9 changed files with 125 additions and 12 deletions
@ -0,0 +1,71 @@ |
|||||
|
<template> |
||||
|
<div |
||||
|
class="demonstration-box w-full flex flex-nowrap" |
||||
|
style="padding: 0 16px" |
||||
|
:style="{ backgroundColor: detailValueType === 1 ? '#40a9ff' : '#6ea4d1' }" |
||||
|
:class="patientInfo && patientInfo.isInfo ? 'justify-between' : 'justify-center'" |
||||
|
> |
||||
|
<template v-if="patientInfo && patientInfo.isInfo"> |
||||
|
<div class="flex"> |
||||
|
<div style="margin-right: 16px"> |
||||
|
{{ patientInfo.name ? patientInfo.name : '无名氏' }} |
||||
|
</div> |
||||
|
<div style="margin-right: 16px"> |
||||
|
<span v-if="patientInfo && (patientInfo.gender || patientInfo.gender === 0)"> |
||||
|
{{ patientInfo.gender === 0 ? '女' : '男' }} |
||||
|
</span> |
||||
|
<span v-else>-</span> |
||||
|
</div> |
||||
|
<div> |
||||
|
{{ patientInfo.age ? patientInfo.age + '岁' : '-' }} |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
<div> |
||||
|
<span v-if="detailValueType === 1"> 当前为演示模式 </span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script> |
||||
|
import { mapState, mapMutations } from 'vuex'; |
||||
|
export default { |
||||
|
name: 'Demonstration', |
||||
|
data() { |
||||
|
return {}; |
||||
|
}, |
||||
|
computed: mapState('carbasics', ['patientInfo', 'firstAidId', 'detailValueType']), |
||||
|
async created() { |
||||
|
await this.getData(); |
||||
|
}, |
||||
|
methods: { |
||||
|
...mapMutations('carbasics', ['setPatientInfo']), |
||||
|
// 获取病例信息 |
||||
|
async getData() { |
||||
|
try { |
||||
|
const param = { firstAidId: this.firstAidId }; |
||||
|
const data = await this.$u.api.getPatient(param); |
||||
|
const info = { |
||||
|
name: data.name, |
||||
|
gender: data.gender, |
||||
|
age: data.age, |
||||
|
isInfo: true, |
||||
|
}; |
||||
|
this.setPatientInfo(info); |
||||
|
} catch (error) { |
||||
|
console.log('error: ', error); |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
<style scoped> |
||||
|
.demonstration-box { |
||||
|
height: 28px; |
||||
|
line-height: 28px; |
||||
|
text-align: center; |
||||
|
position: fixed; |
||||
|
color: #fff; |
||||
|
top: 0; |
||||
|
z-index: 99; |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue