Authored by 张文文

站内信删除跳转异常处理 reviewd by 朱傲哲

... ... @@ -59,7 +59,10 @@ export default class ContentLikedListCell extends Component {
</View>
</View>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData.articleId, rowData.rootCommentId)}>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData.articleId, rowData.rootCommentId, rowData.isDelete)}>
{ rowData.isDelete === 'N' ?
<View style={ styles.originView} >
<Text style={styles.copyText}>原文</Text>
<YH_Image url={imageUrl} style={styles.imageStyle} />
... ... @@ -68,8 +71,14 @@ export default class ContentLikedListCell extends Component {
:
<View style={{height: 5}} />
}
</View>
:
<View style={ styles.originView} >
<Text style={styles.deleteText} numberOfLines={1}>{'原文已被作者删除'}</Text>
</View> }
</TouchableOpacity>
<View style={styles.timeView}>
... ... @@ -166,4 +175,13 @@ let styles = StyleSheet.create({
height: 0.5,
backgroundColor: '#e0e0e0'
},
deleteText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#b0b0b0',
marginLeft: 9,
marginRight: 16,
marginTop: 10,
marginBottom: 10
},
});
... ...
... ... @@ -69,7 +69,7 @@ export default class ContentMessageCell extends Component {
{ status ?
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData.articleId, rowData.rootCommentId)}>
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData.articleId, rowData.rootCommentId, rowData.isDelete, status)}>
<View style={styles.ownerReplyView}>
<Text style={{paddingLeft: 10, paddingTop: 14, paddingRight: 1, paddingBottom: 12}} numberOfLines={3}>
<Text style={styles.replyText}>我的评论:</Text>
... ... @@ -80,22 +80,32 @@ export default class ContentMessageCell extends Component {
:
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData.articleId, rowData.rootCommentId)}>
<View style={ styles.originContainerView} >
<Text style={styles.copyText}>原文</Text>
{ imageUrl ? <YH_Image url={imageUrl} style={styles.imageStyle} /> : null }
<TouchableOpacity activeOpacity={1} onPress={() => this.props.jumpToGrassDetailPage && this.props.jumpToGrassDetailPage(rowData.articleId, rowData.rootCommentId, rowData.isDelete, status)}>
{ rowData.isDelete === 'N' ?
<View style={ styles.originContainerView} >
<Text style={styles.copyText}>原文</Text>
{ imageUrl ? <YH_Image url={imageUrl} style={styles.imageStyle} /> : null }
{rowData.content ?
{rowData.content ?
<Text style={styles.originText} numberOfLines={1}>
<Text>{rowData.content}</Text>
<Text>{'...'}</Text>
</Text>
:
<View style={{height: 5}} />
}
<Text style={styles.originText} numberOfLines={1}>
<Text>{contents}</Text>
<Text>{'...'}</Text>
</Text>
:
<View style={{height: 5}} />
}
</View>
:
<View style={ styles.originContainerView} >
<Text style={styles.deleteText} numberOfLines={1}>{'原文已被作者删除'}</Text>
</View>
}
</TouchableOpacity> }
<View style={styles.timeView}>
... ... @@ -209,6 +219,15 @@ let styles = StyleSheet.create({
marginRight: 16,
marginBottom: 9,
},
deleteText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#b0b0b0',
marginLeft: 9,
marginRight: 16,
marginTop: 10,
marginBottom: 10
},
timeView: {
alignItems: 'flex-start',
marginBottom: 10,
... ...
... ... @@ -96,7 +96,7 @@ export default class ContentMessageView extends Component {
}
render() {
let {commentList, isPullToRefresh, tipMessage} = this.props;
let {commentList, isPullToRefresh, tipMessage, isShowToast, toastMessage} = this.props;
return (
<View style={styles.container}>
... ... @@ -164,6 +164,12 @@ export default class ContentMessageView extends Component {
: null
}
{isShowToast ? <Prompt
text={toastMessage}
duration={3000}
onPromptHidden={this.props.hideToastMessage}
/> : null}
</View>
);
}
... ...
... ... @@ -62,4 +62,7 @@ export default keyMirror({
MESSAGE_CLEAR_COMMENT_LIST: null,
CLEAR_BADGE_NUM_SUCCESS: null,
UPDATE_TIP_FLAG_SUCCESS: null,
SHOW_TOAST: null,
HIDE_TOAST: null,
});
... ...
... ... @@ -100,9 +100,12 @@ class ContentListContainer extends Component {
NativeModules.YH_CommonHelper.jumpWithUrl(path);
}
_jumpToGrassDetailPage(articleId, rootCommentId) {
let {communityHost} = this.props
_jumpToGrassDetailPage(articleId, rootCommentId, isDelete) {
if (isDelete === 'Y') {
return;
}
let {communityHost} = this.props
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/article/detail/${articleId}`+ `?commentId=${rootCommentId}`
let action, params;
if(Platform.OS === 'ios') {
... ...
... ... @@ -29,6 +29,8 @@ function mapStateToProps(state) {
contentTipFlag: state.content.contentTipFlag,
tipMessage: state.content.tipMessage,
communityHost: state.app.communityHost,
toastMessage: state.content.toastMessage,
isShowToast: state.content.isShowToast,
};
}
... ... @@ -55,6 +57,8 @@ class ContentMessageContainer extends Component {
this._jumpToPersonalGrassPage = this._jumpToPersonalGrassPage.bind(this);
this._jumpToGrassDetailPage = this._jumpToGrassDetailPage.bind(this);
this._onPressTabAction = this._onPressTabAction.bind(this);
this._hideToastMessage = this._hideToastMessage.bind(this);
this.subscription = NativeAppEventEmitter.addListener(
'YHUpdateAuthStatusEvent',
... ... @@ -103,6 +107,10 @@ class ContentMessageContainer extends Component {
});
}
_hideToastMessage() {
this.props.actions.hideToastMessage();
}
//跳转到种草H5
_jumpToPersonalGrassPage(optUid) {
... ... @@ -131,31 +139,38 @@ class ContentMessageContainer extends Component {
NativeModules.YH_CommonHelper.jumpWithUrl(path);
}
_jumpToGrassDetailPage(articleId, rootCommentId) {
let {communityHost} = this.props
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/article/detail/${articleId}`+ `?commentId=${rootCommentId}`
let action, params;
if(Platform.OS === 'ios') {
action = 'go.h5';
params = {
url,
param : { headerid: "-1", toplayoutByH5: 'Y' }
}
} else {
action = 'go.h5';
params = {
url,
param : { headerid: "-1", toplayoutByH5: 'Y' }
}
}
let jumpParams = {
action,
params
}
let path = 'http://m.yohobuy.com?openby:yohobuy=' + JSON.stringify(jumpParams);
NativeModules.YH_CommonHelper.jumpWithUrl(path);
_jumpToGrassDetailPage(articleId, rootCommentId, isDelete, status) {
if (isDelete === 'Y') {
if (status) {
this.props.actions.showToastMessage('原文已被作者删除');
}
return;
}
let {communityHost} = this.props
let url = communityHost + (Platform.OS === 'ios' ? '/grass': '') + `/article/detail/${articleId}`+ `?commentId=${rootCommentId}`
let action, params;
if(Platform.OS === 'ios') {
action = 'go.h5';
params = {
url,
param : { headerid: "-1", toplayoutByH5: 'Y' }
}
} else {
action = 'go.h5';
params = {
url,
param : { headerid: "-1", toplayoutByH5: 'Y' }
}
}
let jumpParams = {
action,
params
}
let path = 'http://m.yohobuy.com?openby:yohobuy=' + JSON.stringify(jumpParams);
NativeModules.YH_CommonHelper.jumpWithUrl(path);
}
render() {
... ... @@ -165,7 +180,9 @@ class ContentMessageContainer extends Component {
tabButtons,
commentList,
isPullToRefresh,
isFetching
isFetching,
toastMessage,
isShowToast,
} = this.props
return (
... ... @@ -175,6 +192,8 @@ class ContentMessageContainer extends Component {
this.messageView = view
}}
contentTipFlag={contentTipFlag}
toastMessage={toastMessage}
isShowToast={isShowToast}
tabButtons={tabButtons}
commentList={commentList}
isPullToRefresh={isPullToRefresh}
... ... @@ -187,6 +206,7 @@ class ContentMessageContainer extends Component {
jumpToPersonalGrassPage={this._jumpToPersonalGrassPage}
jumpToGrassDetailPage={this._jumpToGrassDetailPage}
onPressTabAction={this._onPressTabAction}
hideToastMessage={this._hideToastMessage}
/>
</View>
)
... ...
... ... @@ -45,8 +45,24 @@ const {
CLEAR_BADGE_NUM_SUCCESS,
UPDATE_TIP_FLAG_SUCCESS,
SHOW_TOAST,
HIDE_TOAST,
} = require('../../constants/actionTypes').default;
export function showToastMessage(value) {
return {
type: SHOW_TOAST,
payload: value
};
}
export function hideToastMessage() {
return {
type: HIDE_TOAST,
};
}
export function setContentListId(id) {
return {
type: SET_CONTENT_LIST_ID,
... ...
... ... @@ -50,6 +50,9 @@ let InitialState = Record({
error: null,
})),
isShowToast: false,
toastMessage: '',
});
export default InitialState;
... ...
... ... @@ -42,6 +42,9 @@ const {
CLEAR_BADGE_NUM_SUCCESS,
UPDATE_TIP_FLAG_SUCCESS,
SHOW_TOAST,
HIDE_TOAST,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -192,6 +195,11 @@ export default function grassReducer(state=initialState, action) {
return state.set('contentTipFlag', action.payload);
}
case SHOW_TOAST:
return state.set('isShowToast', true).set('toastMessage', action.payload)
case HIDE_TOAST:
return state.set('isShowToast', false).set('toastMessage', '')
}
return state;
}
... ...