Browse Source

增加文本分析及页面跳转,

qinpeng 2 years ago
parent
commit
46d4f06514

+ 20 - 1
src/api/ajax.js

@@ -315,4 +315,23 @@ export function compareSenTenceTime(data) {
         method: 'post',
         data
     })
-}
+}
+
+// 文本分析 
+export function analysSubmit(data) {
+    let userInfor = getToken();
+    let UserCode = '',
+        UserType = '',
+        SessionID = ''
+    if (userInfor) {
+        let user = JSON.parse(getToken());
+        UserCode = user.user_code;
+        UserType = user.user_type;
+        SessionID = user.session_id;
+    }
+    return request({
+        url: `/GCLSTCServer/tools/TS/analys?UserCode=${UserCode}&UserType=${UserType}&SessionID=${SessionID}`,
+        method: 'post',
+        data
+    })
+}

BIN
src/assets/NPC/wbfx-icon.png


+ 100 - 39
src/components/Adult/preview/DialogueArticleViewChs/index.vue

@@ -9,42 +9,49 @@
       <!-- <a :class="['ArticleView-full']" v-if="showPractice" @click="goFullscreen"
         >全屏模式</a
       > -->
-      <template v-if="curQue.checkList.indexOf(1) > -1">
-        <el-switch
-          style="display: block"
-          v-model="showPhrases"
-          :active-color="activeColor"
-          inactive-color="rgba(0,0,0,0.1)"
-          active-text=""
-          inactive-text="本课生词"
-          @change="handleSwitchChange('showPractice', 'showWord')"
-        >
-        </el-switch>
-      </template>
-      <template v-if="curQue.checkList.indexOf(2) > -1">
-        <el-switch
-          style="display: block"
-          v-model="showPractice"
-          :active-color="activeColor"
-          inactive-color="rgba(0,0,0,0.1)"
-          active-text=""
-          inactive-text="语音练习"
-          @change="handleSwitchChange('showPhrases', 'showWord')"
-        >
-        </el-switch>
-      </template>
-      <template v-if="curQue.checkList.indexOf(3) > -1">
-        <el-switch
-          style="display: block"
-          v-model="showWord"
-          :active-color="activeColor"
-          inactive-color="rgba(0,0,0,0.1)"
-          active-text=""
-          inactive-text="取词"
-          @change="handleSwitchChange('showPhrases', 'showPractice')"
-        >
-        </el-switch>
-      </template>
+      <div class="left" @click="submit">
+        <img src="../../../../assets/NPC/wbfx-icon.png" alt="" />
+        文本分析
+      </div>
+      <div class="right">
+        <template v-if="curQue.checkList.indexOf(1) > -1">
+          <el-switch
+            style="display: block"
+            v-model="showPhrases"
+            :active-color="activeColor"
+            inactive-color="rgba(0,0,0,0.1)"
+            active-text=""
+            inactive-text="本课生词"
+            @change="handleSwitchChange('showPractice', 'showWord')"
+          >
+          </el-switch>
+        </template>
+        <template v-if="curQue.checkList.indexOf(2) > -1">
+          <el-switch
+            style="display: block"
+            v-model="showPractice"
+            :active-color="activeColor"
+            inactive-color="rgba(0,0,0,0.1)"
+            active-text=""
+            inactive-text="语音练习"
+            @change="handleSwitchChange('showPhrases', 'showWord')"
+          >
+          </el-switch>
+        </template>
+        <template v-if="curQue.checkList.indexOf(3) > -1">
+          <el-switch
+            style="display: block"
+            v-model="showWord"
+            :active-color="activeColor"
+            inactive-color="rgba(0,0,0,0.1)"
+            active-text=""
+            inactive-text="取词"
+            @change="handleSwitchChange('showPhrases', 'showPractice')"
+          >
+          </el-switch>
+        </template>
+      </div>
+
       <!-- <div class="setting-fontsize">
         <a @click="handleFontsize('-')"
           ><img src="../../../../assets/newImage/common/btn-reduce.png"
@@ -126,7 +133,7 @@ import PhraseModel from "./PhraseModelChs.vue";
 import NormalModelChs from "./NormalModelChs.vue";
 import Practice from "./Practicechs.vue"; // 语音练习模式
 import WordModel from "./WordModelChs.vue"; // 语音练习模式
-
+import { analysSubmit } from "@/api/ajax";
 export default {
   name: "DialogueArticleViewChs",
   props: [
@@ -187,6 +194,41 @@ export default {
   watch: {},
   //方法集合
   methods: {
+    submit() {
+      let loading = this.$loading({
+        lock: true,
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      console.log(this.curQue);
+      analysSubmit({
+        tenantId: "",
+        text: this.curQue.article,
+      })
+        .then((res) => {
+          window.open(
+            process.env.VUE_APP_BASE_API +
+              `/GCLS-TC/#/textanalysis/Result?
+          partitionKey=${res.data.result.partitionKey}
+          &subjectWords=${res.data.result.subjectWords}
+          &wordTextCount=${res.data.result.textCount}
+          &wordCount=${res.data.result.wordCount}
+          &vocabularyTextCount=${res.data.result.vocabularyTextCount}
+          &vocabularyCount=${res.data.result.vocabularyCount}
+          &pinyinCount=${res.data.result.pinyinCount}
+          &pinyinTextCount=${res.data.result.pinyinTextCount}
+          &pinyinDifficulty=${res.data.result.pinyinDifficulty}
+          &wordDifficulty=${res.data.result.wordDifficulty}
+          &vocabularyDifficulty=${res.data.result.vocabularyDifficulty}
+          &type=文本分析`
+          );
+          loading.close();
+        })
+        .catch((res) => {
+          loading.close();
+        });
+    },
     goFullscreen() {
       var element = document.getElementById("articleBoby");
       if (element.mozRequestFullScreen) {
@@ -289,11 +331,30 @@ export default {
   }
   .ArticleView-header {
     display: flex;
-    justify-content: flex-end;
+    justify-content: space-between;
     align-items: center;
     margin-bottom: 16px;
     position: relative;
-
+    .left {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      width: 104px;
+      height: 32px;
+      background: #ffffff;
+      border: 1px solid rgba(0, 0, 0, 0.25);
+      box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.02);
+      border-radius: 4px;
+      cursor: pointer;
+      img {
+        width: 24px;
+        height: 24px;
+        margin-right: 4px;
+      }
+    }
+    .right {
+      display: flex;
+    }
     .setting-fontsize {
       display: flex;
       margin-left: 24px;