flat: bug修复
This commit is contained in:
33
App.vue
33
App.vue
@@ -25,7 +25,7 @@ onLaunch((options) => {
|
||||
useUserStore().changMachineEnv(false);
|
||||
return;
|
||||
}
|
||||
if (!isY9MachineType()) {
|
||||
if (isY9MachineType()) {
|
||||
console.warn('求职一体机环境');
|
||||
baseDB.resetAndReinit(); // 清空indexdb
|
||||
useUserStore().logOutApp();
|
||||
@@ -63,15 +63,16 @@ onHide(() => {
|
||||
console.log('App Hide');
|
||||
});
|
||||
|
||||
async function handleInactivity() {
|
||||
function handleInactivity() {
|
||||
console.log('【全局】60秒无操作,执行安全逻辑');
|
||||
if (inactivityModalTimer) {
|
||||
clearTimeout(inactivityModalTimer);
|
||||
inactivityModalTimer = null;
|
||||
}
|
||||
|
||||
if (useUserStore().hasLogin) {
|
||||
// 示例:弹窗确认
|
||||
await $confirm({
|
||||
// 1. 正常弹出确认框
|
||||
$confirm({
|
||||
title: '会话即将过期',
|
||||
content: '长时间无操作,是否继续使用?',
|
||||
success: (res) => {
|
||||
@@ -80,25 +81,33 @@ async function handleInactivity() {
|
||||
inactivityModalTimer = null;
|
||||
}
|
||||
if (res.confirm) {
|
||||
inactivityManager?.resume(); // 恢复监听
|
||||
inactivityManager?.resume();
|
||||
} else {
|
||||
performLogout();
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
if (inactivityModalTimer) clearTimeout(inactivityModalTimer);
|
||||
if (inactivityModalTimer) {
|
||||
clearTimeout(inactivityModalTimer);
|
||||
inactivityModalTimer = null;
|
||||
}
|
||||
performLogout();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
inactivityManager?.resume(); // 恢复监听
|
||||
}
|
||||
// 启动 10 秒自动登出定时器
|
||||
|
||||
// 2. 启动 10 秒倒计时
|
||||
inactivityModalTimer = setTimeout(() => {
|
||||
inactivityModalTimer = null;
|
||||
console.log('【自动登出】用户10秒未操作');
|
||||
console.log('【自动登出】10秒无响应,强制清理状态');
|
||||
|
||||
// 【关键改进】:通知全局组件强制关闭弹窗,防止用户点击陈旧弹窗
|
||||
uni.$emit('hide-global-popup');
|
||||
|
||||
performLogout();
|
||||
}, 10000); // 10秒
|
||||
}, 10000);
|
||||
} else {
|
||||
inactivityManager?.resume();
|
||||
}
|
||||
}
|
||||
|
||||
function performLogout() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default {
|
||||
// baseUrl: 'https://fw.rc.qingdao.gov.cn/rgpp-api/api', // 内网
|
||||
baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试
|
||||
baseUrl: 'https://fw.rc.qingdao.gov.cn/rgpp-api/api', // 内网
|
||||
// baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试
|
||||
// baseUrl: 'http://192.168.3.29:8081',
|
||||
// baseUrl: 'http://10.213.6.207:19010/api',
|
||||
// 语音转文字
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
</tabcontrolVue>
|
||||
<SelectJobs ref="selectJobsModel"></SelectJobs>
|
||||
<!-- 后门 -->
|
||||
<view class="backdoor" @click="loginbackdoor">
|
||||
<view class="backdoor" v-if="!isMachineEnv" @click="loginbackdoor">
|
||||
<my-icons type="gift-filled" size="60"></my-icons>
|
||||
</view>
|
||||
</AppLayout>
|
||||
@@ -276,9 +276,7 @@ const resetCountdown = () => {
|
||||
const returnToHome = () => {
|
||||
stopCountdown();
|
||||
stopScanAnimation();
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index',
|
||||
});
|
||||
useUserStore().logOutApp();
|
||||
};
|
||||
|
||||
// 取消登录
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<scroll-view :scroll-y="true" class="nearby-scroll" @scrolltolower="scrollBottom">
|
||||
<view class="nearby-map" @touchmove.stop.prevent>
|
||||
<map
|
||||
style="width: 100%; height:410rpx "
|
||||
style="width: 100%; height: 410rpx"
|
||||
:latitude="latitudeVal"
|
||||
:longitude="longitudeVal"
|
||||
:markers="mapCovers"
|
||||
@@ -16,7 +16,7 @@
|
||||
<image class="view-sx" :class="{ active: rangeShow }" src="@/static/icon/shaixun.png"></image>
|
||||
</view>
|
||||
<transition name="fade-slide">
|
||||
<view class="select-list" v-if="rangeShow">
|
||||
<view class="select-list" v-show="rangeShow">
|
||||
<view class="list-item button-click" v-for="(item, index) in range" @click="changeRadius(item)">
|
||||
{{ item }}km
|
||||
</view>
|
||||
@@ -147,6 +147,7 @@ function changeRangeShow() {
|
||||
}
|
||||
|
||||
function changeRadius(item) {
|
||||
console.log(item);
|
||||
pageState.search.radius = item;
|
||||
rangeShow.value = false;
|
||||
progressChange(item);
|
||||
@@ -244,7 +245,7 @@ function getInit() {
|
||||
}
|
||||
|
||||
function progressChange(value) {
|
||||
const range = 1 + value;
|
||||
const range = value < 1 ? 1 : value;
|
||||
pageState.search.radius = range;
|
||||
mapCircles.value = [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref, computed } from 'vue';
|
||||
import {
|
||||
defineStore
|
||||
} from 'pinia';
|
||||
import {
|
||||
ref,
|
||||
computed
|
||||
} from 'vue';
|
||||
import wideScreenStyles from '../common/wide-screen.css?inline';
|
||||
|
||||
// 屏幕检测管理器类
|
||||
class ScreenDetectionManager {
|
||||
@@ -9,6 +15,8 @@ class ScreenDetectionManager {
|
||||
this.resizeTimer = null;
|
||||
this.resizeListeners = [];
|
||||
this.cssLink = null;
|
||||
this.STYLE_ID = 'wide-screen-style-tag';
|
||||
this.styleTag = null;
|
||||
}
|
||||
|
||||
// 获取屏幕宽度
|
||||
@@ -46,8 +54,7 @@ class ScreenDetectionManager {
|
||||
foldable: true,
|
||||
count: window.visualViewport.segments.length - 1
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return {
|
||||
foldable: false,
|
||||
count: 1
|
||||
@@ -101,16 +108,40 @@ class ScreenDetectionManager {
|
||||
}
|
||||
|
||||
// 更新 CSS 状态
|
||||
// updateWideScreenCSS(isWideScreen) {
|
||||
// if (isWideScreen) {
|
||||
// return this.loadWideScreenCSS();
|
||||
// } else {
|
||||
// return this.removeWideScreenCSS();
|
||||
// }
|
||||
// }
|
||||
|
||||
updateWideScreenCSS(isWideScreen) {
|
||||
if (typeof document === 'undefined') return;
|
||||
|
||||
if (isWideScreen) {
|
||||
return this.loadWideScreenCSS();
|
||||
// 如果已经是宽屏且标签已存在,则不重复创建
|
||||
if (document.getElementById(this.STYLE_ID)) return;
|
||||
|
||||
this.styleTag = document.createElement('style');
|
||||
this.styleTag.id = this.STYLE_ID;
|
||||
this.styleTag.innerHTML = wideScreenStyles; // 将 CSS 文本注入
|
||||
document.head.appendChild(this.styleTag);
|
||||
console.log('宽屏样式已通过内联方式注入');
|
||||
} else {
|
||||
return this.removeWideScreenCSS();
|
||||
// 非宽屏时移除标签
|
||||
const existingTag = document.getElementById(this.STYLE_ID);
|
||||
if (existingTag) {
|
||||
existingTag.remove();
|
||||
this.styleTag = null;
|
||||
console.log('宽屏样式已移除');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//显示/隐藏默认tabbar
|
||||
updateTabbar(isWideScreen){
|
||||
if(isWideScreen) uni.hideTabBar()
|
||||
updateTabbar(isWideScreen) {
|
||||
if (isWideScreen) uni.hideTabBar()
|
||||
else uni.showTabBar()
|
||||
}
|
||||
|
||||
@@ -126,7 +157,10 @@ class ScreenDetectionManager {
|
||||
};
|
||||
|
||||
window.addEventListener('resize', handler);
|
||||
this.resizeListeners.push({ callback, handler });
|
||||
this.resizeListeners.push({
|
||||
callback,
|
||||
handler
|
||||
});
|
||||
|
||||
// 返回清理函数
|
||||
return () => this.removeResizeListener(callback);
|
||||
@@ -136,7 +170,9 @@ class ScreenDetectionManager {
|
||||
removeResizeListener(callback) {
|
||||
const index = this.resizeListeners.findIndex(item => item.callback === callback);
|
||||
if (index > -1) {
|
||||
const { handler } = this.resizeListeners[index];
|
||||
const {
|
||||
handler
|
||||
} = this.resizeListeners[index];
|
||||
window.removeEventListener('resize', handler);
|
||||
this.resizeListeners.splice(index, 1);
|
||||
}
|
||||
@@ -173,7 +209,10 @@ const useScreenStore = defineStore('screen', () => {
|
||||
try {
|
||||
// 检测屏幕状态
|
||||
const width = await manager.getScreenWidth();
|
||||
const { foldable, count } = manager.checkVisualViewport();
|
||||
const {
|
||||
foldable,
|
||||
count
|
||||
} = manager.checkVisualViewport();
|
||||
|
||||
foldFeature.value = foldable;
|
||||
foldCount.value = count;
|
||||
@@ -207,7 +246,10 @@ const useScreenStore = defineStore('screen', () => {
|
||||
const updateScreenStatus = async () => {
|
||||
try {
|
||||
const width = await manager.getScreenWidth();
|
||||
const { foldable, count } = manager.checkVisualViewport();
|
||||
const {
|
||||
foldable,
|
||||
count
|
||||
} = manager.checkVisualViewport();
|
||||
|
||||
// 保存旧状态
|
||||
const oldWidth = screenWidth.value;
|
||||
@@ -222,7 +264,9 @@ const useScreenStore = defineStore('screen', () => {
|
||||
|
||||
// 检查宽屏状态是否发生变化
|
||||
if (oldIsWideScreen !== isWideScreen.value) {
|
||||
console.log(`🔄 屏幕状态变化: ${oldIsWideScreen ? '宽屏' : '非宽屏'} -> ${isWideScreen.value ? '宽屏' : '非宽屏'}`);
|
||||
console.log(
|
||||
`🔄 屏幕状态变化: ${oldIsWideScreen ? '宽屏' : '非宽屏'} -> ${isWideScreen.value ? '宽屏' : '非宽屏'}`
|
||||
);
|
||||
console.log(`屏幕宽度变化: ${oldWidth}px -> ${width}px`);
|
||||
manager.updateWideScreenCSS(isWideScreen.value);
|
||||
manager.updateTabbar(isWideScreen.value);
|
||||
@@ -230,7 +274,9 @@ const useScreenStore = defineStore('screen', () => {
|
||||
|
||||
// 检查折叠屏状态是否发生变化
|
||||
if (oldFoldable !== foldable || oldFoldCount !== count) {
|
||||
console.log(`折叠屏状态变化: ${oldFoldable ? '是' : '否'}->${foldable ? '是' : '否'}, 折叠数: ${oldFoldCount}->${count}`);
|
||||
console.log(
|
||||
`折叠屏状态变化: ${oldFoldable ? '是' : '否'}->${foldable ? '是' : '否'}, 折叠数: ${oldFoldCount}->${count}`
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -53,7 +53,7 @@ export default function viteInjectPopup() {
|
||||
'\n <global-popup />\n' +
|
||||
code.slice(lastTemplateEndIndex);
|
||||
|
||||
console.log(`🎯 [精准注入]: ${relativePath}`);
|
||||
console.log(`[精准注入]: ${relativePath}`);
|
||||
return {
|
||||
code: newCode,
|
||||
map: null
|
||||
|
||||
Reference in New Issue
Block a user