111
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
i[f].name &&
|
||||
i[f].value &&
|
||||
((c += i[f].name + "=" + i[f].value), f < i.length - 1 && (c += "&"));
|
||||
return r(c + (n = n || getApp().siteInfo.token));
|
||||
return r(c + (n = n || wx.getStorageSync("userInfo").sessionid));
|
||||
}
|
||||
var _typeof =
|
||||
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator
|
||||
@@ -79,14 +79,9 @@
|
||||
},
|
||||
url: function (e, t) {
|
||||
var n = getApp(),
|
||||
a =
|
||||
n.siteInfo.siteroot + "?from=wxapp&";
|
||||
a = n.siteInfo.siteroot + "?";
|
||||
if (
|
||||
(e &&
|
||||
((e = e.split("/"))[0] && (a += "c=" + e[0] + "&"),
|
||||
e[1] && (a += "a=" + e[1] + "&"),
|
||||
e[2] && (a += "do=" + e[2] + "&")),
|
||||
t && "object" === (void 0 === t ? "undefined" : _typeof(t)))
|
||||
(e && ((e = e.split("/"))[0] && (a += "c=" + e[0] + "&"), e[1] && (a += "a=" + e[1] + "&"), e[2] && (a += "do=" + e[2] + "&")), t && "object" === (void 0 === t ? "undefined" : _typeof(t)))
|
||||
)
|
||||
for (var r in t)
|
||||
r && t.hasOwnProperty(r) && t[r] && (a += r + "=" + t[r] + "&");
|
||||
@@ -102,31 +97,11 @@
|
||||
a = getApp();
|
||||
((e = e || {}).cachetime = e.cachetime ? e.cachetime : 0),
|
||||
(e.showLoading = void 0 === e.showLoading || e.showLoading);
|
||||
var r = wx.getStorageSync("userInfo").sessionid,
|
||||
i = e.url;
|
||||
if (
|
||||
(-1 == i.indexOf("http://") &&
|
||||
-1 == i.indexOf("https://") &&
|
||||
(i = util.url(i)),
|
||||
getUrlParam(i, "state") ||
|
||||
(e.data && e.data.state) ||
|
||||
!r ||
|
||||
(i = i + "&state=we7sid-" + r),
|
||||
!e.data || !e.data.m)
|
||||
) {
|
||||
var o = getCurrentPages();
|
||||
o.length &&
|
||||
(o = o[getCurrentPages().length - 1]) &&
|
||||
o.__route__ &&
|
||||
(i += "&m=monai_market");
|
||||
}
|
||||
var i = e.url;
|
||||
if ((-1 == i.indexOf("http://") && -1 == i.indexOf("https://") && (i = util.url(i)), !e.data || !e.data.m)) { }
|
||||
var s = getSign(i, e.data);
|
||||
if ((s && (i = i + "&sign=" + s), !i)) return !1;
|
||||
if (
|
||||
(wx.showNavigationBarLoading(),
|
||||
e.showLoading && util.showLoading(),
|
||||
e.cachetime)
|
||||
) {
|
||||
if ((wx.showNavigationBarLoading(), e.showLoading && util.showLoading(), e.cachetime)) {
|
||||
var u = n(i),
|
||||
c = wx.getStorageSync(u),
|
||||
f = Date.parse(new Date());
|
||||
@@ -144,23 +119,14 @@
|
||||
}
|
||||
}
|
||||
wx.request(
|
||||
(_defineProperty(
|
||||
(t = {
|
||||
url: i,
|
||||
data: e.data ? e.data : {},
|
||||
header: e.header ? e.header : {},
|
||||
method: e.method ? e.method : "GET",
|
||||
}),
|
||||
"header",
|
||||
{ "content-type": "application/json" }
|
||||
(_defineProperty((t = { url: i, data: e.data ? e.data : {}, header: e.header ? e.header : {}, method: e.method ? e.method : "GET", }),
|
||||
"header", { "content-type": "application/json", "token": wx.getStorageSync("userInfo").sessionid }
|
||||
),
|
||||
_defineProperty(t, "success", function (t) {
|
||||
if (
|
||||
(wx.hideNavigationBarLoading(), wx.hideLoading(), t.data.code)
|
||||
) {
|
||||
if ("401" == t.data.code)
|
||||
return (
|
||||
wx.setStorageSync("userInfo", ""),
|
||||
|
||||
if ((wx.hideNavigationBarLoading(), wx.hideLoading(), t.data.code !== 200)) {
|
||||
if (401 == t.data.code)
|
||||
return (wx.setStorageSync("userInfo", ""),
|
||||
void util.getUserInfo(function () {
|
||||
util.request(e);
|
||||
})
|
||||
@@ -172,10 +138,7 @@
|
||||
else var n = "";
|
||||
a.util.message(t.data.message, n, "error");
|
||||
}
|
||||
} else if (
|
||||
(e.success && "function" == typeof e.success && e.success(t),
|
||||
e.cachetime)
|
||||
) {
|
||||
} else if ((e.success && "function" == typeof e.success && e.success(t), e.cachetime)) {
|
||||
var r = { data: t.data, expire: f + 1e3 * e.cachetime };
|
||||
wx.setStorageSync(u, r);
|
||||
}
|
||||
@@ -198,7 +161,7 @@
|
||||
t)
|
||||
);
|
||||
},
|
||||
getWe7User: function (e, t) {
|
||||
getXphpUser: function (e, t) {
|
||||
var n = wx.getStorageSync("userInfo") || {};
|
||||
util.request({
|
||||
url: "auth/session/openid",
|
||||
@@ -206,7 +169,7 @@
|
||||
cachetime: 0,
|
||||
showLoading: !1,
|
||||
success: function (t) {
|
||||
t.data.code == 200 || ((n.sessionid = t.data.data.sessionid), (n.memberInfo = t.data.data.userinfo), wx.setStorageSync("userInfo", n)),
|
||||
t.data.code == 200 && ((n.sessionid = t.data.data.sessionid), (n.memberInfo = t.data.data.userinfo), wx.setStorageSync("userInfo", n)),
|
||||
"function" == typeof e && e(n);
|
||||
},
|
||||
});
|
||||
@@ -224,7 +187,6 @@
|
||||
encryptedData: e.encryptedData,
|
||||
},
|
||||
method: "POST",
|
||||
header: { "content-type": "application/x-www-form-urlencoded" },
|
||||
cachetime: 0,
|
||||
success: function (e) {
|
||||
e.data.code == 200 ||
|
||||
@@ -253,7 +215,7 @@
|
||||
console.log("start login"),
|
||||
wx.login({
|
||||
success: function (n) {
|
||||
util.getWe7User(function (n) {
|
||||
util.getXphpUser(function (n) {
|
||||
t
|
||||
? util.upadteUser(t, function (t) {
|
||||
"function" == typeof e && e(t);
|
||||
@@ -275,23 +237,21 @@
|
||||
});
|
||||
},
|
||||
a = wx.getStorageSync("userInfo") || {};
|
||||
a.sessionid
|
||||
? util.checkSession({
|
||||
success: function () {
|
||||
t
|
||||
? util.upadteUser(t, function (t) {
|
||||
"function" == typeof e && e(t);
|
||||
})
|
||||
: "function" == typeof e && e(a);
|
||||
},
|
||||
fail: function () {
|
||||
(a.sessionid = ""),
|
||||
console.log("relogin"),
|
||||
wx.removeStorageSync("userInfo"),
|
||||
n();
|
||||
},
|
||||
})
|
||||
: n();
|
||||
a.sessionid ? util.checkSession({
|
||||
success: function () {
|
||||
t
|
||||
? util.upadteUser(t, function (t) {
|
||||
"function" == typeof e && e(t);
|
||||
})
|
||||
: "function" == typeof e && e(a);
|
||||
},
|
||||
fail: function () {
|
||||
(a.sessionid = ""),
|
||||
console.log("relogin"),
|
||||
wx.removeStorageSync("userInfo"),
|
||||
n();
|
||||
},
|
||||
}) : n();
|
||||
},
|
||||
navigateBack: function (e) {
|
||||
var t = e.delta ? e.delta : 1;
|
||||
|
@@ -27,7 +27,7 @@ var e;
|
||||
n ||
|
||||
(t = t.replace(
|
||||
/index.php\?/,
|
||||
"index.php?from=wxapp&state=we7sid-" + e.sessionid + "&"
|
||||
"index.php?token=" + e.sessionid + "&"
|
||||
));
|
||||
var a = getCurrentPages();
|
||||
a && (a = a[getCurrentPages().length - 1]), a.setData({ url: t });
|
||||
|
Reference in New Issue
Block a user