flat: 一体机兼容,添加全局事件扫码回调等
This commit is contained in:
38
App.vue
38
App.vue
@@ -1,14 +1,17 @@
|
||||
<script setup>
|
||||
import { reactive, inject, onMounted } from 'vue';
|
||||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
|
||||
import { IncreaseRevie } from '@/common/all-in-one-listen.js';
|
||||
import useUserStore from './stores/useUserStore';
|
||||
import usePageAnimation from './hook/usePageAnimation';
|
||||
import useDictStore from './stores/useDictStore';
|
||||
import { useGlobalInactivity } from '@/hook/useGlobalInactivity';
|
||||
const { $api, navTo, appendScriptTagElement, aes_Decrypt, sm2_Decrypt, safeReLaunch } = inject('globalFunction');
|
||||
import config from '@/config.js';
|
||||
import baseDB from '@/utils/db.js';
|
||||
usePageAnimation();
|
||||
const appword = 'aKd20dbGdFvmuwrt'; // 固定值
|
||||
let uQRListen = null;
|
||||
|
||||
onLaunch((options) => {
|
||||
useDictStore().getDictData();
|
||||
@@ -25,6 +28,7 @@ onLaunch((options) => {
|
||||
useUserStore().logOutApp();
|
||||
useUserStore().changMiniProgramAppStatus(true);
|
||||
useUserStore().changMachineEnv(true);
|
||||
uQRListen = new IncreaseRevie();
|
||||
return;
|
||||
}
|
||||
// 正式上线去除此方法
|
||||
@@ -54,12 +58,40 @@ onHide(() => {
|
||||
console.log('App Hide');
|
||||
});
|
||||
|
||||
const { resume, pause } = useGlobalInactivity(() => {
|
||||
console.warn('【全局】60秒无操作,执行安全登出...');
|
||||
uni.showModal({
|
||||
title: '会话即将过期',
|
||||
content: '长时间无操作,是否继续使用?',
|
||||
showCancel: true,
|
||||
cancelText: '退出',
|
||||
confirmText: '继续',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
resume();
|
||||
} else {
|
||||
handleLogout();
|
||||
}
|
||||
},
|
||||
});
|
||||
}, 60 * 1000);
|
||||
|
||||
function handleLogout() {
|
||||
// 清除 token、跳转登录页
|
||||
uni.clearStorageSync();
|
||||
baseDB.resetAndReinit();
|
||||
useUserStore().logOutApp();
|
||||
pause();
|
||||
}
|
||||
|
||||
// 一体机环境判断
|
||||
function isY9MachineType() {
|
||||
const ua = navigator.userAgent;
|
||||
const isY9Machine = /Y9-ZYYH/i.test(ua); // 匹配机器型号
|
||||
return isY9Machine;
|
||||
}
|
||||
|
||||
// 爱山东环境登录
|
||||
function getUserInfo() {
|
||||
lightAppJssdk.user.getUserInfoWithEncryptedParamByAppId({
|
||||
appId: config.appInfo.loveShandong, // 接入方在成功创建应用后自动生成
|
||||
@@ -180,19 +212,19 @@ uni-modal,
|
||||
|
||||
@font-face {
|
||||
font-family: PingFangSC-Regular;
|
||||
src: url('https://qd.zhaopinzao8dian.com/file/csn/PingFangSC-Regular.woff2') format('woff2');
|
||||
src: url('/static/font/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');
|
||||
src: url('/static/font/PingFangSC-Medium.woff2') format('woff2');
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: DIN-Medium;
|
||||
src: url('./static/font/DIN-Medium.woff2') format('woff2');
|
||||
src: url('/static/font/DIN-Medium.woff2') format('woff2');
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user