|
@@ -101,14 +101,80 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
"use strict";
|
|
|
-
|
|
|
+/* WEBPACK VAR INJECTION */(function(uni) {
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
value: true
|
|
|
});
|
|
|
exports.default = void 0;
|
|
|
-var _default = {};
|
|
|
+var _default = {
|
|
|
+ data: function data() {
|
|
|
+ return {};
|
|
|
+ },
|
|
|
+ onLoad: function onLoad() {},
|
|
|
+ onShow: function onShow() {},
|
|
|
+ onLaunch: function onLaunch() {
|
|
|
+ var that = this;
|
|
|
+ that.checkVersion();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 检查版本
|
|
|
+ checkVersion: function checkVersion() {
|
|
|
+ var _this = this;
|
|
|
+ var that = this;
|
|
|
+ plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) {
|
|
|
+ uni.request({
|
|
|
+ url: "".concat(that.$config.serverUrl, "/files/project/appVersion.json"),
|
|
|
+ method: 'GET',
|
|
|
+ success: function success(res) {
|
|
|
+ if (wgtinfo.version === res.data.version) return;
|
|
|
+ uni.showModal({
|
|
|
+ title: '更新',
|
|
|
+ content: "有新版本,是否下载?",
|
|
|
+ success: function success(oneres) {
|
|
|
+ if (oneres.confirm) {
|
|
|
+ // 下载app
|
|
|
+ _this.toUpdateAPK(res.data.url);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ toUpdateAPK: function toUpdateAPK(url) {
|
|
|
+ if (!url) return;
|
|
|
+ uni.showLoading({
|
|
|
+ title: '更新中……',
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ uni.downloadFile({
|
|
|
+ url: url,
|
|
|
+ success: function success(res) {
|
|
|
+ uni.hideLoading();
|
|
|
+ if (res.statusCode == 200) {
|
|
|
+ uni.showModal({
|
|
|
+ content: '更新成功,确定现在重启吗?',
|
|
|
+ confirmText: '重启',
|
|
|
+ confirmColor: '#EE8F57',
|
|
|
+ success: function success(modalRes) {
|
|
|
+ if (modalRes.confirm) {
|
|
|
+ plus.runtime.install(res.tempFilePath, {
|
|
|
+ force: true
|
|
|
+ }, function (res) {
|
|
|
+ plus.runtime.restart();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
exports.default = _default;
|
|
|
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
|
|
|
|
|
|
/***/ }),
|
|
|
|