2025-02-13 09:59:20 +08:00
|
|
|
<script>
|
2025-02-15 16:09:39 +08:00
|
|
|
// 工具库
|
|
|
|
import util from '@/common/js/util';
|
|
|
|
// vuex
|
|
|
|
import store from '@/store/index.js'
|
|
|
|
export default {
|
|
|
|
onLaunch() {
|
|
|
|
// 登录令牌
|
|
|
|
const token = uni.getStorageSync('token')
|
|
|
|
// 用户信息
|
2025-02-18 18:09:05 +08:00
|
|
|
const userinfo = JSON.parse(uni.getStorageSync('userinfo'))
|
2025-02-15 16:09:39 +08:00
|
|
|
|
|
|
|
// 如果登录保活
|
|
|
|
if (token) {
|
2025-02-18 11:38:36 +08:00
|
|
|
// 用户信息
|
|
|
|
if (userinfo) {
|
|
|
|
store.commit('setState', {
|
|
|
|
key: 'userinfo',
|
|
|
|
value: userinfo
|
|
|
|
})
|
2025-02-15 16:09:39 +08:00
|
|
|
|
2025-02-18 18:09:05 +08:00
|
|
|
// 登录腾讯IM
|
2025-02-18 11:38:36 +08:00
|
|
|
// util.loginTencent(userinfo)
|
|
|
|
}
|
2025-02-15 16:09:39 +08:00
|
|
|
} else {
|
|
|
|
// 如果未登录,跳转到登录页面
|
|
|
|
uni.redirectTo({
|
|
|
|
url: '/pages/login/login'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onShow() { },
|
|
|
|
onHide() { }
|
|
|
|
}
|
2025-02-13 09:59:20 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2025-02-15 16:09:39 +08:00
|
|
|
/*每个页面公共css */
|
|
|
|
@import "./common/css/style.scss";
|
|
|
|
</style>
|