Authored by 张文文

新站内信通知 reviewd by 朱傲哲

... ... @@ -12,6 +12,8 @@ import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';
import ContentEmptyView from './ContentEmptyView'
import ContentLikedListCell from './ContentLikedListCell'
import ContentFansListCell from './ContentFansListCell'
import ContentNotifyListCell from './ContentNotifyListCell'
export default class ContentListView extends Component {
constructor(props) {
... ... @@ -25,9 +27,10 @@ export default class ContentListView extends Component {
}
_renderFooter(){
_renderFooter() {
let backgroundColor = this.props.contentListId === '3' ? '#f2f2f2' : '#ffffff';
return (
<View style={[{height: 50}, {backgroundColor: 'white'}, {justifyContent:'center'}]}>
<View style={[{height: 50}, {backgroundColor: backgroundColor}, {justifyContent:'center'}]}>
</View>
)
}
... ... @@ -35,37 +38,59 @@ export default class ContentListView extends Component {
_renderRow(rowData, sectionID, rowID) {
let showLine = this.props.contentList.length === +rowID+1 ? false : true;
return (
<View>
switch (this.props.contentListId) {
case '1':
{
return(
<ContentLikedListCell
key={'row'+ rowID}
data={rowData}
showLine={showLine}
jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
jumpToGrassDetailPage={this.props.jumpToGrassDetailPage}
/>
);
}
{ this.props.contentListId === '1' ?
<ContentLikedListCell
key={'row'+ rowID}
data={rowData}
showLine={showLine}
jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
jumpToGrassDetailPage={this.props.jumpToGrassDetailPage}
/>
break;
case '2':
{
return(
<ContentFansListCell
key={'row'+ rowID}
data={rowData}
showLine={showLine}
updateAttentionAction={this.props.updateAttentionAction}
jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
/>
);
}
:
break;
<ContentFansListCell
key={'row'+ rowID}
data={rowData}
showLine={showLine}
updateAttentionAction={this.props.updateAttentionAction}
jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
/>
}
case '3':
{
return(
<ContentNotifyListCell
itemData={rowData}
onPressListItem={(itemData) => {
this.props.onPressListItem && this.props.onPressListItem(itemData, rowID)
}
}
/>
);
}
</View>
break;
default:
);
}
}
render() {
let {contentList, isPullToRefresh, shouldShowEmpty} = this.props;
let backgroundColor = this.props.contentListId === '3' ? '#f2f2f2' : '#ffffff';
if (shouldShowEmpty) {
return (
... ... @@ -78,7 +103,7 @@ export default class ContentListView extends Component {
}
return (
<View style={styles.container}>
<View style={[styles.container, {backgroundColor: backgroundColor}]}>
{
Platform.OS === 'ios' ?
<ListView
... ... @@ -139,7 +164,6 @@ export default class ContentListView extends Component {
let styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
contentContainer: {
},
... ...
/**
* Created by zzz on 2019/5/21.
*/
'use strict';
import React, {Component} from 'react';
import {Dimensions, Image, ListView, StyleSheet, Text, TouchableOpacity, View, NativeModules} from 'react-native';
import {Immutable} from "immutable";
import YH_Image from '../../../common/components/YH_Image';
import SlicedImage from '../../../common/components/SlicedImage'
export default class ContentNotifyListCell extends Component {
constructor(props) {
super(props);
}
render() {
let imageUri = 'http://img10.static.yhbimg.com/couponImg/2017/02/23/16/0199db13b531e2ae5b4c69fa34c198c902.png?imageView/{mode}/w/{width}/h/{height}';
imageUri = SlicedImage.getSlicedUrl(imageUri, 50, 50, 2);
let {itemData} = this.props;
return (
<View style= {styles.cellContainer}>
<View style={styles.headContainer}>
<Text style={styles.headTextStyle}>
今天 12:03
</Text>
<View style={[styles.headSeparator]}/>
</View>
<View style={styles.editContainer}>
<TouchableOpacity
activeOpacity={1}
onLongPress={() =>{
this.props.onLongPressListItem && this.props.onLongPressListItem(itemData);
}}
onPress={() =>{
this.props.onPressListItem && this.props.onPressListItem(itemData);
}}
>
<View style={styles.contentContainer}>
<View style={styles.descStyle}>
<Image
style={styles.iconStyle}
source={{uri: imageUri}}
resizeMode="contain"
/>
<View style={styles.textContainer}>
<Text
style={styles.detail}
numberOfLines={2}
>
恭喜您!您发布的内容为优质内容,获得有货社区重点推荐
</Text>
</View>
</View>
</View>
</TouchableOpacity>
<TouchableOpacity
activeOpacity={1}
onPress={() => {
this.props.onPressListItem && this.props.onPressListItem(itemData)
}
}
>
<View style={styles.footContainer}>
<View style={styles.footSeparator} />
<View style={styles.footextContainer}>
<Text style={styles.footextStyle}>
查看原文
</Text>
</View>
</View>
</TouchableOpacity>
</View>
</View>
);
}
}
let { width, height } = Dimensions.get('window');
const DEVICE_HEIGHT_RATIO = height / 667;
let styles = StyleSheet.create({
cellContainer: {
backgroundColor: 'transparent',
flexDirection: 'column',
justifyContent: 'flex-start',
},
headContainer: {
flexDirection: 'column',
width,
height: 40,
backgroundColor: '#f2f2f2',
},
headTextStyle: {
fontSize: 13,
backgroundColor: 'transparent',
color: '#b0b0b0',
textAlign: 'center',
marginTop: 13
},
headSeparator: {
marginTop: 10.5,
backgroundColor: '#e0e0e0',
width,
height: 0.5,
},
editContainer: {
backgroundColor: 'white',
width
},
contentContainer: {
flex: 1,
minHeight: 71,
flexDirection: 'column',
backgroundColor: 'white',
justifyContent: 'center'
},
descStyle:{
flexDirection: 'row',
backgroundColor: 'white',
alignItems: 'center',
},
iconStyle: {
marginLeft: 15,
width: 50,
height: 50
},
textContainer: {
flex: 1,
flexDirection: 'column',
justifyContent: 'space-between',
alignItems: 'flex-start',
},
titleStyle: {
marginLeft: 10,
fontSize: 13,
fontWeight: 'bold',
color: '#444444',
marginRight: 15,
backgroundColor: 'transparent'
},
detail:{
marginLeft: 10,
fontSize: 13,
fontWeight: 'bold',
color: '#444444',
maxWidth: width-15-50-10-22,
lineHeight: 18,
backgroundColor: 'transparent'
},
footContainer: {
flexDirection: 'column',
height: 44,
backgroundColor: 'white',
width
},
footSeparator: {
marginLeft: 15,
height: 0.5,
width: width-15,
backgroundColor: '#e0e0e0'
},
footextContainer: {
flexDirection: 'row',
justifyContent: 'space-between',
height: 43,
width,
backgroundColor: 'white',
alignItems: 'center'
},
footextStyle: {
marginLeft: 15,
color: '#444444',
backgroundColor: 'transparent',
textAlign: 'left',
fontSize: 14,
fontWeight: 'bold'
},
});
... ...
... ... @@ -51,6 +51,7 @@ class ContentListContainer extends Component {
this._onEndReached = this._onEndReached.bind(this);
this._jumpToPersonalGrassPage = this._jumpToPersonalGrassPage.bind(this);
this._jumpToGrassDetailPage = this._jumpToGrassDetailPage.bind(this);
this._onPressListItem = this._onPressListItem.bind(this);
}
_updateAttentionAction(status, optUid) {
... ... @@ -73,6 +74,10 @@ class ContentListContainer extends Component {
this.props.actions.clearOtherMessage()
}
_onPressListItem(itemData, rowID) {
console.log('查看原文');
}
//跳转到种草H5
_jumpToPersonalGrassPage(optUid) {
let {communityHost} = this.props
... ... @@ -106,7 +111,7 @@ class ContentListContainer extends Component {
}
let {communityHost} = this.props
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/article/detail/${articleId}`+ `?commentId=${rootCommentId}`
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/article/detail/${articleId}`
let action, params;
if(Platform.OS === 'ios') {
action = 'go.h5';
... ... @@ -147,6 +152,7 @@ class ContentListContainer extends Component {
updateAttentionAction={this._updateAttentionAction}
jumpToPersonalGrassPage={this._jumpToPersonalGrassPage}
jumpToGrassDetailPage={this._jumpToGrassDetailPage}
onPressListItem={this._onPressListItem}
/>
</View>
... ...