From e3fd78a6184db01fe5ce9846158662f048f83297 Mon Sep 17 00:00:00 2001 From: yangzhe Date: Mon, 14 Apr 2025 16:51:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=88=B7=E5=8D=A1=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/cleanDetails.vue | 5 +++-- pages/index/cleanPlan.vue | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pages/index/cleanDetails.vue b/pages/index/cleanDetails.vue index d72aa98..e38b229 100644 --- a/pages/index/cleanDetails.vue +++ b/pages/index/cleanDetails.vue @@ -31,7 +31,6 @@ class="image" v-for="(v, i) in dataInfo.pictures" :key="i" - mode="aspectFill" :src="BASE_URL + '/uploads/' + v.path" @click="previewImage(i)" > @@ -72,7 +71,9 @@ export default { // 预览图片 previewImage(index) { uni.previewImage({ - urls: this.dataInfo.pictures.map((v) => BASE_URL + "/uploads/" + v.path), + urls: this.dataInfo.pictures.map( + (v) => BASE_URL + "/uploads/" + v.path + ), current: index, }); }, diff --git a/pages/index/cleanPlan.vue b/pages/index/cleanPlan.vue index 4bd78b1..e327015 100644 --- a/pages/index/cleanPlan.vue +++ b/pages/index/cleanPlan.vue @@ -78,7 +78,7 @@ - + @@ -115,7 +115,8 @@ 暂不 - 异常上报 + 异常上报 + From 1059a1f3b7942313046734b2c00cc1981da6226a Mon Sep 17 00:00:00 2001 From: yangzhe Date: Tue, 15 Apr 2025 09:59:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E8=AE=A1=E5=88=92=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/planList.vue | 76 +++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/pages/index/planList.vue b/pages/index/planList.vue index 728bbd8..d4aaf46 100644 --- a/pages/index/planList.vue +++ b/pages/index/planList.vue @@ -30,7 +30,7 @@ @click="switchTab('completed')" > 已完成计划 - 12 + {{ completedPlanList.length }} 未完成计划 - 12 + {{ incompletePlanList.length }} @@ -63,7 +63,13 @@ --> - + + + @@ -102,27 +116,31 @@ import { getDateDiff } from "@/utils/utils"; export default { data() { + const todayStr = GetNowTime(new Date()); + return { activeTab: "completed", - maxDate: "2049-12-31", + // maxDate: "2049-12-31", // 默认最大日期为当天 showCalendar: false, // 请求参数 params: { - // '0 1 2' - "Item1.IsCompleted": 0, - dateBegin: GetNowTime(new Date()), - dateEnd: GetNowTime(new Date()), + // "Item1.IsCompleted": 1, // '0 1 2' 0未完成 1已完成 2不用管 + dateBegin: todayStr, + dateEnd: todayStr, }, // 计划列表 - planList: [], + completedPlanList: [], + incompletePlanList: [], + loading: false, // 添加加载状态 }; }, onShow() { - this.getPlanList(); + // 页面每次展示时都获取所有列表 + this.fetchAllPlanLists(); }, methods: { getDateDiff, @@ -137,15 +155,38 @@ export default { changeDate(e) { this.params.dateBegin = e.startDate; this.params.dateEnd = e.endDate; - this.getPlanList(); + // 日期更改后,重新获取所有列表 + this.fetchAllPlanLists(); }, - // 获取计划列表 - async getPlanList() { - const res = await GetPlanList(this.params); + // 统一获取所有列表数据 + async fetchAllPlanLists() { + if (this.loading) return; // 防止重复加载 + this.loading = true; + uni.showLoading({ title: "加载中..." }); // 显示加载提示 + try { + await Promise.all([this.fetchListData(1), this.fetchListData(0)]); + } catch (error) { + console.error("获取所有列表时出错:", error); + } finally { + this.loading = false; + uni.hideLoading(); // 隐藏加载提示 + } + }, + async fetchListData(status) { + const requestParams = { + ...this.params, + "Item1.IsCompleted": status, // 0未完成 1已完成 2不用管 + }; + + const res = await GetPlanList(requestParams); if (res.succeed) { - this.planList = res.data; + if (status === 1) { + this.completedPlanList = res.data || []; + } else { + this.incompletePlanList = res.data || []; + } } }, }, @@ -153,6 +194,9 @@ export default {