打包地址
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
function auth() {
|
||||
return new Promise((resolve, reject) => {
|
||||
common_vendor.index.login({
|
||||
provider: "weixin",
|
||||
//使用微信登录
|
||||
onlyAuthorize: true,
|
||||
//不弹出授权页面,直接进入微信登录流程
|
||||
success(res) {
|
||||
if (res.errMsg == "login:ok") {
|
||||
resolve(res.code);
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: res.errMsg,
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.auth = auth;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/auth.js.map
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
let BASE_URL = "";
|
||||
{
|
||||
BASE_URL = "https://dev-casedata.igandan.com/api";
|
||||
}
|
||||
const BASE_URL$1 = BASE_URL;
|
||||
exports.BASE_URL = BASE_URL$1;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/config.js.map
|
||||
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/cookie.js.map
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
const utils_pageUrl = require("./pageUrl.js");
|
||||
function navTo(obj) {
|
||||
let token = "";
|
||||
{
|
||||
const { envVersion } = common_vendor.index.getAccountInfoSync().miniProgram;
|
||||
if (envVersion == "release") {
|
||||
token = common_vendor.index.getStorageSync("AUTH_TOKEN_CASEDATA");
|
||||
} else {
|
||||
token = common_vendor.index.getStorageSync("DEV_AUTH_TOKEN_CASEDATA");
|
||||
}
|
||||
}
|
||||
if (!token) {
|
||||
let page_url = utils_pageUrl.pageUrl();
|
||||
common_vendor.index.setStorageSync("redirectUrl", page_url);
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/login/login?redirectUrl=has"
|
||||
});
|
||||
} else {
|
||||
{
|
||||
const pages = getCurrentPages();
|
||||
let len = pages.length;
|
||||
common_vendor.index.__f__("log", "at utils/navTo.js:31", len);
|
||||
if (len >= 10) {
|
||||
common_vendor.index.redirectTo(obj);
|
||||
} else {
|
||||
common_vendor.index.navigateTo(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.navTo = navTo;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/navTo.js.map
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
function pageUrl() {
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
const url = currentPage.route;
|
||||
const options = currentPage.options;
|
||||
let fullUrl = url + "?";
|
||||
for (let key in options) {
|
||||
fullUrl += `${key}=${options[key]}&`;
|
||||
}
|
||||
fullUrl = fullUrl.substring(0, fullUrl.length - 1);
|
||||
return fullUrl;
|
||||
}
|
||||
exports.pageUrl = pageUrl;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/pageUrl.js.map
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
const utils_config = require("./config.js");
|
||||
const utils_pageUrl = require("./pageUrl.js");
|
||||
const request = (url, data = {}, method = "post", loading = false, contentType = "application/x-www-form-urlencoded") => {
|
||||
if (loading) {
|
||||
common_vendor.index.showLoading({
|
||||
title: "加载中",
|
||||
mask: true
|
||||
});
|
||||
}
|
||||
let token = "";
|
||||
{
|
||||
const { envVersion } = common_vendor.index.getAccountInfoSync().miniProgram;
|
||||
if (envVersion == "release") {
|
||||
token = common_vendor.index.getStorageSync("AUTH_TOKEN_CASEDATA");
|
||||
} else {
|
||||
token = common_vendor.index.getStorageSync("DEV_AUTH_TOKEN_CASEDATA");
|
||||
}
|
||||
}
|
||||
let header = {
|
||||
"content-type": contentType,
|
||||
"Authorization": "Bearer " + token
|
||||
};
|
||||
return new Promise(function(e, n) {
|
||||
let timestamp = Date.now();
|
||||
common_vendor.index.request({
|
||||
data,
|
||||
url: url.indexOf("http") != -1 ? url : encodeURI(utils_config.BASE_URL + url + "?timestamp=" + timestamp),
|
||||
method,
|
||||
sslVerify: false,
|
||||
header: url.indexOf("/manager/getSignature4bing") == -1 ? header : {},
|
||||
timeout: 1e4,
|
||||
success: function(res) {
|
||||
var Authorization_token = res.header.Authorization;
|
||||
if (Authorization_token) {
|
||||
{
|
||||
common_vendor.index.setStorageSync("DEV_AUTH_TOKEN_CASEDATA", Authorization_token);
|
||||
}
|
||||
}
|
||||
if (loading) {
|
||||
common_vendor.index.hideLoading();
|
||||
}
|
||||
if (res.data.code == 200) {
|
||||
e(res);
|
||||
} else if (res.data.code == 401 || res.data.code == 403 || res.data.code == 405 || res.data.code == 406) {
|
||||
{
|
||||
let freeList = ["/login/wechat/mobile", "/code/phone", "/login/mobile_login", "/index", "/user/check"];
|
||||
if (freeList.indexOf(url) == -1) {
|
||||
let page_url = utils_pageUrl.pageUrl();
|
||||
common_vendor.index.setStorageSync("redirectUrl", page_url);
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/login/login?redirectUrl=has"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (res.data.code == 500) {
|
||||
n(res);
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: res.data.message,
|
||||
icon: "none"
|
||||
});
|
||||
n(res);
|
||||
}
|
||||
},
|
||||
fail: function(err) {
|
||||
"request:fail " === err.errMsg && msg("请求数据失败!"), n(err.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
exports.request = request;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/request.js.map
|
||||
Reference in New Issue
Block a user