@@ -1,7 +1,7 @@ | |||||
<!-- | <!-- | ||||
* @Date: 2022-08-17 16:19:13 | * @Date: 2022-08-17 16:19:13 | ||||
* @LastEditors: JinxChen | * @LastEditors: JinxChen | ||||
* @LastEditTime: 2023-07-12 16:52:18 | |||||
* @LastEditTime: 2023-08-16 09:39:56 | |||||
* @FilePath: \TelpoH5FrontendWeb\README.md | * @FilePath: \TelpoH5FrontendWeb\README.md | ||||
* @description: 项目说明 | * @description: 项目说明 | ||||
--> | --> | ||||
@@ -664,4 +664,14 @@ update | |||||
`2023.8.11` | `2023.8.11` | ||||
update | update | ||||
- 心理监测 | - 心理监测 | ||||
- 修改 AuthToken 为 accessToken | |||||
- 修改 AuthToken 为 accessToken | |||||
## v1.0.83 | |||||
`2023.8.15` | |||||
update | |||||
- 心理建模进度查询, 心理监测首页 | |||||
- 增加 获取 accessToken 接口 | |||||
- 增加 url无 accessToken 参数时重新获取 accessToken | |||||
- 调整 问卷与佩戴提醒2个小时顺序 | |||||
- 修改 心理健康baseUrl,https://dbmq.rzliot.com/heart => https://dbmq.rzliot.com/auth_heart |
@@ -1,11 +1,11 @@ | |||||
/* | /* | ||||
* @Date: 2021-11-20 10:26:39 | * @Date: 2021-11-20 10:26:39 | ||||
* @LastEditors: JinxChen | * @LastEditors: JinxChen | ||||
* @LastEditTime: 2023-08-11 09:50:44 | |||||
* @LastEditTime: 2023-08-15 10:55:03 | |||||
* @FilePath: \TelpoH5FrontendWeb\src\config\models.js | * @FilePath: \TelpoH5FrontendWeb\src\config\models.js | ||||
* @description: | * @description: | ||||
*/ | */ | ||||
export const VERSION_MODEL = '1.0.82F'; //版本号 | |||||
export const VERSION_MODEL = '1.0.83F'; //版本号 | |||||
export const IMAGE_URL = { | export const IMAGE_URL = { | ||||
production: 'http://zfb.ssjlai.com/web/', | production: 'http://zfb.ssjlai.com/web/', | ||||
test: 'http://zfb.ssjlai.com/web/', | test: 'http://zfb.ssjlai.com/web/', | ||||
@@ -43,6 +43,7 @@ | |||||
<script> | <script> | ||||
import axios from "axios"; | import axios from "axios"; | ||||
import { isNotNull} from "@/utils/index"; | import { isNotNull} from "@/utils/index"; | ||||
import APICore from "@/api/core"; | |||||
export default { | export default { | ||||
name: 'psychologicalMain', | name: 'psychologicalMain', | ||||
data(){ | data(){ | ||||
@@ -63,27 +64,47 @@ export default { | |||||
return isNotNull(this.$route.query.fromUrl); | return isNotNull(this.$route.query.fromUrl); | ||||
} | } | ||||
}, | }, | ||||
created() { | |||||
this.loadParams(); | |||||
this.getHomeData(); | |||||
}, | |||||
mounted() { | mounted() { | ||||
this.loadParams(); | |||||
window.document.title = '心理监测'; | window.document.title = '心理监测'; | ||||
}, | }, | ||||
methods: { | methods: { | ||||
loadParams() { | |||||
// 获取b端token | |||||
getAuth() { | |||||
let manufactorId = "5bf13062-a41e-4d00-ba14-1101aad12650"; | |||||
let that = this; | |||||
return new Promise((resolve, reject) => { | |||||
APICore.getAuth({ manufactorId: manufactorId }).then(res => { | |||||
let data = res.data; | |||||
if(data.code === 0) { | |||||
resolve(res.data.data); | |||||
} else { | |||||
this.$toast.fail(`${data.message}`); | |||||
reject(''); | |||||
} | |||||
}) | |||||
}) | |||||
}, | |||||
// 加载路由参数 | |||||
async loadParams() { | |||||
let params = this.$route.query; | let params = this.$route.query; | ||||
if (params) { | if (params) { | ||||
this.uid = params.uid; | this.uid = params.uid; | ||||
this.routeDate = params.date; | this.routeDate = params.date; | ||||
this.params = params; | this.params = params; | ||||
this.$store.commit('ssjlToken', params.accessToken); | |||||
if(!params.accessToken) { | |||||
let authToken = await this.getAuth(); | |||||
this.$store.commit('ssjlToken', authToken); | |||||
} else { | |||||
this.$store.commit('ssjlToken', params.accessToken); | |||||
} | |||||
this.getHomeData(); | |||||
} | } | ||||
}, | }, | ||||
// 获取首页数据 | |||||
getHomeData() { | getHomeData() { | ||||
this.$toast.loading('数据加载中'); | this.$toast.loading('数据加载中'); | ||||
console.log("this.$store.getters.ssjlToken", this.$store.getters.ssjlToken); | |||||
let reqUrl = `https://dbmq.rzliot.com/heart/api/Data/GetHomeData`; | |||||
let reqUrl = `https://dbmq.rzliot.com/auth_heart/api/Data/GetHomeData`; | |||||
let reqParams = { | let reqParams = { | ||||
uid: this.uid, | uid: this.uid, | ||||
date: this.routeDate || this.$dayjs(new Date()).format('YYYY-MM-DD') | date: this.routeDate || this.$dayjs(new Date()).format('YYYY-MM-DD') | ||||
@@ -94,6 +115,9 @@ export default { | |||||
}).then(res => { | }).then(res => { | ||||
console.log("res", res); | console.log("res", res); | ||||
const data = res.data.response; | const data = res.data.response; | ||||
if(!data) { | |||||
return this.$toast.fail(res.data.msg); | |||||
} | |||||
this.healhtList = [ | this.healhtList = [ | ||||
// 抑郁 | // 抑郁 | ||||
{ value: data.DepScore, name: '抑郁倾向', class: 'depression', result: data.DepDesc, time: data.DepMeasureTime ? this.$dayjs(data.DepMeasureTime).format('HH:mm'): '', level: data.DepLevel, img: data.DepScore ? this.calcImg(data.DepLevel, 'depression') : ''}, | { value: data.DepScore, name: '抑郁倾向', class: 'depression', result: data.DepDesc, time: data.DepMeasureTime ? this.$dayjs(data.DepMeasureTime).format('HH:mm'): '', level: data.DepLevel, img: data.DepScore ? this.calcImg(data.DepLevel, 'depression') : ''}, | ||||
@@ -103,7 +127,7 @@ export default { | |||||
{ value: data.TirScore, name: '疲劳', class: 'tiredness', result: data.TirDesc, time: data.TirMeasureTime ? this.$dayjs(data.TirMeasureTime).format('HH:mm') : '', level: data.TirLevel, img: data.TirScore ? this.calcImg(data.TirLevel, 'tiredness') : '' }, | { value: data.TirScore, name: '疲劳', class: 'tiredness', result: data.TirDesc, time: data.TirMeasureTime ? this.$dayjs(data.TirMeasureTime).format('HH:mm') : '', level: data.TirLevel, img: data.TirScore ? this.calcImg(data.TirLevel, 'tiredness') : '' }, | ||||
]; | ]; | ||||
this.$toast.success('数据加载完成'); | this.$toast.success('数据加载完成'); | ||||
}).catch(() =>{}).finally(() => { this.$toast.clear() }) | |||||
}).catch(() =>{}).finally(() => { }) | |||||
}, | }, | ||||
onClick(item) { | onClick(item) { | ||||
@@ -693,7 +693,7 @@ export default { | |||||
let currentDate = new Date(); | let currentDate = new Date(); | ||||
// 获取最近30天的心情等级日历数据 | // 获取最近30天的心情等级日历数据 | ||||
let dateList = this.getPostDate(currentDate, 30, true); | let dateList = this.getPostDate(currentDate, 30, true); | ||||
let reqUrl = `https://dbmq.rzliot.com/heart/api/Data/GetCalendarData`; | |||||
let reqUrl = `https://dbmq.rzliot.com/auth_heart/api/Data/GetCalendarData`; | |||||
let reqParams = { | let reqParams = { | ||||
uid: this.uid, | uid: this.uid, | ||||
startDate: dateList[0], | startDate: dateList[0], | ||||
@@ -753,7 +753,7 @@ export default { | |||||
type: this.emoType | type: this.emoType | ||||
}; | }; | ||||
console.log("请求参数", reqParams); | console.log("请求参数", reqParams); | ||||
let reqUrl = `https://dbmq.rzliot.com/heart/api/Data/GetHisData`; | |||||
let reqUrl = `https://dbmq.rzliot.com/auth_heart/api/Data/GetHisData`; | |||||
axios | axios | ||||
.get(reqUrl, { | .get(reqUrl, { | ||||
params: { ...reqParams }, | params: { ...reqParams }, | ||||
@@ -979,11 +979,15 @@ export default { | |||||
this.result = data.Result; | this.result = data.Result; | ||||
this.resultLevel = data.ResultLevel; | this.resultLevel = data.ResultLevel; | ||||
this.advice = data.Advice; | this.advice = data.Advice; | ||||
this.$toast.loading({ | |||||
this.$toast.success({ | |||||
message: '数据加载完成' | message: '数据加载完成' | ||||
}); | }); | ||||
} | } | ||||
}).catch(() => {}).finally(() => { this.$toast.clear(); }); | |||||
}).catch(() => { | |||||
this.$dialog({ | |||||
message: '登录过期,请重新进入' | |||||
}) | |||||
}).finally(() => { }); | |||||
}, | }, | ||||
// 计算百分比 | // 计算百分比 | ||||
calcPercentage(value, total) { | calcPercentage(value, total) { | ||||
@@ -17,32 +17,9 @@ | |||||
</div> | </div> | ||||
</div> | </div> | ||||
<div v-if="info"> | <div v-if="info"> | ||||
<div class="step" v-show="info.progress !== 1"> | |||||
<div class="name">第一步</div> | |||||
<div class="title"> | |||||
<div class="text">连续佩戴两小时</div> | |||||
<div class="status success" v-if="info.progress === 1"> | |||||
<span class="icon" | |||||
><i class="iconfont icon-caozuochenggong"></i | |||||
></span> | |||||
<span>已完成</span> | |||||
</div> | |||||
<div class="status" v-else>{{ stateText}}</div> | |||||
</div> | |||||
<div class="schedule"> | |||||
<van-progress | |||||
:percentage="(info.progress) * 100" | |||||
stroke-width="10px" | |||||
color="#638ee4" | |||||
:show-pivot="true" | |||||
></van-progress> | |||||
</div> | |||||
<div class="sub_title"> | |||||
请连续佩戴不低于2小时,有助于为您输出更加精准的情绪分析指标。 | |||||
</div> | |||||
</div> | |||||
<!-- 第一步 --> | |||||
<div class="step" v-show="info.initScaleState !== 1"> | <div class="step" v-show="info.initScaleState !== 1"> | ||||
<div class="name">第二步</div> | |||||
<div class="name">第一步</div> | |||||
<div class="title"> | <div class="title"> | ||||
<div class="text">情绪初始化评估</div> | <div class="text">情绪初始化评估</div> | ||||
<div class="status success" v-if="info.initScaleState === 1"> | <div class="status success" v-if="info.initScaleState === 1"> | ||||
@@ -66,6 +43,32 @@ | |||||
>去完成</van-button> | >去完成</van-button> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<!-- 第二步 --> | |||||
<div class="step" v-show="info.progress !== 1"> | |||||
<div class="name">第二步</div> | |||||
<div class="title"> | |||||
<div class="text">连续佩戴两小时</div> | |||||
<div class="status success" v-if="info.progress === 1"> | |||||
<span class="icon" | |||||
><i class="iconfont icon-caozuochenggong"></i | |||||
></span> | |||||
<span>已完成</span> | |||||
</div> | |||||
<div class="status" v-else>{{ stateText}}</div> | |||||
</div> | |||||
<div class="schedule"> | |||||
<van-progress | |||||
:percentage="(info.progress) * 100" | |||||
stroke-width="10px" | |||||
color="#638ee4" | |||||
:show-pivot="true" | |||||
></van-progress> | |||||
</div> | |||||
<div class="sub_title"> | |||||
请连续佩戴不低于2小时,有助于为您输出更加精准的情绪分析指标。 | |||||
</div> | |||||
</div> | |||||
<div class="completed" v-show="info.progress === 1 && info.initScaleState === 1"> | <div class="completed" v-show="info.progress === 1 && info.initScaleState === 1"> | ||||
<van-button | <van-button | ||||
round | round | ||||
@@ -80,7 +83,7 @@ | |||||
<script> | <script> | ||||
import axios from 'axios' | import axios from 'axios' | ||||
import APICore from "@/api/core"; | |||||
export default { | export default { | ||||
name: 'PsychologicalModeling', | name: 'PsychologicalModeling', | ||||
data() { | data() { | ||||
@@ -109,12 +112,11 @@ export default { | |||||
window.document.title = '情绪初始化建模' | window.document.title = '情绪初始化建模' | ||||
//页面传参 | //页面传参 | ||||
let params = { ...this.$route.query } | |||||
let params = { ...this.$route.query } | |||||
if (params.uid) { | if (params.uid) { | ||||
this.uid = params.uid; | this.uid = params.uid; | ||||
// 缓存从随手精灵传过来的token | // 缓存从随手精灵传过来的token | ||||
this.$store.commit('ssjlToken', params.token || params.accessToken); | |||||
this.$store.commit('ssjlToken', params.accessToken || ''); | |||||
// 缓存从随手精灵传过来的标识 | // 缓存从随手精灵传过来的标识 | ||||
this.$store.commit('fromSsjl', params.fromSsjl); | this.$store.commit('fromSsjl', params.fromSsjl); | ||||
// 是否显示 返回标签 | // 是否显示 返回标签 | ||||
@@ -128,6 +130,23 @@ export default { | |||||
} | } | ||||
}, | }, | ||||
methods: { | methods: { | ||||
// 获取b端token | |||||
getAuth() { | |||||
let manufactorId = "5bf13062-a41e-4d00-ba14-1101aad12650"; | |||||
let that = this; | |||||
return new Promise((resolve, reject) => { | |||||
APICore.getAuth({ manufactorId: manufactorId }).then(res => { | |||||
let data = res.data; | |||||
if(data.code === 0) { | |||||
resolve(res.data.data); | |||||
} else { | |||||
that.$toast.fail(`${data.message}`); | |||||
reject(''); | |||||
} | |||||
}) | |||||
}) | |||||
}, | |||||
// 返回 | |||||
onNavBack() { | onNavBack() { | ||||
let fromSsjl = this.$store.getters.fromSsjl === 'true'; | let fromSsjl = this.$store.getters.fromSsjl === 'true'; | ||||
if(fromSsjl) { | if(fromSsjl) { | ||||
@@ -138,6 +157,11 @@ export default { | |||||
} | } | ||||
}, | }, | ||||
async init() { | async init() { | ||||
if(!this.$route.query.accessToken) { | |||||
// 如果当前url没有 accessToken, 获取token,并且存储到本地缓存里面 | |||||
let authToken = await this.getAuth(); | |||||
this.$store.commit('ssjlToken', authToken); | |||||
} | |||||
let ssjlToken = this.$store.getters.ssjlToken; | let ssjlToken = this.$store.getters.ssjlToken; | ||||
let re = await this.api('/api/Question/Progress', { | let re = await this.api('/api/Question/Progress', { | ||||
method: 'GET', | method: 'GET', | ||||
@@ -166,7 +190,7 @@ export default { | |||||
this.$router.replace(`/PsychologicalQuestionnaire?uid=${this.uid}`) | this.$router.replace(`/PsychologicalQuestionnaire?uid=${this.uid}`) | ||||
}, | }, | ||||
api(url, config, token) { | api(url, config, token) { | ||||
let baseUrl = 'https://dbmq.rzliot.com/heart' | |||||
let baseUrl = 'https://dbmq.rzliot.com/auth_heart' | |||||
setTimeout(() => { | setTimeout(() => { | ||||
this.$toast.loading({ | this.$toast.loading({ | ||||
message: '', | message: '', | ||||
@@ -229,7 +229,7 @@ export default { | |||||
duration: 1500, | duration: 1500, | ||||
}) | }) | ||||
}, 100) | }, 100) | ||||
let baseUrl = 'https://dbmq.rzliot.com/heart' | |||||
let baseUrl = 'https://dbmq.rzliot.com/auth_heart' | |||||
return new Promise((res) => { | return new Promise((res) => { | ||||
axios({ | axios({ | ||||
url: `${baseUrl}${url}`, | url: `${baseUrl}${url}`, | ||||