Files

106 lines
2.6 KiB
Vue
Raw Permalink Normal View History

2024-11-08 11:55:23 +08:00
<script setup>
2025-04-07 09:10:55 +08:00
import { reactive, inject, onMounted } from 'vue';
2024-11-08 11:55:23 +08:00
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
2025-03-28 15:19:42 +08:00
import useUserStore from './stores/useUserStore';
import useDictStore from './stores/useDictStore';
2025-04-07 09:10:55 +08:00
const { $api, navTo, appendScriptTagElement } = inject('globalFunction');
2025-07-14 15:38:39 +08:00
import config from '@/config.js';
2025-03-28 15:19:42 +08:00
onLaunch((options) => {
2025-07-22 15:20:21 +08:00
useUserStore().initSeesionId(); //更新
2025-03-28 15:19:42 +08:00
useDictStore().getDictData();
2025-06-26 08:56:42 +08:00
// uni.hideTabBar();
2025-03-28 15:19:42 +08:00
2025-06-26 08:56:42 +08:00
// 登录
2025-03-28 15:19:42 +08:00
let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息
if (token) {
useUserStore()
.loginSetToken(token)
.then(() => {
$api.msg('登录成功');
2025-09-29 11:53:10 +08:00
})
.catch(() => {
uni.redirectTo({
url: '/pages/login/login',
});
2025-03-28 15:19:42 +08:00
});
2024-11-08 11:55:23 +08:00
} else {
2025-03-28 15:19:42 +08:00
uni.redirectTo({
url: '/pages/login/login',
});
2024-11-08 11:55:23 +08:00
}
});
2025-04-07 09:10:55 +08:00
onMounted(() => {
2025-05-13 11:42:17 +08:00
// #ifndef MP-WEIXIN
2025-07-14 15:38:39 +08:00
appendScriptTagElement('https://qd.zhaopinzao8dian.com/file/csn/jweixin-1.4.0.js').then(() => {
console.log('✅ 微信 JSSDK 加载完成');
2025-07-22 15:20:21 +08:00
// signatureFn();
2025-07-14 15:38:39 +08:00
});
2025-05-13 11:42:17 +08:00
// #endif
2025-04-07 09:10:55 +08:00
});
2024-11-08 11:55:23 +08:00
onShow(() => {
console.log('App Show');
});
2025-05-13 11:10:38 +08:00
2024-11-08 11:55:23 +08:00
onHide(() => {
console.log('App Hide');
});
</script>
<style>
/*每个页面公共css */
2025-06-26 08:56:42 +08:00
@import '@/common/animation.css';
2024-11-08 11:55:23 +08:00
@import '@/common/common.css';
2025-03-28 15:19:42 +08:00
/* 修改pages tabbar样式 H5有效 */
.uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon {
2025-05-15 14:17:51 +08:00
height: 110rpx !important;
width: 122rpx !important;
margin-top: 6rpx;
2025-04-07 09:10:55 +08:00
}
2025-05-15 14:17:51 +08:00
2025-04-07 09:10:55 +08:00
.uni-tabbar-border {
2025-04-16 14:24:06 +08:00
background-color: transparent !important;
/* background-color: #e4e4e4 !important; */
}
.uni-popup {
z-index: 1001 !important;
2025-04-07 09:10:55 +08:00
}
/* 提升toast层级 */
uni-toast,
uni-modal,
.uni-modal,
.uni-mask {
2025-04-16 14:24:06 +08:00
z-index: 998;
2025-03-28 15:19:42 +08:00
}
2025-05-13 11:10:38 +08:00
@font-face {
font-family: DingTalk JinBuTi;
2025-07-09 15:15:37 +08:00
src: url('/static/font/DingTalk JinBuTi_min.woff2') format('woff2');
font-display: swap;
}
@font-face {
font-family: PingFangSC-Regular;
2025-07-14 15:38:39 +08:00
src: url('https://qd.zhaopinzao8dian.com/file/csn/PingFangSC-Regular.woff2') format('woff2');
2025-07-09 15:15:37 +08:00
font-display: swap;
}
@font-face {
font-family: PingFangSC-Medium;
2025-07-14 15:38:39 +08:00
src: url('https://qd.zhaopinzao8dian.com/file/csn/PingFangSC-Medium.woff2') format('woff2');
2025-07-09 15:15:37 +08:00
font-display: swap;
}
@font-face {
font-family: DIN-Medium;
2025-07-14 15:38:39 +08:00
src: url('https://qd.zhaopinzao8dian.com/file/csn/DIN-Medium.woff2') format('woff2');
2025-07-09 15:15:37 +08:00
font-display: swap;
}
body {
font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
2025-05-13 11:10:38 +08:00
}
2025-04-10 10:59:25 +08:00
</style>