From c7b5f048d9f1035c6f2e712ea989c85fbba44c5d Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Tue, 9 Jan 2024 15:40:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E5=AE=9E=E7=8E=B0=E7=99=BB=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E8=A7=86=E9=A2=91=E6=95=B0=E6=8D=AE=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=EF=BC=8C=E5=BE=85=E5=AE=8C=E6=88=90=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=92=AD=E6=94=BE=EF=BC=8C=E6=95=B0=E6=8D=AE=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E4=BC=A0=E5=8F=82route?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 6 ++++ package.json | 1 + src/main.js | 6 +++- src/router/index.js | 6 ++++ src/utils/global.js | 11 ++++++- src/views/Login.vue | 14 +++++--- src/views/Video.vue | 68 +++++++++++++++++++++------------------ src/views/VideoList.vue | 56 ++++++++++++++++++++++++-------- src/views/VideoPlayer.vue | 36 +++++++++++++++++++++ 9 files changed, 153 insertions(+), 51 deletions(-) create mode 100644 src/views/VideoPlayer.vue diff --git a/package-lock.json b/package-lock.json index 3edfdc3..53ad2b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "element-plus": "^2.4.4", "video.js": "^8.9.0", "vue": "^3.3.11", + "vue-cookies": "^1.8.3", "vue-router": "^4.2.5" }, "devDependencies": { @@ -1518,6 +1519,11 @@ } } }, + "node_modules/vue-cookies": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/vue-cookies/-/vue-cookies-1.8.3.tgz", + "integrity": "sha512-VBRsyRMVdahBgFfh389TMHPmDdr4URDJNMk4FKSCfuNITs7+jitBDhwyL4RJd3WUsfOYNNjPAkfbehyH9AFuoA==" + }, "node_modules/vue-router": { "version": "4.2.5", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.2.5.tgz", diff --git a/package.json b/package.json index 9331349..1797267 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "element-plus": "^2.4.4", "video.js": "^8.9.0", "vue": "^3.3.11", + "vue-cookies": "^1.8.3", "vue-router": "^4.2.5" }, "devDependencies": { diff --git a/src/main.js b/src/main.js index ba6544e..f5d0df4 100644 --- a/src/main.js +++ b/src/main.js @@ -5,7 +5,11 @@ import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' import App from './App.vue' import router from '@/router' +import globalData from '@/utils/global.js' -createApp(App).use(router).use(ElementPlus).mount('#app') + +const app=createApp(App); +app.provide('globalData',globalData); +app.use(router).use(ElementPlus).mount('#app'); diff --git a/src/router/index.js b/src/router/index.js index aeb904a..700c386 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -13,6 +13,12 @@ const routes = [ { path: '/video', name: 'Video', + meta:{ + name:'', + id:0, + userid:0, + token:"", + }, component: VideoVue }, { diff --git a/src/utils/global.js b/src/utils/global.js index 2bcc2b7..272e9f5 100644 --- a/src/utils/global.js +++ b/src/utils/global.js @@ -4,4 +4,13 @@ const token = ref(""); // 定义一个响应式全局变量 const userId=ref(1); const videoId=ref(1); const videoName=ref(""); -export default token; // 导出全局变量 \ No newline at end of file +const globalData=ref({ + token:"", + userId:0, + videoId:0, + videoName:"", +}) +const updateLocation = (data) => { + globalData.token = data.token; + } +export default globalData; \ No newline at end of file diff --git a/src/views/Login.vue b/src/views/Login.vue index 179461e..3cbe86d 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -88,14 +88,16 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/views/VideoList.vue b/src/views/VideoList.vue index fba08e8..f70a34a 100644 --- a/src/views/VideoList.vue +++ b/src/views/VideoList.vue @@ -1,17 +1,25 @@ @@ -89,16 +111,16 @@ export default { - + - -