officialAccount/unpackage/dist/build/web/assets/pages-index-callback.DlXgjR...

2 lines
2.7 KiB
JavaScript

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