diff --git a/packages/community/index/index.vue b/packages/community/index/index.vue index a24e039f..0fa14303 100644 --- a/packages/community/index/index.vue +++ b/packages/community/index/index.vue @@ -134,7 +134,50 @@ export default { communityList: [], flag: false, - functionList: [], + functionList: [ + { + create_time: "2025-07-04 17:28:35", + id: 4, + is_published: 1, + jump_target: 1, + mini_program_url: "/packages/community/repairList/index", + nav_icon: picUrl + "/static/images/2025-07-05/db3s1b1lyxawt8cnke.png", + nav_name: "报事报修", + other_appid: "", + other_path: "", + sort: 5, + update_time: "2025-08-29 11:39:54", + visible_communities: "" + }, + { + create_time: "2025-07-05 10:48:27", + id: 5, + is_published: 1, + jump_target: 1, + mini_program_url: "/packages/community/propertyPayment/index", + nav_icon: picUrl + "/static/images/2025-07-05/db3s1t7d1k0qmuha61.png", + nav_name: "物业缴费", + other_appid: "", + other_path: "", + sort: 4, + update_time: "2025-08-29 11:40:02", + visible_communities: "", + }, + { + create_time: "2025-07-05 10:49:02", + id: 7, + is_published: 1, + jump_target: 1, + mini_program_url: "/packages/community/providentFund/index", + nav_icon: picUrl + "/static/images/2025-07-05/db3s29e33rd7rsrecf.png", + nav_name: "物业公积金", + other_appid: "", + other_path: "", + sort: 2, + update_time: "2025-08-29 11:39:21", + visible_communities: "" + } + ], ads1Show: false, ads2Show: false, @@ -318,14 +361,24 @@ export default { console.log(res, "xx"); // 获取 rowNum 和 colNum 的乘积 - const totalItems = this.rowNum * this.colNum; - // 使用 slice 方法截取前 totalItems 个元素 - this.functionList = res.rows.slice(0, totalItems).map((item) => { + const totalItems = this.rowNum * this.colNum - 3; + // 截取前 totalItems 个元素 + const newItems = res.rows.slice(0, totalItems).map((item) => { return { ...item, nav_icon: picUrl + item.nav_icon, }; }); + + // 根据nav_name判断是否已存在,不存在则添加 + newItems.forEach(newItem => { + const exists = this.functionList.some(existingItem => + existingItem.nav_name === newItem.nav_name + ); + if (!exists) { + this.functionList.push(newItem); + } + }); console.log("functionList", this.functionList); },