diff --git a/src/components/Home/About copy.vue b/src/components/Home/About copy.vue new file mode 100644 index 0000000..4354178 --- /dev/null +++ b/src/components/Home/About copy.vue @@ -0,0 +1,34 @@ + + + + + + + 本项目是一个开源工具站, 求星星 + + 本项目开源地址:https://github.com/taoran1401/tools-web + + 联系作者/问题反馈 + + 反馈中心:{{ feedBackUrl }} + + 邮箱:taoran0796@163.com + + + + + + \ No newline at end of file diff --git a/src/components/Home/About.vue b/src/components/Home/About.vue index 4354178..e66d6d1 100644 --- a/src/components/Home/About.vue +++ b/src/components/Home/About.vue @@ -1,31 +1,100 @@ - - - 本项目是一个开源工具站, 求星星 - - 本项目开源地址:https://github.com/taoran1401/tools-web - - 联系作者/问题反馈 - - 反馈中心:{{ feedBackUrl }} - - 邮箱:taoran0796@163.com - + + + 首页 + + 上一个 + 下一个 + 当前播放:{{ scanStore.getNowPlay().path }} + + 您的浏览器不支持video + + + diff --git a/src/components/Home/Home.vue b/src/components/Home/Home.vue index 97272d3..45436a1 100644 --- a/src/components/Home/Home.vue +++ b/src/components/Home/Home.vue @@ -3,10 +3,10 @@ import { onMounted,reactive, ref } from 'vue'; import { useScanStore } from '@/store/modules/scan' // import { ElMessage } from 'element-plus' import { Search } from '@element-plus/icons-vue'; -// import { useRoute } from "vue-router" +import { useRouter } from "vue-router" //store const scanStore = useScanStore() -// const route = useRoute() +const router = useRouter() // const getToolsCate = async () => { // try { // await toolsStore.getToolCate() @@ -18,8 +18,8 @@ const scanStore = useScanStore() const loading = ref(false) const setTagsDialog = ref(false) // const checkedTags = reactive({}) -//常见视频格式 -const extVideo = ref(['ts', 'mp4', 'mkv', 'wmv', 'avi', 'flv', '3gp', 'dvd', 'mov', 'vob', 'webm']) +//----- config ----- +//----- ^ ----- //获取分类 //查询参数 @@ -28,8 +28,9 @@ const searchParam = reactive({ tags: '', page: 1, }) -const getList = async () => { +const getList = async (query) => { try { + searchParam.title = query await scanStore.getList(searchParam) } catch (error) { console.log(error) @@ -97,15 +98,38 @@ const pageChange = async (nowPage: number) => { 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(() => { - getList(); + getList(''); getTags(); }) - + { > + + 随机预览 + + 数量:111 + @@ -138,8 +167,8 @@ onMounted(() => { - - + + @@ -163,10 +192,10 @@ onMounted(() => { - open + open set tags - move - delete + + @@ -196,7 +225,7 @@ onMounted(() => { - + {{ item.title }} diff --git a/src/store/modules/scan.ts b/src/store/modules/scan.ts index 5ed65c8..dd6ccb5 100644 --- a/src/store/modules/scan.ts +++ b/src/store/modules/scan.ts @@ -9,7 +9,13 @@ export const useScanStore = defineStore('scan', { list: {} as ScanFilePage, fileInfo: {} as ScanFileInfo, //当前文件信息 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: { @@ -19,6 +25,8 @@ export const useScanStore = defineStore('scan', { const result: any = await getList(data) if (result.code == 200) { this.list = result.data + localStorage.setItem('videoList', JSON.stringify(result.data.data)) + console.log(localStorage.getItem('videoList')) return result.message } else { return Promise.reject(new Error(result.message)) @@ -56,5 +64,31 @@ export const useScanStore = defineStore('scan', { 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'); + } } }) \ No newline at end of file
本项目是一个开源工具站, 求星星
本项目开源地址:https://github.com/taoran1401/tools-web
联系作者/问题反馈
反馈中心:{{ feedBackUrl }}
邮箱:taoran0796@163.com