From 4563fa90af0887652ecb8fa9e68841d832de9368 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Thu, 27 Nov 2025 21:26:32 +0800 Subject: [PATCH 01/16] =?UTF-8?q?flat:=20=E4=BC=98=E5=8C=96=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/selectJobs/selectJobs.vue | 15 +- config.js | 4 +- packageA/pages/addPosition/addPosition.vue | 178 ++++++++++++++++++++- 3 files changed, 192 insertions(+), 5 deletions(-) diff --git a/components/selectJobs/selectJobs.vue b/components/selectJobs/selectJobs.vue index 09cc886..2ac6218 100644 --- a/components/selectJobs/selectJobs.vue +++ b/components/selectJobs/selectJobs.vue @@ -86,14 +86,13 @@ const open = (newConfig = {}) => { } = newConfig; reset(); - serchforIt(defaultId); - if (configTitle) title.value = configTitle; if (typeof success === 'function') confirmCallback.value = success; if (typeof cancel === 'function') cancelCallback.value = cancel; if (typeof change === 'function') changeCallback.value = change; if (Array.isArray(data)) listData.value = data; + serchforIt(defaultId); rowLabel.value = configRowLabel; rowKey.value = configRowKey; maskClick.value = configMaskClick; @@ -154,6 +153,18 @@ function serchforIt(defaultId) { state.visible = true; return; } + if (listData.value.length) { + if (userInfo.value.jobTitleId) { + const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id)); + count.value = ids.length; + setCheckedNodes(listData.value, ids); + } + state.jobTitleId = userInfo.value.jobTitleId; + state.stations = listData.value; + state.visible = true; + + return; + } $api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => { if (userInfo.value.jobTitleId) { const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id)); diff --git a/config.js b/config.js index 74e3c87..fb1fc56 100644 --- a/config.js +++ b/config.js @@ -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', // 语音转文字 diff --git a/packageA/pages/addPosition/addPosition.vue b/packageA/pages/addPosition/addPosition.vue index 35d1892..2eeef40 100644 --- a/packageA/pages/addPosition/addPosition.vue +++ b/packageA/pages/addPosition/addPosition.vue @@ -12,11 +12,33 @@ 选择想找的工作,我的将在首页为你推荐 - + + + + + + {{ item.lable }} + + + + {{ item }} + + + \ No newline at end of file + diff --git a/components/renderDeliveryRecord/renderDeliveryRecord.vue b/components/renderDeliveryRecord/renderDeliveryRecord.vue index 111a610..8aca631 100644 --- a/components/renderDeliveryRecord/renderDeliveryRecord.vue +++ b/components/renderDeliveryRecord/renderDeliveryRecord.vue @@ -3,22 +3,25 @@ - + {{ job.jobTitle }} - + {{ job.companyName }} - {{job.education == '不限' ? '学历不限' : job.education}} + {{ job.education == '不限' ? '学历不限' : job.education }} - {{job.experience == '不限' ? '经验不限' : job.experience}} + {{ job.experience == '不限' ? '经验不限' : job.experience }} - {{ vacanciesTo(job.vacancies) }} + {{ vacanciesTo(job.vacancies) }} @@ -34,22 +37,25 @@ - + - + {{ job.jobTitle }} - + {{ job.companyName }} - {{job.education == '不限' ? '学历不限' : job.education}} + {{ job.education == '不限' ? '学历不限' : job.education }} - {{job.experience == '不限' ? '经验不限' : job.experience}} + {{ job.experience == '不限' ? '经验不限' : job.experience }} {{ vacanciesTo(job.vacancies) }} @@ -77,7 +83,7 @@ @@ -198,4 +207,4 @@ function nextDetail(job) { color: #6C7282; } } - \ No newline at end of file + diff --git a/components/renderJobCollectionRecord/renderJobCollectionRecord.vue b/components/renderJobCollectionRecord/renderJobCollectionRecord.vue index c1f6888..3857395 100644 --- a/components/renderJobCollectionRecord/renderJobCollectionRecord.vue +++ b/components/renderJobCollectionRecord/renderJobCollectionRecord.vue @@ -3,19 +3,22 @@ - + {{ job.jobTitle }} - + {{ job.companyName }} - {{job.education == '不限' ? '学历不限' : job.education}} + {{ job.education == '不限' ? '学历不限' : job.education }} - {{job.experience == '不限' ? '经验不限' : job.experience}} + {{ job.experience == '不限' ? '经验不限' : job.experience }} {{ vacanciesTo(job.vacancies) }} @@ -34,22 +37,25 @@ - + - + {{ job.jobTitle }} - + {{ job.companyName }} - {{job.education == '不限' ? '学历不限' : job.education}} + {{ job.education == '不限' ? '学历不限' : job.education }} - {{job.experience == '不限' ? '经验不限' : job.experience}} + {{ job.experience == '不限' ? '经验不限' : job.experience }} {{ vacanciesTo(job.vacancies) }} @@ -77,7 +83,7 @@ @@ -198,4 +207,4 @@ function nextDetail(job) { color: #6C7282; } } - \ No newline at end of file + From 6eb0767a88d39db926fa1f57ef3b479a650165a0 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Fri, 28 Nov 2025 14:33:08 +0800 Subject: [PATCH 03/16] =?UTF-8?q?flatL=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 3 +-- config.js | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/App.vue b/App.vue index 9a66f58..b68a331 100644 --- a/App.vue +++ b/App.vue @@ -51,7 +51,6 @@ function getUserInfo() { const sm2_privateKey = config.appInfo.sm2PrivateKey; let sm2_encrypt_result = data.data; let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, sm2_privateKey); - console.log(sm2_decrypt_result); if (typeof sm2_decrypt_result == 'string') sm2_decrypt_result = JSON.parse(sm2_decrypt_result); // 其次,对sm2解密后的结果进行 aes解密 @@ -100,7 +99,7 @@ function oncloseWindow() { function loginCallback(userInfo) { let params = { - username: userInfo, + userInfo, }; $api.createRequest('/app/login', params, 'post').then((resData) => { useUserStore() diff --git a/config.js b/config.js index fb1fc56..74e3c87 100644 --- a/config.js +++ b/config.js @@ -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', // 语音转文字 From b447026f99e2824d1a4c73af90ee52f0c05da959 Mon Sep 17 00:00:00 2001 From: xiebing Date: Fri, 28 Nov 2025 17:22:36 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E5=B2=97=E4=BD=8D=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E6=8F=92=E5=85=A5=E6=94=B9=E4=B8=BA=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/components/index-one.vue | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pages/index/components/index-one.vue b/pages/index/components/index-one.vue index 6de61d6..3b50ec1 100644 --- a/pages/index/components/index-one.vue +++ b/pages/index/components/index-one.vue @@ -359,7 +359,11 @@ function getJobRecommend(type = 'add') { ...pageState.search, ...conditionSearch.value, }; - let comd = { recommend: true, jobCategory: '', tip: '确认你的兴趣,为您推荐更多合适的岗位' }; + let comd = { + recommend: true, + jobCategory: '', + tip: '确认你的兴趣,为您推荐更多合适的岗位', + }; $api.createRequest('/app/job/recommend', params).then((resData) => { const { data, total } = resData; pageState.total = 0; @@ -380,7 +384,16 @@ function getJobRecommend(type = 'add') { if (question) { comd.jobCategory = question; - data.unshift(comd); + // 生成随机插入位置,排除前两个和最后两个位置 + let insertIndex; + if (data.length <= 4) { + // 如果数据长度小于等于4,直接插入到中间位置 + insertIndex = Math.floor(data.length / 2); + } else { + // 生成2到data.length-2之间的随机位置 + insertIndex = Math.floor(Math.random() * (data.length - 4)) + 2; + } + data.splice(insertIndex, 0, comd); } } const reslist = dataToImg(data); From b53d8196b4623548428da2daeebb72e0c269a7df Mon Sep 17 00:00:00 2001 From: xiebing Date: Fri, 28 Nov 2025 17:49:05 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E7=AB=9E=E4=BA=89=E5=8A=9B=E5=88=86?= =?UTF-8?q?=E6=9E=90=E8=B6=85=E8=BF=873=E4=B8=AA=E6=89=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA,=20=E7=AE=80=E5=8E=86=E5=AE=8C=E6=88=90=E5=BA=A6?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=B7=A5=E4=BD=9C=E7=BB=8F=E5=8E=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packageA/pages/post/post.vue | 2 +- stores/useUserStore.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packageA/pages/post/post.vue b/packageA/pages/post/post.vue index fe84ac0..f0d83ed 100644 --- a/packageA/pages/post/post.vue +++ b/packageA/pages/post/post.vue @@ -128,7 +128,7 @@ - + 竞争力分析 diff --git a/stores/useUserStore.js b/stores/useUserStore.js index 646a226..e489188 100644 --- a/stores/useUserStore.js +++ b/stores/useUserStore.js @@ -31,6 +31,7 @@ function getResumeCompletionPercentage(resume) { 'status', 'jobTitleId', 'jobTitle', + 'workExp' ]; const totalFields = requiredFields.length; From 550173c82de037d32eda44232f9824f4c5c970b9 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Fri, 28 Nov 2025 17:53:26 +0800 Subject: [PATCH 06/16] =?UTF-8?q?flat:=20=E4=BF=AE=E6=94=B9=E9=94=99?= =?UTF-8?q?=E5=88=AB=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages.json b/pages.json index 37782d1..f54ad54 100644 --- a/pages.json +++ b/pages.json @@ -117,7 +117,7 @@ { "path": "pages/vCard/vCard", "style": { - "navigationBarTitleText": "点子名片", + "navigationBarTitleText": "电子名片", "navigationBarBackgroundColor": "#FFFFFF", "navigationStyle": "custom" } From 78661c12aff10aae986ba770f1fd7d64777b6855 Mon Sep 17 00:00:00 2001 From: xiebing Date: Fri, 28 Nov 2025 18:17:22 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E6=97=A5=E6=9C=9F=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packageA/pages/selectDate/selectDate.vue | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packageA/pages/selectDate/selectDate.vue b/packageA/pages/selectDate/selectDate.vue index 03cf809..c686301 100644 --- a/packageA/pages/selectDate/selectDate.vue +++ b/packageA/pages/selectDate/selectDate.vue @@ -26,6 +26,7 @@ { + updateDateArray() if (options.date) { current.value = { date: options?.date || null, @@ -79,6 +83,20 @@ onLoad((options) => { } }); +function hasZphInData(item) { + return hasZphDateArray.value.some(date=>date == item.date) +} + +async function updateDateArray() { + if(localStorage.getItem('hasZphDateArray')) hasZphDateArray.value = localStorage.getItem('hasZphDateArray') + + let res = await $api.createRequest('/app/internal/getDateList', {}, 'get') + if(res.data){ + hasZphDateArray.value = res.data + localStorage.setItem('hasZphDateArray',res.data) + } +} + function backParams() { if (isValidDateString(current.value.date)) { navBack({ From d84fd90a11908fa4396439b34842e225203dfe8a Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Fri, 28 Nov 2025 19:47:42 +0800 Subject: [PATCH 08/16] =?UTF-8?q?flat:=20=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 9 +- pages/mine/mine.vue | 12 +- stores/useReadMsg.js | 2 + stores/useUserStore.js | 20 +- .../pinia-plugin-unistorage/changelog.md | 31 +++ .../pinia-plugin-unistorage/index.d.ts | 112 +++++++++ uni_modules/pinia-plugin-unistorage/index.js | 162 +++++++++++++ .../pinia-plugin-unistorage/package.json | 94 ++++++++ uni_modules/pinia-plugin-unistorage/readme.md | 226 ++++++++++++++++++ .../pinia-plugin-unistorage/src/index.ts | 35 +++ 10 files changed, 691 insertions(+), 12 deletions(-) create mode 100644 uni_modules/pinia-plugin-unistorage/changelog.md create mode 100644 uni_modules/pinia-plugin-unistorage/index.d.ts create mode 100644 uni_modules/pinia-plugin-unistorage/index.js create mode 100644 uni_modules/pinia-plugin-unistorage/package.json create mode 100644 uni_modules/pinia-plugin-unistorage/readme.md create mode 100644 uni_modules/pinia-plugin-unistorage/src/index.ts diff --git a/main.js b/main.js index 671b533..2ebf500 100644 --- a/main.js +++ b/main.js @@ -1,8 +1,12 @@ import App from '@/App' import * as Pinia from 'pinia' +import { + createUnistorage +} from "./uni_modules/pinia-plugin-unistorage"; import globalFunction from '@/common/globalFunction' import '@/lib/string-similarity.min.js' import similarityJobs from '@/utils/similarity_Job.js'; + // 组件 import AppLayout from './components/AppLayout/AppLayout.vue'; import Empty from './components/empty/empty.vue'; @@ -65,7 +69,10 @@ export function createApp() { app.provide('deviceInfo', globalFunction.getdeviceInfo()); app.use(SelectPopupPlugin); - app.use(Pinia.createPinia()); + + const store = Pinia.createPinia(); + store.use(createUnistorage()); + app.use(store); return { app, diff --git a/pages/mine/mine.vue b/pages/mine/mine.vue index 71f5645..afbcc5f 100644 --- a/pages/mine/mine.vue +++ b/pages/mine/mine.vue @@ -110,13 +110,13 @@ import FileUploader from '@/utils/FileUploader.js'; const { $api, navTo } = inject('globalFunction'); import useUserStore from '@/stores/useUserStore'; const popup = ref(null); -const { userInfo, Completion } = storeToRefs(useUserStore()); -const counts = ref({}); +const { userInfo, Completion, counts } = storeToRefs(useUserStore()); + function logOut() { popup.value.open(); } onShow(() => { - getUserstatistics(); + useUserStore().getUserstatistics(); }); function close() { @@ -129,12 +129,6 @@ function confirm() { const isAbove90 = (percent) => parseFloat(percent) < 90; -function getUserstatistics() { - $api.createRequest('/app/user/statistics').then((resData) => { - counts.value = resData.data; - }); -} - function selectFile() { // FileUploader.showMenuAndUpload({ // success: function (res) { diff --git a/stores/useReadMsg.js b/stores/useReadMsg.js index 5e78e60..7f0760d 100644 --- a/stores/useReadMsg.js +++ b/stores/useReadMsg.js @@ -108,4 +108,6 @@ export const useReadMsg = defineStore('readMsg', () => { markAsRead, updateTabBarBadge } +}, { + unistorage: true, }) \ No newline at end of file diff --git a/stores/useUserStore.js b/stores/useUserStore.js index e489188..cd1e655 100644 --- a/stores/useUserStore.js +++ b/stores/useUserStore.js @@ -14,6 +14,10 @@ import { import { useReadMsg } from '@/stores/useReadMsg'; +import { + msg, + $api, +} from '../common/globalFunction'; // 简历完成度计算 function getResumeCompletionPercentage(resume) { @@ -52,7 +56,8 @@ const useUserStore = defineStore("user", () => { const token = ref('') const resume = ref({}) const Completion = ref('0%') - const seesionId = ref(uni.getStorageSync('seesionId') || '') + const seesionId = ref('') + const counts = ref({}) const login = (value) => { hasLogin.value = true; @@ -128,6 +133,13 @@ const useUserStore = defineStore("user", () => { seesionId.value = seesionIdVal } + function getUserstatistics() { + $api.createRequest('/app/user/statistics').then((resData) => { + counts.value = resData.data; + }); + } + + // 导入 return { hasLogin, @@ -140,8 +152,12 @@ const useUserStore = defineStore("user", () => { getUserResume, initSeesionId, seesionId, - Completion + Completion, + getUserstatistics, + counts } +}, { + unistorage: true, }) export default useUserStore; \ No newline at end of file diff --git a/uni_modules/pinia-plugin-unistorage/changelog.md b/uni_modules/pinia-plugin-unistorage/changelog.md new file mode 100644 index 0000000..053621c --- /dev/null +++ b/uni_modules/pinia-plugin-unistorage/changelog.md @@ -0,0 +1,31 @@ +## 0.1.2(2024-07-17) +chore: 移除冗余的 typescript 依赖 +## 0.1.1(2024-07-17) +fix: 修复 createUnistorage 导出 +## 0.1.0(2024-07-10) +fix!: 更新 pinia 类型 +## 0.0.21(2024-07-10) +chore!: 继承 pinia-plugin-persistedstate +## 0.0.19(2024-01-18) + +fix: 重新构建,不需要默认参数 + +## 0.0.16(2023-05-06) + +fix: 修复全局 key 移除 + +## 0.0.14(2023-04-29) + +fix: 修复全局 global key 选项 + +## 0.0.12(2023-04-07) + +- fix: 修复类型错误 + +## 0.0.11(2023-03-22) + +- chore: ts 支持 + +## 0.0.7(2022-04-29) + +- 更新 README diff --git a/uni_modules/pinia-plugin-unistorage/index.d.ts b/uni_modules/pinia-plugin-unistorage/index.d.ts new file mode 100644 index 0000000..b6d3c73 --- /dev/null +++ b/uni_modules/pinia-plugin-unistorage/index.d.ts @@ -0,0 +1,112 @@ +import * as pinia from 'pinia'; +import { StateTree, PiniaPluginContext, PiniaPlugin } from 'pinia'; + +type Prettify = { + [K in keyof T]: T[K]; +}; +type StorageLike = Pick; +interface Serializer { + /** + * Serializes state into string before storing + * @default JSON.stringify + */ + serialize: (value: StateTree) => string; + /** + * Deserializes string into state before hydrating + * @default JSON.parse + */ + deserialize: (value: string) => StateTree; +} +interface PersistedStateOptions { + /** + * Storage key to use. + * @default $store.id + */ + key?: string | ((id: string) => string); + /** + * Where to store persisted state. + * @default localStorage + */ + storage?: StorageLike; + /** + * Dot-notation paths to partially save state. Saves everything if undefined. + * @default undefined + */ + paths?: Array; + /** + * Customer serializer to serialize/deserialize state. + */ + serializer?: Serializer; + /** + * Hook called before state is hydrated from storage. + * @default null + */ + beforeRestore?: (context: PiniaPluginContext) => void; + /** + * Hook called after state is hydrated from storage. + * @default undefined + */ + afterRestore?: (context: PiniaPluginContext) => void; + /** + * Logs errors in console when enabled. + * @default false + */ + debug?: boolean; +} +type PersistedStateFactoryOptions = Prettify & { + /** + * Global key generator, allows pre/postfixing store keys. + * @default storeKey => storeKey + */ + key?: (storeKey: string) => string; + /** + * Automatically persists all stores, opt-out individually. + * @default false + */ + auto?: boolean; +}>; +declare module 'pinia' { + interface DefineStoreOptionsBase { + /** + * Persists store in storage. + * @see https://prazdevs.github.io/pinia-plugin-persistedstate + */ + persist?: boolean | PersistedStateOptions | PersistedStateOptions[]; + unistorage?: boolean | PersistedStateOptions | PersistedStateOptions[]; + } + interface PiniaCustomProperties { + /** + * Rehydrates store from persisted state + * Warning: this is for advances usecases, make sure you know what you're doing. + * @see https://prazdevs.github.io/pinia-plugin-persistedstate/guide/advanced.html#forcing-the-rehydration + */ + $hydrate: (opts?: { + runHooks?: boolean; + }) => void; + /** + * Persists store into configured storage + * Warning: this is for advances usecases, make sure you know what you're doing. + * @see https://prazdevs.github.io/pinia-plugin-persistedstate/guide/advanced.html#forcing-the-persistence + */ + $persist: () => void; + } +} + +/** + * Creates a pinia persistence plugin + * @param factoryOptions global persistence options + * @returns pinia plugin + */ +declare function createPersistedState(factoryOptions?: PersistedStateFactoryOptions): PiniaPlugin; + +declare const _default: pinia.PiniaPlugin; + +export { PersistedStateFactoryOptions, PersistedStateOptions, Serializer, StorageLike, createPersistedState, _default as default, createUnistorage }; + +/** + * Creates a pinia persistence plugin with uniapp + * @param factoryOptions global persistence options + * @returns pinia plugin + */ +declare function createUnistorage(factoryOptions?: PersistedStateFactoryOptions): PiniaPlugin; + \ No newline at end of file diff --git a/uni_modules/pinia-plugin-unistorage/index.js b/uni_modules/pinia-plugin-unistorage/index.js new file mode 100644 index 0000000..02c4e79 --- /dev/null +++ b/uni_modules/pinia-plugin-unistorage/index.js @@ -0,0 +1,162 @@ +// src/normalize.ts +function isObject(v) { + return typeof v === "object" && v !== null; +} +function normalizeOptions(options, factoryOptions) { + options = isObject(options) ? options : /* @__PURE__ */ Object.create(null); + return new Proxy(options, { + get(target, key, receiver) { + if (key === "key") + return Reflect.get(target, key, receiver); + return Reflect.get(target, key, receiver) || Reflect.get(factoryOptions, key, receiver); + } + }); +} + +// src/pick.ts +function get(state, path) { + return path.reduce((obj, p) => { + return obj == null ? void 0 : obj[p]; + }, state); +} +function set(state, path, val) { + return path.slice(0, -1).reduce((obj, p) => { + if (/^(__proto__)$/.test(p)) + return {}; + else + return obj[p] = obj[p] || {}; + }, state)[path[path.length - 1]] = val, state; +} +function pick(baseState, paths) { + return paths.reduce((substate, path) => { + const pathArray = path.split("."); + return set(substate, pathArray, get(baseState, pathArray)); + }, {}); +} + +// src/plugin.ts +function parsePersistence(factoryOptions, store) { + return (o) => { + var _a; + try { + const { + storage = localStorage, + beforeRestore = void 0, + afterRestore = void 0, + serializer = { + serialize: JSON.stringify, + deserialize: JSON.parse + }, + key = store.$id, + paths = null, + debug = false + } = o; + return { + storage, + beforeRestore, + afterRestore, + serializer, + key: ((_a = factoryOptions.key) != null ? _a : (k) => k)(typeof key == "string" ? key : key(store.$id)), + paths, + debug + }; + } catch (e) { + if (o.debug) + console.error("[pinia-plugin-persistedstate]", e); + return null; + } + }; +} +function hydrateStore(store, { storage, serializer, key, debug }) { + try { + const fromStorage = storage == null ? void 0 : storage.getItem(key); + if (fromStorage) + store.$patch(serializer == null ? void 0 : serializer.deserialize(fromStorage)); + } catch (e) { + if (debug) + console.error("[pinia-plugin-persistedstate]", e); + } +} +function persistState(state, { storage, serializer, key, paths, debug }) { + try { + const toStore = Array.isArray(paths) ? pick(state, paths) : state; + storage.setItem(key, serializer.serialize(toStore)); + } catch (e) { + if (debug) + console.error("[pinia-plugin-persistedstate]", e); + } +} +function createPersistedState(factoryOptions = {}) { + return (context) => { + const { auto = false } = factoryOptions; + const { + options: { persist = auto }, + store, + pinia + } = context; + if (!persist) + return; + if (!(store.$id in pinia.state.value)) { + const original_store = pinia._s.get(store.$id.replace("__hot:", "")); + if (original_store) + Promise.resolve().then(() => original_store.$persist()); + return; + } + const persistences = (Array.isArray(persist) ? persist.map((p) => normalizeOptions(p, factoryOptions)) : [normalizeOptions(persist, factoryOptions)]).map(parsePersistence(factoryOptions, store)).filter(Boolean); + store.$persist = () => { + persistences.forEach((persistence) => { + persistState(store.$state, persistence); + }); + }; + store.$hydrate = ({ runHooks = true } = {}) => { + persistences.forEach((persistence) => { + const { beforeRestore, afterRestore } = persistence; + if (runHooks) + beforeRestore == null ? void 0 : beforeRestore(context); + hydrateStore(store, persistence); + if (runHooks) + afterRestore == null ? void 0 : afterRestore(context); + }); + }; + persistences.forEach((persistence) => { + const { beforeRestore, afterRestore } = persistence; + beforeRestore == null ? void 0 : beforeRestore(context); + hydrateStore(store, persistence); + afterRestore == null ? void 0 : afterRestore(context); + store.$subscribe( + (_mutation, state) => { + persistState(state, persistence); + }, + { + detached: true + } + ); + }); + }; +} + +function createUnistorage(globalOptions = {}) { + const persistedState = createPersistedState({ + storage: { + getItem(key) { + return uni.getStorageSync(key); + }, + setItem(key, value) { + uni.setStorageSync(key, value); + } + }, + serializer: { + deserialize: JSON.parse, + serialize: JSON.stringify + }, + ...globalOptions + }); + return (ctx) => { + if (ctx.options.unistorage) { + ctx.options.persist = ctx.options.unistorage; + } + return persistedState(ctx); + }; +} + +export { createPersistedState, createUnistorage }; diff --git a/uni_modules/pinia-plugin-unistorage/package.json b/uni_modules/pinia-plugin-unistorage/package.json new file mode 100644 index 0000000..fd82db4 --- /dev/null +++ b/uni_modules/pinia-plugin-unistorage/package.json @@ -0,0 +1,94 @@ +{ + "id": "pinia-plugin-unistorage", + "displayName": "pinia-plugin-unistorage", + "version": "0.1.2", + "description": "uniapp 下 pinia 的本地数据缓存插件", + "keywords": [ + "pinia", + "uniapp", + "storage", + "pinia-plugin", + "persistence" +], + "type": "module", + "main": "./index.js", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./index.js", + "types": "./index.d.ts" + } + }, + "engines": { + "HBuilderX": "^3.4.7" + }, + "dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/pinia-plugin-unistorage", + "type": "sdk-js" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y", + "alipay": "n" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y", + "钉钉": "y", + "快手": "y", + "飞书": "y", + "京东": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + } + } + } + } +} diff --git a/uni_modules/pinia-plugin-unistorage/readme.md b/uni_modules/pinia-plugin-unistorage/readme.md new file mode 100644 index 0000000..7724e13 --- /dev/null +++ b/uni_modules/pinia-plugin-unistorage/readme.md @@ -0,0 +1,226 @@ +
+ +

