diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..7549542 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +registry=https://registry.npmmirror.com diff --git a/App.vue b/App.vue index 5550f18..d5fceb6 100644 --- a/App.vue +++ b/App.vue @@ -7,8 +7,6 @@ const serviceStore = useServiceStoreWidthOut() export default { async onLaunch() { - console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!') - console.log('App Launch') try { await uni.$u.api.login() this.getCarInfo() @@ -25,6 +23,7 @@ export default { methods: { async getCarInfo() { try { + if (!userStore.token) return const res = await uni.$u.api.getCarInfo() serviceStore.setCurrentCar(res) setTimeout(() => { diff --git a/api/modules/user.ts b/api/modules/user.ts index 46b0209..4886e19 100644 --- a/api/modules/user.ts +++ b/api/modules/user.ts @@ -8,7 +8,8 @@ export const userApi = { login: async () => { const localDeviceNo = uni.getStorageSync(uni.$u.LOCAL_KEY.DEVICE_NO) if (!localDeviceNo) { - uni.showModal({ title: '提示', content: '请先设置平板信息' }) + // uni.showModal({ title: '提示', content: '请先设置平板信息' }) + uni.$u.toast('请先设置平板信息') return null } try { diff --git a/components/CreatePatient/CreatePatient.vue b/components/CreatePatient/CreatePatient.vue index 0668488..bc4624f 100644 --- a/components/CreatePatient/CreatePatient.vue +++ b/components/CreatePatient/CreatePatient.vue @@ -85,6 +85,3 @@ function onConfirm() { }) } - - diff --git a/components/DetailBase/DetailBase.vue b/components/DetailBase/DetailBase.vue index 40b9fc4..a318733 100644 --- a/components/DetailBase/DetailBase.vue +++ b/components/DetailBase/DetailBase.vue @@ -1,9 +1,151 @@ +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() - \ No newline at end of file +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() + diff --git a/config/service.ts b/config/service.ts index 4aca9b4..c7dcbb9 100644 --- a/config/service.ts +++ b/config/service.ts @@ -27,3 +27,10 @@ export const FIRST_AID_ZL_TYPE = [ { value: 2, text: 'ATI急性创伤' }, { value: 3, text: 'AGB急性消化道出血' }, ] + +// 是否发病时间已知 +export const fbTimeKnown = [ + { value: '已知', text: '已知' }, + { value: '未知', text: '未知' }, + { value: '醒后卒中', text: '醒后卒中' }, +] diff --git a/pages/detail2/detail2.vue b/pages/detail2/detail2.vue index 2bc6345..8f6dd43 100644 --- a/pages/detail2/detail2.vue +++ b/pages/detail2/detail2.vue @@ -8,8 +8,8 @@ - - + + - + @@ -38,15 +38,30 @@ - - + + + NIHSS评分 + + + 00 : + 00 : + 00 + + + 急救信息记录 - - + + + + + + + + @@ -56,7 +71,6 @@ - @@ -117,10 +131,30 @@ async function getAidInfo(firstAidId: string) { } .item-card { - padding: 1em 1em 1em 1.2em; + // padding-left: 10rpx; border-radius: 20rpx; background-color: #fff; - border-left: 10rpx solid; + + .item-card-content { + margin-left: 0.5em; + border-radius: 10px; + padding: 1em; + } + + .count-wrap { + color: #fff; + padding: 1em; + font-weight: bold; + + .time-item { + background-color: #fff; + color: $u-type-primary; + padding: 0 2px; + border-radius: 4px; + margin: 0 3px; + } + } + } .head { diff --git a/uni.scss b/uni.scss index 83298d8..705b12e 100644 --- a/uni.scss +++ b/uni.scss @@ -14,6 +14,10 @@ $u-type-success: #1bb299; background: linear-gradient(180deg, #4f8bff, rgba(44, 110, 183, 0)); } +.bg-primary { + background-color: $u-type-primary !important; +} + .border-radius-9-up { border-radius: 18rpx 18rpx 0 0; }