From 0cdc24ed926ec628d932027fd4aa7af8d0e5ae86 Mon Sep 17 00:00:00 2001 From: Your Name <you@example.com> Date: 星期二, 16 八月 2022 23:31:43 +0800 Subject: [PATCH] # --- pages/basics/pakin.vue | 45 +++++++++++++++++++++++++++------------------ 1 files changed, 27 insertions(+), 18 deletions(-) diff --git a/pages/basics/pakin.vue b/pages/basics/pakin.vue index 06f3bb5..093b904 100644 --- a/pages/basics/pakin.vue +++ b/pages/basics/pakin.vue @@ -8,8 +8,8 @@ </view> <view class="square-content"> <view class="content-input"> - <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="10" - :focus="barcodeFocus" @input="barcodeInput"> + <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" + :focus="barcodeFocus" @input="barcodeInput()" placeholder-style="line-height: 85rpx;"> <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons> </view> </view> @@ -24,7 +24,7 @@ <view class="square-content"> <view class="content-input-btn"> <input v-model="matnr" type="text" placeholder="鎵爜 / 杈撳叆" @input="findMat()" - :focus="focus"> + :focus="focus" placeholder-style="line-height: 85rpx;"> <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons> </view> <view class="content-btn"> @@ -116,6 +116,7 @@ export default { data() { return { + commonUrl:null, barcode: '', barcodeFocus:true, focus:false, @@ -146,30 +147,39 @@ this.baseIP = UIP; const UPORT = uni.getStorageSync('UPORT'); this.basePORT = UPORT + const PROJ = uni.getStorageSync('UPROJ'); + this.baseUrl = PROJ + this.getUrl() }, methods: { + // 鑾峰彇url + getUrl() { + this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl + }, // barcode input 浜嬩欢 barcodeInput() { - var len = this.barcode.length - if (len != 8) { - uni.showToast({title: '鎵樼洏鐮佹湁璇閲嶈瘯', icon: "none", position: 'top'}); - this.barcodeFocuss() - return; - } - if (len == 8) { - this.focuss() - } + console.log(1) + // 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏� + setTimeout(()=>{ + var len = this.barcode.length + if (len != 8) { + uni.showToast({title: '鎵樼洏鐮佹湁璇閲嶈瘯', icon: "none", position: 'top'}); + this.barcodeFocuss() + return; + } + if (len == 8) { + this.focuss() + } + },100) }, // 鎵樼洏鐮佹湁璇噸缃� barcodeFocuss() { - // #ifdef APP let that = this; that.barcodeFocus = false; setTimeout(()=>{ that.barcode = ''; that.barcodeFocus = true; }, 100); - // #endif }, // 鍟嗗搧鍏夋爣娓呯┖閲嶇疆 focuss() { @@ -227,7 +237,7 @@ } uni.showLoading(); uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/comb/auth', + url: that.commonUrl + '/mobile/comb/auth', data: JSON.stringify({ barcode: that.barcode, combMats: that.matList @@ -273,7 +283,7 @@ }, success: function(res) { // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� 鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑 - res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT }) + res.eventChannel.emit('acceptDataFromOpenerPage', {commonUrl:that.commonUrl }) }, }); @@ -282,7 +292,7 @@ findMat() { let that = this uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth', + url: that.commonUrl + '/mat/auth', data: { matnr:that.matnr }, @@ -301,7 +311,6 @@ // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� matList: function(data) { that.matList.push(data.data) - console.log(that.matList) }, }, success: function(res) { -- Gitblit v1.9.1