You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
1.9 KiB
98 lines
1.9 KiB
<template>
|
|
<view class="container" style="opacity: 0.01;">
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import helper from 'common/helper.js'
|
|
export default {
|
|
onLaunch: function() {},
|
|
onShow: function() {
|
|
/* #ifndef H5 */
|
|
const getInfo = (token) => {
|
|
uni.request({
|
|
url: `${helper.serverUrl}/user/getInfo`,
|
|
header: {
|
|
Authorization: `Bearer ${token}`
|
|
},
|
|
success(resp) {
|
|
helper.tempUserInfo = resp.data.data;
|
|
uni.setStorage({
|
|
data: resp.data.data,
|
|
key: "tempUserInfo"
|
|
})
|
|
console.log('success', resp);
|
|
if (resp?.data?.code !== 200) {
|
|
uni.reLaunch({
|
|
url: '/pages/login/login',
|
|
success() {
|
|
// plus.navigator.closeSplashscreen();
|
|
},
|
|
fail(err) {
|
|
console.log('reLaunch', err);
|
|
}
|
|
})
|
|
} else {
|
|
uni.reLaunch({
|
|
url: '/pages/index/index',
|
|
success() {
|
|
// plus.navigator.closeSplashscreen();
|
|
},
|
|
fail(err) {
|
|
console.log('reLaunch', err);
|
|
}
|
|
})
|
|
}
|
|
},
|
|
fail(err) {
|
|
console.log('error', err);
|
|
if (token) {
|
|
uni.reLaunch({
|
|
url: '/pages/index/index',
|
|
success() {
|
|
// plus.navigator.closeSplashscreen();
|
|
},
|
|
fail(err) {
|
|
console.log('reLaunch', err);
|
|
}
|
|
})
|
|
} else {
|
|
uni.reLaunch({
|
|
url: '/pages/login/login',
|
|
success() {
|
|
// plus.navigator.closeSplashscreen();
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
}
|
|
uni.getStorage({
|
|
key: 'token',
|
|
success(token) {
|
|
if (token) {
|
|
helper.tempToken = token.data;
|
|
}
|
|
getInfo(token.data)
|
|
},
|
|
fail(err) {
|
|
console.log('err', err)
|
|
getInfo()
|
|
}
|
|
})
|
|
/* #endif */
|
|
},
|
|
onHide: function() {}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.container {
|
|
background: url(/static/login-bg.png);
|
|
height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
</style> |