合并 智慧就业第一版
This commit is contained in:
38
App.vue
38
App.vue
@@ -11,24 +11,26 @@ onLaunch((options) => {
|
||||
useDictStore().getDictData();
|
||||
// uni.hideTabBar();
|
||||
|
||||
// 登录
|
||||
let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息
|
||||
if (token) {
|
||||
useUserStore()
|
||||
.loginSetToken(token)
|
||||
.then(() => {
|
||||
$api.msg('登录成功');
|
||||
})
|
||||
.catch(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login',
|
||||
// 尝试从缓存恢复用户信息
|
||||
const restored = useUserStore().restoreUserInfo();
|
||||
|
||||
if (restored) {
|
||||
// 如果成功恢复用户信息,验证token是否有效
|
||||
let token = uni.getStorageSync('token') || '';
|
||||
if (token) {
|
||||
useUserStore()
|
||||
.loginSetToken(token)
|
||||
.then(() => {
|
||||
console.log('用户登录状态已恢复');
|
||||
})
|
||||
.catch(() => {
|
||||
// token无效,清除缓存(不跳转登录页)
|
||||
console.log('token已过期,需要重新登录');
|
||||
useUserStore().logOut(false);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/pages/login/login',
|
||||
});
|
||||
}
|
||||
}
|
||||
// 不再强制跳转到登录页,而是在需要登录时弹出授权弹窗
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
@@ -53,6 +55,8 @@ onHide(() => {
|
||||
/*每个页面公共css */
|
||||
@import '@/common/animation.css';
|
||||
@import '@/common/common.css';
|
||||
/* 引入阿里图标库 */
|
||||
@import url("/static/iconfont/iconfont.css");
|
||||
/* 修改pages tabbar样式 H5有效 */
|
||||
.uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon {
|
||||
height: 110rpx !important;
|
||||
@@ -81,6 +85,7 @@ uni-modal,
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
/* #ifdef H5 */
|
||||
@font-face {
|
||||
font-family: PingFangSC-Regular;
|
||||
src: url('https://qd.zhaopinzao8dian.com/file/csn/PingFangSC-Regular.woff2') format('woff2');
|
||||
@@ -98,6 +103,7 @@ uni-modal,
|
||||
src: url('https://qd.zhaopinzao8dian.com/file/csn/DIN-Medium.woff2') format('woff2');
|
||||
font-display: swap;
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
body {
|
||||
font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
|
||||
Reference in New Issue
Block a user