Commit 2badf2fbbe1c1aa2291d9455a66ec9267dce7890
1 parent
de098de0
优选库商城首页对接接口~
Showing
12 changed files
with
331 additions
and
416 deletions
src/components/discountZone/discountZone.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div> | ||
| 3 | - <titleBox v-if="discountZoneInfo" :titles="discountZoneInfo[0]"></titleBox> | ||
| 4 | - <div v-if="discountZoneInfo&&discountZoneInfo[0].img" class="item_box"> | ||
| 5 | - <div class="left"> | ||
| 6 | - <img v-lazy="discountZoneInfo[0].img[0].simg" @click="$parent.toDetail(discountZoneInfo[0].img[0])" alt="网家家" /> | ||
| 7 | - </div> | ||
| 8 | - <div class="right"> | ||
| 9 | - <img class="item" v-for="(item,index) in discountZoneInfo[0].img" :key="index" @click="$parent.toDetail(item)" v-if="index>0" v-lazy="item.simg" alt="网家家"/> | ||
| 10 | - </div> | ||
| 11 | - </div> | ||
| 12 | - </div> | 2 | + <div v-if="discountZoneInfo"> |
| 3 | + <titleBox v-if="discountZoneInfo" @more="more" | ||
| 4 | + :titles="discountZoneInfo"> | ||
| 5 | + </titleBox> | ||
| 6 | + <div v-if="discountZoneInfo && discountZoneInfo.img" class="item_box"> | ||
| 7 | + <div class="left"> | ||
| 8 | + <img v-lazy="discountZoneInfo.img[0].simg + SIGN.MIDDLE" @click="toDetail(discountZoneInfo.img[0])" /> | ||
| 9 | + </div> | ||
| 10 | + <div class="right"> | ||
| 11 | + <img class="item" v-lazy="item.simg + SIGN.MIDDLE" v-if="index > 0" v-for="(item, index) in discountZoneInfo.img" :key="index" @click="toDetail(item)" /> | ||
| 12 | + </div> | ||
| 13 | + </div> | ||
| 14 | + </div> | ||
| 13 | </template> | 15 | </template> |
| 14 | 16 | ||
| 15 | <script> | 17 | <script> |
| 18 | + // 引入组件 | ||
| 16 | import titleBox from "@/components/titleBox/titleBox"; | 19 | import titleBox from "@/components/titleBox/titleBox"; |
| 17 | - export default { | ||
| 18 | - name: 'discountZone', | ||
| 19 | - data () { | ||
| 20 | - return { | ||
| 21 | - titles:null | ||
| 22 | - } | ||
| 23 | - }, | ||
| 24 | - props:["discountZoneInfo"], | ||
| 25 | - components:{ | ||
| 26 | - titleBox | ||
| 27 | - }, | ||
| 28 | - created(){ | 20 | + |
| 21 | + export default { | ||
| 22 | + name: 'discountZone', | ||
| 23 | + data() { | ||
| 24 | + return { | ||
| 25 | + | ||
| 26 | + } | ||
| 27 | + }, | ||
| 28 | + props:["discountZoneInfo"], | ||
| 29 | + components:{ | ||
| 30 | + titleBox | ||
| 31 | + }, | ||
| 32 | + methods: { | ||
| 29 | 33 | ||
| 30 | - }, | ||
| 31 | - methods: { | 34 | + /** |
| 35 | + * 详情 | ||
| 36 | + * @param {object} item [详情数据] | ||
| 37 | + */ | ||
| 38 | + toDetail(item) { | ||
| 39 | + this.$emit("toDetail", item); | ||
| 40 | + }, | ||
| 32 | 41 | ||
| 42 | + /** | ||
| 43 | + * 更多 | ||
| 44 | + * @param {object} item [详情数据] | ||
| 45 | + */ | ||
| 46 | + more(item) { | ||
| 47 | + this.$emit("more", item); | ||
| 48 | + } | ||
| 49 | + } | ||
| 33 | } | 50 | } |
| 34 | - } | ||
| 35 | </script> | 51 | </script> |
| 36 | 52 | ||
| 37 | <!-- Add "scoped" attribute to limit CSS to this component only --> | 53 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
src/components/goodsItem_1/goodsItem_1.vue
| 1 | <template> | 1 | <template> |
| 2 | <div class="goods-item-1-box" :class="'pid-' + pid" v-if="item"> | 2 | <div class="goods-item-1-box" :class="'pid-' + pid" v-if="item"> |
| 3 | <div class="img-box"> | 3 | <div class="img-box"> |
| 4 | - <img :src="item.simg + SIGN.SMALL" class="simg" /> | 4 | + <img v-lazy="item.simg + SIGN.SMALL" class="simg" /> |
| 5 | </div> | 5 | </div> |
| 6 | <div class="title">{{item.title}}</div> | 6 | <div class="title">{{item.title}}</div> |
| 7 | <div class="price-box"> | 7 | <div class="price-box"> |
src/components/preferential/preferential.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div> | ||
| 3 | - <titleBox v-if="preferentialInfo" :titles="preferentialInfo[0]"></titleBox> | ||
| 4 | - <div v-if="preferentialInfo" class="item_box"> | ||
| 5 | - <div class="left"> | ||
| 6 | - <img class="item" v-for="(item,index) in preferentialInfo[0].img" :key="index"@click="$parent.toDetail(item)" v-if="index<3" v-lazy="item.simg" /> | ||
| 7 | - </div> | ||
| 8 | - <div class="right"> | ||
| 9 | - <img class="first" v-lazy="preferentialInfo[0].img[3].simg" @click="$parent.toDetail(preferentialInfo[0].img[3])" alt="网家家"/> | ||
| 10 | - <img class="item" v-lazy="preferentialInfo[0].img[4].simg" @click="$parent.toDetail(preferentialInfo[0].img[4])" alt="网家家"/> | ||
| 11 | - </div> | ||
| 12 | - </div> | ||
| 13 | - </div> | 2 | + <div v-if="preferentialInfo"> |
| 3 | + <titleBox v-if="preferentialInfo" @more="more" | ||
| 4 | + :titles="preferentialInfo"> | ||
| 5 | + </titleBox> | ||
| 6 | + <div v-if="preferentialInfo" class="item_box"> | ||
| 7 | + <div class="left"> | ||
| 8 | + <img class="item" v-lazy="item.simg + SIGN.MIDDLE" v-if="index < 3" v-for="(item,index) in preferentialInfo.img" :key="index" @click="toDetail(item)" /> | ||
| 9 | + </div> | ||
| 10 | + <div class="right"> | ||
| 11 | + <img class="first" v-lazy="preferentialInfo.img[3].simg + SIGN.MIDDLE" @click="toDetail(preferentialInfo.img[3])" /> | ||
| 12 | + <img class="item" v-lazy="preferentialInfo.img[4].simg + SIGN.MIDDLE" @click="toDetail(preferentialInfo.img[4])" /> | ||
| 13 | + </div> | ||
| 14 | + </div> | ||
| 15 | + </div> | ||
| 14 | </template> | 16 | </template> |
| 15 | 17 | ||
| 16 | <script> | 18 | <script> |
| 19 | + // 引入组件 | ||
| 17 | import titleBox from "@/components/titleBox/titleBox"; | 20 | import titleBox from "@/components/titleBox/titleBox"; |
| 18 | - export default { | ||
| 19 | - name: 'discountZone', | ||
| 20 | - data () { | ||
| 21 | - return { | ||
| 22 | - titles:null | ||
| 23 | - } | ||
| 24 | - }, | ||
| 25 | - props:["preferentialInfo"], | ||
| 26 | - components:{ | ||
| 27 | - titleBox | ||
| 28 | - }, | ||
| 29 | - created(){ | 21 | + |
| 22 | + export default { | ||
| 23 | + name: 'preferential', | ||
| 24 | + data() { | ||
| 25 | + return { | ||
| 30 | 26 | ||
| 31 | - }, | ||
| 32 | - methods: { | 27 | + } |
| 28 | + }, | ||
| 29 | + props:["preferentialInfo"], | ||
| 30 | + components:{ | ||
| 31 | + titleBox | ||
| 32 | + }, | ||
| 33 | + methods: { | ||
| 33 | 34 | ||
| 35 | + /** | ||
| 36 | + * 详情 | ||
| 37 | + * @param {object} item [详情数据] | ||
| 38 | + */ | ||
| 39 | + toDetail(item) { | ||
| 40 | + this.$emit("toDetail", item); | ||
| 41 | + }, | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 更多 | ||
| 45 | + * @param {object} item [详情数据] | ||
| 46 | + */ | ||
| 47 | + more(item) { | ||
| 48 | + this.$emit("more", item); | ||
| 49 | + } | ||
| 50 | + } | ||
| 34 | } | 51 | } |
| 35 | - } | ||
| 36 | </script> | 52 | </script> |
| 37 | 53 | ||
| 38 | <!-- Add "scoped" attribute to limit CSS to this component only --> | 54 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
src/components/style_7/style_7.vue
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | 17 | ||
| 18 | <!-- Banner图 --> | 18 | <!-- Banner图 --> |
| 19 | <div class="banner-img-box" v-if="styles.market && styles.market.simg" @click="bannerJump(styles.market)"> | 19 | <div class="banner-img-box" v-if="styles.market && styles.market.simg" @click="bannerJump(styles.market)"> |
| 20 | - <img :src="styles.market.simg + SIGN.BIG" class="banner-img" mode="widthFix" /> | 20 | + <img v-lazy="styles.market.simg + SIGN.BIG" class="banner-img" mode="widthFix" /> |
| 21 | </div> | 21 | </div> |
| 22 | 22 | ||
| 23 | <!-- 横向滚动列表 --> | 23 | <!-- 横向滚动列表 --> |
src/components/videoArea/videoArea.less
src/components/videoArea/videoArea.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div> | ||
| 3 | - <titleBox v-if="videoAreaInfo" :titles="videoAreaInfo[0]"></titleBox> | ||
| 4 | - <div class="item_box"> | ||
| 5 | - <img src="/static/img/pic_1.jpg" alt="网家家"/> | ||
| 6 | - <div class="title"> | ||
| 7 | - 美猴王系列绘本(套装共32册) | ||
| 8 | - </div> | ||
| 9 | - <div class="desc"> | ||
| 10 | - 规格:32册/套 | ||
| 11 | - </div> | ||
| 12 | - <div class="pic_box"> | ||
| 13 | - <div class="pice"> | ||
| 14 | - <div class="now">¥ 361.9</div> | ||
| 15 | - <div class="original">¥ 399.9</div> | ||
| 16 | - </div> | ||
| 17 | - <!--<div class="btn">--> | ||
| 18 | - <!--立即购买--> | ||
| 19 | - <!--</div>--> | ||
| 20 | - </div> | ||
| 21 | - </div> | ||
| 22 | - </div> | 2 | + <div v-if="videoAreaInfo"> |
| 3 | + <titleBox v-if="videoAreaInfo" @more="more" | ||
| 4 | + :titles="videoAreaInfo"> | ||
| 5 | + </titleBox> | ||
| 6 | + <div class="item_box" @click="toDetail(videoAreaInfo.img[0])"> | ||
| 7 | + <img v-lazy="videoAreaInfo.img[0].simg + SIGN.BIG" class="main-img" mode="widthFix" /> | ||
| 8 | + <div class="title"> | ||
| 9 | + 美猴王系列绘本(套装共32册) | ||
| 10 | + </div> | ||
| 11 | + <div class="desc"> | ||
| 12 | + 规格:32册/套 | ||
| 13 | + </div> | ||
| 14 | + <div class="pic_box"> | ||
| 15 | + <div class="pice"> | ||
| 16 | + <div class="now">¥ 361.9</div> | ||
| 17 | + <div class="original">¥ 399.9</div> | ||
| 18 | + </div> | ||
| 19 | + <!--<div class="btn">--> | ||
| 20 | + <!--立即购买--> | ||
| 21 | + <!--</div>--> | ||
| 22 | + </div> | ||
| 23 | + </div> | ||
| 24 | + </div> | ||
| 23 | </template> | 25 | </template> |
| 24 | 26 | ||
| 25 | <script> | 27 | <script> |
| 28 | + // 引入组件 | ||
| 26 | import titleBox from "@/components/titleBox/titleBox"; | 29 | import titleBox from "@/components/titleBox/titleBox"; |
| 27 | - export default { | ||
| 28 | - name: 'videoArea', | ||
| 29 | - data () { | ||
| 30 | - return { | ||
| 31 | - titles:null | ||
| 32 | - } | ||
| 33 | - }, | ||
| 34 | - props:["videoAreaInfo"], | ||
| 35 | - components:{ | ||
| 36 | - titleBox | ||
| 37 | - }, | ||
| 38 | - created(){ | 30 | + |
| 31 | + export default { | ||
| 32 | + name: 'videoArea', | ||
| 33 | + data() { | ||
| 34 | + return { | ||
| 39 | 35 | ||
| 40 | - }, | ||
| 41 | - methods: { | 36 | + } |
| 37 | + }, | ||
| 38 | + props:["videoAreaInfo"], | ||
| 39 | + components:{ | ||
| 40 | + titleBox | ||
| 41 | + }, | ||
| 42 | + methods: { | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 详情 | ||
| 46 | + * @param {object} item [详情数据] | ||
| 47 | + */ | ||
| 48 | + toDetail(item) { | ||
| 49 | + this.$emit("toDetail", item); | ||
| 50 | + }, | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 更多 | ||
| 54 | + * @param {object} item [详情数据] | ||
| 55 | + */ | ||
| 56 | + more(item) { | ||
| 57 | + this.$emit("more", item); | ||
| 58 | + } | ||
| 59 | + } | ||
| 42 | } | 60 | } |
| 43 | - } | ||
| 44 | </script> | 61 | </script> |
| 45 | 62 | ||
| 46 | <!-- Add "scoped" attribute to limit CSS to this component only --> | 63 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
src/pages/com/com.less deleted
100644 → 0
src/pages/com/com.vue deleted
100644 → 0
| 1 | -<template> | ||
| 2 | - <div class="index-box"> | ||
| 3 | - | ||
| 4 | - | ||
| 5 | - <!-- style_1组件 --> | ||
| 6 | - <style-7 @more="more" @bannerJump="bannerJump" @jump=jump @addCart=addCart | ||
| 7 | - :styles="styleA"> | ||
| 8 | - </style-7> | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - </div> | ||
| 12 | -</template> | ||
| 13 | - | ||
| 14 | -<script> | ||
| 15 | - | ||
| 16 | - // 引入组件 | ||
| 17 | - import { Toast, Indicator } from "mint-ui"; | ||
| 18 | - import style7 from "@/components/style_7/style_7"; | ||
| 19 | - | ||
| 20 | - export default { | ||
| 21 | - data () { | ||
| 22 | - return { | ||
| 23 | - title: "", | ||
| 24 | - styleA: { | ||
| 25 | - "id": "1567", | ||
| 26 | - "simg": "https://wjjtest.ys2.cnliveimg.com/shop/img/2020/03/26/5e7c442f13a41.png", | ||
| 27 | - "style": "7", | ||
| 28 | - "title": "网家家生鲜", | ||
| 29 | - "video": "", | ||
| 30 | - "video_img": "", | ||
| 31 | - "w": "90", | ||
| 32 | - "h": "90", | ||
| 33 | - "img": [], | ||
| 34 | - "market": { | ||
| 35 | - "id": "66", | ||
| 36 | - "title": "火锅测试", | ||
| 37 | - "icon": "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/05/06/5ccfa14759478.png", | ||
| 38 | - "simg": "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/05/06/5ccfa14a3c3fe.jpg", | ||
| 39 | - "pid": "4", | ||
| 40 | - "type": "13", | ||
| 41 | - "to": "66", | ||
| 42 | - "shop_type": "", | ||
| 43 | - "goods": [ | ||
| 44 | - { | ||
| 45 | - "id": "9520377", | ||
| 46 | - "title": "测试优惠劵", | ||
| 47 | - "simg": "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/04/29/5cc5e6f49256e.png", | ||
| 48 | - "price": "120.00", | ||
| 49 | - "shop_type": "1" | ||
| 50 | - }, | ||
| 51 | - { | ||
| 52 | - "id": "9520377", | ||
| 53 | - "title": "测试优惠劵", | ||
| 54 | - "simg": "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/04/29/5cc5e6f49256e.png", | ||
| 55 | - "price": "120.00", | ||
| 56 | - "shop_type": "1" | ||
| 57 | - }, | ||
| 58 | - { | ||
| 59 | - "id": "9520377", | ||
| 60 | - "title": "测试优惠劵", | ||
| 61 | - "simg": "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/04/29/5cc5e6f49256e.png", | ||
| 62 | - "price": "120.00", | ||
| 63 | - "shop_type": "1" | ||
| 64 | - }, | ||
| 65 | - { | ||
| 66 | - "id": "9520377", | ||
| 67 | - "title": "测试优惠劵", | ||
| 68 | - "simg": "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/04/29/5cc5e6f49256e.png", | ||
| 69 | - "price": "120.00", | ||
| 70 | - "shop_type": "1" | ||
| 71 | - }, | ||
| 72 | - { | ||
| 73 | - "id": "9520377", | ||
| 74 | - "title": "测试优惠劵", | ||
| 75 | - "simg": "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/04/29/5cc5e6f49256e.png", | ||
| 76 | - "price": "120.00", | ||
| 77 | - "shop_type": "1" | ||
| 78 | - }, | ||
| 79 | - { | ||
| 80 | - "id": "9520377", | ||
| 81 | - "title": "测试优惠劵", | ||
| 82 | - "simg": "https://wjjtest.ys2.cnliveimg.com/802/shop/img/2019/04/29/5cc5e6f49256e.png", | ||
| 83 | - "price": "120.00", | ||
| 84 | - "shop_type": "1" | ||
| 85 | - } | ||
| 86 | - ] | ||
| 87 | - } | ||
| 88 | - }, | ||
| 89 | - | ||
| 90 | - | ||
| 91 | - | ||
| 92 | - | ||
| 93 | - | ||
| 94 | - | ||
| 95 | - | ||
| 96 | - } | ||
| 97 | - }, | ||
| 98 | - components: { | ||
| 99 | - style7, | ||
| 100 | - | ||
| 101 | - | ||
| 102 | - | ||
| 103 | - }, | ||
| 104 | - created() { | ||
| 105 | - | ||
| 106 | - // 设置标题 | ||
| 107 | - this.$set(this, "title", "aabb"); | ||
| 108 | - | ||
| 109 | - | ||
| 110 | - | ||
| 111 | - | ||
| 112 | - | ||
| 113 | - | ||
| 114 | - }, | ||
| 115 | - methods: { | ||
| 116 | - | ||
| 117 | - /** | ||
| 118 | - * 更多 | ||
| 119 | - * @param {object} item [数据对象] | ||
| 120 | - */ | ||
| 121 | - more(item) { | ||
| 122 | - | ||
| 123 | - // 判断并调用通用跳转 | ||
| 124 | - if (typeof this.$parent.gotoDetail === "function") { | ||
| 125 | - this.$parent.gotoDetail(item); | ||
| 126 | - } | ||
| 127 | - }, | ||
| 128 | - | ||
| 129 | - /** | ||
| 130 | - * Banner跳转 | ||
| 131 | - * @param {object} item [数据对象] | ||
| 132 | - */ | ||
| 133 | - bannerJump(item) { | ||
| 134 | - | ||
| 135 | - // 判断并调用通用跳转 | ||
| 136 | - if (typeof this.$parent.gotoDetail === "function") { | ||
| 137 | - this.$parent.gotoDetail(item); | ||
| 138 | - } | ||
| 139 | - }, | ||
| 140 | - | ||
| 141 | - /** | ||
| 142 | - * 跳转 | ||
| 143 | - * @param {object} item [数据对象] | ||
| 144 | - */ | ||
| 145 | - jump(item) { | ||
| 146 | - | ||
| 147 | - // 判断并调用通用跳转 | ||
| 148 | - if (typeof this.$parent.gotoDetail === "function") { | ||
| 149 | - | ||
| 150 | - // 构造跳转详情页参数 | ||
| 151 | - let options = { | ||
| 152 | - type: "2", | ||
| 153 | - to: item.id, | ||
| 154 | - shop_type: item.shop_type | ||
| 155 | - } | ||
| 156 | - | ||
| 157 | - | ||
| 158 | - console.log(options); | ||
| 159 | - | ||
| 160 | - | ||
| 161 | - | ||
| 162 | - | ||
| 163 | - this.$parent.gotoDetail(options); | ||
| 164 | - } | ||
| 165 | - }, | ||
| 166 | - | ||
| 167 | - /** | ||
| 168 | - * 加入购物车 | ||
| 169 | - * @param {object} item [数据对象] | ||
| 170 | - */ | ||
| 171 | - addCart(item) { | ||
| 172 | - | ||
| 173 | - | ||
| 174 | - console.log("addCartA", item); | ||
| 175 | - | ||
| 176 | - | ||
| 177 | - | ||
| 178 | - }, | ||
| 179 | - | ||
| 180 | - | ||
| 181 | - | ||
| 182 | - | ||
| 183 | - }, | ||
| 184 | - head: { | ||
| 185 | - title () { | ||
| 186 | - return { | ||
| 187 | - inner: this.title | ||
| 188 | - } | ||
| 189 | - } | ||
| 190 | - }, | ||
| 191 | - watch: { | ||
| 192 | - | ||
| 193 | - // 设置页面标题 | ||
| 194 | - title(newVal) { | ||
| 195 | - if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") { | ||
| 196 | - this.$iFrame.insertIFrame(newVal); | ||
| 197 | - } else { | ||
| 198 | - this.$emit("updateHead"); | ||
| 199 | - } | ||
| 200 | - } | ||
| 201 | - }, | ||
| 202 | - mounted() { | ||
| 203 | - | ||
| 204 | - } | ||
| 205 | - } | ||
| 206 | -</script> | ||
| 207 | - | ||
| 208 | -<!-- Add "scoped" attribute to limit CSS to this component only --> | ||
| 209 | -<style rel="stylesheet/less" lang='less' scoped> | ||
| 210 | - @import "com"; | ||
| 211 | -</style> |
src/pages/index/index.less deleted
100644 → 0
src/pages/mall/mall.less
0 → 100644
src/pages/index/index.vue renamed to src/pages/mall/mall.vue
| 1 | <template> | 1 | <template> |
| 2 | - <div> | ||
| 3 | - <!--轮播--> | ||
| 4 | - <swiper v-if="activityAdInfo&&activityAdInfo.banner" :swipers="activityAdInfo.banner"></swiper> | ||
| 5 | - <!--导航--> | ||
| 6 | - <swiperItem v-if="activityAdInfo&&activityAdInfo.nav" :navs="activityAdInfo.navs"></swiperItem> | ||
| 7 | - <!--优惠专区--> | ||
| 8 | - <discountZone :discountZoneInfo="discountZoneInfo"></discountZone> | ||
| 9 | - <!--天天特惠--> | ||
| 10 | - <preferential :preferentialInfo="preferentialInfo"></preferential> | ||
| 11 | - <!--视听专区--> | ||
| 12 | - <videoArea :videoAreaInfo="videoAreaInfo"></videoArea> | ||
| 13 | - </div> | 2 | + <div class="mall-box"> |
| 3 | + | ||
| 4 | + <!--轮播--> | ||
| 5 | + <swiper v-if="banner" | ||
| 6 | + :swipers="banner"> | ||
| 7 | + </swiper> | ||
| 8 | + | ||
| 9 | + <!--导航--> | ||
| 10 | + <swiperItem v-if="navs" | ||
| 11 | + :navs="navs"> | ||
| 12 | + </swiperItem> | ||
| 13 | + | ||
| 14 | + <!-- 遍历ads,输出列表数据 --> | ||
| 15 | + <div class="ads-box"> | ||
| 16 | + <div class="ads" v-for="(item, index) in ads" :key="index"> | ||
| 17 | + | ||
| 18 | + <!--优惠专区--> | ||
| 19 | + <discountZone v-if="item.style == '1'" @more="toDetail" @toDetail="toDetail" | ||
| 20 | + :discountZoneInfo="item"> | ||
| 21 | + </discountZone> | ||
| 22 | + | ||
| 23 | + <!--天天特惠--> | ||
| 24 | + <preferential v-if="item.style == '2'" @more="toDetail" @toDetail="toDetail" | ||
| 25 | + :preferentialInfo="item"> | ||
| 26 | + </preferential> | ||
| 27 | + | ||
| 28 | + <!--视听专区--> | ||
| 29 | + <videoArea v-if="item.style == '13'" @more="toDetail" @toDetail="toDetail" | ||
| 30 | + :videoAreaInfo="item"> | ||
| 31 | + </videoArea> | ||
| 32 | + | ||
| 33 | + <!-- style_7组件 --> | ||
| 34 | + <style-7 v-if="item.style == '7'" @more="toDetail" @bannerJump="toDetail" @jump=jump @addCart=addCart | ||
| 35 | + :styles="item"> | ||
| 36 | + </style-7> | ||
| 37 | + </div> | ||
| 38 | + </div> | ||
| 39 | + </div> | ||
| 14 | </template> | 40 | </template> |
| 15 | 41 | ||
| 16 | <script> | 42 | <script> |
| 43 | + // 引入组件 | ||
| 44 | + import { Toast, Indicator } from "mint-ui"; | ||
| 17 | import swiper from "@/components/swiper/swiper"; | 45 | import swiper from "@/components/swiper/swiper"; |
| 18 | import swiperItem from "@/components/swiperItem/swiperItem"; | 46 | import swiperItem from "@/components/swiperItem/swiperItem"; |
| 19 | import discountZone from "@/components/discountZone/discountZone"; | 47 | import discountZone from "@/components/discountZone/discountZone"; |
| 20 | import preferential from "@/components/preferential/preferential"; | 48 | import preferential from "@/components/preferential/preferential"; |
| 21 | import videoArea from "@/components/videoArea/videoArea"; | 49 | import videoArea from "@/components/videoArea/videoArea"; |
| 22 | - import { Toast, Indicator } from "mint-ui"; | ||
| 23 | - export default { | ||
| 24 | - name: 'index', | ||
| 25 | - data () { | ||
| 26 | - return { | ||
| 27 | - activityAdInfo:null, | ||
| 28 | - discountZoneInfo:null, // 优惠专区 | ||
| 29 | - preferentialInfo:null, // 天天特价 | ||
| 30 | - videoAreaInfo:null // 视听专区 | ||
| 31 | - } | ||
| 32 | - }, | ||
| 33 | - filters: { | ||
| 34 | - | ||
| 35 | - capitalize: function (value) { | ||
| 36 | - if (!value) return '' | ||
| 37 | - value = value.toString() | ||
| 38 | - return value.charAt(0).toUpperCase() + value.slice(1) | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - }, | ||
| 42 | - components:{ | ||
| 43 | - swiper, | ||
| 44 | - swiperItem, | ||
| 45 | - discountZone, | ||
| 46 | - preferential, | ||
| 47 | - videoArea | ||
| 48 | - }, | ||
| 49 | - created(){ | ||
| 50 | - this.activityAd(); | ||
| 51 | - }, | ||
| 52 | - methods: { | ||
| 53 | - /** | 50 | + import style7 from "@/components/style_7/style_7"; |
| 51 | + | ||
| 52 | + export default { | ||
| 53 | + name: 'mall', | ||
| 54 | + data() { | ||
| 55 | + return { | ||
| 56 | + title: "", // 标题 | ||
| 57 | + banner:null, // banner | ||
| 58 | + navs: null, // 导航 | ||
| 59 | + ads: null // 列表 | ||
| 60 | + } | ||
| 61 | + }, | ||
| 62 | + components:{ | ||
| 63 | + swiper, | ||
| 64 | + swiperItem, | ||
| 65 | + discountZone, | ||
| 66 | + preferential, | ||
| 67 | + videoArea, | ||
| 68 | + style7 | ||
| 69 | + }, | ||
| 70 | + created() { | ||
| 71 | + | ||
| 72 | + // 设置标题 | ||
| 73 | + this.$set(this, "title", "优选库商城"); | ||
| 74 | + | ||
| 75 | + // 获取优选库精选活动 | ||
| 76 | + this.activityAd(); | ||
| 77 | + }, | ||
| 78 | + methods: { | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * 获取优选库精选活动 | ||
| 82 | + */ | ||
| 83 | + activityAd() { | ||
| 84 | + // 加载中提示 | ||
| 85 | + Indicator.open("加载中..."); | ||
| 86 | + | ||
| 87 | + // 获取证书请求接口 | ||
| 88 | + this.http("/Api/" + this.getApiVersion().index + "/activityAd", { | ||
| 89 | + id: this.$route.query.id | ||
| 90 | + }, this.activityAdCallback, { | ||
| 91 | + method: "post" | ||
| 92 | + } | ||
| 93 | + ); | ||
| 94 | + }, | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * 获取优选库精选活动回调 | ||
| 98 | + * @param {object} res [服务器返回数据] | ||
| 99 | + * @param {object} ext [扩展参数] | ||
| 100 | + */ | ||
| 101 | + activityAdCallback(res, ext) { | ||
| 102 | + | ||
| 103 | + // 加载完成 | ||
| 104 | + Indicator.close(); | ||
| 105 | + | ||
| 106 | + // 返回处理 | ||
| 107 | + if (res.code == 200) { | ||
| 108 | + | ||
| 109 | + // 解构数据 | ||
| 110 | + let { data: datas } = res; | ||
| 111 | + | ||
| 112 | + /* 获取优选库精选活动数据 开始 */ | ||
| 113 | + | ||
| 114 | + // 设置banner数据 | ||
| 115 | + if (datas.banner && datas.banner.length) { | ||
| 116 | + this.$set(this, "banner", datas.banner); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + // 设置navs数据 | ||
| 120 | + if (datas.navs && datas.navs.length) { | ||
| 121 | + this.$set(this, "navs", datas.navs); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + // 设置ads数据 | ||
| 125 | + if (datas.ads && datas.ads.length) { | ||
| 126 | + this.$set(this, "ads", datas.ads); | ||
| 127 | + } | ||
| 128 | + } else if (res.code == 400) { | ||
| 129 | + | ||
| 130 | + // 获取优选库精选活动失败 | ||
| 131 | + Toast(res.message); | ||
| 132 | + } else { | ||
| 133 | + | ||
| 134 | + // 获取优选库精选活动失败 | ||
| 135 | + Toast("获取优选库精选活动失败"); | ||
| 136 | + } | ||
| 137 | + }, | ||
| 138 | + | ||
| 139 | + /** | ||
| 54 | * 调用通用跳转 | 140 | * 调用通用跳转 |
| 55 | * @param {object} item [通用跳转对象] | 141 | * @param {object} item [通用跳转对象] |
| 56 | */ | 142 | */ |
| @@ -63,60 +149,61 @@ | @@ -63,60 +149,61 @@ | ||
| 63 | this.$parent.gotoDetail(item); | 149 | this.$parent.gotoDetail(item); |
| 64 | } | 150 | } |
| 65 | }, | 151 | }, |
| 66 | - /** | ||
| 67 | - * 获取优选库精选活动 | ||
| 68 | - */ | ||
| 69 | - activityAd() { | ||
| 70 | - // 加载中提示 | ||
| 71 | - Indicator.open("加载中..."); | ||
| 72 | - | ||
| 73 | - // 获取证书请求接口 | ||
| 74 | - this.http( | ||
| 75 | - "/Api/" + this.getApiVersion().index + "/activityAd", | ||
| 76 | - { | ||
| 77 | -// id: this.$route.query.id | ||
| 78 | - id: 20 | ||
| 79 | - }, | ||
| 80 | - this.activityAdCallback, | ||
| 81 | - { | ||
| 82 | - method: "post" | 152 | + |
| 153 | + /** | ||
| 154 | + * style7跳转 | ||
| 155 | + * @param {object} item [数据对象] | ||
| 156 | + */ | ||
| 157 | + jump(item) { | ||
| 158 | + | ||
| 159 | + // 判断并调用通用跳转 | ||
| 160 | + if (typeof this.$parent.gotoDetail === "function") { | ||
| 161 | + | ||
| 162 | + // 构造跳转详情页参数 | ||
| 163 | + let options = { | ||
| 164 | + type: "2", | ||
| 165 | + to: item.id, | ||
| 166 | + shop_type: item.shop_type | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + this.$parent.gotoDetail(options); | ||
| 83 | } | 170 | } |
| 84 | - ); | 171 | + }, |
| 172 | + | ||
| 173 | + /** | ||
| 174 | + * 加入购物车 | ||
| 175 | + * @param {object} item [数据对象] | ||
| 176 | + */ | ||
| 177 | + addCart(item) { | ||
| 178 | + | ||
| 179 | + | ||
| 180 | + console.log("addCartA", item); | ||
| 181 | + | ||
| 182 | + | ||
| 183 | + } | ||
| 85 | }, | 184 | }, |
| 86 | - /** | ||
| 87 | - * 获取优选库精选活动 | ||
| 88 | - * @param {object} res [服务器返回数据] | ||
| 89 | - * @param {object} ext [扩展参数] | ||
| 90 | - */ | ||
| 91 | - activityAdCallback(res, ext) { | ||
| 92 | - // 加载完成 | ||
| 93 | - Indicator.close(); | ||
| 94 | - // 返回处理 | ||
| 95 | - if (res.code == 200) { | ||
| 96 | - // 解构数据 | ||
| 97 | - let { data: datas } = res; | ||
| 98 | - /* 获取获取证书信息 开始 */ | ||
| 99 | - this.activityAdInfo = res.data; | ||
| 100 | - // 优惠专区 | ||
| 101 | - this.discountZoneInfo = this.activityAdInfo.ads.filter(n => n.style==1); | ||
| 102 | - // 天天特价 | ||
| 103 | - this.preferentialInfo = this.activityAdInfo.ads.filter(n => n.style==2); | ||
| 104 | - // 视听专区 | ||
| 105 | - this.videoAreaInfo = this.activityAdInfo.ads.filter(n => n.style==13); | ||
| 106 | - | ||
| 107 | - } else if (res.code == 400) { | ||
| 108 | - // 获取证书信息失败 | ||
| 109 | - Toast(res.message); | ||
| 110 | - } else { | ||
| 111 | - // 获取证书信息计划失败 | ||
| 112 | - Toast("获取优选库精选活动失败"); | 185 | + head: { |
| 186 | + title () { | ||
| 187 | + return { | ||
| 188 | + inner: this.title | ||
| 189 | + } | ||
| 113 | } | 190 | } |
| 114 | }, | 191 | }, |
| 192 | + watch: { | ||
| 193 | + | ||
| 194 | + // 设置页面标题 | ||
| 195 | + title(newVal) { | ||
| 196 | + if (this.$store.state.browser.toLowerCase() == "qq" && this.$store.state.deviceType.toLowerCase() == "iphone") { | ||
| 197 | + this.$iFrame.insertIFrame(newVal); | ||
| 198 | + } else { | ||
| 199 | + this.$emit("updateHead"); | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + } | ||
| 115 | } | 203 | } |
| 116 | - } | ||
| 117 | </script> | 204 | </script> |
| 118 | 205 | ||
| 119 | <!-- Add "scoped" attribute to limit CSS to this component only --> | 206 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| 120 | <style rel="stylesheet/less" lang="less" scoped> | 207 | <style rel="stylesheet/less" lang="less" scoped> |
| 121 | - @import "index"; | 208 | + @import "mall"; |
| 122 | </style> | 209 | </style> |
src/router/index.js
| @@ -14,25 +14,14 @@ const router = new Router({ | @@ -14,25 +14,14 @@ const router = new Router({ | ||
| 14 | component: resolve => { | 14 | component: resolve => { |
| 15 | require(["@/pages/common/common"], resolve); | 15 | require(["@/pages/common/common"], resolve); |
| 16 | }, | 16 | }, |
| 17 | - redirect: "/index", | 17 | + redirect: "/mall", |
| 18 | children: [ | 18 | children: [ |
| 19 | { | 19 | { |
| 20 | - // 首页 | ||
| 21 | - path: "/index", | ||
| 22 | - name: "index", | 20 | + // 优选库商城活动页 |
| 21 | + path: "/mall", | ||
| 22 | + name: "mall", | ||
| 23 | component: resolve => { | 23 | component: resolve => { |
| 24 | - require(["@/pages/index/index"], resolve); | ||
| 25 | - }, | ||
| 26 | - meta: { | ||
| 27 | - requireAuth: false | ||
| 28 | - } | ||
| 29 | - }, | ||
| 30 | - { | ||
| 31 | - // 首页 | ||
| 32 | - path: "/com", | ||
| 33 | - name: "com", | ||
| 34 | - component: resolve => { | ||
| 35 | - require(["@/pages/com/com"], resolve); | 24 | + require(["@/pages/mall/mall"], resolve); |
| 36 | }, | 25 | }, |
| 37 | meta: { | 26 | meta: { |
| 38 | requireAuth: false | 27 | requireAuth: false |
| @@ -42,7 +31,7 @@ const router = new Router({ | @@ -42,7 +31,7 @@ const router = new Router({ | ||
| 42 | }, | 31 | }, |
| 43 | { | 32 | { |
| 44 | path: "*", | 33 | path: "*", |
| 45 | - redirect: "/index" | 34 | + redirect: "/mall" |
| 46 | } | 35 | } |
| 47 | ] | 36 | ] |
| 48 | }); | 37 | }); |