jufubao-takeorder 1.0.1
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 +122 -0
- package/src/CreateClientID.js +16 -0
- package/src/ICONS.js +1148 -0
- package/src/appParams.js +1 -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 +368 -0
- package/src/components/CusListItem/CusListItem.vue +141 -0
- package/src/components/CusPoster/CusPoster.vue +167 -0
- package/src/components/CusPoster/CusSwiperDot.vue +234 -0
- package/src/components/CusPrice/CusPrice.vue +383 -0
- package/src/components/CusProduct/CusProduct.vue +763 -0
- package/src/components/CusShops/CusShops.vue +717 -0
- package/src/components/CusSwiperDot/CusSwiperDot.vue +234 -0
- package/src/components/CusTab/CusTab.vue +544 -0
- package/src/components/CusVideo/CusVideo.vue +170 -0
- package/src/components/CusVipList/CusVipList.vue +169 -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/get.package.path.js +22 -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
- package/src/oss.config.js +17 -0
- package/src/settings.js +244 -0
- package/src/staticVersion.js +3 -0
- package/src/xd.less +196 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="xd-tab"
|
|
4
|
+
v-if="eleID"
|
|
5
|
+
:class="{noBorder: noBorder}"
|
|
6
|
+
:style="{background:bgColor}"
|
|
7
|
+
>
|
|
8
|
+
|
|
9
|
+
<scroll-view
|
|
10
|
+
class="tab-scroll"
|
|
11
|
+
scroll-x
|
|
12
|
+
:scroll-with-animation="scrollWithAnimation"
|
|
13
|
+
:scroll-into-view="toView"
|
|
14
|
+
:id="eleID"
|
|
15
|
+
:style="{
|
|
16
|
+
width: 'calc(100% - '+ getSettingWidth + 'px)',
|
|
17
|
+
height: height + 'rpx'
|
|
18
|
+
}"
|
|
19
|
+
@scroll="handleScroll"
|
|
20
|
+
>
|
|
21
|
+
<view class="tab-scroll__box">
|
|
22
|
+
<view
|
|
23
|
+
:id="`tab-scroll__index-${index}`"
|
|
24
|
+
v-for="(item, index) in list"
|
|
25
|
+
:key="index"
|
|
26
|
+
:style="{
|
|
27
|
+
color: activeIndex === index? (actColor||styleMainColor): color,
|
|
28
|
+
height: height + 'rpx',
|
|
29
|
+
width: (getItemWidth(item) + (index===0?spacing:0)) + 'rpx',
|
|
30
|
+
margin: (actBgcColor || bgcColor)? 0:`0 0 0 ${spacing}rpx`
|
|
31
|
+
}"
|
|
32
|
+
class="tab-scroll__item"
|
|
33
|
+
:class="{active:activeIndex === index,'desc': xAbsolute === 'none' && item.subName}"
|
|
34
|
+
@click="clickTab(item, index)"
|
|
35
|
+
>
|
|
36
|
+
<view
|
|
37
|
+
:style="[{
|
|
38
|
+
width: getItemWidth(item) + 'rpx',
|
|
39
|
+
fontWeight: activeIndex === index? actFontWeight: fontWeight,
|
|
40
|
+
fontSize: (activeIndex === index ? actFontSize : fontSize) + 'rpx',
|
|
41
|
+
height:(xAbsolute === 'none' && item.subName)?(height/2 + 'rpx'):(height + 'rpx'),
|
|
42
|
+
lineHeight:(xAbsolute === 'none' && item.subName)?(height/2 + 'rpx'):(height + 'rpx'),
|
|
43
|
+
backgroundColor: activeIndex === index?actBgcColor:bgcColor,
|
|
44
|
+
borderRadius: (actBgcColor||bgcColor)? '30rpx':0,
|
|
45
|
+
padding: (actBgcColor||bgcColor) ? '0 16rpx':0,
|
|
46
|
+
marginLeft: index === 0? `${spacing}rpx`: 0
|
|
47
|
+
}]">{{item.name}}</view>
|
|
48
|
+
<view
|
|
49
|
+
class="xAbsolute"
|
|
50
|
+
v-if="xAbsolute === 'absolute'"
|
|
51
|
+
:style="[
|
|
52
|
+
footerStyleComp,
|
|
53
|
+
{backgroundColor: activeIndex === index? (actColor||styleMainColor): ''},
|
|
54
|
+
{left: `calc(50% + ${index === 0 ? `${spacing/2}rpx`: '0rpx'})`}
|
|
55
|
+
]"
|
|
56
|
+
>
|
|
57
|
+
<view
|
|
58
|
+
v-if="activeIndex === index && styleSolid === 'N'"
|
|
59
|
+
:style="[footerStyleSolidComp]"
|
|
60
|
+
class="styleSolid"
|
|
61
|
+
></view>
|
|
62
|
+
</view>
|
|
63
|
+
<view
|
|
64
|
+
v-if="xAbsolute === 'none' && item.subName"
|
|
65
|
+
class="none"
|
|
66
|
+
:style="[activeIndex === index?subActNameComp:subNameComp]"
|
|
67
|
+
>{{item.subName}}</view>
|
|
68
|
+
<view
|
|
69
|
+
class="xAbsolute triangle"
|
|
70
|
+
v-if="xAbsolute === 'triangle' && activeIndex === index"
|
|
71
|
+
:style="[{left: `calc(50% + ${index === 0 ? '24rpx': '0rpx'})`}]"
|
|
72
|
+
>
|
|
73
|
+
<xd-font-icon icon="iconrepository-xialaxuanxiangup" size="22" :color="actColor||styleMainColor"></xd-font-icon>
|
|
74
|
+
</view>
|
|
75
|
+
<view
|
|
76
|
+
class="xAbsolute center"
|
|
77
|
+
v-if="xAbsolute === 'center' && activeIndex === index"
|
|
78
|
+
:style="[
|
|
79
|
+
{background: activeIndex === index? (actColor||styleMainColor): color},
|
|
80
|
+
{left: `calc(50% + ${index === 0 ? `${spacing/2}rpx`: '0rpx'})`}
|
|
81
|
+
]"
|
|
82
|
+
></view>
|
|
83
|
+
</view>
|
|
84
|
+
</view>
|
|
85
|
+
</scroll-view>
|
|
86
|
+
<view class="center" v-if="xAbsolute === 'center'">
|
|
87
|
+
<view :style="{left:left, background: styleMainColor}"></view>
|
|
88
|
+
</view>
|
|
89
|
+
<view
|
|
90
|
+
class="tab-icons"
|
|
91
|
+
@click="handleClickSetting"
|
|
92
|
+
:style="{width: settingWidth + 'rpx'}"
|
|
93
|
+
v-if="showSetting"
|
|
94
|
+
>
|
|
95
|
+
<xd-font-icon
|
|
96
|
+
icon="iconshezhi1"
|
|
97
|
+
color="#666"
|
|
98
|
+
size="40"
|
|
99
|
+
width="50"
|
|
100
|
+
height="50"
|
|
101
|
+
></xd-font-icon>
|
|
102
|
+
</view>
|
|
103
|
+
</view>
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<script>
|
|
107
|
+
|
|
108
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
109
|
+
import {
|
|
110
|
+
getParentsStyle, //获取页面风格单个键值值
|
|
111
|
+
} from '@/utils/xd.base';
|
|
112
|
+
|
|
113
|
+
export default {
|
|
114
|
+
name: 'CusTab',
|
|
115
|
+
components: {
|
|
116
|
+
XdFontIcon
|
|
117
|
+
},
|
|
118
|
+
props: {
|
|
119
|
+
subNameStyle:{
|
|
120
|
+
type: Object,
|
|
121
|
+
default(){
|
|
122
|
+
return {}
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
spacing:{
|
|
126
|
+
type: Number,
|
|
127
|
+
default: 40
|
|
128
|
+
},
|
|
129
|
+
settingWidth: {
|
|
130
|
+
type: Number,
|
|
131
|
+
default: 70
|
|
132
|
+
},
|
|
133
|
+
showSetting: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
default: false,
|
|
136
|
+
},
|
|
137
|
+
list: {
|
|
138
|
+
type: Array,
|
|
139
|
+
default() {
|
|
140
|
+
return []
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
tabIndex: {
|
|
144
|
+
type: Number,
|
|
145
|
+
default: 0
|
|
146
|
+
},
|
|
147
|
+
footerStyle:{
|
|
148
|
+
type: String,
|
|
149
|
+
default: 'line-4-8-s'
|
|
150
|
+
},
|
|
151
|
+
showFooterLine: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: false
|
|
154
|
+
},
|
|
155
|
+
scrollWithAnimation:{
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: true
|
|
158
|
+
},
|
|
159
|
+
noBorder: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
default: true
|
|
162
|
+
},
|
|
163
|
+
color: {
|
|
164
|
+
type: String,
|
|
165
|
+
default: '#333'
|
|
166
|
+
},
|
|
167
|
+
bgColor: {
|
|
168
|
+
type: String,
|
|
169
|
+
default: '#fff'
|
|
170
|
+
},
|
|
171
|
+
fontSize: {
|
|
172
|
+
type: Number | String, //rpx
|
|
173
|
+
default: 30
|
|
174
|
+
},
|
|
175
|
+
actFontSize:{
|
|
176
|
+
type: Number | String, //rpx
|
|
177
|
+
default: 38
|
|
178
|
+
},
|
|
179
|
+
fontWeight: {
|
|
180
|
+
type: Number | String, //rpx
|
|
181
|
+
default: 100
|
|
182
|
+
},
|
|
183
|
+
actFontWeight: {
|
|
184
|
+
type: Number | String, //rpx
|
|
185
|
+
default: 500
|
|
186
|
+
},
|
|
187
|
+
bgcColor: {
|
|
188
|
+
type: String,
|
|
189
|
+
default: ''
|
|
190
|
+
},
|
|
191
|
+
actBgcColor: {
|
|
192
|
+
type: String,
|
|
193
|
+
default: ''
|
|
194
|
+
},
|
|
195
|
+
height: {
|
|
196
|
+
type: Number | String, //rpx
|
|
197
|
+
default: 90
|
|
198
|
+
},
|
|
199
|
+
lineBottom: {
|
|
200
|
+
type: Number | String, //rpx
|
|
201
|
+
default: 10
|
|
202
|
+
},
|
|
203
|
+
actColor: {
|
|
204
|
+
type: String,
|
|
205
|
+
default: ''
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
data() {
|
|
209
|
+
return {
|
|
210
|
+
eleID:null,
|
|
211
|
+
activeIndex: 0,
|
|
212
|
+
toView: null,
|
|
213
|
+
styleMainColor: '', //插件主题风格样式
|
|
214
|
+
styleType: 'line',
|
|
215
|
+
styleHeight: 0,
|
|
216
|
+
styleWidth: 0,
|
|
217
|
+
styleRadius:'0',
|
|
218
|
+
styleLong: '0',//长短
|
|
219
|
+
|
|
220
|
+
xAbsolute: 'absolute',//绝对定位|无
|
|
221
|
+
styleSolid: 'Y',
|
|
222
|
+
itemWidth: 0,
|
|
223
|
+
|
|
224
|
+
//居中处理
|
|
225
|
+
left:0,
|
|
226
|
+
boxWidth:0
|
|
227
|
+
};
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
computed: {
|
|
231
|
+
getSettingWidth() {
|
|
232
|
+
if (this.showSetting) {
|
|
233
|
+
return 100 * this.$rpxNum;
|
|
234
|
+
}
|
|
235
|
+
return 0;
|
|
236
|
+
},
|
|
237
|
+
footerStyleComp(){
|
|
238
|
+
let temp = {};
|
|
239
|
+
temp['bottom'] = this.lineBottom + 'rpx';
|
|
240
|
+
if(this.styleType === 'line') {
|
|
241
|
+
temp['height'] = this.styleHeight + 'rpx';
|
|
242
|
+
temp['width'] = '64rpx';
|
|
243
|
+
temp['transform'] = 'translateX(-50%)';
|
|
244
|
+
temp['borderRadius'] = this.styleRadius;
|
|
245
|
+
}
|
|
246
|
+
if(this.styleType === 'circle'){
|
|
247
|
+
temp['height'] = this.styleHeight + 'rpx';
|
|
248
|
+
temp['width'] = this.styleHeight + 'rpx';
|
|
249
|
+
temp['marginLeft'] = -this.styleHeight/2 + 'rpx'
|
|
250
|
+
temp['borderRadius'] = this.styleRadius;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return temp
|
|
254
|
+
},
|
|
255
|
+
footerStyleSolidComp(){
|
|
256
|
+
let temp = {};
|
|
257
|
+
temp['height'] = (this.styleHeight - 4) + 'rpx';
|
|
258
|
+
temp['width'] = (this.styleHeight - 4) + 'rpx';
|
|
259
|
+
temp['backgroundColor'] = '#fff';
|
|
260
|
+
if(this.styleType === 'circle'){
|
|
261
|
+
temp['borderRadius'] = '50%';
|
|
262
|
+
}
|
|
263
|
+
return temp
|
|
264
|
+
},
|
|
265
|
+
subNameComp(){
|
|
266
|
+
let temp = {
|
|
267
|
+
fontSize: '22rpx',
|
|
268
|
+
color:'#333',
|
|
269
|
+
};
|
|
270
|
+
if(this.subNameStyle['bgColor']) temp['backgroundColor'] = this.subNameStyle['bgColor'];
|
|
271
|
+
if(this.subNameStyle['color']) temp['color'] = this.subNameStyle['color'];
|
|
272
|
+
if(this.subNameStyle['fontSize']) temp['fontSize'] = this.subNameStyle['fontSize'];
|
|
273
|
+
if(this.subNameStyle['fontWeight']) temp['fontWeight'] = this.subNameStyle['fontWeight'];
|
|
274
|
+
return temp
|
|
275
|
+
},
|
|
276
|
+
subActNameComp(){
|
|
277
|
+
let temp = {
|
|
278
|
+
backgroundColor: this.actColor,
|
|
279
|
+
fontSize: '22rpx',
|
|
280
|
+
color:'#fff',
|
|
281
|
+
};
|
|
282
|
+
if(this.subNameStyle['actBgColor']) temp['backgroundColor'] = this.subNameStyle['actBgColor'];
|
|
283
|
+
if(this.subNameStyle['actColor']) temp['color'] = this.subNameStyle['actColor'];
|
|
284
|
+
if(this.subNameStyle['actFontSize']) temp['fontSize'] = this.subNameStyle['actFontSize'];
|
|
285
|
+
if(this.subNameStyle['actFontWeight']) temp['fontWeight'] = this.subNameStyle['actFontWeight'];
|
|
286
|
+
return temp
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
watch: {
|
|
290
|
+
tabIndex(newVal, oldVal) {
|
|
291
|
+
if(newVal !== oldVal) {
|
|
292
|
+
this.activeIndex = newVal;
|
|
293
|
+
this.toView = `tab-scroll__index-${newVal}`;
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
footerStyle(){
|
|
297
|
+
this.initStyle();
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
async created() {
|
|
301
|
+
this.eleID = this.$xdUniHelper.randomChar(5);
|
|
302
|
+
this.initStyle();
|
|
303
|
+
this.styleMainColor = await getParentsStyle(this.$parent, '$mainColor');
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
mounted(){
|
|
307
|
+
this.$nextTick(()=>{
|
|
308
|
+
this.toView = 'tab-scroll__index-0'
|
|
309
|
+
if(this.scrollWithAnimation && 0) {
|
|
310
|
+
setTimeout(() => {
|
|
311
|
+
this.activeIndex = this.tabIndex;
|
|
312
|
+
this.toView = `tab-scroll__index-${this.tabIndex}`;
|
|
313
|
+
this.$emit('onInit', this.list[this.activeIndex], this.activeIndex);
|
|
314
|
+
}, 50);
|
|
315
|
+
}
|
|
316
|
+
else{
|
|
317
|
+
this.activeIndex = this.tabIndex;
|
|
318
|
+
this.toView = `tab-scroll__index-${this.tabIndex}`;
|
|
319
|
+
this.$emit('onInit', this.list[this.activeIndex], this.activeIndex);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const query = uni.createSelectorQuery().in(this);
|
|
323
|
+
query
|
|
324
|
+
.select(`#${this.eleID }`)
|
|
325
|
+
.boundingClientRect((data) => {
|
|
326
|
+
this.boxWidth = data.width;
|
|
327
|
+
})
|
|
328
|
+
.exec();
|
|
329
|
+
});
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
methods: {
|
|
333
|
+
initStyle(){
|
|
334
|
+
let arr = this.footerStyle.split('-');
|
|
335
|
+
this.styleType = arr[0];
|
|
336
|
+
this.xAbsolute = 'absolute';
|
|
337
|
+
|
|
338
|
+
if(this.styleType === 'desc') {
|
|
339
|
+
this.xAbsolute = 'none';
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if(this.styleType === 'center') {
|
|
343
|
+
this.xAbsolute = 'center';
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if(this.styleType === 'triangle') {
|
|
347
|
+
this.xAbsolute = 'triangle';
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
//圆与三角
|
|
351
|
+
if(arr.length === 3) {
|
|
352
|
+
this.styleHeight = this.styleWidth = Number(arr[1])
|
|
353
|
+
this.styleSolid = arr[2] === 'k'?'N':'Y'
|
|
354
|
+
if(this.styleType === 'circle') {
|
|
355
|
+
this.styleRadius = '50%'
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
//线
|
|
360
|
+
if(arr.length === 4) {
|
|
361
|
+
this.styleHeight = 6;
|
|
362
|
+
this.styleRadius = 4 + 'rpx';
|
|
363
|
+
if(arr[3] === 'l') this.styleLong = '20rpx'
|
|
364
|
+
else this.styleLong = '35%'
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
getItemWidth(item){
|
|
370
|
+
let maxFontSize = Math.max(parseInt(this.actFontSize),parseInt(this.fontSize))
|
|
371
|
+
let nameWidth = item.name.length * maxFontSize;
|
|
372
|
+
let actFontSize = Math.max(parseInt(this.subNameStyle['actFontSize']||24),parseInt(this.subNameStyle['fontSize']||24))
|
|
373
|
+
let subNameWidth = this.xAbsolute==='none' ? (item.subName.length * actFontSize): 0;
|
|
374
|
+
if(this.actBgcColor || this.bgcColor) {
|
|
375
|
+
nameWidth += 16*2
|
|
376
|
+
}
|
|
377
|
+
return Math.max(nameWidth,subNameWidth);
|
|
378
|
+
},
|
|
379
|
+
|
|
380
|
+
clickTab(item, index) {
|
|
381
|
+
this.activeIndex = index;
|
|
382
|
+
this.toView = `tab-scroll__index-${this.activeIndex}`;
|
|
383
|
+
this.$emit('onTab', item, index);
|
|
384
|
+
},
|
|
385
|
+
handleClickSetting(){
|
|
386
|
+
this.$emit('onSetting');
|
|
387
|
+
},
|
|
388
|
+
|
|
389
|
+
handleScroll({detail}){
|
|
390
|
+
if(this.xAbsolute === 'center'){
|
|
391
|
+
let maxScrollW = detail.scrollWidth - this.boxWidth;
|
|
392
|
+
this.left = ((detail.scrollLeft* 30 * this.$rpxNum)/ maxScrollW) + 'px';
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
</script>
|
|
399
|
+
|
|
400
|
+
<style lang="less">
|
|
401
|
+
.xd-tab {
|
|
402
|
+
display: flex;
|
|
403
|
+
flex-direction: row;
|
|
404
|
+
justify-content: space-between;
|
|
405
|
+
align-items: center;
|
|
406
|
+
flex-wrap: wrap;
|
|
407
|
+
overflow: hidden;
|
|
408
|
+
padding: 0;
|
|
409
|
+
position: relative;
|
|
410
|
+
&.noBorder {
|
|
411
|
+
border-bottom: 1px #f5f5f5 solid;
|
|
412
|
+
}
|
|
413
|
+
& > .center {
|
|
414
|
+
position: absolute;
|
|
415
|
+
height: 8rpx;
|
|
416
|
+
left: 50%;
|
|
417
|
+
bottom: 8rpx;
|
|
418
|
+
width: 80rpx;
|
|
419
|
+
margin-left: -40rpx;
|
|
420
|
+
border-radius: 5rpx;
|
|
421
|
+
background-color: #ccc;
|
|
422
|
+
overflow: hidden;
|
|
423
|
+
&> view {
|
|
424
|
+
position: absolute;
|
|
425
|
+
top:0;
|
|
426
|
+
bottom: 0;
|
|
427
|
+
width: 50rpx;
|
|
428
|
+
border-radius: 5rpx;
|
|
429
|
+
height: 8rpx;
|
|
430
|
+
background-color: #ccc;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.tab-scroll {
|
|
435
|
+
.tab-scroll__box {
|
|
436
|
+
display: flex;
|
|
437
|
+
align-items: center;
|
|
438
|
+
flex-wrap: nowrap;
|
|
439
|
+
box-sizing: border-box;
|
|
440
|
+
|
|
441
|
+
.tab-scroll__item {
|
|
442
|
+
position: relative;
|
|
443
|
+
flex-shrink: 0;
|
|
444
|
+
padding: 0;
|
|
445
|
+
color: #333;
|
|
446
|
+
font-size: unit(30, rpx);
|
|
447
|
+
height: unit(100, rpx);
|
|
448
|
+
display: flex;
|
|
449
|
+
align-items: center;
|
|
450
|
+
align-content: center;
|
|
451
|
+
flex-flow: column;
|
|
452
|
+
text-align: center;
|
|
453
|
+
&:first-child {
|
|
454
|
+
margin-left: 0!important;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
&.desc {
|
|
458
|
+
justify-content: center;
|
|
459
|
+
min-width: 3.5rem;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
&.active {
|
|
465
|
+
color: @xd-base-color;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
& > view.xAbsolute {
|
|
470
|
+
position: absolute;
|
|
471
|
+
bottom: unit(10,rpx);
|
|
472
|
+
display: flex;
|
|
473
|
+
justify-content: center;
|
|
474
|
+
align-items: center;
|
|
475
|
+
line-height: 1.1rem;
|
|
476
|
+
|
|
477
|
+
&.triangle {
|
|
478
|
+
bottom: unit(0,rpx);
|
|
479
|
+
transform: translateX(-50%);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
&.center {
|
|
483
|
+
position: absolute;
|
|
484
|
+
bottom: 22rpx;
|
|
485
|
+
width: 70rpx;
|
|
486
|
+
height: 10rpx;
|
|
487
|
+
opacity: .25;
|
|
488
|
+
border-radius:40%;
|
|
489
|
+
z-index: 0;
|
|
490
|
+
transform: translateX(-50%);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
& > view.none {
|
|
495
|
+
padding:0;
|
|
496
|
+
text-align: center;
|
|
497
|
+
color:#000;
|
|
498
|
+
border-radius:18rpx;
|
|
499
|
+
width: 100%;
|
|
500
|
+
font-size: 24rpx;
|
|
501
|
+
line-height: 36rpx;
|
|
502
|
+
height: 36rpx;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.tab-icons {
|
|
509
|
+
position: relative;
|
|
510
|
+
justify-content: flex-end;
|
|
511
|
+
display: flex;
|
|
512
|
+
align-items: center;
|
|
513
|
+
height: unit(100, rpx);
|
|
514
|
+
|
|
515
|
+
/deep/ span {
|
|
516
|
+
font-size: unit(40, rpx) !important;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.tab-icons-box {
|
|
520
|
+
width: unit(60, rpx);
|
|
521
|
+
height: unit(60, rpx);
|
|
522
|
+
line-height: unit(60, rpx);
|
|
523
|
+
text-align: center;
|
|
524
|
+
vertical-align: middle;
|
|
525
|
+
display: block;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
&::after {
|
|
529
|
+
content: '';
|
|
530
|
+
position: absolute;
|
|
531
|
+
top: unit(30, rpx);
|
|
532
|
+
bottom: unit(30, rpx);
|
|
533
|
+
left: 0;
|
|
534
|
+
width: 1px;
|
|
535
|
+
background-color: #ddd;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
.styleSolid {
|
|
539
|
+
flex-shrink: 0;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
</style>
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="video-box">
|
|
3
|
+
<view class="thumb" :class="{noImageUrl: !imageUrl}" v-if="!playStatus">
|
|
4
|
+
<image :src="imageUrl" v-if="imageUrl" />
|
|
5
|
+
<view v-if="videoUrl" @click="handlePlay()">
|
|
6
|
+
<xd-font-icon
|
|
7
|
+
:icon="iconFont"
|
|
8
|
+
size="100"
|
|
9
|
+
color="#fff"
|
|
10
|
+
></xd-font-icon>
|
|
11
|
+
</view>
|
|
12
|
+
</view>
|
|
13
|
+
<view
|
|
14
|
+
class="video"
|
|
15
|
+
:style="{borderRadius: radius + 'rpx'}"
|
|
16
|
+
v-else
|
|
17
|
+
>
|
|
18
|
+
<video
|
|
19
|
+
v-if="videoUrl"
|
|
20
|
+
:src="videoUrl"
|
|
21
|
+
:autoplay="autoplay === 'Y'"
|
|
22
|
+
@ended="handleEnd()"
|
|
23
|
+
@error="handleError"
|
|
24
|
+
></video>
|
|
25
|
+
</view>
|
|
26
|
+
</view>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import getServiceUrl from '@/common/getServiceUrl'
|
|
31
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
name:'CusVideo',
|
|
35
|
+
components:{
|
|
36
|
+
XdFontIcon
|
|
37
|
+
},
|
|
38
|
+
props:{
|
|
39
|
+
margin:{
|
|
40
|
+
type: Object,
|
|
41
|
+
default(){
|
|
42
|
+
return {}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
poster:{
|
|
46
|
+
type:Object,
|
|
47
|
+
required: true
|
|
48
|
+
},
|
|
49
|
+
radius:{
|
|
50
|
+
type: String|Number,
|
|
51
|
+
default: 0
|
|
52
|
+
},
|
|
53
|
+
video:{
|
|
54
|
+
type:Object,
|
|
55
|
+
required: true
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
data(){
|
|
59
|
+
return {
|
|
60
|
+
isPreview: false,
|
|
61
|
+
|
|
62
|
+
//play
|
|
63
|
+
imageUrl: '',
|
|
64
|
+
videoUrl: '',
|
|
65
|
+
playStatus: false,
|
|
66
|
+
autoplay: 'N',
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
computed: {
|
|
70
|
+
iconFont(){
|
|
71
|
+
if(this.autoplay === 'N') return 'iconplayright'
|
|
72
|
+
if(this.autoplay === 'E') return 'iconshibai';
|
|
73
|
+
if(this.autoplay === 'R') return 'iconplayreplay';
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
watch:{
|
|
77
|
+
poster(){
|
|
78
|
+
this.init();
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
created() {
|
|
82
|
+
this.isPreview = this.$configProject.isPreview;
|
|
83
|
+
this.init();
|
|
84
|
+
},
|
|
85
|
+
methods:{
|
|
86
|
+
init(){
|
|
87
|
+
if(this.poster.size) {
|
|
88
|
+
this.width = Number(this.poster.size.width);
|
|
89
|
+
this.height = Number(this.poster.size.height);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let {image_url, thumb} = this.video;
|
|
93
|
+
if(image_url) this.videoUrl = getServiceUrl(image_url);
|
|
94
|
+
if(thumb) this.imageUrl = getServiceUrl(thumb);
|
|
95
|
+
},
|
|
96
|
+
handlePlay(){
|
|
97
|
+
if(this.autoplay === 'E') return;
|
|
98
|
+
this.playStatus = !this.playStatus;
|
|
99
|
+
this.autoplay = "Y";
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
handleEnd(){
|
|
103
|
+
setTimeout(()=>{
|
|
104
|
+
this.playStatus = !this.playStatus;
|
|
105
|
+
this.autoplay = "R";
|
|
106
|
+
}, 1000)
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
handleError(){
|
|
110
|
+
this.$xdConfirm({
|
|
111
|
+
title: '温馨提示',
|
|
112
|
+
content:'当前视频资源无法播放',
|
|
113
|
+
cancel: false,
|
|
114
|
+
confirmText:'我知道了',
|
|
115
|
+
zIndex:10000,
|
|
116
|
+
success:()=>{
|
|
117
|
+
this.playStatus = !this.playStatus;
|
|
118
|
+
this.autoplay = "R";
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
<style scoped lang="less">
|
|
130
|
+
.video-box {
|
|
131
|
+
width: 100%;
|
|
132
|
+
height: 100%;
|
|
133
|
+
box-sizing: border-box;
|
|
134
|
+
view.noImageUrl {
|
|
135
|
+
background: rgba(0,0,0,.6);
|
|
136
|
+
}
|
|
137
|
+
view.thumb {
|
|
138
|
+
height: 100%;
|
|
139
|
+
width: 100%;
|
|
140
|
+
position: relative;
|
|
141
|
+
overflow: hidden;
|
|
142
|
+
|
|
143
|
+
& > view {
|
|
144
|
+
width: 120rpx;
|
|
145
|
+
height: 120rpx;
|
|
146
|
+
position: absolute;
|
|
147
|
+
top: 50%;
|
|
148
|
+
left: 50%;
|
|
149
|
+
margin-top: -60rpx;
|
|
150
|
+
margin-left:-60rpx;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
& > image {
|
|
154
|
+
height: 100%;
|
|
155
|
+
width: 100%;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
view.video {
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
height: 100%;
|
|
162
|
+
width: 100%;
|
|
163
|
+
|
|
164
|
+
& video {
|
|
165
|
+
height: 100%;
|
|
166
|
+
width: 100%;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
</style>
|