版本更新修改

master
guoshuang 3 years ago
parent e9b9c2b531
commit d670d9d8f8

@ -10,6 +10,7 @@ export default {
Cancel: '取消', Cancel: '取消',
LoginSuccessful: '登录成功', LoginSuccessful: '登录成功',
Loading: '加载中', Loading: '加载中',
uploading: '正在下载中........',
request_Tip1: '请求错误', request_Tip1: '请求错误',
request_Tip2: '未授权,请登录', request_Tip2: '未授权,请登录',
request_Tip3: '拒绝访问', request_Tip3: '拒绝访问',

@ -10,6 +10,7 @@ export default {
Cancel: 'Cancel', Cancel: 'Cancel',
LoginSuccessful: 'Login success', LoginSuccessful: 'Login success',
Loading: 'Loading', Loading: 'Loading',
uploading: 'Downloading now........',
request_Tip1: 'Request error', request_Tip1: 'Request error',
request_Tip2: 'Unauthorize, please log in', request_Tip2: 'Unauthorize, please log in',
request_Tip3: 'Access denied', request_Tip3: 'Access denied',

@ -86,6 +86,8 @@ import { session } from '@/store/modules/session';
import { BasePage } from '@/components/base/page'; import { BasePage } from '@/components/base/page';
import { VForm } from 'vue/types/form'; import { VForm } from 'vue/types/form';
import { Lang } from '@/i18n'; import { Lang } from '@/i18n';
import vm from '@/main';
import checkAppUpdate from '@/plugins/app-update';
// mixin // mixin
// import { any } from 'lodash/fp'; // import { any } from 'lodash/fp';
@ -147,12 +149,12 @@ export default class LoginPage extends BasePage {
this.$form.setRules(this.rules); this.$form.setRules(this.rules);
//this.update(); //this.update();
console.log('image', this.image); console.log('image', this.image);
console.log("Version////",this.Version); console.log('Version////', this.Version);
} }
Version = '1.0.0'; Version = '1.0.0';
async update() { async update() {
await session.QueryVersion(); await session.QueryVersion();
if (this.Version != session.Version) { if (this.Version == session.Version) {
// //
uni.showModal({ uni.showModal({
content: this.$t('message.Tip1') as string, content: this.$t('message.Tip1') as string,
@ -162,69 +164,33 @@ export default class LoginPage extends BasePage {
if (res.confirm) { if (res.confirm) {
// //
let downloadApkUrl = session.url; let downloadApkUrl = session.url;
uni.showLoading({
title: vm.$t('message.uploading') as string,
//title: '..........',
});
////////////////uni, ////////////////uni,
uni.downloadFile({ uni.downloadFile({
url: downloadApkUrl, url: downloadApkUrl,
success: (downloadResult) => { success: (downloadResult) => {
//uni.hideLoading(); uni.hideLoading();
if (downloadResult.statusCode == 200) { if (downloadResult.statusCode == 200) {
// //
plus.runtime.install(downloadResult.tempFilePath as any, { force: true }, function () { plus.runtime.install(downloadResult.tempFilePath as any, { force: true }, function () {
//uni.showToast(''); //uni.showToast('');
plus.runtime.restart(); plus.runtime.restart();
}); });
// uni.showModal({
// //content: '',
// content: this.$t('message.Tip2') as string,
// confirmText: this.$t('message.restart') as string,
// cancelText: this.$t('message.Cancel') as string,
// success: function (res) {
// if (res.confirm == true) {
// plus.runtime.install(downloadResult.tempFilePath, { force: true }, function (res) {
// //uni.showToast('');
// plus.runtime.restart();
// });
// }
// },
// });
} }
}, },
}); });
///////////////////// plus } else {
// plus.downloader
// .createDownload(downloadApkUrl, {}, function (d, status) {
// uni.showModal({
// content: status,
// });
// if (status == 200) {
// uni.showModal({
// title: '',
// content: this.$t('message.Tip2') as string,
// confirmText: this.$t('message.restart') as string,
// cancelText: this.$t('message.Cancel') as string,
// success: function (res) {
// if (res.confirm == true) {
// plus.runtime.install(plus.io.convertLocalFileSystemURL(d.filename), { force: true }, function (res) {
// //uni.showToast('');
// plus.runtime.restart();
// });
// }
// },
// });
// } else {
// console.log('Download failed: ' + status);
// }
// })
// .start();
// dtask.start();
/////////////////plus
} else if (res.cancel) {
//console.log('');
}
},
});
}
//return; //return;
console.log("1111111");
}
},
});
return;
}
this.go();
} }
///////////////// /////////////////
// //
@ -260,18 +226,7 @@ export default class LoginPage extends BasePage {
}, 1500); }, 1500);
} }
//////////////////////////// ////////////////////////////
login(): void { async go() {
this.$form.validate(async (valid: boolean) => {
if (valid) {
if (!server.isServerAddressSet) {
await uni.showToast({
icon: 'none',
title: this.$t('message.Tip') as string,
});
setTimeout(() => {
uni.navigateTo({ url: page.login.server });
}, 2000);
} else {
const { username, password } = this.form; const { username, password } = this.form;
const loginResult = await session.login({ const loginResult = await session.login({
username, username,
@ -293,12 +248,52 @@ export default class LoginPage extends BasePage {
icon: 'success', icon: 'success',
title: this.$t('message.LoginSuccessful') as string, title: this.$t('message.LoginSuccessful') as string,
}); });
//debugger;
// this.update();
uni.navigateTo({ uni.navigateTo({
url: page.login.area, url: page.login.area,
}); });
} }
login(): void {
this.$form.validate(async (valid: boolean) => {
if (valid) {
if (!server.isServerAddressSet) {
await uni.showToast({
icon: 'none',
title: this.$t('message.Tip') as string,
});
setTimeout(() => {
uni.navigateTo({ url: page.login.server });
}, 2000);
} else {
//checkAppUpdate();
this.update();
//const { username, password } = this.form;
// const loginResult = await session.login({
// username,
// password,
// lang: this.$i18n.locale as Lang,
// });
// const { code, factoryCode, list, loginName, msg, userId, userName } = loginResult;
// session.setUser({
// code,
// factoryCode,
// loginName,
// list,
// msg,
// userId,
// userName,
// lang: this.$i18n.locale as Lang,
// });
// uni.showToast({
// icon: 'success',
// title: this.$t('message.LoginSuccessful') as string,
// });
// //debugger;
// // this.update();
// uni.navigateTo({
// url: page.login.area,
// });
}
} }
}); });
} }

@ -163,7 +163,8 @@ class SessionService extends VuexModule {
async QueryVersion() { async QueryVersion() {
let res: any = await request.get('http://seamom.haier.net/sgNginxDownload/Debug/setup.json'); let res: any = await request.get('http://seamom.haier.net/sgNginxDownload/Debug/setup.json');
let Version = res.version; let Version = res.version;
let url = res.url + res.file; let url = res.url + '/' + res.file;
console.log("url..........", url);
return { Version, url }; return { Version, url };
} }
//直接下载 //直接下载

Loading…
Cancel
Save