From 3e7ac6fbf06932f80890bd9ca43641b77a636b7a Mon Sep 17 00:00:00 2001 From: wangyi <3432649580@qq.com> Date: Wed, 29 Oct 2025 13:23:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=B1=E5=BA=A6=E6=8E=A2=E7=B4=A2=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E8=AE=B0=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/deepExploration/deepExploration.js | 13 + components/deepExploration_header.vue | 66 +-- pages/deepExploration/deepExploration.vue | 871 ++++++++++++++++-------------- stores/index.js | 1 + stores/modules/deepExploration.js | 44 ++ utils/http.js | 7 +- 6 files changed, 532 insertions(+), 470 deletions(-) create mode 100644 stores/modules/deepExploration.js diff --git a/api/deepExploration/deepExploration.js b/api/deepExploration/deepExploration.js index 386e0bf..d2d33bb 100644 --- a/api/deepExploration/deepExploration.js +++ b/api/deepExploration/deepExploration.js @@ -21,3 +21,16 @@ export const RecordListApi = (data) => { } + + +//历史记录详情 +export const RecordInfoApi = (data) => { + return http({ + method: 'POST', + url: '/api/coze/clickRecord', + data:data + }) +} + + + diff --git a/components/deepExploration_header.vue b/components/deepExploration_header.vue index 2a63d6a..daae53c 100644 --- a/components/deepExploration_header.vue +++ b/components/deepExploration_header.vue @@ -84,8 +84,12 @@ \ No newline at end of file diff --git a/stores/index.js b/stores/index.js index 354b74d..ada9fd8 100644 --- a/stores/index.js +++ b/stores/index.js @@ -9,5 +9,6 @@ pinia.use(persist) // 导入所有模块 export * from './modules/userInfo' export * from './modules/deviceInfo' +export * from './modules/deepExploration' // 默认导出,给 main.js 使用 export default pinia \ No newline at end of file diff --git a/stores/modules/deepExploration.js b/stores/modules/deepExploration.js new file mode 100644 index 0000000..d326807 --- /dev/null +++ b/stores/modules/deepExploration.js @@ -0,0 +1,44 @@ +import { defineStore } from 'pinia' +import { ref } from 'vue' + +// 定义 Store +export const useDeepExplorationStore = defineStore( + 'deepExploration', + () => { + // 会员信息 + const deepExplorationInfo = ref() + + // 保存会员信息,登录时使用 + const setDeepExplorationInfo = (val) => { + deepExplorationInfo.value = val + } + + // 清理会员信息,退出时使用 + const clearDeepExplorationInfo = () => { + deepExplorationInfo.value = undefined + } + + // 记得 return + return { + deepExplorationInfo, + setDeepExplorationInfo, + clearDeepExplorationInfo, + } + }, + // TODO: 持久化 + { + // 网页端持久化 + // persist: true, + // 小程序端持久化 + persist: { + storage: { + getItem(key) { + return uni.getStorageSync(key) + }, + setItem(key, value) { + uni.setStorageSync(key, value) + }, + }, + }, + }, +) diff --git a/utils/http.js b/utils/http.js index 51668a2..7ef4d56 100644 --- a/utils/http.js +++ b/utils/http.js @@ -30,15 +30,14 @@ const httpInterceptor = { const deviceInfo =useDeviceStore() - const client = 'ios'; + options.header = { ...options.header, - 'source-client': 'miniapp', // 标准头与文档头同时设置,确保兼容 'content-type': 'application/json', 'contentType': 'application/json', - 'version': '1', - 'client': client, + 'version': uni.getSystemInfoSync().appVersion, + 'client': uni.getSystemInfoSync().platform == 'ios' ? 'ios' : 'android', 'deviceId': deviceInfo.deviceInfo.deviceId } //4 添加token,优先用store,没有则回退到body中的token,保持与Apifox一致