Browse Source

Merge branch 'develop'

master
JinxChen 7 hours ago
parent
commit
e65be03b24
13 changed files with 4201 additions and 112 deletions
  1. +33
    -0
      README.md
  2. +81
    -81
      package-lock.json
  3. +1
    -1
      src/config/models.js
  4. +5
    -0
      src/router/index.js
  5. +1
    -0
      src/views/health/psychological-main/index.vue
  6. +31
    -8
      src/views/health/psychological/index.scss
  7. +176
    -21
      src/views/health/psychological/index.vue
  8. +339
    -0
      src/views/health/psychological/reportDetails/index.scss
  9. +2249
    -0
      src/views/health/psychological/reportDetails/index.vue
  10. +16
    -1
      src/views/psychological-modeling/index.vue
  11. +336
    -0
      src/views/psychological-scale/detail.vue
  12. +575
    -0
      src/views/psychological-scale/index.vue
  13. +358
    -0
      src/views/psychological-scale/list.vue

+ 33
- 0
README.md View File

@@ -1180,3 +1180,36 @@ update

- 增加 app打开充值h5跳转到话费查询页面
- 增加 app点击订购套餐提示


## v1.0.128

`2024.8.7`
update

- 增加 心理量表功能

## v1.0.129

`2024.8.7`
update

- 量表页面全部增加可选头部导航

## v1.0.130

`2024.8.7`
fix

- 修复 心理量表选项起始数调整为0
`2024.8.21`
update
- 优化 周报汇总切换


## v1.0.131

`2024.9.5`
fix
- 修复 周报初始化图表异常的问题


+ 81
- 81
package-lock.json View File

@@ -2250,87 +2250,6 @@
"webpack-chain": "^6.4.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^4.2.2"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz",
"integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
}
}
},
"@vue/cli-shared-utils": {
@@ -15020,6 +14939,87 @@
}
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"loader-utils": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz",
"integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==",
"dev": true,
"optional": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^3.0.0",
"json5": "^2.1.2"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-router": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.5.3.tgz",


+ 1
- 1
src/config/models.js View File