pinia-plugin-unistorage

+

uniapp 下 pinia 的本地数据缓存插件

+
+ +
+
+ +
+ +
+ +
+
+ +## 引用 + +该插件是 +[pinia-plugin-persistedstate](https://github.com/prazdevs/pinia-plugin-persistedstate) +的 `uniapp` 版本,如果你需要在纯 `vue` 或者 `nuxt` 项目中使用 `pinia` +的本地数据缓存,请使用 +[pinia-plugin-persistedstate](https://github.com/prazdevs/pinia-plugin-persistedstate)。 + +
+
+ +## 动机 + +为了实现多端的更简单的全局本地数据缓存 + +
+
+ +## 组织 🦔 + +欢迎关注 **帝莎编程** + +- [官网](http://dishaxy.dishait.cn/) +- [Gitee](https://gitee.com/dishait) +- [Github](https://github.com/dishait) +- [网易云课堂](https://study.163.com/provider/480000001892585/index.htm?share=2&shareId=480000001892585) + +
+
+ +## 使用 + +### 安装 + +#### 1. `cli` 创建的 `uniapp` 项目 + +```shell +npm i pinia-plugin-unistorage -D +``` + +```js +// main.js +import { createSSRApp } from "vue"; +import * as Pinia from "pinia"; +import { createUnistorage } from "pinia-plugin-unistorage"; + +export function createApp() { + const app = createSSRApp(App); + + const store = Pinia.createPinia(); + + // 关键代码 👇 + store.use(createUnistorage()); + + app.use(store); + + return { + app, + Pinia, // 此处必须将 Pinia 返回 + }; +} +``` + +
+ +#### 2. `hbuilderx` 创建的 `uniapp` 项目 + +直接插件市场安装后引入注册 + +```js +// main.js +import { createSSRApp } from "vue"; +import * as Pinia from "pinia"; +import { createUnistorage } from "./uni_modules/pinia-plugin-unistorage"; + +export function createApp() { + const app = createSSRApp(App); + + const store = Pinia.createPinia(); + + // 关键代码 👇 + store.use(createUnistorage()); + + app.use(store); + + return { + app, + Pinia, // 此处必须将 Pinia 返回 + }; +} +``` + +### 基础 + +```js +import { defineStore } from "pinia"; + +export const useStore = defineStore("main", { + state() { + return { + someState: "hello pinia", + }; + }, + unistorage: true, // 开启后对 state 的数据读写都将持久化 +}); +``` + +或者 `setup` 语法也是支持的 + +```js +import { defineStore } from "pinia"; + +export const useStore = defineStore( + "main", + () => { + const someState = ref("hello pinia"); + return { someState }; + }, + { + unistorage: true, // 开启后对 state 的数据读写都将持久化 + }, +); +``` + +
+ +### 选项 + +#### 钩子 + +```js +import { defineStore } from "pinia"; + +export const useStore = defineStore("main", { + state() { + return { + someState: "hello pinia", + }; + }, + unistorage: { + // 初始化恢复前触发 + beforeRestore(ctx) {}, + // 初始化恢复后触发 + afterRestore(ctx) {}, + }, +}); +``` + +
+ +#### 序列化 + +大多数情况下你并不需要了解该选项 + +```js +import { defineStore } from "pinia"; + +export const useStore = defineStore("main", { + state() { + return { + someState: "hello pinia", + }; + }, + unistorage: { + serializer: { + // 序列化,默认为 JSON.stringify + serialize(v) { + return JSON.stringify(v); + }, + // 反序列化,默认为 JSON.parse + deserialize(v) { + return JSON.parse(v); + }, + }, + }, +}); +``` + +
+ +#### 其他 + +```js +import { defineStore } from "pinia"; + +export const useStore = defineStore("main", { + state() { + return { + foo: "foo", + nested: { + data: "nested pinia", + }, + someState: "hello pinia", + }; + }, + unistorage: { + key: "foo", // 缓存的键,默认为该 store 的 id,这里是 main, + paths: ["foo", "nested.data"], // 需要缓存的路径,这里设置 foo 和 nested 下的 data 会被缓存 + }, +}); +``` + +
+
+ +## License + +Made with [markthree](https://github.com/markthree) + +Published under [MIT License](./LICENSE). diff --git a/uni_modules/pinia-plugin-unistorage/src/index.ts b/uni_modules/pinia-plugin-unistorage/src/index.ts new file mode 100644 index 0000000..bc6bcb9 --- /dev/null +++ b/uni_modules/pinia-plugin-unistorage/src/index.ts @@ -0,0 +1,35 @@ +import { + createPersistedState, + type PersistedStateFactoryOptions, +} from "pinia-plugin-persistedstate"; + +export * from "pinia-plugin-persistedstate"; + +export function createUnistorage( + globalOptions: PersistedStateFactoryOptions = {}, +) { + const persistedState = createPersistedState({ + storage: { + getItem(key) { + // @ts-ignore + return uni.getStorageSync(key); + }, + setItem(key, value) { + // @ts-ignore + uni.setStorageSync(key, value); + }, + }, + serializer: { + deserialize: JSON.parse, + serialize: JSON.stringify, + }, + ...globalOptions, + }); + // @ts-ignore + return (ctx) => { + if (ctx.options.unistorage) { + ctx.options.persist = ctx.options.unistorage; + } + return persistedState(ctx); + }; +} From 636818361c6196102d09b962ee3656ae00d9f447 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Sat, 29 Nov 2025 11:48:05 +0800 Subject: [PATCH 09/16] =?UTF-8?q?flat:=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index 74e3c87..fb1fc56 100644 --- a/config.js +++ b/config.js @@ -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', // 语音转文字 From 63d0cdb5ad0280bbdc07eeb63184904c48c4bf54 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Sat, 29 Nov 2025 16:31:34 +0800 Subject: [PATCH 10/16] =?UTF-8?q?flat:=20=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E6=8B=9B=E8=81=98=E4=BC=9A=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E6=80=A7=E8=83=BD=E4=BC=98=E5=8C=96=E3=80=81?= =?UTF-8?q?=E7=B2=BE=E9=80=89=E4=BC=81=E4=B8=9A=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E5=B0=81=E8=A3=85=E7=BC=93=E5=AD=98request?= =?UTF-8?q?=E3=80=81indexDb=E6=96=B9=E6=B3=95=EF=BC=8C=E4=B8=BB=E8=A6=81?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E4=B8=8D=E5=B8=B8=E6=9B=B4=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3,=E4=BB=A5=E8=BE=BE=E5=88=B0=E6=AF=AB?= =?UTF-8?q?=E7=A7=92=E7=BA=A7=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/globalFunction.js | 2 + config.js | 4 +- packageA/pages/choiceness/choiceness.vue | 5 +- packageA/pages/selectDate/selectDate.vue | 31 +++++--- pages/careerfair/careerfair.vue | 32 ++++++--- stores/BaseDBStore.js | 73 ------------------- stores/useRecommedIndexedDBStore.js | 2 +- stores/userChatGroupStore.js | 2 +- utils/db.js | 91 ++++++++++++++++++++++++ utils/request.js | 52 ++++++++++++-- 10 files changed, 190 insertions(+), 104 deletions(-) delete mode 100644 stores/BaseDBStore.js create mode 100644 utils/db.js diff --git a/common/globalFunction.js b/common/globalFunction.js index a4bf4bd..34ec784 100644 --- a/common/globalFunction.js +++ b/common/globalFunction.js @@ -1,6 +1,7 @@ import '@/lib/encryption/sm4.min.js' import useUserStore from "../stores/useUserStore"; import { + createRequestWithCache, createRequest, uploadFile } from "../utils/request"; @@ -624,6 +625,7 @@ export const $api = { sendingMiniProgramMessage, copyText, aes_Decrypt, + createRequestWithCache } diff --git a/config.js b/config.js index fb1fc56..74e3c87 100644 --- a/config.js +++ b/config.js @@ -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', // 语音转文字 diff --git a/packageA/pages/choiceness/choiceness.vue b/packageA/pages/choiceness/choiceness.vue index 16f89af..1abf65f 100644 --- a/packageA/pages/choiceness/choiceness.vue +++ b/packageA/pages/choiceness/choiceness.vue @@ -50,10 +50,11 @@ function delCollectionCard(item) { } function getPremiumList() { - $api.createRequest('/app/company/card').then((resData) => { + const LoadCache = (resData) => { const { rows, total } = resData; list.value = rows; - }); + }; + $api.createRequestWithCache('/app/company/card', {}, 'GET', false, {}, LoadCache).then(LoadCache); } function seeDetail(item) { diff --git a/packageA/pages/selectDate/selectDate.vue b/packageA/pages/selectDate/selectDate.vue index c686301..5812aa9 100644 --- a/packageA/pages/selectDate/selectDate.vue +++ b/packageA/pages/selectDate/selectDate.vue @@ -26,7 +26,7 @@ { - updateDateArray() if (options.date) { current.value = { date: options?.date || null, @@ -81,20 +80,30 @@ onLoad((options) => { addMonth(); }); } + if (options.entrance === 'careerfair') { + updateDateArray(); + } }); function hasZphInData(item) { - return hasZphDateArray.value.some(date=>date == item.date) + if (!item || typeof item.date !== 'string') { + return false; + } + + const dateArray = Array.isArray(hasZphDateArray.value) ? hasZphDateArray.value : []; + + return dateArray.some((date) => { + return typeof date === 'string' && date === item.date; + }); } async function updateDateArray() { - if(localStorage.getItem('hasZphDateArray')) hasZphDateArray.value = localStorage.getItem('hasZphDateArray') - - let res = await $api.createRequest('/app/internal/getDateList', {}, 'get') - if(res.data){ - hasZphDateArray.value = res.data - localStorage.setItem('hasZphDateArray',res.data) - } + const LoadCache = (resData) => { + if (resData.code === 200) { + hasZphDateArray.value = resData.data; + } + }; + $api.createRequestWithCache('/app/internal/getDateList', {}, 'GET', false, {}, LoadCache).then(LoadCache); } function backParams() { diff --git a/pages/careerfair/careerfair.vue b/pages/careerfair/careerfair.vue index 69b88ae..e5032cc 100644 --- a/pages/careerfair/careerfair.vue +++ b/pages/careerfair/careerfair.vue @@ -13,7 +13,14 @@ - + @@ -42,7 +49,14 @@ class="card press-button" v-for="(item, index) in fairList" :key="index" - @click="navTo('/packageA/pages/exhibitors/exhibitors?jobFairId=' + item.zphID + '&jobFairName=' + item.zphmc)" + @click=" + navTo( + '/packageA/pages/exhibitors/exhibitors?jobFairId=' + + item.zphID + + '&jobFairName=' + + item.zphmc + ) + " > {{ item.zphmc }} @@ -95,7 +109,7 @@ import Tabbar from '@/components/tabbar/midell-box.vue'; import useLocationStore from '@/stores/useLocationStore'; import { storeToRefs } from 'pinia'; const { longitudeVal, latitudeVal } = storeToRefs(useLocationStore()); -const { $api, navTo, cloneDeep,debounce } = inject('globalFunction'); +const { $api, navTo, cloneDeep, debounce } = inject('globalFunction'); const weekList = ref([]); const fairList = ref([]); const currentDay = ref({}); @@ -108,7 +122,7 @@ const pageState = reactive({ total: 0, maxPage: 2, pageSize: 10, - zphmc:'' + zphmc: '', }); onLoad(() => { @@ -122,7 +136,7 @@ onLoad(() => { startDate: currentDate, }); weekList.value = result; - currentDay.value.fullDate = result[0].fullDate + currentDay.value.fullDate = result[0].fullDate; getFair('refresh'); }); @@ -130,6 +144,7 @@ function toSelectDate() { navTo('/packageA/pages/selectDate/selectDate', { query: { date: currentDay.value.fullDate, + entrance: 'careerfair', }, onBack: (res) => { console.log(res); @@ -162,12 +177,11 @@ function seemsg(index) { } const handleScrollToLower = () => { - return + return; getFair(); console.log('触底'); }; - function getFair(type = 'add') { if (type === 'refresh') { pageState.page = 1; @@ -177,7 +191,7 @@ function getFair(type = 'add') { pageState.page += 1; } let params = { - zphmc:pageState.zphmc, + zphmc: pageState.zphmc, // current: pageState.page, // pageSize: pageState.pageSize, }; @@ -194,7 +208,7 @@ function getFair(type = 'add') { // const end = fairList.value.length; // const reslist = rows; // fairList.value.splice(str, end, ...reslist); - fairList.value = rows + fairList.value = rows; } else { fairList.value = rows; } diff --git a/stores/BaseDBStore.js b/stores/BaseDBStore.js deleted file mode 100644 index ad61257..0000000 --- a/stores/BaseDBStore.js +++ /dev/null @@ -1,73 +0,0 @@ -// BaseStore.js - 基础Store类 -import IndexedDBHelper from '@/common/IndexedDBHelper.js' -// import UniStorageHelper from '../common/UniStorageHelper' -import useChatGroupDBStore from './userChatGroupStore' -import config from '@/config' - - -class BaseStore { - db = null - isDBReady = false - dbName = 'BrowsingHistory' - constructor() { - this.checkAndInitDB() - } - checkAndInitDB() { - // 获取本地数据库版本 - if (config.OnlyUseCachedDB) { - return this.initDB() - } - const localVersion = uni.getStorageSync('indexedDBVersion') || 1 - console.log('DBVersion: ', localVersion, config.DBversion) - if (localVersion === config.DBversion) { - this.initDB() - } else { - console.log('清空本地数据库') - this.clearDB().then(() => { - uni.setStorageSync('indexedDBVersion', config.DBversion); - this.initDB(); - }); - } - } - initDB() { - // // #ifdef H5 - this.db = new IndexedDBHelper(this.dbName, config.DBversion); - // // #endif - // // #ifndef H5 - // this.db = new UniStorageHelper(this.dbName, config.DBversion); - // // #endif - this.db.openDB([{ - name: 'record', - keyPath: "id", - autoIncrement: true, - }, { - name: 'messageGroup', - keyPath: "id", - autoIncrement: true, - }, { - name: 'messages', - keyPath: "id", - autoIncrement: true, - indexes: [{ - name: 'parentGroupId', - key: 'parentGroupId', - unique: false - }] - }]).then(async () => { - useChatGroupDBStore().init() - this.isDBReady = true - }); - } - async clearDB() { - return new Promise((resolve, rejetc) => { - new IndexedDBHelper().deleteDB(this.dbName).then(() => { - resolve() - }) - }) - } - -} - -const baseDB = new BaseStore() - -export default baseDB \ No newline at end of file diff --git a/stores/useRecommedIndexedDBStore.js b/stores/useRecommedIndexedDBStore.js index 3f74d19..3669828 100644 --- a/stores/useRecommedIndexedDBStore.js +++ b/stores/useRecommedIndexedDBStore.js @@ -9,7 +9,7 @@ import jobAnalyzer from '@/utils/jobAnalyzer'; import { msg } from '@/common/globalFunction.js' -import baseDB from './BaseDBStore'; +import baseDB from '@/utils/db.js'; import config from '../config'; class JobRecommendation { diff --git a/stores/userChatGroupStore.js b/stores/userChatGroupStore.js index af70f96..54478d3 100644 --- a/stores/userChatGroupStore.js +++ b/stores/userChatGroupStore.js @@ -6,7 +6,7 @@ import { ref, toRaw } from 'vue' -import baseDB from './BaseDBStore'; +import baseDB from '@/utils/db.js'; import { msg, CloneDeep, diff --git a/utils/db.js b/utils/db.js new file mode 100644 index 0000000..d901575 --- /dev/null +++ b/utils/db.js @@ -0,0 +1,91 @@ +// BaseDBStore.js +import IndexedDBHelper from '@/common/IndexedDBHelper.js' +// import UniStorageHelper from '../common/UniStorageHelper' +import useChatGroupDBStore from '@/stores/userChatGroupStore' +import config from '@/config' + +class BaseStore { + db = null + isDBReady = false + dbName = 'BrowsingHistory' // 'AppMainDB' + initPromise = null + + constructor() { + this.initPromise = this.checkAndInitDB() + } + + async getDB() { + if (!this.initPromise) { + this.initPromise = this.checkAndInitDB(); + } + await this.initPromise; // 等待初始化完成 + return this.db; + } + + async checkAndInitDB() { + if (config.OnlyUseCachedDB) { + return this.initDB() + } + const localVersion = uni.getStorageSync('indexedDBVersion') || 1 + console.log('DBVersion: ', localVersion, config.DBversion) + if (localVersion === config.DBversion) { + return this.initDB() // 🟢 记得加 return + } else { + console.log('清空本地数据库') + await this.clearDB() // 🟢 建议用 await + uni.setStorageSync('indexedDBVersion', config.DBversion); + return this.initDB(); // 🟢 记得加 return + } + } + + initDB() { + // // #ifdef H5 + this.db = new IndexedDBHelper(this.dbName, config.DBversion); + // // #endif + + return this.db.openDB([{ + name: 'record', + keyPath: "id", + autoIncrement: true, + }, + { + name: 'messageGroup', + keyPath: "id", + autoIncrement: true, + }, + { + name: 'messages', + keyPath: "id", + autoIncrement: true, + indexes: [{ + name: 'parentGroupId', + key: 'parentGroupId', + unique: false + }] + }, + { + name: 'api_cache', + keyPath: "cacheKey", // 使用 URL+参数 作为主键 + indexes: [] + } + ]).then(async () => { + // 这里原来的逻辑保留 + if (useChatGroupDBStore) { + useChatGroupDBStore().init() + } + this.isDBReady = true + return this.db; + }); + } + + async clearDB() { + return new Promise((resolve, rejetc) => { + new IndexedDBHelper().deleteDB(this.dbName).then(() => { + resolve() + }) + }) + } +} + +const baseDB = new BaseStore() +export default baseDB \ No newline at end of file diff --git a/utils/request.js b/utils/request.js index 9ee9c0d..b4eca8d 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,14 +1,15 @@ import config from "@/config.js" import { sm2_Decrypt, - sm2_Encrypt -} from '@/common/globalFunction'; -import useUserStore from '@/stores/useUserStore'; -import { + sm2_Encrypt, sm4Decrypt, sm4Encrypt -} from '../common/globalFunction'; +} from '@/common/globalFunction'; +import IndexedDBHelper from '@/common/IndexedDBHelper'; +import useUserStore from '@/stores/useUserStore'; +import baseDB from '@/utils/db.js'; +const CACHE_STORE_NAME = 'api_cache'; const needToEncrypt = [ ["post", "/app/login"], @@ -20,6 +21,47 @@ const needToEncrypt = [ ["get", "/app/user/experience/list"] ] +/** + * 带缓存的请求方法 + */ +export async function createRequestWithCache(url, data = {}, method = 'GET', loading = false, headers = {}, + onCacheLoad = null) { + const cacheKey = `${method.toUpperCase()}:${url}:${JSON.stringify(data)}`; + + baseDB.getDB().then(async (dbHelper) => { + try { + const cachedRecord = await dbHelper.get(CACHE_STORE_NAME, cacheKey); + + if (cachedRecord && cachedRecord.response && typeof onCacheLoad === 'function') { + onCacheLoad(cachedRecord.response); + } + } catch (e) { + console.error('读取缓存失败', e); + } + }); + + // 3. 发起网络请求 + try { + const networkResponse = await createRequest(url, data, method, loading, headers); + baseDB.getDB().then(async (dbHelper) => { + try { + await dbHelper.update(CACHE_STORE_NAME, { + cacheKey: cacheKey, + response: networkResponse, + timestamp: Date.now() + }); + console.log('💾 [BaseDB] 缓存更新:', url); + } catch (e) { + console.error('更新缓存失败', e); + } + }); + + return networkResponse; + } catch (error) { + throw error; + } +} + /** * @param url String,请求的地址,默认:none * @param data Object,请求的参数,默认:{} From 0dec1618fa93f22d4a278fd4edbd283296a3668f Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Sun, 30 Nov 2025 14:08:16 +0800 Subject: [PATCH 11/16] =?UTF-8?q?flat:=20=E4=BC=98=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E8=BF=98=E6=98=AF=E4=BD=BF=E7=94=A8=E5=8E=9F=E7=94=9FTabbar,em?= =?UTF-8?q?pty=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 19 ++++-- common/animation.css | 34 ++++++++++ common/common.css | 4 ++ components/empty/empty.vue | 41 +++++++++--- .../Intendedposition/Intendedposition.vue | 11 ++-- packageA/pages/UnitDetails/UnitDetails.vue | 28 ++++---- packageA/pages/browseJob/browseJob.vue | 23 +++---- .../pages/choicenessList/choicenessList.vue | 6 +- packageA/pages/collection/collection.vue | 5 +- packageA/pages/exhibitors/exhibitors.vue | 4 +- packageA/pages/reservation/reservation.vue | 29 +++++---- pages.json | 4 +- pages/careerfair/careerfair copy.vue | 7 +- pages/careerfair/careerfair.vue | 4 +- pages/chat/chat.vue | 65 ++++++++++++------- pages/index/components/index-one.vue | 2 +- pages/index/index.vue | 2 +- pages/mine/mine.vue | 4 +- pages/msglog/msglog.vue | 2 +- pages/nearby/components/four.vue | 12 ++-- pages/nearby/components/one.vue | 8 ++- pages/nearby/components/three.vue | 11 +++- pages/nearby/components/two.vue | 9 ++- 23 files changed, 229 insertions(+), 105 deletions(-) diff --git a/App.vue b/App.vue index b68a331..99acae0 100644 --- a/App.vue +++ b/App.vue @@ -124,11 +124,22 @@ function loginCallback(userInfo) { /*每个页面公共css */ @import '@/common/animation.css'; @import '@/common/common.css'; -/* 修改pages tabbar样式 H5有效 */ + +/* 修改pages tabbar样式 H5才有效 */ .uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon { - height: 110rpx !important; - width: 122rpx !important; - margin-top: 6rpx; + width: 108rpx !important; + height: 98rpx !important; + margin-top: 0rpx; + transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); + transform-origin: center center; + /* transition: transform 0.15s ease-in-out; */ + /* transform-origin: center center; */ +} + +.uni-tabbar .uni-tabbar__item:nth-child(4) .uni-tabbar__bd .uni-tabbar__icon:active { + transform: scale(0.8); + transition: transform 0.1s ease-out; + /* animation: jelly 0.5s; */ } .uni-tabbar-border { diff --git a/common/animation.css b/common/animation.css index d6e411f..3125565 100644 --- a/common/animation.css +++ b/common/animation.css @@ -190,4 +190,38 @@ .btn-rubberBand:active { -webkit-animation-name: tada; animation-name: tada +} + +@keyframes jelly { + 0% { + transform: scale(1); + } + + 30% { + transform: scale(1.25, 0.75); + } + + /* 压扁 */ + 40% { + transform: scale(0.75, 1.25); + } + + /* 拉长 */ + 50% { + transform: scale(1.15, 0.85); + } + + /* 稍微压扁 */ + 65% { + transform: scale(0.95, 1.05); + } + + /* 稍微拉长 */ + 75% { + transform: scale(1.05, 0.95); + } + + 100% { + transform: scale(1); + } } \ No newline at end of file diff --git a/common/common.css b/common/common.css index 68e0da4..da7cc25 100644 --- a/common/common.css +++ b/common/common.css @@ -468,4 +468,8 @@ html { .grayscale { filter: grayscale(100%) opacity(0.6); +} + +.height-100 { + height: 100%; } \ No newline at end of file diff --git a/components/empty/empty.vue b/components/empty/empty.vue index 03f072e..ecd0aec 100644 --- a/components/empty/empty.vue +++ b/components/empty/empty.vue @@ -1,5 +1,9 @@ @@ -151,6 +151,8 @@ image { } .main-list{ background-color: #F4F4F4; - padding: 1rpx 28rpx 28rpx 28rpx + padding: 1rpx 28rpx 28rpx 28rpx; + min-height: calc(100% - 29rpx); + position: relative } diff --git a/packageA/pages/collection/collection.vue b/packageA/pages/collection/collection.vue index d181d7b..a627a04 100644 --- a/packageA/pages/collection/collection.vue +++ b/packageA/pages/collection/collection.vue @@ -26,7 +26,7 @@ :longitude="longitudeVal" :latitude="latitudeVal" > - + @@ -44,7 +44,7 @@ :longitude="longitudeVal" :latitude="latitudeVal" > - + @@ -262,6 +262,7 @@ function getCompanyList(type = 'add') { .swiper{ height: 100% .mian{ + height: 100% padding: 0 28rpx 28rpx 28rpx } } diff --git a/packageA/pages/exhibitors/exhibitors.vue b/packageA/pages/exhibitors/exhibitors.vue index a4b7827..ca3fac5 100644 --- a/packageA/pages/exhibitors/exhibitors.vue +++ b/packageA/pages/exhibitors/exhibitors.vue @@ -83,7 +83,7 @@ :longitude="longitudeVal" :latitude="latitudeVal" > - +
@@ -433,6 +433,8 @@ image { background: #F4F4F4; .views{ padding: 28rpx + min-height: calc(100% - 56rpx); + position: relative .Detail-title{ font-weight: 600; font-size: 32rpx; diff --git a/packageA/pages/reservation/reservation.vue b/packageA/pages/reservation/reservation.vue index 89bf7c7..bd2aa1d 100644 --- a/packageA/pages/reservation/reservation.vue +++ b/packageA/pages/reservation/reservation.vue @@ -12,10 +12,19 @@
- + - + @@ -37,7 +46,7 @@ - +
@@ -72,7 +81,7 @@ const ranOptions = ref([ ]); function isTimePassed(timeStr) { - if(!timeStr) return false + if (!timeStr) return false; const targetTime = new Date(timeStr.replace(/-/g, '/')).getTime(); // 兼容格式 const now = Date.now(); return now < targetTime; @@ -95,16 +104,14 @@ function updateCancel(item) { content: '确定要取消预约吗?', showCancel: true, success: ({ confirm, cancel }) => { - if(confirm){ - $api.createRequest(`/app/fair/collection/${fairId}`, {}, 'DELETE').then((resData) => { + if (confirm) { + $api.createRequest(`/app/fair/collection/${fairId}`, {}, 'DELETE').then((resData) => { getList('refresh'); $api.msg('取消预约成功'); }); } - } - }) - - + }, + }); } function getList(type = 'add', loading = true) { @@ -178,7 +185,7 @@ function getList(type = 'add', loading = true) { display: flex align-items: center } - + } .card-Title{ font-family: 'PingFangSC-Medium', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, 'Microsoft YaHei', sans-serif; diff --git a/pages.json b/pages.json index f54ad54..94bbace 100644 --- a/pages.json +++ b/pages.json @@ -227,8 +227,8 @@ ] }], "tabBar": { - "custom": true, - "display": "none", + // "custom": true, + // "display": "none", "color": "#5E5F60", "selectedColor": "#256BFA", "borderStyle": "black", diff --git a/pages/careerfair/careerfair copy.vue b/pages/careerfair/careerfair copy.vue index 0abc265..4431345 100644 --- a/pages/careerfair/careerfair copy.vue +++ b/pages/careerfair/careerfair copy.vue @@ -122,7 +122,7 @@ onLoad(() => { startDate: currentDate, }); weekList.value = result; - currentDay.value.fullDate = result[0].fullDate + currentDay.value.fullDate = result[0].fullDate; getFair('refresh'); }); @@ -162,12 +162,11 @@ function seemsg(index) { } const handleScrollToLower = () => { - return + return; getFair(); console.log('触底'); }; - function getFair(type = 'add') { if (type === 'refresh') { pageState.page = 1; @@ -194,7 +193,7 @@ function getFair(type = 'add') { // const end = fairList.value.length; // const reslist = rows; // fairList.value.splice(str, end, ...reslist); - fairList.value = rows + fairList.value = rows; } else { fairList.value = rows; } diff --git a/pages/careerfair/careerfair.vue b/pages/careerfair/careerfair.vue index e5032cc..5d5495b 100644 --- a/pages/careerfair/careerfair.vue +++ b/pages/careerfair/careerfair.vue @@ -94,10 +94,10 @@ 内容简介:{{ item.zphjj }}
- +
- +
diff --git a/pages/chat/chat.vue b/pages/chat/chat.vue index 591a30c..35f8b4b 100644 --- a/pages/chat/chat.vue +++ b/pages/chat/chat.vue @@ -63,9 +63,9 @@
- +
@@ -213,27 +213,48 @@ footer-height = 98rpx background: #FFFFFF; display: flex flex-direction: column - .drawer-user - border-top: 1rpx solid rgba(0,0,0,.1); - padding: 20rpx 28rpx - display: flex + .drawer-user { + display: flex; + align-items: center; + width: 100%; + box-sizing: border-box; + padding: 24rpx 32rpx; + padding-bottom: calc(24rpx + constant(safe-area-inset-bottom)); + padding-bottom: calc(24rpx + env(safe-area-inset-bottom)); + border-top: 1rpx solid rgba(0, 0, 0, 0.06); + background-color: #ffffff; + color: #333333; font-weight: 500; - align-items: center - position: relative - margin-bottom: calc( 32rpx + var(--window-bottom)); /*兼容 IOS<11.2*/ - margin-bottom: calc( 32rpx +var(--window-bottom)); /*兼容 IOS>11.2*/ - color: #000000 - .drawer-user-img - width: 57.2rpx; - height: 57.2rpx - margin-right: 20rpx - .drawer-user-setting - width: 48rpx - height: 48rpx - position: absolute - top: 50% - right: 28rpx - transform: translate(0,-50%) + font-size: 28rpx; + + &:active { + background-color: #f9f9f9; + } + + .drawer-user-img { + width: 60rpx; + height: 60rpx; + border-radius: 50%; + margin-right: 24rpx; + background-color: #eee; + flex-shrink: 0; + } + + .user-name { + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 30rpx; + } + + .drawer-user-setting { + width: 48rpx; + height: 48rpx; + margin-left: auto; + opacity: 0.8; + } + } .drawer-title height: header-height; line-height: header-height; diff --git a/pages/index/components/index-one.vue b/pages/index/components/index-one.vue index 3b50ec1..79b6ccf 100644 --- a/pages/index/components/index-one.vue +++ b/pages/index/components/index-one.vue @@ -142,7 +142,7 @@
- +
diff --git a/pages/index/index.vue b/pages/index/index.vue index 771556d..614dd23 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -41,7 +41,7 @@
- + diff --git a/pages/mine/mine.vue b/pages/mine/mine.vue index afbcc5f..186dea1 100644 --- a/pages/mine/mine.vue +++ b/pages/mine/mine.vue @@ -95,9 +95,9 @@ > - diff --git a/pages/msglog/msglog.vue b/pages/msglog/msglog.vue index 4d73acc..e2a6b55 100644 --- a/pages/msglog/msglog.vue +++ b/pages/msglog/msglog.vue @@ -40,7 +40,7 @@
- + diff --git a/pages/nearby/components/four.vue b/pages/nearby/components/four.vue index 0cba282..cd84057 100644 --- a/pages/nearby/components/four.vue +++ b/pages/nearby/components/four.vue @@ -75,8 +75,8 @@ :longitude="longitudeVal" :latitude="latitudeVal" > - - + + @@ -340,6 +340,7 @@ defineExpose({ loadData, handleFilterConfirm }); color: #4778EC !important .nearby-scroll overflow: hidden; + height: 100%; .two-head margin: 22rpx; display: flex; @@ -380,8 +381,10 @@ defineExpose({ loadData, handleFilterConfirm }); border-radius: 12rpx 12rpx 12rpx 12rpx; .nearby-list border-top: 2rpx solid #EBEBEB; - height: 100% + height: calc(100% - 140rpx) + background: #f4f4f4 .one-cards{ + height: 100% display: flex; flex-direction: column; padding: 0 20rpx 20rpx 20rpx; @@ -389,6 +392,7 @@ defineExpose({ loadData, handleFilterConfirm }); } .nav-filter padding: 16rpx 28rpx 0 28rpx + background: #ffffff .filter-top display: flex justify-content: space-between; @@ -447,4 +451,4 @@ defineExpose({ loadData, handleFilterConfirm }); height: 26rpx; .active transform: rotate(180deg) - \ No newline at end of file + diff --git a/pages/nearby/components/one.vue b/pages/nearby/components/one.vue index a92cb9e..33241ce 100644 --- a/pages/nearby/components/one.vue +++ b/pages/nearby/components/one.vue @@ -80,8 +80,8 @@ :longitude="longitudeVal" :latitude="latitudeVal" > - - + + @@ -364,11 +364,14 @@ defineExpose({ loadData, handleFilterConfirm }); } .nearby-scroll overflow: hidden; + height: 100%; .nearby-map height: 767rpx; background: #e8e8e8; overflow: hidden .nearby-list + height: calc(100% - 384rpx) + background: #f4f4f4 .one-cards{ display: flex; flex-direction: column; @@ -378,6 +381,7 @@ defineExpose({ loadData, handleFilterConfirm }); } .nav-filter padding: 16rpx 28rpx 0 28rpx + background: #ffffff .filter-top display: flex justify-content: space-between; diff --git a/pages/nearby/components/three.vue b/pages/nearby/components/three.vue index 973ca51..02fe209 100644 --- a/pages/nearby/components/three.vue +++ b/pages/nearby/components/three.vue @@ -101,8 +101,8 @@ :longitude="longitudeVal" :latitude="latitudeVal" > - - + + @@ -359,8 +359,9 @@ defineExpose({ loadData, handleFilterConfirm }); color: #4778EC !important; .nearby-scroll overflow: hidden; + height: 100% .three-head - margin: 24rpx 0 0 0; + // margin: 24rpx 0 0 0; padding: 26rpx 0 0 0; border-radius: 17rpx 17rpx 17rpx 17rpx; .one-picker @@ -482,7 +483,10 @@ defineExpose({ loadData, handleFilterConfirm }); z-index: 1; .nearby-list border-top: 2rpx solid #EBEBEB; + height: calc(100% - 222rpx) + background: #f4f4f4 .one-cards{ + height: 100% display: flex; flex-direction: column; padding: 0 20rpx 20rpx 20rpx; @@ -490,6 +494,7 @@ defineExpose({ loadData, handleFilterConfirm }); } .nav-filter padding: 16rpx 28rpx 0 28rpx + background: #ffffff .filter-top display: flex justify-content: space-between; diff --git a/pages/nearby/components/two.vue b/pages/nearby/components/two.vue index 2ffc419..4245977 100644 --- a/pages/nearby/components/two.vue +++ b/pages/nearby/components/two.vue @@ -71,8 +71,8 @@ :longitude="longitudeVal" :latitude="latitudeVal" > - - + + @@ -255,6 +255,7 @@ defineExpose({ loadData, handleFilterConfirm }); color: #4778EC !important .nearby-scroll overflow: hidden; + height: 100%; .two-head margin: 22rpx; display: flex; @@ -284,14 +285,18 @@ defineExpose({ loadData, handleFilterConfirm }); border-radius: 12rpx 12rpx 12rpx 12rpx; .nearby-list border-top: 2rpx solid #EBEBEB; + height: calc(100% - 252rpx) + background: #f4f4f4 .one-cards{ display: flex; flex-direction: column; padding: 0 20rpx 20rpx 20rpx; background: #f4f4f4 + height: 100% } .nav-filter padding: 16rpx 28rpx 0 28rpx + background: #ffffff .filter-top display: flex justify-content: space-between; From 8cf55d3925acb8d3c87148322982978cc3a9248e Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Sun, 30 Nov 2025 14:26:36 +0800 Subject: [PATCH 12/16] =?UTF-8?q?flat:=20=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/components/index-one.vue | 3 +++ pages/index/index.vue | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pages/index/components/index-one.vue b/pages/index/components/index-one.vue index 79b6ccf..bd3ff74 100644 --- a/pages/index/components/index-one.vue +++ b/pages/index/components/index-one.vue @@ -298,6 +298,7 @@ function nextDetail(job) { function openFilter() { showFilter.value = true; emits('onShowTabbar', false); + uni.hideTabBar(); selectFilterModel.value?.open({ title: '筛选', maskClick: true, @@ -310,10 +311,12 @@ function openFilter() { } showFilter.value = false; getJobList('refresh'); + uni.showTabBar(); }, cancel: () => { showFilter.value = false; emits('onShowTabbar', true); + uni.showTabBar(); }, }); } diff --git a/pages/index/index.vue b/pages/index/index.vue index 614dd23..3832ce3 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -49,7 +49,7 @@ 左滑查看视频 快去体验吧~ 去体验 - 1 + @@ -80,7 +80,9 @@ onLoad(() => { // 判断浏览器是否有 fristEntry 第一次进入 let fristEntry = uni.getStorageSync('fristEntry') === false ? false : true; // 默认未读 maskFristEntry.value = fristEntry; - // maskFristEntry.value = true; + if (fristEntry) { + uni.hideTabBar(); + } }); onShow(() => { @@ -187,10 +189,12 @@ function changeSwiperMsgType(e) { function closeFristEntry() { uni.setStorageSync('fristEntry', false); maskFristEntry.value = false; + uni.showTabBar(); } function goExperience() { closeFristEntry(); + uni.showTabBar(); state.current = 1; } From 9a38bbd298c0725773e8865158d778c5c1e5c4ba Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Sun, 30 Nov 2025 16:47:06 +0800 Subject: [PATCH 13/16] =?UTF-8?q?flat:=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/selectJobs/selectJobs.vue | 5 +- .../Intendedposition/Intendedposition.vue | 7 +- packageA/pages/addPosition/addPosition.vue | 5 +- packageA/pages/collection/collection.vue | 11 +- packageA/pages/exhibitors/exhibitors.vue | 33 ++--- packageA/pages/post/post.vue | 64 +++++----- packageA/pages/reservation/reservation.vue | 5 +- pages/careerfair/careerfair.vue | 2 +- pages/login/login.vue | 5 +- pages/nearby/components/four.vue | 5 +- pages/nearby/components/one.vue | 5 +- pages/nearby/components/three.vue | 5 +- pages/nearby/components/two.vue | 5 +- stores/useReadMsg.js | 113 ++++++++++-------- utils/request.js | 19 ++- 15 files changed, 167 insertions(+), 122 deletions(-) diff --git a/components/selectJobs/selectJobs.vue b/components/selectJobs/selectJobs.vue index 2ac6218..686683d 100644 --- a/components/selectJobs/selectJobs.vue +++ b/components/selectJobs/selectJobs.vue @@ -165,7 +165,7 @@ function serchforIt(defaultId) { return; } - $api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => { + const LoadCache = (resData) => { if (userInfo.value.jobTitleId) { const ids = userInfo.value.jobTitleId.split(',').map((id) => Number(id)); count.value = ids.length; @@ -174,7 +174,8 @@ function serchforIt(defaultId) { state.jobTitleId = userInfo.value.jobTitleId; state.stations = resData.data; state.visible = true; - }); + }; + $api.createRequestWithCache('/app/common/jobTitle/treeselect', {}, 'GET', false, LoadCache).then(LoadCache); } const reset = () => { diff --git a/packageA/pages/Intendedposition/Intendedposition.vue b/packageA/pages/Intendedposition/Intendedposition.vue index 61a7234..08e4e78 100644 --- a/packageA/pages/Intendedposition/Intendedposition.vue +++ b/packageA/pages/Intendedposition/Intendedposition.vue @@ -53,7 +53,7 @@ function getJobList(type = 'add') { current: pageState.page, pageSize: pageState.pageSize, }; - $api.createRequest('/app/user/apply/job', params).then((resData) => { + const LoadCache = (resData) => { const { rows, total } = resData; if (type === 'add') { const str = pageState.pageSize * (pageState.page - 1); @@ -66,8 +66,9 @@ function getJobList(type = 'add') { // pageState.list = resData.rows; pageState.total = resData.total; pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize); - console.log(pageState.list); - }); + }; + + $api.createRequestWithCache('/app/user/apply/job', params, 'GET', false, {}, LoadCache).then(LoadCache); } diff --git a/packageA/pages/addPosition/addPosition.vue b/packageA/pages/addPosition/addPosition.vue index 2eeef40..1545e26 100644 --- a/packageA/pages/addPosition/addPosition.vue +++ b/packageA/pages/addPosition/addPosition.vue @@ -176,12 +176,13 @@ function complete(values) { } function getTree() { - $api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => { + const LoadCache = (resData) => { if (resData.code === 200) { dataSource.value = flattenTree(resData.data); treeDataList.value = resData.data; } - }); + }; + $api.createRequestWithCache('/app/common/jobTitle/treeselect', {}, 'GET', false, LoadCache).then(LoadCache); } function flattenTree(treeData, parentPath = '') { diff --git a/packageA/pages/collection/collection.vue b/packageA/pages/collection/collection.vue index a627a04..5f1bc81 100644 --- a/packageA/pages/collection/collection.vue +++ b/packageA/pages/collection/collection.vue @@ -178,7 +178,8 @@ function getJobList(type = 'add') { current: pageState.page, pageSize: pageState.pageSize, }; - $api.createRequest('/app/user/collection/job', params).then((resData) => { + const LoadCache = (resData) => { + console.log(resData); const { rows, total } = resData; if (type === 'add') { const str = pageState.pageSize * (pageState.page - 1); @@ -191,7 +192,8 @@ function getJobList(type = 'add') { // pageState.list = resData.rows; pageState.total = resData.total; pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize); - }); + }; + $api.createRequestWithCache('/app/user/collection/job', params, 'GET', false, {}, LoadCache).then(LoadCache); } function getCompanyList(type = 'add') { @@ -206,7 +208,7 @@ function getCompanyList(type = 'add') { current: pageCompanyState.page, pageSize: pageCompanyState.pageSize, }; - $api.createRequest('/app/user/collection/company', params).then((resData) => { + const LoadCache = (resData) => { const { rows, total } = resData; if (type === 'add') { const str = pageCompanyState.pageSize * (pageCompanyState.page - 1); @@ -219,7 +221,8 @@ function getCompanyList(type = 'add') { // pageCompanyState.list = resData.rows; pageCompanyState.total = resData.total; pageCompanyState.maxPage = Math.ceil(pageCompanyState.total / pageCompanyState.pageSize); - }); + }; + $api.createRequestWithCache('/app/user/collection/company', params, 'GET', false, {}, LoadCache).then(LoadCache); } diff --git a/packageA/pages/exhibitors/exhibitors.vue b/packageA/pages/exhibitors/exhibitors.vue index ca3fac5..0a8659a 100644 --- a/packageA/pages/exhibitors/exhibitors.vue +++ b/packageA/pages/exhibitors/exhibitors.vue @@ -134,7 +134,7 @@ onLoad((options) => { }); function getJobFairInfo(id, name) { - $api.createRequest(`/app/internal/jobFairThirdPart/${id}`).then((resData) => { + $api.createRequest(`/app/internal/jobFairThirdPart/${id}`, {}, 'GET', true).then((resData) => { fairInfo.value = resData.data; hasAppointment(); }); @@ -152,21 +152,24 @@ function getCompanyList(type = 'add') { current: pageState.current, pageSize: pageState.pageSize, }; - $api.createRequest(`/app/internal/companyThirdPart/?zphID=${jobFairId}&zphmc=${jobFairName}`, params).then( - (resData) => { - const { rows, total } = resData; - if (type === 'add') { - const str = pageState.pageSize * (pageState.current - 1); - const end = pageState.list.length; - const reslist = rows; - pageState.list.splice(str, end, ...reslist); - } else { - pageState.list = rows; - } - pageState.total = resData.total; - pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize); + $api.createRequest( + `/app/internal/companyThirdPart/?zphID=${jobFairId}&zphmc=${jobFairName}`, + params, + 'GET', + true + ).then((resData) => { + const { rows, total } = resData; + if (type === 'add') { + const str = pageState.pageSize * (pageState.current - 1); + const end = pageState.list.length; + const reslist = rows; + pageState.list.splice(str, end, ...reslist); + } else { + pageState.list = rows; } - ); + pageState.total = resData.total; + pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize); + }); } const hasAppointment = () => { diff --git a/packageA/pages/post/post.vue b/packageA/pages/post/post.vue index f0d83ed..449ea0d 100644 --- a/packageA/pages/post/post.vue +++ b/packageA/pages/post/post.vue @@ -11,7 +11,7 @@ - + @@ -23,7 +23,7 @@ :is-month="true" > - + - {{jobInfo.xlyq == '不限' ? '学历不限' : jobInfo.xlyq}} + {{ jobInfo.xlyq == '不限' ? '学历不限' : jobInfo.xlyq }} - + - {{jobInfo.gwgzjy == '不限' ? '经验不限' : jobInfo.gwgzjy}} + {{ jobInfo.gwgzjy == '不限' ? '经验不限' : jobInfo.gwgzjy }} @@ -83,12 +83,7 @@ 公司信息 - - 单位详情 - + 单位详情 @@ -103,12 +98,12 @@ :value="jobInfo.company?.industry" >   - - {{jobInfo.qyxz}} + {{ jobInfo.qyxz }} 在招 @@ -156,19 +151,24 @@ - + @@ -232,12 +232,12 @@ function getDetail(jobId) { if (dataType.value === 2) { // 第三方数据接口 return new Promise((reslove, reject) => { - $api.createRequest(`/app/internal/jobThirdPart/${jobId}`).then((resData) => { + $api.createRequest(`/app/internal/jobThirdPart/${jobId}`, {}, 'GET', true).then((resData) => { const { gsID, gsmc, zphID } = resData.data; jobInfo.value = resData.data; reslove(resData.data); getCompanyIsAJobs(gsID, gsmc, zphID); - + if (resData.data.latitude && resData.data.longitude) { initMapCovers(resData.data.latitude, resData.data.longitude, resData.data.gsmc); } @@ -245,12 +245,12 @@ function getDetail(jobId) { }); } else { // 原数据接口 - $api.createRequest(`/app/job/${jobId}`).then((resData) => { + $api.createRequest(`/app/job/${jobId}`, {}, 'GET', true).then((resData) => { const { latitude, longitude, companyName, companyId } = resData.data; jobInfo.value = resData.data; getCompanyIsAJobs(companyId); getCompetivetuveness(jobId); - + if (latitude && longitude) { initMapCovers(latitude, longitude, companyName); } @@ -315,12 +315,12 @@ function jobApply() { if (dataType.value === 2) { // 第三方数据申请逻辑 const params = { - jobid:jobInfo.value.id, - jobname:jobInfo.value.gwmc - } + jobid: jobInfo.value.id, + jobname: jobInfo.value.gwmc, + }; if (jobInfo.value.isApply) { $api.msg('已经投递过该岗位了~'); - return ; + return; } else { $api.createRequest(`/app/internal/sendResume`, params, 'POST').then((resData) => { $api.msg('投递成功'); @@ -380,7 +380,9 @@ function jobCollection() { // 处理公司详情跳转 function handleCompanyDetail() { if (dataType.value === 2) { - navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.value.gsID}&companyName=${jobInfo.value.gsmc}&zphId=${jobInfo.value.zphID}&dataType=2`); + navTo( + `/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.value.gsID}&companyName=${jobInfo.value.gsmc}&zphId=${jobInfo.value.zphID}&dataType=2` + ); } else { navTo(`/packageA/pages/UnitDetails/UnitDetails?companyId=${jobInfo.value.company.companyId}`); } @@ -660,4 +662,4 @@ for i in 0..100 box-shadow: 0rpx -4rpx 24rpx 0rpx rgba(11,44,112,0.12); } } - \ No newline at end of file + diff --git a/packageA/pages/reservation/reservation.vue b/packageA/pages/reservation/reservation.vue index bd2aa1d..31c8dd2 100644 --- a/packageA/pages/reservation/reservation.vue +++ b/packageA/pages/reservation/reservation.vue @@ -127,7 +127,7 @@ function getList(type = 'add', loading = true) { pageSize: pageState.pageSize, type: ranItem.value.value, }; - $api.createRequest('/app/user/collection/fair', params).then((resData) => { + const LoadCache = (resData) => { const { rows, total } = resData; if (type === 'add') { const str = pageState.pageSize * (pageState.page - 1); @@ -140,7 +140,8 @@ function getList(type = 'add', loading = true) { // pageState.list = resData.rows; pageState.total = resData.total; pageState.maxPage = Math.ceil(pageState.total / pageState.pageSize); - }); + }; + $api.createRequestWithCache('/app/user/collection/fair', params, 'GET', false, {}, LoadCache).then(LoadCache); } diff --git a/pages/careerfair/careerfair.vue b/pages/careerfair/careerfair.vue index 5d5495b..c5023f1 100644 --- a/pages/careerfair/careerfair.vue +++ b/pages/careerfair/careerfair.vue @@ -201,7 +201,7 @@ function getFair(type = 'add') { if (currentDay.value?.fullDate) { params.zphjbsj = currentDay.value.fullDate.replace(/-/g, ''); } - $api.createRequest('/app/internal/jobFairThirdPart', params).then((resData) => { + $api.createRequest('/app/internal/jobFairThirdPart', params, 'GET', true).then((resData) => { const { rows, total } = resData; if (type === 'add') { // const str = pageState.pageSize * (pageState.page - 1); diff --git a/pages/login/login.vue b/pages/login/login.vue index 096b691..578c658 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -241,9 +241,10 @@ function nextStep() { // 获取职位 function getTreeselect() { - $api.createRequest('/app/common/jobTitle/treeselect', {}, 'GET').then((resData) => { + const LoadCache = (resData) => { state.station = resData.data; - }); + }; + $api.createRequestWithCache('/app/common/jobTitle/treeselect', {}, 'GET', false, LoadCache).then(LoadCache); } function loginbackdoor() { diff --git a/pages/nearby/components/four.vue b/pages/nearby/components/four.vue index cd84057..130fc65 100644 --- a/pages/nearby/components/four.vue +++ b/pages/nearby/components/four.vue @@ -381,14 +381,17 @@ defineExpose({ loadData, handleFilterConfirm }); border-radius: 12rpx 12rpx 12rpx 12rpx; .nearby-list border-top: 2rpx solid #EBEBEB; - height: calc(100% - 140rpx) + min-height: calc(100% - 140rpx) background: #f4f4f4 + display: flex; + flex-direction: column; .one-cards{ height: 100% display: flex; flex-direction: column; padding: 0 20rpx 20rpx 20rpx; background: #f4f4f4 + flex: 1 } .nav-filter padding: 16rpx 28rpx 0 28rpx diff --git a/pages/nearby/components/one.vue b/pages/nearby/components/one.vue index 33241ce..8641473 100644 --- a/pages/nearby/components/one.vue +++ b/pages/nearby/components/one.vue @@ -370,14 +370,17 @@ defineExpose({ loadData, handleFilterConfirm }); background: #e8e8e8; overflow: hidden .nearby-list - height: calc(100% - 384rpx) + min-height: calc(100% - 384rpx) background: #f4f4f4 + display: flex; + flex-direction: column; .one-cards{ display: flex; flex-direction: column; padding: 0 20rpx 20rpx 20rpx; background: #f4f4f4 height: 100% + flex: 1 } .nav-filter padding: 16rpx 28rpx 0 28rpx diff --git a/pages/nearby/components/three.vue b/pages/nearby/components/three.vue index 02fe209..5d2bc68 100644 --- a/pages/nearby/components/three.vue +++ b/pages/nearby/components/three.vue @@ -483,14 +483,17 @@ defineExpose({ loadData, handleFilterConfirm }); z-index: 1; .nearby-list border-top: 2rpx solid #EBEBEB; - height: calc(100% - 222rpx) + min-height: calc(100% - 222rpx) background: #f4f4f4 + display: flex; + flex-direction: column; .one-cards{ height: 100% display: flex; flex-direction: column; padding: 0 20rpx 20rpx 20rpx; background: #f4f4f4 + flex: 1 } .nav-filter padding: 16rpx 28rpx 0 28rpx diff --git a/pages/nearby/components/two.vue b/pages/nearby/components/two.vue index 4245977..e7b8642 100644 --- a/pages/nearby/components/two.vue +++ b/pages/nearby/components/two.vue @@ -285,14 +285,17 @@ defineExpose({ loadData, handleFilterConfirm }); border-radius: 12rpx 12rpx 12rpx 12rpx; .nearby-list border-top: 2rpx solid #EBEBEB; - height: calc(100% - 252rpx) + min-height: calc(100% - 252rpx) background: #f4f4f4 + display: flex; + flex-direction: column; .one-cards{ display: flex; flex-direction: column; padding: 0 20rpx 20rpx 20rpx; background: #f4f4f4 height: 100% + flex: 1 } .nav-filter padding: 16rpx 28rpx 0 28rpx diff --git a/stores/useReadMsg.js b/stores/useReadMsg.js index 7f0760d..f99f62a 100644 --- a/stores/useReadMsg.js +++ b/stores/useReadMsg.js @@ -12,27 +12,25 @@ import { $api, } from '../common/globalFunction'; -// 控制消息 +// 常量定义:消息在 TabBar 的索引位置 +const TABBAR_INDEX = 3; + export const useReadMsg = defineStore('readMsg', () => { const msgList = ref([]) + // 用于自定义 Tabbar 组件的渲染 const badges = ref([{ - count: 0 - }, - { - count: 0 - }, - { - count: 0 - }, - { - count: 0 - }, - { - count: 0 - }, - ]) + count: 0 + }, { + count: 0 + }, { + count: 0 + }, { + count: 0 + }, { + count: 0 + }]) - // 计算总未读数量,基于 notReadCount 字段 + // 计算总未读数量 const unreadCount = computed(() => msgList.value.reduce((sum, msg) => sum + (msg.notReadCount || 0), 0) ) @@ -42,40 +40,49 @@ export const useReadMsg = defineStore('readMsg', () => { msgList.value.filter(msg => msg.notReadCount > 0) ) - - // 设置 TabBar 角标 - function updateTabBarBadge() { + function updateBadgeEffect() { const count = unreadCount.value - const index = 3 - const countVal = count > 99 ? '99+' : String(count) - if (count === 0) { - uni.removeTabBarBadge({ - index - }) // 替换为你消息页面的 TabBar index - badges.value[index] = { - count: 0 + // 处理显示文本:超过99显示99+ + const countStr = count > 99 ? '99+' : String(count) + + // 1. 更新内部状态 (用于自定义 UI) + if (badges.value[TABBAR_INDEX]) { + badges.value[TABBAR_INDEX].count = count === 0 ? 0 : countStr + } + + // 2. 更新系统原生 TabBar + // 加 try-catch 防止在非 Tabbar 页面或加栽未完成时报错 + try { + if (count > 0) { + uni.setTabBarBadge({ + index: TABBAR_INDEX, + text: countStr + }) + } else { + uni.removeTabBarBadge({ + index: TABBAR_INDEX + }) } - } else { - badges.value[index] = { - count: countVal - } - uni.setTabBarBadge({ - index, - text: countVal - }) + } catch (e) { + console.warn('TabBar Badge 更新失败(可能当前非TabBar页面):', e) } } + watch(unreadCount, () => { + updateBadgeEffect() + console.log('value', unreadCount.value) + }, { + immediate: true + }) + // 拉取消息列表 async function fetchMessages() { try { - $api.createRequest('/app/notice/info', { + const res = await $api.createRequest('/app/notice/info', { isRead: 1 - }, "GET").then((res) => { - msgList.value = res.data || [] - updateTabBarBadge() - }) + }, "GET") + msgList.value = res.data || [] } catch (err) { console.error('获取消息失败:', err) } @@ -83,17 +90,23 @@ export const useReadMsg = defineStore('readMsg', () => { // 设置为已读 async function markAsRead(item, index) { - const msg = msgList.value[index] - if (!msg || msg.isRead === 1) return + const targetMsg = msgList.value[index] + if (!targetMsg) return + + // 如果已经是已读,直接返回,避免无效请求 + // 假设服务端逻辑是:isRead=1 表示已读 (注意检查你的字段定义) + // 你的原代码判断是 if (msg.isRead === 1) return,如果是这样,下面请求成功应该设为 1 + // 但通常未读是0,已读是1。这里维持你原有的逻辑,假设服务端把 notReadCount 清零 try { let params = { - id: msg.noticeId + id: targetMsg.noticeId } - $api.createRequest('/app/notice/read?id=' + msg.noticeId, params, "POST").then((res) => { - msgList.value[index].isRead = 1 - updateTabBarBadge() - }) + await $api.createRequest('/app/notice/read?id=' + targetMsg.noticeId, params, "POST") + + // 更新本地数据 + msgList.value[index].notReadCount = 0 + msgList.value[index].isRead = 1 // 标记已读状态 } catch (err) { console.error('设置消息已读失败:', err) } @@ -106,8 +119,8 @@ export const useReadMsg = defineStore('readMsg', () => { unreadCount, fetchMessages, markAsRead, - updateTabBarBadge + updateTabBarBadge: updateBadgeEffect } }, { - unistorage: true, + unistorage: true, // 开启持久化 }) \ No newline at end of file diff --git a/utils/request.js b/utils/request.js index b4eca8d..deb722a 100644 --- a/utils/request.js +++ b/utils/request.js @@ -26,6 +26,10 @@ const needToEncrypt = [ */ export async function createRequestWithCache(url, data = {}, method = 'GET', loading = false, headers = {}, onCacheLoad = null) { + // 是分页接口的话, 只缓存第一页的数据 + if (data.current && data.current > 1) { + return createRequest(url, data, method, loading, headers); + } const cacheKey = `${method.toUpperCase()}:${url}:${JSON.stringify(data)}`; baseDB.getDB().then(async (dbHelper) => { @@ -77,13 +81,16 @@ export function createRequest(url, data = {}, method = 'GET', loading = false, h mask: true }) } - let Authorization = '' - if (useUserStore().token) { - Authorization = `${useUserStore().token}` - } + let header = { + ...headers + }; + const userStore = useUserStore(); + const token = userStore.token; - const header = headers || {}; - header["Authorization"] = encodeURIComponent(Authorization); + if (token) { + // 确保 Authorization 不会被覆盖,且进行编码 + header["Authorization"] = encodeURIComponent(token); + } // ------------------------------------------------------------------ // 检查当前请求是否需要加密 From ecfacd13e3130b5e6e21e52c113329ee59105b73 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Sun, 30 Nov 2025 17:14:41 +0800 Subject: [PATCH 14/16] =?UTF-8?q?flat:=20=E4=BC=98=E5=8C=962?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packageA/pages/browseJob/browseJob.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packageA/pages/browseJob/browseJob.vue b/packageA/pages/browseJob/browseJob.vue index 7b54fd1..a542fb9 100644 --- a/packageA/pages/browseJob/browseJob.vue +++ b/packageA/pages/browseJob/browseJob.vue @@ -164,9 +164,12 @@ image { .collection-content height: 100% display: flex - flex-direction: column + flex-direction: column; + background: #f4f4f4 + .collection-search padding: 10rpx 20rpx; + background: #FFFFFF; .search-content position: relative From 16b8ca84cd0da5f9ec16cde4093b458159fdf036 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Mon, 1 Dec 2025 20:29:19 +0800 Subject: [PATCH 15/16] =?UTF-8?q?flat:=20=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8Canimation=20=E7=AD=89\preload=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 3 +- config.js | 4 +- hook/page-animation.css | 30 +++++++++ hook/usePageAnimation.js | 66 +++++++++++++++++++ index.html | 7 +- packageA/pages/UnitDetails/UnitDetails.vue | 23 ++++--- .../pages/newJobPosition/newJobPosition.vue | 4 +- packageA/pages/reservation/reservation.vue | 4 +- pages/careerfair/careerfair copy.vue | 4 +- pages/careerfair/careerfair.vue | 4 +- pages/chat/components/ai-paging.vue | 10 +-- pages/index/components/index-one.vue | 4 +- pages/index/index.vue | 7 ++ pages/msglog/read.vue | 2 + pages/msglog/unread.vue | 2 + pages/nearby/components/four.vue | 15 ++--- pages/nearby/components/one.vue | 10 +-- pages/nearby/components/three.vue | 11 ++-- pages/nearby/components/two.vue | 13 ++-- utils/request.js | 10 +-- 20 files changed, 169 insertions(+), 64 deletions(-) create mode 100644 hook/page-animation.css create mode 100644 hook/usePageAnimation.js diff --git a/App.vue b/App.vue index 99acae0..eb78bd7 100644 --- a/App.vue +++ b/App.vue @@ -2,10 +2,11 @@ import { reactive, inject, onMounted } from 'vue'; import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'; import useUserStore from './stores/useUserStore'; +import usePageAnimation from './hook/usePageAnimation'; import useDictStore from './stores/useDictStore'; const { $api, navTo, appendScriptTagElement, aes_Decrypt, sm2_Decrypt } = inject('globalFunction'); import config from '@/config.js'; - +usePageAnimation(); const appword = 'aKd20dbGdFvmuwrt'; // 固定值 onLaunch((options) => { diff --git a/config.js b/config.js index 74e3c87..fb1fc56 100644 --- a/config.js +++ b/config.js @@ -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', // 语音转文字 diff --git a/hook/page-animation.css b/hook/page-animation.css new file mode 100644 index 0000000..7e7fdc1 --- /dev/null +++ b/hook/page-animation.css @@ -0,0 +1,30 @@ +/* #ifdef H5 */ +uni-page { + opacity: 1; + will-change: opacity; +} + +/* --- 进场 (Enter) --- */ +uni-page.animation-enter-from { + opacity: 0; +} + +uni-page.animation-enter-active { + transition: opacity 0.2s ease-out; +} + +/* --- 离场 (Leave) --- */ +uni-page.animation-leave-active { + transition: opacity 0.15s ease-in; +} + +uni-page.animation-leave-to { + opacity: 0; +} + +/* --- 稳态 --- */ +uni-page.animation-show { + opacity: 1; +} + +/* #endif */ \ No newline at end of file diff --git a/hook/usePageAnimation.js b/hook/usePageAnimation.js new file mode 100644 index 0000000..bba7bbc --- /dev/null +++ b/hook/usePageAnimation.js @@ -0,0 +1,66 @@ +import { + onLaunch +} from '@dcloudio/uni-app' +import { + getCurrentInstance +} from 'vue' +import './page-animation.css' + +const DURATION = 130 + +export default function usePageAnimation() { + // #ifdef H5 + const show = () => { + const page = document.querySelector('uni-page') + if (!page) return + const cl = page.classList + + cl.add('animation-enter-from') + cl.remove('animation-leave-to', 'animation-leave-active') + + requestAnimationFrame(() => { + requestAnimationFrame(() => { + cl.remove('animation-enter-from') + cl.add('animation-enter-active', 'animation-show') + + setTimeout(() => { + cl.remove('animation-enter-active') + }, DURATION) + }) + }) + } + + const hide = (next) => { + const page = document.querySelector('uni-page') + if (!page) { + next() + return + } + const cl = page.classList + + cl.add('animation-leave-active') + + requestAnimationFrame(() => { + cl.remove('animation-show') + cl.add('animation-leave-to') + + setTimeout(() => { + cl.remove('animation-leave-active', 'animation-leave-to') + next() + }, DURATION - 50) + }) + } + + onLaunch(() => { + const instance = getCurrentInstance() + const router = instance?.proxy?.$router + if (router) { + show() + + router.beforeEach((to, from, next) => hide(next)) + + router.afterEach(() => show()) + } + }) + // #endif +} \ No newline at end of file diff --git a/index.html b/index.html index 2e04e64..3f577f2 100644 --- a/index.html +++ b/index.html @@ -18,9 +18,14 @@ - + + + diff --git a/packageA/pages/UnitDetails/UnitDetails.vue b/packageA/pages/UnitDetails/UnitDetails.vue index 7af3248..1966189 100644 --- a/packageA/pages/UnitDetails/UnitDetails.vue +++ b/packageA/pages/UnitDetails/UnitDetails.vue @@ -93,7 +93,7 @@ const pageOptions = ref({}); const dataType = ref(1); // 1: 原数据, 2: 第三方数据 onLoad((options) => { - console.log(options); + // console.log(options); dataType.value = options.dataType ? parseInt(options.dataType) : 1; pageOptions.value = options; @@ -145,13 +145,13 @@ function getCompanyInfo(...args) { if (dataType.value === 2) { // 第三方数据接口 const [companyId, zphId] = args; - $api.createRequest(`/app/internal/companyThirdPart/${companyId}/${zphId}`).then((resData) => { + $api.createRequest(`/app/internal/companyThirdPart/${companyId}/${zphId}`, {}, 'GET', true).then((resData) => { companyInfo.value = resData.data; }); } else { // 原数据接口 const [companyId] = args; - $api.createRequest(`/app/company/${companyId}`).then((resData) => { + $api.createRequest(`/app/company/${companyId}`, {}, 'GET', true).then((resData) => { companyInfo.value = resData.data; getJobsList(); }); @@ -184,12 +184,15 @@ function getThirdPartyJobsList(type = 'add') { pageSize: pageState.pageSize, }; - $api.createRequest(`/app/internal/jobThirdPart?gsID=${companyId}&gsmc=${companyName}&zphID=${zphId}`, params).then( - (resData) => { - const { rows, total } = resData; - handleJobsListResponse(type, rows, total, 'current'); - } - ); + $api.createRequest( + `/app/internal/jobThirdPart?gsID=${companyId}&gsmc=${companyName}&zphID=${zphId}`, + params, + 'GET', + true + ).then((resData) => { + const { rows, total } = resData; + handleJobsListResponse(type, rows, total, 'current'); + }); } function getOriginalJobsList(type = 'add') { @@ -206,7 +209,7 @@ function getOriginalJobsList(type = 'add') { pageSize: pageState.pageSize, }; - $api.createRequest(`/app/company/job/${companyInfo.value.companyId}`, params).then((resData) => { + $api.createRequest(`/app/company/job/${companyInfo.value.companyId}`, params, 'GET', true).then((resData) => { const { rows, total } = resData; handleJobsListResponse(type, rows, total, 'page'); }); diff --git a/packageA/pages/newJobPosition/newJobPosition.vue b/packageA/pages/newJobPosition/newJobPosition.vue index 4536ce0..c6c0b2c 100644 --- a/packageA/pages/newJobPosition/newJobPosition.vue +++ b/packageA/pages/newJobPosition/newJobPosition.vue @@ -24,12 +24,11 @@ - + @@ -140,6 +139,7 @@ function getList(type = 'add', loading = true) { height: 100% .list{ padding: 0 28rpx 28rpx 28rpx + height: calc(100% - 28rpx) } } } diff --git a/packageA/pages/reservation/reservation.vue b/packageA/pages/reservation/reservation.vue index 31c8dd2..d8302fd 100644 --- a/packageA/pages/reservation/reservation.vue +++ b/packageA/pages/reservation/reservation.vue @@ -13,7 +13,7 @@ - + diff --git a/pages/careerfair/careerfair copy.vue b/pages/careerfair/careerfair copy.vue index 4431345..69f3b55 100644 --- a/pages/careerfair/careerfair copy.vue +++ b/pages/careerfair/careerfair copy.vue @@ -37,7 +37,7 @@ - + 内容简介:{{ item.zphjj }} - + diff --git a/pages/careerfair/careerfair.vue b/pages/careerfair/careerfair.vue index c5023f1..59ce01f 100644 --- a/pages/careerfair/careerfair.vue +++ b/pages/careerfair/careerfair.vue @@ -44,7 +44,7 @@ - + 内容简介:{{ item.zphjj }} - + diff --git a/pages/chat/components/ai-paging.vue b/pages/chat/components/ai-paging.vue index 0dc6d79..3db1b13 100644 --- a/pages/chat/components/ai-paging.vue +++ b/pages/chat/components/ai-paging.vue @@ -268,10 +268,10 @@ import WaveDisplay from './WaveDisplay.vue'; import FileIcon from './fileIcon.vue'; import FileText from './fileText.vue'; // 系统功能hook和阿里云hook -// import { useAudioRecorder } from '@/hook/useRealtimeRecorder.js'; -import { useAudioRecorder } from '@/hook/useSystemSpeechReader.js'; -// import { useTTSPlayer } from '@/hook/useTTSPlayer.js'; -import { useTTSPlayer } from '@/hook/useSystemPlayer.js'; +import { useAudioRecorder } from '@/hook/useRealtimeRecorder.js'; +// import { useAudioRecorder } from '@/hook/useSystemSpeechReader.js'; +import { useTTSPlayer } from '@/hook/useTTSPlayer.js'; +// import { useTTSPlayer } from '@/hook/useSystemPlayer.js'; // 全局 const { $api, navTo, throttle } = inject('globalFunction'); const emit = defineEmits(['onConfirm']); @@ -632,7 +632,7 @@ function readMarkdown(value, index) { if (isPaused.value) { resume(); } else { - console.log(value, speechIndex.value, index, isPaused.value) + // console.log(value, speechIndex.value, index, isPaused.value) speak(value); } } diff --git a/pages/index/components/index-one.vue b/pages/index/components/index-one.vue index bd3ff74..bb5ac14 100644 --- a/pages/index/components/index-one.vue +++ b/pages/index/components/index-one.vue @@ -66,7 +66,7 @@ - + - + diff --git a/pages/index/index.vue b/pages/index/index.vue index 3832ce3..a29060e 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -83,6 +83,13 @@ onLoad(() => { if (fristEntry) { uni.hideTabBar(); } + // 预加载较重页面 + setTimeout(() => { + uni.preloadPage({ url: '/packageA/pages/post/post' }); + uni.preloadPage({ url: '/pages/nearby/nearby' }); + uni.preloadPage({ url: '/pages/chat/chat' }); + uni.preloadPage({ url: '/packageA/pages/choiceness/choiceness' }); + }, 3000); }); onShow(() => { diff --git a/pages/msglog/read.vue b/pages/msglog/read.vue index 58d67a9..b187216 100644 --- a/pages/msglog/read.vue +++ b/pages/msglog/read.vue @@ -35,6 +35,7 @@ {{ item.subTitle || '消息' }} + @@ -83,6 +84,7 @@ defineExpose({ loadData }); } .scrollmain{ padding: 28rpx + height: calc(100% - 56rpx) } .read{ diff --git a/pages/msglog/unread.vue b/pages/msglog/unread.vue index 9181049..b675823 100644 --- a/pages/msglog/unread.vue +++ b/pages/msglog/unread.vue @@ -33,6 +33,7 @@ {{ item.subTitle || '消息' }} + @@ -69,6 +70,7 @@ defineExpose({ loadData }); } .scrollmain{ padding: 28rpx + height: calc(100% - 56rpx) } .read{ diff --git a/pages/nearby/components/four.vue b/pages/nearby/components/four.vue index 130fc65..b11030d 100644 --- a/pages/nearby/components/four.vue +++ b/pages/nearby/components/four.vue @@ -69,13 +69,8 @@ - - + + @@ -341,15 +336,17 @@ defineExpose({ loadData, handleFilterConfirm }); .nearby-scroll overflow: hidden; height: 100%; + background: #f4f4f4; .two-head - margin: 22rpx; + padding: 22rpx; display: flex; flex-direction: column flex-wrap: no-wrap // grid-template-columns: repeat(4, 1fr); // grid-column-gap: 10rpx; // grid-row-gap: 24rpx; - border-radius: 17rpx 17rpx 17rpx 17rpx; + background: #FFFFFF + // border-radius: 17rpx 17rpx 17rpx 17rpx; .head-all{ display: flex; justify-content: space-between; diff --git a/pages/nearby/components/one.vue b/pages/nearby/components/one.vue index 8641473..c3fc9d3 100644 --- a/pages/nearby/components/one.vue +++ b/pages/nearby/components/one.vue @@ -74,13 +74,8 @@ - - + + @@ -365,6 +360,7 @@ defineExpose({ loadData, handleFilterConfirm }); .nearby-scroll overflow: hidden; height: 100%; + background: #f4f4f4; .nearby-map height: 767rpx; background: #e8e8e8; diff --git a/pages/nearby/components/three.vue b/pages/nearby/components/three.vue index 5d2bc68..828ff20 100644 --- a/pages/nearby/components/three.vue +++ b/pages/nearby/components/three.vue @@ -95,13 +95,8 @@ - - + + @@ -359,10 +354,12 @@ defineExpose({ loadData, handleFilterConfirm }); color: #4778EC !important; .nearby-scroll overflow: hidden; + background: #f4f4f4; height: 100% .three-head // margin: 24rpx 0 0 0; padding: 26rpx 0 0 0; + background: #FFFFFF; border-radius: 17rpx 17rpx 17rpx 17rpx; .one-picker height: 100% diff --git a/pages/nearby/components/two.vue b/pages/nearby/components/two.vue index e7b8642..85d4b61 100644 --- a/pages/nearby/components/two.vue +++ b/pages/nearby/components/two.vue @@ -65,13 +65,8 @@ - - + + @@ -256,10 +251,12 @@ defineExpose({ loadData, handleFilterConfirm }); .nearby-scroll overflow: hidden; height: 100%; + background: #f4f4f4; .two-head - margin: 22rpx; + padding: 22rpx; display: flex; flex-wrap: wrap + background: #FFFFFF; // grid-template-columns: repeat(4, 1fr); // grid-column-gap: 10rpx; // grid-row-gap: 24rpx; diff --git a/utils/request.js b/utils/request.js index deb722a..fe39634 100644 --- a/utils/request.js +++ b/utils/request.js @@ -137,10 +137,12 @@ export function createRequest(url, data = {}, method = 'GET', loading = false, h resolve(resData.data) return } - uni.showToast({ - title: msg, - icon: 'none' - }) + if (msg) { + uni.showToast({ + title: msg, + icon: 'none' + }) + } } if (resData.data?.code === 401 || resData.data?.code === 402) { useUserStore().logOut() From c5955959c51e508f7e770480dc7f300538315e1a Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Wed, 3 Dec 2025 11:01:58 +0800 Subject: [PATCH 16/16] flat: ces --- config.js | 4 ++-- index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config.js b/config.js index fb1fc56..74e3c87 100644 --- a/config.js +++ b/config.js @@ -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', // 语音转文字 diff --git a/index.html b/index.html index 3f577f2..f5958b8 100644 --- a/index.html +++ b/index.html @@ -22,11 +22,11 @@ --> - +