| | |
| | | |
| | | import { defineStore } from 'pinia' |
| | | import { ref } from 'vue' |
| | | import { ajaxPost} from '@/utils/axios' |
| | | // 使用示例一:函数式定义【个人推荐】 |
| | | export const userInfoStore = defineStore('userInfo', () => { |
| | | const info = ref({ |
| | |
| | | headimgurl:'', |
| | | nickname:'', |
| | | }) |
| | | const patient=ref({}) |
| | | 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(patient:object) { |
| | | patient.value=patient |
| | | 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,patient,setPatient, setInfo } |
| | | return { info,patient,setPatient, setInfo,setPatientApi } |
| | | }) |