fix default playSource and update upload manage

This commit is contained in:
mubai
2024-01-04 00:47:29 +08:00
parent 615cdf6d02
commit 31955638a5
34 changed files with 504 additions and 318 deletions

View File

@@ -59,7 +59,7 @@
</p>
</div>
<p>
<el-button type="warning" class="player" size="large" @click="play({episode:0,source:0})" round>
<el-button type="warning" class="player" size="large" @click="play({episode:0,source:data.detail.list[0].id})" round>
<el-icon>
<CaretRight/>
</el-icon>
@@ -155,6 +155,32 @@ const handleLongText = (t: string): string => {
return res.trimEnd()
}
// 播放源切换
const changeTab = (id:string)=>{
data.currentTabId = id
}
// 选集播放点击事件
const play = (change: { source: string, episode: number }) => {
router.push({path: `/play`, query: {id: `${router.currentRoute.value.query.link}`, ...change}})
}
// 内容展开收起效果
const multiBtn = ref({state: false, text: '展开'})
const textContent = ref()
const showContent = (flag: boolean) => {
if (flag) {
multiBtn.value = {state: !flag, text: '展开'}
textContent.value.style.webkitLineClamp = 2
return
}
multiBtn.value = {state: !flag, text: '收起'}
textContent.value.style.webkitLineClamp = 8
}
// 页面加载数据初始化
onBeforeMount(() => {
let link = router.currentRoute.value.query.link
ApiGet('/filmDetail', {id: link}).then((resp: any) => {
@@ -179,29 +205,6 @@ onBeforeMount(() => {
})
})
// 播放源切换
const changeTab = (id:string)=>{
data.currentTabId = id
}
// 选集播放点击事件
const play = (change: { source: string, episode: number }) => {
router.push({path: `/play`, query: {id: `${router.currentRoute.value.query.link}`, ...change}})
}
// 内容展开收起效果
const multiBtn = ref({state: false, text: '展开'})
const textContent = ref()
const showContent = (flag: boolean) => {
if (flag) {
multiBtn.value = {state: !flag, text: '展开'}
textContent.value.style.webkitLineClamp = 2
return
}
multiBtn.value = {state: !flag, text: '收起'}
textContent.value.style.webkitLineClamp = 8
}
</script>

View File

@@ -126,7 +126,6 @@ const data = reactive({
list: [],
},
current: {index: 0, episode: '', link: ''},
currentTabName: '',
currentEpisode: 0,
relate: [],
currentTabId: '', // 当前播放源ID
@@ -152,27 +151,7 @@ const hasNext = computed(() => {
// 获取路由信息
const router = useRouter()
onBeforeMount(() => {
let query = router.currentRoute.value.query
ApiGet(`/filmPlayInfo`, {id: query.id, playFrom: query.source, episode: query.episode}).then((resp: any) => {
if (resp.code === 0) {
data.detail = resp.data.detail
data.current = {index: resp.data.currentEpisode, ...resp.data.current}
// data.currentPlayFrom = resp.data.currentPlayFrom
data.currentEpisode = resp.data.currentEpisode
data.relate = resp.data.relate
// 设置当前选中的播放源
data.currentTabName = `tab-${query.source}`
// 设置当前的视频播放url
data.options.src = data.current.link
// 设置当前播放源ID信息
data.currentTabId = resp.data.currentPlayFrom
data.loading = true
} else {
ElMessage.error({message: resp.msg})
}
})
})
// 点击播集数播放对应影片
const playChange = (play: { sourceId: string, episodeIndex: number, target: any }) => {
@@ -278,6 +257,27 @@ const saveFilmHisroy = ()=>{
// 在浏览器关闭前或页面刷新前将当前影片的观看信息存入历史记录中
window.addEventListener('beforeunload',saveFilmHisroy)
// 初始化页面数据
onBeforeMount(() => {
let query = router.currentRoute.value.query
ApiGet(`/filmPlayInfo`, {id: query.id, playFrom: query.source, episode: query.episode}).then((resp: any) => {
if (resp.code === 0) {
data.detail = resp.data.detail
data.current = {index: resp.data.currentEpisode, ...resp.data.current}
// data.currentPlayFrom = resp.data.currentPlayFrom
data.currentEpisode = resp.data.currentEpisode
data.relate = resp.data.relate
// 设置当前的视频播放url
data.options.src = data.current.link
// 设置当前播放源ID信息
data.currentTabId = resp.data.currentPlayFrom
data.loading = true
} else {
ElMessage.error({message: resp.msg})
}
})
})
</script>
<style scoped>

View File

@@ -80,7 +80,7 @@
</el-form-item>
<el-form-item label="间隔时长">
<el-tooltip class="box-item" effect="dark" content="单次采集请求的时间间隔, 单位/ms" placement="top">
<el-input-number v-model="form.add.interval" :step="100" step-strictly />
<el-input-number v-model="form.add.interval" :min="0" :step="100" step-strictly />
</el-tooltip>
</el-form-item>
<el-form-item label="接口类型">
@@ -131,7 +131,7 @@
</el-form-item>
<el-form-item label="间隔时长">
<el-tooltip class="box-item" effect="dark" content="单次采集请求的时间间隔, 单位/ms" placement="top">
<el-input-number v-model="form.edit.interval" :step="100" step-strictly />
<el-input-number v-model="form.edit.interval" :min="0" :step="100" step-strictly />
</el-tooltip>
</el-form-item>
<el-form-item label="接口类型">

View File

@@ -1,41 +1,34 @@
<template>
<div class="container">
<div class="title_container">
<h3>文件上传</h3>
</div>
<!-- <div class="title_container">
<h3>海报墙预览</h3>
</div>-->
<div class="content">
<el-upload v-model:file-list="data.photoWall" action="#" list-type="picture-card"
:on-remove="handleRemove" :http-request="customUpload">
<template #file="{ file }">
<div>
<el-image class="el-upload-list__item-thumbnail" :src="file.link" fit="cover" />
<el-image class="el-upload-list__item-thumbnail" style="width: 100%;height: 100%" :src="file.link" fit="cover" />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
<el-icon><zoom-in /></el-icon>
</span>
<span class="el-upload-list__item-delete">
<span class="el-upload-list__item-delete" v-if="false">
<el-icon><Download /></el-icon>
</span>
<span class="el-upload-list__item-delete">
<span class="el-upload-list__item-delete" @click="delImage(file)" >
<el-icon><Delete /></el-icon>
</span>
</span>
</div>
</template>
<el-icon><Plus /></el-icon>
</el-upload>
<el-upload v-if="false" class="upload-demo" drag action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15" multiple>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">
删除文件 <em>点击上传</em>
</div>
<template #tip>
<div class="el-upload__tip">
jpg/png files with a size less than 500kb
</div>
</template>
</el-upload>
<div class="pagination">
<el-pagination background layout="prev, pager, next"
:total="data.page.total" v-model:page-size="data.page.pageSize"
v-model:current-page="data.page.current"
@change="getPhotoPage" hide-on-single-page/>
</div>
</div>
</div>
</template>
@@ -52,6 +45,7 @@ import {Preview} from "../../../components/Global/preview";
const data = reactive({
photoWall: [],
page: {current:1, pageSize: 39, pageNumber: 0, total: 0},
imgList:[""]
})
const customUpload = (options:any)=>{
@@ -70,10 +64,12 @@ const customUpload = (options:any)=>{
})
}
// 分页数据获取
const getPhotoPage = ()=>{
ApiGet(`/manage/file/list`, ).then((resp: any) => {
ApiGet(`/manage/file/list`, {current: data.page.current} ).then((resp: any) => {
if (resp.code === 0) {
data.photoWall = resp.data
data.photoWall = resp.data.list
data.page = resp.data.page
} else {
ElMessage.error({message: resp.msg})
}
@@ -83,11 +79,18 @@ const getPhotoPage = ()=>{
onMounted(()=>{
getPhotoPage()
})
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
console.log(uploadFile, uploadFiles)
const delImage = (file:any)=>{
ApiGet(`/manage/file/del`, {id: file.ID} ).then((resp: any) => {
if (resp.code === 0) {
getPhotoPage()
ElMessage.success({message: resp.msg})
} else {
ElMessage.error({message: resp.msg})
}
})
}
// const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
// 图片放大预览
const handlePictureCardPreview = (currentFile:any) => {
let list = data.photoWall.map((item:any)=>{
return item.link
@@ -101,7 +104,31 @@ const handlePictureCardPreview = (currentFile:any) => {
background: var(--bg-light);
}
.content {
display: flex;
justify-content: start;
width: 100%;
padding: 10px 0;
}
.title_container {
margin: 10px 0 10px 0;
}
:deep(.el-upload-list--picture-card ) {
padding: 10px 10px;
}
:deep(.el-upload-list__item ) {
margin: 10px auto!important;
}
:deep(.el-upload--picture-card){
margin: 10px auto;
}
.pagination {
padding: 20px 0;
text-align: center;
}
:deep(.el-pagination) {
width: 100% !important;
justify-content: center;
--el-color-primary: var(--paging-parmary-color);
}
</style>

View File

@@ -265,7 +265,6 @@ onMounted(() => {
max-width: 100%;
text-align: center;
padding-right: 50px;
}
:deep(.el-pagination) {
@@ -274,11 +273,6 @@ onMounted(() => {
--el-color-primary: var(--paging-parmary-color);
}
:deep(.el-select-dropdown__item) {
--el-color-primary: red !important;
}
:deep(.el-pager li) {
--el-pagination-button-bg-color: var(--btn-bg-linght);
border: 1px solid var(--border-gray-color);