@@ -8,7 +8,7 @@
import store from "@/store";
// 情绪模型
const appTypeList = ['1'];
export const VERSION_MODEL = '1.0.127F'; //版本号
export const VERSION_MODEL = '1.0.131F'; //版本号
export const IMAGE_URL = {
production: 'http://zfb.ssjlai.com/web/',
test: 'http://zfb.ssjlai.com/web/',


+ 5
- 0
src/router/index.js View File

@@ -56,6 +56,9 @@ const routes = [
// 心理监测
{ path: '/PsychologicalModeling', name: 'PsychologicalModeling', component: resolve => require(['@/views/psychological-modeling'], resolve) },
{ path: '/PsychologicalQuestionnaire', name: 'PsychologicalQuestionnaire', component: resolve => require(['@/views/psychological-questionnaire'], resolve) },
{ path: '/PsychologicalScale', name: 'PsychologicalScale', component: resolve => require(['@/views/psychological-scale'], resolve) },
{ path: '/PsychologicalScaleDetail', name: 'PsychologicalScaleDetail', component: resolve => require(['@/views/psychological-scale/detail'], resolve) },
{ path: '/PsychologicalScaleList', name: 'PsychologicalScaleList', component: resolve => require(['@/views/psychological-scale/list'], resolve) },

// 健康-心理监测详情,抑郁,压力和疲劳
{ path: '/psychological', name: 'psychological', component: resolve => require(['@/views/health/psychological'], resolve) },
@@ -65,6 +68,8 @@ const routes = [
{ path: '/psychologicalReport', name: 'psychologicalReport', component: resolve => require(['@/views/health/psychological/report/index'], resolve) },
// 周报/月报-入口
{ path: '/psychiclReportEntry', name: 'psychiclReportEntry', component: resolve => require(['@/views/health/psychological/report/report-entry'], resolve) },
// 周报/月报
{ path: '/reportDetails', name: 'reportDetails', component: resolve => require(['@/views/health/psychological/reportDetails/index'], resolve) },

// 告警详情-中间页
{ path: '/aiCallAlarm', name: 'aiCallAlarm', component: resolve => require(['@/views/ai-call-alarm'], resolve) },


+ 1
- 0
src/views/health/psychological-main/index.vue View File

@@ -89,6 +89,7 @@ export default {
},
// 加载路由参数
async loadParams() {
this.$toast.loading("数据加载中");
let params = this.$route.query;
if (params) {
this.uid = params.uid;


+ 31
- 8
src/views/health/psychological/index.scss View File

@@ -69,7 +69,7 @@ $newBlue: #638EE4;
}
}
.psy-tab-bar {
height: 40px;
height: 30px;
position: relative;
margin: 5px 0;
padding: 0 10px;
@@ -84,7 +84,7 @@ $newBlue: #638EE4;
justify-content: space-around;
align-items: center;
color: #fff;
height: 40px;
height: 30px;
width: 100%;
/* background-color: red; */
.psy-tab-item {
@@ -93,12 +93,12 @@ $newBlue: #638EE4;
color: #6D6D6D;
height: 100%;
width: 100%;
font-size: 18px;
font-size: 14px;
border-radius: 20px;
@include center();
&.active {
color: #FFFFFF;
background-color: #638EE4;
background-color: #189B3BFF;
}
}
}
@@ -106,8 +106,9 @@ $newBlue: #638EE4;
}
.main {
position: relative;
height: calc(100vh - 150px);
overflow: scroll;
height: calc(100vh - 110px);
overflow-y: scroll;
overflow-x: hidden;
.top {
flex: 1;
.title {
@@ -123,6 +124,22 @@ $newBlue: #638EE4;
font-size: 18px;
}
}

.title-right{
display: flex;

.title-right-button{
color: #638EE4;
font-size: 16px;
border: 1px solid #638EE4;
padding: 2px 10px;
margin-right: 5px;

&:last-child{
margin-right: 0;
}
}
}
}
.monitoring-count {
text-align: left;
@@ -149,6 +166,10 @@ $newBlue: #638EE4;
height: 106px;
width: 106px;
}
#pieChartDay {
height: 106px;
width: 106px;
}
}
.pie-chart-right {
height: 150px;
@@ -420,10 +441,12 @@ $newBlue: #638EE4;
}
.overall {
display: flex;
justify-content: space-between;
align-items: center;
justify-content: flex-start;
align-items: flex-start;
width: 100%;
.left {
flex-direction: column;
p {
padding-left: 20px;
font-weight: bold;


+ 176
- 21
src/views/health/psychological/index.vue View File

@@ -21,7 +21,7 @@
</div>
</div>
<!-- 情绪切换 -->
<div class="psy-tab-bar">
<div class="psy-tab-bar" v-if="pageType !== 1">
<div class="psy-tab-con">
<div class="psy-tab-list">
<div :class="[
@@ -42,7 +42,8 @@
{{ titleLeft }}<van-icon name="question-o" @click="onHelp" />
</div>
<div class="title-right" v-show="currentDays === 0">
<p @click="onHistory">历史监测</p>
<div class="title-right-button" @click="onPsychologicalScale">量表记录</div>
<div class="title-right-button" @click="onHistory">历史监测</div>
</div>
</div>
<!-- 日历 -->
@@ -193,8 +194,8 @@
<!-- 周报菜单 -->
<div class="main report" v-show="current == 3">
<div class="content">
<div class="list" v-if="weekList.length > 0">
<div class="item" v-for="(item, index) in weekList" :key="index" @click="onClickItem(item.recordId)">
<div class="list" v-if="pageType === 0 && weekList.length > 0">
<div class="item" v-for="(item, index) in weekList" :key="index" @click="onClickItem(item)">
<div class="left">
<img :src="weekImg" alt />
<div class="middle">
@@ -203,13 +204,48 @@
<p>{{ item.name }}</p>
</div>
<div class="overall">
<span>总评</span>
<div class="left">
<span>总评</span>
<p :style="{ color: calcResultColor(item.summaryLevel) }">
{{ item.summary }}
</p>
</div>
</div>
</div>
</div>

<div class="right">
<img :src="moreImg" alt />
</div>
</div>
</div>
<div class="list" v-if="pageType === 1 && weekResultList.length > 0">
<div class="item" v-for="(item, index) in weekResultList" :key="index" @click="onClickItem(item[1])">
<div class="left">
<img :src="weekImg" alt />
<div class="middle">
<div class="title">
<span>周报</span>
<p>{{ item[1].name }}</p>
</div>
<div class="overall">
<span>总评</span>
<div class="left">
<p v-for="(su, index) in item[1].summaryDetails" :key="index" :style="{ color: calcResultColor(su.summaryLevel) }">
{{ su.summary }}
</p>
<!-- <p :style="{ color: calcResultColor(item.summaryLevel) }">
{{ item.summary }}
</p>
<p :style="{ color: calcResultColor(item.summaryLevel) }">
{{ item.summary }}
</p>
<p :style="{ color: calcResultColor(item.summaryLevel) }">
{{ item.summary }}
</p> -->
</div>
</div>
<!-- <div class="trend">
<p>( <span>无抑郁倾向</span><span>5%</span>,<span>轻度抑郁倾向</span> <span>5%</span> )</p>
</div>-->
@@ -221,7 +257,7 @@
</div>
</div>
</div>
<div class="list no-data" v-else>
<div class="list no-data" v-if="weekList.length < 1 && weekResultList.length < 1 ">
<img :src="noDataImg" alt />
<p>连续佩戴两周产生对比数据</p>
</div>
@@ -385,9 +421,14 @@ export default {
startDate: "", //接口需要的开始时间
endDate: "", //接口需要的结束时间
currentEmoName: "", //当前情绪名称
weekResultList: [], //周报新详情周报列表
};
},
computed: {
// 页面类型,0 保持不动,1显示方式为新页面显示方式
pageType() {
return Number(this.$route.query.pageType) || 0
},
anxietyText() {
const appTypeList = ['1'];
return appTypeList.indexOf(this.$store.getters.appType) > -1 ? `忧郁` : `抑郁`
@@ -726,19 +767,27 @@ export default {
// 读取路由传过来的参数,根据路由传过来的参数判断是哪种情绪
this.loadParams();
this.initEchartText();
this.getPieData();
/* this.getPieData(); */
this.getCalendarData();
this.getPsychologiclData();
this.getWeekResult();
},
mounted() {
this.initEchart();
this.current = Number(this.$store.getters.tabClick) || 0;
if(this.params.current) {
this.current = Number(this.params.current);
} else {
this.current = Number(this.$store.getters.tabClick) || 0;
}
this.currentDays = this.calcDaysByTabClick(
Number(this.$store.getters.tabClick)
);
this.psyCurrent = this.calcPsyTabindex(EmotionModel[this.params.name].type);
window.document.title = "心理监测";
if(this.pageType === 1) {
this.getWeekResultAny();
}
},
methods: {
loadParams() {
@@ -1271,7 +1320,13 @@ export default {
this.endDate = dateList[1];
} else {
// 周报菜单
this.getWeekResult();
if(this.pageType !== 1) {
this.getWeekResult();
} else {
this.getWeekResultAny();
}
}
},
// 点击情绪tab
@@ -1366,6 +1421,17 @@ export default {
this.echarts = this.$echarts.init(this.$refs.charts);
this.echarts.setOption(this.defaultOptions);
},
// 点击心理量表记录
onPsychologicalScale(){
this.$router.push({
name: "PsychologicalScaleList",
query: {
uid: this.uid,
accessToken: this.$store.getters.ssjlToken,
showLeftArrow:1,
},
});
},
// 点击历史监测,打开日历
onHistory() {
this.calendarDialogShow = true;
@@ -1433,7 +1499,79 @@ export default {
onClose() {
this.isPopup = false;
},
getWeekResult() {
//循环调用3次 GetWeekResult 接口
async getWeekResultAny() {
Promise.all([
await this.getWeekResultPro(1),
await this.getWeekResultPro(2),
await this.getWeekResultPro(3),
]).then(res =>{
let weekResultLists = res.reduce((accumulator, currentValue) => accumulator.concat(currentValue), [])
let typeMap = {};
weekResultLists.forEach(item => {
if (!typeMap[item.name]) {
typeMap[item.name] = {
name: item.name,
recordId: [],
summary: [],
summaryLevel: [],
summaryDetails: [],
type: item.type,
};
weekResultLists.push(typeMap[item.name]);
}
typeMap[item.name].recordId.push(item.recordId);
typeMap[item.name].summary.push(item.summary);
typeMap[item.name].summaryLevel.push(item.summaryLevel);
let combinedArray = typeMap[item.name].summary.map((sum, index) => ({summary: sum, summaryLevel: typeMap[item.name].summaryLevel[index]}));
console.log(combinedArray);
typeMap[item.name].summaryDetails = combinedArray
});
let array = Object.entries(typeMap);
this.weekResultList = array.reverse();
console.log("weekResultLists", this.weekResultList);
console.log("typeMap", typeMap);
});
},
getWeekResultPro(type) {
let baseUrl =
process.env.NODE_ENV === "production"
? "https://dbmq.rzliot.com/auth_heart"
: "https://dbmq.rzliot.com/heart";
let reqUrl = `${baseUrl}/api/Data/GetWeekResult`;
let reqParams = {
uid: this.uid /* '1929285069986332672' */,
type: type || this.emoType,
};
return new Promise(resolve => {
axios
.get(reqUrl, {
params: { ...reqParams },
/* headers: { 'AccessToken': this.$store.getters.ssjlToken } */
}).then(res => {
const data = res.data.response;
let summaryList = data.map(item => {
return {
name: item.Name.replace("周报", "")
.replace(/-/g, ".")
.replace(/~/g, "-"),
recordId: item.RecordId,
summary: this.$replaceAll(item.Summary, '抑郁', '忧郁'),
summaryLevel: item.SummaryLevel,
type: item.Type,
};
});
resolve(summaryList)
})
})
},
getWeekResult(type) {
this.$toast.loading("数据加载中");
let baseUrl =
process.env.NODE_ENV === "production"
@@ -1441,7 +1579,7 @@ export default {
: "https://dbmq.rzliot.com/heart";
let reqUrl = `${baseUrl}/api/Data/GetWeekResult`;
let reqParams = {
uid: this.uid /* '2023101521270090082 */,
uid: this.uid /* '1929285069986332672' */,
type: this.emoType,
};
axios
@@ -1468,16 +1606,33 @@ export default {
this.$toast.success("数据加载完成");
});
},
onClickItem(recordId) {
this.$router.push({
name: "psychologicalReport",
query: {
recordId: recordId,
name: this.currentEmoName,
isShowLeft: true,
uid: this.uid,
},
});
onClickItem(item) {
if(this.pageType === 1) {
// 跳转去新的周报详情页
this.$router.push({
name: "reportDetails",
query: {
recordId: item.recordId[Number(this.psyCurrent) - 1],
name: this.currentEmoName,
isShowLeft: true,
uid: this.uid,
time: item.name,
current: 3,

},
});
} else {
this.$router.push({
name: "psychologicalReport",
query: {
recordId: item.recordId,
name: this.currentEmoName,
isShowLeft: true,
uid: this.uid,
},
});
}
},
},
};


+ 339
- 0
src/views/health/psychological/reportDetails/index.scss View File

@@ -0,0 +1,339 @@
.main-details {
height: 100vh;
width: 100%;
overflow: hidden;
background-color: #F5F5F5;
font-family: Source Han Sans CN;

.report-details {
height: calc(100vh - 88px);
overflow: scroll;
background-color: #fff;

.line {
height: 11px;
background-color: $lineGray;
}

.overall-rating {
padding: 23px 15px;
margin-bottom: 9px;

.con {
padding: 17px 18px;
display: flex;
justify-content: flex-start;
align-items: flex-start;
flex-direction: column;
font-size: 14px;
background: #FFFFFF;
border: 1px solid #535353;
box-shadow: 4px 5px 0px 0px #638EE4;
border-radius: 5px;

p {
font-size: 18px;
font-family: Source Han Sans CN;
color: #666666;

.bold {
color: #282828;
font-weight: bold;
}
}

.space-between {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;

.time {
font-size: 12px;
}
}

.normal {
font-size: 13px;
line-height: 21px;
text-align: left;
color: #666666;
}

.bold-pro {
color: #282828;
font-size: 24px;
font-weight: bold;
padding: 12px 0;
}
}
}

.pie-chart-top {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 23px 15px 16px 15px;

p {
font-size: 12px;
font-family: Source Han Sans CN;
line-height: 21px;
}

.bold {
font-size: 18px;
font-weight: bold;
color: #282828;
line-height: 18px;
}
}

.count {
padding: 0 15px 5px 15px;
text-align: left;

p {
font-size: 12px;
font-family: Source Han Sans CN;
font-weight: 400;
color: #8B8B8B;
line-height: 18px;
}
}

.pie-chart-con {
flex: 1;
padding: 5px 0 10px 0;
display: flex;
justify-content: space-between;
align-items: flex-start;
background-color: #fff;

.pie-chart-left {
position: relative;
height: 150px;
padding-left: 15px;
width: 35%;
@include center();

#pieChart {
height: 106px;
width: 106px;
}
#pieChartDay {
height: 106px;
width: 106px;
}
}

.pie-chart-right {
height: 150px;
width: 65%;
@include center();

.list {
display: flex;
justify-content: center;
flex-direction: column;
.item {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
padding: 9px 0;
.item-left {
display: flex;
justify-content: flex-start;
align-items: center;
padding-right: 10px;

.circle {
height: 12px;
width: 12px;
margin: 0 4px;
}

span {
font-size: 12px;
}

.text {
color: #000;
font-size: 12px;
}
}

.item-right {
@include center();
span {
font-size: 12px;
}
}
.status {
padding: 0 5px;
@include center();
img {
height: 15px;
width: 9px;
padding: 0 3px ;
}
}
}
}
}
}

.statistics {
position: relative;
padding: 5px 14px 5px 14px;
.list {
flex: 1;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 16px;

.item {
@include center();
width: 58px;
/* height: px2rem(136); */
flex-direction: column;

.top {
font-size: 12px;
}

.middle {
font-size: 24px;
font-weight: bold;
padding: 5px;
}

.bottom {
font-size: 9px
}
}
}
}

.bar-chart {
height: 350px;
background-color: #fff;
padding: 0 5px;

.echart {
height: 350px;
padding: 0 5px;
}
}

.advice {
padding: 26px 15px 30px 15px;

.content {
background: #F2F6FF;
border-radius: 10px;
padding: 20px 15px;
text-align: left;

p {
font-size: 15px;
font-weight: 400;
color: #707070;
line-height: 23px;
}

.title {
font-size: 18px;
font-weight: bold;
color: #638EE4;
line-height: 18px;
padding-bottom: 13px;
}
}
}

.overview {
padding: 0 15px 16px 15px;

.content {
.title {
text-align: left;

.title-text {
font-size: 18px;
font-weight: bold;
color: #282828;
line-height: 18px;
}

.mood-list {
display: grid;
grid-template-columns: repeat(2, 1fr); //定义了一个 2x2 的网格布
grid-template-rows: repeat(2, 1fr);
gap: 21px;
padding: 21px 21px 22px 20px;

.item {
width: 107px;
height: 94px;
background-color: #F2F6FF;
display: flex;
justify-content: center;
align-items: flex-start;
flex-direction: column;
padding-left: 30px;

p {
font-size: 14px;
padding: 0;
color: #666666;
@include center();
/* align-items: flex-end; */
.day {
/* padding: 5px; */
font-size: 28px;
}

.day-text {
font-size: 12px;
padding: 0 5px;
}
img {
height: 15px;
width: 9px;
}
}
}
}
}
}
}
&.no-data {
@include center();
flex-direction: column;
p {
font-size: 16px;
}
}
}
}

.hideNav{
.report-details{
height: calc(100vh - 44px);
}
}
.hideTab{
.report-details{
height: calc(100vh - 44px);
}
}
.hideNavTab{
.report-details{
height: 100vh;
}
}

+ 2249
- 0
src/views/health/psychological/reportDetails/index.vue
File diff suppressed because it is too large
View File


+ 16
- 1
src/views/psychological-modeling/index.vue View File

@@ -185,7 +185,22 @@ export default {
}
},
toQuestion() {
this.$router.replace(`/PsychologicalQuestionnaire?uid=${this.uid}`);
// this.$router.replace(`/PsychologicalQuestionnaire?uid=${this.uid}`);

// 2024.08.15 问卷填写变更为心理量表
this.$router.replace({
name: 'PsychologicalScale',
query: {
uid: this.uid,
accessToken: this.$store.getters.ssjlToken,
showLeftArrow: this.showLeftArrow,
isModel: true,
// 其他参数也一起传递
fromSsjl:this.$store.getters.fromSsjl,
fromUrl:this.$store.getters.fromUrl,
fromMenu:this.$store.getters.fromMenu,
},
})
},
api(url, config, token) {
let baseUrl =


+ 336
- 0
src/views/psychological-scale/detail.vue View File

@@ -0,0 +1,336 @@
<template>
<div
class="psychologicalScale-detail"
:style="`padding-top: ${showLeftArrow ? '10vw' : '0'};`"
>
<van-nav-bar
title="测评结果"
:border="true"
:left-arrow="true"
@click-left="onNavBack"
v-if="showLeftArrow"
style="position: fixed; left: 0; top: 0; width: 100vw"
>
<template #left>
<van-icon name="arrow-left" size="23" style="padding: 0" />返回
</template>
</van-nav-bar>
<div class="content">
<div class="result-title">您的测评结果为:</div>
<div class="result" :style="{ color: levels[`${resultLevel}`].color }">
{{ levels[`${resultLevel}`].title }}
</div>
<div class="result-label">
<span>您的焦虑得分:</span>
<div
class="result-color"
:style="{ background: levels[`${resultLevel}`].color }"
></div>
</div>
<div class="result-details">
<div
class="result-details-item"
v-for="(item, index) in showLevels"
:key="index"
:style="{ width: `${100 / showLevels.length}%` }"
>
<div
class="result-details-item-icon"
:style="{ background: item.color }"
></div>
<div
class="result-details-item-title"
:style="{
color: resultLevel == index + 1 ? 'black' : 'gray',
}"
>
{{ item.title }}
</div>
</div>
</div>
<div class="result-label">总体评分:</div>
<div class="result-content">{{ result.Explain }}</div>
<div class="result-label">结果解释:</div>
<div class="result-content">{{ result.Advice }}</div>
</div>
</div>
</template>

<script>
import axios from 'axios'
import APICore from '@/api/core'

export default {
name: 'PsychologicalScaleDetail',
data() {
return {
id: '',
uid: '',
showLeftArrow: false,
fromSsjl: this.$store.getters.fromSsjl,
result: {
Advice: '',
Explain: '',
ScaleName: '',
Score: 15,
Summary: '',
SummaryLevel: '-1',
Time: '',
},
levels: [
{
show: false,
color: '#dfe4ea',
title: '暂无测评结果',
},
{
color: '#60B977',
title: '没有抑郁症状',
},
{
color: '#FFB600',
title: '轻度抑郁',
},
{
color: '#CC0003',
title: '重度抑郁',
},
],
}
},
computed: {
resultLevel() {
return parseInt(this.result.SummaryLevel) + 1
},
showLevels() {
return this.levels.filter((item) => {
if (!(item.show === false)) {
return true
}
})
},
},
watch: {},
mounted() {
//页面标题
window.document.title = '测评结果'

//页面传参
let params = { ...this.$route.query }

if (params.id && params.uid) {
this.id = params.id
this.uid = params.uid

// 缓存从随手精灵传过来的token
this.$store.commit('ssjlToken', params.accessToken || '')
if (params.appType) {
this.$store.commit('appType', params.appType)
}
// 缓存从随手精灵传过来的标识
if (params.fromSsjl) {
this.$store.commit('fromSsjl', params.fromSsjl)
}
// 是否显示 返回标签
if (params.showLeftArrow) {
this.showLeftArrow = true
}
this.fromUrl = params.fromUrl
console.log('fromUrl', this.fromUrl)

//初始化
this.init()
} else {
this.$toast('参数错误')
}
},
methods: {
async init() {
if (!this.$route.query.accessToken) {
// 如果当前url没有 accessToken, 获取token,并且存储到本地缓存里面
let authToken = await this.getAuth()
this.$store.commit('ssjlToken', authToken)
}

this.$toast.loading({
message: '',
forbidClick: true,
duration: 0,
})

let re = await this.api(
'/api/Question/GetScaleFillingRecord',
{
method: 'GET',
sslVerify: false,
withCredentials: false,
params: {
uid: this.uid,
},
},
this.$store.getters.ssjlToken
)
if (re.success) {
if (re.response && re.response.length) {
re.response.forEach((item) => {
if (item.Id === this.id) {
this.result = item
}
})
} else {
// this.$toast('暂无测评结果')
}
} else {
this.$toast(re.msg)
}
},
onNavBack() {
let fromSsjl = this.$store.getters.fromSsjl === 'true'
if (fromSsjl) {
let baseUrl = this.fromUrl
window.location.href = `${baseUrl}/#/${
this.$route.query.fromMenu || 'device'
}`
} else {
window.history.go(-1)
}
},
// 获取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('')
}
})
})
},
api(url, config, token) {
setTimeout(() => {
this.$toast.loading({
message: '',
forbidClick: true,
duration: 1500,
})
}, 100)
let baseUrl =
process.env.NODE_ENV === 'production'
? 'https://dbmq.rzliot.com/auth_heart'
: 'https://dbmq.rzliot.com/heart'
return new Promise((res) => {
axios({
url: `${baseUrl}${url}`,
...config,
// 增加请求头部 token
headers: {
AccessToken: token,
},
})
.then((re) => {
if (re) {
if (re.data) {
console.log(re.data)
res(re.data)
this.$toast.clear()
return
}
this.$toast(`信息获取失败-${re.status}`)
res(true)
this.$toast.clear()
return
}
this.$toast(`信息获取失败-${url}`)
res(true)
this.$toast.clear()
})
.catch((e) => {
this.$toast(`信息获取失败-${url}`)
res(true)
this.$toast.clear()
console.log(e)
})
})
},
},
}
</script>

