From 7ad59aeeab18deb262015f67666d340071cb34d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E8=BE=89?= Date: Fri, 1 May 2026 04:02:50 +0800 Subject: [PATCH] 111 --- config.js | 4 ++-- pages/index/components/index-one.vue | 5 ++++ stores/useDictStore.js | 36 +++++++++++++++------------- utils/request.js | 6 +++-- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/config.js b/config.js index dff82d2..4f174da 100644 --- a/config.js +++ b/config.js @@ -6,8 +6,8 @@ */ export default { // baseUrl: 'http://39.98.44.136:8080', // 测试 - // baseUrl: 'https://www.xjksly.cn/api/ks', // 正式环境 - baseUrl: 'http://ks.zhaopinzao8dian.com/api/ks', // 测试 + baseUrl: 'https://www.xjksly.cn/api/ks', // 正式环境 + // baseUrl: 'http://ks.zhaopinzao8dian.com/api/ks', // 测试 // LCBaseUrl:'http://10.110.145.145:9100',//内网端口 // LCBaseUrlInner:'http://10.110.145.145:10100',//招聘、培训、帮扶 diff --git a/pages/index/components/index-one.vue b/pages/index/components/index-one.vue index c203464..3749736 100644 --- a/pages/index/components/index-one.vue +++ b/pages/index/components/index-one.vue @@ -786,6 +786,7 @@ const rangeOptions = ref([ ]); const isLoaded = ref(false); const isInitialized = ref(false); // 添加初始化标志 +const isRecommendLoading = ref(false); // 请求锁,防止重复调用 const { columnCount, columnSpace } = useColumnCount(() => { pageState.pageSize = 10 * (columnCount.value - 1) + 10; @@ -1243,10 +1244,12 @@ function handelHostestSearch(val) { } function getJobRecommend(type = 'add') { + if (isRecommendLoading.value) return; if (type === 'refresh') { list.value = []; if (waterfallsFlowRef.value) waterfallsFlowRef.value.refresh(); } + isRecommendLoading.value = true; let params = { pageSize: pageState.pageSize + 10, sessionId: useUserStore().seesionId, @@ -1320,6 +1323,8 @@ function getJobRecommend(type = 'add') { if (!data.length) { useUserStore().initSeesionId(); } + }).finally(() => { + isRecommendLoading.value = false; }); } diff --git a/stores/useDictStore.js b/stores/useDictStore.js index f74bac9..d023955 100644 --- a/stores/useDictStore.js +++ b/stores/useDictStore.js @@ -29,6 +29,7 @@ function buildIndex(tree) { const useDictStore = defineStore("dict", () => { // 定义状态 const complete = ref(false) + const dictLoading = ref(false) const state = reactive({ education: [], experience: [], @@ -43,13 +44,16 @@ const useDictStore = defineStore("dict", () => { }) // political_affiliation const getDictData = async (dictType, dictName) => { + if (dictType && dictName) { + return getDictSelectOption(dictType).then((data) => { + state[dictName] = data + return data + }) + } + if (complete.value) return + if (dictLoading.value) return + dictLoading.value = true try { - if (dictType && dictName) { - return getDictSelectOption(dictType).then((data) => { - state[dictName] = data - return data - }) - } const [education, experience, area, scale, sex, affiliation, nature, noticeType] = await Promise.all([ getDictSelectOption('education'), @@ -75,16 +79,16 @@ const useDictStore = defineStore("dict", () => { } catch (error) { console.error('Error fetching dictionary data:', error); // 确保即使出错也能返回空数组 - if (!dictType && !dictName) { - state.education = []; - state.experience = []; - state.area = []; - state.scale = []; - state.sex = []; - state.affiliation = []; - state.nature = []; - state.noticeType = []; - } + state.education = []; + state.experience = []; + state.area = []; + state.scale = []; + state.sex = []; + state.affiliation = []; + state.nature = []; + state.noticeType = []; + } finally { + dictLoading.value = false } }; diff --git a/utils/request.js b/utils/request.js index b9b74d9..9777470 100644 --- a/utils/request.js +++ b/utils/request.js @@ -23,9 +23,11 @@ const encryptPathPrefixes = [ '/app/companycontact/', '/app/appskill/', '/app/userworkexperiences/', + '/app/appWxphoneSmsCode', '/app/user/', '/app/user/resume/', '/cms/job/recommen/', + '/app/appLoginPhone', '/app/notice/', ]; @@ -49,7 +51,7 @@ const isEncryptNeeded = (method, url) => { const encryptRequestData = (data) => { const jsonData = JSON.stringify(data); // const jsonData = JSON.stringify({a: '1'}); - console.log('[请求] 加密前:', jsonData) + // console.log('[请求] 加密前:', jsonData) return { encrypted: true, encryptedData: sm4Encrypt(config.sm4Config.key, jsonData), @@ -62,7 +64,7 @@ const handleResponseData = (resData) => { if (resData?.encrypted) { const decrypted = sm4Decrypt(config.sm4Config.key, resData.encryptedData); resData = JSON.parse(decrypted); - console.log('[请求] 解密后数据:', resData); + // console.log('[请求] 解密后数据:', resData); } } catch (e) { console.error('[请求] 解密失败:', e.message);