加入视频下载,优化变量名称,

This commit is contained in:
emm
2022-09-06 21:30:30 +08:00
parent 63ab838f43
commit 6920aecf15
3 changed files with 378 additions and 87 deletions
+99 -21
View File
@@ -1,13 +1,13 @@
<template>
<div class="side" style="width: 100%">
<span>下载历史</span>
<div v-show="loadComplete" class="load_complete" >
<el-table :data="data">
<span>{{showType}}历史</span>
<div v-show="loadComplete" class="load_complete">
<el-table :data="galleryTasks" v-show="isShowGalleryHistory">
<el-table-column type="expand">
<template #default="props">
名字:{{ props.row.name}} <br>
链接:<el-link :href="props.row.link">Link</el-link> <br>
链接:<el-link :href="props.row.link">链接</el-link> <br>
语言:{{props.row.language}} <br>
页数:{{props.row.pages}} <br>
文件大小:{{props.row.fileSize}}<br>
@@ -24,14 +24,48 @@
<el-table-column label="操作" width="250">
<template #default="scoped">
<span v-show="scoped.row.download">
<el-button @click="downloadGallery(scoped.row.download)">下载</el-button>
<el-button @click="downloadTask(scoped.row.download)">下载</el-button>
<el-button @click="deleteGallery(scoped.row.gid)">删除</el-button>
<el-button @click="onlineReader(scoped.row.name)">在线看</el-button>
<el-button @click="onlineGalleryReader(scoped.row.name)">在线看</el-button>
</span>
</template>
</el-table-column>
<el-table-column label="进度" width="60">
<el-table-column label="进度" width="80">
<template #default="scoped">
{{ scoped.row.progress }}
</template>
</el-table-column>
</el-table>
<el-table :data="videoTasks" v-show="isShowVideoHistory">
<el-table-column type="expand">
<template #default="props">
名字:{{props.row.name}} <br>
网站:{{props.row.website}} <br>
链接:<el-link :href="props.row.link">链接</el-link> <br>
文件大小:{{props.row.fileSize}} <br>
视频长度:{{props.row.duration}} <br>
分辨率:{{props.row.resolution}} <br>
</template>
</el-table-column>
<el-table-column label="名字" width="300">
<template #default="scoped">
{{scoped.row.name}}
</template>
</el-table-column>
<el-table-column label="操作" width="250">
<template #default="scoped">
<span v-show="scoped.row.download">
<el-button @click="downloadTask(scoped.row.download)">下载</el-button>
<el-button @click="deleteVideo(scoped.row.id)">删除</el-button>
<el-button @click="onlineVideoViewer(scoped.row.name)">在线看</el-button>
</span>
</template>
</el-table-column>
<el-table-column label="进度" width="80">
<template #default="scoped">
{{ scoped.row.progress }}
</template>
@@ -47,11 +81,14 @@
v-show="isEditing"
@blur="reverse()"
class="page"
ref="input"></el-input>
ref="inputNode"></el-input>
<span @click="reverse" v-show="!isEditing" class="page">{{page}}</span>
<el-button @click="next">+</el-button>
<el-button @click="toMax">{{max}}</el-button>
</el-col>
<el-col>
<el-button @click="changeShowType">切换</el-button>
</el-col>
</el-row>
</div>
<span v-show="!loadComplete" class="side">请输入授权码后再查看</span>
@@ -68,16 +105,31 @@ export default {
const targetPage = ref(1)
const isEditing = ref(false)
let input = ref(null)
let inputNode = ref(null)
let showType = ref("本子")
let data = computed(() => {
console.log(store.getters.task)
if(store.getters.task)
return store.getters.task
let galleryTasks = computed(() => {
if(store.getters.galleryTasks)
return store.getters.galleryTasks
else
return null
})
let videoTasks = computed(() => {
if(store.getters.videoTasks)
return store.getters.videoTasks
else
return null
})
let isShowVideoHistory = computed(() => {
return store.getters.showType === "video"
})
let isShowGalleryHistory = computed(() => {
return store.getters.showType === "gallery"
})
let min = computed(() => {
return store.getters.min
})
@@ -130,12 +182,12 @@ export default {
function reverse(){
isEditing.value = !isEditing.value
if(isEditing){
input.value.focus()
inputNode.value.focus()
}
targetPage.value = page.value
}
function downloadGallery(link){
function downloadTask(link){
window.open(link)
}
@@ -143,28 +195,54 @@ export default {
store.dispatch("deleteGallery", gid)
}
function onlineReader(name){
function deleteVideo(id){
store.dispatch("deleteVideo", id)
}
function onlineGalleryReader(name){
window.open("http://100.42.234.138:8080/1/gallery/" + encodeURI(name))
}
function onlineVideoViewer(name){
window.open("http://100.42.234.138:8080/1/video/" + encodeURI(name + ".mp4"))
}
return {data,
function changeShowType(){
if(isShowVideoHistory.value){
store.commit("_setShowType", "gallery")
showType.value = "本子"
}
else{
store.commit("_setShowType", "video")
showType.value = "视频"
}
}
return {galleryTasks,
videoTasks,
min,
max,
targetPage,
loadComplete,
page,
isEditing,
input,
inputNode,
isShowVideoHistory,
isShowGalleryHistory,
showType,
reverse,
changePage,
changeShowType,
toMax,
toMin,
previous,
next,
downloadGallery,
downloadTask,
deleteGallery,
onlineReader,
deleteVideo,
onlineGalleryReader,
onlineVideoViewer,
store
}
}
@@ -181,7 +259,7 @@ export default {
}
.pageChanger{
position: absolute;
top:92vh;
top:90vh;
left: 150px;
}
.page{