<style lang="scss">
.psychologicalScale-detail {
width: 100vw;
min-height: 100vh;
box-sizing: border-box;
font-size: 3.6vw;
text-align: left;
background: #f4f4f4;
padding-bottom: 8vw;

.van-nav-bar__content {
height: 10vw !important;

.van-nav-bar__left,
.van-nav-bar__title {
font-size: 4vw !important;
line-height: initial !important;

.van-icon-arrow-left {
font-size: 4vw !important;
}
}
}

.content {
padding: 4vw;

.result-title {
font-size: 4vw;
text-align: center;
}
.result {
font-size: 6vw;
text-align: center;
font-weight: bold;
margin-top: 4vw;
}
.result-label {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 4.5vw;
font-weight: bold;
margin-top: 6vw;
}
.result-color {
width: 5.5vw;
height: 5.5vw;
border-radius: 1vw;
}
.result-details {
display: flex;
margin-top: 4vw;

.result-details-item {
.result-details-item-icon {
width: 100%;
height: 5.5vw;
}
.result-details-item-title {
font-weight: bold;
text-align: center;
margin-top: 2vw;
}
}
}
.result-content {
font-size: 3.6vw;
margin-top: 2vw;
}
}
}
</style>

+ 575
- 0
src/views/psychological-scale/index.vue View File

