Authored by 张文文

Merge remote-tracking branch 'origin/6.8.7_message' into V6.8.9

... ... @@ -29,6 +29,7 @@ import {
setPlatform,
setHost,
setServiceHost,
setCommunityHost,
} from './reducers/app/appActions';
import {
... ... @@ -62,6 +63,7 @@ export default function native(platform) {
store.dispatch(setPlatform(platform));
store.dispatch(setHost(this.props.host));
store.dispatch(setServiceHost(this.props.serviceHost));
store.dispatch(setCommunityHost(this.props.communityHost));
let type = this.props.type;
if (type == 'main') {
... ...
... ... @@ -19,22 +19,20 @@ export default class ContentFansListCell extends Component {
let status = data.isMutualAttention ? 1 : 0;
let optUid = data.optUid;
function onHeadIconPress() {
}
return (
<View>
<View style={styles.headerBackground}>
<TouchableOpacity activeOpacity={1} onPress={()=> {onHeadIconPress()}}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(data)}>
<YH_Image style={styles.headIcon} url={data.headIco} circle={true}/>
</TouchableOpacity>
<View style={styles.textView}>
<Text>
<Text style={styles.nicknameText}>{data.userName}</Text>
<Text style={styles.defaultReplyText} numberOfLines={2}> 关注了你</Text>
</Text>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(data)}>
<Text>
<Text style={styles.nicknameText}>{data.userName}</Text>
<Text style={styles.defaultReplyText} numberOfLines={1}> 关注了你</Text>
</Text>
</TouchableOpacity>
<Text style={styles.startTimeText}>{data.createTime}</Text>
</View>
<TouchableOpacity activeOpacity={1} style={styles.fanContainer} onPress={()=> {this.props.updateAttentionAction && this.props.updateAttentionAction(status,optUid)}}>
... ...
... ... @@ -40,31 +40,25 @@ export default class ContentLikedListCell extends Component {
subName = '关注了你';
break;
default:
}
function onHeadIconPress() {
}
function onOriginPress() {
}
return (
<View>
<View style={styles.headerBackground}>
<TouchableOpacity activeOpacity={1} onPress={()=> {onHeadIconPress()}}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
<YH_Image style={styles.headIcon} url={rowData.headIco} circle={true}/>
</TouchableOpacity>
<View style={styles.textView}>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
<Text style={styles.nicknameText}>{rowData.userName}</Text>
</TouchableOpacity>
<Text style={styles.subnameText}>{subName}</Text>
</View>
</View>
<TouchableOpacity activeOpacity={1} onPress={() => {onOriginPress()}}>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData)}>
<View style={ styles.originView} >
<Text style={styles.copyText}>原文</Text>
<YH_Image url={imageUrl} style={styles.imageStyle} />
... ...
... ... @@ -33,6 +33,8 @@ export default class ContentListView extends Component {
<ContentLikedListCell
key={'row'+ rowID}
data={rowData}
jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
jumpToGrassDetailPage={this.props.jumpToGrassDetailPage}
/>
:
... ... @@ -41,6 +43,7 @@ export default class ContentListView extends Component {
key={'row'+ rowID}
data={rowData}
updateAttentionAction={this.props.updateAttentionAction}
jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
/>
}
... ...
... ... @@ -13,24 +13,13 @@ export default class ContentMessageCell extends Component {
super(props);
}
componentDidMount() {
}
componentWillUnmount() {
}
onReplyPress(rowData) {
this.props.storeReplySource && this.props.storeReplySource(rowData);
NativeModules.YH_CommonHelper.showkeyBoardView();
}
render() {
let {rowData} = this.props;
let status = rowData.businessType === 1003 ? true : false;
let resource = rowData.coverImg;
resource = resource ? JSON.parse(resource) : '';
let picItem = resource.data ? JSON.parse(resource.data) : '';;
let picItem = resource.data ? JSON.parse(resource.data) : '';
let imageUrl = YH_Image.getSlicedUrl(picItem.src, 50 * DEVICE_HEIGHT_RATIO, 50 * DEVICE_HEIGHT_RATIO, 2);
... ... @@ -58,12 +47,17 @@ export default class ContentMessageCell extends Component {
return (
<View>
<View style={styles.headerBackground}>
<YH_Image style={styles.headIcon} url={rowData.headIco} circle={true}/>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
<YH_Image style={styles.headIcon} url={rowData.headIco} circle={true}/>
</TouchableOpacity>
<View style={styles.textView}>
<Text style={styles.nicknameText}>{rowData.userName}</Text>
<TouchableOpacity activeOpacity={1} onPress={()=> this.props.jumpToPersonalGrassPage && this.props.jumpToPersonalGrassPage(rowData)}>
<Text style={styles.nicknameText}>{rowData.userName}</Text>
</TouchableOpacity>
<Text style={styles.subnameText}>{subName}</Text>
</View>
<TouchableOpacity activeOpacity={1} style={styles.replyContainer} onPress={()=> this.onReplyPress(rowData)}>
<TouchableOpacity activeOpacity={1} style={styles.replyContainer} onPress={()=> this.props.jumpToShowKeyboard && this.props.jumpToShowKeyboard(rowData)}>
<Image style={styles.replyImage} source={require('../../images/content_reply.png')}/>
</TouchableOpacity>
</View>
... ... @@ -74,22 +68,24 @@ export default class ContentMessageCell extends Component {
{ status ?
<View style={styles.ownerReplyView}>
<Text style={{paddingLeft: 10, paddingTop: 14, paddingRight: 1, paddingBottom: 12}}>
<Text style={styles.replyText}>我的评论:</Text>
<Text style={styles.defaultReplyText} numberOfLines={2}>{rowData.parentCommentContent}</Text>
</Text>
</View>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData)}>
<View style={styles.ownerReplyView}>
<Text style={{paddingLeft: 10, paddingTop: 14, paddingRight: 1, paddingBottom: 12}}>
<Text style={styles.replyText}>我的评论:</Text>
<Text style={styles.defaultReplyText} numberOfLines={2}>{rowData.parentCommentContent}</Text>
</Text>
</View>
</TouchableOpacity>
:
<TouchableOpacity activeOpacity={1} onPress={() => {}}>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData)}>
<View style={ styles.originContainerView} >
<Text style={styles.copyText}>原文</Text>
<YH_Image url={imageUrl} style={styles.imageStyle} />
<Text style={styles.originText} numberOfLines={1}>{rowData.content}</Text>
</View>
</TouchableOpacity>}
</TouchableOpacity> }
<View style={styles.timeView}>
<Text style={styles.startTimeText}>{rowData.createTime}</Text>
... ...
... ... @@ -28,7 +28,9 @@ export default class ContentMessageView extends Component {
<ContentMessageCell
key={'row'+ rowID}
rowData={rowData}
storeReplySource={this.props.storeReplySource}
jumpToShowKeyboard={this.props.jumpToShowKeyboard}
jumpToPersonalGrassPage={this.props.jumpToPersonalGrassPage}
jumpToGrassDetailPage={this.props.jumpToGrassDetailPage}
/>
);
}
... ...
... ... @@ -6,6 +6,7 @@ export default keyMirror({
SET_HOST: null,
SET_SERVICE_HOST: null,
SET_CHANNEL: null,
SET_COMMUNITY_HOST: null,
LATEST_MESSAGE_REQUEST: null,
LATEST_MESSAGE_SUCCESS: null,
... ...
... ... @@ -25,6 +25,7 @@ function mapStateToProps(state) {
contentList: state.content.contentList.get('list').toJS(),
isPullToRefresh: state.content.contentList.get('isPullToRefresh'),
shouldShowEmpty: state.content.contentList.get('shouldShowEmpty'),
communityHost: state.app.communityHost,
};
}
... ... @@ -48,6 +49,8 @@ class ContentListContainer extends Component {
this._updateAttentionAction = this._updateAttentionAction.bind(this);
this._onRefresh = this._onRefresh.bind(this);
this._onEndReached = this._onEndReached.bind(this);
this._jumpToPersonalGrassPage = this._jumpToPersonalGrassPage.bind(this);
this._jumpToGrassDetailPage = this._jumpToGrassDetailPage.bind(this);
}
_updateAttentionAction(status, optUid) {
... ... @@ -70,6 +73,59 @@ class ContentListContainer extends Component {
this.props.actions.clearOtherMessage()
}
//跳转到种草H5
_jumpToPersonalGrassPage(rowData) {
let {communityHost} = this.props
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/author/${1}/${rowData.optUid}`
let action, params;
if(Platform.OS === 'ios') {
action = 'go.h5hn';
params = {
url,
headerid: -1,
}
} else {
action = 'go.h5';
params = {
url,
param : { headerid: "-1" }
}
}
let jumpParams = {
action,
params
}
let path = 'http://m.yohobuy.com?openby:yohobuy=' + JSON.stringify(jumpParams);
NativeModules.YH_CommonHelper.jumpWithUrl(path);
}
_jumpToGrassDetailPage(rowData) {
let {communityHost} = this.props
let url = communityHost + '/grass/article' + `/detail/${rowData.articleId}`
let action, params;
if(Platform.OS === 'ios') {
action = 'go.h5hn';
params = {
url,
headerid: -1,
}
} else {
action = 'go.h5';
params = {
url,
param : { headerid: "-1" }
}
}
let jumpParams = {
action,
params
}
let path = 'http://m.yohobuy.com?openby:yohobuy=' + JSON.stringify(jumpParams);
NativeModules.YH_CommonHelper.jumpWithUrl(path);
}
render() {
return (
<View style={styles.container}>
... ... @@ -86,6 +142,8 @@ class ContentListContainer extends Component {
onRefresh={this._onRefresh}
onEndReached={this._onEndReached}
updateAttentionAction={this._updateAttentionAction}
jumpToPersonalGrassPage={this._jumpToPersonalGrassPage}
jumpToGrassDetailPage={this._jumpToGrassDetailPage}
/>
</View>
... ...
... ... @@ -26,6 +26,7 @@ function mapStateToProps(state) {
isPullToRefresh: state.content.commentList.get('isPullToRefresh'),
contentTipFlag: state.content.contentTipFlag,
tipMessage: state.content.tipMessage,
communityHost: state.app.communityHost,
};
}
... ... @@ -52,8 +53,10 @@ class ContentMessageContainer extends Component {
this._onRefresh = this._onRefresh.bind(this);
this._onEndReached = this._onEndReached.bind(this);
this._storeReplySource = this._storeReplySource.bind(this);
this._onHiddenTipMessage = this._onHiddenTipMessage.bind(this);
this._jumpToShowKeyboard = this._jumpToShowKeyboard.bind(this);
this._jumpToPersonalGrassPage = this._jumpToPersonalGrassPage.bind(this);
this._jumpToGrassDetailPage = this._jumpToGrassDetailPage.bind(this);
}
componentDidMount() {
... ... @@ -90,14 +93,70 @@ class ContentMessageContainer extends Component {
this.props.actions.addArticleCommentAction(addValue, destId, commentId, addType, columnType);
}
_storeReplySource(dataSource) {
_onHiddenTipMessage() {
this.props.actions.hiddenTipMessage();
}
_jumpToShowKeyboard(dataSource) {
this.setState({
dataSource: dataSource,
});
NativeModules.YH_CommonHelper.showkeyBoardView();
}
_onHiddenTipMessage() {
this.props.actions.hiddenTipMessage();
//跳转到种草H5
_jumpToPersonalGrassPage(rowData) {
let {communityHost} = this.props
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/author/${1}/${rowData.optUid}`
let action, params;
if(Platform.OS === 'ios') {
action = 'go.h5hn';
params = {
url,
headerid: -1,
}
} else {
action = 'go.h5';
params = {
url,
param : { headerid: "-1" }
}
}
let jumpParams = {
action,
params
}
let path = 'http://m.yohobuy.com?openby:yohobuy=' + JSON.stringify(jumpParams);
NativeModules.YH_CommonHelper.jumpWithUrl(path);
}
_jumpToGrassDetailPage(rowData) {
let {communityHost} = this.props
let url = communityHost + '/grass/article' + `/detail/${rowData.articleId}`
let action, params;
if(Platform.OS === 'ios') {
action = 'go.h5hn';
params = {
url,
headerid: -1,
}
} else {
action = 'go.h5';
params = {
url,
param : { headerid: "-1" }
}
}
let jumpParams = {
action,
params
}
let path = 'http://m.yohobuy.com?openby:yohobuy=' + JSON.stringify(jumpParams);
NativeModules.YH_CommonHelper.jumpWithUrl(path);
}
render() {
... ... @@ -122,8 +181,10 @@ class ContentMessageContainer extends Component {
tipMessage={tipMessage}
onRefresh={this._onRefresh}
onEndReached={this._onEndReached}
storeReplySource={this._storeReplySource}
onHiddenTipMessage={this._onHiddenTipMessage}
jumpToShowKeyboard={this._jumpToShowKeyboard}
jumpToPersonalGrassPage={this._jumpToPersonalGrassPage}
jumpToGrassDetailPage={this._jumpToGrassDetailPage}
/>
</View>
)
... ...
... ... @@ -3,10 +3,11 @@
import ReactNative from 'react-native';
const {
SET_PLATFORM,
SET_CHANNEL,
SET_PLATFORM,
SET_CHANNEL,
SET_HOST,
SET_SERVICE_HOST,
SET_COMMUNITY_HOST,
} = require('../../constants/actionTypes').default;
export function setPlatform(platform) {
... ... @@ -35,4 +36,11 @@ export function setServiceHost(host) {
type: SET_SERVICE_HOST,
payload: host
};
}
\ No newline at end of file
}
export function setCommunityHost(host) {
return {
type: SET_COMMUNITY_HOST,
payload: host
}
}
... ...
... ... @@ -7,6 +7,7 @@ let InitialState = Record({
channel: 1, // 1 - boy, 2 - girl, 3 - kid, 4 - lifestyle, 5 - yoho
host: 'http://api.yoho.cn',
serviceHost: 'http://api.yoho.cn',
communityHost: '',
});
export default InitialState;
... ...
... ... @@ -7,6 +7,7 @@ const {
SET_CHANNEL,
SET_HOST,
SET_SERVICE_HOST,
SET_COMMUNITY_HOST,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -23,6 +24,8 @@ export default function appReducer(state = initialState, action) {
return state.set('host', action.payload);
case SET_SERVICE_HOST:
return state.set('serviceHost', action.payload);
case SET_COMMUNITY_HOST:
return state.set('communityHost', action.payload);
}
return state;
... ...