diff --git a/buyer/src/api/index.js b/buyer/src/api/index.js index 3fe612ff..731937be 100644 --- a/buyer/src/api/index.js +++ b/buyer/src/api/index.js @@ -1,5 +1,16 @@ import request, { Method } from "@/plugins/request.js"; +/** + * 获取首页专题数据 + */ +export function getTopicData(id) { + return request({ + url: `/buyer/other/pageData/get/${id}`, + method: Method.GET, + }); +} + + // 获取首页楼层装修数据 export function indexData(params) { return request({ diff --git a/buyer/src/pages/Index.vue b/buyer/src/pages/Index.vue index dc5ebee9..4eb31739 100644 --- a/buyer/src/pages/Index.vue +++ b/buyer/src/pages/Index.vue @@ -32,7 +32,7 @@ - + @@ -79,6 +79,12 @@ export default { carouselOpacity: false // 不同轮播分类样式 }; }, + props:{ + pageData:{ + type:null, + default:"" + } + }, // created(){ // }, @@ -136,7 +142,6 @@ export default { return cur; }, []); if(this.autoCoupList != '' && this.autoCoupList.length > 0){ - console.log(1231232132) this.showCpmodel = true; } storage.setItem('getTimes',datas)//存储缓存 @@ -147,31 +152,41 @@ export default { } , getIndexData () { - // 获取首页装修数据 - indexData({ clientType: 'PC' }).then(async (res) => { - if (res.success) { - let dataJson = JSON.parse(res.result.pageData); - // 秒杀活动不是装修的数据,需要调用接口判断是否有秒杀商品 - // 轮播图根据不同轮播,样式不同 - for (let i = 0; i < dataJson.list.length; i++) { - let type = dataJson.list[i].type - if (type === 'carousel2') { - this.carouselLarge = true; - } else if (type === 'carousel1') { - this.carouselLarge = true - this.carouselOpacity = true - } else if (type === 'seckill') { - let seckill = await this.getListByDay() - dataJson.list[i].options.list = seckill - } + if(this.pageData){ + this.parsePageData(JSON.stringify(this.pageData)) + } + else{ + // 获取首页装修数据 + indexData({ clientType: 'PC' }).then(async (res) => { + if (res.success && res.result) { + this.parsePageData(res.result.pageData) } - this.modelForm = dataJson; - storage.setItem('navList', dataJson.list[1]) - this.showNav = true - this.topAdvert = dataJson.list[0]; - } - }); + }); + } }, + + async parsePageData(pageData){ + let dataJson = JSON.parse(pageData); + // 秒杀活动不是装修的数据,需要调用接口判断是否有秒杀商品 + // 轮播图根据不同轮播,样式不同 + for (let i = 0; i < dataJson.list.length; i++) { + let type = dataJson.list[i].type + if (type === 'carousel2') { + this.carouselLarge = true; + } else if (type === 'carousel1') { + this.carouselLarge = true + this.carouselOpacity = true + } else if (type === 'seckill') { + let seckill = await this.getListByDay() + dataJson.list[i].options.list = seckill + } + } + this.modelForm = dataJson; + storage.setItem('navList', dataJson.list[1]) + this.showNav = true + this.topAdvert = dataJson.list[0]; + }, + async getListByDay () { // 当天秒杀活动 const res = await seckillByDay() if (res.success && res.result.length) { diff --git a/buyer/src/pages/Topic.vue b/buyer/src/pages/Topic.vue new file mode 100644 index 00000000..d57a6ac5 --- /dev/null +++ b/buyer/src/pages/Topic.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/buyer/src/router/index.js b/buyer/src/router/index.js index 5dfb92eb..d5886003 100644 --- a/buyer/src/router/index.js +++ b/buyer/src/router/index.js @@ -88,7 +88,7 @@ const Home = (resolve) => require(["@/pages/user/Home"], resolve); const Merchant = (resolve) => require(["@/pages/Merchant"], resolve); const UserMain = (resolve) => require(["@/pages/home/Main"], resolve); - +const topic = (resolve) => require(["@/pages/Topic"], resolve); /** * 店铺入驻 */ @@ -113,6 +113,11 @@ export default new Router({ name: "Index", component: Index, }, + { + path: "/topic", // 首页 + name: "topic", + component: topic, + }, { path: "/login", // 登陆 name: "login", diff --git a/manager/src/components/lili-dialog/link-dialog.vue b/manager/src/components/lili-dialog/link-dialog.vue index 5a870d77..b68812de 100644 --- a/manager/src/components/lili-dialog/link-dialog.vue +++ b/manager/src/components/lili-dialog/link-dialog.vue @@ -42,6 +42,7 @@ export default { watch: { changed: { handler(val) { + console.log(val,'changed') this.$emit("selectedLink", val[0]); //因为是单选,所以直接返回第一个 }, deep: true diff --git a/manager/src/components/lili-dialog/template/special.vue b/manager/src/components/lili-dialog/template/special.vue index 2f692353..eff051e3 100644 --- a/manager/src/components/lili-dialog/template/special.vue +++ b/manager/src/components/lili-dialog/template/special.vue @@ -14,11 +14,9 @@ { this.index = params.index; - params.row = {...params.row,pageType:'special'} + params.row = {...params.row,pageType:'special',___type:'special'} this.$emit("selected", [params.row]); }, }, @@ -94,12 +92,24 @@ export default { }, methods: { + changePageNum (val) { // 修改评论页码 + this.params.pageNumber = val; + this.init(); + }, + changePageSize (val) { // 修改评论页数 + this.params.pageNumber = 1; + this.params.pageSize = val; + this.init(); + }, // 获取话题的标题 async init() { + // 根据当前路径判断当前是H5还是PC + this.params.pageClientType = this.$route.name === 'renovation' ? 'PC' : 'H5' let res = await getHomeList(this.params); if (res.success) { this.loading = false; - this.data= res.result.records + this.data= res.result.records + this.total = res.result.total } else { this.loading = false; } diff --git a/manager/src/utils/filters.js b/manager/src/utils/filters.js index fb4e5042..5855744c 100644 --- a/manager/src/utils/filters.js +++ b/manager/src/utils/filters.js @@ -237,13 +237,15 @@ export function formatDate(date, fmt) { // 楼层装修,选择链接处理跳转方式 export function formatLinkType (item) { - const types = ['goods', 'category', 'shops', 'marketing', 'pages', 'other'] // 所有跳转的分类 依次为 商品、分类、店铺、活动、页面、其他 + const types = ['goods', 'category', 'shops', 'marketing', 'pages', 'other','special'] // 所有跳转的分类 依次为 商品、分类、店铺、活动、页面、其他 let url = ''; switch (item.___type) { case 'goods': url = `/goodsDetail?skuId=${item.id}&goodsId=${item.goodsId}`; break; - + case 'special': + url = `/topic?id=${item.id}` + break; case 'category': url = `/goodsList?categoryId=${item.allId}`; break; diff --git a/manager/src/views/page-decoration/floorList.vue b/manager/src/views/page-decoration/floorList.vue index 9b958c0a..aaaeeb4e 100644 --- a/manager/src/views/page-decoration/floorList.vue +++ b/manager/src/views/page-decoration/floorList.vue @@ -17,7 +17,9 @@
页面名称
-
状态
+
+
状态
+
操作
@@ -25,30 +27,35 @@
{{ item.name || "暂无模板昵称" }}
+
- - - - - +
+
+ + + + + +
暂无更多模板
@@ -193,9 +200,11 @@ export default { decorate(val) { // 装修 + const data = { id: val.id, pageShow: val.pageShow,pageType:this.searchForm.pageType } + this.$router.push({ name: "renovation", - query: { id: val.id, pageShow: val.pageShow }, + query: data, }); }, @@ -235,6 +244,8 @@ export default { }, releaseTemplate(id) { + console.log(id) + // id.pageType = 'SPECIAL' //发布模板 API_floor.releasePageHome(id).then((res) => { if (res.success) { @@ -303,6 +314,7 @@ export default { align-items: center; justify-content: space-between; > .item-config { + width: 250px; display: flex; justify-content: space-between; @@ -315,4 +327,9 @@ export default { .item:nth-of-type(2n + 1) { background: #f5f7fa; } +.action{ + display: flex; + align-items: center; + width: 100px; +} diff --git a/manager/src/views/page-decoration/modelForm.vue b/manager/src/views/page-decoration/modelForm.vue index b19d7f8a..713852ce 100644 --- a/manager/src/views/page-decoration/modelForm.vue +++ b/manager/src/views/page-decoration/modelForm.vue @@ -32,7 +32,7 @@ -