jufubao-base 1.0.63-beta203 → 1.0.63-beta205

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.
@@ -0,0 +1,208 @@
1
+ <template>
2
+ <view
3
+ class="video-box"
4
+ :style="{
5
+ width: contentWidth + 'rpx',
6
+ height:contentHeight + 'rpx',
7
+ margin: outMargin
8
+ }"
9
+ >
10
+ <view
11
+ class="thumb"
12
+ v-if="!playStatus"
13
+ :style="{borderRadius: radius + 'rpx'}"
14
+ >
15
+ <image :src="imageUrl" v-if="imageUrl" />
16
+ <view @click="handlePlay()">
17
+ <xd-font-icon
18
+ :icon="iconFont"
19
+ size="100"
20
+ color="#fff"
21
+ ></xd-font-icon>
22
+
23
+ </view>
24
+ </view>
25
+ <view
26
+ class="video"
27
+ :style="{borderRadius: radius + 'rpx'}"
28
+ v-else
29
+ >
30
+ <video
31
+ v-if="videoUrl"
32
+ :src="videoUrl"
33
+ :autoplay="autoplay === 'Y'"
34
+ @ended="handleEnd()"
35
+ @error="handleError"
36
+ ></video>
37
+ </view>
38
+ </view>
39
+ </template>
40
+
41
+ <script>
42
+ import getServiceUrl from '@/common/getServiceUrl'
43
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
44
+
45
+ export default {
46
+ name:'XdVideo',
47
+ components:{
48
+ XdFontIcon
49
+ },
50
+ props:{
51
+ margin:{
52
+ type: Object,
53
+ default(){
54
+ return {
55
+ top:0,
56
+ left:0,
57
+ right:0,
58
+ bottom:0
59
+ }
60
+ }
61
+ },
62
+ poster:{
63
+ type:Object,
64
+ required: true
65
+ },
66
+ radius:{
67
+ type: String|Number,
68
+ default: 0
69
+ },
70
+ packThis:{
71
+ type:Object,
72
+ required: true
73
+ },
74
+ video:{
75
+ type:Object,
76
+ required: true
77
+ },
78
+ },
79
+ data(){
80
+ return {
81
+ isPreview: false,
82
+
83
+ //css
84
+ width: 0,
85
+ height: 0,
86
+
87
+ //play
88
+ imageUrl: '',
89
+ videoUrl: '',
90
+ playStatus: false,
91
+ autoplay: 'N',
92
+ }
93
+ },
94
+ computed: {
95
+ iconFont(){
96
+ if(this.autoplay === 'N') return 'iconplayright'
97
+ if(this.autoplay === 'E') return 'iconshibai';
98
+ if(this.autoplay === 'R') return 'iconplayreplay';
99
+ },
100
+ contentWidth(){
101
+ let border = 0;
102
+ if(this.isPreview) border = 2;
103
+ return 750 - (this.margin.left + this.margin.right + border);
104
+ },
105
+ contentHeight(){
106
+ let border = 0;
107
+ if(this.isPreview) border = 2;
108
+ let winWidth = 750 - ((this.margin.left||0) + (this.margin.right||0) + border);
109
+ return winWidth * this.height/this.width;
110
+ },
111
+
112
+ outMargin(){
113
+ let margin = `${this.margin.top !== null ? this.margin.top : 0}rpx`;
114
+ margin = `${margin} ${this.margin.right !== null ? this.margin.right : 0}rpx`;
115
+ margin = `${margin} ${this.margin.bottom !== null ? this.margin.bottom :0}rpx`;
116
+ margin = `${margin} ${this.margin.left !== null ? this.margin.left : 0}rpx`;
117
+ return margin;
118
+ }
119
+ },
120
+ watch:{
121
+ poster(){
122
+ this.init();
123
+ }
124
+ },
125
+ created() {
126
+ this.isPreview = this.$configProject.isPreview;
127
+ this.init();
128
+ },
129
+ methods:{
130
+ init(){
131
+ if(this.poster.size) {
132
+ this.width = Number(this.poster.size.width);
133
+ this.height = Number(this.poster.size.height);
134
+ }
135
+
136
+ let {image_url, thumb} = this.video;
137
+ if(image_url) this.videoUrl = getServiceUrl(image_url);
138
+ if(thumb) this.imageUrl = getServiceUrl(thumb);
139
+ },
140
+ handlePlay(){
141
+ if(this.autoplay === 'E') return;
142
+ this.playStatus = !this.playStatus;
143
+ this.autoplay = "Y";
144
+ },
145
+
146
+ handleEnd(){
147
+ setTimeout(()=>{
148
+ this.playStatus = !this.playStatus;
149
+ this.autoplay = "R";
150
+ }, 1000)
151
+ },
152
+
153
+ handleError(){
154
+ this.$xdConfirm({
155
+ title: '温馨提示',
156
+ content:'当前视频资源无法播放',
157
+ cancel: false,
158
+ confirmText:'我知道了',
159
+ zIndex:10000,
160
+ success:()=>{
161
+ this.playStatus = !this.playStatus;
162
+ this.autoplay = "R";
163
+ }
164
+ })
165
+
166
+ }
167
+ }
168
+ }
169
+ </script>
170
+
171
+
172
+
173
+ <style scoped lang="less">
174
+ .video-box {
175
+ view.thumb {
176
+ height: 100%;
177
+ width: 100%;
178
+ position: relative;
179
+ overflow: hidden;
180
+
181
+ & > view {
182
+ width: 120rpx;
183
+ height: 120rpx;
184
+ position: absolute;
185
+ top: 50%;
186
+ left: 50%;
187
+ margin-top: -60rpx;
188
+ margin-left:-60rpx;
189
+ }
190
+
191
+ & > image {
192
+ height: 100%;
193
+ width: 100%;
194
+ }
195
+ }
196
+
197
+ view.video {
198
+ overflow: hidden;
199
+ height: 100%;
200
+ width: 100%;
201
+
202
+ & video {
203
+ height: 100%;
204
+ width: 100%;
205
+ }
206
+ }
207
+ }
208
+ </style>
@@ -1,281 +0,0 @@
1
- <template>
2
- <view class="sreen">
3
- <view
4
- class="sreen__box notCarousel"
5
- v-if="config.isCarousel === false"
6
- >
7
- <view
8
- v-for="(item,index) in list"
9
- :key="item['content_id']"
10
- :style="{
11
- borderRadius: config.radius + 'rpx',
12
- marginTop: index < config.cell ? 0 : config.padding + 'rpx',
13
- width: config.width + 'px',
14
- height: config.height + 'px',
15
- marginRight: (index+1) % config.cell === 0 ? 0: config.padding + 'rpx'
16
- }"
17
- @click="handleClick(item)"
18
- >
19
- <image
20
- :style="{
21
- width: width + 'px',
22
- height: height + 'px'
23
- }"
24
- :src="item.image_url"
25
- mode="widthFix"
26
- ></image>
27
- </view>
28
- </view>
29
- <view class="sreen__box carousel" v-if="config.isCarousel === true">
30
- <xd-swiper-dot
31
- :current="current"
32
- :info="list"
33
- field="content_name"
34
- :mode="config.mode"
35
- :dots-styles="config.dotStyleData"
36
- :style="{height:(getHeight + 46 * $rpxNum) + 'px'}"
37
- >
38
- <xd-swiper
39
- :indicator-dots="false"
40
- :interval="config.carouselTime"
41
- :list="list"
42
- :current="current"
43
- width="100%"
44
- :height="getHeight + 'px'"
45
- @onClickItem="handleClick"
46
- @animationfinish="handleAnimationfinish"
47
- >
48
- <template slot-scope="{ item, index}">
49
- <view
50
- class="sreen__box-list"
51
- :style="{
52
- height: getHeight + 'px'
53
- }"
54
- >
55
- <view
56
- v-for="(it, indext) in item"
57
- :key="it['content_id']"
58
- :style="{
59
- borderRadius: config.radius + 'rpx',
60
- width: config.width + 'px',
61
- height: config.height + 'px',
62
- marginRight: (indext+1) % config.cell === 0 ? 0: config.padding + 'rpx',
63
- marginTop: indext < config.cell ? 0 : config.padding + 'rpx',
64
- }"
65
- @click="handleClick(it)"
66
- >
67
- <image :style="{ width: width + 'px', height: height + 'px'}" :src="it.image_url" mode="widthFix"></image>
68
- </view>
69
- </view>
70
- </template>
71
- </xd-swiper>
72
- </xd-swiper-dot>
73
- </view>
74
- <view v-if="isPreview" class="carousel-mask"></view>
75
- </view>
76
- </template>
77
-
78
- <script>
79
- import XdSwiperDot from "./XdSwiperDot";
80
- import XdSwiper from "@/components/XdSwiper/XdSwiper";
81
-
82
- export default {
83
- components:{
84
- XdSwiperDot,
85
- XdSwiper
86
- },
87
- name: "MoreScreen",
88
- props: {
89
- config: {
90
- type: Object,
91
- required: true
92
- },
93
- content: {
94
- type: Array,
95
- required: true
96
- }
97
- },
98
- data() {
99
- return {
100
- timer: null,
101
- width: 0,
102
- height: 0,
103
- padding: 0,
104
- status: false,
105
- list: [],
106
- isPreview: false,
107
- current: 0,
108
- }
109
- },
110
- computed:{
111
- getHeight() {
112
- let height = this.height * this.config.rows;
113
- let padding = 0;
114
- if (this.config.rows === 2) padding = Number(this.config.padding) * this.$rpxNum;
115
- return height + padding;
116
- },
117
- },
118
- watch: {
119
- config() {
120
- this.init()
121
- },
122
- content() {
123
- this.init();
124
- },
125
-
126
- },
127
- created() {
128
- this.isPreview = this.$configProject.isPreview;
129
- this.init();
130
- },
131
- methods: {
132
- handleAnimationfinish(e) {
133
- this.current = e.detail.current;
134
- },
135
- init() {
136
- if (this.timer) clearTimeout(this.timer);
137
- this.timer = setTimeout(() => {
138
- this.width = Number(this.config.width);
139
- this.height = Number(this.config.height);
140
- this.padding = Number(this.config.padding);
141
-
142
- //静态图显示
143
- if(this.config.isCarousel === false) {
144
- this.list = this.content
145
- }
146
- //轮播图显示
147
- else {
148
- let num = 4 * this.config.rows;
149
- let maxPage = Math.ceil(this.content.length / num);
150
- let arr = [];
151
- for(let i =1 ; i <= maxPage; i++) {
152
- arr.push(this.$xdUniHelper.getLocalPaginationData(this.content, i, num))
153
- }
154
- this.list = arr;
155
- }
156
-
157
-
158
- }, 100)
159
- },
160
- handleClick(item) {
161
- //内部链接跳转地址
162
- if (item.redirect_type === 'INN') {
163
- try {
164
- let url = JSON.parse(item.redirect_data);
165
- let params = '';
166
- if (item['redirect_params']) params = `?${item['redirect_params']}`;
167
- this.$xdUniHelper.navigateTo({
168
- url: url.page + params
169
- })
170
- } catch (e) {
171
- console.error(e)
172
- }
173
- }
174
-
175
- //外部链接
176
- if (item.redirect_type === 'URL') {
177
- let reg = /^(http:\/\/|https:\/\/|\/\/)+.+$/;
178
- //#ifdef MP-WEIXIN
179
- try {
180
- let url = JSON.parse(item.redirect_data);
181
- if (reg.test(url.url) && this.$configProject.extras.webview) {
182
- console.warn(`广告跳转外站: ${url.url}`)
183
- this.$xdUniHelper.navigateTo({
184
- url: `${this.$configProject.extras.webview}?seatUrl=${Base64.encodeURI(url.url)}`
185
- });
186
- } else {
187
- throw Error('地址错误')
188
- }
189
- } catch (e) {
190
- console.error(e)
191
- }
192
- //#endif
193
- //#ifdef H5
194
- try {
195
- let url = JSON.parse(item.redirect_data);
196
- if (reg.test(url.url)) {
197
- console.warn(`广告跳转外站: ${url.url}`);
198
- window.location.href = url.url;
199
- } else {
200
- throw Error('地址错误')
201
- }
202
- } catch (e) {
203
- console.error(e)
204
- }
205
- //#endif
206
-
207
- }
208
- },
209
- }
210
- }
211
- </script>
212
-
213
- <style scoped lang="less">
214
- .sreen {
215
- width: calc(100% + 4px); /**防止宽度不够问**/
216
- position: relative;
217
-
218
- & .carousel-mask {
219
- position: absolute;
220
- left: 0;
221
- right: 0;
222
- top: 0;
223
- bottom: 0;
224
- background: rgba(0, 0, 0, 0);
225
- }
226
-
227
- &__box.notCarousel {
228
- display: flex;
229
- justify-content: flex-start;
230
- align-items: flex-start;
231
- flex-wrap: wrap;
232
- overflow: hidden;
233
- width: calc(100% + 20px); /**防止宽度不够问**/
234
-
235
- & > view {
236
- display: flex;
237
- justify-content: center;
238
- align-items: flex-start;
239
- flex-shrink: 0;
240
- box-sizing: border-box;
241
- overflow: hidden;
242
- }
243
- }
244
-
245
- &__box.carousel {
246
- display: flex;
247
- justify-content: flex-start;
248
- align-items: flex-start;
249
- flex-wrap: wrap;
250
- overflow: hidden;
251
- }
252
-
253
- & .sreen__box-list {
254
- width: calc(100% + 20px); /**防止宽度不够问**/
255
- display: flex;
256
- justify-content: flex-start;
257
- align-items: flex-start;
258
- flex-wrap: wrap;
259
- overflow: hidden;
260
-
261
- & view {
262
- display: flex;
263
- justify-content: center;
264
- align-items: flex-start;
265
- flex-shrink: 0;
266
- box-sizing: border-box;
267
- overflow: hidden;
268
-
269
- &:nth-child(4n) {
270
- margin-right: 0 !important;
271
- }
272
-
273
- & > image {
274
-
275
- }
276
- }
277
- }
278
- }
279
-
280
-
281
- </style>
@@ -1,234 +0,0 @@
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: 20rpx!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>