From e8b665122cf256caae4993534c696d029883f0d5 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期三, 05 三月 2025 10:52:03 +0800 Subject: [PATCH] showmodal cancal 改成 close --- pages/login/index.vue | 322 ++++++++++++++++++++--------------------------------- 1 files changed, 123 insertions(+), 199 deletions(-) diff --git a/pages/login/index.vue b/pages/login/index.vue index 2fef010..bba6b7e 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -70,7 +70,10 @@ </uni-popup> <!-- 鐗堟湰鍗囩骇寮圭獥缁撴潫 --> </view> - + <!-- <button @click="onClickWms">鐧诲綍wms</button> + <view class="webview"> + <web-view ref="webview" src="http://115.29.185.26:5000/mobox3/#/"></web-view> + </view> --> </view> </template> @@ -83,6 +86,12 @@ showLoading, hideLoading } from "@/js/Page.js" + import { + isMobox3Web, + login, + getApkVersionInfo + } from "@/api/index.js" + import utils from "@/js/utils.js" export default { components: { @@ -133,113 +142,43 @@ }, //妫�祴鏄惁闇�鏇存柊 async check(version) { - if (!this.userServer) { - uni.showModal({ - title: this.translateSys("tip"), - content: this.translate("tip_no_web_server"), - showCancel: false, - confirmText: this.translateSys('cancel') - }); - return; - } - var ser = this.userServer.toLowerCase().split('/'); - var translateSyshis = this; - var rootUrl = 'http://' + this.userServer - if (this.userServer.includes("://")) { - rootUrl = this.userServer - } - if (ser[ser.length - 1] == 'mobox3') { //鍒ゆ柇褰撳墠缃戝潃鏄惁鏄痬obox3 - var url = rootUrl + '/Program/version.txt'; - console.log(url); - uni.request({ - url: url, // 鎸囧畾JS鏂囦欢鐨勫畬鏁磋矾寰�- method: 'GET', - success(res) { - console.log(res); - if (res && res.statusCode === 200) { - //鑾峰彇褰撳墠鐗堟湰鍙�- var VersionName = res.data; //鏇存柊鍖呭悕绉�- var versionInfo = res.data.split('_'); - var versionNum = versionInfo[2].replace(".apk", ""); //鐗堟湰缂栫爜 - var VersionCode = versionInfo[2].replace(".apk", "").replace(".", "").replace( - ".", ""); //鏈嶅姟绔増鏈彿 - // this.downloadUrl = resp.PdaUrl+"/"+VersionName; //app涓嬭浇閾炬帴 - - translateSyshis.downloadUrl = rootUrl + "/Program/" + - VersionName; //app涓嬭浇閾炬帴this. - var isver = translateSyshis.compare(versionNum, version); - if (isver) { - translateSyshis.$refs.promotion.open(); - } else { - console.log('褰撳墠宸叉槸鏈�柊鐗堟湰') - } - } else { - // if(res.statusCode === 404){ - // uni.showModal({ - // title: "鎻愮ず", - // content: '璇锋眰澶辫触锛屾壘涓嶅埌鏇存柊鍖呯増鏈枃妗o細'+url, - // showCancel: false, - // confirmText: "鍙栨秷" - // }); - // } - } - }, - fail(err) { - // 閿欒澶勭悊閫昏緫 - uni.showModal({ - title: this.translateSys('error'), - content: this.translate('tip_get_file_fail_first') + "'" + url + "'" + - this.translate('tip_get_file_fail_last') + "\n" + err, - showCancel: false, - confirmText: this.translateSys('cancel') - }); - } - }); - } else { - var dataInfo = { - server: rootUrl - }; - this.$store.dispatch('GetApkVersionInfo', dataInfo).then(success => { - console.log(success); - if (success.code == '00000') { - let resp = success.data; - if (resp) { - // const obj = resp.data.filter(item => { - // return item.groupName == 'version' - // }) - //鑾峰彇褰撳墠鐗堟湰鍙�- const VersionName = resp.VersionName; //鏇存柊鍖呭悕绉�- const VersionCode = resp.VersionCode; //鐗堟湰缂栫爜 - const versionNum = resp.Version; //鏈嶅姟绔増鏈彿 - // this.downloadUrl = resp.PdaUrl+"/"+VersionName; //app涓嬭浇閾炬帴 - translateSyshis.downloadUrl = rootUrl + - "/Program/" + - VersionName; //app涓嬭浇閾炬帴this. - var isver = translateSyshis.compare(versionNum, version); - if (isver) { - translateSyshis.$refs.promotion.open(); - } else { - console.log('褰撳墠宸叉槸鏈�柊鐗堟湰') - } - } - } else { - uni.showModal({ - title: this.translateSys('error'), - content: success.msg, - showCancel: false, - confirmText: this.translateSys('cancel') - }); - } - }).catch(ex => { - console.log(ex); + try { + if (!this.userServer) { uni.showModal({ - title: this.translateSys('error'), - content: ex.errMsg ? ex.errMsg : ex.message, + title: this.translateSys("tip"), + content: this.translate("tip_no_web_server"), showCancel: false, - confirmText: this.translateSys('cancel') + confirmText: this.translateSys('close') }); + return; + } + // var ser = this.userServer.toLowerCase().split('/'); + const res = await getApkVersionInfo(this.userServer) + this.downloadUrl = res.dldUrl || "" + if (this.downloadUrl) { + var isver = this.compare(res.verNum || "", version); + if (isver) { + this.$refs.promotion.open(); + } else { + console.log('褰撳墠宸叉槸鏈�柊鐗堟湰') + } + } + + } catch (ex) { + // console.log(ex); + let exStr = JSON.stringify(ex) + if (exStr == "{}") + exStr = ex + let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr + uni.showModal({ + title: this.translateSys("error"), + content: tip, + showCancel: false, + confirmText: this.translateSys('close') }); } + + }, compare(curV, reqV) { var arr1 = curV.toString().split('.'); @@ -340,8 +279,8 @@ url: "./set", events: { exitSetEvent(val) { - $this.userServer = val; - $this.query(); //鐗堟湰鍗囩骇 + $this.userServer = val; + $this.query(); //鐗堟湰鍗囩骇 } } }) @@ -397,100 +336,79 @@ // ((expiredays==null)?'':';expires='+exdate.toGMTString()); // }, - logind() { - if (!this.userServer) { - uni.showModal({ - title: this.translateSys('tip'), - content: this.translate('tip_no_web_server'), - showCancel: false, - confirmText: this.translateSys('cancel') - }); - return; - } - if (!this.userName) { - uni.showModal({ - title: this.translateSys('tip'), - content: this.translate('tip_no_user_account'), - showCancel: false, - confirmText: this.translateSys('cancel') - }); - return; - } - if (!this.userPwd) { - uni.showModal({ - title: this.translateSys('tip'), - content: this.translate('tip_no_user_password'), - showCancel: false, - confirmText: this.translateSys('cancel') - }); - return; - } - var rootUrl = 'http://' + this.userServer - if (this.userServer.includes("://")) { - rootUrl = this.userServer - } - const mobox3Port = utils.session.getValue('mobox3_port'); - //妫�煡 "鐧诲綍鐘舵�/閿佸睆鐘舵�" 缁撴潫 - var loginInfo = { - server: rootUrl, - orgsport: mobox3Port?.org || 5101, - moboxsport: mobox3Port?.mobox || 5102, - datasport: mobox3Port?.data || 5103, - mongodbsport: mobox3Port?.mongodb || 5201, - uname: this.userName, - pwd: this.userPwd, - cname: plus.device.model, - type: "0" - }; - console.log(loginInfo); - showLoading("loading......") - //鐧诲綍 - this.$store.dispatch('login', loginInfo).then(success => { - console.log(success); - if (success.code == '00000' || success.err_code == 0) { - //鐧诲綍鎴愬姛鍚庢竻绌虹紦瀛樻暟鎹�- this.$store.commit("areaFunc", null); - this.$store.commit("classAttrList", null); - this.$store.commit("classGridStyleInfo", null); - this.$store.commit("dicValueInfo", null); - this.$store.commit("subClassAttrList", null); - this.$store.commit("subClassGridStyleInfo", null); - //璁剧疆鍏ㄥ眬鍙傛暟锛歶ser-鐢ㄦ埛淇℃伅 - utils.session.setValue('server', loginInfo.server); - utils.session.setValue('account', loginInfo.uname); - utils.session.setValue('password', loginInfo.pwd); - // this.mutatLogin({loginid:success}); - this.$store.commit('login', { - loginid: success - }); - hideLoading() - uni.navigateTo({ - url: '../index/index?args=9999999999' - }) - // uni.redirectTo({ - // url:'../index/index?args=9999999999' - // }); - - - } else { - hideLoading() + async logind() { + try { + if (!this.userServer) { uni.showModal({ - title: this.translateSys('error'), - content: success.msg, + title: this.translateSys('tip'), + content: this.translate('tip_no_web_server'), showCancel: false, - confirmText: this.translateSys('cancel') + confirmText: this.translateSys('close') }); + return; } - }).catch(ex => { - console.log(ex); + if (!this.userName) { + uni.showModal({ + title: this.translateSys('tip'), + content: this.translate('tip_no_user_account'), + showCancel: false, + confirmText: this.translateSys('close') + }); + return; + } + if (!this.userPwd) { + uni.showModal({ + title: this.translateSys('tip'), + content: this.translate('tip_no_user_password'), + showCancel: false, + confirmText: this.translateSys('close') + }); + return; + } + var rootUrl = 'http://' + this.userServer + if (this.userServer.includes("://")) { + rootUrl = this.userServer + } + showLoading("loading......") + const res = await login(rootUrl, this.userName, this.userPwd) + //璁剧疆鍏ㄥ眬鍙傛暟锛歶ser-鐢ㄦ埛淇℃伅 + utils.session.setValue('server', rootUrl); + utils.session.setValue('account', this.userName); + utils.session.setValue('password', this.userPwd); + const app = getApp() + app.globalData.sessionId = res.session_id + app.globalData.loginUser = { + id: this.userName, + name: res.name, + pwd: this.userPwd + } hideLoading() + + uni.navigateTo({ + url: '../index/index?args=9999999999' + }) + + } catch (ex) { + hideLoading() + let exStr = JSON.stringify(ex) + if (exStr == "{}") + exStr = ex + let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr uni.showModal({ - title: this.translateSys('error'), - content: ex.errMsg, + title: this.translateSys("error"), + content: tip, showCancel: false, - confirmText: this.translateSys('cancel') + confirmText: this.translateSys('close') }); - }); + } + + }, + onClickWms() + { + let otherAppSchemeURL = "testapp://pages/index/index"; // 鏇挎崲涓虹洰鏍嘺pp鐨剆cheme URL + plus.runtime.openURL(otherAppSchemeURL, function(error) { + console.error('鎵撳紑搴旂敤澶辫触: ', error); + }, "uni.TeatApp"); }, translate(t) { if (typeof this.$t == "function") return this.$t(`page.${t}`) @@ -501,13 +419,19 @@ else return t; }, }, - onLoad() { + onLoad(options) { //鑾峰彇mac鍦板潃 - var url = this.$store.state.url; - var username = this.$store.state.username; - var userpwd = this.$store.state.userpwd; - - + let tip=`login:account:${options.account || ""},password:${options.password || ""}` + // console.log(options); + uni.showModal({ + title: "鍙傛暟", + content: tip, + showCancel: false, + confirmText:'close' + }); + var url = utils.session.getValue('server'); + var username = utils.session.getValue('account'); + var userpwd = utils.session.getValue('password'); var ischecked = false; if (!this.userServer) @@ -535,10 +459,10 @@ } deviceId += tmp; } + getApp().globalData.deviceId = deviceId + getApp().globalData.cname = plus.device.model //78b8d67511ca - this.$store.commit("setDeviceId", deviceId); console.log('Android璁惧鐨刣eviceId:', deviceId); - plus.runtime.getProperty(plus.runtime.appid, (info) => { // console.log(info); this.$data.version = info.version; -- Gitblit v1.9.1