Authored by 张文文

有赚我的页面身份证绑定修改

@@ -6,6 +6,7 @@ import {Immutable} from "immutable"; @@ -6,6 +6,7 @@ import {Immutable} from "immutable";
6 import SingleImage from './floor/SingleImage'; 6 import SingleImage from './floor/SingleImage';
7 import MineCell from './cell/MineCell'; 7 import MineCell from './cell/MineCell';
8 import YH_Image from '../../common/components/YH_Image'; 8 import YH_Image from '../../common/components/YH_Image';
  9 +import Prompt from "../../common/components/Prompt";
9 10
10 11
11 export default class Mine extends Component { 12 export default class Mine extends Component {
@@ -77,7 +78,11 @@ export default class Mine extends Component { @@ -77,7 +78,11 @@ export default class Mine extends Component {
77 <View style={{height: 1, backgroundColor: '#f0f0f0'}}/> 78 <View style={{height: 1, backgroundColor: '#f0f0f0'}}/>
78 79
79 <TouchableOpacity activeOpacity={1} style={styles.withdrawView} onPress={() => { 80 <TouchableOpacity activeOpacity={1} style={styles.withdrawView} onPress={() => {
  81 + if (uploadStatus) {
  82 + this.props.showToastMessage && this.props.showToastMessage('身份证已上传,如需修改请联系有货客服');
  83 + } else {
80 this.props.jumpWithUrl && this.props.jumpWithUrl('我的身份证', 'nameAuthen'); 84 this.props.jumpWithUrl && this.props.jumpWithUrl('我的身份证', 'nameAuthen');
  85 + }
81 }}> 86 }}>
82 <Text style={styles.hasWithDrawText}>我的身份证</Text> 87 <Text style={styles.hasWithDrawText}>我的身份证</Text>
83 <View style={[styles.textView, {flexDirection: 'row', paddingRight: 15}]}> 88 <View style={[styles.textView, {flexDirection: 'row', paddingRight: 15}]}>
@@ -141,7 +146,7 @@ export default class Mine extends Component { @@ -141,7 +146,7 @@ export default class Mine extends Component {
141 } 146 }
142 147
143 render() { 148 render() {
144 - let {mineResourceInfo} = this.props; 149 + let {mineResourceInfo, isShowToast, toastMessage} = this.props;
145 let resourceList = mineResourceInfo.resourceList ? mineResourceInfo.resourceList.toArray() : []; 150 let resourceList = mineResourceInfo.resourceList ? mineResourceInfo.resourceList.toArray() : [];
146 return ( 151 return (
147 <View style={styles.container}> 152 <View style={styles.container}>
@@ -155,6 +160,12 @@ export default class Mine extends Component { @@ -155,6 +160,12 @@ export default class Mine extends Component {
155 renderHeader={this._renderHeader} 160 renderHeader={this._renderHeader}
156 renderRow={this._renderRow} 161 renderRow={this._renderRow}
157 /> 162 />
  163 +
  164 + {isShowToast ? <Prompt
  165 + text={toastMessage}
  166 + duration={1500}
  167 + onPromptHidden={this.props.hideToastMessage}
  168 + /> : null}
158 </View> 169 </View>
159 ); 170 );
160 } 171 }
@@ -39,6 +39,9 @@ class MineContainer extends Component { @@ -39,6 +39,9 @@ class MineContainer extends Component {
39 this._jumpWithUrl = this._jumpWithUrl.bind(this); 39 this._jumpWithUrl = this._jumpWithUrl.bind(this);
40 this._resourceJumpWithUrl = this._resourceJumpWithUrl.bind(this); 40 this._resourceJumpWithUrl = this._resourceJumpWithUrl.bind(this);
41 this._refreshSettlementInfo = this._refreshSettlementInfo.bind(this); 41 this._refreshSettlementInfo = this._refreshSettlementInfo.bind(this);
  42 + this._showToastMessage = this._showToastMessage.bind(this);
  43 + this._hideToastMessage = this._hideToastMessage.bind(this);
  44 +
42 } 45 }
43 46
44 componentDidMount() { 47 componentDidMount() {
@@ -53,6 +56,14 @@ class MineContainer extends Component { @@ -53,6 +56,14 @@ class MineContainer extends Component {
53 56
54 } 57 }
55 58
  59 + _showToastMessage(toast) {
  60 + this.props.actions.showToastMessage(toast);
  61 + }
  62 +
  63 + _hideToastMessage() {
  64 + this.props.actions.hideToastMessage();
  65 + }
  66 +
56 _jumpWithUrl(title = '', type = '', orderCode = '') { 67 _jumpWithUrl(title = '', type = '', orderCode = '') {
57 let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"${title}","type":"${type}","order_code":"${orderCode}"}}`; 68 let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"${title}","type":"${type}","order_code":"${orderCode}"}}`;
58 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); 69 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
@@ -90,6 +101,11 @@ class MineContainer extends Component { @@ -90,6 +101,11 @@ class MineContainer extends Component {
90 jumpWithUrl={this._jumpWithUrl} 101 jumpWithUrl={this._jumpWithUrl}
91 resourceJumpWithUrl={this._resourceJumpWithUrl} 102 resourceJumpWithUrl={this._resourceJumpWithUrl}
92 refreshSettlementInfo={this._refreshSettlementInfo} 103 refreshSettlementInfo={this._refreshSettlementInfo}
  104 +
  105 + isShowToast={this.props.alliance.isShowToast}
  106 + toastMessage={this.props.alliance.toastMessage}
  107 + showToastMessage={this._showToastMessage}
  108 + hideToastMessage={this._hideToastMessage}
93 /> 109 />
94 <LoadingIndicator isVisible={isFetching}/> 110 <LoadingIndicator isVisible={isFetching}/>
95 </View> 111 </View>
@@ -62,8 +62,6 @@ class NameAuthenContainer extends Component { @@ -62,8 +62,6 @@ class NameAuthenContainer extends Component {
62 bindIdentityCard(frontIDCardImageUri, backIDCardImageUri) { 62 bindIdentityCard(frontIDCardImageUri, backIDCardImageUri) {
63 this.showLoading(true); 63 this.showLoading(true);
64 64
65 - console.log(backIDCardImageUri);  
66 - console.log(frontIDCardImageUri);  
67 let param = [{code: 0,imageUri:frontIDCardImageUri.replace('file://','')},{code: 1,imageUri:backIDCardImageUri.replace('file://','')}]; 65 let param = [{code: 0,imageUri:frontIDCardImageUri.replace('file://','')},{code: 1,imageUri:backIDCardImageUri.replace('file://','')}];
68 NativeModules.YH_MarketHelper && NativeModules.YH_MarketHelper.postIDCardImage(param).then(data => { 66 NativeModules.YH_MarketHelper && NativeModules.YH_MarketHelper.postIDCardImage(param).then(data => {
69 let list = data; 67 let list = data;
@@ -85,9 +83,7 @@ class NameAuthenContainer extends Component { @@ -85,9 +83,7 @@ class NameAuthenContainer extends Component {
85 return; 83 return;
86 } 84 }
87 85
88 - this.props.actions.bindIdentityCard(cardFrontUrl, cardBackUrl, function(json) {  
89 -  
90 - }); 86 + this.props.actions.bindIdentityCard(cardFrontUrl, cardBackUrl);
91 }) 87 })
92 .catch(error => { 88 .catch(error => {
93 this.showLoading(false); 89 this.showLoading(false);
@@ -1402,7 +1402,7 @@ function exposeProductListData(json) { @@ -1402,7 +1402,7 @@ function exposeProductListData(json) {
1402 } 1402 }
1403 1403
1404 1404
1405 -export function bindIdentityCard(cardFrontUrl, cardBackUrl, callback) { 1405 +export function bindIdentityCard(cardFrontUrl, cardBackUrl) {
1406 return (dispatch, getState) => { 1406 return (dispatch, getState) => {
1407 let {app, alliance} = getState(); 1407 let {app, alliance} = getState();
1408 1408
@@ -1411,8 +1411,9 @@ export function bindIdentityCard(cardFrontUrl, cardBackUrl, callback) { @@ -1411,8 +1411,9 @@ export function bindIdentityCard(cardFrontUrl, cardBackUrl, callback) {
1411 return new AllianceService(app.host).bindIdentityCard(uid, cardFrontUrl, cardBackUrl) 1411 return new AllianceService(app.host).bindIdentityCard(uid, cardFrontUrl, cardBackUrl)
1412 .then(json => { 1412 .then(json => {
1413 dispatch(bindIdentityCardSuccess(json)); 1413 dispatch(bindIdentityCardSuccess(json));
  1414 + dispatch(showToastMessage('绑定成功'));
1414 1415
1415 - callback && typeof callback === 'function' && callback(json) 1416 + ReactNative.NativeModules.YH_CommonHelper.goBack();
1416 }) 1417 })
1417 .catch(error => { 1418 .catch(error => {
1418 dispatch(bindIdentityCardFailure(error)); 1419 dispatch(bindIdentityCardFailure(error));