2 lines
3.2 KiB
JavaScript
2 lines
3.2 KiB
JavaScript
import{y as e,r as n,c as o,w as s,z as t,i as a,o as c,b as i,t as r,q as l,s as p,F as u,a as d,f as h,g as f}from"./index-DVIfOFfO.js";import{o as m}from"./uni-app.es.DNqITeUz.js";import{u as g}from"./useWeChatAuth.s7uh5--2.js";import{_ as w}from"./_plugin-vue_export-helper.BCo6x5W8.js";const y=w({__name:"callback",setup(w){g();const y=e({name:"",openid:"",accessToken:""}),v=()=>{console.log("???"),h({url:"/pages/pay/index"})},k=n(""),I=()=>{const e=`https://www.focusnu.com/nursing-unit/h5Api/nuBizAdvisoryInfo/queryWeixinInfo?openId=${encodeURIComponent(y.openid)}&wechatName=${encodeURIComponent(y.name)}`;fetch(e).then((e=>e.json())).then((e=>{console.log("个人信息打印",e);const n=`${e.result.serverUrl}/weiXinPay/getUserInfo`,o={openid:y.openid,access_token:y.accessToken};console.log("???/",o),fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then((e=>e.json())).then((e=>{k.value=e,console.log("!!!!!!!!!!!!!!!!!!!!!!!",e)})).catch((e=>{console.error("请求失败:",e)})),j()}))},_=n([]),j=()=>{fetch("https://www.focusnu.com/nursing-unit/sys/sysDepart/queryInstitutionsList").then((e=>e.json())).then((e=>{_.value=[...e],console.log("机构打印",_.value)}))},x=n([]);return m((()=>{var e;const n=null==(e=window.location.href.split("?")[1])?void 0:e.split("#")[0],o={};n&&n.split("&").forEach((e=>{const[n,s]=e.split("=");o[n]=decodeURIComponent(s)})),console.log("解析到的 query 参数:",o),o.code&&(e=>{const n=`https://www.focusnu.com/nursing-unit/weixin/wechat/callback?code=${encodeURIComponent(e)}`;fetch(n).then((e=>e.json())).then((e=>{console.log("✅ 获取用户信息成功:",e),y.name=e.data.nickname,y.openid=e.data.openid,y.accessToken=e.accessToken,t({key:"openid",data:{openid:e.data.openid,accessToken:e.accessToken}}),I()})).catch((e=>{console.error("❌ 获取用户信息失败:",e)}))})(o.code)})),(e,n)=>{const h=a,m=f;return c(),o(h,{class:"callback-container"},{default:s((()=>[i(" 回调成功"+r(y.name)+r(y.openid)+" ",1),(c(!0),l(u,null,p(_.value,((e,n)=>(c(),o(h,{key:n},{default:s((()=>[d(h,{style:{"font-size":"30rpx","margin-top":"10rpx","font-weight":"700"},onClick:n=>(e=>{const n=`${e.serverUrl}/h5Api/nuBaseInfo/list`;fetch(n).then((e=>e.json())).then((e=>{x.value=[...e.result]})),t({key:"serverUrl",data:{url:e.serverUrl}});const o={openId:y.openid,serverUrl:e.serverUrl};console.log("???/",o),fetch("https://www.focusnu.com/nursing-unit/h5Api/nuBizAdvisoryInfo/editNuBizAdvisoryInfo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then((e=>e.json())).then((e=>{console.log("???",e)})).catch((e=>{console.error("请求失败:",e)}))})(e)},{default:s((()=>[i(r(e.departName),1)])),_:2},1032,["onClick"]),d(m,{style:{width:"60rpx",height:"60rpx"},src:`https://www.focusnu.com/nursing-unit/sys/common/static/${e.picUrl}`},null,8,["src"])])),_:2},1024)))),128)),(c(!0),l(u,null,p(x.value,((e,n)=>(c(),o(h,{key:n,onClick:v},{default:s((()=>[d(h,{style:{"font-size":"30rpx","margin-top":"10rpx","font-weight":"700"}},{default:s((()=>[i(r(e.nuName),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1})}}},[["__scopeId","data-v-4644647c"]]);export{y as default};
|