From 0df437e7bc64fda34713d2497621971686e8f924 Mon Sep 17 00:00:00 2001 From: Maoqiang Zheng Date: Wed, 13 Feb 2019 11:19:18 +0800 Subject: [PATCH] dev v1 --- .../voucherPosterComponent/voucherPosterComponent.js | 7 ++++--- src/serviceAPI.config.js | 4 ++-- src/weChatLogin.js | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js b/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js index a98d7f0..b4696dd 100644 --- a/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js +++ b/src/component/filteredShopComponent/voucherPosterComponent/voucherPosterComponent.js @@ -98,6 +98,10 @@ class VoucherPoster extends Component { this.props.onPassDataToChild(false) } componentWillReceiveProps(nextProps) { + this.setState({ + voucherName: nextProps.userName, + voucherPhone: nextProps.userPhone, + }) } componentDidMount() { @@ -111,9 +115,6 @@ class VoucherPoster extends Component { componentDidHide() { } render() { - - - return ( {/* */} diff --git a/src/serviceAPI.config.js b/src/serviceAPI.config.js index 600f3a7..4f2e54f 100644 --- a/src/serviceAPI.config.js +++ b/src/serviceAPI.config.js @@ -1,6 +1,6 @@ - //const LOCALURL = "http://192.168.1.230/" -const LOCALURL = "https://www.ihome6.com/" + const LOCALURL = "http://192.168.1.230/" +//const LOCALURL = "https://www.ihome6.com/" const URL = { Base: LOCALURL, Login: LOCALURL + 'Applet-login', //登入接口 diff --git a/src/weChatLogin.js b/src/weChatLogin.js index de1066f..499101e 100644 --- a/src/weChatLogin.js +++ b/src/weChatLogin.js @@ -31,7 +31,7 @@ export default function login() { success(res) { if (res.code) { // 发起网络请求 - // console.log('手机端微信code:',res.code) + console.log('手机端微信code:',res.code) Taro.request({ url: URL.Login, method: 'POST', @@ -44,14 +44,14 @@ export default function login() { } }) .then(response => { - if (response.data.err_code === 888) { + if (response.data.err_code === 0) { console.log('微信登入成功', response) Taro.showToast({ title: '微信登入成功', icon: 'success', duration: 2000 }) - Taro.setStorageSync('session_id', response.data.session_id) + Taro.setStorageSync('session_id', response.data.session_id) Taro.setStorageSync('shopInfo', response.data.shop_info) Taro.setStorageSync('userInfo', response.data.user_info) setUserInfoToStorage()