Преглед изворни кода

update

- 心理监测详情
    - 增加 7天 和 30天数据查看功能
    - 优化 页面样式内容
    - 增加 返回到随手精灵逻辑
master
JinxChen пре 1 година
родитељ
комит
f0c300d1be
7 измењених фајлова са 186 додато и 55 уклоњено
  1. +10
    -2
      README.md
  2. +1
    -1
      src/config/models.js
  3. +6
    -0
      src/views/health/psychological-main/index.scss
  4. +20
    -2
      src/views/health/psychological-main/index.vue
  5. +5
    -5
      src/views/health/psychological/index.scss
  6. +127
    -39
      src/views/health/psychological/index.vue
  7. +17
    -6
      src/views/psychological-modeling/index.vue

+ 10
- 2
README.md Прегледај датотеку

@@ -1,7 +1,7 @@
<!--
* @Date: 2022-08-17 16:19:13
* @LastEditors: JinxChen
* @LastEditTime: 2023-06-21 16:31:04
* @LastEditTime: 2023-06-25 16:08:26
* @FilePath: \TelpoH5FrontendWeb\README.md
* @description: 项目说明
-->
@@ -526,4 +526,12 @@ update
update
- 心理监测详情
- 今天趋势饼状图
- 修改 百分比显示值,取小数点后面一位
- 修改 百分比显示值,取小数点后面一位

## v1.0.66
`2023.6.25`
update
- 心理监测详情
- 增加 7天 和 30天数据查看功能
- 优化 页面样式内容
- 增加 返回到随手精灵逻辑

+ 1
- 1
src/config/models.js Прегледај датотеку

