WeiXin.ZhiXueHuiCha.MiniPro.../pages/login/login.vue

91 lines
2.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="warpper-login">
<view class="img_loading"></view>
<view class="text">登录中···</view>
</view>
</template>
<script setup lang="ts">
import {
getUserLogin,
getConfig
} from "@/api/user";
import {onShow } from "@dcloudio/uni-app";
onShow(()=>{
uni.login({
provider: 'weixin', //使用微信登录
success: (loginRes) => {
getUserLogin(loginRes.code).then((res :any) => {
console.log('APP.vue请求登录',res);
if (res.Code == 200) {
uni.setStorageSync('TokenType', res.Data.TokenType)
uni.setStorageSync('HAS_STUDENT', res.Data.user.HasStudent)
uni.setStorageSync('HAS_BINDSTUDENT', res.Data.user.BindMobile)
if (res.Data.AccessToken) {
uni.setStorageSync('token', res.Data.AccessToken)
uni.navigateBack()
} else {
uni.setStorageSync('XCXID', res.Data.xcxId)
getConfig().then((resCig:any) => {
console.log('公众号AppId', resCig);
let url = 'https://mk-wxauth.23544.com'
uni.navigateTo({
url: `/pages/webview/webview?appId=${resCig.Data.gzh.AppId}&url=${url}`
})
})
}
} else {
console.log('denglushibai', res.Code);
}
})
}
});
})
</script>
<style lang="scss">
page{
font-family: 'PingFang SC';
border: 0 !important;
background: #ffffff;
}
.warpper-login{
width: 100%;
height: 100vh;
display: flex;
flex-direction: column;
background: rgba(0 , 0, 0, 0.5);
justify-content: center;
align-items: center;
}
.img_loading{
width: 50px;
height: 50px;
background: url('@/static/login_loading.png');
background-size: 100% 100%;
animation: runLoginMove 2s infinite linear;
margin-bottom: 20px;
}
.text{
color: #fff;
font-family: PingFang SC;
font-size: 14px;
font-style: normal;
font-weight: 500;
line-height: normal;
letter-spacing: 0.96px;
margin-bottom: 200px;
}
@keyframes runLoginMove {
0%{
transform: rotate(0turn);
}
50%{
transform: rotate(0.5turn);
}
100%{
transform: rotate(1turn);
}
}
</style>