login.4c93aa6a.js 588 字节
import{u as e,y as o,ao as s,ap as a}from"./index-831b0644.js";const i=e();function n(){const e=()=>new Promise(((e,o)=>{a({provider:"weixin",success:o=>{e(o.code)},fail:e=>{o(e)}})})),n=e=>new Promise(((o,s)=>{uni.getUserInfo({provider:"weixin",withCredentials:!0,success:s=>{o({code:e,encryptedData:s.encryptedData,iv:s.iv})},fail:e=>{s(e)}})})),t=async a=>{try{const i=await e(),t=await n(i);console.log(i,t),a.code&&a.encryptedData&&a.iv&&o.$api.user.userLogin(a).then((e=>{1==e.code&&s({delta:arguments})}))}catch(t){console.error(t),i.setToken("")}};return{login:t}}export{n as u};