@@ -0,0 +1,575 @@
<template>
<div
class="psychologicalScale-index"
v-if="topic.length"
:style="`padding-top: ${tip?'10vw':showLeftArrow ? '34vw' : '24vw'};`"
>
<van-nav-bar
title="测评"
:border="true"
:left-arrow="true"
@click-left="onNavBack"
v-if="showLeftArrow"
style="position: fixed; left: 0; top: 0; width: 100vw; height: 10vw"
>
<template #left>
<van-icon name="arrow-left" size="23" style="padding: 0" />返回
</template>
</van-nav-bar>
<div class="tip" v-if="tip">
<div class="tip-title title">{{ title }}</div>
<div class="tip-title">测评说明:</div>
<div class="tip-content">
请仔细阅读每一道题,根据根据您自己的
真实状态,评估最近7天内你最接近的感觉,而不只是你今天的感觉
</div>
<div class="tip-title">注意事项:</div>
<div class="tip-content">
题目共10题,选项无对错之分,不用过度思考,根据第一反应选择则可。
</div>
<div class="tip-content">
该测评结果仅供参考,不能以此作相关诊断。如有疑问,请咨询专业人员。
</div>
<div class="button">
<van-button
round
type="info"
style="width: 100%; height: 100%"
@click="tip = false"
>开始测评</van-button
>
</div>
</div>
<div class="" v-else>
<div class="top" :style="`top: ${showLeftArrow ? '10vw' : '0'};`">
<div class="schedule">
<div class="progress">
<van-progress
:percentage="
(select.length == 0 ? 0 : select.length / topic.length) * 100
"
stroke-width="10px"
color="#638ee4"
:show-pivot="false"
v-if="topic.length"
></van-progress>
</div>
<div class="text">
<span class="val">{{ select.length }}</span
>/<span class="total">{{ topic.length }}</span>
</div>
</div>
<div class="title">{{ title }}</div>
</div>
<div class="list_box">
<div class="item" v-for="(item, index) in topic" :key="index">
<div
:class="[
'label',
{
error:
(isError && fromSsjl && item.Id == '6') ||
(isError && fromSsjl && item.Id == '8') ||
(isError && fromSsjl && item.Id == '11'),
},
]"
>
<span>{{ item.Title }}</span>
<span>({{ item.Type }})</span>
</div>
<van-radio-group
class="radio"
v-model="item.select"
v-if="item.Type == '单选题'"
>
<van-cell-group>
<van-cell
clickable
v-for="(ite, idx) in item.Option"
:key="idx"
:title="ite.label"
@click="onRadio(index, ite.value)"
:title-class="[
{
cellTitle:
(isError && fromSsjl && item.Id == '6') ||
(isError && fromSsjl && item.Id == '8') ||
(isError && fromSsjl && item.Id == '11'),
},
]"
>
<template #right-icon>
<van-radio :name="ite.value" />
</template>
</van-cell>
</van-cell-group>
</van-radio-group>
<van-checkbox-group class="checkbox" v-model="item.select" v-else>
<van-cell-group>
<van-cell
v-for="(ite, idx) in item.Option"
clickable
:key="idx"
:title="ite.label"
@click="onCheckbox(`checkboxes${item.Id}`, idx)"
>
<template #right-icon>
<van-checkbox
:name="ite.value"
:ref="`checkboxes${item.Id}`"
/>
</template>
</van-cell>
</van-cell-group>
</van-checkbox-group>
</div>
</div>
<div class="button">
<van-button
round
type="info"
:disabled="topic.length != select.length"
style="width: 100%; height: 100%"
@click="submit"
>提交测评</van-button
>
</div>
</div>
</div>
</template>

