diff --git a/src/i18n/lang/cn.ts b/src/i18n/lang/cn.ts index 14399b4..9f4ae54 100644 --- a/src/i18n/lang/cn.ts +++ b/src/i18n/lang/cn.ts @@ -10,6 +10,7 @@ export default { Cancel: '取消', LoginSuccessful: '登录成功', Loading: '加载中', + uploading: '正在下载中........', request_Tip1: '请求错误', request_Tip2: '未授权,请登录', request_Tip3: '拒绝访问', diff --git a/src/i18n/lang/en.ts b/src/i18n/lang/en.ts index e11ae75..1f51648 100644 --- a/src/i18n/lang/en.ts +++ b/src/i18n/lang/en.ts @@ -10,6 +10,7 @@ export default { Cancel: 'Cancel', LoginSuccessful: 'Login success', Loading: 'Loading', + uploading: 'Downloading now........', request_Tip1: 'Request error', request_Tip2: 'Unauthorize, please log in', request_Tip3: 'Access denied', diff --git a/src/manifest.json b/src/manifest.json index 493429d..f43ce9b 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,87 +1,87 @@ { - "name": "HaierWMS", - "appid": "__UNI__306D001", - "description": "", - "versionName": "0.0.1", - "versionCode": 1, - "transformPx": false, - "app-plus": { - "compatible": { - "ignoreVersion": true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持 + "name" : "HaierWMS", + "appid" : "__UNI__306D001", + "description" : "", + "versionName" : "0.0.1", + "versionCode" : 1, + "transformPx" : false, + "app-plus" : { + "compatible" : { + "ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持 + }, + /* 5+App特有相关 */ + "modules" : {}, + /* 模块配置 */ + "distribute" : { + /* 应用发布信息 */ + "android" : { + /* android打包配置 */ + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "autoSdkPermissions" : true + }, + "ios" : {}, + /* ios打包配置 */ + "sdkConfigs" : { + "ad" : {} + } + }, + /* SDK配置 */ + "usingComponents" : true }, - /* 5+App特有相关 */ - "modules": {}, - /* 模块配置 */ - "distribute": { - /* 应用发布信息 */ - "android": { - /* android打包配置 */ - "permissions": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ], - "autoSdkPermissions": true - }, - "ios": {}, - /* ios打包配置 */ - "sdkConfigs": { - "ad": {} - } + "quickapp" : {}, + /* 快应用特有相关 */ + "mp-weixin" : { + /* 小程序特有相关 */ + "usingComponents" : true, + "appid" : "", + "setting" : { + "urlCheck" : true + } }, - /* SDK配置 */ - "usingComponents": true - }, - "quickapp": {}, - /* 快应用特有相关 */ - "mp-weixin": { - /* 小程序特有相关 */ - "usingComponents": true, - "appid": "", - "setting": { - "urlCheck": true + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "mp-qq" : { + "usingComponents" : true + }, + "h5" : { + "optimization" : { + "treeShaking" : { + "enable" : false + } + }, + "router" : { + "mode" : "hash", + "base" : "/nwp" + } } - }, - "mp-alipay": { - "usingComponents": true - }, - "mp-baidu": { - "usingComponents": true - }, - "mp-toutiao": { - "usingComponents": true - }, - "mp-qq": { - "usingComponents": true - }, - "h5": { - "optimization": { - "treeShaking": { - "enable": false - } - }, - "router": { - "mode": "hash", - "base": "/nwp" - } - } } diff --git a/src/pages/login/login/index.vue b/src/pages/login/login/index.vue index 55417b1..f80c22a 100644 --- a/src/pages/login/login/index.vue +++ b/src/pages/login/login/index.vue @@ -86,6 +86,8 @@ import { session } from '@/store/modules/session'; import { BasePage } from '@/components/base/page'; import { VForm } from 'vue/types/form'; import { Lang } from '@/i18n'; +import vm from '@/main'; +import checkAppUpdate from '@/plugins/app-update'; // mixin 引入示例目前用于弹窗自定义 // import { any } from 'lodash/fp'; @@ -147,12 +149,12 @@ export default class LoginPage extends BasePage { this.$form.setRules(this.rules); //this.update(); console.log('image', this.image); - console.log("Version////",this.Version); + console.log('Version////', this.Version); } Version = '1.0.0'; async update() { await session.QueryVersion(); - if (this.Version != session.Version) { + if (this.Version == session.Version) { // 版本更新提示 uni.showModal({ content: this.$t('message.Tip1') as string, @@ -162,69 +164,33 @@ export default class LoginPage extends BasePage { if (res.confirm) { //确定执行下载 let downloadApkUrl = session.url; + uni.showLoading({ + title: vm.$t('message.uploading') as string, + //title: '正在下载中..........', + }); ////////////////uni下载方法, uni.downloadFile({ url: downloadApkUrl, success: (downloadResult) => { - //uni.hideLoading(); + uni.hideLoading(); if (downloadResult.statusCode == 200) { //安装更新 plus.runtime.install(downloadResult.tempFilePath as any, { force: true }, function () { //uni.showToast('更新成功,重启'); 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方法 - // 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('用户点击取消'); + } else { + //return; + console.log("1111111"); } }, }); + return; } - //return; + this.go(); } /////////////////无用代码无用代码 // 更新应用资源 @@ -260,6 +226,33 @@ export default class LoginPage extends BasePage { }, 1500); } //////////////////////////// + async go() { + 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, + }); + uni.navigateTo({ + url: page.login.area, + }); + } + login(): void { this.$form.validate(async (valid: boolean) => { if (valid) { @@ -272,32 +265,34 @@ export default class LoginPage extends BasePage { uni.navigateTo({ url: page.login.server }); }, 2000); } else { - 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, - }); + //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, + // }); } } }); diff --git a/src/store/modules/session.ts b/src/store/modules/session.ts index 39ec4f8..6cda1b2 100644 --- a/src/store/modules/session.ts +++ b/src/store/modules/session.ts @@ -163,7 +163,8 @@ class SessionService extends VuexModule { async QueryVersion() { let res: any = await request.get('http://seamom.haier.net/sgNginxDownload/Debug/setup.json'); let Version = res.version; - let url = res.url + res.file; + let url = res.url + '/' + res.file; + console.log("url..........", url); return { Version, url }; } //直接下载