request.js
484 字节
"use strict";const a=require("../common/vendor.js"),d="https://dajiankang.y.broing.cn",c=t=>new Promise((o,n)=>{a.index.request({url:d+t.url,method:t.method||"GET",data:t.data||{},header:{token:a.index.getStorageSync("token")||""},success:e=>{console.log(e,a.index.getStorageSync("token")),e.data.code==1?o(e.data.data):(e.data.code==401&&(a.index.navigateTo({url:"/pages/login/login"}),a.index.clearStorageSync()),n(e.data.msg))},fail:e=>{console.log(e),n(e)}})});exports.request=c;