From 7e6b8b1eef198ab4de9633288037a23817f9ee39 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期三, 24 五月 2023 22:52:42 +0800
Subject: [PATCH] 45
---
src/stores/userInfo.ts | 35 +++++++++++++++++++++++++++++++----
1 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/src/stores/userInfo.ts b/src/stores/userInfo.ts
index 1e043bc..e7d5b0b 100644
--- a/src/stores/userInfo.ts
+++ b/src/stores/userInfo.ts
@@ -1,18 +1,45 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
+import { ajaxPost} from '@/utils/axios'
// 使用示例一:函数式定义【个人推荐】
export const userInfoStore = defineStore('userInfo', () => {
const info = ref({
openid:'',
headimgurl:'',
- nickname:''
+ nickname:'',
})
- function setUserInfo(userInfo:{openud:string, headimgurl:string,nickname:string}) {
- info.value.openid=userInfo.openud
+ const patient=ref({
+ patientInfo:{
+ age:0,
+ code:'',
+ id:'',
+ patientCardNo:'',
+ patientOpenId:'',
+ patientIdentityNo:'',
+ patientName:'',
+ patientTelNo:'',
+ patientAvatarIcon:'',
+ patientCreditValue:0,
+ clientCode:'',
+ },
+ pressure:'',
+ weight:''
+ })
+ function setInfo(userInfo:{openid:string, headimgurl:string,nickname:string}) {
+ info.value.openid=userInfo.openid
info.value.headimgurl=userInfo.headimgurl
info.value.nickname=userInfo.nickname
}
+ function setPatient(userInfo:object) {
+ patient.value=userInfo
+ }
+ const setPatientApi= async ()=>{
+ const res= await ajaxPost('/patient/info/getPatientInfo','')
+ console.log('-----')
+ console.log(res)
+ setPatient(res)
+ }
- return { info, setUserInfo }
+ return { info,patient,setPatient, setInfo,setPatientApi }
})
--
Gitblit v1.8.0