82 lines
2.4 KiB
JavaScript
82 lines
2.4 KiB
JavaScript
var e = require("../common/vendor.js"),
|
|
t = require("../constant/index.js"),
|
|
n = function () {
|
|
e.index.hideLoading();
|
|
};
|
|
(exports.checkForUpdate = function () {
|
|
var t = e.index.getUpdateManager();
|
|
t.onUpdateReady(function () {
|
|
e.index.showModal({
|
|
title: "更新提示",
|
|
content: "新版本已经准备好,是否重启应用?",
|
|
success: function (e) {
|
|
e.confirm && t.applyUpdate();
|
|
},
|
|
});
|
|
});
|
|
}),
|
|
(exports.choosePhoto = function () {
|
|
return e.index
|
|
.showActionSheet({
|
|
title: "请拍摄或上传行驶证",
|
|
itemList: ["拍摄行驶证", "从相册选择"],
|
|
})
|
|
.then(function (t) {
|
|
var n = t.tapIndex;
|
|
return (function () {
|
|
return e.index
|
|
.chooseMedia({
|
|
count: 1,
|
|
mediaType: ["image"],
|
|
sourceType: [0 === n ? "camera" : "album"],
|
|
})
|
|
.then(function (e) {
|
|
return e.tempFiles[0].tempFilePath;
|
|
});
|
|
})();
|
|
});
|
|
}),
|
|
(exports.decrypt = function (n) {
|
|
var o = e.CryptoJS.enc.Utf8.parse(t.decryptKey),
|
|
r = e.CryptoJS.enc.Utf8.parse(t.decryptIV),
|
|
i = e.CryptoJS.enc.Base64.parse(n),
|
|
c = e.CryptoJS.enc.Base64.stringify(i),
|
|
a = e.CryptoJS.AES.decrypt(c, o, {
|
|
iv: r,
|
|
mode: e.CryptoJS.mode.CBC,
|
|
padding: e.CryptoJS.pad.Pkcs7,
|
|
});
|
|
return JSON.parse(a.toString(e.CryptoJS.enc.Utf8));
|
|
}),
|
|
(exports.encrypt = function (n, o) {
|
|
var r = {};
|
|
e._.isEmpty(n) || (r = e._.cloneDeep(n)), (r.channel = o);
|
|
var i = {};
|
|
Object.keys(r)
|
|
.sort()
|
|
.forEach(function (e) {
|
|
i[e] = r[e];
|
|
});
|
|
var c = [];
|
|
for (var a in i)
|
|
i.hasOwnProperty(a) &&
|
|
c.push(
|
|
"".concat(encodeURIComponent(a), "=").concat(encodeURIComponent(i[a]))
|
|
);
|
|
var p = c.join("&") + t.encryptKey,
|
|
s = e.CryptoJS.MD5(p).toString();
|
|
return e._.assign(n, { secret: s });
|
|
}),
|
|
(exports.hideLoading = n),
|
|
(exports.showLoading = function () {
|
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";
|
|
e.index.showLoading({ title: t, mask: !0 });
|
|
}),
|
|
(exports.showToast = function () {
|
|
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";
|
|
n(), e.index.showToast({ icon: "none", title: t });
|
|
}),
|
|
(exports.vibrate = function () {
|
|
e.wx$1.vibrateShort({ type: "light" });
|
|
});
|