Files
tk-mini-program/unpackage/dist/build/mp-weixin/components/request.js
pengxiaolong 7116e57fc3 优化
2025-07-21 22:10:59 +08:00

2 lines
1.1 KiB
JavaScript

"use strict";const e=require("../common/vendor.js"),t=require("./addPrefixToHeaderIcon.js");exports.request=function(n){const{url:r,data:a,method:o,header:s,userInfo:i}=n,g="https://pk.zhukeping.com/"+r;return new Promise(i?(n,r)=>{e.index.getStorage({key:"userinfo",success:i=>{i.data?i.data.nickName?e.index.request({url:g,data:a,method:o,header:s,success:function(e){console.log("请求成功",e),n(t.addPrefixToHeaderIcon(e.data))},fail:function(e){r(e)}}):(e.index.setStorageSync("lastPage",getCurrentPages()[getCurrentPages().length-1].route),e.index.reLaunch({url:"/pages/UserInformation/UserInformation"})):(e.index.setStorageSync("lastPage",getCurrentPages()[getCurrentPages().length-1].route),e.index.navigateTo({url:"/pages/login/login"}))},fail:function(t){e.index.setStorageSync("lastPage",getCurrentPages()[getCurrentPages().length-1].route),e.index.navigateTo({url:"/pages/login/login"}),r(t)}})}:(n,r)=>{e.index.request({url:g,data:a,method:o,header:s,success:function(e){console.log("请求成功",e),n(t.addPrefixToHeaderIcon(e.data))},fail:function(e){r(e)}})})};