| | |
| | | <template> |
| | | <view class="uni-page-login" style="width: 100vw;height: 64vh;"> |
| | | <view class="uni-page-login " :class="largeMode?'large-mode':''" style="width: 100vw;height: 64vh;"> |
| | | <div id="headr" class="mui-bar mui-bar-nav"> |
| | | <image class="logo" src="../../images/login/mobox_log_200.png"></image> |
| | | </div> |
| | |
| | | |
| | | <a href="javascript:;" class="SetServer" @click="inputDialogToggle">{{translateSys('set')}}</a> |
| | | <a href="javascript:;" class="SetServer" @click="clickSetLanguage">{{translateSys('language')}}</a> |
| | | |
| | | <!-- <div class="mui-input-row"> |
| | | <label class="la_icon"><image class="logo_input" src="../../images/login/svr_30.png"></image></label> |
| | | <input type="text" class="mui-input" v-model="userServer" placeholder="服务器地址"> |
| | | <label class="mui-navigate-right" id="sersel"><image class="logo_icon" src="../../images/login/sel_left.png" ></image></label> |
| | | </div> --> |
| | | <div class="mui-input-row"> |
| | | <label class="la_icon"> |
| | | <image class="logo_input" src="../../images/login/person_30.png"></image> |
| | | </label> |
| | | <input type="text" class="mui-input" v-model="userName" :placeholder="translateSys('input_login')"> |
| | | <!-- <label class="mui-navigate-right" id="namsel"><image class="logo_icon" src="../../images/login/user-photo.png</image></label> --> |
| | | </div> |
| | | <div class="mui-input-row"> |
| | | <label class="la_icon"> |
| | |
| | | </label> |
| | | </checkbox-group> |
| | | </form> |
| | | <button id='login' type="default" @tap="logind" class="btn_login">{{translateSys("start_login")}}</button> |
| | | <button id='login' :disabled="btnLoading" type="default" @tap="onClickLogin" |
| | | class="btn_login">{{translateSys("start_login")}}</button> |
| | | <p style="float:right; margin: 10px 10px;color:#c8c7cc"> |
| | | <span>{{translateSys('version')}}:</span> |
| | | <span>{{version}}</span> |
| | |
| | | </view> |
| | | </uni-popup> |
| | | <!-- 版本升级弹窗结束 --> |
| | | <uni-popup ref="refClassDialog" type="dialog"> |
| | | <uni-popup-dialog mode="info" :title="$t('page.bind_classes')" @confirm="dialogClassConfirm"> |
| | | <view class="popup-class"> |
| | | <view class="popup-class-item" :style="{color:item.text == selectedClasses ? '#27A6E1' :''}" |
| | | v-for="(item,index) in classesLst" :key="index" @click="clickSelectClass(item)"> |
| | | <view class="ico"><uni-icons v-if="item.text == selectedClasses" type="checkmarkempty" |
| | | :color="item.text == selectedClasses ? '#27A6E1' :''" size="24"></uni-icons></view> |
| | | {{item.text}} |
| | | </view> |
| | | </view> |
| | | </uni-popup-dialog> |
| | | </uni-popup> |
| | | </view> |
| | | <!-- <button @click="onClickWms">登录wms</button> |
| | | <view class="webview"> |
| | |
| | | login, |
| | | getApkVersionInfo |
| | | } from "@/api/index.js" |
| | | |
| | | import buttonClickMixin from '@/mixins/button-click.js'; |
| | | import { |
| | | dictGetInfo |
| | | } from "@/api/mobox.js" |
| | | import utils from "@/js/utils.js" |
| | | export default { |
| | | mixins: [buttonClickMixin], |
| | | components: { |
| | | cmdProgress |
| | | }, |
| | |
| | | downloadUrl: "", //安卓app下载链接 |
| | | percentage: 0, //下载进度 |
| | | showBtns: true, |
| | | selectedClasses: "", |
| | | classesLst: [], |
| | | largeMode: false, |
| | | |
| | | |
| | | } |
| | | }, |
| | | onShow() { |
| | |
| | | title: this.translateSys("tip"), |
| | | content: this.translate("tip_no_web_server"), |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | confirmText: this.translateSys('close') |
| | | }); |
| | | return; |
| | | } |
| | |
| | | title: this.translateSys("error"), |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys("cancel") |
| | | confirmText: this.translateSys('close') |
| | | }); |
| | | } |
| | | |
| | |
| | | inputDialogToggle() { |
| | | // this.$refs.inputDialog.open() |
| | | const $this = this |
| | | |
| | | uni.navigateTo({ |
| | | url: "./set", |
| | | events: { |
| | | exitSetEvent(val) { |
| | | $this.userServer = val; |
| | | $this.query(); //版本升级 |
| | | $this.largeMode = getApp().globalData.largeMode |
| | | |
| | | } |
| | | } |
| | | }) |
| | |
| | | // }, 3000) |
| | | // }, 3000) |
| | | }, |
| | | |
| | | rememberPwd(e) { //记住密码 |
| | | console.log(e.target); |
| | | utils.session.setValue('account', ''); |
| | | utils.session.setValue('password', ''); |
| | | if (e.target.value[0] == '1') { |
| | | if (e.detail.value[0] == '1') { |
| | | utils.session.setValue('account', this.userName); |
| | | utils.session.setValue('password', this.userPwd); |
| | | } |
| | |
| | | // ((expiredays==null)?'':';expires='+exdate.toGMTString()); |
| | | |
| | | // }, |
| | | onClickLogin() { |
| | | this.handleButtonClick((done) => { |
| | | this.logind() |
| | | setTimeout(() => { |
| | | done(); // 重置状态 |
| | | }, 1000); |
| | | }); |
| | | }, |
| | | async logind() { |
| | | try { |
| | | if (!this.userServer) { |
| | |
| | | title: this.translateSys('tip'), |
| | | content: this.translate('tip_no_web_server'), |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | confirmText: this.translateSys('close') |
| | | }); |
| | | return; |
| | | } |
| | |
| | | title: this.translateSys('tip'), |
| | | content: this.translate('tip_no_user_account'), |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | confirmText: this.translateSys('close') |
| | | }); |
| | | return; |
| | | } |
| | |
| | | title: this.translateSys('tip'), |
| | | content: this.translate('tip_no_user_password'), |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | confirmText: this.translateSys('close') |
| | | }); |
| | | return; |
| | | } |
| | |
| | | pwd: this.userPwd |
| | | } |
| | | hideLoading() |
| | | const bindInfo = utils.session.getValue('bind_classes') |
| | | app.globalData.bindClasses = bindInfo?.checked || false |
| | | if (app.globalData.bindClasses) { |
| | | this.selectedClasses = bindInfo?.classes || "" |
| | | await this.loadClassesList() |
| | | if (this.classesLst.length > 0) { |
| | | this.$refs.refClassDialog.open() |
| | | |
| | | } |
| | | return |
| | | } |
| | | uni.navigateTo({ |
| | | url: '../index/index?args=9999999999' |
| | | }) |
| | | |
| | | |
| | | |
| | | } catch (ex) { |
| | | hideLoading() |
| | |
| | | title: this.translateSys("error"), |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys("cancel") |
| | | confirmText: this.translateSys('close') |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | onClickWms() |
| | | { |
| | | onClickWms() { |
| | | let otherAppSchemeURL = "testapp://pages/index/index"; // 替换为目标app的scheme URL |
| | | plus.runtime.openURL(otherAppSchemeURL, function(error) { |
| | | console.error('打开应用失败: ', error); |
| | | }, "uni.TeatApp"); |
| | | }, |
| | | async loadClassesList() { |
| | | try { |
| | | var $this = this; |
| | | var dataInfo = { |
| | | dict_id: "", |
| | | dict_name: "WMS_CLASSES" |
| | | }; |
| | | const res = await dictGetInfo(dataInfo) |
| | | var list = []; |
| | | (res.dict_item_list || []).forEach((item) => { |
| | | list.push({ |
| | | text: item.value ? item.value : item.name, |
| | | value: item.name, |
| | | }); |
| | | }); |
| | | |
| | | if (list.length == 0) { |
| | | uni.showModal({ |
| | | title: this.translate("get_classes_fail"), |
| | | content: this.translate("page.please_login_after_admin_add_classes"), |
| | | showCancel: false, |
| | | confirmText: this.translateSys('close') |
| | | }); |
| | | this.selectedClasses = "" |
| | | } else { |
| | | if (this.selectedClasses) { |
| | | const curIndex = list.findIndex((a) => { |
| | | return a.text == this.selectedClasses |
| | | }) |
| | | if (curIndex < 0) { |
| | | this.selectedClasses = list[0].text |
| | | } |
| | | } else { |
| | | this.selectedClasses = list[0].text |
| | | } |
| | | } |
| | | this.classesLst = list |
| | | |
| | | |
| | | } catch (ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translate("get_classes_fail"), |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('close') |
| | | }); |
| | | |
| | | this.selectedClasses = "" |
| | | this.classesLst = [] |
| | | // { |
| | | // text: "测试", |
| | | // value: "test" |
| | | // }, { |
| | | // text: "测试3", |
| | | // value: "test3" |
| | | // } |
| | | } |
| | | }, |
| | | dialogClassConfirm() { |
| | | |
| | | utils.session.setValue('bind_classes', { |
| | | checked: true, |
| | | classes: this.selectedClasses |
| | | }) |
| | | getApp().globalData.classes = this.selectedClasses |
| | | uni.navigateTo({ |
| | | url: '../index/index?args=9999999999' |
| | | }) |
| | | }, |
| | | clickSelectClass(item) { |
| | | this.selectedClasses = item.text |
| | | }, |
| | | translate(t) { |
| | | if (typeof this.$t == "function") return this.$t(`page.${t}`) |
| | |
| | | }, |
| | | onLoad(options) { |
| | | //获取mac地址 |
| | | let tip=`login:account:${options.account || ""},password:${options.password || ""}` |
| | | // console.log(options); |
| | | uni.showModal({ |
| | | title: "参数", |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText:"cancel" |
| | | }); |
| | | |
| | | var url = utils.session.getValue('server'); |
| | | var username = utils.session.getValue('account'); |
| | | var userpwd = utils.session.getValue('password'); |
| | | |
| | | this.largeMode = utils.session.getValue('large_mode') ? true : false |
| | | getApp().globalData.largeMode = this.largeMode |
| | | var ischecked = false; |
| | | if (!this.userServer) |
| | | this.userServer = url; |
| | |
| | | console.log('Android设备的deviceId:', deviceId); |
| | | plus.runtime.getProperty(plus.runtime.appid, (info) => { |
| | | // console.log(info); |
| | | this.$data.version = info.version; |
| | | this.version = info.version; |
| | | }); |
| | | } |
| | | } |
| | |
| | | |
| | | .mui-input-row input { |
| | | font-family: 'Helvetica Neue', Helvetica, sans-serif; |
| | | font-size: 15px; |
| | | width: 480rpx; |
| | | /* float: right; */ |
| | | margin-bottom: 0; |
| | | padding-left: 20rpx; |
| | | /* padding-right: 10rpx; */ |
| | | /* line-height: 30rpx; */ |
| | | height: 85rpx; |
| | | /* padding: 7px 40px 7px 0px; */ |
| | | -webkit-user-select: text; |
| | | /* border: 0; */ |
| | | /* border-radius: 0; */ |
| | | box-shadow: none; |
| | | outline: 0; |
| | | background: 0 0; |
| | | -webkit-appearance: none; |
| | | } |
| | | |
| | | .mui-input-group label.mui-navigate-right { |
| | | font-size: 25px; |
| | | float: right; |
| | | padding: 0; |
| | | width: 80rpx; |
| | | margin-right: 5rpx; |
| | | margin-top: -88rpx; |
| | | display: inline-block; |
| | | } |
| | | |
| | | button.btn_login { |
| | |
| | | border: none; |
| | | color: #fff; |
| | | } |
| | | |
| | | .popup-class { |
| | | display: flex; |
| | | flex-direction: column; |
| | | width: 100%; |
| | | |
| | | .popup-class-item { |
| | | padding: 20rpx 0; |
| | | border-bottom: 1px solid #eee; |
| | | display: flex; |
| | | flex-direction: row; |
| | | |
| | | .ico { |
| | | width: 20px; |
| | | margin: 0 20rpx; |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | .uni-page-login.large-mode{ |
| | | .logo_input { |
| | | height: 54rpx; |
| | | width: 54rpx; |
| | | } |
| | | } |
| | | |
| | | </style> |