Jelajahi Sumber

feat: 添加pdf.js依赖,添加相关空白页面

ChenYangfan 6 tahun lalu
induk
melakukan
9d171e0c98

+ 3 - 0
.eslintrc.js

@@ -12,6 +12,9 @@ module.exports = {
   parserOptions: {
     parser: 'babel-eslint'
   },
+  globals: {
+    'pdfjs': true
+  },
   overrides: [
     {
       files: [

+ 0 - 10
doc/todos.md

@@ -1,10 +0,0 @@
-# 课堂助手编辑器逻辑细化
-
-- [ ] 上下箭头在位置在 range 发生改变的时候不更改默认操作,只有在按下上下键之后 range 仍然没有改变(说明在头部或者尾部)才触发更新焦点的事件
-- [ ]
-- [ ] 在可编辑项有类型的地方的开头退格,此时清除这个项的类型
-- [ ] 有序列表使用 div 进行模拟,序号操作由 js 进行控制
-- [ ] 加粗更改为使用不同的颜色字体进行表示
-- [ ] 在有序列表换行、在无序列表换行,下一个项应该是对应的有序或者无序列表
-- [ ] 在项的属性更改之后,需要重新设置焦点的元素,
-- [ ] 特殊的两个项:hr、和 ‘===’。hr 使用 div 进行模拟,‘===’不显示或者更改样式

+ 2 - 1
public/index.html

@@ -6,6 +6,7 @@
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width,initial-scale=1.0">
   <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+  <script src="https://cdn.bootcss.com/pdf.js/2.3.200/pdf.min.js"></script>
   <title>SEEC 课堂助手</title>
   <style>
     :root {
@@ -23,4 +24,4 @@
   <!-- built files will be auto injected -->
 </body>
 
-</html>
+</html>

+ 2 - 2
src/App.vue

@@ -5,9 +5,9 @@
 </template>
 
 <script>
-
 export default {
-  components: {}
+  components: {},
+  mounted () {}
 }
 </script>
 

+ 2 - 1
src/components/CButton.vue

@@ -24,12 +24,13 @@ button {
   -webkit-tap-highlight-color: transparent;
 
   display: block;
-  width: 120px;
+  min-width: 120px;
   height: 40px;
   background: $theme-blue;
   color: white;
   border-radius: 8px;
   font-size: 14px;
+  padding: 0 16px;
   font-weight: 600;
 
   &:hover {

+ 13 - 0
src/components/Pdf.vue

@@ -0,0 +1,13 @@
+<template>
+  <div>
+    pdf 阅读器
+  </div>
+</template>
+
+<script>
+export default {}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 4 - 0
src/router/index.js

@@ -64,6 +64,10 @@ const routes = [{
     name: 'student-personal',
     component: () => import('../views/student/tabs/StudentPersonal.vue')
   }]
+}, {
+  path: '/pdf-reader/:id',
+  name: 'pdf-reader',
+  component: () => import('../views/reader/PdfReader.vue')
 }]
 
 const router = new VueRouter({

+ 0 - 2
src/server/slide.js

@@ -31,7 +31,6 @@ export function createSlide (courseId, name) {
     state: 'DRAFT'
   }
   return axios.post(useSlideServer(), data).then(res => {
-    console.log(res.data)
     if (res.data.code === 200) {
       return res.data.data
     } else {
@@ -45,7 +44,6 @@ export function updateSlide (slideInfo, items) {
     ...slideInfo,
     items: items
   }
-  console.log(data)
   return axios.put(useSlideServer(), data).then(res => {
     if (res.data.code === 200) {
       return res.data.data

+ 17 - 0
src/views/reader/PdfReader.vue

@@ -0,0 +1,17 @@
+<template>
+  <div>
+    <pdf></pdf>
+  </div>
+</template>
+
+<script>
+import Pdf from '@/components/Pdf'
+
+export default {
+  components: { Pdf }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 1 - 1
src/views/teacher/tabs/CreateSlide.vue

@@ -89,7 +89,7 @@ select {
 }
 
 .select-wrapper, .c-input {
-  margin-bottom: 16px;
+  margin-bottom: 24px;
 }
 
 .my-button {

+ 10 - 1
src/views/teacher/tabs/TeacherExplore.vue

@@ -3,6 +3,8 @@
     <search-bar></search-bar>
     <section>
       <h1 class="sub-title">最近浏览</h1>
+      <c-button @click.native="push()">临时:PDF阅读器链接</c-button>
+      <br>
     </section>
     <section>
       <h1 class="sub-title">课程列表</h1>
@@ -12,8 +14,15 @@
 
 <script>
 import SearchBar from '@/components/SearchBar'
+import CButton from '@/components/CButton'
 export default {
-  components: { SearchBar }
+  components: { CButton, SearchBar },
+  methods: {
+    // todo 临时
+    push () {
+      this.$router.push('/pdf-reader/1')
+    }
+  }
 }
 </script>
 

+ 7 - 0
vue.config.js

@@ -0,0 +1,7 @@
+module.exports = {
+  configureWebpack: {
+    externals: {
+      'pdfjs': 'pdfjsLib'
+    }
+  }
+}