From 2fec3ce73fb3b50f354bec83ea8db150d6b8c658 Mon Sep 17 00:00:00 2001 From: JayChou <2064936853@qq.com> Date: Mon, 12 Aug 2024 17:57:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=BE=E7=A8=8B=E8=B5=84?= =?UTF-8?q?=E6=BA=90=20=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 1 + package.json | 4 +- pnpm-lock.yaml | 104 ++++- src/Layout/index.vue | 39 +- src/api/course.ts | 39 +- src/main.ts | 2 + src/utils/filters.ts | 22 + .../course/components/courseTree copy.vue | 372 ++++++++++++++++ src/views/course/components/courseTree.vue | 403 ++---------------- src/views/course/index.vue | 174 +++++++- src/views/home/components/Graph.vue | 5 +- src/views/home/index.vue | 6 +- 12 files changed, 762 insertions(+), 409 deletions(-) create mode 100644 src/utils/filters.ts create mode 100644 src/views/course/components/courseTree copy.vue diff --git a/index.html b/index.html index 3d28fea..7414bf0 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,7 @@
+ diff --git a/package.json b/package.json index a2df517..855f00d 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@antv/g6": "3.8.3", "@element-plus/icons-vue": "^2.3.1", "axios": "^1.6.8", + "docx-preview": "^0.3.2", "echarts": "^5.5.0", "echarts-liquidfill": "^3.1.0", "element-plus": "^2.6.2", @@ -30,7 +31,8 @@ "px2rem-loader": "^0.1.9", "three": "^0.163.0", "vue": "^3.4.21", - "vue-router": "^4.3.0" + "vue-router": "^4.3.0", + "vue3-pdfjs": "^0.1.6" }, "devDependencies": { "@babel/eslint-parser": "^7.24.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 523a786..e735bfe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,6 +13,9 @@ dependencies: axios: specifier: ^1.6.8 version: 1.6.8 + docx-preview: + specifier: ^0.3.2 + version: 0.3.2 echarts: specifier: ^5.5.0 version: 5.5.0 @@ -46,6 +49,9 @@ dependencies: vue-router: specifier: ^4.3.0 version: 4.3.0(vue@3.4.21) + vue3-pdfjs: + specifier: ^0.1.6 + version: 0.1.6(typescript@5.2.2) devDependencies: '@babel/eslint-parser': @@ -1831,6 +1837,10 @@ packages: engines: {node: '>=0.10.0'} dev: true + /core-util-is@1.0.3: + resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} + dev: false + /cors@2.8.5: resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==} engines: {node: '>= 0.10'} @@ -2205,6 +2215,12 @@ packages: esutils: 2.0.3 dev: true + /docx-preview@0.3.2: + resolution: {integrity: sha512-YRsyiiejdauCQ2boKNHKjJMiIhOCXs643+NCHnmbCM31e7JWqmPiobtzlmHOnv4i+ft9w+ajPEK1hK7VymyRXQ==} + dependencies: + jszip: 3.10.1 + dev: false + /dom-serializer@0.2.2: resolution: {integrity: sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==} dependencies: @@ -2256,6 +2272,11 @@ packages: domelementtype: 2.3.0 dev: true + /dommatrix@1.0.3: + resolution: {integrity: sha512-l32Xp/TLgWb8ReqbVJAFIvXmY7go4nTxxlWiAFyhoQw9RKEOHBZNnyGvJWqDVSPmq3Y9HlM4npqF/T6VMOXhww==} + deprecated: dommatrix is no longer maintained. Please use @thednp/dommatrix. + dev: false + /domutils@1.7.0: resolution: {integrity: sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==} dependencies: @@ -3282,6 +3303,10 @@ packages: hasBin: true dev: true + /immediate@3.0.6: + resolution: {integrity: sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==} + dev: false + /immutable@4.3.5: resolution: {integrity: sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw==} dev: true @@ -3560,7 +3585,6 @@ packages: /isarray@1.0.0: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} - dev: true /isarray@2.0.5: resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} @@ -3652,6 +3676,15 @@ packages: graceful-fs: 4.2.11 dev: true + /jszip@3.10.1: + resolution: {integrity: sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==} + dependencies: + lie: 3.3.0 + pako: 1.0.11 + readable-stream: 2.3.8 + setimmediate: 1.0.5 + dev: false + /kapsule@1.14.5: resolution: {integrity: sha512-H0iSpTynUzZw3tgraDmReprpFRmH5oP5GPmaNsurSwLx2H5iCpOMIkp5q+sfhB4Tz/UJd1E1IbEE9Z6ksnJ6RA==} engines: {node: '>=12'} @@ -3709,6 +3742,12 @@ packages: resolution: {integrity: sha512-9yowMWA70tKhKdCJDaltY0mNQG4OWo7pWKScnTp9aiSxS7s20ZYlwBRE3335nweOf5qKXVC7sDxJwMPM8/MFZg==} dev: false + /lie@3.3.0: + resolution: {integrity: sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==} + dependencies: + immediate: 3.0.6 + dev: false + /lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} dev: true @@ -4110,6 +4149,10 @@ packages: p-limit: 3.1.0 dev: true + /pako@1.0.11: + resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==} + dev: false + /parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -4163,6 +4206,18 @@ packages: resolution: {integrity: sha512-sTitTPYnn23esFR3RlqYBWn4c45WGeLcsKzQiUpXJAyfcWkolvlYpV8FLo7JishK946oQwMFUCHXQ9AjGPKExw==} dev: true + /pdfjs-dist@2.16.105: + resolution: {integrity: sha512-J4dn41spsAwUxCpEoVf6GVoz908IAA3mYiLmNxg8J9kfRXc2jxpbUepcP0ocp0alVNLFthTAM8DZ1RaHh8sU0A==} + peerDependencies: + worker-loader: ^3.0.8 + peerDependenciesMeta: + worker-loader: + optional: true + dependencies: + dommatrix: 1.0.3 + web-streams-polyfill: 3.3.3 + dev: false + /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} @@ -4355,6 +4410,10 @@ packages: hasBin: true dev: true + /process-nextick-args@2.0.1: + resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} + dev: false + /proxy-from-env@1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} dev: false @@ -4394,6 +4453,18 @@ packages: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true + /readable-stream@2.3.8: + resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} + dependencies: + core-util-is: 1.0.3 + inherits: 2.0.4 + isarray: 1.0.0 + process-nextick-args: 2.0.1 + safe-buffer: 5.1.2 + string_decoder: 1.1.1 + util-deprecate: 1.0.2 + dev: false + /readable-stream@3.6.2: resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} engines: {node: '>= 6'} @@ -4538,6 +4609,10 @@ packages: isarray: 2.0.5 dev: true + /safe-buffer@5.1.2: + resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} + dev: false + /safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} dev: true @@ -4637,6 +4712,10 @@ packages: split-string: 3.1.0 dev: true + /setimmediate@1.0.5: + resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==} + dev: false + /shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -4797,6 +4876,12 @@ packages: es-object-atoms: 1.0.0 dev: true + /string_decoder@1.1.1: + resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} + dependencies: + safe-buffer: 5.1.2 + dev: false + /string_decoder@1.3.0: resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} dependencies: @@ -5363,7 +5448,6 @@ packages: /util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - dev: true /vary@1.1.2: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} @@ -5486,6 +5570,17 @@ packages: typescript: 5.2.2 dev: true + /vue3-pdfjs@0.1.6(typescript@5.2.2): + resolution: {integrity: sha512-7UaWbsp8wNqB0y/rRlyo5yRb0S+XOkkSpmdUuS267Dhi07Pt4RFEetQ8inrpf/aTFJwGnW0Uc/UE4p376s+Zmw==} + engines: {node: '>=10.0.0'} + dependencies: + pdfjs-dist: 2.16.105 + vue: 3.4.21(typescript@5.2.2) + transitivePeerDependencies: + - typescript + - worker-loader + dev: false + /vue@3.4.21(typescript@5.2.2): resolution: {integrity: sha512-5hjyV/jLEIKD/jYl4cavMcnzKwjMKohureP8ejn3hhEjwhWIhWeuzL2kJAjzl/WyVsgPY56Sy4Z40C3lVshxXA==} peerDependencies: @@ -5501,6 +5596,11 @@ packages: '@vue/shared': 3.4.21 typescript: 5.2.2 + /web-streams-polyfill@3.3.3: + resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} + engines: {node: '>= 8'} + dev: false + /which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} dependencies: diff --git a/src/Layout/index.vue b/src/Layout/index.vue index cd260ca..4b04564 100644 --- a/src/Layout/index.vue +++ b/src/Layout/index.vue @@ -43,20 +43,33 @@ const scrollToTop = () => { // flog.value = true } const scrollTop = () => { - var currentPosition = window.pageYOffset - - if (currentPosition > 0) { - window.scrollTo(0, currentPosition - 40) - requestAnimationFrame(scrollTop) - } else { - totop.value.style.display = 'none' - num = 800 - flog.value = false - show.value = false + window.scrollTo({ + top: 0, + left: 0, + behavior: 'smooth', + }); setTimeout(() => { - show.value = true - }, 0) - } + show.value = false + },1500); + setTimeout(() => { + show.value = true + flog.value = false + num = 800 + },1600); + // var currentPosition = window.pageYOffset + + // if (currentPosition > 0) { + // window.scrollTo(0, currentPosition - 40) + // requestAnimationFrame(scrollTop) + // } else { + // totop.value.style.display = 'none' + // num = 800 + // flog.value = false + // show.value = false + // setTimeout(() => { + // show.value = true + // }, 0) + // } } let num = 800 onMounted(() => { diff --git a/src/api/course.ts b/src/api/course.ts index fa0491d..a1b7708 100644 --- a/src/api/course.ts +++ b/src/api/course.ts @@ -1,17 +1,44 @@ -import request from '@/utils/requset' +import request from '@/utils/requset' // 获取课程列表 -export const getCourseList = (params:object) => { +export const getCourseList = (params: object) => { + return request({ + url: '/api/coursesteacher/page', + params, + }) +} +// 获取课程图谱 +export const getCourseAtlas = (params: object) => { + return request({ + url: '/knowNeo/getAllKnowByCourseId', + params, + }) +} +// 获取课程简介 +// export const getCourseDescription = (params:any) => { +// return request({ +// url:'' +// }) +// } +export const getCourseChapter = (params: any) => { + return request({ + url: '/chapter2/chapter', + params, + }) +} + +// 获取所有课程资源 +export const getCourseFiles = (params:any) => { return request({ - url:'/api/coursesteacher/page', + url:'/resource/queryByCourseId', params }) } -// 获取课程图谱 -export const getCourseAtlas = (params:object) => { +// 获取文件流 +export const getFileStreams = (params:any) => { return request({ - url:'/know/all', + url:'/resource/read', params }) } \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index eeb9d41..d872faa 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,12 +19,14 @@ import './permissions' // 引入仓库 import pinia from '@/store/index' import '@/utils/rem.js' +import VuePdf from 'vue3-pdfjs' // 创建vue实例 const app = createApp(App) // 注册element plus组件库 app.use(ElementPlus, { locale: zhCn, }) +app.use(VuePdf) // 注册全局组件 app.use(gloablComponent) app.use(router) diff --git a/src/utils/filters.ts b/src/utils/filters.ts new file mode 100644 index 0000000..4d0d988 --- /dev/null +++ b/src/utils/filters.ts @@ -0,0 +1,22 @@ +// 筛选文件类型 +export const filterFilesType = (arr:[]) :{} => { + const res:any = { + video:[], + PPT:[], + questions:[], + word:[], + other:[] + } + arr.forEach((item:any) => { + if(item.type === 19){ + res.video.push(item) + }else if(item.type === 6){ + res.PPT.push(item) + }else if(item.type === 7 || item.type === 5){ + res.word.push(item) + }else{ + res.other.push(item) + } + }) + return res +} diff --git a/src/views/course/components/courseTree copy.vue b/src/views/course/components/courseTree copy.vue new file mode 100644 index 0000000..36b16ac --- /dev/null +++ b/src/views/course/components/courseTree copy.vue @@ -0,0 +1,372 @@ + +