| | |
| | | headimgurl:'', |
| | | nickname:'' |
| | | }) |
| | | function setUserInfo(userInfo:{openud:string, headimgurl:string,nickname:string}) { |
| | | info.value.openid=userInfo.openud |
| | | function setUserInfo(userInfo:{openid:string, headimgurl:string,nickname:string}) { |
| | | info.value.openid=userInfo.openid |
| | | info.value.headimgurl=userInfo.headimgurl |
| | | info.value.nickname=userInfo.nickname |
| | | } |
| | |
| | | instance.interceptors.response.use( |
| | | (response: AxiosResponse) => { |
| | | const { data, status } = response |
| | | console.log('返回结果',data) |
| | | const { message } = data |
| | | // 请求正常时,仅返回需要用到的 data 信息即可 |
| | | if (message==='SUCCESS') return data.data |
| | |
| | | <script lang="ts" setup> |
| | | import { Dialog } from 'vant' |
| | | import { ref,onMounted } from 'vue' |
| | | import {useRoute,useRouter} from 'vue-router' |
| | | import { ajaxGet } from '@/utils/axios' |
| | | // import { Session } from '@/utils/storage' |
| | | import { Toast } from 'vant' |
| | | import { Dialog } from 'vant' |
| | | import { userInfoStore } from '@/stores/userInfo' |
| | | import logo from 'assets/logo.png' |
| | | import shoujiLogin from 'assets/yijianLogin.png' |
| | | import pswdLogin from 'assets/pswdLogin.png' |
| | | const userInfo = userInfoStore() |
| | | const route = useRoute() |
| | | const router=useRouter() |
| | | const username = ref('') |
| | |
| | | if (code){ |
| | | ajaxGet('wechat/code',{code}).then((re:any)=>{ |
| | | console.log(re) |
| | | userInfo.setUserInfo({openid:re.openid,nickname:re.nickname,headimgurl:re.headimgurl}) |
| | | const openid = re.openid |
| | | if (openid) { |
| | | ajaxGet('patient/info/wechatLogin',{openid}).then((re:any)=>{ |
| | | console.log('openid换的accesstoken=',re) |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | } |
| | | else { |
| | |
| | | } |
| | | } else { |
| | | console.log('不是微信浏览器') |
| | | Toast({ |
| | | Dialog.alert({ |
| | | title: '提示', |
| | | message: '请在微信中打开浏览', |
| | | position: 'top', |
| | | }).then(() => { |
| | | // on close |
| | | }) |
| | | } |
| | | }) |