@@ -5,7 +5,7 @@
* @FilePath: \TelpoH5FrontendWeb\src\config\models.js
* @description:
*/
export const VERSION_MODEL = '1.0.65F'; //版本号
export const VERSION_MODEL = '1.0.66F'; //版本号
export const IMAGE_URL = {
production: 'http://zfb.ssjlai.com/web/',
test: 'http://zfb.ssjlai.com/web/',


+ 6
- 0
src/views/health/psychological-main/index.scss Прегледај датотеку

@@ -3,6 +3,12 @@
width: 100%;
overflow: hidden;
background-color: #F4F8FB;
.nav-bar-title {
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.main {
height: calc(100vh - 45px);
background-color: #F4F8FB;


+ 20
- 2
src/views/health/psychological-main/index.vue Прегледај датотеку

@@ -1,6 +1,15 @@
<template>
<div class="psychological-main-container">
<van-nav-bar title="今日情绪" :border="true" :left-arrow="false" @click-left="onNavBack"></van-nav-bar>
<van-nav-bar title="今日情绪" :border="true" @click-left="onNavBack">
<template #left>
<div v-show="isShowLeft" class="nav-bar-title">
<van-icon name="arrow-left" size="23"/><span>返回</span>
</div>
</template>
<template #title>
<span>今日情绪</span>
</template>
</van-nav-bar>
<div class="main">
<div class="list">
<div v-for="(item,index) in healhtList" :key="index" :class="['item', item.class]" @click="onClick(item)">
@@ -46,6 +55,11 @@ export default {

}
},
computed: {
isShowLeft() {
return this.$route.query.fromUrl !== undefined;
}
},
created() {
this.loadParams();
this.getHomeData();
@@ -96,7 +110,11 @@ export default {
})
},
onNavBack() {
this.$router.go(-1);
if(this.isShowLeft && this.$route.query.fromUrl !== undefined) {
window.location.href = `${this.$route.query.fromUrl}/#/device`;
} else {
this.$router.go(-1);
}
},
// 计算表情
calcImg(level) {


+ 5
- 5
src/views/health/psychological/index.scss Прегледај датотеку

@@ -11,7 +11,7 @@ $newBlue: #638EE4;
flex: 1;

.tab-bar {
padding: 23px 13px 0 13px;
padding: 0 13px 0 13px;
.date-tab-con {
padding: 10px 0;
height: 35px;
@@ -57,7 +57,7 @@ $newBlue: #638EE4;
display: flex;
justify-content: space-between;
align-items: center;
padding: 27px 16px 16px 13px;
padding: 16px 16px 16px 13px;
font-size: 18px;
.title-left {
font-weight: bold;
@@ -81,7 +81,7 @@ $newBlue: #638EE4;
.pie-chart-left {
position: relative;
height: 180px;
padding-left: 23px;
padding-left: 15px;
width: 40%;
@include center();
#pieChart {
@@ -122,7 +122,7 @@ $newBlue: #638EE4;
}
.item-right {
display: flex;
justify-content: flex-end;
justify-content: center;
align-items: center;
}
}
@@ -131,7 +131,7 @@ $newBlue: #638EE4;
}
.statistics {
position: relative;
padding: 0 12px 36px 36px;
padding: 10px 14px;
.list {
flex: 1;
width: 100%;


+ 127
- 39
src/views/health/psychological/index.vue Прегледај датотеку

@@ -1,6 +1,10 @@
<template>
<div class="psychological-container">
<van-nav-bar :title="emoName + '监测'" :border="true" :left-arrow="true" @click-left="onNavBack"></van-nav-bar>
<van-nav-bar :title="emoName + '监测'" :border="true" :left-arrow="true" @click-left="onNavBack">
<template #left>
<van-icon name="arrow-left" size="24" style="padding: 0"/>
</template>
</van-nav-bar>
<div class="main">
<div class="top">
<!-- 日期选择 -->
@@ -22,7 +26,7 @@
<!-- 标题 -->
<div class="title">
<div class="title-left">{{ titleLeft }}</div>
<div class="title-right">
<div class="title-right" v-show="currentDays === 0">
<p @click="onHistory">历史监测</p>
</div>
</div>
@@ -58,7 +62,7 @@

<!-- 监测次数 -->
<div class="monitoring-count">
<p>监测次数:{{ monitoringCount || '--' }}次</p>
<p>监测次数:{{ monitoringCount || '0' }}次</p>
</div>

<!-- 折线图-非日报 -->
@@ -78,10 +82,8 @@
</div>

<div class="item-right">
<span :style="{color: item.color}">{{ item.count ? item.count + '次' : '--'}}</span>
<span
:style="{color: item.color}"
>{{ item.percentage ? item.percentage + '%' : '--'}}</span>
<span :style="{color: item.color}">{{ item.count ? item.count + '次' : '0次'}}</span>
<label :style="{color: item.color, paddingTop: '3px'}">{{ item.percentage ? '(' + item.percentage + '%' + ')' : '(0%)'}}</label>
</div>
</div>
</div>
@@ -201,8 +203,8 @@ export default {
// 日期选择标签
dateList: [
{ name: "today", text: "今天", value: 0 },
/* { name: "week", text: "7天", value: 7 },
{ name: "month", text: "30天", value: 30 } */
{ name: "week", text: "7天", value: 7 },
{ name: "month", text: "30天", value: 30 }
],
current: 0, // 日期选择标签-当前选中的标签
currentDays: 0, //日期选择标签-日期参数
@@ -334,39 +336,40 @@ export default {
legend: {
width: "60%",
orient: "horizontal",
right: "right",
left: 'right',
top: "3%",
bottom: "3%",
itemHeight: 12,
itemWidth: 12,
itemGap: 14,
align: 'auto',
selectedMode: false,
data: [

{
name: `${this.emoName}倾向`,
name: `轻度${this.emoName}倾向`,
icon: "rect",
itemStyle: {
color: "#62BD48"
color: "#FFB481"
},
textStyle: {
// 项目遗留问题,新项目不需重新转换文字大小
fontSize: 12
}
},
{
name: `轻度${this.emoName}倾向`,
icon: "rect",
name: `中度${this.emoName}倾向`,
itemStyle: {
color: "#FFB481"
color: "#F86825"
},
icon: "rect",
textStyle: {
fontSize: 12
}
},
{
name: `度${this.emoName}倾向`,
name: `度${this.emoName}倾向`,
itemStyle: {
color: "#F86825"
color: "#F86825",
},
icon: "rect",
textStyle: {
@@ -374,15 +377,16 @@ export default {
}
},
{
name: `重度${this.emoName}倾向`,
name: `无${this.emoName}倾向`,
icon: "rect",
itemStyle: {
color: "#F86825"
color: "#62BD48"
},
icon: "rect",
textStyle: {
// 项目遗留问题,新项目不需重新转换文字大小
fontSize: 12
}
}
},
],
formatter: function(name) {
// 自定义显示内容
@@ -666,7 +670,7 @@ export default {
];
},
// 获取情绪数据
getPsychologiclData(date) {
getPsychologiclData(date, startDate, endDate) {

this.$toast.loading({
message: '数据加载中'
@@ -677,8 +681,8 @@ export default {
: this.$dayjs(this.defaultDate).format("YYYY-MM-DD") /* "2023-05-23" */;
let reqParams = {
uid: this.uid,
startDate: reqDate,
endDate: reqDate,
startDate: startDate || reqDate,
endDate: endDate || reqDate,
type: this.emoType
};
console.log("请求参数", reqParams);
@@ -750,25 +754,37 @@ export default {
label: "最大值",
value: data.Max,
time: data.MaxDesc
? this.$dayjs(data.MaxDesc).format("hh:mm")
? this.currentDays === 0 ? this.$dayjs(data.MaxDesc).format("HH:mm")
: this.$dayjs(data.MaxDesc).format("MM/DD HH:mm")
: ""
};
let Min = {
label: "最小值",
value: data.Min,
time: data.MinDesc
? this.$dayjs(data.MinDesc).format("hh:mm")
? this.currentDays === 0 ? this.$dayjs(data.MinDesc).format("HH:mm")
: this.$dayjs(data.MinDesc).format("MM/DD HH:mm")
: ""
};
let Avg = {
label: "平均值",
value: data.Avg,
time: data.AvgDesc
? this.currentDays === 0 ? this.$dayjs(data.AvgDesc).format("HH:mm")
: this.$dayjs(data.AvgDesc).format("MM/DD HH:mm")
: ""
};
let Current = {
label: "最近值",
value: data.Current,
time: data.CurrentDesc
? this.$dayjs(data.CurrentDesc).format("hh:mm")
? this.currentDays === 0 ? this.$dayjs(data.CurrentDesc).format("HH:mm")
: this.$dayjs(data.CurrentDesc).format("MM/DD HH:mm")
: ""
};
this.statisticsList.push(Max);
this.statisticsList.push(Min);
this.statisticsList.push(Avg);
this.statisticsList.push(Current);
// 周报月报底部显示数据
let NoneDay = {
@@ -800,11 +816,20 @@ export default {
return item.Value;
});
// x轴显示数据
this.xAxisData = data.ChartDatas.map(item => {
return this.$dayjs(item.Key.replace(/-/g, "/")).format(
"HH:mm"
);
});
if(this.currentDays === 0) {
// 显示今天数据
this.xAxisData = data.ChartDatas.map(item => {
return this.$dayjs(item.Key.replace(/-/g, "/")).format(
"HH:mm"
);
});
} else {
this.xAxisData = data.ChartDatas.map(item => {
return this.$dayjs(item.Key.replace(/-/g, "/")).format(
"MM/DD"
);
});
}
// 结果解读
this.result = data.Result;
this.advice = data.Advice;
@@ -958,9 +983,12 @@ export default {
const month = day.date.getMonth() + 1;
const date = day.date.getDate();
const formatDate = this.$dayjs(day.date).format("YYYY-MM-DD");
const currentDate = this.$dayjs(new Date()).format("YYYY-MM-DD");
day.className = "custom-calendar";
if (this.highlightDates.includes(formatDate)) {
day.className = "highlight-border";
}else if (formatDate === currentDate) {
day.text = '今天'
}
return day;
},
@@ -971,8 +999,11 @@ export default {
// 点击日期选择
onTabClick(value, index) {
this.current = index;
this.currentDays = index;
if (index !== 0) {
this.currentDays = value;
let currentDate = new Date();
let leftText = value === 0 ? '今天' : value === 7 ? '7天' : '30天';
this.titleLeft = `${leftText}${this.emoName}倾向趋势`;
if (value === 7) {
this.defaultOptions.xAxis.data = [
"周一",
"周二",
@@ -983,13 +1014,67 @@ export default {
"周日"
];
this.defaultOptions.series = this.weekAndMonthSeries;
this.initEchart();
let dateList = this.getPostDate(currentDate, 6, true);
console.log("dateList", dateList);
this.getPsychologiclData('', dateList[0], dateList[1]);
} else if (value === 0) {
// 今天
this.defaultOptions.xAxis.data = this.xAxisData;
this.defaultOptions.series = this.defaultSeries;
this.defaultOptions.series[0].data = this.emotionData;
this.getPsychologiclData(this.selectDate ? this.selectDate : this .$dayjs(currentDate).format("YYYY-MM-DD"));
} else {
// 30天
this.defaultOptions.xAxis.data = this.xAxisData;
this.defaultOptions.series = this.defaultSeries;
this.defaultOptions.series[0].data = this.emotionData;
this.initEchart();
let dateList = this.getCurrentMonthStaAndEnd(currentDate);
console.log("dateList", dateList);
this.getPsychologiclData('', dateList[0], dateList[1]);
}
},
getCurrentMonthStaAndEnd(currentDate) {
let list = [];
let monthStart = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1); // 获取本月第一天的日期时间
let monthEnd = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0, 23, 59, 59); // 获取本月最后一天的日期时间(时间为23:59:59)
list.push(this.$dayjs(monthStart).format("YYYY-MM-DD"));
list.push(this.$dayjs(monthEnd).format("YYYY-MM-DD"));
return list;
},
// 获取指定天数的起始日期
/**
*
* @param dateNow :Date类
* @param intervalDays :间隔天数
* @param bolPastTime :Boolean,判断在参数date之前,还是之后,
*/
getPostDate(dateNow,intervalDays,bolPastTime) {
let oneDayTime = 24 * 60 * 60 * 1000;
let list = [];
let lastDay;

if(bolPastTime == true){
lastDay = new Date(dateNow.getTime() - intervalDays * oneDayTime);
list.push(this.formateDate(lastDay));
list.push(this.formateDate(dateNow));
}else{
lastDay = new Date(dateNow.getTime() + intervalDays * oneDayTime);
list.push(this.formateDate(dateNow));
list.push(this.formateDate(lastDay));
}
return list;
},
formateDate(time){
let year = time.getFullYear();
let month = time.getMonth() + 1;
let day = time.getDate();
if (month < 10) {
month = '0' + month
};
if (day < 10) {
day = '0' + day
};
return year + '-' + month + '-' + day + '';
},
// 字体大小转化
fontChar(res) {
@@ -1020,8 +1105,9 @@ export default {
// 选择日历具体某一个日期
onSelect(value) {
const selectDate = this.$dayjs(value).format("YYYY-MM-DD");
this.dateList[0].text = this.$dayjs(value).format("YYYY-MM-DD") === this.$dayjs(new Date()).format("YYYY-MM-DD") ? '今天' : this.$dayjs(value).format("YYYY-MM-DD");
this.dateList[0].text = this.$dayjs(value).format("YYYY-MM-DD") === this.$dayjs(new Date()).format("YYYY-MM-DD") ? '今天' : this.$dayjs(value).format("MM-DD");
this.calendarDialogShow = false;
this.selectDate = selectDate;
this.getPsychologiclData(selectDate);
},
// 计算字体显示的颜色
@@ -1058,7 +1144,9 @@ export default {
.van-calendar {
height: 300px;
.van-calendar__days .van-calendar__day {

width: 27px;
height: 27px;
font-size: 12px;
&.custom-calendar {
width: 27px;
height: 27px;


+ 17
- 6
src/views/psychological-modeling/index.vue Прегледај датотеку

@@ -1,6 +1,10 @@
<template>
<div class="page">
<van-nav-bar title="" :border="true" :left-arrow="true" @click-left="onNavBack" v-if="showLeftArrow"></van-nav-bar>
<div class="page" v-show="isSHowPage">
<van-nav-bar title="" :border="true" :left-arrow="true" @click-left="onNavBack" v-if="showLeftArrow">
<template #left>
<van-icon name="arrow-left" size="23" style="padding: 0"/>返回
</template>
</van-nav-bar>
<div class="tip">
<div class="icon">
<i class="iconfont icon-tishi"></i>
@@ -76,6 +80,8 @@ export default {
return {
info: null,
showLeftArrow: null,
isSHowPage: false,
fromUrl: '',
}
},
mounted() {
@@ -93,6 +99,8 @@ export default {
this.$store.commit('fromSsjl', params.fromSsjl);
// 是否显示 返回标签
this.showLeftArrow = this.$store.getters.fromSsjl === 'true';
this.fromUrl = params.fromUrl;
console.log("fromUrl", this.fromUrl);
//初始化
this.init()
} else {
@@ -103,7 +111,7 @@ export default {
onNavBack() {
let fromSsjl = this.$store.getters.fromSsjl === 'true';
if(fromSsjl) {
let baseUrl = process.env.NODE_ENV === "production" ? 'https://ai.ssjlai.com/parentweb' : 'https://id.ssjlai.com/parentweb';
let baseUrl = this.fromUrl;
window.location.href = `${baseUrl}/#/device`;
} else {
this.$router.go(-1);
@@ -124,16 +132,19 @@ export default {
this.$toast('用户不存在或未绑定手表')
} else if (re.response && re.response.initScaleState === 1 && re.response.progress === 1) {
// 2023.6.1 需求变更,建模完成直接跳到心理健康汇总页面
this.$router.push(`/psychologicalMain?uid=${this.uid}`);
this.$router.replace(`/psychologicalMain?uid=${this.uid}&fromUrl=${this.fromUrl}`);
} else {
this.info = re.response
}
} else {
this.$toast(re.msg)
}
}
setTimeout(() => {
this.isSHowPage = true;
}, 800)
},
toQuestion() {
this.$router.push(`/PsychologicalQuestionnaire?uid=${this.uid}`)
this.$router.replace(`/PsychologicalQuestionnaire?uid=${this.uid}`)
},
api(url, config, token) {
let baseUrl = 'https://dbmq.rzliot.com/heart'


Loading…
Откажи
Сачувај