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