<script>
import axios from 'axios'
import APICore from '@/api/core'

export default {
name: 'PsychologicalScale',
data() {
return {
uid: '',
keyCode: '',
title: '',
tip: true,
topic: [], //题目列表
select: [],
isError: null, //是否是答题错误
fromSsjl: this.$store.getters.fromSsjl,
showLeftArrow: false,
isModel: false,
}
},
mounted() {
//页面标题
window.document.title = '测评'

//页面传参
let params = { ...this.$route.query }

if (params.uid) {
this.uid = params.uid

// 缓存从随手精灵传过来的token
this.$store.commit('ssjlToken', params.accessToken || '')
if (params.appType) {
this.$store.commit('appType', params.appType)
}
// 缓存从随手精灵传过来的标识
this.$store.commit('fromSsjl', params.fromSsjl)
// 是否显示 返回标签
if (params.showLeftArrow) {
this.showLeftArrow = true
}
this.fromUrl = params.fromUrl
console.log('fromUrl', this.fromUrl)

// 是否从建模页过来
if (params.isModel) {
this.isModel = true
}

//初始化
this.init()
} else {
this.$toast('参数错误')
}
},
watch: {
selects(val) {
let temp = JSON.parse(val)
let tempt = temp.filter((item) => {
if (item.select >= 0) {
return true
}
})
this.select = tempt
},
},
computed: {
selects() {
return JSON.stringify(this.topic)
},
},
methods: {
async init() {
if (!this.$route.query.accessToken) {
// 如果当前url没有 accessToken, 获取token,并且存储到本地缓存里面
let authToken = await this.getAuth()
this.$store.commit('ssjlToken', authToken)
}

let re = await this.api(
'/api/Question/GetScaleQuestion',
{
method: 'GET',
sslVerify: false,
withCredentials: false,
params: {
// uid: this.uid,
code: 'EPDS',
},
},
this.$store.getters.ssjlToken
)
if (re.success) {
if (
re.response &&
re.response.ScaleQuestionDetails &&
re.response.ScaleQuestionDetails.length
) {
let code = re.response.Code
this.title = re.response.Name
this.keyCode = re.response.Code

let temp = re.response.ScaleQuestionDetails

let topic = []
temp.forEach((item) => {
let tempt = { ...item }
if (!tempt.Type) {
tempt.Type = '单选题'
}
let a1 = tempt.Option.split('&')
let option = []
for (let index = 0; index < a1.length; index++) {
option.push({
label: a1[index],
value: index,
})
}
tempt.Option = option
tempt.value = ''
topic.push(tempt)
})

this.topic = topic
} else {
this.$toast('问卷不存在')
}
} else {
this.$toast(re.msg)
}
},
async submit() {
let temp = {
uid: this.uid, //客户端系统用户id
keyCode: this.keyCode, //问卷编号
answer: [],
}
this.topic.forEach((item) => {
temp.answer.push({
qid: item.Id, //问卷题目编号
value:
typeof item.select == 'object'
? item.select.join(',')
: item.select, //用户所选答案的 id
})
})
let re = await this.api(
'/api/Question/ScaleRsults',
{
method: 'POST',
sslVerify: false,
withCredentials: false,
data: temp,
},
this.$store.getters.ssjlToken
)
if (re.success && re.response) {
this.$toast('问卷提交成功', 3000)
this.isError = false
setTimeout(() => {
let fromSsjl = this.$store.getters.fromSsjl === 'true'
if (fromSsjl) {
// c端跳转按c端返回逻辑处理
this.onNavBack()
} else if (this.isModel) {
// 建模页跳转过来的要回建模页
this.$router.replace({
name: 'PsychologicalModeling',
query: {
uid: this.uid,
},
})
} else {
this.$router.replace({
name: 'PsychologicalScaleDetail',
query: {
id: re.response.Id,
uid: this.uid,
accessToken: this.$store.getters.ssjlToken,
showLeftArrow: this.showLeftArrow,
},
})
}
}, 3000)
} else {
//this.$toast(re.msg);
this.$dialog.confirm({
message: re.msg,
showCancelButton: false,
})
this.isError = true
}
},
onRadio(index, value) {
let temp = { ...this.topic[index] }
temp.select = value
this.$set(this.topic, index, temp)
},
onCheckbox(key, index) {
try {
this.$refs[`${key}`][index].toggle()
} catch (error) {
console.log(error)
}
},
onNavBack() {
let fromSsjl = this.$store.getters.fromSsjl === 'true'
if (fromSsjl) {
let baseUrl = this.fromUrl
window.location.href = `${baseUrl}/#/${
this.$route.query.fromMenu || 'device'
}`
} else {
window.history.go(-1)
}
},
// 获取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('')
}
})
})
},
api(url, config, token) {
setTimeout(() => {
this.$toast.loading({
message: '',
forbidClick: true,
duration: 1500,
})
}, 100)
let baseUrl =
process.env.NODE_ENV === 'production'
? 'https://dbmq.rzliot.com/auth_heart'
: 'https://dbmq.rzliot.com/heart'
return new Promise((res) => {
axios({
url: `${baseUrl}${url}`,
...config,
// 增加请求头部 token
headers: {
AccessToken: token,
},
})
.then((re) => {
if (re) {
if (re.data) {
console.log(re.data)
res(re.data)
this.$toast.clear()
return
}
this.$toast(`信息获取失败-${re.status}`)
res(true)
this.$toast.clear()
return
}
this.$toast(`信息获取失败-${url}`)
res(true)
this.$toast.clear()
})
.catch((e) => {
this.$toast(`信息获取失败-${url}`)
res(true)
this.$toast.clear()
console.log(e)
})
})
},
},
}
</script>

