home.vue
9.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<template>
<div class="main">
<!--轮播广告-->
<template v-for="vm in weiIndex.fields">
<template v-if="vm.fieldType=='imageAdv'">
<mt-swipe :auto="4000" style="height:4.2rem" v-if="vm.content.imageType==2">
<mt-swipe-item :style="{'background-image':'url('+item.image+')'}"
v-for="item in vm.content.navList" @click.native="gotopage(item.prefix,item.url)">
<div class="component-swipe-title" v-if="item.title!=''">{{item.title}}</div>
</mt-swipe-item>
</mt-swipe>
<!--轮播广告分开显示-->
<ul v-else>
<no-swpie-adv :style="{'background-image':'url('+item.image+')'}" v-for="item in vm.content.navList"
@click.native="gotopage(item.prefix,item.url)">
<div class="component-swipe-title" ref="title" v-if="item.title!=''">
斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达斯柯达
</div>
</no-swpie-adv>
</ul>
</template>
<!--商品-->
<template v-if="vm.fieldType=='product'">
<!--商品大图-->
<ul v-if="vm.content.listType==4">
<big-pic v-for="item in vm.content.goods" :item="item" :showType="vm.content.showType"
:showTitle="vm.content.showTitle" :isShowPrice="vm.content.isShowPrice"
:siteUnitName="weiIndex.siteUnitName"></big-pic>
</ul>
<!--商品小图-->
<ul class="goods-small-ul" v-if="vm.content.listType==1">
<small-pic v-for="item in vm.content.goods" :item="item" :showType="vm.content.showType"
:showTitle="vm.content.showTitle" :isShowPrice="vm.content.isShowPrice"
:siteUnitName="weiIndex.siteUnitName"></small-pic>
</ul>
<!--商品详细列表-->
<ul class="goods-piclist-ul" v-if="vm.content.listType==3">
<small-pic-list v-for="item in vm.content.goods" :item="item" :showType="vm.content.showType"
:showTitle="vm.content.showTitle" :isShowPrice="vm.content.isShowPrice"
:siteUnitName="weiIndex.siteUnitName"></small-pic-list>
</ul>
<!--商品一大两小-->
<div v-if="vm.content.listType==2">
<mix-pic :data="vm.content.goods" :showType="vm.content.showType" :showTitle="vm.content.showTitle"
:isShowPrice="vm.content.isShowPrice" :siteUnitName="weiIndex.siteUnitName"></mix-pic>
</div>
</template>
<!--商品组-->
<template v-if="vm.fieldType=='productList'">
<router-link
:to="{ name: 'goodsGroup',params: {typer:'productGroup',productListId: vm.content.groupId}}"
tag="div" class="component-text-nav">
<span>{{vm.content.groupTitle}}</span><img src="../../static/images/arr.svg"/>
</router-link>
<!--商品大图-->
<ul v-if="vm.content.listType==4">
<big-pic v-for="item in vm.content.goods" :item="item" :showType="vm.content.showType"
:showTitle="vm.content.showTitle" :isShowPrice="vm.content.isShowPrice"
:siteUnitName="weiIndex.siteUnitName"></big-pic>
</ul>
<!--商品小图-->
<ul class="goods-small-ul" v-if="vm.content.listType==1">
<small-pic v-for="item in vm.content.goods" :item="item" :showType="vm.content.showType"
:showTitle="vm.content.showTitle" :isShowPrice="vm.content.isShowPrice"
:siteUnitName="weiIndex.siteUnitName"></small-pic>
</ul>
<!--商品详细列表-->
<ul class="goods-piclist-ul" v-if="vm.content.listType==3">
<small-pic-list v-for="item in vm.content.goods" :item="item" :showType="vm.content.showType"
:showTitle="vm.content.showTitle" :isShowPrice="vm.content.isShowPrice"
:siteUnitName="weiIndex.siteUnitName"></small-pic-list>
</ul>
<!--商品一大两小-->
<div v-if="vm.content.listType==2">
<mix-pic :data="vm.content.goods" :showType="vm.content.showType" :showTitle="vm.content.showTitle"
:isShowPrice="vm.content.isShowPrice" :siteUnitName="weiIndex.siteUnitName"></mix-pic>
</div>
</template>
<!--标题-->
<titler v-if="vm.fieldType=='title'" :data="vm.content"></titler>
<!--文本导航-->
<template v-if="vm.fieldType=='textNav'">
<text-nav v-for="item in vm.content" :item="item"></text-nav>
</template>
<!--辅助线-->
<div class="component-Guide" v-if="vm.fieldType=='line'"></div>
<!--辅助空白-->
<div class="component-blank" v-if="vm.fieldType=='white'" :style="{'height':vm.content.height+'px'}"></div>
<!--富文本-->
<div class="component-Rich-text" v-if="vm.fieldType=='richText'" :style="{'background':vm.content.bgColor}"
v-html="vm.content.textContent"></div>
<!--图片导航-->
<div class="component-picNav-table" v-if="vm.fieldType=='imageNav'">
<pic-nav v-for="item in vm.content" :item="item"></pic-nav>
</div>
<!--商品搜索-->
<router-link to="/search" tag="div" class="component-search" v-if="vm.fieldType=='search'">
<button>请输入商品名称或分类</button>
</router-link>
<!--公告组件-->
<notice v-if="vm.fieldType=='notice'" :data="vm.content"></notice>
<!--优惠券组件-->
<template v-if="vm.fieldType=='coupons'">
<index-coupon-item v-for="item in vm.content.couponArr" :item="item"
:siteUnitName="weiIndex.siteUnitName"></index-coupon-item>
</template>
<!--优惠券中心-->
<router-link to="/couponCenter" tag="div" class="coupon-center"
v-if="vm.fieldType=='couponCenter'"></router-link>
</template>
<!--底部导航-->
<bottom-nav></bottom-nav>
</div>
</template>
<style>
.main .mint-swipe-indicators {
left: auto !important;
bottom: 5px !important;
right: -16px;
}
image[lazy=loading] {
width: 40px !important;
height: 50vw;
margin: auto;
}
</style>
<script type="text/ecmascript-6">
import noSwpieAdv from '../adv/noSwpieAdv.vue';
import bigPic from '../goods/bigPic.vue';
import smallPic from '../goods/smallPic.vue';
import smallPicList from '../goods/smallPicList.vue';
import mixPic from '../goods/mixPic.vue';
import titler from '../index/title.vue';
import textNav from '../index/textNav.vue';
import picNav from '../index/picNav.vue';
import notice from '../index/notice.vue';
import indexCouponItem from '../coupon/indexCouponItem.vue';
import bottomNav from '../common/bottomNav.vue';
import {getweiIndext} from '../../vuex/actions';
import {goto} from '../../utils/commonUtil';
export default {
data() {
return {}
},
components: {
noSwpieAdv,
bigPic,
smallPic,
smallPicList,
mixPic,
titler,
textNav,
picNav,
notice,
indexCouponItem,
bottomNav
},
methods: {
gotopage(type, url){
goto.gotopage(this, type, url);
}
},
vuex: {
getters: {
weiIndex: ({weiPageData}) => {
return weiPageData.weiIndex;
}
},
actions: {
getweiIndext,
}
},
beforeRouteEnter (to, from, next){
next(vm => {
vm.getweiIndext(0);
});
},
beforeRouteLeave (to, from, next){
next();
}
}
</script>