403 lines
9.0 KiB
Plaintext
403 lines
9.0 KiB
Plaintext
|
|
<template>
|
|||
|
|
<view class="container">
|
|||
|
|
<view class="positonFixed">
|
|||
|
|
<view class="header-top flex-row-center" :class="{videoTop:current==0}"
|
|||
|
|
:style="{ height: `${88+statusBarHeight}rpx`,paddingTop: `${statusBarHeight}rpx`}">
|
|||
|
|
<view class="left-area" @click="goBack">
|
|||
|
|
<image src="/static/images/whiteBack.png" mode="aspectFit" class="back-icon"></image>
|
|||
|
|
</view>
|
|||
|
|
<view class="flex-row-center-center" style="flex: 1;margin-right: 18rpx;height:66rpx;">
|
|||
|
|
<uv-tabs :list="list" @click="tabsClick" itemStyle="height:66rpx;" :activeStyle="activeStyle"
|
|||
|
|
:inactiveStyle="inactiveStyle" :current="current" :lineColor="`rgba(232, 16, 30, 1)`"></uv-tabs>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
<scroll-view scroll-x style="height: 100rpx;" v-if="current==1">
|
|||
|
|
<view class="container-tabs flex-row-center">
|
|||
|
|
<view class="container-tab flex-row-center-center" @click="clickTab(item)"
|
|||
|
|
:class="{active:cardListIndex==item.id}" v-for="(item,index) in cardList[1]" :key="index">
|
|||
|
|
<text class="container-tab-text">{{ item.title }}</text>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
</scroll-view>
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
<view class="container-content" :style="swiperStyle2">
|
|||
|
|
<swiper class="swiper" circular :style="swiperStyle" :current="current" @change="swiperChange" :disable-touch="current==0">
|
|||
|
|
<swiper-item>
|
|||
|
|
<videoSlide ref="ideoSlideRrf" :popVideoList="videoList" :marginTop="`${88 + this.statusBarHeight}`" :current="current" v-show="current==0" v-if="videoList.length"></videoSlide>
|
|||
|
|
</swiper-item>
|
|||
|
|
<swiper-item>
|
|||
|
|
<scroll-view scroll-y :style="{height:`${viewportHeight-88-this.statusBarHeight-100}rpx`}">
|
|||
|
|
<view class="swiper-items2">
|
|||
|
|
<view class="swiper-item2" :class="{item2Left:index%2 == 0}"
|
|||
|
|
v-for="(item,index) in imagObj[cardListIndex]" :key="index">
|
|||
|
|
<image class="swiper-item2-img" mode="aspectFill" :src="item.url"></image>
|
|||
|
|
<view class="swiper-item2-title">
|
|||
|
|
<text class="swiper-item2-title-text">{{ item.name }}</text>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</scroll-view>
|
|||
|
|
</swiper-item>
|
|||
|
|
</swiper>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
import videoSlide from "./components/videoSlide"
|
|||
|
|
import request from "../../utils/request";
|
|||
|
|
export default {
|
|||
|
|
components: {
|
|||
|
|
videoSlide
|
|||
|
|
},
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
cardList: {
|
|||
|
|
1: [{
|
|||
|
|
title: "全部",
|
|||
|
|
id: 0
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: "主图",
|
|||
|
|
id: 1
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: "环境",
|
|||
|
|
id: 2
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: "作品",
|
|||
|
|
id: 3
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
title: "其他",
|
|||
|
|
id: 4
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
cardListIndex: 0,
|
|||
|
|
systemInfo: {},
|
|||
|
|
id: null, //商家或者手艺人id
|
|||
|
|
user_type: null,
|
|||
|
|
activeStyle: {
|
|||
|
|
fontWeight: 500,
|
|||
|
|
fontSize: "32rpx",
|
|||
|
|
color: "#333333",
|
|||
|
|
},
|
|||
|
|
inactiveStyle: {
|
|||
|
|
fontWeight: 500,
|
|||
|
|
fontSize: "32rpx",
|
|||
|
|
color: "#666666",
|
|||
|
|
},
|
|||
|
|
current: 1,
|
|||
|
|
statusBarHeight: 0,
|
|||
|
|
list: [{
|
|||
|
|
name: '视频',
|
|||
|
|
}, {
|
|||
|
|
name: '相册',
|
|||
|
|
}],
|
|||
|
|
imagObj: {},
|
|||
|
|
videoList: []
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
async onLoad(options) {
|
|||
|
|
// 获取状态栏高度
|
|||
|
|
const systemInfo = await uni.getSystemInfoSync()
|
|||
|
|
this.systemInfo = systemInfo
|
|||
|
|
let screenWidth = systemInfo.screenWidth;
|
|||
|
|
this.statusBarHeight = this.pxToRpx(systemInfo.statusBarHeight, screenWidth);
|
|||
|
|
if (options.id && options.user_type) {
|
|||
|
|
this.id = options.id
|
|||
|
|
this.user_type = options.user_type
|
|||
|
|
this.getImgList()
|
|||
|
|
this.getVideoList()
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
computed: {
|
|||
|
|
// 计算swiper的样式
|
|||
|
|
swiperStyle() {
|
|||
|
|
if (this.current == 1) {
|
|||
|
|
let screenWidth = this.systemInfo.screenWidth;
|
|||
|
|
// 注意:100vh 是视口高度,需要先转数值计算,再拼接单位
|
|||
|
|
|
|||
|
|
let viewportHeight = this.pxToRpx(this.systemInfo.windowHeight || window?.innerHeight || document
|
|||
|
|
?.documentElement?.clientHeight|| 0, screenWidth ) ;
|
|||
|
|
let height = viewportHeight - 88 - this.statusBarHeight;
|
|||
|
|
return {
|
|||
|
|
height: `${height}rpx`
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return {
|
|||
|
|
height: `${this.viewportHeight}rpx`
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
swiperStyle2() {
|
|||
|
|
if (this.current == 1) {
|
|||
|
|
return {
|
|||
|
|
marginTop: `${88 + this.statusBarHeight + 100}rpx`,
|
|||
|
|
height: `${this.viewportHeight-88-this.statusBarHeight-100}rpx`
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return {
|
|||
|
|
height: `${this.viewportHeight}rpx`
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
viewportHeight() {
|
|||
|
|
let screenWidth = this.systemInfo.screenWidth;
|
|||
|
|
// 注意:100vh 是视口高度,需要先转数值计算,再拼接单位
|
|||
|
|
let viewportHeight = this.pxToRpx(this.systemInfo.windowHeight || window?.innerHeight || document
|
|||
|
|
?.documentElement?.clientHeight|| 0, screenWidth) ;
|
|||
|
|
return viewportHeight
|
|||
|
|
},
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
clickTab(item) {
|
|||
|
|
this.cardListIndex = item.id
|
|||
|
|
},
|
|||
|
|
tabsClick(e) {
|
|||
|
|
this.$nextTick(() => {
|
|||
|
|
|
|||
|
|
this.current = e.index
|
|||
|
|
if(this.current==1){
|
|||
|
|
this.activeStyle.color = "#333333"
|
|||
|
|
this.inactiveStyle.color = "#666666"
|
|||
|
|
this.$refs.ideoSlideRrf.nowStopVideo()
|
|||
|
|
}
|
|||
|
|
if(this.current==0){
|
|||
|
|
this.activeStyle.color = "#fff"
|
|||
|
|
this.inactiveStyle.color = "#ccc"
|
|||
|
|
this.$refs.ideoSlideRrf.nowPlayVideo()
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
swiperChange(e) {
|
|||
|
|
this.$nextTick(() => {
|
|||
|
|
this.current = e.detail.current
|
|||
|
|
if(this.current==1){
|
|||
|
|
this.activeStyle.color = "#333333"
|
|||
|
|
this.inactiveStyle.color = "#666666"
|
|||
|
|
this.$refs.ideoSlideRrf.nowStopVideo()
|
|||
|
|
}
|
|||
|
|
if(this.current==0){
|
|||
|
|
this.activeStyle.color = "#fff"
|
|||
|
|
this.inactiveStyle.color = "#ccc"
|
|||
|
|
this.$refs.ideoSlideRrf.nowPlayVideo()
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
},
|
|||
|
|
pxToRpx(px, screenWidth) {
|
|||
|
|
|
|||
|
|
if (typeof px !== 'number') {
|
|||
|
|
throw new Error('请传入数字类型的px值');
|
|||
|
|
}
|
|||
|
|
return px * (750 / screenWidth);
|
|||
|
|
},
|
|||
|
|
getImgList() {
|
|||
|
|
request.post("/user/imgVideo/list", {
|
|||
|
|
user_id: this.id,
|
|||
|
|
user_type: this.user_type,
|
|||
|
|
type: 1
|
|||
|
|
}).then(res => {
|
|||
|
|
if (res.code == 200) {
|
|||
|
|
this.imagObj = res.data.list[1]
|
|||
|
|
let all = []
|
|||
|
|
for (let key in res.data.list[1]) {
|
|||
|
|
all = [...all, ...res.data.list[1][key]]
|
|||
|
|
}
|
|||
|
|
this.imagObj[0] = all
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
getVideoList() {
|
|||
|
|
request.post("/user/imgVideo/list", {
|
|||
|
|
user_id: this.id,
|
|||
|
|
user_type: this.user_type,
|
|||
|
|
type: 2
|
|||
|
|
}).then(res => {
|
|||
|
|
if (res.code == 200) {
|
|||
|
|
for (let key in res.data.list[2]) {
|
|||
|
|
this.videoList = [...this.videoList, ...res.data.list[2][key]]
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<style lang="less">
|
|||
|
|
.container {
|
|||
|
|
.positonFixed {
|
|||
|
|
z-index: 9999;
|
|||
|
|
position: fixed;
|
|||
|
|
top: 0;
|
|||
|
|
left: 0;
|
|||
|
|
right: 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.header-top {
|
|||
|
|
z-index: 9999;
|
|||
|
|
background: #f5f5f5;
|
|||
|
|
padding: 0 24rpx;
|
|||
|
|
|
|||
|
|
.left-area {
|
|||
|
|
display: flex;
|
|||
|
|
align-items: center;
|
|||
|
|
|
|||
|
|
.back-icon {
|
|||
|
|
width: 36rpx;
|
|||
|
|
height: 36rpx;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.left-area-img {
|
|||
|
|
width: 144rpx;
|
|||
|
|
height: 52rpx;
|
|||
|
|
margin-left: 20rpx;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
.videoTop{
|
|||
|
|
background: transparent;
|
|||
|
|
::v-deep .uv-tabs__wrapper__nav__line{
|
|||
|
|
background: #fff!important;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.container-tabs {
|
|||
|
|
.container-tab {
|
|||
|
|
width: 96rpx;
|
|||
|
|
height: 56rpx;
|
|||
|
|
background: #FFFFFF;
|
|||
|
|
border-radius: 10rpx;
|
|||
|
|
margin: 20rpx;
|
|||
|
|
|
|||
|
|
.container-tab-text {
|
|||
|
|
font-weight: 400;
|
|||
|
|
font-size: 28rpx;
|
|||
|
|
color: #666666;
|
|||
|
|
text-align: left;
|
|||
|
|
font-style: normal;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.active {
|
|||
|
|
background: #FEE5E7;
|
|||
|
|
|
|||
|
|
.container-tab-text {
|
|||
|
|
font-weight: 400;
|
|||
|
|
font-size: 28rpx;
|
|||
|
|
color: #E8101E;
|
|||
|
|
line-height: 40rpx;
|
|||
|
|
text-align: left;
|
|||
|
|
font-style: normal;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.container-content {
|
|||
|
|
z-index: 1000;
|
|||
|
|
.swiper {
|
|||
|
|
background: #fff;
|
|||
|
|
|
|||
|
|
.swiper-items2 {
|
|||
|
|
flex-wrap: wrap;
|
|||
|
|
flex-direction: row;
|
|||
|
|
display: flex;
|
|||
|
|
padding-bottom: 20rpx;
|
|||
|
|
|
|||
|
|
.swiper-item2 {
|
|||
|
|
width: 370rpx;
|
|||
|
|
height: 370rpx;
|
|||
|
|
margin-top: 10rpx;
|
|||
|
|
border-radius: 20rpx;
|
|||
|
|
overflow: hidden;
|
|||
|
|
position: relative;
|
|||
|
|
|
|||
|
|
.swiper-item2-img {
|
|||
|
|
width: 370rpx;
|
|||
|
|
height: 370rpx;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.swiper-item2-title {
|
|||
|
|
position: absolute;
|
|||
|
|
left: 0;
|
|||
|
|
top: 0;
|
|||
|
|
height: 33rpx;
|
|||
|
|
padding: 0 8rpx;
|
|||
|
|
background: rgba(0, 0, 0, 0.5);
|
|||
|
|
border-radius: 0rpx 0rpx 10rpx 0rpx;
|
|||
|
|
width: fit-content;
|
|||
|
|
|
|||
|
|
.swiper-item2-title-text {
|
|||
|
|
font-weight: 400;
|
|||
|
|
font-size: 18rpx;
|
|||
|
|
color: #FFFFFF;
|
|||
|
|
line-height: 33rpx;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.item2Left {
|
|||
|
|
margin-right: 9rpx;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.flex-row-center-between {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: row;
|
|||
|
|
align-items: center;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.flex-row-start-between {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: row;
|
|||
|
|
align-items: flex-start;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.flex-row-center-center {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: row;
|
|||
|
|
align-items: center;
|
|||
|
|
justify-content: center;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.flex-row-center {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: row;
|
|||
|
|
align-items: center;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.flex-row-start {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: row;
|
|||
|
|
align-items: flex-start;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.flex-row-end-between {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: row;
|
|||
|
|
align-items: flex-end;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
</style>
|