<style lang="scss">
.psychologicalScale-index {
width: 100vw;
min-height: 100vh;
box-sizing: border-box;
font-size: 3.6vw;
text-align: left;
background: #f4f4f4;
padding-bottom: 8vw;
padding-top: 24vw;

.van-nav-bar__content {
height: 10vw !important;

.van-nav-bar__left,
.van-nav-bar__title {
font-size: 4vw !important;
line-height: initial !important;

.van-icon-arrow-left {
font-size: 4vw !important;
}
}
}

.tip{
width: 90vw;
margin: 0 auto;
margin-top: 5vw;
padding: 10vw 3vw;
border-radius: 2vw;
background: white;

.tip-title{
font-size: 4vw;
font-weight: bold;
margin-top: 5vw;
margin-bottom: 5vw;
}

.title{
font-size: 4.5vw;
text-align: center;
margin-top: 0;
}

.tip-content{
font-size: 3.7vw;
text-indent: 5vw;
margin-bottom: 2vw;

&:last-child{
margin-bottom: 0;
}
}
.button{
position: fixed;
left: 0;
right: 0;
bottom: 10vw;
margin: auto;
}
}

.top {
box-sizing: border-box;
position: fixed;
top: 0;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 3vw;
width: 100vw;
height: 24vw;
background: white;
z-index: 99;

.schedule {
display: flex;
align-items: center;

.progress {
width: 85%;
}
.text {
width: 15%;
font-size: 4.5vw;
text-align: center;

.val {
font-size: 5vw;
font-weight: bold;
}
}
}
.title {
color: #638ee4;
}
}

.list_box {
width: 100%;
margin-top: 3vw;

.item {
margin-top: 3vw;
padding: 3vw;
background: white;

.label {
font-size: 4vw;
// &.error {
// color: red;
// }
}
.van-cell {
line-height: initial !important;
padding: 3vw 2vw;

.van-cell__title {
font-size: 3.5vw !important;

// &.cellTitle {
// color: red;
// }
}
.van-radio__icon {
height: 100% !important;

.van-icon {
font-size: 3.5vw !important;
}
}
}
}
}

.button {
width: 75vw;
height: 14vw;
margin: 0 auto;
margin-top: 8vw;

.van-button {
font-size: 4vw !important;
}
.van-button--info {
background-color: #638ee4;
border: 1px solid #638ee4;
}
}
}
</style>

