|
|
@@ -12,7 +12,8 @@
|
|
|
} from '@/utils/auth'
|
|
|
import {
|
|
|
login,
|
|
|
- verifyScanCode
|
|
|
+ verifyScanCode,
|
|
|
+ getIsNoLogin
|
|
|
} from '@/api/login'
|
|
|
import {
|
|
|
getScanData
|
|
|
@@ -46,25 +47,28 @@
|
|
|
this.status = true;
|
|
|
}
|
|
|
wx.login({
|
|
|
- success(res) {
|
|
|
- if (res.code) {
|
|
|
+ success(resLogin) {
|
|
|
+ if (resLogin.code) {
|
|
|
// 例如发送到服务器进行登录态验证等操作
|
|
|
- login(that.scanCode, res.code).then(res => {
|
|
|
+ login(that.scanCode, resLogin.code).then(res => {
|
|
|
console.log('登录成功', res);
|
|
|
if (res.code === 0) {
|
|
|
if (res.data.isWxAuth == 1) {
|
|
|
uni.setStorageSync('Authorization-status', true);
|
|
|
}
|
|
|
+ if ((that.scanCode === '' || that.scanCode === undefined) && res.data.roles.length > 1){
|
|
|
+ that.getIsNoLogin(res.data.uid);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
that.scanCode = res.data.qrCode;
|
|
|
- setToken(res.data.sessionId)
|
|
|
+ setToken(res.data.sessionId);
|
|
|
that.path = res.data.page_path;
|
|
|
that.verify();
|
|
|
} else {
|
|
|
if (res.code === 98) {
|
|
|
- uni.showToast({
|
|
|
- title: '请重新扫描二维码进入页面',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
+ that.getIsNoLogin();
|
|
|
+ return;
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
|
@@ -123,7 +127,21 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+ getIsNoLogin(uid) {
|
|
|
+ wx.login({
|
|
|
+ success(resLogin) {
|
|
|
+ if (resLogin.code) {
|
|
|
+ getIsNoLogin({jsCode:resLogin.code}).then(res => {
|
|
|
+ // 跳转登陆页
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/hexiao/login?uid=0'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|