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

2 lines
2.7 KiB
JavaScript

import{l as e,r as n,c as o,w as s,s as t,i as a,o as i,b as r,t as c,h as l,j as u,F as p,a as d,f as h,g as f}from"./index-BwwWwpov.js";import{o as m}from"./uni-app.es.CdisLe7k.js";import{u as w}from"./useWeChatAuth.BbPcLRMD.js";import{_ as g}from"./_plugin-vue_export-helper.BCo6x5W8.js";const y=g({__name:"callback",setup(g){w();const y=e({name:"",openid:""}),v=()=>{console.log("???"),h({url:"/pages/pay/index"})},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),_()}))},x=n([]),_=()=>{fetch("https://www.focusnu.com/nursing-unit/sys/sysDepart/queryInstitutionsList").then((e=>e.json())).then((e=>{x.value=[...e],console.log("机构打印",x.value)}))},j=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.nickname,y.openid=e.openid,t({key:"openid",data:{openid:e.openid}}),I()})).catch((e=>{console.error("❌ 获取用户信息失败:",e)}))})(o.code)})),(e,n)=>{const h=a,m=f;return i(),o(h,{class:"callback-container"},{default:s((()=>[r(" 回调成功"+c(y.name)+c(y.openid)+" ",1),(i(!0),l(p,null,u(x.value,((e,n)=>(i(),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=>{j.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((()=>[r(c(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)),(i(!0),l(p,null,u(j.value,((e,n)=>(i(),o(h,{key:n,onClick:v},{default:s((()=>[d(h,{style:{"font-size":"30rpx","margin-top":"10rpx","font-weight":"700"}},{default:s((()=>[r(c(e.nuName),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1})}}},[["__scopeId","data-v-0b73e663"]]);export{y as default};