"use strict";const e=require("../common/vendor.js"),t=require("../utils/fun.js"),o={development:"https://apidjk.jitujt.com",production:"https://apidjk.jitujt.com"};exports.http=({url:n,params:i,method:r})=>new Promise(((a,s)=>{let c=e.index.getStorageSync("Authorization")||"",d={Authorization:c,"Tenant-id":"134"};e.index.request({url:o.production+n,data:i||{},method:r||"POST",header:d,success:o=>{const n=o.data;if(401==n.code||401==o.statusCode)return e.index.removeStorageSync("Authorization"),e.index.removeStorageSync("userInfo"),e.index.showModal({title:"提示",content:(c?"登录失效":"你还未登录")+",是否前往登录?",success:function(t){t.confirm?e.index.navigateTo({url:"/pages/login/login"}):t.cancel&&(e.index.clearStorageSync(),console.log("用户点击取消"))}}),void s(n);0===n.code?a(n.data||null):(t.toast(n.msg),s(n))},fail:e=>{s(e)}})})),exports.proxyObj=o;
