Commit f7f3251a by liangjianmin

css

parent 58355e58
...@@ -25,7 +25,12 @@ ...@@ -25,7 +25,12 @@
}, { }, {
"path": "pages/mine/auth", "path": "pages/mine/auth",
"style": { "style": {
"navigationBarTitleText": "登录" "navigationBarTitleText": "授权登录"
}
}, {
"path": "pages/mine/authPhone",
"style": {
"navigationBarTitleText": "授权手机号"
} }
}, { }, {
"path": "pages/mine/login", "path": "pages/mine/login",
...@@ -37,13 +42,13 @@ ...@@ -37,13 +42,13 @@
"style": { "style": {
"navigationBarTitleText": "提交结果" "navigationBarTitleText": "提交结果"
} }
},{ }, {
"path": "pages/question/handle", "path": "pages/question/handle",
"style": { "style": {
"navigationBarTitleText": "操作处理" "navigationBarTitleText": "操作处理"
} }
},{ }, {
"path": "pages/question/detail", "path": "pages/question/detail",
"style": { "style": {
"navigationBarTitleText": "操作详情" "navigationBarTitleText": "操作详情"
} }
......
...@@ -47,13 +47,16 @@ export default { ...@@ -47,13 +47,16 @@ export default {
wx.getUserProfile({ wx.getUserProfile({
desc: '用于完善会员资料', desc: '用于完善会员资料',
success: res => { success: res => {
self.request(API.getOpenId, 'GET', { code: self.code }, true).then(res => { self.request(API.getOpenId, 'GET', { code: self.code }, true).then(data => {
if (res.err_code === 0) { if (data.err_code === 0) {
uni.setStorageSync('openid', res.data.openid); uni.setStorageSync('openid', data.data.openid);
self.bindWechat(res); uni.setStorageSync('session_key', data.data.session_key);
}else{ uni.navigateTo({
url: '/pages/mine/authPhone'
});
} else {
uni.showToast({ uni.showToast({
title: res.err_msg, title: data.err_msg,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });
...@@ -69,8 +72,8 @@ export default { ...@@ -69,8 +72,8 @@ export default {
} }
}); });
}, },
bindWechat(data) { bindWechat(data, openid, session_key) {
this.request(API.BindWechat, 'POST', { encryptedData: data.encryptedData ,iv:data.iv}, true).then(res => { this.request(API.BindWechat, 'POST', { encryptedData: data.encryptedData, iv: data.iv, openid: openid, session_key: session_key }, true).then(res => {
if (res.err_code === 0) { if (res.err_code === 0) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/mine/login' url: '/pages/mine/login'
......
<template>
<view class="page-auth column rowCenter verCenter">
<text class="logo"></text>
<text class="title">SCM商务系统</text>
<button class="share row rowCenter verCenter" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">
<text class="iconfont icon-jinggao1"></text>
<text class="t1">微信授权获取手机号</text>
</button>
<view class="copyright">©2021深圳市猎芯供应链有限公司 ALL RIGHTS RESERVED</view>
</view>
</template>
<script>
import { API } from '@/util/api.js';
export default {
data() {
return {};
},
onLoad(options) {
uni.login({
success: res => {
console.log('login', JSON.stringify(res));
}
});
},
onShareTimeline(res) {},
methods: {
decryptPhoneNumber(e) {
let openid = uni.getStorageSync('openid');
let session_key = uni.getStorageSync('session_key');
console.log(e);
this.request(API.BindWechat, 'POST', { encryptedData: e.detail.encryptedData, iv: e.detail.iv, openid: openid, session_key: session_key }, true).then(res => {
if (res.err_code === 0) {
uni.navigateTo({
url: '/pages/mine/login'
});
}
});
}
}
};
</script>
<style lang="scss">
@import '../../assets/css/mine/auth.scss';
</style>
...@@ -53,8 +53,23 @@ export default { ...@@ -53,8 +53,23 @@ export default {
return false; return false;
} }
let wechat_unique_id = uni.getStorageSync('openid'); let openid = uni.getStorageSync('openid');
this.request(API.Login, 'POST', { account: this.account, pwd: this.pwd, wechat_unique_id: wechat_unique_id }, true).then(res => { let session_key = uni.getStorageSync('session_key');
let encryptedData = uni.getStorageSync('encryptedData');
let iv = uni.getStorageSync('iv');
this.request(
API.Login,
'POST',
{
account: this.account,
pwd: this.pwd,
openid: openid,
session_key: session_key,
encryptedData: encryptedData,
iv: iv
},
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({
......
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