112 lines
2.8 KiB
Vue
112 lines
2.8 KiB
Vue
<script setup>
|
||
import { reactive, inject, onMounted } from 'vue';
|
||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
|
||
import useUserStore from './stores/useUserStore';
|
||
import useDictStore from './stores/useDictStore';
|
||
import { setupWechatShare, generateShareLink } from '@/utils/wechatShare.js';
|
||
const { $api, navTo, appendScriptTagElement } = inject('globalFunction');
|
||
import config from '@/config.js';
|
||
|
||
onLaunch((options) => {
|
||
useDictStore().getDictData();
|
||
// uni.hideTabBar();
|
||
|
||
// 登录
|
||
let token = uni.getStorageSync('token') || ''; // 同步获取 缓存信息
|
||
if (token) {
|
||
useUserStore()
|
||
.loginSetToken(token)
|
||
.then(() => {
|
||
$api.msg('登录成功');
|
||
});
|
||
} else {
|
||
uni.redirectTo({
|
||
url: '/pages/login/login',
|
||
});
|
||
}
|
||
});
|
||
|
||
onMounted(() => {
|
||
// #ifndef MP-WEIXIN
|
||
appendScriptTagElement('https://qd.zhaopinzao8dian.com/file/csn/jweixin-1.4.0.js').then(() => {
|
||
console.log('✅ 微信 JSSDK 加载完成');
|
||
signatureFn();
|
||
});
|
||
// #endif
|
||
});
|
||
|
||
onShow(() => {
|
||
console.log('App Show');
|
||
});
|
||
|
||
onHide(() => {
|
||
console.log('App Hide');
|
||
});
|
||
|
||
function signatureFn() {
|
||
const link = generateShareLink();
|
||
// console.log('首页link:', link);
|
||
setupWechatShare({
|
||
title: config.shareConfig.title,
|
||
desc: config.shareConfig.desc,
|
||
link: link,
|
||
imgUrl: config.shareConfig.imgUrl,
|
||
});
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
/*每个页面公共css */
|
||
@import '@/common/animation.css';
|
||
@import '@/common/common.css';
|
||
/* 修改pages tabbar样式 H5有效 */
|
||
.uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon {
|
||
height: 110rpx !important;
|
||
width: 122rpx !important;
|
||
margin-top: 6rpx;
|
||
}
|
||
|
||
.uni-tabbar-border {
|
||
background-color: transparent !important;
|
||
/* background-color: #e4e4e4 !important; */
|
||
}
|
||
.uni-popup {
|
||
z-index: 1001 !important;
|
||
}
|
||
/* 提升toast层级 */
|
||
uni-toast,
|
||
uni-modal,
|
||
.uni-modal,
|
||
.uni-mask {
|
||
z-index: 998;
|
||
}
|
||
|
||
@font-face {
|
||
font-family: DingTalk JinBuTi;
|
||
src: url('/static/font/DingTalk JinBuTi_min.woff2') format('woff2');
|
||
font-display: swap;
|
||
}
|
||
|
||
@font-face {
|
||
font-family: PingFangSC-Regular;
|
||
src: url('https://qd.zhaopinzao8dian.com/file/csn/PingFangSC-Regular.woff2') format('woff2');
|
||
font-display: swap;
|
||
}
|
||
|
||
@font-face {
|
||
font-family: PingFangSC-Medium;
|
||
src: url('https://qd.zhaopinzao8dian.com/file/csn/PingFangSC-Medium.woff2') format('woff2');
|
||
font-display: swap;
|
||
}
|
||
|
||
@font-face {
|
||
font-family: DIN-Medium;
|
||
src: url('https://qd.zhaopinzao8dian.com/file/csn/DIN-Medium.woff2') format('woff2');
|
||
font-display: swap;
|
||
}
|
||
|
||
body {
|
||
font-family: 'PingFangSC-Regular', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||
}
|
||
</style>
|