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 useDictStore from './stores/useDictStore';
|
||||
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 baseDB from '@/utils/db.js';
|
||||
import { $confirm } from '@/utils/modal.js';
|
||||
import useLocationStore from '@/stores/useLocationStore';
|
||||
usePageAnimation();
|
||||
const appword = 'aKd20dbGdFvmuwrt'; // 固定值
|
||||
let uQRListen = null;
|
||||
let inactivityManager = null;
|
||||
let inactivityModalTimer = null;
|
||||
|
||||
usePageAnimation();
|
||||
onLaunch((options) => {
|
||||
useDictStore().getDictData();
|
||||
if (lightAppJssdk.user) {
|
||||
if (isAsdMachineType()) {
|
||||
console.warn('爱山东环境');
|
||||
getUserInfo();
|
||||
useUserStore().changMiniProgramAppStatus(false);
|
||||
useUserStore().changMachineEnv(false);
|
||||
useLocationStore().getLocationLoop()//循环获取定位
|
||||
useLocationStore().getLocationLoop(); //循环获取定位
|
||||
return;
|
||||
}
|
||||
if (isY9MachineType()) {
|
||||
@@ -34,17 +43,19 @@ onLaunch((options) => {
|
||||
useUserStore().changMiniProgramAppStatus(true);
|
||||
useUserStore().changMachineEnv(true);
|
||||
(function loop() {
|
||||
console.log('📍一体机尝试获取定位')
|
||||
useLocationStore().getLocation().then(({longitude,latitude})=>{
|
||||
console.log(`✅一体机获取定位成功:lng:${longitude},lat${latitude}`)
|
||||
})
|
||||
.catch(err=>{
|
||||
console.log('❌一体机获取定位失败,30s后尝试重新获取')
|
||||
setTimeout(() => {
|
||||
loop()
|
||||
}, 3000);
|
||||
})
|
||||
})()
|
||||
console.log('📍一体机尝试获取定位');
|
||||
useLocationStore()
|
||||
.getLocation()
|
||||
.then(({ longitude, latitude }) => {
|
||||
console.log(`✅一体机获取定位成功:lng:${longitude},lat${latitude}`);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log('❌一体机获取定位失败,30s后尝试重新获取');
|
||||
setTimeout(() => {
|
||||
loop();
|
||||
}, 3000);
|
||||
});
|
||||
})();
|
||||
uQRListen = new IncreaseRevie();
|
||||
inactivityManager = new GlobalInactivityManager(handleInactivity, 60 * 1000);
|
||||
inactivityManager.start();
|
||||
@@ -52,7 +63,7 @@ onLaunch((options) => {
|
||||
}
|
||||
// 正式上线去除此方法
|
||||
console.warn('浏览器环境');
|
||||
useLocationStore().getLocationLoop()//循环获取定位
|
||||
useLocationStore().getLocationLoop(); //循环获取定位
|
||||
useUserStore().changMiniProgramAppStatus(true);
|
||||
useUserStore().changMachineEnv(false);
|
||||
useUserStore().initSeesionId(); //更新
|
||||
@@ -70,7 +81,6 @@ onLaunch((options) => {
|
||||
|
||||
onMounted(() => {});
|
||||
|
||||
|
||||
onShow(() => {
|
||||
console.log('App Show');
|
||||
});
|
||||
@@ -133,13 +143,6 @@ function performLogout() {
|
||||
inactivityManager?.resume(); // 恢复监听
|
||||
}
|
||||
|
||||
// 一体机环境判断
|
||||
function isY9MachineType() {
|
||||
const ua = navigator.userAgent;
|
||||
const isY9Machine = /Y9-ZYYH/i.test(ua); // 匹配机器型号
|
||||
return isY9Machine;
|
||||
}
|
||||
|
||||
// 爱山东环境登录
|
||||
function getUserInfo() {
|
||||
lightAppJssdk.user.getUserInfoWithEncryptedParamByAppId({
|
||||
|
||||
@@ -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('识别失败')
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -4,8 +4,8 @@ export default {
|
||||
// baseUrl: 'http://192.168.3.29:8081',
|
||||
// baseUrl: 'http://10.213.6.207:19010/api',
|
||||
// 语音转文字
|
||||
vioceBaseURl: 'wss://qd.zhaopinzao8dian.com/api/app/asr/connect', // 自定义
|
||||
// vioceBaseURl: 'wss://fw.rc.qingdao.gov.cn/rgpp-api/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', // 内网
|
||||
// 语音合成
|
||||
// speechSynthesis: 'wss://qd.zhaopinzao8dian.com/api/speech-synthesis',
|
||||
// speechSynthesis2: 'wss://resource.zhuoson.com/synthesis/', //直接替换即可
|
||||
|
||||
Reference in New Issue
Block a user