From 4991d23ca8ec11af74d87f756cdff07ba80289ff Mon Sep 17 00:00:00 2001 From: ingkele <598792849@qq.com> Date: Fri, 23 Oct 2026 19:22:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=88=91=E7=9A=84=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E9=A1=B5=E6=9C=AA=E7=99=BB=E5=BD=95=E5=BC=95=E5=AF=BC=E7=99=BB?= =?UTF-8?q?=E5=BD=95=EF=BC=8Cuid=E8=8E=B7=E5=8F=96=E5=A2=9E=E5=8A=A0storag?= =?UTF-8?q?e=E5=85=9C=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复进入我的报告页即提示加载失败:未登录时云函数返回未登录被reject - 新增getUid:vuex优先、uni_id_user_info storage兜底 - 未登录时不再发请求,弹窗引导去登录 --- pages/ai/reports.vue | 28 ++- pages/ai/review.vue | 11 +- .../jjxReviewTimer/package-lock.json | 170 ++++++++++++++++++ 3 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 uniCloud-tcb/cloudfunctions/jjxReviewTimer/package-lock.json diff --git a/pages/ai/reports.vue b/pages/ai/reports.vue index 377ee29..702daca 100644 --- a/pages/ai/reports.vue +++ b/pages/ai/reports.vue @@ -81,12 +81,35 @@ export default { this.queryReports() }, methods: { + // 获取当前登录用户uid(vuex优先,storage兜底) + getUid() { + let uid = (typeof vk.getVuex === 'function' && vk.getVuex('$user.userInfo._id')) || '' + if (!uid) { + const cache = vk.getStorageSync('uni_id_user_info') || {} + uid = cache._id || cache.uid || '' + } + return uid + }, + // 未登录引导 + checkLogin() { + if (this.getUid()) return true + uni.showModal({ + title: '提示', + content: '请先登录后查看报告', + confirmText: '去登录', + success: (res) => { + if (res.confirm) uni.navigateTo({ url: '/pages/login/login' }) + } + }) + return false + }, async queryReports() { + if (!this.checkLogin()) return this.loading = true try { const res = await vk.callFunction({ url: 'client/ai/pub/getMyReports', - data: { pageIndex: 1, pageSize: 50, uid: vk.getVuex('$user.userInfo._id') || '' } + data: { pageIndex: 1, pageSize: 50, uid: this.getUid() } }) if (res.code === 0 && res.data && res.data.rows) { this.reportList = res.data.rows.map(r => ({ @@ -115,6 +138,7 @@ export default { }, // 待审查记录 → 重新发起审查 async reReview(r) { + if (!this.checkLogin()) return if (!r.fileId) { uni.showToast({ title: '该记录缺少文件信息', icon: 'none' }) return @@ -147,7 +171,7 @@ export default { file_id: r.fileId, file_name: r.fileName, file_size: r.fileSize || 0, - uid: vk.getVuex('$user.userInfo._id') || '' + uid: this.getUid() } }) uni.hideLoading() diff --git a/pages/ai/review.vue b/pages/ai/review.vue index 1404234..f8e9cd6 100644 --- a/pages/ai/review.vue +++ b/pages/ai/review.vue @@ -84,6 +84,15 @@ export default { this.getPointsBalance() }, methods: { + // 获取当前登录用户uid(vuex优先,storage兜底) + getUid() { + let uid = (typeof vk.getVuex === 'function' && vk.getVuex('$user.userInfo._id')) || '' + if (!uid) { + const cache = vk.getStorageSync('uni_id_user_info') || {} + uid = cache._id || cache.uid || '' + } + return uid + }, async getPointsBalance() { const res = await vk.callFunction({ url: 'client/points/kh/getBalance' }) if (res.code === 0 && res.data) { @@ -122,7 +131,7 @@ export default { file_base64: base64, file_name: fileName, file_size: fileSize, - uid: vk.getVuex('$user.userInfo._id') || '', + uid: this.getUid(), upload_only: true } }) diff --git a/uniCloud-tcb/cloudfunctions/jjxReviewTimer/package-lock.json b/uniCloud-tcb/cloudfunctions/jjxReviewTimer/package-lock.json new file mode 100644 index 0000000..140a83a --- /dev/null +++ b/uniCloud-tcb/cloudfunctions/jjxReviewTimer/package-lock.json @@ -0,0 +1,170 @@ +{ + "name": "jjxReviewTimer", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "jjxReviewTimer", + "version": "1.0.0", + "dependencies": { + "docx": "^8.5.0" + } + }, + "node_modules/@types/node": { + "version": "20.19.43", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz", + "integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "node_modules/docx": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/docx/-/docx-8.5.0.tgz", + "integrity": "sha512-4SbcbedPXTciySXiSnNNLuJXpvxFe5nqivbiEHXyL8P/w0wx2uW7YXNjnYgjW0e2e6vy+L/tMISU/oAiXCl57Q==", + "dependencies": { + "@types/node": "^20.3.1", + "jszip": "^3.10.1", + "nanoid": "^5.0.4", + "xml": "^1.0.1", + "xml-js": "^1.6.8" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/jszip": { + "version": "3.10.2", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.2.tgz", + "integrity": "sha512-3l+rb15IOWtUhU0H5MFqES/T6Kh7abYwjosBey/vD6hDt8zoEffkSC5Ws5SGtgVw3gBx2NEbhTeSW1+kWkpyTQ==", + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dependencies": { + "immediate": "~3.0.5" + } + }, + "node_modules/nanoid": { + "version": "5.1.16", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.16.tgz", + "integrity": "sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.js" + }, + "engines": { + "node": "^18 || >=20" + } + }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/sax": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz", + "integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==", + "engines": { + "node": ">=11.0.0" + } + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==" + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==" + }, + "node_modules/xml-js": { + "version": "1.6.11", + "resolved": "https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz", + "integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==", + "dependencies": { + "sax": "^1.2.4" + }, + "bin": { + "xml-js": "bin/cli.js" + } + } + } +}