From e6a02c8b09a796e436a501e9b87d19e25c34c9d1 Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期日, 07 四月 2024 15:53:37 +0800 Subject: [PATCH] # --- pages/business/plan/plan.vue | 80 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 74 insertions(+), 6 deletions(-) diff --git a/pages/business/plan/plan.vue b/pages/business/plan/plan.vue index 5af2ebe..2b69ffb 100644 --- a/pages/business/plan/plan.vue +++ b/pages/business/plan/plan.vue @@ -101,6 +101,7 @@ <view class="fxbtn"> <uni-icons type="plusempty" color="#fff" @click="gotoggle()" ></uni-icons> </view> + <uni-load-more :status="status" :icon-size="16" :content-text="contentText" /> </view> </template> @@ -113,7 +114,7 @@ user: { username: '', id: 0, - type: 'user_id' + type: '' }, falg: true, csmtrList: [], @@ -153,7 +154,12 @@ name:'骞冲簱', value: 6 }, - ] + { + name:'鍏朵粬', + value: 7 + }, + ], + param: {curr:1,limit:4} } }, onLoad() { @@ -171,7 +177,7 @@ this.getDetail() } setTimeout(()=> { - this.getCsmtr1() + this.getList() },50) }, onReachBottom() { @@ -192,23 +198,79 @@ this.toggle('right') }, add(val) { - let addPlan = 'addPlan' + let addPlan = 'addPlan',_this = this if (val > 1) { addPlan = 'addPlan' + val } uni.navigateTo({ url:'/pages/business/plan/' + addPlan, + success() { + _this.$refs.popup.close() + } }) + + }, toggle(type) { this.type = type // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴�� this.$refs.popup.open(type) }, + getList() { + let that = this + that.csmtrList = [] + uni.showLoading() + if (this.user.type == 'user_id') { + that.param = {curr:1,limit:4,user_id: that.user.id} + } else if(this.user.type == 'dept_id') { + that.param = {curr:1,limit:4,dept_id: that.user.id} + } + uni.request({ + url: that.baseUrl + '/plan/page/auth', + header: {'token' : uni.getStorageSync('token'),}, + data: that.param, + method:'GET', + success(result) { + console.log(result); + if (result.statusCode === 404) { + uni.showToast({title: '璇烽噸鏂扮櫥褰�', icon: "none", position: 'top'}) + return + } + var res = result.data + if (res.code === 200) { + let list = res.data.records + that.csmtrList = that.reload ? list : that.csmtrList.concat(list); + if (res.data.records.length == 0) { + that.status = 'noMore' + } + } 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'}) + } + }, + fail(result) { + uni.showToast({title: '璇锋眰澶辫触'}) + setTimeout(() => { + uni.reLaunch({ + url: '../../login/login' + }); + }, 1000); + }, + complete() { + uni.hideLoading() + } + }) + }, getCsmtr1(e) { let that = this that.csmtrList = [] - uni.showLoading({}) + uni.showLoading() let param = {curr:1,limit:4,dept_id: 0,user_id: 67} if (this.user.type == 'user_id') { param = {curr:1,limit:4,user_id: that.user.id} @@ -217,12 +279,14 @@ } else { param = {curr:1,limit:4} } + param = {curr:1,limit:4} uni.request({ url: that.baseUrl + '/plan/page/auth', header: {'token' : uni.getStorageSync('token'),}, data: param, method:'GET', success(result) { + console.log(result); if (result.statusCode === 404) { uni.showToast({title: '璇烽噸鏂扮櫥褰�', icon: "none", position: 'top'}) return @@ -275,6 +339,7 @@ data: param, method:'GET', success(result) { + console.log(result); if (result.statusCode === 404) { uni.showToast({title: '璇烽噸鏂扮櫥褰�', icon: "none", position: 'top'}) return @@ -283,7 +348,10 @@ if (res.code === 200) { let list = res.data.records that.csmtrList = that.reload ? list : that.csmtrList.concat(list); - that.curr = that.curr + 1 + console.log(list); + if (list.length > 0) { + that.curr = that.curr + 1 + } if (res.data.records.length == 0) { that.status = 'noMore' } -- Gitblit v1.9.1