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