|
@@ -3298,7 +3298,7 @@ function resolveLocaleChain(locale) {
|
|
|
|
|
|
|
|
/***/ }),
|
|
/***/ }),
|
|
|
|
|
|
|
|
-/***/ 220:
|
|
|
|
|
|
|
+/***/ 227:
|
|
|
/*!*********************************************************************************************************************************!*\
|
|
/*!*********************************************************************************************************************************!*\
|
|
|
!*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/common/relation.js ***!
|
|
!*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/common/relation.js ***!
|
|
|
\*********************************************************************************************************************************/
|
|
\*********************************************************************************************************************************/
|
|
@@ -3470,7 +3470,7 @@ function children(parent) {
|
|
|
|
|
|
|
|
/***/ }),
|
|
/***/ }),
|
|
|
|
|
|
|
|
-/***/ 221:
|
|
|
|
|
|
|
+/***/ 228:
|
|
|
/*!*********************************************************************************************************************************!*\
|
|
/*!*********************************************************************************************************************************!*\
|
|
|
!*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/l-painter/props.js ***!
|
|
!*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/l-painter/props.js ***!
|
|
|
\*********************************************************************************************************************************/
|
|
\*********************************************************************************************************************************/
|
|
@@ -3529,7 +3529,7 @@ exports.default = _default;
|
|
|
|
|
|
|
|
/***/ }),
|
|
/***/ }),
|
|
|
|
|
|
|
|
-/***/ 222:
|
|
|
|
|
|
|
+/***/ 229:
|
|
|
/*!*********************************************************************************************************************************!*\
|
|
/*!*********************************************************************************************************************************!*\
|
|
|
!*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/l-painter/utils.js ***!
|
|
!*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/l-painter/utils.js ***!
|
|
|
\*********************************************************************************************************************************/
|
|
\*********************************************************************************************************************************/
|
|
@@ -3819,7 +3819,23 @@ function getImageInfo(path, useCORS) {
|
|
|
|
|
|
|
|
/***/ }),
|
|
/***/ }),
|
|
|
|
|
|
|
|
-/***/ 223:
|
|
|
|
|
|
|
+/***/ 23:
|
|
|
|
|
+/*!***************************************************************!*\
|
|
|
|
|
+ !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
|
|
|
|
|
+ \***************************************************************/
|
|
|
|
|
+/*! no static exports found */
|
|
|
|
|
+/***/ (function(module, exports) {
|
|
|
|
|
+
|
|
|
|
|
+function _classCallCheck(instance, Constructor) {
|
|
|
|
|
+ if (!(instance instanceof Constructor)) {
|
|
|
|
|
+ throw new TypeError("Cannot call a class as a function");
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
|
+
|
|
|
|
|
+/***/ }),
|
|
|
|
|
+
|
|
|
|
|
+/***/ 230:
|
|
|
/*!***********************************************************************************************************************************!*\
|
|
/*!***********************************************************************************************************************************!*\
|
|
|
!*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/l-painter/painter.js ***!
|
|
!*** D:/zhongshuweilai/zswl.zip/zswl/code/charge_miniapp/charge_miniapp/uni_modules/lime-painter/components/l-painter/painter.js ***!
|
|
|
\***********************************************************************************************************************************/
|
|
\***********************************************************************************************************************************/
|
|
@@ -6192,22 +6208,6 @@ n.WEB == I && (window.Painter = Bt);
|
|
|
|
|
|
|
|
/***/ }),
|
|
/***/ }),
|
|
|
|
|
|
|
|
-/***/ 23:
|
|
|
|
|
-/*!***************************************************************!*\
|
|
|
|
|
- !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
|
|
|
|
|
- \***************************************************************/
|
|
|
|
|
-/*! no static exports found */
|
|
|
|
|
-/***/ (function(module, exports) {
|
|
|
|
|
-
|
|
|
|
|
-function _classCallCheck(instance, Constructor) {
|
|
|
|
|
- if (!(instance instanceof Constructor)) {
|
|
|
|
|
- throw new TypeError("Cannot call a class as a function");
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
|
|
|
-
|
|
|
|
|
-/***/ }),
|
|
|
|
|
-
|
|
|
|
|
/***/ 24:
|
|
/***/ 24:
|
|
|
/*!************************************************************!*\
|
|
/*!************************************************************!*\
|
|
|
!*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
|
|
!*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
|
|
@@ -12388,6 +12388,10 @@ var api = {};
|
|
|
// 标志位:控制登录提示弹窗只显示一次
|
|
// 标志位:控制登录提示弹窗只显示一次
|
|
|
var isLoginPromptShown = false;
|
|
var isLoginPromptShown = false;
|
|
|
|
|
|
|
|
|
|
+// 标志位:控制token刷新状态,防止重复刷新
|
|
|
|
|
+var isRefreshing = false;
|
|
|
|
|
+var failedQueue = [];
|
|
|
|
|
+
|
|
|
// 网络请求封装
|
|
// 网络请求封装
|
|
|
var Request = function Request(opts) {
|
|
var Request = function Request(opts) {
|
|
|
var originalComplete = opts.complete;
|
|
var originalComplete = opts.complete;
|
|
@@ -12498,8 +12502,8 @@ api.base = function (method, url, data, opts) {
|
|
|
_context.next = 25;
|
|
_context.next = 25;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- // 刷新成功,更新header中的token并重新请求
|
|
|
|
|
- options.header.token = getAccessToken();
|
|
|
|
|
|
|
+ // 刷新成功,更新header中的Authorization并重新请求
|
|
|
|
|
+ options.header.Authorization = "Bearer " + getAccessToken();
|
|
|
_context.prev = 13;
|
|
_context.prev = 13;
|
|
|
_context.next = 16;
|
|
_context.next = 16;
|
|
|
return Request(options);
|
|
return Request(options);
|
|
@@ -12518,7 +12522,7 @@ api.base = function (method, url, data, opts) {
|
|
|
case 25:
|
|
case 25:
|
|
|
// 刷新失败,执行登录
|
|
// 刷新失败,执行登录
|
|
|
// await api.login();
|
|
// await api.login();
|
|
|
- options.header.token = getAccessToken();
|
|
|
|
|
|
|
+ options.header.Authorization = "Bearer " + getAccessToken();
|
|
|
_context.prev = 26;
|
|
_context.prev = 26;
|
|
|
_context.next = 29;
|
|
_context.next = 29;
|
|
|
return Request(options);
|
|
return Request(options);
|
|
@@ -12559,12 +12563,13 @@ api.base = function (method, url, data, opts) {
|
|
|
};
|
|
};
|
|
|
}()).catch( /*#__PURE__*/function () {
|
|
}()).catch( /*#__PURE__*/function () {
|
|
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(err) {
|
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(err) {
|
|
|
- var refreshResult, db, currentPage, currentRoute;
|
|
|
|
|
|
|
+ var _err$data;
|
|
|
|
|
+ var refreshResult, db, currentPage, currentRoute, _err$data2, _err$data3, _err$data4;
|
|
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
|
while (1) {
|
|
while (1) {
|
|
|
switch (_context2.prev = _context2.next) {
|
|
switch (_context2.prev = _context2.next) {
|
|
|
case 0:
|
|
case 0:
|
|
|
- if (!(err.data.code == "A0230")) {
|
|
|
|
|
|
|
+ if (!(((_err$data = err.data) === null || _err$data === void 0 ? void 0 : _err$data.code) == "A0230")) {
|
|
|
_context2.next = 29;
|
|
_context2.next = 29;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -12577,8 +12582,8 @@ api.base = function (method, url, data, opts) {
|
|
|
_context2.next = 19;
|
|
_context2.next = 19;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- // 刷新成功,更新header中的token并重新请求
|
|
|
|
|
- options.header.token = getAccessToken();
|
|
|
|
|
|
|
+ // 刷新成功,更新header中的Authorization并重新请求
|
|
|
|
|
+ options.header.Authorization = "Bearer " + getAccessToken();
|
|
|
_context2.prev = 7;
|
|
_context2.prev = 7;
|
|
|
_context2.next = 10;
|
|
_context2.next = 10;
|
|
|
return Request(options);
|
|
return Request(options);
|
|
@@ -12600,13 +12605,13 @@ api.base = function (method, url, data, opts) {
|
|
|
currentRoute = currentPage ? currentPage.route : "";
|
|
currentRoute = currentPage ? currentPage.route : "";
|
|
|
if (currentRoute === "pages/index/index") {
|
|
if (currentRoute === "pages/index/index") {
|
|
|
// 在首页时只显示弱提示
|
|
// 在首页时只显示弱提示
|
|
|
- _app.default.popup.toast("".concat(err.data.msg));
|
|
|
|
|
|
|
+ _app.default.popup.toast("".concat((_err$data2 = err.data) === null || _err$data2 === void 0 ? void 0 : _err$data2.msg));
|
|
|
} else {
|
|
} else {
|
|
|
// 非首页时显示登录确认框
|
|
// 非首页时显示登录确认框
|
|
|
if (!isLoginPromptShown) {
|
|
if (!isLoginPromptShown) {
|
|
|
isLoginPromptShown = true;
|
|
isLoginPromptShown = true;
|
|
|
// 清除登录缓存
|
|
// 清除登录缓存
|
|
|
- _app.default.popup.confirm("".concat(err.data.msg, ",\u70B9\u51FB\u786E\u5B9A\u53BB\u767B\u5F55"), "提示", {
|
|
|
|
|
|
|
+ _app.default.popup.confirm("".concat((_err$data3 = err.data) === null || _err$data3 === void 0 ? void 0 : _err$data3.msg, ",\u70B9\u51FB\u786E\u5B9A\u53BB\u767B\u5F55"), "提示", {
|
|
|
showCancel: true
|
|
showCancel: true
|
|
|
}).then(function (confirmed) {
|
|
}).then(function (confirmed) {
|
|
|
isLoginPromptShown = false;
|
|
isLoginPromptShown = false;
|
|
@@ -12630,10 +12635,12 @@ api.base = function (method, url, data, opts) {
|
|
|
_context2.next = 30;
|
|
_context2.next = 30;
|
|
|
break;
|
|
break;
|
|
|
case 29:
|
|
case 29:
|
|
|
- _app.default.popup.alert("\u670D\u52A1\u5668\u54CD\u5E94\u5931\u8D25\r\n".concat(err.data.msg), "数据请求");
|
|
|
|
|
|
|
+ _app.default.popup.alert("\u670D\u52A1\u5668\u54CD\u5E94\u5931\u8D25\r\n".concat((_err$data4 = err.data) === null || _err$data4 === void 0 ? void 0 : _err$data4.msg), "数据请求");
|
|
|
case 30:
|
|
case 30:
|
|
|
/*失败处理,此处为非200状态码引起的错误*/
|
|
/*失败处理,此处为非200状态码引起的错误*/
|
|
|
- options.hideLoading();
|
|
|
|
|
|
|
+ if (options.loading && typeof options.hideLoading == "function") {
|
|
|
|
|
+ options.hideLoading();
|
|
|
|
|
+ }
|
|
|
case 31:
|
|
case 31:
|
|
|
case "end":
|
|
case "end":
|
|
|
return _context2.stop();
|
|
return _context2.stop();
|
|
@@ -12663,24 +12670,51 @@ var getAccessToken = function getAccessToken() {
|
|
|
return uni.getStorageSync(_config.default.keyname.accessToken);
|
|
return uni.getStorageSync(_config.default.keyname.accessToken);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// 处理请求队列
|
|
|
|
|
+var processQueue = function processQueue(error) {
|
|
|
|
|
+ var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
|
|
|
+ failedQueue.forEach(function (prom) {
|
|
|
|
|
+ if (error) {
|
|
|
|
|
+ prom.reject(error);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ prom.resolve(token);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ failedQueue = [];
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 新增:刷新token的方法
|
|
// 新增:刷新token的方法
|
|
|
var refreshToken = /*#__PURE__*/function () {
|
|
var refreshToken = /*#__PURE__*/function () {
|
|
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
|
- var refreshToken, res;
|
|
|
|
|
|
|
+ var refreshToken, res, newToken;
|
|
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
|
while (1) {
|
|
while (1) {
|
|
|
switch (_context4.prev = _context4.next) {
|
|
switch (_context4.prev = _context4.next) {
|
|
|
case 0:
|
|
case 0:
|
|
|
|
|
+ if (!isRefreshing) {
|
|
|
|
|
+ _context4.next = 2;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ return _context4.abrupt("return", new Promise(function (resolve, reject) {
|
|
|
|
|
+ failedQueue.push({
|
|
|
|
|
+ resolve: resolve,
|
|
|
|
|
+ reject: reject
|
|
|
|
|
+ });
|
|
|
|
|
+ }));
|
|
|
|
|
+ case 2:
|
|
|
|
|
+ isRefreshing = true;
|
|
|
refreshToken = uni.getStorageSync(_config.default.keyname.refreshToken);
|
|
refreshToken = uni.getStorageSync(_config.default.keyname.refreshToken);
|
|
|
console.log("刷新token", refreshToken);
|
|
console.log("刷新token", refreshToken);
|
|
|
if (refreshToken) {
|
|
if (refreshToken) {
|
|
|
- _context4.next = 4;
|
|
|
|
|
|
|
+ _context4.next = 9;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
+ isRefreshing = false;
|
|
|
|
|
+ processQueue(new Error("No refresh token available"));
|
|
|
return _context4.abrupt("return", false);
|
|
return _context4.abrupt("return", false);
|
|
|
- case 4:
|
|
|
|
|
- _context4.prev = 4;
|
|
|
|
|
- _context4.next = 7;
|
|
|
|
|
|
|
+ case 9:
|
|
|
|
|
+ _context4.prev = 9;
|
|
|
|
|
+ _context4.next = 12;
|
|
|
return Request({
|
|
return Request({
|
|
|
url: pathJoin(_config.default.url.request, _config.default.api.refreshToken),
|
|
url: pathJoin(_config.default.url.request, _config.default.api.refreshToken),
|
|
|
method: "post",
|
|
method: "post",
|
|
@@ -12691,27 +12725,38 @@ var refreshToken = /*#__PURE__*/function () {
|
|
|
"content-type": "application/json"
|
|
"content-type": "application/json"
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- case 7:
|
|
|
|
|
|
|
+ case 12:
|
|
|
res = _context4.sent;
|
|
res = _context4.sent;
|
|
|
if (!(res.code === "00000")) {
|
|
if (!(res.code === "00000")) {
|
|
|
- _context4.next = 12;
|
|
|
|
|
|
|
+ _context4.next = 22;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
uni.setStorageSync(_config.default.keyname.accessToken, res.data.accessToken);
|
|
uni.setStorageSync(_config.default.keyname.accessToken, res.data.accessToken);
|
|
|
uni.setStorageSync(_config.default.keyname.refreshToken, res.data.refreshToken);
|
|
uni.setStorageSync(_config.default.keyname.refreshToken, res.data.refreshToken);
|
|
|
|
|
+ newToken = getAccessToken();
|
|
|
|
|
+ isRefreshing = false;
|
|
|
|
|
+ processQueue(null, newToken);
|
|
|
return _context4.abrupt("return", true);
|
|
return _context4.abrupt("return", true);
|
|
|
- case 12:
|
|
|
|
|
|
|
+ case 22:
|
|
|
|
|
+ isRefreshing = false;
|
|
|
|
|
+ processQueue(new Error("Token refresh failed"));
|
|
|
return _context4.abrupt("return", false);
|
|
return _context4.abrupt("return", false);
|
|
|
- case 15:
|
|
|
|
|
- _context4.prev = 15;
|
|
|
|
|
- _context4.t0 = _context4["catch"](4);
|
|
|
|
|
|
|
+ case 25:
|
|
|
|
|
+ _context4.next = 33;
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 27:
|
|
|
|
|
+ _context4.prev = 27;
|
|
|
|
|
+ _context4.t0 = _context4["catch"](9);
|
|
|
|
|
+ console.error("Token refresh error:", _context4.t0);
|
|
|
|
|
+ isRefreshing = false;
|
|
|
|
|
+ processQueue(_context4.t0);
|
|
|
return _context4.abrupt("return", false);
|
|
return _context4.abrupt("return", false);
|
|
|
- case 18:
|
|
|
|
|
|
|
+ case 33:
|
|
|
case "end":
|
|
case "end":
|
|
|
return _context4.stop();
|
|
return _context4.stop();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }, _callee4, null, [[4, 15]]);
|
|
|
|
|
|
|
+ }, _callee4, null, [[9, 27]]);
|
|
|
}));
|
|
}));
|
|
|
return function refreshToken() {
|
|
return function refreshToken() {
|
|
|
return _ref4.apply(this, arguments);
|
|
return _ref4.apply(this, arguments);
|
|
@@ -12811,6 +12856,25 @@ api.upload = function (file, opts) {
|
|
|
// 设置关闭LOADING的方法
|
|
// 设置关闭LOADING的方法
|
|
|
hideLoading: hideLoading
|
|
hideLoading: hideLoading
|
|
|
}, opts || {});
|
|
}, opts || {});
|
|
|
|
|
+ uni.uploadFile(_objectSpread(_objectSpread({}, options), {}, {
|
|
|
|
|
+ success: function success(res) {
|
|
|
|
|
+ if (options.loading && typeof options.hideLoading == "function") {
|
|
|
|
|
+ options.hideLoading();
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ var data = JSON.parse(res.data);
|
|
|
|
|
+ resolve(data);
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ resolve(res);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: function fail(err) {
|
|
|
|
|
+ if (options.loading && typeof options.hideLoading == "function") {
|
|
|
|
|
+ options.hideLoading();
|
|
|
|
|
+ }
|
|
|
|
|
+ reject(err);
|
|
|
|
|
+ }
|
|
|
|
|
+ }));
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|