+ 358
- 0
src/views/psychological-scale/list.vue View File

@@ -0,0 +1,358 @@
<template>
<div class="psychologicalScale-list"
:style="`padding-top: ${showLeftArrow ? '10vw' : '0'};`">
<van-nav-bar
title="测评记录"
:border="true"
:left-arrow="true"
@click-left="onNavBack"
v-if="showLeftArrow"
style="position: fixed; left: 0; top: 0;width: 100vw;"
>
<template #left>
<van-icon name="arrow-left" size="23" style="padding: 0" />返回
</template>
</van-nav-bar>
<div class="content" v-if="result.length">
<div
class="item"
v-for="(item, index) in result"
:key="index"
@click="toDetail(item)"
>
<div class="left">
<div class="name">{{ item.ScaleName }}</div>
<div class="result">
<span>评测结果:</span>
<span>{{ item.Summary }}</span>
</div>
<div class="time">
{{ formateDate('yyyy年mm月dd日 HH:MM', item.Time) }}
</div>
</div>
<div class="right">
<div class="button">查看结果</div>
</div>
</div>
</div>
<div class="blank" v-else>暂无测评记录</div>
</div>
</template>

<script>
import axios from 'axios'
import APICore from '@/api/core'

export default {
name: 'PsychologicalScaleList',
data() {
return {
uid: '',
isError: null, //是否是答题错误
showLeftArrow: false,
fromSsjl: this.$store.getters.fromSsjl,
result: [],
}
},
computed: {
},
watch: {},
mounted() {
//页面标题
window.document.title = '测评记录'

//页面传参
let params = { ...this.$route.query }

if (params.uid) {
this.uid = params.uid

// 缓存从随手精灵传过来的token
this.$store.commit('ssjlToken', params.accessToken || '')
if (params.appType) {
this.$store.commit('appType', params.appType)
}
// 缓存从随手精灵传过来的标识
this.$store.commit('fromSsjl', params.fromSsjl)
// 是否显示 返回标签
if (params.showLeftArrow) {
this.showLeftArrow = true
}
this.fromUrl = params.fromUrl
console.log('fromUrl', this.fromUrl)

//初始化
this.init()
} else {
this.$toast('参数错误')
}
},
methods: {
async init() {
if (!this.$route.query.accessToken) {
// 如果当前url没有 accessToken, 获取token,并且存储到本地缓存里面
let authToken = await this.getAuth()
this.$store.commit('ssjlToken', authToken)
}

this.$toast.loading({
message: '',
forbidClick: true,
duration: 0,
})

let re = await this.api(
'/api/Question/GetScaleFillingRecord',
{
method: 'GET',
sslVerify: false,
withCredentials: false,
params: {
uid: this.uid,
},
},
this.$store.getters.ssjlToken
)
if (re.success) {
if (re.response && re.response.length) {
this.result = re.response
} else {
// this.$toast('暂无测评结果')
}
} else {
this.$toast(re.msg)
}
},
toDetail(item) {
this.$router.push({
name: 'PsychologicalScaleDetail',
query: {
id: item.Id,
uid: this.uid,
accessToken: this.$store.getters.ssjlToken,
showLeftArrow: 1,
},
})
},
onNavBack() {
let fromSsjl = this.$store.getters.fromSsjl === 'true'
if (fromSsjl) {
let baseUrl = this.fromUrl
window.location.href = `${baseUrl}/#/${
this.$route.query.fromMenu || 'device'
}`
} else {
window.history.go(-1)
}
},
// 获取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('')
}
})
})
},
api(url, config, token) {
setTimeout(() => {
this.$toast.loading({
message: '',
forbidClick: true,
duration: 1500,
})
}, 100)
let baseUrl =
process.env.NODE_ENV === 'production'
? 'https://dbmq.rzliot.com/auth_heart'
: 'https://dbmq.rzliot.com/heart'
return new Promise((res) => {
axios({
url: `${baseUrl}${url}`,
...config,
// 增加请求头部 token
headers: {
AccessToken: token,
},
})
.then((re) => {
if (re) {
if (re.data) {
console.log(re.data)
res(re.data)
this.$toast.clear()
return
}
this.$toast(`信息获取失败-${re.status}`)
res(true)
this.$toast.clear()
return
}
this.$toast(`信息获取失败-${url}`)
res(true)
this.$toast.clear()
})
.catch((e) => {
this.$toast(`信息获取失败-${url}`)
res(true)
this.$toast.clear()
console.log(e)
})
})
},
formateDate(fmt = 'yyyy-mm-dd', date = '') {
if (!date) {
date = new Date()
}

try {
if (typeof date == 'string') {
date = date.replace(/-/g, '/').replace(/T/g, ' ')
if (date.indexOf('/') == -1) {
date = new Date(parseFloat(date))
}
date = new Date(date)
} else if (typeof date == 'number') {
date = new Date(date)
}
} catch (error) {
console.log('时间格式化出错', error)
date = new Date()
}

let ret
let weak = (function (date) {
let days = date.getDay()
let weekArrTxt = [
'星期天',
'星期一',
'星期二',
'星期三',
'星期四',
'星期五',
'星期六',
]
let weekArrTxt2 = [
'周日',
'周一',
'周二',
'周三',
'周四',
'周五',
'周六',
]
return [weekArrTxt[days], weekArrTxt2[days]]
})(date)
const opt = {
'y+': date.getFullYear().toString(), // 年
'm+': (date.getMonth() + 1).toString(), // 月
'd+': date.getDate().toString(), // 日
'H+': date.getHours().toString(), // 时
'M+': date.getMinutes().toString(), // 分
'S+': date.getSeconds().toString(), // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
'W+': weak[0],
'w+': weak[1],
}
for (let k in opt) {
ret = new RegExp('(' + k + ')').exec(fmt)
if (ret) {
fmt = fmt.replace(
ret[1],
ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
)
}
}
return fmt
},
},
}
</script>

