From b4416d1e1c0c292875820a3a510a1bc3488cb1f7 Mon Sep 17 00:00:00 2001 From: whycq <123456> Date: 星期四, 10 十一月 2022 12:37:41 +0800 Subject: [PATCH] # --- pages/basics/matSelect.vue | 43 +++++++++++++++++++++++++++---------------- 1 files changed, 27 insertions(+), 16 deletions(-) diff --git a/pages/basics/matSelect.vue b/pages/basics/matSelect.vue index beef27d..a8b6db0 100644 --- a/pages/basics/matSelect.vue +++ b/pages/basics/matSelect.vue @@ -42,13 +42,10 @@ export default { data() { return { + commonUrl:null, condition:null, tag: [], data: [], - baseHttp:'http://', - baseIP:'', - basePORT:'', - baseUrl:'/jkwms' } }, onLoad() { @@ -57,9 +54,8 @@ const eventChannel = this.getOpenerEventChannel(); // 鐩戝惉acceptDataFromOpenerPage浜嬩欢锛岃幏鍙栦笂涓�椤甸潰閫氳繃eventChannel浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� - eventChannel.on('acceptDataFromOpenerPage', function(data) { - that.baseIP = data.baseIP - that.basePORT = data.basePORT + eventChannel.on('commonUrl', function(data) { + that.commonUrl = data.commonUrl that.showTag(1) }) }, @@ -81,7 +77,7 @@ }); uni.request({ // url: "http://localhost:8081/jkwms/tag/list/pda/auth", - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/search/pda/auth', + url: that.commonUrl + '/mat/search/pda/auth', data: { condition: condition }, @@ -94,25 +90,36 @@ var res = result.data if (res.code === 200 ) { that.data = res.data + } else if (res.code == 403) { + uni.showToast({title: res.msg, icon: "none", position: 'top'}) + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + } else { + uni.showToast({title: res.msg, icon: "none",position: 'top'}) } } }); }, showTag(parentId) { let that = this - uni.vibrateShort(); + uni.showLoading(); uni.request({ - // url: "http://localhost:8081/jkwms/tag/list/pda/auth", - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/tag/list/pda/auth', + url: that.commonUrl + '/tag/list/pda/auth', + header: { + 'token':uni.getStorageSync('token'), + }, data: { limit: 100000, parentId: parentId }, - method:"GET", - header: { + header: { 'token':uni.getStorageSync('token'), - }, + }, success(result) { + console.log(result) that.tag = null that.data = null var res = result.data @@ -132,6 +139,7 @@ } else { uni.showToast({title: res.msg, icon: "none",position: 'top'}) } + uni.hideLoading(); } }); }, @@ -142,8 +150,7 @@ return; } uni.request({ - // url: "http://localhost:8081/jkwms/mat/list/pda/auth", - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/list/pda/auth', + url: that.commonUrl + '/mat/list/pda/auth', data: { tagId: tagId }, @@ -152,11 +159,14 @@ 'token':uni.getStorageSync('token'), }, success(result) { + console.log(result) that.tag = null var res = result.data if (res.code === 200) { if (res.data != null && res.data.length > 0) { + uni.showLoading(); that.data = res.data + uni.hideLoading(); } else { // that.tagId = parentId } @@ -170,6 +180,7 @@ } else { uni.showToast({title: res.msg, icon: "none",position: 'top'}) } + } }); }, -- Gitblit v1.9.1