From fcc3977e6a84700e5fb347db13bc1302b2b05b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TOP=E7=B3=AF=E7=B1=B3?= <1130395124@qq.com> Date: Tue, 7 Mar 2023 13:51:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=A6=96=E9=A1=B5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/apis.js | 20 ++- src/pages/index/index.vue | 172 +++++++---------------- src/static/{temp/index => backup}/a1.png | Bin src/static/{temp/index => backup}/a2.png | Bin src/static/{temp/index => backup}/a3.png | Bin src/static/{temp/index => backup}/a4.png | Bin src/static/{temp/index => backup}/a5.png | Bin 7 files changed, 62 insertions(+), 130 deletions(-) rename src/static/{temp/index => backup}/a1.png (100%) rename src/static/{temp/index => backup}/a2.png (100%) rename src/static/{temp/index => backup}/a3.png (100%) rename src/static/{temp/index => backup}/a4.png (100%) rename src/static/{temp/index => backup}/a5.png (100%) diff --git a/src/core/apis.js b/src/core/apis.js index 21da9ce..71f8b75 100644 --- a/src/core/apis.js +++ b/src/core/apis.js @@ -2,34 +2,32 @@ export default { index: { banner: { url: "/index/banner", - method: "post", - auth: false, + }, + notify: { + url: "/index/message", + }, + install: { + url: "/index/category1", + }, + aftermarket: { + url: "/index/category2", }, }, user: { sendCode: { url: "/public/send", - method: "post", - auth: false, }, openId: { url: "/public/getopenid", - method: "post", - auth: false, }, register: { url: "/public/register", - method: "post", - auth: false, }, login: { url: "/public/login", - method: "post", - auth: false, }, info: { url: "/user/getuserinfo", - method: "post", auth: true, } }, diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 26ec5d3..f8b2d93 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -4,7 +4,7 @@ @@ -87,118 +87,10 @@ export default { data() { return { utils: this.$utils, - bannerList: [ - { - id: 1, - image: require("@/static/temp/banner.png"), - title: "", - page: "", - }, - ], - notifyList: [ - { - id: 1, - title: "恭喜成都市王先生订购xxxxxx服务一套", - }, - { - id: 2, - title: "恭喜成都市王先生订购xxxxxx服务一套", - }, - { - id: 3, - title: "恭喜成都市王先生订购xxxxxx服务一套", - }, - { - id: 4, - title: "恭喜成都市王先生订购xxxxxx服务一套", - }, - { - id: 5, - title: "恭喜成都市王先生订购xxxxxx服务一套", - }, - ], - installServiceList: [ - { - id: 1, - icon: require("@/static/temp/index/1.png"), - title: "电器安装", - page: "", - }, - { - id: 2, - icon: require("@/static/temp/index/2.png"), - title: "卫浴吊顶安装", - page: "", - }, - { - id: 3, - icon: require("@/static/temp/index/3.png"), - title: "水电安装", - page: "", - }, - { - id: 4, - icon: require("@/static/temp/index/4.png"), - title: "烟道钻孔", - page: "", - }, - { - id: 5, - icon: require("@/static/temp/index/5.png"), - title: "家具安装", - page: "", - }, - { - id: 6, - icon: require("@/static/temp/index/6.png"), - title: "门窗五金安装", - page: "", - }, - { - id: 7, - icon: require("@/static/temp/index/7.png"), - title: "地面墙体安装", - page: "", - }, - { - id: 8, - icon: require("@/static/temp/index/8.png"), - title: "其他安装", - page: "/pages/service/other/other", - }, - ], - aftermarketServiceList: [ - { - id: 9, - icon: require("@/static/temp/index/a1.png"), - title: "电器维护", - page: "", - }, - { - id: 10, - icon: require("@/static/temp/index/a2.png"), - title: "家电清洗", - page: "", - }, - { - id: 11, - icon: require("@/static/temp/index/a3.png"), - title: "保洁家政", - page: "/pages/demand/demand", - }, - { - id: 12, - icon: require("@/static/temp/index/a4.png"), - title: "管道疏通", - page: "", - }, - { - id: 13, - icon: require("@/static/temp/index/a5.png"), - title: "货物配送", - page: "/pages/service/other/distribution", - }, - ], + bannerList: [], + notifyList: [], + installServiceList: [], + aftermarketServiceList: [], bussinessServiceList: [ { id: 14, @@ -220,16 +112,58 @@ export default { AppBanner, WidgetSearch, }, - onLoad() {}, + onLoad() { + // 轮播 + this.$request({ + api: "index.banner", + }).then((response) => { + response.data.forEach((item) => { + this.bannerList.push({ + image: item.image, + }); + }); + }); + // 公告 + this.$request({ + api: "index.notify", + }).then((response) => { + this.notifyList = [ + { + title: response.data.message, + }, + ]; + }); + // 服务 + this.$request({ + api: "index.install", + }).then((response) => { + response.data.forEach((item) => { + this.installServiceList.push({ + id: item.id, + title: item.name, + icon: item.more, + page: "", + }); + }); + }); + this.$request({ + api: "index.aftermarket", + }).then((response) => { + response.data.forEach((item) => { + this.aftermarketServiceList.push({ + id: item.id, + title: item.name, + icon: item.more, + page: "", + }); + }); + }); + }, onShow() {}, onReady() {}, onReachBottom() {}, onPullDownRefresh() {}, - methods: { - clickBanner(item) { - console.log(item); - }, - }, + methods: {}, }; diff --git a/src/static/temp/index/a1.png b/src/static/backup/a1.png similarity index 100% rename from src/static/temp/index/a1.png rename to src/static/backup/a1.png diff --git a/src/static/temp/index/a2.png b/src/static/backup/a2.png similarity index 100% rename from src/static/temp/index/a2.png rename to src/static/backup/a2.png diff --git a/src/static/temp/index/a3.png b/src/static/backup/a3.png similarity index 100% rename from src/static/temp/index/a3.png rename to src/static/backup/a3.png diff --git a/src/static/temp/index/a4.png b/src/static/backup/a4.png similarity index 100% rename from src/static/temp/index/a4.png rename to src/static/backup/a4.png diff --git a/src/static/temp/index/a5.png b/src/static/backup/a5.png similarity index 100% rename from src/static/temp/index/a5.png rename to src/static/backup/a5.png