Authored by 张文文

字符串截取

@@ -18,6 +18,7 @@ export default class ContentFansListCell extends Component { @@ -18,6 +18,7 @@ export default class ContentFansListCell extends Component {
18 let resource = data.isMutualAttention ? require('../../images/content_attentioned.png') : require('../../images/content_fan.png'); 18 let resource = data.isMutualAttention ? require('../../images/content_attentioned.png') : require('../../images/content_fan.png');
19 let status = data.isMutualAttention ? 1 : 0; 19 let status = data.isMutualAttention ? 1 : 0;
20 let optUid = data.optUid; 20 let optUid = data.optUid;
  21 + let userName = data.userName.length > 10 ? data.userName.slice(0,10)+'...' : data.userName;
21 22
22 return ( 23 return (
23 <View> 24 <View>
@@ -28,7 +29,7 @@ export default class ContentFansListCell extends Component { @@ -28,7 +29,7 @@ export default class ContentFansListCell extends Component {
28 29
29 <View style={styles.textView}> 30 <View style={styles.textView}>
30 <TouchableOpacity style={styles.toubleView} activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(data)}> 31 <TouchableOpacity style={styles.toubleView} activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(data)}>
31 - <Text style={[styles.nicknameText, {maxWidth: width-220}]} numberOfLines={1}>{data.userName}</Text> 32 + <Text style={styles.nicknameText} numberOfLines={1}>{userName}</Text>
32 <Text style={styles.defaultReplyText}>关注了你</Text> 33 <Text style={styles.defaultReplyText}>关注了你</Text>
33 </TouchableOpacity> 34 </TouchableOpacity>
34 <Text style={styles.startTimeText}>{data.createTime}</Text> 35 <Text style={styles.startTimeText}>{data.createTime}</Text>
@@ -37,7 +38,7 @@ export default class ContentFansListCell extends Component { @@ -37,7 +38,7 @@ export default class ContentFansListCell extends Component {
37 <Image style={styles.fanImage} source={resource}/> 38 <Image style={styles.fanImage} source={resource}/>
38 </TouchableOpacity> 39 </TouchableOpacity>
39 </View> 40 </View>
40 - <View style={styles.lineView}/> 41 + { this.props.showLine ? <View style={styles.lineView}/> : null }
41 </View> 42 </View>
42 ); 43 );
43 } 44 }
@@ -20,7 +20,7 @@ export default class ContentLikedListCell extends Component { @@ -20,7 +20,7 @@ export default class ContentLikedListCell extends Component {
20 let picItem = resource ? typeof resource.data === 'string' ? JSON.parse(resource.data) : resource.data : ''; 20 let picItem = resource ? typeof resource.data === 'string' ? JSON.parse(resource.data) : resource.data : '';
21 21
22 let imageUrl = YH_Image.getSlicedUrl(picItem.src, 50 * DEVICE_HEIGHT_RATIO, 50 * DEVICE_HEIGHT_RATIO, 2); 22 let imageUrl = YH_Image.getSlicedUrl(picItem.src, 50 * DEVICE_HEIGHT_RATIO, 50 * DEVICE_HEIGHT_RATIO, 2);
23 - 23 + let userName = rowData.userName.length > 15 ? rowData.userName.slice(0,15)+'...' : rowData.userName;
24 let subName = '赞了你'; 24 let subName = '赞了你';
25 switch (rowData.businessType) { 25 switch (rowData.businessType) {
26 case 1000: 26 case 1000:
@@ -51,7 +51,7 @@ export default class ContentLikedListCell extends Component { @@ -51,7 +51,7 @@ export default class ContentLikedListCell extends Component {
51 51
52 <View style={styles.textView}> 52 <View style={styles.textView}>
53 <TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}> 53 <TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
54 - <Text style={[styles.nicknameText, {maxWidth: width-80}]} numberOfLines={1}>{rowData.userName}</Text> 54 + <Text style={styles.nicknameText} numberOfLines={1}>{userName}</Text>
55 </TouchableOpacity> 55 </TouchableOpacity>
56 <Text style={styles.subnameText}>{subName}</Text> 56 <Text style={styles.subnameText}>{subName}</Text>
57 </View> 57 </View>
@@ -68,7 +68,9 @@ export default class ContentLikedListCell extends Component { @@ -68,7 +68,9 @@ export default class ContentLikedListCell extends Component {
68 <View style={styles.timeView}> 68 <View style={styles.timeView}>
69 <Text style={styles.startTimeText}>{rowData.createTime}</Text> 69 <Text style={styles.startTimeText}>{rowData.createTime}</Text>
70 </View> 70 </View>
71 - <View style={styles.lineView}/> 71 +
  72 + { this.props.showLine ? <View style={styles.lineView}/> : null }
  73 +
72 </View> 74 </View>
73 ); 75 );
74 } 76 }
@@ -32,6 +32,7 @@ export default class ContentListView extends Component { @@ -32,6 +32,7 @@ export default class ContentListView extends Component {
32 } 32 }
33 33
34 _renderRow(rowData, sectionID, rowID) { 34 _renderRow(rowData, sectionID, rowID) {
  35 + let showLine = this.props.contentList.length === +rowID+1 ? false : true;
35 36
36 return ( 37 return (
37 38
@@ -41,6 +42,7 @@ export default class ContentListView extends Component { @@ -41,6 +42,7 @@ export default class ContentListView extends Component {
41 <ContentLikedListCell 42 <ContentLikedListCell
42 key={'row'+ rowID} 43 key={'row'+ rowID}
43 data={rowData} 44 data={rowData}
  45 + showLine={showLine}
44 jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage} 46 jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
45 jumpToGrassDetailPage={this.props.jumpToGrassDetailPage} 47 jumpToGrassDetailPage={this.props.jumpToGrassDetailPage}
46 /> 48 />
@@ -50,6 +52,7 @@ export default class ContentListView extends Component { @@ -50,6 +52,7 @@ export default class ContentListView extends Component {
50 <ContentFansListCell 52 <ContentFansListCell
51 key={'row'+ rowID} 53 key={'row'+ rowID}
52 data={rowData} 54 data={rowData}
  55 + showLine={showLine}
53 updateAttentionAction={this.props.updateAttentionAction} 56 updateAttentionAction={this.props.updateAttentionAction}
54 jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage} 57 jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
55 /> 58 />
@@ -21,7 +21,7 @@ export default class ContentMessageCell extends Component { @@ -21,7 +21,7 @@ export default class ContentMessageCell extends Component {
21 let picItem = resource ? typeof resource.data === 'string' ? JSON.parse(resource.data) : resource.data : ''; 21 let picItem = resource ? typeof resource.data === 'string' ? JSON.parse(resource.data) : resource.data : '';
22 22
23 let imageUrl = YH_Image.getSlicedUrl(picItem.src, 50 * DEVICE_HEIGHT_RATIO, 50 * DEVICE_HEIGHT_RATIO, 2); 23 let imageUrl = YH_Image.getSlicedUrl(picItem.src, 50 * DEVICE_HEIGHT_RATIO, 50 * DEVICE_HEIGHT_RATIO, 2);
24 - 24 + let userName = rowData.userName.length > 15 ? rowData.userName.slice(0,15)+'...' : rowData.userName;
25 let subName = '赞了你'; 25 let subName = '赞了你';
26 switch (rowData.businessType) { 26 switch (rowData.businessType) {
27 case 1000: 27 case 1000:
@@ -52,7 +52,7 @@ export default class ContentMessageCell extends Component { @@ -52,7 +52,7 @@ export default class ContentMessageCell extends Component {
52 52
53 <View style={styles.textView}> 53 <View style={styles.textView}>
54 <TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}> 54 <TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
55 - <Text style={[styles.nicknameText, {maxWidth: width-150}]} numberOfLines={1}>{rowData.userName}</Text> 55 + <Text style={styles.nicknameText} numberOfLines={1}>{userName}</Text>
56 </TouchableOpacity> 56 </TouchableOpacity>
57 <Text style={styles.subnameText}>{subName}</Text> 57 <Text style={styles.subnameText}>{subName}</Text>
58 </View> 58 </View>
@@ -89,7 +89,9 @@ export default class ContentMessageCell extends Component { @@ -89,7 +89,9 @@ export default class ContentMessageCell extends Component {
89 <View style={styles.timeView}> 89 <View style={styles.timeView}>
90 <Text style={styles.startTimeText}>{rowData.createTime}</Text> 90 <Text style={styles.startTimeText}>{rowData.createTime}</Text>
91 </View> 91 </View>
92 - <View style={styles.lineView}/> 92 +
  93 + { this.props.showLine ? <View style={styles.lineView}/> : null }
  94 +
93 </View> 95 </View>
94 ); 96 );
95 } 97 }
@@ -25,10 +25,12 @@ export default class ContentMessageView extends Component { @@ -25,10 +25,12 @@ export default class ContentMessageView extends Component {
25 } 25 }
26 26
27 _renderRow(rowData, sectionID, rowID) { 27 _renderRow(rowData, sectionID, rowID) {
  28 + let showLine = this.props.commentList.length === +rowID+1 ? false : true;
28 return ( 29 return (
29 <ContentMessageCell 30 <ContentMessageCell
30 key={'row'+ rowID} 31 key={'row'+ rowID}
31 rowData={rowData} 32 rowData={rowData}
  33 + showLine={showLine}
32 jumpToShowKeyboard={this.props.jumpToShowKeyboard} 34 jumpToShowKeyboard={this.props.jumpToShowKeyboard}
33 jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage} 35 jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
34 jumpToGrassDetailPage={this.props.jumpToGrassDetailPage} 36 jumpToGrassDetailPage={this.props.jumpToGrassDetailPage}