操作视频,增删改查,接口联调
This commit is contained in:
@ -4,17 +4,17 @@
|
||||
<custom-navbar title="操作视频" :showBack="true" backgroundColor="#202020" color="#FFFFFF"></custom-navbar>
|
||||
<view class="device-page" :style="{ paddingTop: navBarHeight + 'px' }">
|
||||
<scroll-view scroll-y>
|
||||
<uni-swipe-action >
|
||||
<uni-swipe-action>
|
||||
<block v-for="(item, index) in videoList" :key="index">
|
||||
<uni-swipe-action-item :right-options="item.showConfirm ? confirmOptions : deleteOptions"
|
||||
@click="handleSwipeClick($event, index)" class="content">
|
||||
<view class="image-box" @click="openVideoUrl(item.url)">
|
||||
@click="handleSwipeClick($event, index,item)" class="content">
|
||||
<view class="image-box" @click="openVideoUrl(item.videoUrl)">
|
||||
<view class="deviceIMG">
|
||||
<image src="/static/images/video.png" mode="" class="video"></image>
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="file-title">{{item.title}}</view>
|
||||
<view class="file-baidu">{{item.url}}</view>
|
||||
<view class="file-title">{{item.videoName}}</view>
|
||||
<view class="file-baidu">{{item.videoUrl}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<image src="/static/images/cires.png" class="circle"></image>
|
||||
@ -30,12 +30,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listOperationVideos,
|
||||
deleteOperationVideo
|
||||
} from '@/api/common/operationVideo/index.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
navTitle: '操作视频',
|
||||
|
||||
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
||||
videoList: [],
|
||||
deviceID: '',
|
||||
deleteOptions: [{
|
||||
text: '编辑',
|
||||
style: {
|
||||
@ -68,27 +73,46 @@
|
||||
// 添加视频
|
||||
addvideo() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/6170/addvideo/index'
|
||||
url: `/pages/common/addvideo/index??id=${this.deviceID}`
|
||||
})
|
||||
},
|
||||
|
||||
// 处理滑动按钮点击
|
||||
handleSwipeClick(e, index) {
|
||||
handleSwipeClick(e, index, item) {
|
||||
console.log(item, 'eeeee');
|
||||
const {
|
||||
content
|
||||
} = e;
|
||||
// 如果是确认删除操作
|
||||
if (content.text === '确认删除') {
|
||||
this.videoList.splice(index, 1);
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
return;
|
||||
let ids = item.id
|
||||
let data ={
|
||||
ids:item.id
|
||||
}
|
||||
deleteOperationVideo(ids).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'success'
|
||||
});
|
||||
this.getData()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'success'
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// return;
|
||||
}
|
||||
// 编辑操作
|
||||
if (content.text === '编辑') {
|
||||
this.editVideo(this.videoList[index].id);
|
||||
console.log('编辑');
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/addvideo/index?item=${encodeURIComponent(JSON.stringify(item))}`
|
||||
});
|
||||
}
|
||||
// 删除操作
|
||||
else if (content.text === '删除') {
|
||||
@ -103,12 +127,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
// 编辑视频
|
||||
editVideo(id) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/6170/editVideo/index?id=${id}`
|
||||
});
|
||||
},
|
||||
// 打开视频URL
|
||||
openVideoUrl(url) {
|
||||
console.log(url, 'url333');
|
||||
@ -127,6 +145,29 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
getData() {
|
||||
let data = {
|
||||
deviceId: this.deviceID
|
||||
}
|
||||
listOperationVideos(data).then((res) => {
|
||||
console.log(res, 'resss');
|
||||
if (res.code == 200) {
|
||||
this.videoList = res.data
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getData()
|
||||
},
|
||||
onLoad(options) {
|
||||
this.deviceID = options.id
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user