jufubao-forms 1.0.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/commands.js +84 -0
- package/commands.update.change.js +176 -0
- package/file.config.js +16 -0
- package/get.package.path.js +22 -0
- package/get.package.path.js.tpl +22 -0
- package/package.json +119 -0
- package/src/CreateClientID.js +16 -0
- package/src/ICONS.js +1148 -0
- package/src/common/authorize.js +261 -0
- package/src/common/getBusinessImageUrl.js +39 -0
- package/src/common/getServiceUrl.js +38 -0
- package/src/common/paysdk/jweixin.js +98 -0
- package/src/components/CusCouponChose/CusCouponChose.vue +1024 -0
- package/src/components/CusCouponItem/CusCouponItem.vue +298 -0
- package/src/components/CusEnter/CusEnter.vue +333 -0
- package/src/components/CusPoster/CusPoster.vue +213 -0
- package/src/components/CusPoster/CusSwiperDot.vue +234 -0
- package/src/components/CusProduct/CusProduct.vue +362 -0
- package/src/components/CusSwiperDot/CusSwiperDot.vue +234 -0
- package/src/components/CusTab/CusTab.vue +411 -0
- package/src/components/CusVideo/CusVideo.vue +170 -0
- package/src/components/JfbFormsDynamicForm/Api.js +66 -0
- package/src/components/JfbFormsDynamicForm/Attr.js +35 -0
- package/src/components/JfbFormsDynamicForm/JfbFormsDynamicForm.vue +767 -0
- package/src/components/JfbFormsDynamicForm/JfbFormsDynamicFormLess.less +79 -0
- package/src/components/JfbFormsDynamicForm/JfbFormsDynamicFormMixin.js +30 -0
- package/src/components/JfbFormsDynamicForm/Mock.js +194 -0
- package/src/components/JfbFormsDynamicForm/XdFormDate.vue +71 -0
- package/src/components/JfbFormsDynamicForm/ld-select/ld-select.vue +329 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/calendar-item.vue +177 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/calendar.vue +930 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/en.json +22 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/index.js +8 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/zh-Hans.json +22 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/i18n/zh-Hant.json +22 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/time-picker.vue +934 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/uni-datetime-picker.vue +1042 -0
- package/src/components/JfbFormsDynamicForm/uni-datetime-picker/util.js +403 -0
- package/src/components/JfbFormsList/Api.js +20 -0
- package/src/components/JfbFormsList/Attr.js +70 -0
- package/src/components/JfbFormsList/JfbFormsList.vue +228 -0
- package/src/components/JfbFormsList/JfbFormsListLess.less +79 -0
- package/src/components/JfbFormsList/JfbFormsListMixin.js +30 -0
- package/src/components/JfbFormsList/Mock.js +38 -0
- package/src/components/JfbFormsQuestionAndAnswer/Api.js +43 -0
- package/src/components/JfbFormsQuestionAndAnswer/Attr.js +14 -0
- package/src/components/JfbFormsQuestionAndAnswer/JfbFormsQuestionAndAnswer.vue +506 -0
- package/src/components/JfbFormsQuestionAndAnswer/JfbFormsQuestionAndAnswerLess.less +79 -0
- package/src/components/JfbFormsQuestionAndAnswer/JfbFormsQuestionAndAnswerMixin.js +30 -0
- package/src/components/JfbFormsQuestionAndAnswer/Mock.js +144 -0
- package/src/components/SkeProduct/SkeProduct.vue +241 -0
- package/src/config.app.plus.js +6 -0
- package/src/config.h5.js +13 -0
- package/src/config.mp.weixin.js +13 -0
- package/src/config.project.js +15 -0
- package/src/mixins/cardListMixins.js +187 -0
- package/src/mixins/colorCardMixins.js +122 -0
- package/src/mixins/componentsMixins.js +900 -0
- package/src/mixins/extsMixins.js +3 -0
- package/src/mixins/locationMixins.js +119 -0
- package/src/mixins/newLocaltionMixins.js +754 -0
- package/src/mixins/openDebuggerMixins.js +74 -0
- package/src/mixins/pageEditx.js +347 -0
- package/src/mixins/pageEvent.js +311 -0
- package/src/mixins/pageMain.js +120 -0
- package/src/mixins/pageUitls.js +738 -0
- package/src/mixins/posterMixins.js +122 -0
- package/src/mixins/scrollListFixedHeigthMixins.js +174 -0
- package/src/mocks.js +4 -0
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="product" :class="{two: cell >= 2 , one: cell === 1}" @click="handleDetail()">
|
|
3
|
+
<view
|
|
4
|
+
class="product-image"
|
|
5
|
+
:style="{
|
|
6
|
+
marginRight: (cell === 1 ? (cellSpacing + 'rpx'):0),
|
|
7
|
+
marginBottom: (cell === 1 ? 0: (cellSpacing + 'rpx')),
|
|
8
|
+
width: (cell === 1 ? '200rpx': '100%'),
|
|
9
|
+
height: (cell === 1 ? '200rpx': (height + 'rpx')),
|
|
10
|
+
backgroundColor: '#f8f8f8',
|
|
11
|
+
borderRadius: imageRadius + 'rpx',
|
|
12
|
+
}"
|
|
13
|
+
>
|
|
14
|
+
<image v-if="errorStatus" :src="errorImage" :alt="item['product_name']" ></image>
|
|
15
|
+
<image v-if="!errorStatus" :src="imageUrl" :alt="item['product_name']" @error="handleError(item)"></image>
|
|
16
|
+
<xd-product-status :status="item['status']"></xd-product-status>
|
|
17
|
+
</view>
|
|
18
|
+
<view class="product-content">
|
|
19
|
+
<view class="product-content-info">
|
|
20
|
+
<view class="name" :style="[nameFont]" v-html="cusName" :class="{showOne: isOne}"></view>
|
|
21
|
+
<view
|
|
22
|
+
class="brand"
|
|
23
|
+
v-if="productConfig.is_show_brand==='Y'"
|
|
24
|
+
:style="{color:brandColor}"
|
|
25
|
+
>{{item['brand_name']}}</view>
|
|
26
|
+
<view class="tags" :class="{showTwo:!isOne}">
|
|
27
|
+
<view
|
|
28
|
+
v-for="tag in tagsList"
|
|
29
|
+
:key="tag"
|
|
30
|
+
:style="{background:tagObjColor[tag]}"
|
|
31
|
+
>{{tagObj[tag]}}</view>
|
|
32
|
+
</view>
|
|
33
|
+
</view>
|
|
34
|
+
<view class="product-content-btn" v-if="isBtn">
|
|
35
|
+
<view :class="{onePrice: onePrice }">
|
|
36
|
+
<view v-if="productConfig.isPrice === 'Y'">
|
|
37
|
+
<xd-unit
|
|
38
|
+
:price="(item['promo_price'] || item['sale_price'])"
|
|
39
|
+
:isOld="false"
|
|
40
|
+
:iconSize="cell <= 2?0.3:0.26"
|
|
41
|
+
:fontSize="cell <= 2?36:26"
|
|
42
|
+
/>
|
|
43
|
+
</view>
|
|
44
|
+
<view
|
|
45
|
+
v-if="productConfig.isShowDiscount==='Y' && checkDiscountPrice"
|
|
46
|
+
:style="{color:oldPriceColor}" class="oldPrice">
|
|
47
|
+
<xd-unit
|
|
48
|
+
:price="dividePrice"
|
|
49
|
+
:iconSize="0.21"
|
|
50
|
+
:fontSize="cell <= 2?24:22"
|
|
51
|
+
delete-line
|
|
52
|
+
is-gray
|
|
53
|
+
/>
|
|
54
|
+
</view>
|
|
55
|
+
</view>
|
|
56
|
+
<view>
|
|
57
|
+
<view @click.stop="handleDetail('Y')" v-if="productConfig.isAddCart === 'Y'">
|
|
58
|
+
<xd-font-icon
|
|
59
|
+
icon="icongouwuche-01"
|
|
60
|
+
:color="color"
|
|
61
|
+
size="40"
|
|
62
|
+
></xd-font-icon>
|
|
63
|
+
</view>
|
|
64
|
+
</view>
|
|
65
|
+
</view>
|
|
66
|
+
</view>
|
|
67
|
+
</view>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
import getServiceUrl from "@/common/getServiceUrl";
|
|
72
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon.vue";
|
|
73
|
+
import XdProductStatus from "@/components/XdProductStatus/XdProductStatus";
|
|
74
|
+
import XdUnit from "@/components/XdUnit/XdUnit.vue";
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
export default {
|
|
78
|
+
name: "CusProduct",
|
|
79
|
+
components:{
|
|
80
|
+
XdFontIcon,
|
|
81
|
+
XdUnit,
|
|
82
|
+
XdProductStatus
|
|
83
|
+
},
|
|
84
|
+
props:{
|
|
85
|
+
keyword:{
|
|
86
|
+
type:String,
|
|
87
|
+
default:''
|
|
88
|
+
},
|
|
89
|
+
nameFont: {
|
|
90
|
+
type:Object,
|
|
91
|
+
default(){
|
|
92
|
+
return {}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
height:{
|
|
97
|
+
type:Number|String,
|
|
98
|
+
default:"auto",
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
item:Object,
|
|
102
|
+
cellSpacing: {
|
|
103
|
+
type: Number|String,
|
|
104
|
+
default: 20
|
|
105
|
+
},
|
|
106
|
+
rowSpacing: {
|
|
107
|
+
type: Number|String,
|
|
108
|
+
default: 20
|
|
109
|
+
},
|
|
110
|
+
color:{
|
|
111
|
+
type:String,
|
|
112
|
+
default:'red',
|
|
113
|
+
},
|
|
114
|
+
brandColor:{
|
|
115
|
+
type: String,
|
|
116
|
+
default: '#999'
|
|
117
|
+
},
|
|
118
|
+
oldPriceColor: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: '#999'
|
|
121
|
+
},
|
|
122
|
+
imageRadius:{
|
|
123
|
+
type: String|Number,
|
|
124
|
+
default: '10'
|
|
125
|
+
},
|
|
126
|
+
cell:{
|
|
127
|
+
type: Number|String,
|
|
128
|
+
required: true
|
|
129
|
+
},
|
|
130
|
+
productConfig:{
|
|
131
|
+
type:Object|null,
|
|
132
|
+
default: null
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
computed:{
|
|
136
|
+
onePrice(){
|
|
137
|
+
if(this.cell === 1) return true;
|
|
138
|
+
if(this.cell === 3) return false;
|
|
139
|
+
if(this.cell === 2) return false;
|
|
140
|
+
},
|
|
141
|
+
cusName(){
|
|
142
|
+
return this.item['product_name'] || this.item['list_title']
|
|
143
|
+
},
|
|
144
|
+
imageUrl(){
|
|
145
|
+
if(!this.item['thumb']) return getServiceUrl('/common/empty/product.png?v1=1','size4')
|
|
146
|
+
return getServiceUrl(this.item['thumb'], 'size4')
|
|
147
|
+
},
|
|
148
|
+
isOne(){
|
|
149
|
+
let status = false;
|
|
150
|
+
if(this.cell === 1) status = false
|
|
151
|
+
return status
|
|
152
|
+
},
|
|
153
|
+
isBtn(){
|
|
154
|
+
return this.productConfig.isPrice === 'Y' || this.productConfig.isAddCart === 'Y'
|
|
155
|
+
},
|
|
156
|
+
dividePrice() {
|
|
157
|
+
return this.$xdUniHelper.divisionFloatNumber(this.item.market_price, 100);
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
checkDiscountPrice() {
|
|
161
|
+
if(this.productConfig.isPrice === 'N') return false
|
|
162
|
+
if (this.productConfig.isShowDiscount === 'Y') {
|
|
163
|
+
let price = Number(this.item.market_price) - Number(this.item.sale_price);
|
|
164
|
+
return this.$xdUniHelper.divisionFloatNumber(price,100) > Number(this.productConfig.differ);
|
|
165
|
+
}
|
|
166
|
+
return false
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
tagsList(){
|
|
170
|
+
return (this.item['market_tags']||[]).filter(tag=>{
|
|
171
|
+
if(tag === 'flashsale') {
|
|
172
|
+
return this.productConfig.showActivityPrice === 'Y'
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
return this.productConfig.isShowTag === 'Y'
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
data(){
|
|
181
|
+
return {
|
|
182
|
+
tagObj: null,
|
|
183
|
+
tagObjColor: null,
|
|
184
|
+
errorStatus: false,
|
|
185
|
+
errorImage:'',
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
created() {
|
|
189
|
+
this.tagObj = this.$colorConfig.productTags;
|
|
190
|
+
this.tagObjColor = this.$colorConfig.productTagsColor;
|
|
191
|
+
this.errorImage = getServiceUrl('/common/empty/product.png?v1=1','size4')
|
|
192
|
+
},
|
|
193
|
+
methods:{
|
|
194
|
+
handleError(item){
|
|
195
|
+
this.errorStatus = true;
|
|
196
|
+
},
|
|
197
|
+
handleDetail(type='N'){
|
|
198
|
+
this.$emit('on-product-detail', {isCart:type,...this.item});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
</script>
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
<style scoped lang="less">
|
|
207
|
+
.product {
|
|
208
|
+
cursor: pointer;
|
|
209
|
+
|
|
210
|
+
&.one {
|
|
211
|
+
display: flex;
|
|
212
|
+
justify-content: space-between;
|
|
213
|
+
align-items: flex-start;
|
|
214
|
+
min-height: 200rpx;
|
|
215
|
+
|
|
216
|
+
.product-image {
|
|
217
|
+
flex-shrink: 0;
|
|
218
|
+
position: relative;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.product-content {
|
|
222
|
+
flex: 1;
|
|
223
|
+
min-height: 200rpx;
|
|
224
|
+
display: flex;
|
|
225
|
+
justify-content: flex-start;
|
|
226
|
+
flex-flow: wrap;
|
|
227
|
+
align-content: space-between;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
&.two {
|
|
232
|
+
.product-image {
|
|
233
|
+
width: 100%;
|
|
234
|
+
display: flex;
|
|
235
|
+
flex-shrink: 0;
|
|
236
|
+
justify-content: center;
|
|
237
|
+
align-items: center;
|
|
238
|
+
position: relative;
|
|
239
|
+
& > image {
|
|
240
|
+
height: 100%;
|
|
241
|
+
width: 100%;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
&-image {
|
|
248
|
+
overflow: hidden;
|
|
249
|
+
& > image {
|
|
250
|
+
height: 100%;
|
|
251
|
+
width: 100%;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
&-content {
|
|
256
|
+
overflow: hidden;
|
|
257
|
+
&-info {
|
|
258
|
+
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
&-btn {
|
|
262
|
+
width: 100%;
|
|
263
|
+
display: flex;
|
|
264
|
+
justify-content: space-between;
|
|
265
|
+
align-items: center;
|
|
266
|
+
|
|
267
|
+
.onePrice {
|
|
268
|
+
display: flex;
|
|
269
|
+
justify-content: flex-start;
|
|
270
|
+
align-items: center;
|
|
271
|
+
|
|
272
|
+
& > view:nth-child(2) {
|
|
273
|
+
margin-left: 20rpx;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
& > view:first-child {
|
|
278
|
+
flex: 1;
|
|
279
|
+
& > view:first-child {
|
|
280
|
+
height: 40rpx;
|
|
281
|
+
display: flex;
|
|
282
|
+
justify-content: flex-start;
|
|
283
|
+
align-items: center;
|
|
284
|
+
overflow: hidden;
|
|
285
|
+
}
|
|
286
|
+
& > view:nth-child(2) {
|
|
287
|
+
line-height: 30rpx;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
& > view:nth-child(2) {
|
|
294
|
+
flex-shrink: 0;
|
|
295
|
+
width: 40rpx;
|
|
296
|
+
height: 40rpx;
|
|
297
|
+
display: flex;
|
|
298
|
+
justify-content: center;
|
|
299
|
+
align-items: center;
|
|
300
|
+
cursor: pointer;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.oldPrice {
|
|
304
|
+
margin-left: 6rpx;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
& .name {
|
|
309
|
+
margin-bottom: 10rpx;
|
|
310
|
+
line-height: 40rpx;
|
|
311
|
+
.uni-max-cut(2,80);
|
|
312
|
+
word-wrap: break-word;
|
|
313
|
+
word-break: break-all;
|
|
314
|
+
|
|
315
|
+
& > text {
|
|
316
|
+
display: inline-block;
|
|
317
|
+
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
&.showOne {
|
|
321
|
+
.uni-max-cut(1,40);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
& .brand {
|
|
326
|
+
font-size: 22rpx;
|
|
327
|
+
line-height: 30rpx;
|
|
328
|
+
.uni-max-cut(1,30);
|
|
329
|
+
padding-bottom: 10rpx;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.tags {
|
|
333
|
+
display: flex;
|
|
334
|
+
justify-content: flex-start;
|
|
335
|
+
align-content: flex-start;
|
|
336
|
+
flex-flow: wrap;
|
|
337
|
+
|
|
338
|
+
&.showTwo {
|
|
339
|
+
& > view{
|
|
340
|
+
margin-bottom: 8rpx;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
& > view {
|
|
345
|
+
padding: 0 14rpx;
|
|
346
|
+
height: 32rpx;
|
|
347
|
+
line-height: 31rpx;
|
|
348
|
+
font-size: 20rpx;
|
|
349
|
+
color:#fff;
|
|
350
|
+
border-radius: 16rpx;
|
|
351
|
+
margin-right: 10rpx;
|
|
352
|
+
|
|
353
|
+
&:last-child {
|
|
354
|
+
margin-right: 0;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
</style>
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-swiper__warp">
|
|
3
|
+
<slot />
|
|
4
|
+
<view v-if="mode === 'default'" :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box" key='default'>
|
|
5
|
+
<view v-for="(item,index) in info" @click="clickItem(index)" :style="{
|
|
6
|
+
'width': (index === current? dots.width*1.7: dots.width ) + 'px','height':dots.width*(2/5) +'px' ,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border-radius':'0px'}"
|
|
7
|
+
:key="index" class="uni-swiper__dots-item uni-swiper__dots-bar" />
|
|
8
|
+
</view>
|
|
9
|
+
<view v-if="mode === 'dot'" :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box" key='dot'>
|
|
10
|
+
<view v-for="(item,index) in info" @click="clickItem(index)" :style="{
|
|
11
|
+
'width': dots.width + 'px','height':dots.height +'px' ,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border':index !==current ? dots.border:dots.selectedBorder}"
|
|
12
|
+
:key="index" class="uni-swiper__dots-item" />
|
|
13
|
+
</view>
|
|
14
|
+
<view v-if="mode === 'round'" :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box" key='round'>
|
|
15
|
+
<view v-for="(item,index) in info" @click="clickItem(index)" :class="[index === current&&'uni-swiper__dots-long']" :style="{
|
|
16
|
+
'width':(index === current? dots.width*3:dots.width ) + 'px','height':dots.height +'px' ,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border':index !==current ? dots.border:dots.selectedBorder}"
|
|
17
|
+
:key="index" class="uni-swiper__dots-item " />
|
|
18
|
+
</view>
|
|
19
|
+
<view v-if="mode === 'nav'" key='nav' :style="{'background-color':dotsStyles.backgroundColor,'bottom':'0'}" class="uni-swiper__dots-box uni-swiper__dots-nav">
|
|
20
|
+
<text :style="{'color':dotsStyles.color}" class="uni-swiper__dots-nav-item">{{ (current+1)+"/"+info.length }}</text>
|
|
21
|
+
</view>
|
|
22
|
+
<view v-if="mode === 'indexes'" key='indexes' :style="{'bottom':dots.bottom + 'px'}" class="uni-swiper__dots-box">
|
|
23
|
+
<view v-for="(item,index) in info" @click="clickItem(index)" :style="{
|
|
24
|
+
'width':dots.width + 'rpx','height':dots.height +'rpx' ,'color':index === current?dots.selectedColor:dots.color,'background-color':index !== current?dots.backgroundColor:dots.selectedBackgroundColor,'border':index !==current ? dots.border:dots.selectedBorder}"
|
|
25
|
+
:key="index" class="uni-swiper__dots-item uni-swiper__dots-indexes"><text class="uni-swiper__dots-indexes-text">{{ index+1 }}</text></view>
|
|
26
|
+
</view>
|
|
27
|
+
</view>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script>
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* XdSwiperDot 轮播图指示点
|
|
34
|
+
* @description 自定义轮播图指示点
|
|
35
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=284
|
|
36
|
+
* @property {Number} current 当前指示点索引,必须是通过 `swiper` 的 `change` 事件获取到的 `e.detail.current`
|
|
37
|
+
* @property {String} mode = [default|round|nav|indexes] 指示点的类型
|
|
38
|
+
* @value defualt 默认指示点
|
|
39
|
+
* @value round 圆形指示点
|
|
40
|
+
* @value nav 条形指示点
|
|
41
|
+
* @value indexes 索引指示点
|
|
42
|
+
* @property {String} field mode 为 nav 时,显示的内容字段(mode = nav 时必填)
|
|
43
|
+
* @property {String} info 轮播图的数据,通过数组长度决定指示点个数
|
|
44
|
+
* @property {Object} dotsStyles 指示点样式
|
|
45
|
+
* @event {Function} clickItem 组件触发点击事件时触发,e={currentIndex}
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
name: 'XdSwiperDot',
|
|
50
|
+
emits:['clickItem'],
|
|
51
|
+
props: {
|
|
52
|
+
info: {
|
|
53
|
+
type: Array,
|
|
54
|
+
default () {
|
|
55
|
+
return []
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
current: {
|
|
59
|
+
type: Number,
|
|
60
|
+
default: 0
|
|
61
|
+
},
|
|
62
|
+
dotsStyles: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default () {
|
|
65
|
+
return {}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
// 类型 :default(默认) indexes long nav
|
|
69
|
+
mode: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: 'default'
|
|
72
|
+
},
|
|
73
|
+
// 只在 nav 模式下生效,变量名称
|
|
74
|
+
field: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: ''
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
dotsSource: {
|
|
82
|
+
width: 8,
|
|
83
|
+
height: 8,
|
|
84
|
+
bottom: 7,
|
|
85
|
+
color: '#fff',
|
|
86
|
+
backgroundColor: 'rgba(0, 0, 0, .3)',
|
|
87
|
+
border: '1px rgba(0, 0, 0, .3) solid',
|
|
88
|
+
selectedBackgroundColor: '#333',
|
|
89
|
+
selectedBorder: '1px rgba(0, 0, 0, .9) solid'
|
|
90
|
+
},
|
|
91
|
+
dots: { }
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
watch: {
|
|
95
|
+
dotsStyles(newVal) {
|
|
96
|
+
this.init(newVal)
|
|
97
|
+
},
|
|
98
|
+
mode() {
|
|
99
|
+
this.init(this.dotsStyles)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
},
|
|
103
|
+
created() {
|
|
104
|
+
this.init(this.dotsStyles)
|
|
105
|
+
},
|
|
106
|
+
methods: {
|
|
107
|
+
clickItem(index) {
|
|
108
|
+
this.$emit('clickItem', index)
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
init(value){
|
|
112
|
+
let dot = {};
|
|
113
|
+
if (this.mode === 'indexes') {
|
|
114
|
+
dot = {
|
|
115
|
+
width: 34,
|
|
116
|
+
height: 34,
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
this.dots = Object.assign(
|
|
120
|
+
JSON.parse(JSON.stringify(this.dotsSource)),
|
|
121
|
+
JSON.parse(JSON.stringify(value)),
|
|
122
|
+
dot
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
</script>
|
|
129
|
+
|
|
130
|
+
<style lang="scss" scoped>
|
|
131
|
+
.uni-swiper__warp {
|
|
132
|
+
/* #ifndef APP-NVUE */
|
|
133
|
+
display: flex;
|
|
134
|
+
/* #endif */
|
|
135
|
+
flex: 1;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
position: relative;
|
|
138
|
+
overflow: hidden;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.uni-swiper__dots-box {
|
|
142
|
+
position: absolute;
|
|
143
|
+
bottom: 10px;
|
|
144
|
+
left: 0;
|
|
145
|
+
right: 0;
|
|
146
|
+
/* #ifndef APP-NVUE */
|
|
147
|
+
display: flex;
|
|
148
|
+
/* #endif */
|
|
149
|
+
flex: 1;
|
|
150
|
+
flex-direction: row;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
align-items: center;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.uni-swiper__dots-item {
|
|
156
|
+
width: 8px;
|
|
157
|
+
border-radius: 100px;
|
|
158
|
+
margin-left: 6px;
|
|
159
|
+
background-color: $uni-bg-color-mask;
|
|
160
|
+
/* #ifndef APP-NVUE */
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
/* #endif */
|
|
163
|
+
/* #ifdef H5 */
|
|
164
|
+
// border-width: 5px 0;
|
|
165
|
+
// border-style: solid;
|
|
166
|
+
// border-color: transparent;
|
|
167
|
+
// background-clip: padding-box;
|
|
168
|
+
/* #endif */
|
|
169
|
+
// transition: width 0.2s linear; 不要取消注释,不然会不能变色
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.uni-swiper__dots-item:first-child {
|
|
173
|
+
margin: 0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.uni-swiper__dots-default {
|
|
177
|
+
border-radius: 100px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.uni-swiper__dots-long {
|
|
181
|
+
border-radius: 50px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.uni-swiper__dots-bar {
|
|
185
|
+
border-radius: 50px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.uni-swiper__dots-nav {
|
|
189
|
+
bottom: 10rpx!important;
|
|
190
|
+
height: 38rpx;
|
|
191
|
+
line-height: 38rpx;
|
|
192
|
+
position: absolute;
|
|
193
|
+
right: 0;
|
|
194
|
+
left: initial;
|
|
195
|
+
/* #ifndef APP-NVUE */
|
|
196
|
+
display: flex;
|
|
197
|
+
/* #endif */
|
|
198
|
+
flex: 1;
|
|
199
|
+
flex-direction: row;
|
|
200
|
+
justify-content: flex-start;
|
|
201
|
+
align-items: center;
|
|
202
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
203
|
+
border-radius: 6rpx 0 0 6rpx;
|
|
204
|
+
|
|
205
|
+
& > text {
|
|
206
|
+
font-size: 20rpx;
|
|
207
|
+
padding: 0 10px!important;
|
|
208
|
+
margin: 0;
|
|
209
|
+
text-align: center;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.uni-swiper__dots-nav-item {
|
|
214
|
+
/* overflow: hidden;
|
|
215
|
+
text-overflow: ellipsis;
|
|
216
|
+
white-space: nowrap; */
|
|
217
|
+
font-size: $uni-font-size-base;
|
|
218
|
+
color: #fff;
|
|
219
|
+
margin: 0 15px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.uni-swiper__dots-indexes {
|
|
223
|
+
/* #ifndef APP-NVUE */
|
|
224
|
+
display: flex;
|
|
225
|
+
/* #endif */
|
|
226
|
+
// flex: 1;
|
|
227
|
+
justify-content: center;
|
|
228
|
+
align-items: center;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.uni-swiper__dots-indexes-text {
|
|
232
|
+
font-size: $uni-font-size-sm;
|
|
233
|
+
}
|
|
234
|
+
</style>
|