112 lines
2.4 KiB
Vue
112 lines
2.4 KiB
Vue
<template>
|
|
<view class="login-container">
|
|
<image class="login-imge" src="https://www.focusnu.com/media/directive/login/loading.gif" mode="widthFix"
|
|
lazy-load="false" />
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {
|
|
onLoad
|
|
} from '@dcloudio/uni-app';
|
|
import {
|
|
reactive,
|
|
ref
|
|
} from 'vue';
|
|
import {
|
|
getOpenid,
|
|
getMessage
|
|
} from '@/api/loginApi.js'
|
|
|
|
const superLogin = () => {
|
|
uni.login({
|
|
provider: 'weixin',
|
|
success(res) {
|
|
getOpenid(res.code).then(res => {
|
|
let openid = res.data.openid
|
|
uni.setStorageSync("openid", openid)
|
|
getMessage(openid).then(res => {
|
|
uni.setStorageSync('tel', res.result.tel);
|
|
uni.setStorageSync('token', res.result.token);
|
|
uni.setStorageSync('serverUrl', res.result.serverUrl);
|
|
uni.setStorageSync('platId', res.result.platId);
|
|
uni.setStorageSync('izJg', res.result.izJg);
|
|
uni.setStorageSync('izJs', res.result.izJs);
|
|
uni.setStorageSync('izYg', res.result.izYg);
|
|
uni.setStorageSync('allinfo', res.result);
|
|
// console.log("allinfo",res.result.id)
|
|
|
|
if (!res.result.tel) {
|
|
uni.reLaunch({
|
|
url: `/pages/login/xuanchuan`
|
|
});
|
|
} else {
|
|
if (uni.getStorageSync('special')) {
|
|
|
|
uni.reLaunch({
|
|
url: `/pages/login/specialloginafther`
|
|
});
|
|
} else {
|
|
|
|
switch (res.result.advisoryType) {
|
|
case `1`:
|
|
uni.reLaunch({
|
|
url: `/pages/oldmanindex/index`
|
|
});
|
|
break;
|
|
case `2`:
|
|
uni.reLaunch({
|
|
url: `/pages/yuangongindex/index`
|
|
});
|
|
|
|
break;
|
|
case `3`:
|
|
uni.reLaunch({
|
|
url: `/pages/index/index`
|
|
});
|
|
break;
|
|
default:
|
|
uni.reLaunch({
|
|
url: `/pages/login/threeselectone`
|
|
});
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
fail(err) {
|
|
console.error('获取 code 失败:', err);
|
|
}
|
|
});
|
|
}
|
|
onLoad((options) => {
|
|
if (options.type) {
|
|
uni.setStorageSync('special', true);
|
|
} else {
|
|
uni.setStorageSync('special', false);
|
|
}
|
|
superLogin();
|
|
|
|
});
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.login-imge {
|
|
width: 440rpx;
|
|
height: 110rpx;
|
|
}
|
|
|
|
.login-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 100vh;
|
|
width: 100%;
|
|
background-color: rgb(239, 241, 252);
|
|
position: relative;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
</style> |