Преглед на файлове

Merge branch 'master' of http://60.205.254.193:3000/GCLS/eep_page

dsy преди 2 дни
родител
ревизия
2ffe868fe3

+ 84 - 24
src/views/book/courseware/create/components/question/dialogue_article/Article.vue

@@ -425,9 +425,10 @@ import Notes from '../article/Notes.vue';
 import CheckSubtitles from '@/views/book/courseware/create/components/question/voice_matrix/CheckSubtitles.vue';
 import ResourcesOperate from '../../common/ResourcesOperate.vue';
 
-import { getArticleData } from '@/views/book/courseware/data/dialogueArticle';
+import { getArticleData, roleDefaultColorList } from '@/views/book/courseware/data/dialogueArticle';
 import { fileUpload, TextToAudioFile } from '@/api/app';
 import { toolGetWordPinyinCorrectionList } from '@/api/pinyinCorrection';
+import { getRandomNumber } from '@/utils';
 import {
   segSentences,
   BatchSegContent,
@@ -567,30 +568,89 @@ export default {
       if (!this.textInput.trim()) {
         return;
       }
-      // console.log(this.textInput.split('\n'));
-
-      this.data.detail.push({
-        roleIndex: this.curRole,
-        para: this.textInput.replace(/\n/, ''),
-        remark: {
-          chs: '',
-          en: '',
-          heightNumber: null,
-          img_list: [],
-          widthNumber: null,
-          chsBg: '#988ed6',
-          enBg: '#fff',
-        },
-        type: 'text',
-        paraIndex: 0,
-        sentences: [],
-        segList: [],
-        seg_words: [],
-        wordsList: [],
-        timeList: [],
-        isTitle: false,
-        sentencesEn: [],
+      let textList = this.textInput.trim().split('\n');
+      textList.forEach((item) => {
+        let obj = {
+          roleIndex: null,
+          notice: '',
+          para: '',
+          remark: {
+            chs: '',
+            en: '',
+            heightNumber: null,
+            img_list: [],
+            widthNumber: null,
+            chsBg: '#988ed6',
+            enBg: '#fff',
+          },
+          type: 'notice',
+          paraIndex: 0,
+          sentences: [],
+          segList: [],
+          seg_words: [],
+          wordsList: [],
+          timeList: [],
+          isTitle: false,
+          sentencesEn: [],
+        };
+        if (item.indexOf(':') > -1) {
+          // 如果包含描述、语境或者角色名
+          let prefix = item.substring(0, item.indexOf(':'));
+          let content = item.substring(item.indexOf(':') + 1);
+          if (prefix === '描述' || prefix === '语境') {
+            // 语境内容
+            obj.roleIndex = null;
+            obj.notice = content;
+            obj.type = 'notice';
+          } else {
+            obj.para = content;
+            obj.type = 'text';
+            let role = this.data.property.role_list.find((items) => items.fullName === prefix);
+            if (!role) {
+              // 角色名不存在
+              this.data.property.role_list.push({
+                name: prefix,
+                mark: getRandomNumber(),
+                color: roleDefaultColorList[this.data.property.role_list.length],
+                simpleHead: '',
+                img_list: [],
+                fullName: prefix,
+                fullPinyin: '',
+                id: Math.random().toString(36).substr(2),
+              });
+            }
+            obj.roleIndex = this.data.property.role_list.find((items) => items.fullName === prefix).id;
+          }
+        } else {
+          obj.roleIndex = this.curRole;
+          obj.para = content;
+          obj.type = 'text';
+        }
+        this.data.detail.push(obj);
       });
+
+      // this.data.detail.push({
+      //   roleIndex: this.curRole,
+      //   para: this.textInput.replace(/\n/, ''),
+      //   remark: {
+      //     chs: '',
+      //     en: '',
+      //     heightNumber: null,
+      //     img_list: [],
+      //     widthNumber: null,
+      //     chsBg: '#988ed6',
+      //     enBg: '#fff',
+      //   },
+      //   type: 'text',
+      //   paraIndex: 0,
+      //   sentences: [],
+      //   segList: [],
+      //   seg_words: [],
+      //   wordsList: [],
+      //   timeList: [],
+      //   isTitle: false,
+      //   sentencesEn: [],
+      // });
       this.textInput = '';
       this.handleMindMap();
     },

+ 35 - 20
src/views/personal_workbench/project/ProductionResourceManage.vue

@@ -8,6 +8,14 @@
       </div>
       <div class="textbook-chapter">
         <div class="textbook-chapter__header">
+          <div class="search-left">
+            <label class="label-btn" :class="[search_scope === 0 ? 'active' : '']" @click="changeScope(0)">
+              当前节点
+            </label>
+            <label class="label-btn" :class="[search_scope === 1 ? 'active' : '']" @click="changeScope(1)">
+              本节点以及所有子节点
+            </label>
+          </div>
           <div class="courseware">
             <div class="operator flex">
               <span class="link" @click="handleAdd">上传</span>
@@ -343,6 +351,7 @@ export default {
         },
       ], // 类型分类
       type_index: 0, // 类型索引
+      search_scope: 0, // 搜索范围
       sort_list: [
         {
           value: 'name',
@@ -589,6 +598,11 @@ export default {
       this.acceptFileType = this.acceptFileTypeList[index];
       this.queryList('');
     },
+    // 切换搜索范围
+    changeScope(val) {
+      this.search_scope = val;
+      this.queryList('');
+    },
     // 查询列表
     queryList(data) {
       this.boxLoading = true;
@@ -613,6 +627,7 @@ export default {
         type: this.type_list[this.type_index].value,
         name_or_label: this.search_content,
         order_column_list,
+        search_scope: this.search_scope,
       };
       PageQueryProjectResourceList(datas)
         .then(({ total_count, resource_list }) => {
@@ -1026,7 +1041,7 @@ export default {
       &__header {
         display: flex;
         align-items: center;
-        justify-content: flex-end;
+        justify-content: space-between;
         height: 40px;
         padding: 6px 4px;
         margin-bottom: 5px;
@@ -1055,25 +1070,6 @@ export default {
         justify-content: space-between;
         padding: 5px;
 
-        .search-left {
-          display: flex;
-          flex-flow: wrap;
-          gap: 5px;
-          align-items: center;
-        }
-
-        .label-btn {
-          padding: 5px 10px;
-          cursor: pointer;
-          background: #ebebeb;
-          border-radius: 4px;
-
-          &.active {
-            color: #f90;
-            background: #ffefd6;
-          }
-        }
-
         .el-input,
         .el-select {
           width: 120px;
@@ -1081,6 +1077,25 @@ export default {
       }
     }
 
+    .search-left {
+      display: flex;
+      flex-flow: wrap;
+      gap: 5px;
+      align-items: center;
+    }
+
+    .label-btn {
+      padding: 5px 10px;
+      cursor: pointer;
+      background: #ebebeb;
+      border-radius: 4px;
+
+      &.active {
+        color: #f90;
+        background: #ffefd6;
+      }
+    }
+
     .sources-box {
       display: flex;
       flex-flow: wrap;