login.a1c122ce.js 588 字节
import{u as e,y as n,am as o,an as s}from"./index-f4fdb118.js";const a=e();function i(){const e=()=>new Promise(((e,n)=>{s({provider:"weixin",success:n=>{e(n.code)},fail:e=>{n(e)}})})),i=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 a=await e(),t=await i(a);console.log(a,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),a.setToken("")}};return{login:t}}export{i as u};