Commit 8dd518b4017e4bc20e034c1f3fe073ad1b331168
1 parent
178576ee
优化
Showing
4 changed files
with
34 additions
and
14 deletions
src/components/discountZone/discountZone.vue
| 1 | 1 | <template> |
| 2 | 2 | <div> |
| 3 | - <titleBox :titles="titles"></titleBox> | |
| 3 | + <titleBox :titles="discountZoneInfo[0]"></titleBox> | |
| 4 | 4 | <div class="item_box"> |
| 5 | 5 | <div class="left"> |
| 6 | 6 | <img src="/static/img/pic_1.jpg" alt="网家家"/> |
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | titles:null |
| 25 | 25 | } |
| 26 | 26 | }, |
| 27 | + props:["discountZoneInfo"], | |
| 27 | 28 | components:{ |
| 28 | 29 | titleBox |
| 29 | 30 | }, | ... | ... |
src/components/swiperItem/swiperItem.vue
| ... | ... | @@ -5,8 +5,8 @@ |
| 5 | 5 | <div class="app_list_box"> |
| 6 | 6 | <div class="app_list"> |
| 7 | 7 | <div v-for="(items, index) in item" :key="index" @click="$parent.toDetail(item)"> |
| 8 | - <img v-lazy="item.simg" /> | |
| 9 | - <div>{{item.title}}</div> | |
| 8 | + <img v-lazy="items.simg" /> | |
| 9 | + <div>{{items.title}}</div> | |
| 10 | 10 | </div> |
| 11 | 11 | </div> |
| 12 | 12 | </div> | ... | ... |
src/components/titleBox/titleBox.vue
| ... | ... | @@ -2,9 +2,9 @@ |
| 2 | 2 | <div class="title-box" v-if="titles"> |
| 3 | 3 | <div class="box"> |
| 4 | 4 | <div class="title-img-box"> |
| 5 | - <img :src="titles.title" class="title-img" mode="widthFix" /> | |
| 5 | + <img :src="titles.simg" class="title-img" mode="widthFix" /> | |
| 6 | 6 | </div> |
| 7 | - <div class="more-box" @click="more(titles.more)"> | |
| 7 | + <div class="more-box" @click="more(titles.is_more)"> | |
| 8 | 8 | <div class="more-text">更多</div> |
| 9 | 9 | <img class="more-arrow-right-img" src="static/img/icon_arrow_right.png" /> |
| 10 | 10 | </div> |
| ... | ... | @@ -16,12 +16,12 @@ |
| 16 | 16 | export default { |
| 17 | 17 | data: function () { |
| 18 | 18 | return { |
| 19 | - | |
| 19 | + | |
| 20 | 20 | } |
| 21 | 21 | }, |
| 22 | 22 | props: ["titles"], |
| 23 | 23 | methods: { |
| 24 | - | |
| 24 | + | |
| 25 | 25 | /** |
| 26 | 26 | * 更多 |
| 27 | 27 | * @param {object} item [数据对象] |
| ... | ... | @@ -36,4 +36,4 @@ |
| 36 | 36 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| 37 | 37 | <style rel="stylesheet/less" lang="less"> |
| 38 | 38 | @import './titleBox'; |
| 39 | -</style> | |
| 40 | 39 | \ No newline at end of file |
| 40 | +</style> | ... | ... |
src/pages/index/index.vue
| ... | ... | @@ -3,13 +3,13 @@ |
| 3 | 3 | <!--轮播--> |
| 4 | 4 | <swiper v-if="activityAdInfo&&activityAdInfo.banner" :swipers="activityAdInfo.banner"></swiper> |
| 5 | 5 | <!--导航--> |
| 6 | - <swiperItem v-if="activityAdInfo&&activityAdInfo.nav" :navs="activityAdInfo.nav"></swiperItem> | |
| 6 | + <swiperItem v-if="activityAdInfo&&activityAdInfo.nav" :navs="activityAdInfo.navs"></swiperItem> | |
| 7 | 7 | <!--优惠专区--> |
| 8 | - <discountZone></discountZone> | |
| 8 | + <discountZone :discountZoneInfo="discountZoneInfo"></discountZone> | |
| 9 | 9 | <!--天天特惠--> |
| 10 | - <preferential></preferential> | |
| 10 | + <preferential :preferentialInfo="preferentialInfo"></preferential> | |
| 11 | 11 | <!--视听专区--> |
| 12 | - <videoArea></videoArea> | |
| 12 | + <videoArea :videoAreaInfo="videoAreaInfo"></videoArea> | |
| 13 | 13 | </div> |
| 14 | 14 | </template> |
| 15 | 15 | |
| ... | ... | @@ -24,10 +24,22 @@ |
| 24 | 24 | name: 'index', |
| 25 | 25 | data () { |
| 26 | 26 | return { |
| 27 | - activityAdInfo:null | |
| 27 | + activityAdInfo:null, | |
| 28 | + discountZoneInfo:null, // 优惠专区 | |
| 29 | + preferentialInfo:null, // 天天特价 | |
| 30 | + videoAreaInfo:null // 视听专区 | |
| 28 | 31 | } |
| 29 | 32 | }, |
| 30 | - components:{ | |
| 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:{ | |
| 31 | 43 | swiper, |
| 32 | 44 | swiperItem, |
| 33 | 45 | discountZone, |
| ... | ... | @@ -85,6 +97,13 @@ |
| 85 | 97 | let { data: datas } = res; |
| 86 | 98 | /* 获取获取证书信息 开始 */ |
| 87 | 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 | + | |
| 88 | 107 | } else if (res.code == 400) { |
| 89 | 108 | // 获取证书信息失败 |
| 90 | 109 | Toast(res.message); | ... | ... |