flat: bug修复

This commit is contained in:
Apcallover
2025-12-17 19:48:45 +08:00
parent ab3201b015
commit a10fd29440
6 changed files with 359 additions and 305 deletions

33
App.vue
View File

@@ -25,7 +25,7 @@ onLaunch((options) => {
useUserStore().changMachineEnv(false); useUserStore().changMachineEnv(false);
return; return;
} }
if (!isY9MachineType()) { if (isY9MachineType()) {
console.warn('求职一体机环境'); console.warn('求职一体机环境');
baseDB.resetAndReinit(); // 清空indexdb baseDB.resetAndReinit(); // 清空indexdb
useUserStore().logOutApp(); useUserStore().logOutApp();
@@ -63,15 +63,16 @@ onHide(() => {
console.log('App Hide'); console.log('App Hide');
}); });
async function handleInactivity() { function handleInactivity() {
console.log('【全局】60秒无操作执行安全逻辑'); console.log('【全局】60秒无操作执行安全逻辑');
if (inactivityModalTimer) { if (inactivityModalTimer) {
clearTimeout(inactivityModalTimer); clearTimeout(inactivityModalTimer);
inactivityModalTimer = null; inactivityModalTimer = null;
} }
if (useUserStore().hasLogin) { if (useUserStore().hasLogin) {
// 示例:弹窗确认 // 1. 正常弹出确认
await $confirm({ $confirm({
title: '会话即将过期', title: '会话即将过期',
content: '长时间无操作,是否继续使用?', content: '长时间无操作,是否继续使用?',
success: (res) => { success: (res) => {
@@ -80,25 +81,33 @@ async function handleInactivity() {
inactivityModalTimer = null; inactivityModalTimer = null;
} }
if (res.confirm) { if (res.confirm) {
inactivityManager?.resume(); // 恢复监听 inactivityManager?.resume();
} else { } else {
performLogout(); performLogout();
} }
}, },
fail: () => { fail: () => {
if (inactivityModalTimer) clearTimeout(inactivityModalTimer); if (inactivityModalTimer) {
clearTimeout(inactivityModalTimer);
inactivityModalTimer = null;
}
performLogout(); performLogout();
}, },
}); });
} else {
inactivityManager?.resume(); // 恢复监听 // 2. 启动 10 秒倒计时
}
// 启动 10 秒自动登出定时器
inactivityModalTimer = setTimeout(() => { inactivityModalTimer = setTimeout(() => {
inactivityModalTimer = null; inactivityModalTimer = null;
console.log('【自动登出】用户10秒未操作'); console.log('【自动登出】10秒无响应,强制清理状态');
// 【关键改进】:通知全局组件强制关闭弹窗,防止用户点击陈旧弹窗
uni.$emit('hide-global-popup');
performLogout(); performLogout();
}, 10000); // 10秒 }, 10000);
} else {
inactivityManager?.resume();
}
} }
function performLogout() { function performLogout() {

View File

@@ -1,6 +1,6 @@
export default { export default {
// baseUrl: 'https://fw.rc.qingdao.gov.cn/rgpp-api/api', // 内网 baseUrl: 'https://fw.rc.qingdao.gov.cn/rgpp-api/api', // 内网
baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试 // baseUrl: 'https://qd.zhaopinzao8dian.com/api', // 测试
// 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',
// 语音转文字 // 语音转文字

View File

@@ -182,7 +182,7 @@
</tabcontrolVue> </tabcontrolVue>
<SelectJobs ref="selectJobsModel"></SelectJobs> <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> <my-icons type="gift-filled" size="60"></my-icons>
</view> </view>
</AppLayout> </AppLayout>
@@ -276,9 +276,7 @@ const resetCountdown = () => {
const returnToHome = () => { const returnToHome = () => {
stopCountdown(); stopCountdown();
stopScanAnimation(); stopScanAnimation();
uni.switchTab({ useUserStore().logOutApp();
url: '/pages/index/index',
});
}; };
// 取消登录 // 取消登录

View File

@@ -2,7 +2,7 @@
<scroll-view :scroll-y="true" class="nearby-scroll" @scrolltolower="scrollBottom"> <scroll-view :scroll-y="true" class="nearby-scroll" @scrolltolower="scrollBottom">
<view class="nearby-map" @touchmove.stop.prevent> <view class="nearby-map" @touchmove.stop.prevent>
<map <map
style="width: 100%; height:410rpx " style="width: 100%; height: 410rpx"
:latitude="latitudeVal" :latitude="latitudeVal"
:longitude="longitudeVal" :longitude="longitudeVal"
:markers="mapCovers" :markers="mapCovers"
@@ -16,7 +16,7 @@
<image class="view-sx" :class="{ active: rangeShow }" src="@/static/icon/shaixun.png"></image> <image class="view-sx" :class="{ active: rangeShow }" src="@/static/icon/shaixun.png"></image>
</view> </view>
<transition name="fade-slide"> <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)"> <view class="list-item button-click" v-for="(item, index) in range" @click="changeRadius(item)">
{{ item }}km {{ item }}km
</view> </view>
@@ -147,6 +147,7 @@ function changeRangeShow() {
} }
function changeRadius(item) { function changeRadius(item) {
console.log(item);
pageState.search.radius = item; pageState.search.radius = item;
rangeShow.value = false; rangeShow.value = false;
progressChange(item); progressChange(item);
@@ -244,7 +245,7 @@ function getInit() {
} }
function progressChange(value) { function progressChange(value) {
const range = 1 + value; const range = value < 1 ? 1 : value;
pageState.search.radius = range; pageState.search.radius = range;
mapCircles.value = [ mapCircles.value = [
{ {

View File

@@ -1,5 +1,11 @@
import { defineStore } from 'pinia'; import {
import { ref, computed } from 'vue'; defineStore
} from 'pinia';
import {
ref,
computed
} from 'vue';
import wideScreenStyles from '../common/wide-screen.css?inline';
// 屏幕检测管理器类 // 屏幕检测管理器类
class ScreenDetectionManager { class ScreenDetectionManager {
@@ -9,6 +15,8 @@ class ScreenDetectionManager {
this.resizeTimer = null; this.resizeTimer = null;
this.resizeListeners = []; this.resizeListeners = [];
this.cssLink = null; this.cssLink = null;
this.STYLE_ID = 'wide-screen-style-tag';
this.styleTag = null;
} }
// 获取屏幕宽度 // 获取屏幕宽度
@@ -46,8 +54,7 @@ class ScreenDetectionManager {
foldable: true, foldable: true,
count: window.visualViewport.segments.length - 1 count: window.visualViewport.segments.length - 1
} }
} } else {
else {
return { return {
foldable: false, foldable: false,
count: 1 count: 1
@@ -101,16 +108,40 @@ class ScreenDetectionManager {
} }
// 更新 CSS 状态 // 更新 CSS 状态
// updateWideScreenCSS(isWideScreen) {
// if (isWideScreen) {
// return this.loadWideScreenCSS();
// } else {
// return this.removeWideScreenCSS();
// }
// }
updateWideScreenCSS(isWideScreen) { updateWideScreenCSS(isWideScreen) {
if (typeof document === 'undefined') return;
if (isWideScreen) { 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 { } else {
return this.removeWideScreenCSS(); // 非宽屏时移除标签
const existingTag = document.getElementById(this.STYLE_ID);
if (existingTag) {
existingTag.remove();
this.styleTag = null;
console.log('宽屏样式已移除');
} }
} }
}
//显示/隐藏默认tabbar //显示/隐藏默认tabbar
updateTabbar(isWideScreen){ updateTabbar(isWideScreen) {
if(isWideScreen) uni.hideTabBar() if (isWideScreen) uni.hideTabBar()
else uni.showTabBar() else uni.showTabBar()
} }
@@ -126,7 +157,10 @@ class ScreenDetectionManager {
}; };
window.addEventListener('resize', handler); window.addEventListener('resize', handler);
this.resizeListeners.push({ callback, handler }); this.resizeListeners.push({
callback,
handler
});
// 返回清理函数 // 返回清理函数
return () => this.removeResizeListener(callback); return () => this.removeResizeListener(callback);
@@ -136,7 +170,9 @@ class ScreenDetectionManager {
removeResizeListener(callback) { removeResizeListener(callback) {
const index = this.resizeListeners.findIndex(item => item.callback === callback); const index = this.resizeListeners.findIndex(item => item.callback === callback);
if (index > -1) { if (index > -1) {
const { handler } = this.resizeListeners[index]; const {
handler
} = this.resizeListeners[index];
window.removeEventListener('resize', handler); window.removeEventListener('resize', handler);
this.resizeListeners.splice(index, 1); this.resizeListeners.splice(index, 1);
} }
@@ -173,7 +209,10 @@ const useScreenStore = defineStore('screen', () => {
try { try {
// 检测屏幕状态 // 检测屏幕状态
const width = await manager.getScreenWidth(); const width = await manager.getScreenWidth();
const { foldable, count } = manager.checkVisualViewport(); const {
foldable,
count
} = manager.checkVisualViewport();
foldFeature.value = foldable; foldFeature.value = foldable;
foldCount.value = count; foldCount.value = count;
@@ -207,7 +246,10 @@ const useScreenStore = defineStore('screen', () => {
const updateScreenStatus = async () => { const updateScreenStatus = async () => {
try { try {
const width = await manager.getScreenWidth(); const width = await manager.getScreenWidth();
const { foldable, count } = manager.checkVisualViewport(); const {
foldable,
count
} = manager.checkVisualViewport();
// 保存旧状态 // 保存旧状态
const oldWidth = screenWidth.value; const oldWidth = screenWidth.value;
@@ -222,7 +264,9 @@ const useScreenStore = defineStore('screen', () => {
// 检查宽屏状态是否发生变化 // 检查宽屏状态是否发生变化
if (oldIsWideScreen !== isWideScreen.value) { if (oldIsWideScreen !== isWideScreen.value) {
console.log(`🔄 屏幕状态变化: ${oldIsWideScreen ? '宽屏' : '非宽屏'} -> ${isWideScreen.value ? '宽屏' : '非宽屏'}`); console.log(
`🔄 屏幕状态变化: ${oldIsWideScreen ? '宽屏' : '非宽屏'} -> ${isWideScreen.value ? '宽屏' : '非宽屏'}`
);
console.log(`屏幕宽度变化: ${oldWidth}px -> ${width}px`); console.log(`屏幕宽度变化: ${oldWidth}px -> ${width}px`);
manager.updateWideScreenCSS(isWideScreen.value); manager.updateWideScreenCSS(isWideScreen.value);
manager.updateTabbar(isWideScreen.value); manager.updateTabbar(isWideScreen.value);
@@ -230,7 +274,9 @@ const useScreenStore = defineStore('screen', () => {
// 检查折叠屏状态是否发生变化 // 检查折叠屏状态是否发生变化
if (oldFoldable !== foldable || oldFoldCount !== count) { if (oldFoldable !== foldable || oldFoldCount !== count) {
console.log(`折叠屏状态变化: ${oldFoldable ? '是' : '否'}->${foldable ? '是' : '否'}, 折叠数: ${oldFoldCount}->${count}`); console.log(
`折叠屏状态变化: ${oldFoldable ? '是' : '否'}->${foldable ? '是' : '否'}, 折叠数: ${oldFoldCount}->${count}`
);
} }
return { return {

View File

@@ -53,7 +53,7 @@ export default function viteInjectPopup() {
'\n <global-popup />\n' + '\n <global-popup />\n' +
code.slice(lastTemplateEndIndex); code.slice(lastTemplateEndIndex);
console.log(`🎯 [精准注入]: ${relativePath}`); console.log(`[精准注入]: ${relativePath}`);
return { return {
code: newCode, code: newCode,
map: null map: null