generated from ccsens_fe/uni-vue3-template
10 changed files with 264 additions and 57 deletions
@ -1,48 +1,54 @@ |
|||||
{ |
{ |
||||
"pages": [ |
"pages": [ |
||||
{ |
{ |
||||
"path": "pages/loading/loading", |
"path": "pages/loading/loading", |
||||
"style": { |
"style": { |
||||
"navigationStyle": "custom", |
"navigationStyle": "custom", |
||||
"navigationBarTitleText": "" |
"navigationBarTitleText": "" |
||||
} |
} |
||||
}, |
}, |
||||
{ |
{ |
||||
"path": "pages/index/index", |
"path": "pages/index/index", |
||||
"style": { |
"style": { |
||||
"navigationBarTitleText": "", |
"navigationBarTitleText": "", |
||||
"navigationStyle": "custom" |
"navigationStyle": "custom" |
||||
} |
} |
||||
}, |
}, |
||||
{ |
{ |
||||
"path": "pages/patient-list/patient-list", |
"path": "pages/patient-list/patient-list", |
||||
"style": { |
"style": { |
||||
"navigationStyle": "custom", |
"navigationStyle": "custom", |
||||
"navigationBarTitleText": "患者列表" |
"navigationBarTitleText": "患者列表" |
||||
} |
} |
||||
}, |
}, |
||||
{ |
{ |
||||
"path": "pages/detail1/detail1", |
"path": "pages/detail1/detail1", |
||||
"style": { |
"style": { |
||||
"navigationStyle": "custom", |
"navigationStyle": "custom", |
||||
"navigationBarTitleText": "患者详情" |
"navigationBarTitleText": "患者详情" |
||||
} |
} |
||||
}, |
}, |
||||
{ |
{ |
||||
"path": "pages/detail2/detail2", |
"path": "pages/detail2/detail2", |
||||
"style": { |
"style": { |
||||
"navigationStyle": "custom", |
"navigationStyle": "custom", |
||||
"navigationBarTitleText": "患者详情" |
"navigationBarTitleText": "患者详情" |
||||
} |
} |
||||
} |
}, |
||||
], |
{ |
||||
"globalStyle": { |
"path": "pages/create-aid/create-aid", |
||||
"navigationBarTextStyle": "black", |
"style": { |
||||
"navigationBarTitleText": "暴风眼质控", |
"navigationBarTitleText": "create-aid" |
||||
"navigationBarBackgroundColor": "#F8F8F8", |
} |
||||
"backgroundColor": "#F8F8F8", |
} |
||||
"app-plus": { |
], |
||||
"background": "#efeff4" |
"globalStyle": { |
||||
} |
"navigationBarTextStyle": "black", |
||||
} |
"navigationBarTitleText": "暴风眼质控", |
||||
} |
"navigationBarBackgroundColor": "#F8F8F8", |
||||
|
"backgroundColor": "#F8F8F8", |
||||
|
"app-plus": { |
||||
|
"background": "#efeff4" |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,123 @@ |
|||||
|
<template> |
||||
|
<view class="uni-px-10 "> |
||||
|
<uni-section title="患者信息" type="line"> </uni-section> |
||||
|
<uni-forms :modelValue="baseInfo" :label-width="100" class="white uni-radius-lg uni-pa-6"> |
||||
|
<uni-forms-item label="扫描身份证" name="" @click="onScan"> |
||||
|
<view class="flex full-height justify-end"> |
||||
|
<uni-icons type="scan" color="#70798C" size="24" /> |
||||
|
</view> |
||||
|
</uni-forms-item> |
||||
|
<uni-forms-item label="姓名" name="patientName"> |
||||
|
<uni-easyinput type="text" v-model="baseInfo.patientName" placeholder="请输入姓名" /> |
||||
|
</uni-forms-item> |
||||
|
<uni-forms-item name="patientGender" label="性别"> |
||||
|
<uni-data-checkbox v-model="baseInfo.patientGender" :localdata="GENDER_LIST" /> |
||||
|
</uni-forms-item> |
||||
|
<uni-forms-item label="民族" name="patientNation"> |
||||
|
<uni-data-select :localdata="nationList" v-model="baseInfo.patientNation" :clear="false" /> |
||||
|
</uni-forms-item> |
||||
|
<uni-forms-item label="身份证号" name="patientIdCardNo"> |
||||
|
<uni-easyinput type="idcard" v-model="baseInfo.patientIdCardNo" placeholder="请输入身份证号" /> |
||||
|
</uni-forms-item> |
||||
|
</uni-forms> |
||||
|
|
||||
|
<uni-section title="疑似诊断" type="line"> </uni-section> |
||||
|
<uni-data-checkbox mode="list" v-model="baseInfo.firstAidZlType" :localdata="FIRST_AID_ZL_TYPE" class="white uni-radius-lg uni-pa-6"> |
||||
|
</uni-data-checkbox> |
||||
|
|
||||
|
<view class="flex uni-px-6 uni-py-10"> |
||||
|
<u-button @click="onSubmit" shape="circle" type="primary" class="bg-main" size="medium">完成创建患者</u-button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import { reactive, ref } from 'vue'; |
||||
|
import { useUserStore } from '@/store/modules/user' |
||||
|
import { GENDER_LIST, FIRST_AID_ZL_TYPE } from '@/config/service' |
||||
|
import { computed } from 'vue'; |
||||
|
|
||||
|
const baseInfo = reactive({ |
||||
|
patientName: '张三', |
||||
|
patientGender: 0, |
||||
|
patientNation: '汉族', |
||||
|
patientIdCardNo: '142222188901120112', |
||||
|
firstAidZlType: 0 |
||||
|
}) |
||||
|
const nationList = ref([]) |
||||
|
|
||||
|
const userStore = useUserStore() |
||||
|
|
||||
|
const token = computed(() => userStore.token) |
||||
|
|
||||
|
// 提交创建急救 |
||||
|
async function onSubmit() { |
||||
|
const param = { ...baseInfo, } |
||||
|
try { |
||||
|
const { firstAidId, firstAidStatus } = await uni.$u.api.createAid(param) |
||||
|
uni.$u.toast('创建成功') |
||||
|
uni.$u.openPage('detail2', false, `firstAidId=${firstAidId}&firstAidStatus=${firstAidStatus}`) |
||||
|
} catch (error) { |
||||
|
uni.$u.alertError(error) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 扫描身份证 |
||||
|
function onScan() { |
||||
|
uni.chooseImage({ |
||||
|
count: 1, |
||||
|
sizeType: ['original', 'compressed'], |
||||
|
sourceType: ['album', 'camera'], |
||||
|
success(res) { |
||||
|
upload(res.tempFilePaths[0]) |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 上传 |
||||
|
function upload(tempPath: string) { |
||||
|
const host = uni.getStorageSync(uni.$u.LOCAL_KEY.HOST) |
||||
|
if (!host) { |
||||
|
uni.showModal({ title: '提示', content: '请先配置服务器地址' }) |
||||
|
return |
||||
|
} |
||||
|
uni.uploadFile({ |
||||
|
url: `${host}/sys/ocr/idcardInfo`, //仅为示例,非真实的接口地址 |
||||
|
filePath: tempPath, |
||||
|
name: 'file', |
||||
|
header: { Authorization: `Bearer ${token.value}` }, |
||||
|
success: (uploadFileRes) => { |
||||
|
if (!uploadFileRes?.data) { |
||||
|
uni.$u.toast('请求失败') |
||||
|
return |
||||
|
} |
||||
|
const { msg, code, data } = JSON.parse(uploadFileRes.data) as any |
||||
|
|
||||
|
if (code === 200) { |
||||
|
const { name, sex, idCardNo, nation } = data |
||||
|
baseInfo.patientName = name || '' |
||||
|
baseInfo.patientGender = sex || '' |
||||
|
baseInfo.patientNation = nation || '' |
||||
|
baseInfo.patientIdCardNo = idCardNo || '' |
||||
|
// handleScan(url) |
||||
|
} else if (code === 401) { |
||||
|
uni.$u.api.login().then(upload(tempPath)) |
||||
|
} else { |
||||
|
uni.$u.toast(msg) |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 查民族列表 |
||||
|
async function getNationList() { |
||||
|
try { |
||||
|
const data = await uni.$u.api.getNationList() |
||||
|
nationList.value = data.map((item: string) => ({ value: item, text: item })) |
||||
|
} catch (error) { |
||||
|
uni.$u.alertError(error) |
||||
|
} |
||||
|
} |
||||
|
// 初始获取民族 |
||||
|
getNationList() |
||||
|
</script> |
Loading…
Reference in new issue