<style lang="scss">
.psychologicalScale-list {
width: 100vw;
min-height: 100vh;
box-sizing: border-box;
font-size: 3.6vw;
text-align: left;
background: #f4f4f4;
padding-bottom: 8vw;

.van-nav-bar__content {
height: 10vw !important;

.van-nav-bar__left,
.van-nav-bar__title {
font-size: 4vw !important;
line-height: initial !important;

.van-icon-arrow-left {
font-size: 4vw !important;
}
}
}

.content {
padding: 2vw;

.item {
display: flex;
align-items: flex-end;
justify-content: space-between;
padding: 4vw;
margin-top: 2vw;
border-radius: 1vw;
background: white;

.left{

.name{
font-size: 4vw;
font-weight: bold;
}
.time{
color: gray;
margin-top: 4vw;
}
.result{
font-size: 3.8vw;
margin-top: 4vw;
}
}
.right{

.button{
color: #15C6BE;
padding: 2vw 3vw;
border-radius: 8vw;
border: 1px solid #15C6BE;

&:active{
background-color: rgba($color: #15C6BE, $alpha: 0.1);
}
}
}
}
}

.blank {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 80vh;
color: gray;
font-size: 5vw;
font-weight: bold;
letter-spacing: 5px;
}
}
</style>

Loading…
Cancel
Save