This commit is contained in:
2025-12-24 11:48:40 +08:00
parent 872d3febe9
commit d0ff91a2c4
5 changed files with 275 additions and 259 deletions

View File

@@ -1,4 +1,12 @@
// #ifdef H5
import '@/lib/encryption/sm4.min.js'
// #endif
// #ifndef H5
import { sm4 } from 'sm-crypto';
// #endif
import useUserStore from "../stores/useUserStore";
import {
createRequestWithCache,
@@ -601,7 +609,6 @@ export function sm4Decrypt(key, value, mode = "hex") {
cipherType: mode === 'hex' ? 'hex' : 'base64',
padding: 'pkcs#5'
});
return decrypted
} catch (e) {
@@ -638,9 +645,13 @@ export function reloadBrowser() {
export function isY9MachineType() {
try {
const ua = navigator.userAgent;
const isY9Machine = /Y9-ZYYH/i.test(ua); // 匹配机器型号
return isY9Machine;
const ua = navigator.userAgent;
const isY9Machine = /Y9-ZYYH/i.test(ua); // 匹配机器型号
return isY9Machine;
} catch (error) {
return false
}
}
// 一体机环境判断
@@ -648,10 +659,16 @@ export function isAsdMachineType() {
// const ua = navigator.userAgent;
// const isY9Machine = /asd_hanweb/i.test(ua); // 匹配机器型号
// return isY9Machine;
return !!lightAppJssdk.user
try {
return !!lightAppJssdk.user
} catch (error) {
false
}
}
export const $api = {
msg,
prePage,