Commit f7f3251a by liangjianmin

css

parent 58355e58
......@@ -25,7 +25,12 @@
}, {
"path": "pages/mine/auth",
"style": {
"navigationBarTitleText": "登录"
"navigationBarTitleText": "授权登录"
}
}, {
"path": "pages/mine/authPhone",
"style": {
"navigationBarTitleText": "授权手机号"
}
}, {
"path": "pages/mine/login",
......@@ -37,13 +42,13 @@
"style": {
"navigationBarTitleText": "提交结果"
}
},{
"path": "pages/question/handle",
}, {
"path": "pages/question/handle",
"style": {
"navigationBarTitleText": "操作处理"
}
},{
"path": "pages/question/detail",
}, {
"path": "pages/question/detail",
"style": {
"navigationBarTitleText": "操作详情"
}
......
......@@ -47,13 +47,16 @@ export default {
wx.getUserProfile({
desc: '用于完善会员资料',
success: res => {
self.request(API.getOpenId, 'GET', { code: self.code }, true).then(res => {
if (res.err_code === 0) {
uni.setStorageSync('openid', res.data.openid);
self.bindWechat(res);
}else{
self.request(API.getOpenId, 'GET', { code: self.code }, true).then(data => {
if (data.err_code === 0) {
uni.setStorageSync('openid', data.data.openid);
uni.setStorageSync('session_key', data.data.session_key);
uni.navigateTo({
url: '/pages/mine/authPhone'
});
} else {
uni.showToast({
title: res.err_msg,
title: data.err_msg,
icon: 'none',
duration: 2000
});
......@@ -69,8 +72,8 @@ export default {
}
});
},
bindWechat(data) {
this.request(API.BindWechat, 'POST', { encryptedData: data.encryptedData ,iv:data.iv}, true).then(res => {
bindWechat(data, openid, session_key) {
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) {
uni.navigateTo({
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 {
return false;
}
let wechat_unique_id = uni.getStorageSync('openid');
this.request(API.Login, 'POST', { account: this.account, pwd: this.pwd, wechat_unique_id: wechat_unique_id }, true).then(res => {
let openid = uni.getStorageSync('openid');
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) {
uni.setStorageSync('token', res.data.token);
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