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