chore(组件): 引入DiyMinx的js及修复组件错误
This commit is contained in:
@@ -1,98 +1,61 @@
|
||||
<template>
|
||||
<view :style="componentStyle">
|
||||
<!-- 固定布局模式 -->
|
||||
<view v-if="value.showStyle == 'fixed'" :class="['goods-list', 'row1-of' + value.rowCount]" style="padding:20rpx;">
|
||||
<view
|
||||
v-for="(item, index) in value.list"
|
||||
:key="index"
|
||||
class="goods-item"
|
||||
@tap="showVideo(item)"
|
||||
>
|
||||
<view v-if="value.showStyle == 'fixed'" :class="['goods-list', 'row1-of' + value.rowCount]"
|
||||
style="padding:20rpx;">
|
||||
<view v-for="(item, index) in value.list" :key="index" class="goods-item" @tap="showVideo(item)">
|
||||
<view class="goods-img-wrap">
|
||||
<image
|
||||
class="goods-img"
|
||||
style="border-radius:10rpx 10rpx 0 0;"
|
||||
:src="$util.img(item.imageUrl)"
|
||||
mode="widthFix"
|
||||
@error="imgError(index)"
|
||||
></image>
|
||||
<image class="goods-img" style="border-radius:10rpx 10rpx 0 0;" :src="$util.img(item.imageUrl)"
|
||||
mode="widthFix" @error="imgError(index)"></image>
|
||||
<view style="position:absolute;top:10rpx;right:10rpx;">
|
||||
<image style="width:30rpx;" :src="$util.img('addon/personnel/shop/view/enterprise/play.png')" mode="widthFix"></image>
|
||||
<image style="width:30rpx;" :src="$util.img('addon/personnel/shop/view/enterprise/play.png')"
|
||||
mode="widthFix"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-wrap">
|
||||
<view
|
||||
class="goods-name"
|
||||
:style="{
|
||||
'font-size': (value.font.size * 2 + 'rpx') + ';',
|
||||
'font-weight': value.font.weight + ';',
|
||||
'color': value.font.color + ';'
|
||||
}"
|
||||
>{{ item.title }}</view>
|
||||
<view class="goods-name" :style="{
|
||||
'font-size': (value.font.size * 2 + 'rpx') + ';',
|
||||
'font-weight': value.font.weight + ';',
|
||||
'color': value.font.color + ';'
|
||||
}">{{ item.title }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 其他布局模式 -->
|
||||
<scroll-view
|
||||
v-else
|
||||
:class="['video-nav', value.showStyle == 'fixed' ? 'fixed-layout' : value.showStyle]"
|
||||
:scroll-x="value.showStyle == 'singleSlide'"
|
||||
>
|
||||
<scroll-view v-else :class="['video-nav', value.showStyle == 'fixed' ? 'fixed-layout' : value.showStyle]"
|
||||
:scroll-x="value.showStyle == 'singleSlide'">
|
||||
<view class="uni-scroll-view-content">
|
||||
<view
|
||||
v-for="(item, index) in value.list"
|
||||
:key="index"
|
||||
:class="['video-nav-item', value.mode]"
|
||||
:style="{ width: (100 / value.rowCount + '%') + ';' }"
|
||||
@tap="showVideo(item)"
|
||||
>
|
||||
<view v-for="(item, index) in value.list" :key="index" :class="['video-nav-item', value.mode]"
|
||||
:style="{ width: (100 / value.rowCount + '%') + ';' }" @tap="showVideo(item)">
|
||||
<view class="video-img">
|
||||
<image
|
||||
v-if="item.iconType == 'img'"
|
||||
:style="{
|
||||
'max-width': '200rpx;',
|
||||
'max-height': '200rpx;',
|
||||
'border-radius': '8rpx;'
|
||||
}"
|
||||
:src="$util.img(item.imageUrl) || $util.img('public/uniapp/default_img/goods.png')"
|
||||
mode="widthFix"
|
||||
:show-menu-by-longpress="true"
|
||||
></image>
|
||||
<image v-if="item.iconType == 'img'" :style="{
|
||||
'max-width': '200rpx;',
|
||||
'max-height': '200rpx;',
|
||||
'border-radius': '8rpx;'
|
||||
}" :src="$util.img(item.imageUrl) || $util.img('public/uniapp/default_img/goods.png')" mode="widthFix"
|
||||
:show-menu-by-longpress="true"></image>
|
||||
<view style="position:absolute;top:10rpx;right:10rpx;">
|
||||
<image style="width:30rpx;" :src="$util.img('addon/personnel/shop/view/enterprise/play.png')" mode="widthFix"></image>
|
||||
<image style="width:30rpx;"
|
||||
:src="$util.img('addon/personnel/shop/view/enterprise/play.png')" mode="widthFix">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="video-text"
|
||||
:style="{
|
||||
'margin-left': '16rpx;',
|
||||
'font-size': (value.font.size * 2 + 'rpx') + ';',
|
||||
'font-weight': value.font.weight + ';',
|
||||
'color': value.font.color + ';'
|
||||
}"
|
||||
>{{ item.title }}</view>
|
||||
<view class="video-text" :style="{
|
||||
'margin-left': '16rpx;',
|
||||
'font-size': (value.font.size * 2 + 'rpx') + ';',
|
||||
'font-weight': value.font.weight + ';',
|
||||
'color': value.font.color + ';'
|
||||
}">{{ item.title }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
|
||||
<!-- 视频播放弹窗 -->
|
||||
<uni-popup
|
||||
ref="videoPopup"
|
||||
type="center"
|
||||
style="background:transparent;width:100%;height:100%;"
|
||||
>
|
||||
<uni-popup ref="videoPopup" type="center" style="background:transparent;width:100%;height:100%;">
|
||||
<view class="video-container" style="position:fixed;top:30%;width:100%;left:0;">
|
||||
<video
|
||||
class="adaptive-video"
|
||||
:autoPauseIfNavigate="true"
|
||||
:autoPauseIfOpenNative="true"
|
||||
:autoplay="false"
|
||||
:enableAutoRotation="true"
|
||||
id="myVideo"
|
||||
:src="video_url"
|
||||
:controls="true"
|
||||
></video>
|
||||
<video class="adaptive-video" :autoPauseIfNavigate="true" :autoPauseIfOpenNative="true"
|
||||
:autoplay="false" :enableAutoRotation="true" id="myVideo" :src="video_url" :controls="true"></video>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
@@ -100,7 +63,7 @@
|
||||
|
||||
<script>
|
||||
import uniPopup from '@/components/uni-popup/uni-popup.vue'
|
||||
|
||||
import DiyMinx from './minx.js'
|
||||
export default {
|
||||
name: 'diy-video-list',
|
||||
components: {
|
||||
@@ -112,6 +75,7 @@ export default {
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
mixins: [DiyMinx],
|
||||
data() {
|
||||
return {
|
||||
pageWidth: '',
|
||||
@@ -132,25 +96,25 @@ export default {
|
||||
componentStyle() {
|
||||
let style = '';
|
||||
style += 'background-color:' + this.value.componentBgColor + ';';
|
||||
|
||||
|
||||
if (this.value.componentAngle == 'round') {
|
||||
style += 'border-top-left-radius:' + (2 * this.value.topAroundRadius) + 'rpx;';
|
||||
style += 'border-top-right-radius:' + (2 * this.value.topAroundRadius) + 'rpx;';
|
||||
style += 'border-bottom-left-radius:' + (2 * this.value.bottomAroundRadius) + 'rpx;';
|
||||
style += 'border-bottom-right-radius:' + (2 * this.value.bottomAroundRadius) + 'rpx;';
|
||||
}
|
||||
|
||||
|
||||
style += 'box-shadow:' + (this.value.ornament.type == 'shadow' ? '0 0 10rpx ' + this.value.ornament.color : '') + ';';
|
||||
style += 'border:' + (this.value.ornament.type == 'stroke' ? '2rpx solid ' + this.value.ornament.color : '') + ';';
|
||||
|
||||
|
||||
console.log(this.value);
|
||||
|
||||
|
||||
return style;
|
||||
},
|
||||
|
||||
|
||||
swiperHeight() {
|
||||
let height = 0;
|
||||
|
||||
|
||||
if (this.value.mode == 'graphic') {
|
||||
height = (49 + this.value.imageSize) * this.value.pageCount;
|
||||
} else if (this.value.mode == 'img') {
|
||||
@@ -158,13 +122,13 @@ export default {
|
||||
} else if (this.value.mode == 'text') {
|
||||
height = 43 * this.value.pageCount;
|
||||
}
|
||||
|
||||
|
||||
return 'height:' + (2 * height) + 'rpx';
|
||||
},
|
||||
|
||||
|
||||
isIndicatorDots() {
|
||||
return this.value.carousel.type != 'hide' &&
|
||||
1 != Math.ceil(this.value.list.length / (this.value.pageCount * this.value.rowCount));
|
||||
return this.value.carousel.type != 'hide' &&
|
||||
1 != Math.ceil(this.value.list.length / (this.value.pageCount * this.value.rowCount));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -173,7 +137,7 @@ export default {
|
||||
this.video_url = item.videoUrl;
|
||||
this.$refs.videoPopup.open();
|
||||
},
|
||||
|
||||
|
||||
// 图片加载错误处理
|
||||
imgError(index) {
|
||||
// 图片加载失败的处理逻辑
|
||||
@@ -194,7 +158,7 @@ export default {
|
||||
&.row1-of3 {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
|
||||
.goods-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
@@ -202,89 +166,93 @@ export default {
|
||||
margin-top: 20rpx;
|
||||
width: calc(33.3333333% - 14rpx);
|
||||
box-sizing: border-box;
|
||||
|
||||
|
||||
&:nth-child(3n + 3) {
|
||||
width: calc(33.33% - 15rpx);
|
||||
}
|
||||
|
||||
&:nth-of-type(1), &:nth-of-type(2), &:nth-of-type(3) {
|
||||
|
||||
&:nth-of-type(1),
|
||||
&:nth-of-type(2),
|
||||
&:nth-of-type(3) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
||||
&:nth-child(3n) {
|
||||
width: calc(33.3333333% - 15rpx);
|
||||
}
|
||||
|
||||
|
||||
&:nth-child(3n-1) {
|
||||
margin-left: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
|
||||
&.shadow {
|
||||
width: calc(33.3333333% - 18rpx);
|
||||
|
||||
&:nth-of-type(1), &:nth-of-type(2), &:nth-of-type(3) {
|
||||
|
||||
&:nth-of-type(1),
|
||||
&:nth-of-type(2),
|
||||
&:nth-of-type(3) {
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
|
||||
&:nth-child(1n) {
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
|
||||
&:nth-child(3n-1) {
|
||||
margin-left: 20rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
|
||||
&:nth-child(3n) {
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.goods-img-wrap {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: 220rpx;
|
||||
}
|
||||
|
||||
|
||||
.goods-img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.info-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
|
||||
|
||||
.pro-info {
|
||||
margin-top: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
|
||||
.discount-price {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
|
||||
.price-wrap {
|
||||
white-space: nowrap;
|
||||
|
||||
|
||||
.unit {
|
||||
font-size: 24rpx !important;
|
||||
}
|
||||
|
||||
|
||||
.price {
|
||||
font-size: 32rpx;
|
||||
|
||||
|
||||
text {
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.delete-price {
|
||||
text-decoration: line-through;
|
||||
flex: 1;
|
||||
@@ -295,46 +263,46 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.style-1 {
|
||||
.pro-info {
|
||||
.price-wrap {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
|
||||
.discount-price {
|
||||
justify-content: unset !important;
|
||||
align-items: baseline !important;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
|
||||
.delete-price {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.style-2 {
|
||||
.pro-info {
|
||||
position: relative;
|
||||
flex-direction: row !important;
|
||||
align-items: center;
|
||||
|
||||
|
||||
.price-wrap {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
|
||||
.discount-price {
|
||||
align-items: flex-end !important;
|
||||
flex-wrap: wrap;
|
||||
justify-content: unset !important;
|
||||
}
|
||||
|
||||
|
||||
.delete-price {
|
||||
margin: 20rpx 0;
|
||||
flex-basis: 100% !important;
|
||||
}
|
||||
|
||||
|
||||
.buy-btn {
|
||||
min-width: 112rpx;
|
||||
height: 52rpx;
|
||||
@@ -345,19 +313,19 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.sell-out {
|
||||
text {
|
||||
font-size: 150rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.row1-of2 {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
|
||||
.goods-item {
|
||||
position: relative;
|
||||
margin-top: 20rpx;
|
||||
@@ -365,72 +333,74 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
|
||||
|
||||
&:nth-child(2n) {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
&:nth-of-type(1), &:nth-of-type(2) {
|
||||
|
||||
&:nth-of-type(1),
|
||||
&:nth-of-type(2) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
|
||||
&.shadow {
|
||||
width: calc(50% - 18rpx);
|
||||
|
||||
|
||||
&:nth-child(2n-1) {
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
|
||||
&:nth-child(2n) {
|
||||
margin-right: 8rpx !important;
|
||||
}
|
||||
|
||||
&:nth-of-type(1), &:nth-of-type(2) {
|
||||
|
||||
&:nth-of-type(1),
|
||||
&:nth-of-type(2) {
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.goods-img-wrap {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: 340rpx;
|
||||
}
|
||||
|
||||
|
||||
.goods-img {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.info-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
|
||||
|
||||
.sale {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
|
||||
.pro-info {
|
||||
margin-top: auto;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
|
||||
|
||||
.discount-price {
|
||||
.price-wrap {
|
||||
white-space: nowrap;
|
||||
|
||||
|
||||
.unit {
|
||||
font-weight: 700;
|
||||
font-size: 24rpx !important;
|
||||
}
|
||||
|
||||
|
||||
.price {
|
||||
font-weight: 700;
|
||||
font-size: 32rpx !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.delete-price {
|
||||
text-decoration: line-through;
|
||||
flex: 1;
|
||||
@@ -441,57 +411,57 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.style-1 {
|
||||
.pro-info {
|
||||
.discount-price {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
|
||||
|
||||
.price-wrap {
|
||||
display: inline-block;
|
||||
|
||||
|
||||
text {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.delete-price {
|
||||
margin-top: 6rpx;
|
||||
flex-basis: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.style-2 {
|
||||
.pro-info {
|
||||
position: relative;
|
||||
align-items: center;
|
||||
|
||||
|
||||
.price-wrap {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
|
||||
.discount-price {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
|
||||
.delete-price {
|
||||
margin-top: 4rpx;
|
||||
flex-basis: 100% !important;
|
||||
}
|
||||
|
||||
|
||||
.sale {
|
||||
line-height: 1;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
|
||||
.buy-btn {
|
||||
min-width: 140rpx;
|
||||
height: 52rpx;
|
||||
@@ -502,7 +472,7 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.style-3 {
|
||||
.pro-info {
|
||||
.member-price {
|
||||
@@ -510,19 +480,19 @@ export default {
|
||||
align-self: flex-end;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
|
||||
.sale {
|
||||
line-height: 1;
|
||||
align-self: center;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
|
||||
.discount-price {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex: 1;
|
||||
align-content: center;
|
||||
|
||||
|
||||
.price-wrap {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
@@ -531,12 +501,12 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.swiper {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.sell-out {
|
||||
text {
|
||||
font-size: 250rpx;
|
||||
@@ -563,7 +533,7 @@ export default {
|
||||
.video-nav {
|
||||
padding: 16rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
|
||||
&.fixed-layout {
|
||||
.uni-scroll-view-content {
|
||||
display: flex;
|
||||
@@ -571,24 +541,24 @@ export default {
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.singleSlide {
|
||||
.uni-scroll-view-content {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
.video-nav-item {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.pageSlide {
|
||||
position: relative;
|
||||
|
||||
|
||||
.uni-swiper-dots-horizontal {
|
||||
bottom: 0rpx;
|
||||
}
|
||||
|
||||
|
||||
&.straightLine {
|
||||
.uni-swiper-dot {
|
||||
width: 30rpx;
|
||||
@@ -596,7 +566,7 @@ export default {
|
||||
height: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.circle {
|
||||
.uni-swiper-dot {
|
||||
width: 14rpx;
|
||||
@@ -604,21 +574,21 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.video-nav-wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
.video-nav-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 14rpx 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
|
||||
.video-text {
|
||||
padding-top: 12rpx;
|
||||
line-height: 1.5;
|
||||
@@ -627,25 +597,25 @@ export default {
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
||||
|
||||
&.alone {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.text {
|
||||
.video-text {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.video-img {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 90rpx;
|
||||
|
||||
|
||||
.tag {
|
||||
position: absolute;
|
||||
top: -10rpx;
|
||||
@@ -659,7 +629,7 @@ export default {
|
||||
line-height: 1;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
|
||||
.icon {
|
||||
font-size: 50rpx;
|
||||
color: #606266;
|
||||
@@ -675,16 +645,16 @@ export default {
|
||||
justify-content: center;
|
||||
margin-top: -20rpx;
|
||||
padding-bottom: 8rpx;
|
||||
|
||||
|
||||
.swiper-dot {
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
margin: 8rpx;
|
||||
|
||||
|
||||
&.active {
|
||||
background-color: #000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.straightLine {
|
||||
.swiper-dot {
|
||||
width: 30rpx;
|
||||
@@ -692,7 +662,7 @@ export default {
|
||||
height: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.circle {
|
||||
.swiper-dot {
|
||||
width: 15rpx;
|
||||
|
||||
Reference in New Issue
Block a user