flat:暂存

This commit is contained in:
Apcallover
2025-12-20 14:27:38 +08:00
parent 4ae11e31f4
commit 1c05aa1f5b
4 changed files with 65 additions and 43 deletions

View File

@@ -1,5 +1,6 @@
import {
$api
$api,
safeReLaunch
} from "./globalFunction";
import baseDB from '@/utils/db.js';
import useUserStore from '@/stores/useUserStore';
@@ -43,21 +44,23 @@ export class IncreaseRevie {
async handleDebouncedCallback(res) {
if (res.data) {
const code = res.data.qrQode
console.log('二维码code', code);
// 把code给到后端后端拿code兑换用户信息给前端返回token进行登录
// 一体机用户需要清空indexDB
// useUserStore()
// .loginSetToken(resData.token)
// .then((resume) => {
// if (resume.data.jobTitleId) {
// useUserStore().initSeesionId();
// safeReLaunch('/pages/index/index');
// } else {
// safeReLaunch('/pages/login/login');
// }
// });
// baseDB.resetAndReinit(); // 清空indexdb
const code = res.data.qrCode
if (/^\d{6}$/.test(String(code))) {
// 把code给到后端后端拿code兑换用户信息给前端返回token进行登录
// 一体机用户需要清空indexDB
$api.createRequest(`/app/qrcodeLogin/${code}`, {}, 'get').then((resData) => {
useUserStore()
.loginSetToken(resData.token)
.then((resume) => {
if (resume.data.jobTitleId) {
useUserStore().initSeesionId();
safeReLaunch('/pages/index/index');
} else {
safeReLaunch('/pages/login/login');
}
});
});
}
} else {
$api.msg('识别失败')
}

View File

@@ -634,6 +634,20 @@ export function reloadBrowser() {
window.location.reload()
}
// 一体机环境判断
export function isY9MachineType() {
const ua = navigator.userAgent;
const isY9Machine = /Y9-ZYYH/i.test(ua); // 匹配机器型号
return isY9Machine;
}
// 一体机环境判断
export function isAsdMachineType() {
const ua = navigator.userAgent;
const isY9Machine = /asd_hanweb/i.test(ua); // 匹配机器型号
return isY9Machine;
}
export const $api = {
msg,
@@ -684,5 +698,7 @@ export default {
sm2_Decrypt,
sm2_Encrypt,
safeReLaunch,
reloadBrowser
reloadBrowser,
isAsdMachineType,
isY9MachineType
}