login.864dfc07.js
587 字节
import{u as e,v as o,P as s,ar as i}from"./index-8c02187a.js";const n=e();function a(){const e=()=>new Promise(((e,o)=>{i({provider:"weixin",success:o=>{e(o.code)},fail:e=>{o(e)}})})),a=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)}})})),r=async i=>{try{const n=await e(),r=await a(n);console.log(n,r),i.code&&i.encryptedData&&i.iv&&o.$api.user.userLogin(i).then((e=>{1==e.code&&s({delta:arguments})}))}catch(r){console.error(r),n.setToken("")}};return{login:r}}export{a as u};