Commit 75610d8b by 张杰

增加测试地址

增加测试地址
1 parent 99a08d34
...@@ -9,11 +9,11 @@ function t(t, e, a, i, c, p, s, u) { ...@@ -9,11 +9,11 @@ function t(t, e, a, i, c, p, s, u) {
method: i, method: i,
dataType: c, dataType: c,
responseType: p, responseType: p,
success: function(t) { success: function (t) {
n(t.header), 401 == t.statusCode ? wx.navigateTo({ n(t.header), 401 == t.statusCode ? wx.navigateTo({
url: "/pages/auth/login/login" url: "/pages/auth/login/login"
}) : 200 == t.statusCode ? s(t.data) : 412 == t.statusCode || 411 == t.statusCode ? wx.login({ }) : 200 == t.statusCode ? s(t.data) : 412 == t.statusCode || 411 == t.statusCode ? wx.login({
success: function(t) { success: function (t) {
l.globalData.code = t.code, wx.redirectTo({ l.globalData.code = t.code, wx.redirectTo({
url: "/pages/index/index" url: "/pages/index/index"
}); });
...@@ -22,32 +22,39 @@ function t(t, e, a, i, c, p, s, u) { ...@@ -22,32 +22,39 @@ function t(t, e, a, i, c, p, s, u) {
url: "/pages/login/index/index" url: "/pages/login/index/index"
}) : u && "function" == typeof u && u(); }) : u && "function" == typeof u && u();
}, },
fail: function(t) { fail: function (t) {
console.log("error:" + JSON.stringify(t)), u && "function" == typeof u && u(); console.log("error:" + JSON.stringify(t)), u && "function" == typeof u && u();
}, },
complete: function(t) { complete: function (t) {
wx.hideNavigationBarLoading(); wx.hideNavigationBarLoading();
} }
}); });
} }
function n(t) { function n(t) {
var n = wx.getStorageSync(e), o = t["Set-Cookie"]; var n = wx.getStorageSync(e),
o = t["Set-Cookie"];
if (o) { if (o) {
var a = new RegExp(e + "=([^;]*)", "ig"); var a = new RegExp(e + "=([^;]*)", "ig");
(n = o.match(a) ? o.match(a)[0].substr(e.length + 1) : null) && wx.setStorageSync(e, n); (n = o.match(a) ? o.match(a)[0].substr(e.length + 1) : null) && wx.setStorageSync(e, n);
} }
return n && (t.Cookie = [ e, "=", n ].join("")), t; return n && (t.Cookie = [e, "=", n].join("")), t;
} }
var o = "https://gps.cgacar.com", e = "DJ_S_"; //测试环境
var o = "https://dj.test.glsx.com.cn";
// 正式环境
//var o = "https://gps.cgacar.com";
var e = "DJ_S_";
getApp(); getApp();
module.exports = { module.exports = {
domain: o, domain: o,
req: t, req: t,
uploadMedia: function(t, n, e) { uploadMedia: function (t, n, e) {
wx.uploadFile({ wx.uploadFile({
url: o + "/web-dj-weapp-mp/" + t, url: o + "/web-dj-weapp-mp/" + t,
filePath: n, filePath: n,
...@@ -55,10 +62,10 @@ module.exports = { ...@@ -55,10 +62,10 @@ module.exports = {
formData: { formData: {
fileCategory: "AG" fileCategory: "AG"
}, },
success: function(t) { success: function (t) {
e(JSON.parse(t.data)); e(JSON.parse(t.data));
}, },
fail: function(t) { fail: function (t) {
console.log(t), wx.showToast({ console.log(t), wx.showToast({
title: t, title: t,
icon: "none" icon: "none"
...@@ -66,41 +73,41 @@ module.exports = { ...@@ -66,41 +73,41 @@ module.exports = {
} }
}); });
}, },
getSessionId: function() { getSessionId: function () {
return wx.getStorageSync(e); return wx.getStorageSync(e);
}, },
jscodeLogin: function(n, o, e) { jscodeLogin: function (n, o, e) {
t("/web-dj-weapp-mp/jscode/login", { t("/web-dj-weapp-mp/jscode/login", {
code: n, code: n,
appId: o appId: o
}, {}, "GET", "json", "text", e); }, {}, "GET", "json", "text", e);
}, },
authUserInfo: function(n, o, e) { authUserInfo: function (n, o, e) {
t("/web-dj-weapp-mp/auth/userinfo", JSON.stringify(n), { t("/web-dj-weapp-mp/auth/userinfo", JSON.stringify(n), {
"content-type": "application/json" "content-type": "application/json"
}, "POST", "json", "text", o, e); }, "POST", "json", "text", o, e);
}, },
authPhone: function(n, o) { authPhone: function (n, o) {
t("/web-dj-weapp-mp/auth/phone", JSON.stringify(n), { t("/web-dj-weapp-mp/auth/phone", JSON.stringify(n), {
"content-type": "application/json" "content-type": "application/json"
}, "POST", "json", "text", o); }, "POST", "json", "text", o);
}, },
authAccount: function(n, o) { authAccount: function (n, o) {
t("/web-dj-weapp-mp/auth/account", JSON.stringify(n), { t("/web-dj-weapp-mp/auth/account", JSON.stringify(n), {
"content-type": "application/json" "content-type": "application/json"
}, "POST", "json", "text", o); }, "POST", "json", "text", o);
}, },
choiceAccountLogin: function(n, o) { choiceAccountLogin: function (n, o) {
t("/web-dj-weapp-mp/choice/account/login", JSON.stringify(n), { t("/web-dj-weapp-mp/choice/account/login", JSON.stringify(n), {
"content-type": "application/json" "content-type": "application/json"
}, "POST", "json", "text", o); }, "POST", "json", "text", o);
}, },
logout: function(n) { logout: function (n) {
t("/web-dj-weapp-mp/logout", null, { t("/web-dj-weapp-mp/logout", null, {
"content-type": "application/json" "content-type": "application/json"
}, "POST", "json", "text", n); }, "POST", "json", "text", n);
}, },
checkLogin: function(n) { checkLogin: function (n) {
t("/web-dj-weapp-mp/login/check", null, { t("/web-dj-weapp-mp/login/check", null, {
"content-type": "application/json" "content-type": "application/json"
}, "POST", "json", "text", n); }, "POST", "json", "text", n);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!