Explorar o código

修改bookview2跳转方式

秦鹏 %!s(int64=3) %!d(string=hai) anos
pai
achega
35df7a2a07
Modificáronse 3 ficheiros con 46 adicións e 6 borrados
  1. 1 1
      src/permission.js
  2. 21 3
      src/views/BookView2.vue
  3. 24 2
      src/views/courseView.vue

+ 1 - 1
src/permission.js

@@ -8,7 +8,7 @@ import getPageTitle from '@/utils/get-page-title'
 
 NProgress.configure({ showSpinner: false }) // NProgress Configuration
 
-const whiteList = ['/login', '/npcBookView'] // no redirect whitelist
+const whiteList = ['/login', '/BookBrowsing'] // no redirect whitelist
 
 router.beforeEach(async(to, from, next) => {
     // start progress bar

+ 21 - 3
src/views/BookView2.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="bookView2" v-loading="loading">
-    <div>
+    <!-- <div>
       <el-button @click="goperview('book1')">新实用汉语课本1</el-button>
     </div>
     <div>
@@ -8,7 +8,7 @@
     </div>
     <div>
       <el-button @click="goperview('book3')">HSK标准教程1</el-button>
-    </div>
+    </div> -->
     <!-- <div>
       <el-button @click="goperview('book4')">新实用汉语</el-button>
     </div> -->
@@ -88,7 +88,25 @@ export default {
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+    this.loading = true;
+    let codeName = "login_control-CreateTempAccessCode";
+    let access_code = null;
+    let id = this.$route.query.bookId
+    getStaticContent(codeName, {}).then((res) => {
+      access_code = res.access_code;
+      let Mname = "login_control-GetLoginInfoByAccessCode";
+      getStaticContent(Mname, {
+        access_code: access_code,
+      }).then((res) => {
+        this.loading = false;
+        setToken(res);
+        this.$router.push(
+          `/courseview?bookId=${id}&type=preview`
+        );
+      });
+    });
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   //生命周期-创建之前

+ 24 - 2
src/views/courseView.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="container">
-    <template v-if="!name">
+    <template v-if="!type">
       <Header />
       <Nav nav-value="书籍预览" />
     </template>
@@ -123,6 +123,24 @@ export default {
       type: "",
       name: "",
       loading: false,
+      bookName: [
+        {
+          name: "新实用汉语课本1",
+          id: "002-20211006-10-NHVOMDLDRY",
+        },
+        {
+          name: "发展汉语初级综合(Ⅰ)",
+          id: "002-20211007-06-4DGL2ZRIB5",
+        },
+        {
+          name: "HSK标准教程1",
+          id: "002-20211007-14-UNYIWU8EKW",
+        },
+        {
+          name: "新实用汉语",
+          id: "003-20210908-10-1ZWNGSASZL",
+        },
+      ],
     };
   },
   created() {
@@ -130,7 +148,11 @@ export default {
     _this.bookId = this.$route.query.bookId;
 
     _this.type = this.$route.query.type;
-    _this.name = this.$route.query.name;
+    _this.bookName.forEach((item) => {
+      if (item.id == _this.bookId) {
+        _this.name = item.name;
+      }
+    });
   },
   methods: {
     back() {