2 lines
2.0 KiB
JavaScript
2 lines
2.0 KiB
JavaScript
import{r as e,G as o,c as n,w as s,H as t,J as c,z as a,i as r,o as i,b as l}from"./index-BMxaUgem.js";import{o as p}from"./uni-app.es.B5-OajNy.js";import{_ as u}from"./_plugin-vue_export-helper.BCo6x5W8.js";const d=u({__name:"callback",setup(u){e(0);const d=o({name:"",openid:"",accessToken:""});e("");const h=()=>{const e=`https://www.focusnu.com/nursing-unit/h5Api/nuBizAdvisoryInfo/queryWeixinInfo?openId=${encodeURIComponent(d.openid)}`;fetch(e).then((e=>e.json())).then((e=>{console.log("个人信息打印",e),c("token",e.result.token),c("serverUrl",e.result.serverUrl),console.log("???token存储",e.result.token);const o=`${e.result.serverUrl}/weiXinPay/getJsApiInfo`,n={access_token:d.accessToken};console.log("???/",n),fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then((e=>e.json())).then((e=>{console.log("???调取微信",e)})).catch((e=>{console.error("请求失败:",e)})),e.result.tel?a({url:"/pages/index/index"}):a({url:"/pages/login/phonebumber"}),m()}))},f=e([]),m=()=>{fetch("https://www.focusnu.com/nursing-unit/sys/sysDepart/queryInstitutionsList").then((e=>e.json())).then((e=>{f.value=[...e],console.log("机构打印",f.value)}))};return e([]),p((()=>{var e;const o=null==(e=window.location.href.split("?")[1])?void 0:e.split("#")[0],n={};o&&o.split("&").forEach((e=>{const[o,s]=e.split("=");n[o]=decodeURIComponent(s)})),console.log("解析到的 query 参数:",n),n.code&&(e=>{const o=`https://www.focusnu.com/nursing-unit/weixin/wechat/callback?code=${encodeURIComponent(e)}`;fetch(o).then((e=>e.json())).then((e=>{d.name=e.data.nickname,d.openid=e.data.openid,d.accessToken=e.accessToken,t({key:"openid",data:{openid:e.data.openid,accessToken:e.accessToken}}),h()})).catch((e=>{console.error("❌ 获取用户信息失败:",e)}))})(n.code)})),(e,o)=>{const t=r;return i(),n(t,{class:"login-container"},{default:s((()=>[l(" 页面跳转中,请稍后... ")])),_:1})}}},[["__scopeId","data-v-812fd514"]]);export{d as default};
|