Authored by 张文文

字符串截取

... ... @@ -18,6 +18,7 @@ export default class ContentFansListCell extends Component {
let resource = data.isMutualAttention ? require('../../images/content_attentioned.png') : require('../../images/content_fan.png');
let status = data.isMutualAttention ? 1 : 0;
let optUid = data.optUid;
let userName = data.userName.length > 10 ? data.userName.slice(0,10)+'...' : data.userName;
return (
<View>
... ... @@ -28,7 +29,7 @@ export default class ContentFansListCell extends Component {
<View style={styles.textView}>
<TouchableOpacity style={styles.toubleView} activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(data)}>
<Text style={[styles.nicknameText, {maxWidth: width-220}]} numberOfLines={1}>{data.userName}</Text>
<Text style={styles.nicknameText} numberOfLines={1}>{userName}</Text>
<Text style={styles.defaultReplyText}>关注了你</Text>
</TouchableOpacity>
<Text style={styles.startTimeText}>{data.createTime}</Text>
... ... @@ -37,7 +38,7 @@ export default class ContentFansListCell extends Component {
<Image style={styles.fanImage} source={resource}/>
</TouchableOpacity>
</View>
<View style={styles.lineView}/>
{ this.props.showLine ? <View style={styles.lineView}/> : null }
</View>
);
}
... ...
... ... @@ -20,7 +20,7 @@ export default class ContentLikedListCell extends Component {
let picItem = resource ? typeof resource.data === 'string' ? JSON.parse(resource.data) : resource.data : '';
let imageUrl = YH_Image.getSlicedUrl(picItem.src, 50 * DEVICE_HEIGHT_RATIO, 50 * DEVICE_HEIGHT_RATIO, 2);
let userName = rowData.userName.length > 15 ? rowData.userName.slice(0,15)+'...' : rowData.userName;
let subName = '赞了你';
switch (rowData.businessType) {
case 1000:
... ... @@ -51,7 +51,7 @@ export default class ContentLikedListCell extends Component {
<View style={styles.textView}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
<Text style={[styles.nicknameText, {maxWidth: width-80}]} numberOfLines={1}>{rowData.userName}</Text>
<Text style={styles.nicknameText} numberOfLines={1}>{userName}</Text>
</TouchableOpacity>
<Text style={styles.subnameText}>{subName}</Text>
</View>
... ... @@ -68,7 +68,9 @@ export default class ContentLikedListCell extends Component {
<View style={styles.timeView}>
<Text style={styles.startTimeText}>{rowData.createTime}</Text>
</View>
<View style={styles.lineView}/>
{ this.props.showLine ? <View style={styles.lineView}/> : null }
</View>
);
}
... ...
... ... @@ -32,6 +32,7 @@ export default class ContentListView extends Component {
}
_renderRow(rowData, sectionID, rowID) {
let showLine = this.props.contentList.length === +rowID+1 ? false : true;
return (
... ... @@ -41,6 +42,7 @@ export default class ContentListView extends Component {
<ContentLikedListCell
key={'row'+ rowID}
data={rowData}
showLine={showLine}
jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
jumpToGrassDetailPage={this.props.jumpToGrassDetailPage}
/>
... ... @@ -50,6 +52,7 @@ export default class ContentListView extends Component {
<ContentFansListCell
key={'row'+ rowID}
data={rowData}
showLine={showLine}
updateAttentionAction={this.props.updateAttentionAction}
jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
/>
... ...
... ... @@ -21,7 +21,7 @@ export default class ContentMessageCell extends Component {
let picItem = resource ? typeof resource.data === 'string' ? JSON.parse(resource.data) : resource.data : '';
let imageUrl = YH_Image.getSlicedUrl(picItem.src, 50 * DEVICE_HEIGHT_RATIO, 50 * DEVICE_HEIGHT_RATIO, 2);
let userName = rowData.userName.length > 15 ? rowData.userName.slice(0,15)+'...' : rowData.userName;
let subName = '赞了你';
switch (rowData.businessType) {
case 1000:
... ... @@ -52,7 +52,7 @@ export default class ContentMessageCell extends Component {
<View style={styles.textView}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
<Text style={[styles.nicknameText, {maxWidth: width-150}]} numberOfLines={1}>{rowData.userName}</Text>
<Text style={styles.nicknameText} numberOfLines={1}>{userName}</Text>
</TouchableOpacity>
<Text style={styles.subnameText}>{subName}</Text>
</View>
... ... @@ -89,7 +89,9 @@ export default class ContentMessageCell extends Component {
<View style={styles.timeView}>
<Text style={styles.startTimeText}>{rowData.createTime}</Text>
</View>
<View style={styles.lineView}/>
{ this.props.showLine ? <View style={styles.lineView}/> : null }
</View>
);
}
... ...
... ... @@ -25,10 +25,12 @@ export default class ContentMessageView extends Component {
}
_renderRow(rowData, sectionID, rowID) {
let showLine = this.props.commentList.length === +rowID+1 ? false : true;
return (
<ContentMessageCell
key={'row'+ rowID}
rowData={rowData}
showLine={showLine}
jumpToShowKeyboard={this.props.jumpToShowKeyboard}
jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
jumpToGrassDetailPage={this.props.jumpToGrassDetailPage}
... ...