Explorar el Código

字词卡片集成

natasha hace 1 año
padre
commit
0eb467a4f5

+ 2 - 2
src/permission.js

@@ -18,11 +18,11 @@ router.beforeEach(async (to, from, next) => {
   //next();
   NProgress.done()
   const hasToken = getToken()
-  if (hasToken || to.path === '/Integration/TextAnalyser' || to.path === '/Integration/Corpus') {
+  if (hasToken || to.path === '/Integration/TextAnalyser' || to.path === '/Integration/Corpus' || to.path==='/Integration/WordCard') {
     //=======重点部分以下=======
 
     let config = getConfig();
-    if (config || to.path === '/Integration/TextAnalyser' || to.path === '/Integration/Corpus') {
+    if (config || to.path === '/Integration/TextAnalyser' || to.path === '/Integration/Corpus' || to.path==='/Integration/WordCard') {
       if (to.path === '/login') {
         // if is logged in, redirect to the home page
         next({ path: '/EnterSys' })

+ 5 - 0
src/router/index.js

@@ -128,6 +128,11 @@ const routes = [{
             import ('@/views/corpus/Result'),
     },
     {
+        path: '/Integration/WordCard',
+        component: () =>
+            import ('@/views/wordcard/table'),
+    },
+    {
         path: '/wordcard/table',
         component: () =>
             import ('@/views/wordcard/table'),

+ 32 - 24
src/views/wordcard/cread.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="cread" v-loading="loading">
-    <Header :projectShow="true" />
+    <Header :projectShow="true" v-if="!userID" />
     <div class="main" v-if="!isPreview">
       <div class="from">
         <div class="type">
@@ -141,7 +141,7 @@
         </div>
       </div>
     </div>
-    <div class="preview_dv" v-if="isPreview">
+    <div class="preview_dv" v-if="isPreview" :style="{ top: userID ? '0' : '' }">
       <img class="close" src="../../assets/teacherdev/creadCad-close.png" alt="" @click="closepreviewEvent" />
       <div class="preview_main">
         <img
@@ -230,6 +230,7 @@ export default {
       saveShow: false,
       writetableShow: true,
       hzDetailList: null,
+      userID: this.$route.query.userID ? this.$route.query.userID : '',
     };
   },
   //计算属性 类似于data概念
@@ -280,12 +281,14 @@ export default {
           type: this.typeIndex == 0 ? 'WORD' : 'SENTENCE',
           text: this.from.content,
           content: JSON.stringify(this.writeTableData),
+          app_user_id: this.userID,
         })
           .then((res) => {
             this.$router.replace({
               path: '/wordcard/cread',
               query: {
                 id: res.id,
+                userID: this.userID,
               },
             });
             this.loading.close();
@@ -373,7 +376,12 @@ export default {
         if (this.writeTableData) {
           let str = JSON.stringify(this.writeTableData);
           localStorage.setItem('writeTableData', str);
-          this.$router.replace('/wordcard/print');
+          this.$router.replace({
+            path: '/wordcard/print',
+            query: {
+              userID: this.userID,
+            },
+          });
         }
       });
 
@@ -617,27 +625,27 @@ export default {
               audio_file_obj[item.con] = res.file_id;
             }
           });
-          // let data = {
-          //   query: item.con,
-          // };
-          // getHZChineseInfo(data).then((res) => {
-          //   let dataDetail = res.data.result;
-          //   if (dataDetail && dataDetail.length > 0) {
-          //     dataDetail.forEach((item) => {
-          //       if (item.request.queryType == 'entity') {
-          //         // 读音
-          //         item.response.entity.forEach((items) => {
-          //           items.attrs.forEach((itemss) => {
-          //             if (itemss.key == 'pronunciation') {
-          //               // 音频
-          //               audio_file_obj[item.con] = itemss.objects[0]['@value'] ? itemss.objects[0]['@value'] : '';
-          //             }
-          //           });
-          //         });
-          //       }
-          //     });
-          //   }
-          // });
+          let data = {
+            query: item.con,
+          };
+          getHZChineseInfo(data).then((res) => {
+            let dataDetail = res.data.result;
+            if (dataDetail && dataDetail.length > 0) {
+              dataDetail.forEach((item) => {
+                if (item.request.queryType == 'entity') {
+                  // 读音
+                  item.response.entity.forEach((items) => {
+                    items.attrs.forEach((itemss) => {
+                      if (itemss.key == 'pronunciation') {
+                        // 音频
+                        audio_file_obj[item.con] = itemss.objects[0]['@value'] ? itemss.objects[0]['@value'] : '';
+                      }
+                    });
+                  });
+                }
+              });
+            }
+          });
         });
 
         data.option.forEach((item) => {

+ 2 - 1
src/views/wordcard/print.vue

@@ -236,6 +236,7 @@ export default {
       activeColIndex: null,
       dataConfig: null,
       loading: false,
+      userID: this.$route.query.userID ? this.$route.query.userID : '',
     };
   },
   //计算属性 类似于data概念
@@ -254,7 +255,7 @@ export default {
       });
       this.$router.replace({
         path: '/wordcard/cread',
-        query: { cachesType: 'push' },
+        query: { cachesType: 'push', userID: this.userID },
       });
       return false;
     },

+ 26 - 5
src/views/wordcard/table.vue

@@ -1,7 +1,7 @@
 <template>
   <div v-loading="loading" class="cred_table">
-    <Header />
-    <div class="main">
+    <Header v-if="!userID" />
+    <div class="main" v-if="showPage">
       <div>
         <div class="title">字词练习卡</div>
         <div class="number_cread">
@@ -26,6 +26,7 @@
                   query: {
                     id: item.id,
                     cachesType: 'pop',
+                    userID: userID,
                   },
                 })
               "
@@ -66,7 +67,9 @@
 // 这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
 // 例如:import 《组件名称》from ‘《组件路径》';
 import Header from '@/components/Header';
-import { LearnWebSI } from '@/api/api';
+import { LearnWebSI, getStaticContent } from '@/api/api';
+import { getConfigInfor } from '@/utils/index';
+import { setToken } from '@/utils/auth';
 export default {
   // import引入的组件需要注入到对象中才能使用
   components: {
@@ -80,6 +83,10 @@ export default {
       page: 1,
       pageSize: 10,
       loading: false,
+      AccessToken: this.$route.query.AccessToken,
+      AppID: this.$route.query.AppID,
+      showPage: false,
+      userID: this.$route.query.UserID ? this.$route.query.UserID : '',
     };
   },
   // 计算属性 类似于data概念
@@ -87,7 +94,20 @@ export default {
   // 监控data中数据变化
   watch: {},
   // 生命周期 - 创建完成(可以访问当前this实例)
-  created() {
+  async created() {
+    const _this = this;
+    if (this.AccessToken) {
+      const Mname = 'login_control-ParseAccessToken';
+      await getStaticContent(Mname, {
+        access_token: _this.AccessToken,
+      }).then((res) => {
+        res.access_token = _this.AccessToken;
+        setToken(res);
+        this.showPage = true;
+      });
+      await getConfigInfor();
+    }
+    this.showPage = true;
     this.getdata();
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
@@ -104,7 +124,7 @@ export default {
     Startcread() {
       this.$router.push({
         path: '/wordcard/cread',
-        query: { cachesType: 'pop' },
+        query: { cachesType: 'pop', userID: this.userID },
       });
     },
     deleteOne(id, index) {
@@ -130,6 +150,7 @@ export default {
       LearnWebSI(Mname, {
         cur_page: this.page,
         page_capacity: this.pageSize,
+        app_user_id: this.userID,
       })
         .then((res) => {
           this.data = res;