452 lines
10 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="dangerbig-list">
<view class="fixedheader">
<headers :showBack="true">
<view class="headerName">
宣传视频列表
</view>
</headers>
<view class="searchBox">
<view class="uni-form-item">
<input class="uni-input" name="searchName" @input="handleInput" v-model="searchName"
placeholder="请输入视频名称" />
<!-- <button class="mini-btn" type="primary" size="mini" @click="loadData">搜索</button> -->
</view>
</view>
</view>
<view :style="{ 'padding-top': (((statusBarHeight * 2) + 100) * 2)+ 'rpx' }">
<view class="list" v-if="workList && workList.length>0">
<!-- @click="checkItem(item)" -->
<view class="list-item" v-for="(item,index) in workList" :key="index" >
<view class="list-title">
<!-- 未销项 -->
<view>
<!-- <text class="tag" v-if="item.hiddenDangerNum > 0">未销项{{item.hiddenDangerNum}}</text> -->
视频名称{{item.videoName}}
</view>
<!-- <view :class="{'status2': item.engineeringState !== 4, 'status4': item.engineeringState === 4}">
{{item.engineeringState === 4 ? "已完工" : "在施"}}
</view> -->
</view>
<view class="list-content">
<view class="list-info">
是否置顶{{item.isPin == 1 ? '是' : '否'}}
<!-- <view class="info-status" v-if="item.issuperdanger">超危</view> -->
</view>
<view class="list-info">
视频<video @click.stop="downloadFile(item.attachmentUrl)" style="width:200rpx; height: 140rpx;" :src="`${item.attachmentUrl}#t=1`" :show-center-play-btn="false" :controls="false" preload="metadata">
<image class="video_image" src="@/static/video_play.png" mode=""></image>
</video>
<!-- <view class="download" v-for="item in item.image" :key="item.id">
<video @click.stop="downloadFile(item.url)" v-if="item.name.includes('.mp4')" style="width:150rpx; height: 100rpx;" :src="`${item.url}#t=1`" :show-center-play-btn="false" :controls="false" preload="metadata"></video>
<image v-else :src="item.url.includes('http://') ? item.url : url_config+'image/'+item.url"
class="img"
@click.stop="previewImage(item.url.includes('http://') ? item.url : url_config+'image/'+item.url)">
</image>
</view> -->
<!-- <view class="info-status" v-if="item.issuperdanger">超危</view> -->
</view>
</view>
<!-- <view class="btn_detail">查看明细</view> -->
</view>
<view class="loadMoreBox" v-if="isLoadMore">
<uni-load-more :status="loadStatus" iconType="auto"></uni-load-more>
</view>
</view>
<view class="no-data" v-else>
<image class="img" src="/static/noData.png"></image>
<text class="txt">暂无数据</text>
</view>
</view>
<view class="fixed" :class="{show:showIframe}" v-if="show" @click="show=false">
<view class="iframeMain" @click.stop="show=true">
<video v-if="getType(iframeUrl) == 'video'" preload="metadata" :src="`${iframeUrl}#t=1`" class="iframe"></video>
<image v-else-if="getType(iframeUrl) == 'image'" class="iframe" :src="iframeUrl" mode="aspectFit">
</image>
<iframe v-else class="iframe" ref="iframe" :src="iframeUrl" frameborder="0"></iframe>
</view>
</view>
</view>
</template>
<script>
import {
isVideoLink,
isImageLink,
openOutsideFile,
openLocalFile,
removeNetWorkFileTemp,
isJSON
} from '@/utils/tool.js'
export default {
data() {
return {
statusBarHeight: 0,
pageNo: 1,
pageSize: 10,
projectSn: "",
listData: [],
isLoadMore: false,
loadStatus: 'more',
workList: [],
levelList: [{
id: 1,
workCategoryName: "一级"
}, {
id: 2,
workCategoryName: "二级"
}, {
id: 3,
workCategoryName: "三级"
}, {
id: 4,
workCategoryName: "普通"
}],
searchName: "",
showIframe: false,
show: false,
iframeUrl: "",
}
},
onShow() {
this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight;
this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
},
onLoad() {
this.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
// this.initData()
this.getWorkList()
},
onReachBottom() {
console.log(1)
if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
this.isLoadMore = true
this.pageNo += 1
this.getWorkList()
}
},
onPullDownRefresh() {
console.log(2)
this.pageNo = 1
this.listData = []
this.getWorkList()
},
methods: {
getType(url) {
if (isImageLink(url)) {
return "image"
} else if (isVideoLink(url)) {
return "video"
} else {
return ''
}
},
downloadFile(url) {
// 下载所有的文件
let name = url.substring(url.lastIndexOf('/') + 1);
console.log(name, "文件名称");
if (isVideoLink(url) || isImageLink(url)) {
// 是图片和视频
this.show = true;
this.showIframe = true;
this.iframeUrl = url.includes('http://') ? url : this.url_config + 'image/' + url;
} else {
// openOutsideFile(`${this.url_config}image/${url}`)
openLocalFile(name, `${this.url_config}image/${url}`)
}
return;
},
//预览图片
previewImage(url) {
uni.previewImage({
urls: [url]
})
},
handleInput() {
this.pageNo = 1;
this.listData = []
this.workList = [];
this.getWorkList();
},
getWorkList() {
let data = {
pageNo: this.pageNo,
pageSize: this.pageSize,
projectSn: this.projectSn,
videoName: this.searchName,
type: 2,
}
this.sendRequest({
url: 'xmgl/promotionalVideo/page',
method: 'get',
data: data,
success: res => {
uni.hideLoading()
if (res.code == 200) {
console.log("workList======================", res)
// this.listData = res.result.records
// this.workList=this.workList.concat(res.result)
const newResult = res.result.records.map(item => {
return {
...item,
// image: isJSON(item.file) ? JSON
// .parse(item.file) : [],
}
})
this.workList = this.workList.concat(newResult)
if (res.result.records.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
this.isLoadMore = true
this.loadStatus = 'nomore'
} else {
this.isLoadMore = false
// that.loadStatus='more'
}
uni.stopPullDownRefresh()
}
}
})
},
checkItem(val) {
console.log(val)
uni.navigateTo({
url: './detail?id=' + val.id
})
}
}
}
</script>
<style lang="scss" scoped>
.video_image {
width: 60rpx;
height: 60rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 999;
}
.fixed {
position: fixed;
z-index: 9999;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, .3);
display: none;
&.show {
display: initial;
}
}
.iframeMain {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 650rpx;
font-size: 0;
.iframe {
width: 100%;
height: 500rpx;
}
}
.searchBox {
// background-color: white;
background-color: #F3F5F7;
}
.uni-form-item {
position: relative;
display: flex;
align-items: center;
font-size: 28rpx;
/* .search-icon{
position: absolute;
top: 50%;
right: 50rpx;
transform: translateY(-50%);
} */
}
.uni-input {
border-radius: 40rpx;
margin: 20rpx;
// background-color: #f7f8fa;
background: #FFFFFF;
height: 70rpx;
line-height: 60rpx;
padding: 0 40rpx;
font-size: 28rpx;
flex: 1;
}
.screen {
line-height: 100rpx;
color: gray;
}
.flex {
display: flex;
align-items: center;
}
.content {
padding: 0px 30rpx 20rpx;
box-sizing: border-box;
width: 100%;
}
.download {
display: flex;
flex-wrap: wrap;
align-items: center;
margin-top: 10rpx;
// justify-content: center;
}
.img {
width: 120rpx;
height: 120rpx;
}
.dangerbig-list {
min-height: 100%;
// background: #F6F6F6;
background-color: #F3F5F7;
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
:deep( .headerBox ){
background-color: #F3F5F7;
}
.headerName {
z-index: 1;
}
}
.list {
padding: 20rpx 0;
margin: 0 20rpx;
.list-item {
background: #fff;
margin-bottom: 20rpx;
padding: 20rpx 0;
position: relative;
border-radius: 24rpx;
.list-title {
padding: 10rpx 20rpx;
// border-bottom: 4rpx solid #F6F6F6;
display: flex;
align-items: center;
justify-content: space-between;
.tag {
background: #F0AD4E;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
margin-right: 20rpx;
margin-left: -20rpx;
height: 32rpx;
}
.status1 {
background: #2b8df3;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
.status2 {
background: #F0AD4E;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
.status3 {
background: #B22222;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
.status4 {
background: #ccc;
color: #fff;
padding: 4rpx 8rpx;
font-size: 24rpx;
}
}
.list-info {
display: flex;
padding: 10rpx 20rpx;
font-size: 28rpx;
// border-bottom: 2rpx solid #F6F6F6;
}
.info-status {
padding: 0 10rpx;
border: 1px solid #DD524D;
border-radius: 6rpx;
color: #DD524D;
margin-left: 10rpx;
}
.btn_detail {
background-color: #4181FE;
color: white;
padding: 3rpx 16rpx;
border-radius: 30rpx;
position: absolute;
bottom: 16rpx;
right: 16rpx;
}
}
}
.btn {
height: 96rpx;
width: 100%;
line-height: 96rpx;
text-align: center;
background: #4181FE;
color: #fff;
position: fixed;
bottom: 0;
left: 0;
}
.no-data {
text-align: center;
.img {
display: block;
height: 200rpx;
width: 200rpx;
margin: 0 auto;
margin-top: 560rpx;
margin-bottom: 60rpx;
}
.txt {
color: #CFC8CC;
}
}
}
</style>