fix:
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
// import { ref } from 'vue'
|
||||||
|
// import { copy } from '@/utils/string'
|
||||||
|
// const info = reactive({
|
||||||
|
// title: "关于本站",
|
||||||
|
// })
|
||||||
|
const feedBackUrl = import.meta.env.VITE_FEEDBACK_URL
|
||||||
|
//copy
|
||||||
|
// const copyRes = async (resStr: string) => {
|
||||||
|
// copy(resStr)
|
||||||
|
// }
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col mt-3 flex-1">
|
||||||
|
<div class="bg-white rounded-md p-5">
|
||||||
|
<br>
|
||||||
|
<p>本项目是一个开源工具站, 求星星</p>
|
||||||
|
<br>
|
||||||
|
<p>本项目开源地址:<el-link href="https://github.com/taoran1401/tools-web">https://github.com/taoran1401/tools-web</el-link></p>
|
||||||
|
<br>
|
||||||
|
<p class="font-bold">联系作者/问题反馈</p>
|
||||||
|
<br>
|
||||||
|
<p>反馈中心:<el-link :href="feedBackUrl">{{ feedBackUrl }}</el-link></p>
|
||||||
|
<br>
|
||||||
|
<p>邮箱:taoran0796@163.com</p>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,31 +1,100 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// import { ref } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
// import { copy } from '@/utils/string'
|
// import { useRouter } from "vue-router"
|
||||||
// const info = reactive({
|
import { useScanStore } from '@/store/modules/scan'
|
||||||
// title: "关于本站",
|
|
||||||
// })
|
// const router = useRouter()
|
||||||
const feedBackUrl = import.meta.env.VITE_FEEDBACK_URL
|
const scanStore = useScanStore()
|
||||||
//copy
|
|
||||||
// const copyRes = async (resStr: string) => {
|
//video html element
|
||||||
// copy(resStr)
|
const videoPlayerRef = ref()
|
||||||
|
|
||||||
|
//上一个
|
||||||
|
const playPreviousVideo = () => {
|
||||||
|
var data = scanStore.historyList[scanStore.historyList.length - 2];
|
||||||
|
videoPlayerRef.value.src = scanStore.sourceUrl + data.title;
|
||||||
|
// console.log(videoPlayerRef.value.src)
|
||||||
|
videoPlayerRef.value.load();
|
||||||
|
videoPlayerRef.value.play();
|
||||||
|
//记录当期播放
|
||||||
|
scanStore.setNowPlay(data)
|
||||||
|
// scanStore.setNowIndex(nextIndex)
|
||||||
|
//刷新页面
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
|
||||||
|
//下一个
|
||||||
|
const playNextVideo = () => {
|
||||||
|
let nextIndex = scanStore.getNowIndex() + 1;
|
||||||
|
if (scanStore.isRandPlay === false) {
|
||||||
|
//随机播放,并且不能和当前相同TODO
|
||||||
|
nextIndex = Math.floor(Math.random() * scanStore.videoList.length);
|
||||||
|
}
|
||||||
|
if (nextIndex < scanStore.videoList.length) {
|
||||||
|
var data = scanStore.videoList[nextIndex];
|
||||||
|
videoPlayerRef.value.src = scanStore.sourceUrl + data.title;
|
||||||
|
videoPlayerRef.value.load();
|
||||||
|
videoPlayerRef.value.play();
|
||||||
|
//记录当期播放
|
||||||
|
scanStore.setNowPlay(data)
|
||||||
|
scanStore.setNowIndex(nextIndex)
|
||||||
|
//刷新页面
|
||||||
|
window.location.reload()
|
||||||
|
} else {
|
||||||
|
alert('没有下一个了')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//能播放时触发
|
||||||
|
const canplay = () => {
|
||||||
|
//更新历史播放
|
||||||
|
//过滤重复信息
|
||||||
|
let nowPlay = scanStore.getNowPlay()
|
||||||
|
console.log(nowPlay.id)
|
||||||
|
scanStore.historyList = scanStore.historyList.filter(item => item.id != nowPlay.id)
|
||||||
|
scanStore.historyList.push(scanStore.getNowPlay())
|
||||||
|
localStorage.setItem('historyList', JSON.stringify(scanStore.historyList))
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据索引获取文件信息
|
||||||
|
// const getInfoByIndex = () => {
|
||||||
|
// return scanStore.videoList[Number(scanStore.nowIndex)];
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
//播放结束时触发
|
||||||
|
const ended = () => {
|
||||||
|
//自动播放下一个
|
||||||
|
playNextVideo()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
console.log(scanStore.getNowPlay())
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col mt-3 flex-1">
|
<div class="flex flex-col mt-3 flex-1">
|
||||||
<div class="bg-white rounded-md p-5">
|
<div class="ml-3">
|
||||||
<br>
|
<router-link to="/" class="mr-3">
|
||||||
<p>本项目是一个开源工具站, 求星星</p>
|
<el-button>首页</el-button>
|
||||||
<br>
|
</router-link>
|
||||||
<p>本项目开源地址:<el-link href="https://github.com/taoran1401/tools-web">https://github.com/taoran1401/tools-web</el-link></p>
|
<el-button @click="playPreviousVideo">上一个</el-button>
|
||||||
<br>
|
<el-button @click="playNextVideo">下一个</el-button>
|
||||||
<p class="font-bold">联系作者/问题反馈</p>
|
<div class="mt-3 mb-3">当前播放:{{ scanStore.getNowPlay().path }}</div>
|
||||||
<br>
|
<video
|
||||||
<p>反馈中心:<el-link :href="feedBackUrl">{{ feedBackUrl }}</el-link></p>
|
ref="videoPlayerRef"
|
||||||
<br>
|
:src="scanStore.sourceUrl + scanStore.getNowPlay().title" class="w-[850px] h-[500px]"
|
||||||
<p>邮箱:taoran0796@163.com</p>
|
:autoplay="false"
|
||||||
<br>
|
:playbackRate="scanStore.playbackRate"
|
||||||
|
@canplay="canplay"
|
||||||
|
@ended="ended"
|
||||||
|
controls>
|
||||||
|
您的浏览器不支持video
|
||||||
|
</video>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { onMounted,reactive, ref } from 'vue';
|
|||||||
import { useScanStore } from '@/store/modules/scan'
|
import { useScanStore } from '@/store/modules/scan'
|
||||||
// import { ElMessage } from 'element-plus'
|
// import { ElMessage } from 'element-plus'
|
||||||
import { Search } from '@element-plus/icons-vue';
|
import { Search } from '@element-plus/icons-vue';
|
||||||
// import { useRoute } from "vue-router"
|
import { useRouter } from "vue-router"
|
||||||
//store
|
//store
|
||||||
const scanStore = useScanStore()
|
const scanStore = useScanStore()
|
||||||
// const route = useRoute()
|
const router = useRouter()
|
||||||
// const getToolsCate = async () => {
|
// const getToolsCate = async () => {
|
||||||
// try {
|
// try {
|
||||||
// await toolsStore.getToolCate()
|
// await toolsStore.getToolCate()
|
||||||
@@ -18,8 +18,8 @@ const scanStore = useScanStore()
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const setTagsDialog = ref(false)
|
const setTagsDialog = ref(false)
|
||||||
// const checkedTags = reactive({})
|
// const checkedTags = reactive({})
|
||||||
//常见视频格式
|
//----- config -----
|
||||||
const extVideo = ref(['ts', 'mp4', 'mkv', 'wmv', 'avi', 'flv', '3gp', 'dvd', 'mov', 'vob', 'webm'])
|
//----- ^ -----
|
||||||
|
|
||||||
//获取分类
|
//获取分类
|
||||||
//查询参数
|
//查询参数
|
||||||
@@ -28,8 +28,9 @@ const searchParam = reactive({
|
|||||||
tags: '',
|
tags: '',
|
||||||
page: 1,
|
page: 1,
|
||||||
})
|
})
|
||||||
const getList = async () => {
|
const getList = async (query) => {
|
||||||
try {
|
try {
|
||||||
|
searchParam.title = query
|
||||||
await scanStore.getList(searchParam)
|
await scanStore.getList(searchParam)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@@ -97,15 +98,38 @@ const pageChange = async (nowPage: number) => {
|
|||||||
await scanStore.getList(searchParam)
|
await scanStore.getList(searchParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* open local app
|
||||||
|
*
|
||||||
|
* index: 索引
|
||||||
|
* data: 内容数据
|
||||||
|
*/
|
||||||
|
const open = (index: number, data: any) => {
|
||||||
|
//缓存当前播放和播放索引
|
||||||
|
scanStore.setNowPlay(data)
|
||||||
|
scanStore.setNowIndex(index)
|
||||||
|
router.push({
|
||||||
|
path: '/about',
|
||||||
|
})
|
||||||
|
|
||||||
|
// let addr = router.resolve({
|
||||||
|
// path: '/about',
|
||||||
|
// params: {
|
||||||
|
// url: url
|
||||||
|
// }
|
||||||
|
// }).href
|
||||||
|
// window.open(addr, '_blank')
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList('');
|
||||||
getTags();
|
getTags();
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="mt-3">
|
<div class="mt-3 flex items-center">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="searchParam.title"
|
v-model="searchParam.title"
|
||||||
filterable
|
filterable
|
||||||
@@ -128,6 +152,11 @@ onMounted(() => {
|
|||||||
>
|
>
|
||||||
</el-optiond>
|
</el-optiond>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<!-- <el-button>扫描目录</el-button> -->
|
||||||
|
<el-button>随机预览</el-button>
|
||||||
|
<div class='ml-3'>
|
||||||
|
<el-text>数量:111</el-text>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex w-full">
|
<div class="flex w-full">
|
||||||
@@ -138,8 +167,8 @@ onMounted(() => {
|
|||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<div>
|
<div>
|
||||||
<div v-if="extVideo.includes(item.ext)">
|
<div v-if="scanStore.extVideo.includes(item.ext)">
|
||||||
<video :src="item.path" controls></video>
|
<video :src="scanStore.sourceUrl + item.title" style="height:150px;width:270px;"></video>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<el-empty description="无预览" :image-size="100"/>
|
<el-empty description="无预览" :image-size="100"/>
|
||||||
@@ -163,10 +192,10 @@ onMounted(() => {
|
|||||||
|
|
||||||
<!-- right -->
|
<!-- right -->
|
||||||
<div class="flex flex-col justify-center">
|
<div class="flex flex-col justify-center">
|
||||||
<el-button size="small" type="primary" class="w-20">open</el-button>
|
<el-button size="small" type="primary" class="w-20" @click="open(index, item)">open</el-button>
|
||||||
<el-button size="small" type="primary" class="w-20 mt-2" style="margin-left: 0;" @click="setTagsDia(item.id)">set tags</el-button>
|
<el-button size="small" type="primary" class="w-20 mt-2" style="margin-left: 0;" @click="setTagsDia(item.id)">set tags</el-button>
|
||||||
<el-button size="small" type="primary" class="w-20 mt-2" style="margin-left: 0;" >move</el-button>
|
<!-- <el-button size="small" type="primary" class="w-20 mt-2" style="margin-left: 0;" >move</el-button> -->
|
||||||
<el-button size="small" type="primary" class="w-20 mt-2" style="margin-left: 0;">delete</el-button>
|
<!-- <el-button size="small" type="primary" class="w-20 mt-2" style="margin-left: 0;">delete</el-button> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
@@ -196,7 +225,7 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- set tags dialog -->
|
<!-- set tags dialog -->
|
||||||
<el-dialog v-model="setTagsDialog" title="set tags" width="800" @close="getList()">
|
<el-dialog v-model="setTagsDialog" title="set tags" width="800" @close="getList('')">
|
||||||
<!-- tags -->
|
<!-- tags -->
|
||||||
<div class="p-3 bg-white" v-for="(item, index) in scanStore.tags" :key="index">
|
<div class="p-3 bg-white" v-for="(item, index) in scanStore.tags" :key="index">
|
||||||
<div>{{ item.title }}</div>
|
<div>{{ item.title }}</div>
|
||||||
|
|||||||
@@ -9,7 +9,13 @@ export const useScanStore = defineStore('scan', {
|
|||||||
list: {} as ScanFilePage,
|
list: {} as ScanFilePage,
|
||||||
fileInfo: {} as ScanFileInfo, //当前文件信息
|
fileInfo: {} as ScanFileInfo, //当前文件信息
|
||||||
fileInfoTags: [] as number[], //当期文件tags
|
fileInfoTags: [] as number[], //当期文件tags
|
||||||
tags: [] as ScanTagInfo[]
|
tags: [] as ScanTagInfo[],
|
||||||
|
videoList: localStorage.getItem('videoList') !== null ? JSON.parse(localStorage.getItem('videoList') || '') : [], //播放列表,一般情况下同list
|
||||||
|
playbackRate: 1.5, //播放速度
|
||||||
|
isRandPlay: false, //是否随机播放
|
||||||
|
extVideo: ['ts', 'mp4', 'mkv', 'wmv', 'avi', 'flv', '3gp', 'dvd', 'mov', 'vob', 'webm'], //视频格式
|
||||||
|
sourceUrl: 'http://localhost:7881/', //资源服务地址
|
||||||
|
historyList: localStorage.getItem('historyList') !== null ? JSON.parse(localStorage.getItem('historyList') || '') : [], //历史播放
|
||||||
}),
|
}),
|
||||||
//方法
|
//方法
|
||||||
actions: {
|
actions: {
|
||||||
@@ -19,6 +25,8 @@ export const useScanStore = defineStore('scan', {
|
|||||||
const result: any = await getList(data)
|
const result: any = await getList(data)
|
||||||
if (result.code == 200) {
|
if (result.code == 200) {
|
||||||
this.list = result.data
|
this.list = result.data
|
||||||
|
localStorage.setItem('videoList', JSON.stringify(result.data.data))
|
||||||
|
console.log(localStorage.getItem('videoList'))
|
||||||
return result.message
|
return result.message
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(new Error(result.message))
|
return Promise.reject(new Error(result.message))
|
||||||
@@ -56,5 +64,31 @@ export const useScanStore = defineStore('scan', {
|
|||||||
return Promise.reject(new Error(result.message))
|
return Promise.reject(new Error(result.message))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
//设置播放列表
|
||||||
|
// setVideoList() {
|
||||||
|
|
||||||
|
// },
|
||||||
|
//设置播放速度
|
||||||
|
setPlaybackRate(number) {
|
||||||
|
this.playbackRate = number
|
||||||
|
},
|
||||||
|
//当期那播放信息、索引获取和设置
|
||||||
|
getNowPlay() {
|
||||||
|
return localStorage.getItem('nowPlay') !== null ? JSON.parse(localStorage.getItem('nowPlay') || '') : {};
|
||||||
|
},
|
||||||
|
getNowIndex() {
|
||||||
|
return localStorage.getItem('nowIndex') !== null ? JSON.parse(localStorage.getItem('nowIndex') || '') : 0;
|
||||||
|
},
|
||||||
|
setNowPlay(data) {
|
||||||
|
localStorage.setItem('nowPlay', JSON.stringify(data))
|
||||||
|
},
|
||||||
|
setNowIndex(index) {
|
||||||
|
localStorage.setItem('nowIndex', JSON.stringify(index))
|
||||||
|
},
|
||||||
|
//清除缓存
|
||||||
|
cleanCache() {
|
||||||
|
localStorage.removeItem('videoList');
|
||||||
|
localStorage.removeItem('historyList');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user