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

135 lines
3.0 KiB
Vue

<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]">SAS焦虑测评报告</text>
</template>
</Navbar>
<view class="flex-1 overflow-auto relative">
<!-- 顶部卡片 -->
<view class="mt-[30rpx] mx-[24rpx]">
<StatusCard
:score="score"
:rules="anxietyRules"
tip="结果只做参考,不能准确判断是否有焦虑症。"
:level="level"
:description="studyRecord.description"
:tagName="studyRecord.tagName"
/>
</view>
<view class="mt-[30rpx] mx-[24rpx]">
<SuggestionCard />
</view>
<!-- 底部AI智能顾问 -->
<AiFooter :pageId="pageId" :pageType="pageType" />
</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 AiFooter from '../components/AiFooter.vue'
import { getCustomScaleExplains } from '@/service/index/api'
import { handleBack } from '../hooks/useEvaluateBack'
const pageType = ref(0)
const pageId = ref(0)
const anxietyRules = [
{
label: '正常范围',
range: '<50分',
color: '#00B281',
},
{
label: '轻度焦虑',
range: '50-59分',
color: '#F8B801',
},
{
label: '中度焦虑',
range: '60-69分',
color: '#F79C33',
},
{
label: '重度焦虑',
range: '≥70分',
color: '#F5663E',
},
]
const score = ref(0)
const level = ref(0)
const studyRecord = ref({
description: '',
title: '',
result: '',
tagName: '',
})
const calcLevel = (val: string) => {
let _s = JSON.parse(val)
if (_s[0].Total >= 70) {
return 3
} else if (_s[0].Total >= 60) {
return 2
} else if (_s[0].Total >= 50) {
return 1
} else {
return 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
}
level.value = calcLevel(studyRecord.value.result)
score.value = JSON.parse(studyRecord.value.result)[0].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>