|
|
|
@ -85,6 +85,7 @@ import { session } from '@/store/modules/session';
|
|
|
|
|
import { BasePage } from '@/components/base/page';
|
|
|
|
|
import { VForm } from 'vue/types/form';
|
|
|
|
|
import { Lang } from '@/i18n';
|
|
|
|
|
import { url } from '@/utils/url';
|
|
|
|
|
// import { any } from 'lodash/fp';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@ -138,21 +139,54 @@ export default class LoginPage extends BasePage {
|
|
|
|
|
this.$form.setRules(this.rules);
|
|
|
|
|
console.log('image', this.image);
|
|
|
|
|
}
|
|
|
|
|
Version: string = '1.0.0';
|
|
|
|
|
Version = '1.0.0';
|
|
|
|
|
async update() {
|
|
|
|
|
await session.QueryVersion();
|
|
|
|
|
if (this.Version != session.Version) {
|
|
|
|
|
await uni.downloadFile({
|
|
|
|
|
url: 'http://106.13.174.133:5210/HaierWMS.apk',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
console.log('res.statusCode', res.statusCode);
|
|
|
|
|
console.log('res.tempFilePath', res.tempFilePath);
|
|
|
|
|
//alert('版本更新啦!');
|
|
|
|
|
// 版本更新提示
|
|
|
|
|
uni.showModal({
|
|
|
|
|
//title: this.$t('message.updatePrompt') as string,
|
|
|
|
|
content: this.$t('message.Tip1') as string,
|
|
|
|
|
confirmText: this.$t('message.workArea_Confirm') as string,
|
|
|
|
|
cancelText: this.$t('message.Cancel') as string,
|
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
//确定执行下载
|
|
|
|
|
let downloadApkUrl = session.url;
|
|
|
|
|
// uni.downloadFile({
|
|
|
|
|
// url: downloadApkUrl,
|
|
|
|
|
// });
|
|
|
|
|
var dtask = plus.downloader.createDownload(downloadApkUrl, {}, function (d, status) {
|
|
|
|
|
if (status == 200) {
|
|
|
|
|
console.log('Download success: ' + d.filename);
|
|
|
|
|
uni.showToast({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
title: d.filename,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
console.log('Download failed: ' + status);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
dtask.start();
|
|
|
|
|
} else if (res.cancel) {
|
|
|
|
|
//console.log('用户点击取消');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//dtask.addEventListener("statechanged", onStateChanged, false);
|
|
|
|
|
// await uni.downloadFile({
|
|
|
|
|
// url: session.url,
|
|
|
|
|
// success: (res) => {
|
|
|
|
|
// console.log('res.statusCode', res.statusCode);
|
|
|
|
|
// console.log('res.tempFilePath', res.tempFilePath);
|
|
|
|
|
// console.log("url,url,url",session.url);
|
|
|
|
|
// },
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
login(): void {
|
|
|
|
|
// this.update();
|
|
|
|
|
this.$form.validate(async (valid: boolean) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (!server.isServerAddressSet) {
|
|
|
|
@ -185,6 +219,8 @@ export default class LoginPage extends BasePage {
|
|
|
|
|
icon: 'success',
|
|
|
|
|
title: this.$t('message.LoginSuccessful') as string,
|
|
|
|
|
});
|
|
|
|
|
//debugger;
|
|
|
|
|
this.update();
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: page.login.area,
|
|
|
|
|
});
|
|
|
|
|