volunteer-4/src/pages-evaluation-sub/evaluate/psychologicalReport/sdsReport.vue

139 lines
2.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<route lang="json5" type="page">
{
style: {
navigationStyle: 'custom',
},
}
</route>
<template>
<view :scroll-y="true" class="flex flex-col h-screen relative custom-bg">
<Navbar
safeAreaInsetTop
:bordered="false"
leftArrow
@clickLeft="handleBack"
bg-color="transparent"
>
<template #title>
<text class="text-[#1F2329] text-[36rpx] font-medium text-[#fff]">SDS抑郁测评报告</text>
</template>
</Navbar>
<view class="flex-1 overflow-auto pb-safe relative mx-[24rpx]">
<!-- 顶部卡片 -->
<view class="mt-[30rpx]">
<StatusCard
:score="score"
:rules="depressionRules"
tip="结果只做参考,不能准确判断是否有抑郁症。"
:level="level"
:description="studyRecord.description"
:tagName="studyRecord.tagName"
/>
</view>
<view class="mt-[30rpx]">
<SuggestionCard />
</view>
</view>
</view>
</template>
<script setup lang="ts">
import Navbar from '@/pages-evaluation-sub/components/navbar/Navbar.vue'
import StatusCard from '../components/StatusCard.vue'
import SuggestionCard from '../components/SuggestionCard.vue'
import { getCustomScaleExplains } from '@/service/index/api'
const pageType = ref(0)
const pageId = ref(0)
// 示例规则2抑郁评估
const depressionRules = [
{
label: '正常范围',
range: '<52分',
color: '#00B281',
},
{
label: '轻度抑郁',
range: '53-61分',
color: '#F8B801',
},
{
label: '中度抑郁',
range: '62-71分',
color: '#F79C33',
},
{
label: '重度抑郁',
range: '≥72分',
color: '#F5663E',
},
]
const handleBack = () => {
uni.navigateBack()
}
const studyRecord = ref({
description: '',
title: '',
result: '',
tagName: '',
total: '',
})
const calcLevel = (val: string) => {
let _s = +val
if (_s >= 72) {
return 3
} else if (_s >= 62) {
return 2
} else if (_s >= 53) {
return 1
} else {
return 0
}
}
const score = ref(0)
const level = ref(0)
onLoad((options) => {
pageType.value = +options.type
pageId.value = options.id
getCustomScaleExplains({ CustomScaleId: pageId.value }).then((resp) => {
if (resp.code === 200) {
studyRecord.value = resp.result as {
description: string
title: string
result: string
tagName: string
total: string
}
level.value = calcLevel(studyRecord.value.total)
score.value = JSON.parse(studyRecord.value.total)
}
})
})
</script>
<style scoped lang="scss">
.custom-bg {
background: linear-gradient(184deg, #0d79fc 0%, #2186fc 100%);
}
:deep(.icon-class) {
color: #fff !important;
}
.custom-border {
width: 162rpx;
height: 162rpx;
border-radius: 50%;
border: 6rpx dashed;
border-color: #05d69c transparent transparent transparent;
}
</style>