flat:暂存
This commit is contained in:
51
App.vue
51
App.vue
@@ -6,25 +6,34 @@ import useUserStore from './stores/useUserStore';
|
|||||||
import usePageAnimation from './hook/usePageAnimation';
|
import usePageAnimation from './hook/usePageAnimation';
|
||||||
import useDictStore from './stores/useDictStore';
|
import useDictStore from './stores/useDictStore';
|
||||||
import { GlobalInactivityManager } from '@/utils/GlobalInactivityManager';
|
import { GlobalInactivityManager } from '@/utils/GlobalInactivityManager';
|
||||||
const { $api, navTo, appendScriptTagElement, aes_Decrypt, sm2_Decrypt, safeReLaunch } = inject('globalFunction');
|
const {
|
||||||
|
$api,
|
||||||
|
navTo,
|
||||||
|
appendScriptTagElement,
|
||||||
|
aes_Decrypt,
|
||||||
|
sm2_Decrypt,
|
||||||
|
safeReLaunch,
|
||||||
|
isY9MachineType,
|
||||||
|
isAsdMachineType,
|
||||||
|
} = inject('globalFunction');
|
||||||
import config from '@/config.js';
|
import config from '@/config.js';
|
||||||
import baseDB from '@/utils/db.js';
|
import baseDB from '@/utils/db.js';
|
||||||
import { $confirm } from '@/utils/modal.js';
|
import { $confirm } from '@/utils/modal.js';
|
||||||
import useLocationStore from '@/stores/useLocationStore';
|
import useLocationStore from '@/stores/useLocationStore';
|
||||||
usePageAnimation();
|
|
||||||
const appword = 'aKd20dbGdFvmuwrt'; // 固定值
|
const appword = 'aKd20dbGdFvmuwrt'; // 固定值
|
||||||
let uQRListen = null;
|
let uQRListen = null;
|
||||||
let inactivityManager = null;
|
let inactivityManager = null;
|
||||||
let inactivityModalTimer = null;
|
let inactivityModalTimer = null;
|
||||||
|
|
||||||
|
usePageAnimation();
|
||||||
onLaunch((options) => {
|
onLaunch((options) => {
|
||||||
useDictStore().getDictData();
|
useDictStore().getDictData();
|
||||||
if (lightAppJssdk.user) {
|
if (isAsdMachineType()) {
|
||||||
console.warn('爱山东环境');
|
console.warn('爱山东环境');
|
||||||
getUserInfo();
|
getUserInfo();
|
||||||
useUserStore().changMiniProgramAppStatus(false);
|
useUserStore().changMiniProgramAppStatus(false);
|
||||||
useUserStore().changMachineEnv(false);
|
useUserStore().changMachineEnv(false);
|
||||||
useLocationStore().getLocationLoop()//循环获取定位
|
useLocationStore().getLocationLoop(); //循环获取定位
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isY9MachineType()) {
|
if (isY9MachineType()) {
|
||||||
@@ -34,17 +43,19 @@ onLaunch((options) => {
|
|||||||
useUserStore().changMiniProgramAppStatus(true);
|
useUserStore().changMiniProgramAppStatus(true);
|
||||||
useUserStore().changMachineEnv(true);
|
useUserStore().changMachineEnv(true);
|
||||||
(function loop() {
|
(function loop() {
|
||||||
console.log('📍一体机尝试获取定位')
|
console.log('📍一体机尝试获取定位');
|
||||||
useLocationStore().getLocation().then(({longitude,latitude})=>{
|
useLocationStore()
|
||||||
console.log(`✅一体机获取定位成功:lng:${longitude},lat${latitude}`)
|
.getLocation()
|
||||||
})
|
.then(({ longitude, latitude }) => {
|
||||||
.catch(err=>{
|
console.log(`✅一体机获取定位成功:lng:${longitude},lat${latitude}`);
|
||||||
console.log('❌一体机获取定位失败,30s后尝试重新获取')
|
})
|
||||||
setTimeout(() => {
|
.catch((err) => {
|
||||||
loop()
|
console.log('❌一体机获取定位失败,30s后尝试重新获取');
|
||||||
}, 3000);
|
setTimeout(() => {
|
||||||
})
|
loop();
|
||||||
})()
|
}, 3000);
|
||||||
|
});
|
||||||
|
})();
|
||||||
uQRListen = new IncreaseRevie();
|
uQRListen = new IncreaseRevie();
|
||||||
inactivityManager = new GlobalInactivityManager(handleInactivity, 60 * 1000);
|
inactivityManager = new GlobalInactivityManager(handleInactivity, 60 * 1000);
|
||||||
inactivityManager.start();
|
inactivityManager.start();
|
||||||
@@ -52,7 +63,7 @@ onLaunch((options) => {
|
|||||||
}
|
}
|
||||||
// 正式上线去除此方法
|
// 正式上线去除此方法
|
||||||
console.warn('浏览器环境');
|
console.warn('浏览器环境');
|
||||||
useLocationStore().getLocationLoop()//循环获取定位
|
useLocationStore().getLocationLoop(); //循环获取定位
|
||||||
useUserStore().changMiniProgramAppStatus(true);
|
useUserStore().changMiniProgramAppStatus(true);
|
||||||
useUserStore().changMachineEnv(false);
|
useUserStore().changMachineEnv(false);
|
||||||
useUserStore().initSeesionId(); //更新
|
useUserStore().initSeesionId(); //更新
|
||||||
@@ -70,7 +81,6 @@ onLaunch((options) => {
|
|||||||
|
|
||||||
onMounted(() => {});
|
onMounted(() => {});
|
||||||
|
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
console.log('App Show');
|
console.log('App Show');
|
||||||
});
|
});
|
||||||
@@ -133,13 +143,6 @@ function performLogout() {
|
|||||||
inactivityManager?.resume(); // 恢复监听
|
inactivityManager?.resume(); // 恢复监听
|
||||||
}
|
}
|
||||||
|
|
||||||
// 一体机环境判断
|
|
||||||
function isY9MachineType() {
|
|
||||||
const ua = navigator.userAgent;
|
|
||||||
const isY9Machine = /Y9-ZYYH/i.test(ua); // 匹配机器型号
|
|
||||||
return isY9Machine;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 爱山东环境登录
|
// 爱山东环境登录
|
||||||
function getUserInfo() {
|
function getUserInfo() {
|
||||||
lightAppJssdk.user.getUserInfoWithEncryptedParamByAppId({
|
lightAppJssdk.user.getUserInfoWithEncryptedParamByAppId({
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
$api
|
$api,
|
||||||
|
safeReLaunch
|
||||||
} from "./globalFunction";
|
} from "./globalFunction";
|
||||||
import baseDB from '@/utils/db.js';
|
import baseDB from '@/utils/db.js';
|
||||||
import useUserStore from '@/stores/useUserStore';
|
import useUserStore from '@/stores/useUserStore';
|
||||||
@@ -43,21 +44,23 @@ export class IncreaseRevie {
|
|||||||
|
|
||||||
async handleDebouncedCallback(res) {
|
async handleDebouncedCallback(res) {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
const code = res.data.qrQode
|
const code = res.data.qrCode
|
||||||
console.log('二维码code', code);
|
if (/^\d{6}$/.test(String(code))) {
|
||||||
// 把code给到后端,后端拿code兑换用户信息,给前端返回token进行登录
|
// 把code给到后端,后端拿code兑换用户信息,给前端返回token进行登录
|
||||||
// 一体机用户需要清空indexDB
|
// 一体机用户需要清空indexDB
|
||||||
// useUserStore()
|
$api.createRequest(`/app/qrcodeLogin/${code}`, {}, 'get').then((resData) => {
|
||||||
// .loginSetToken(resData.token)
|
useUserStore()
|
||||||
// .then((resume) => {
|
.loginSetToken(resData.token)
|
||||||
// if (resume.data.jobTitleId) {
|
.then((resume) => {
|
||||||
// useUserStore().initSeesionId();
|
if (resume.data.jobTitleId) {
|
||||||
// safeReLaunch('/pages/index/index');
|
useUserStore().initSeesionId();
|
||||||
// } else {
|
safeReLaunch('/pages/index/index');
|
||||||
// safeReLaunch('/pages/login/login');
|
} else {
|
||||||
// }
|
safeReLaunch('/pages/login/login');
|
||||||
// });
|
}
|
||||||
// baseDB.resetAndReinit(); // 清空indexdb
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$api.msg('识别失败')
|
$api.msg('识别失败')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -634,6 +634,20 @@ export function reloadBrowser() {
|
|||||||
window.location.reload()
|
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 = {
|
export const $api = {
|
||||||
msg,
|
msg,
|
||||||
@@ -684,5 +698,7 @@ export default {
|
|||||||
sm2_Decrypt,
|
sm2_Decrypt,
|
||||||
sm2_Encrypt,
|
sm2_Encrypt,
|
||||||
safeReLaunch,
|
safeReLaunch,
|
||||||
reloadBrowser
|
reloadBrowser,
|
||||||
|
isAsdMachineType,
|
||||||
|
isY9MachineType
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,8 @@ export default {
|
|||||||
// baseUrl: 'http://192.168.3.29:8081',
|
// baseUrl: 'http://192.168.3.29:8081',
|
||||||
// baseUrl: 'http://10.213.6.207:19010/api',
|
// baseUrl: 'http://10.213.6.207:19010/api',
|
||||||
// 语音转文字
|
// 语音转文字
|
||||||
vioceBaseURl: 'wss://qd.zhaopinzao8dian.com/api/app/asr/connect', // 自定义
|
// vioceBaseURl: 'wss://qd.zhaopinzao8dian.com/api/app/asr/connect', // 自定义
|
||||||
// vioceBaseURl: 'wss://fw.rc.qingdao.gov.cn/rgpp-api/api/app/asr/connect', // 内网
|
vioceBaseURl: 'wss://fw.rc.qingdao.gov.cn/rgpp-api/api/app/asr/connect', // 内网
|
||||||
// 语音合成
|
// 语音合成
|
||||||
// speechSynthesis: 'wss://qd.zhaopinzao8dian.com/api/speech-synthesis',
|
// speechSynthesis: 'wss://qd.zhaopinzao8dian.com/api/speech-synthesis',
|
||||||
// speechSynthesis2: 'wss://resource.zhuoson.com/synthesis/', //直接替换即可
|
// speechSynthesis2: 'wss://resource.zhuoson.com/synthesis/', //直接替换即可
|
||||||
|
|||||||
Reference in New Issue
Block a user