chenyc
2023-06-04 b8ce0e7f0652aab9d9b0df9c5fbaebd924d31cc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { ajaxPost} from '@/utils/axios'
// 使用示例一:函数式定义【个人推荐】
export const userInfoStore = defineStore('userInfo', () => {
    const info = ref({
        openid:'',
        headimgurl:'',
        nickname:'',
    })
    const patient=ref({
        patientInfo:{
            age:0,
            code:'',
            id:'',
            patientCardNo:'',
            patientOpenId:'',
            patientIdentityNo:'',
            patientName:'',
            patientTelNo:'',
            patientAvatarIcon:'',
            patientCreditValue:0,
            patientAddress:'',
            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:any) {
        patient.value=userInfo
    }
    const setPatientApi= async()=>{
        const res= await ajaxPost('/patient/info/getPatientInfo','')
        setPatient(res)
    }
 
    return { info,patient,setPatient, setInfo,setPatientApi }
})