Skip to content

Commit

Permalink
modify comment display format
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiJiaW committed Oct 31, 2017
1 parent 630c371 commit 826cbe4
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 11 deletions.
16 changes: 8 additions & 8 deletions CnBlogAndroid/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import api from './Source/api/api.js';
import {authData} from './Source/config'
import * as Service from './Source/request/request.js'
import React, { Component } from 'react';
import
import {
Platform,
StyleSheet,
Text,
Expand All @@ -13,7 +13,8 @@ import
TouchableOpacity,
Image,
TextInput,
Dimensions,} from 'react-native';
Dimensions,
} from 'react-native';
import {
StackNavigator,
TabNavigator,
Expand All @@ -27,12 +28,11 @@ import UserInformation from './Source/screens/UserInformation'
import ClassHome from './Source/screens/ClassHome'
import HomeworkPost from './Source/screens/HomeworkPost'
import BlogDetail from './Source/screens/BlogDetail'
import PersonalSettings from './Source/screens/PersonalSettings'
import ClassCreate from './Source/screens/ClassCreate'
import BlogComment from './Source/screens/BlogComment'
import ClassMember from './Source/screens/ClassMember'
import MemberBlog from './Source/screens/MemberBlog'

import ClassCreate from './Source/screens/ClassCreate'
import PersonalSettings from './Source/screens/PersonalSettings'
const { height, width } = Dimensions.get('window');
class App extends Component {
render() {
Expand All @@ -46,7 +46,7 @@ class App extends Component {
}
// 在App中调用的登录界面组件
class Loginer extends Component{
constructor(props)
constructor(props){
super(props);
this.state = {
username: '',
Expand Down Expand Up @@ -194,7 +194,7 @@ const HomeTab = TabNavigator({
},
})

const SimpleNavigation = StackNavigator({
const SimpleNavigation = StackNavigator({
Home: {
screen: App,
navigationOptions: {
Expand Down Expand Up @@ -264,7 +264,7 @@ const SimpleNavigation = StackNavigator({
height: 40,
backgroundColor: 'rgb(51,204,255)',
}
}
}
},
AfterloginTab: {
screen: HomeTab,
Expand Down
Binary file added CnBlogAndroid/Source/images/calender.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 30 additions & 1 deletion CnBlogAndroid/Source/screens/BlogComment.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,35 @@ const screenWidth= MyAdapter.screenWidth;
const screenHeight= MyAdapter.screenHeight;
// 博客评论页面
// 接受评论数量 CommentCount 和 博客名 blogApp 以及博文Id作为参数
// 这里定义一个用于粗略解决返回的评论字符串内包含无法解析的html标签的函数
function CommemtHandler(data){
var s = data.split('');
var result = '';
var tag = 0;
for(var i in s)
{
if(s[i]=='>')
{
tag = 0;
if(s[i-1]=='/'&&s[i-2]=='r')
{
result+='\n';
}
continue;
}
if(s[i]=='<'||tag==1)
{
tag = 1;
continue;
}
if(s[i]=='引'||(s[i]=='用'&&s[i-1]=='引'))
{
continue;
}
result+=s[i];
}
return result;
}
export default class BlogComment extends Component{
constructor(props){
super(props);
Expand Down Expand Up @@ -53,7 +82,7 @@ export default class BlogComment extends Component{
</View>
<View style = {styles.textcontainer}>
<Text style = {{fontSize: 15, fontWeight: 'bold', color: 'black'}}>{Author}</Text>
<Text style = {{color: 'black', fontSize: 12}}>{Body}</Text>
<Text style = {{color: 'black', fontSize: 12}}>{CommemtHandler(Body)}</Text>
<View style = {{
flexDirection: 'row',
justifyContent: 'space-around',
Expand Down
2 changes: 1 addition & 1 deletion CnBlogAndroid/Source/screens/ClassHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export default class ClassHome extends Component{
width: 0.1*screenHeight,
height: 0.1*screenHeight
}}
source={require('../images/calendar.png')}
source={require('../images/calender.png')}
/>
</TouchableHighlight>
<TouchableHighlight
Expand Down
2 changes: 1 addition & 1 deletion CnBlogAndroid/Source/screens/ClassLists.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class ClassLists extends Component{
padding: 0.01*screenHeight,
backgroundColor:"#0588fe"
}}
onPress={() => this.props.navigation.navigate('ClassCreate')}//关联函数
onPress={this._onPress}//关联函数
>
<Text
style= {{
Expand Down

0 comments on commit 826cbe4

Please sign in to comment.