Commit 0f39f6a6 by LJM

js

parent a5275ccf
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-weixin:before {
content: "\e600";
}
.icon-wuliu:before { .icon-wuliu:before {
content: "\e75f"; content: "\e75f";
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<text class="logo"></text> <text class="logo"></text>
<text class="title">SCMWMS</text> <text class="title">SCMWMS</text>
<button class="share row rowCenter verCenter" @tap="getUserProfileChange"> <button class="share row rowCenter verCenter" @tap="getUserProfileChange">
<text class="iconfont icon-jinggao1"></text> <text class="iconfont icon-weixin"></text>
<text class="t1">微信授权登录</text> <text class="t1">微信授权登录</text>
</button> </button>
<view class="copyright">©2022深圳市猎芯供应链有限公司 ALL RIGHTS RESERVED</view> <view class="copyright">©2022深圳市猎芯供应链有限公司 ALL RIGHTS RESERVED</view>
...@@ -48,19 +48,24 @@ export default { ...@@ -48,19 +48,24 @@ export default {
wx.getUserProfile({ wx.getUserProfile({
desc: '用于完善会员资料', desc: '用于完善会员资料',
success: res => { success: res => {
self.request(API.getWechatInfo, 'GET', { code: self.code }, true).then(data => { self.request(API.getWechatInfo, 'GET', { code: self.code }, true).then(res => {
console.log(data); if (res.err_code === 0) {
if (data.err_code === 0) { if (res.data.token == '') {
uni.setStorageSync('openid', data.data.openid); uni.setStorageSync('openid', res.data.wechat_info.openid);
uni.setStorageSync('session_key', data.data.session_key); uni.setStorageSync('session_key', res.data.wechat_info.session_key);
uni.setStorageSync('unionid', data.data.unionid); uni.setStorageSync('unionid', res.data.wechat_info.unionid);
uni.navigateTo({
uni.navigateTo({ url: '/pages/mine/login'
url: '/pages/mine/login' });
}); } else {
uni.setStorageSync('token', res.data.token);
uni.navigateBack({
delta: 2
});
}
} else { } else {
uni.showToast({ uni.showToast({
title: data.err_msg, title: res.err_msg,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
......
...@@ -51,12 +51,13 @@ export default { ...@@ -51,12 +51,13 @@ export default {
}); });
return false; return false;
} }
let unionid = uni.getStorageSync('unionid');
this.request(API.login, 'POST', { account: this.account, passwd: this.passwd }, true).then(res => { this.request(API.login, 'POST', { account: this.account, passwd: this.passwd, unionid: unionid }, true).then(res => {
if (res.err_code === 0) { if (res.err_code === 0) {
uni.setStorageSync('token', res.data.token); uni.setStorageSync('token', res.data.token);
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 3
}); });
} else { } else {
uni.showToast({ uni.showToast({
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment