From 4d4d3e7188d24da04c9e8ef76c2a4f5c448b3bea Mon Sep 17 00:00:00 2001 From: JinxChen <2183691628@qq.com> Date: Thu, 1 Jun 2023 18:08:42 +0800 Subject: [PATCH] =?UTF-8?q?update=20-=20=E5=BF=83=E7=90=86=E5=81=A5?= =?UTF-8?q?=E5=BA=B7=20=20=20=20=20-=20=E5=BB=BA=E6=A8=A1=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9F=A5=E8=AF=A2=EF=BC=8C=E9=97=AE=E5=8D=B7=E8=B0=83?= =?UTF-8?q?=E6=9F=A5=EF=BC=8C=E5=BF=83=E7=90=86=E8=AF=A6=E6=83=85=E6=B1=87?= =?UTF-8?q?=E6=80=BB=E5=92=8C=E5=BF=83=E7=90=86=E5=81=A5=E5=BA=B7=E6=8A=91?= =?UTF-8?q?=E9=83=81=EF=BC=8C=E5=8E=8B=E5=8A=9B=E5=92=8C=E7=96=B2=E5=8A=B3?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?-=20=E5=A2=9E=E5=8A=A0=20=E6=8E=A5=E5=8F=A3=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=97=B6=E5=B8=A6=E4=B8=8A=E4=BB=8E=E9=9A=8F=E6=89=8B=E7=B2=BE?= =?UTF-8?q?=E7=81=B5=E4=BC=A0=E8=BF=87=E6=9D=A5=E7=9A=84token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++++++- src/config/models.js | 4 +-- src/store/index.js | 13 ++++++++-- src/views/health/psychological-main/index.vue | 4 ++- src/views/health/psychological/index.vue | 6 +++-- src/views/psychological-modeling/index.vue | 25 +++++++++++++------ .../psychological-questionnaire/index.vue | 14 +++++++---- 7 files changed, 54 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 6defcdc..6774579 100644 --- a/README.md +++ b/README.md @@ -460,4 +460,11 @@ update ## v1.0.56 `2023.6.1` feature -- 增加 一个心理详情汇总页面 \ No newline at end of file +- 增加 一个心理详情汇总页面 + +## v1.0.57 +`2023.6.1` +update +- 心理健康 + - 建模进度查询,问卷调查,心理详情汇总和心理健康抑郁,压力和疲劳详情页面 + - 增加 接口请求时带上从随手精灵传过来的token \ No newline at end of file diff --git a/src/config/models.js b/src/config/models.js index 59f0f71..fd39a14 100644 --- a/src/config/models.js +++ b/src/config/models.js @@ -1,11 +1,11 @@ /* * @Date: 2021-11-20 10:26:39 * @LastEditors: JinxChen - * @LastEditTime: 2023-05-29 17:10:20 + * @LastEditTime: 2023-06-01 18:06:38 * @FilePath: \TelpoH5FrontendWeb\src\config\models.js * @description: */ -export const VERSION_MODEL = '1.0.56F'; //版本号 +export const VERSION_MODEL = '1.0.57F'; //版本号 export const IMAGE_URL = { production: 'http://zfb.ssjlai.com/web/', test: 'http://zfb.ssjlai.com/web/', diff --git a/src/store/index.js b/src/store/index.js index 46ea7a6..10c23ad 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,7 +1,7 @@ /* * @Date: 2022-08-17 16:18:02 * @LastEditors: JinxChen - * @LastEditTime: 2023-02-25 15:23:43 + * @LastEditTime: 2023-06-01 17:45:48 * @FilePath: \TelpoH5FrontendWeb\src\store\index.js * @description: */ @@ -19,7 +19,8 @@ export default new Vuex.Store({ wxAuthCode: '', openId: '', appId: '', - isFromWx: null + isFromWx: null, + ssjlToken: '', }, mutations: { imei(state, imei) { @@ -50,6 +51,10 @@ export default new Vuex.Store({ state.isFromWx = isFromWx; window.localStorage[prefix + 'isFromWx'] = isFromWx; }, + ssjlToken(state, ssjlToken) { + state.ssjlToken = ssjlToken; + window.localStorage[prefix + 'ssjlToken'] = ssjlToken; + }, }, getters: { imei: state => { @@ -80,6 +85,10 @@ export default new Vuex.Store({ if (state.isFromWx != '') return state.isFromWx; return window.localStorage[prefix + 'isFromWx'] == null ? '' : window.localStorage[prefix + 'isFromWx']; }, + ssjlToken: state => { + if (state.ssjlToken != '') return state.ssjlToken; + return window.localStorage[prefix + 'ssjlToken'] == null ? '' : window.localStorage[prefix + 'ssjlToken']; + }, }, actions: {}, modules: {} diff --git a/src/views/health/psychological-main/index.vue b/src/views/health/psychological-main/index.vue index 10e84e2..c8e4afe 100644 --- a/src/views/health/psychological-main/index.vue +++ b/src/views/health/psychological-main/index.vue @@ -62,13 +62,15 @@ export default { }, getHomeData() { this.$toast.loading('数据加载中'); + console.log("this.$store.getters.ssjlToken", this.$store.getters.ssjlToken); let reqUrl = `https://dbmq.rzliot.com/heart/api/Data/GetHomeData`; let reqParams = { uid: this.uid, date: this.$dayjs(new Date()).format('YYYY-MM-DD') }; axios.get(reqUrl, { - params: { ...reqParams } + params: { ...reqParams }, + headers: { 'AuthToken': this.$store.getters.ssjlToken } }).then(res => { console.log("res", res); const data = res.data.response; diff --git a/src/views/health/psychological/index.vue b/src/views/health/psychological/index.vue index 6b46e75..3b3f5ba 100644 --- a/src/views/health/psychological/index.vue +++ b/src/views/health/psychological/index.vue @@ -643,7 +643,8 @@ export default { month: this.$dayjs(new Date()).format('YYYY-MM') }; axios.get(reqUrl, { - params: { ...reqParams } + params: { ...reqParams }, + headers: { 'AuthToken': this.$store.getters.ssjlToken } }).then(res => { console.log("res", res); if (res.data) { @@ -683,7 +684,8 @@ export default { let reqUrl = `https://dbmq.rzliot.com/heart/api/Data/GetHisData`; axios .get(reqUrl, { - params: { ...reqParams } + params: { ...reqParams }, + headers: { 'AuthToken': this.$store.getters.ssjlToken } }) .then(res => { console.log("res", res); diff --git a/src/views/psychological-modeling/index.vue b/src/views/psychological-modeling/index.vue index 7a57929..403c6ed 100644 --- a/src/views/psychological-modeling/index.vue +++ b/src/views/psychological-modeling/index.vue @@ -73,7 +73,7 @@ export default { name: 'PsychologicalModeling', data() { return { - info: null, + info: null, } }, mounted() { @@ -84,8 +84,9 @@ export default { let params = { ...this.$route.query } if (params.uid) { - this.uid = params.uid - + this.uid = params.uid; + // 缓存从随后精灵传过来的token + this.$store.commit('ssjlToken', params.token); //初始化 this.init() } else { @@ -94,18 +95,22 @@ export default { }, methods: { async init() { + let ssjlToken = this.$store.getters.ssjlToken; let re = await this.api('/api/Question/Progress', { method: 'GET', sslVerify: false, withCredentials: false, params: { uid: this.uid, - }, - }) + }, + }, ssjlToken) if (re.success) { if (re.response && re.response.state === -1) { this.$toast('用户不存在或未绑定手表') - } else { + } else if (re.response && re.response.state === 1) { + // 2023.6.1 需求变更,建模完成直接跳到心理健康汇总页面 + this.$router.push(`/psychologicalMain?uid=${this.uid}`); + } else { this.info = re.response } } else { @@ -115,7 +120,7 @@ export default { toQuestion() { this.$router.push(`/PsychologicalQuestionnaire?uid=${this.uid}`) }, - api(url, config) { + api(url, config, token) { let baseUrl = 'https://dbmq.rzliot.com/heart' setTimeout(() => { this.$toast.loading({ @@ -127,7 +132,11 @@ export default { return new Promise((res) => { axios({ url: `${baseUrl}${url}`, - ...config, + ...config, + // 增加请求头部 token + headers: { + 'AuthToken': token + } }) .then((re) => { if (re) { diff --git a/src/views/psychological-questionnaire/index.vue b/src/views/psychological-questionnaire/index.vue index beb0c1e..74b1752 100644 --- a/src/views/psychological-questionnaire/index.vue +++ b/src/views/psychological-questionnaire/index.vue @@ -133,7 +133,7 @@ export default { params: { // uid: this.uid, }, - }) + }, this.$store.getters.ssjlToken) if (re.success) { if (re.response && re.response.length) { let temp = re.response[0] @@ -147,7 +147,7 @@ export default { params: { code: code, }, - }) + }, this.$store.getters.ssjlToken) if (re1.success) { if (re1.response && re1.response.length) { let topic = [] @@ -199,7 +199,7 @@ export default { sslVerify: false, withCredentials: false, data: temp, - }) + }, this.$store.getters.ssjlToken) if (re.success) { this.$toast('问卷提交成功', 3000) setTimeout(() => { @@ -221,7 +221,7 @@ export default { console.log(error) } }, - api(url, config) { + api(url, config, token) { setTimeout(() => { this.$toast.loading({ message: '', @@ -233,7 +233,11 @@ export default { return new Promise((res) => { axios({ url: `${baseUrl}${url}`, - ...config, + ...config, + // 增加请求头部 token + headers: { + 'AuthToken': token + } }) .then((re) => { if (re) {