Prechádzať zdrojové kódy

拼音提供校正库列表

natasha 5 dní pred
rodič
commit
e3370bd05c

+ 5 - 0
src/api/article.js

@@ -47,3 +47,8 @@ export function getSysConfig() {
 export function getWordTimes(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=tool-AudioTextDot_OldFormat`, data);
 }
+
+// 词典
+export function toolDictionary(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=tool-Dictionary`, data);
+}

+ 5 - 0
src/api/pinyinCorrection.js

@@ -27,4 +27,9 @@ export function toolUpdatePinyinCorrection(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=tool-UpdatePinyinCorrection`, data);
 }
 
+// 得到词的拼音校正列表
+export function toolGetWordPinyinCorrectionList(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=tool-GetWordPinyinCorrectionList`, data);
+}
+
 

+ 35 - 2
src/views/book/courseware/create/components/base/common/CorrectPinyin.vue

@@ -45,14 +45,31 @@
         active-text="显示拼音"
         inactive-text="隐藏拼音"
       />
-      <el-input
+      <!-- <el-input
         v-show="isEnable(dataContent.showPinyin)"
         v-model="numberPinyin"
         autocomplete="off"
         placeholder="请输入正确的拼音"
         @blur="convertTonePinyin"
         class="pinyin-input"
-      />
+      /> -->
+      <el-select
+        v-show="isEnable(dataContent.showPinyin)"
+        v-model="numberPinyin"
+        placeholder="请选择"
+        filterable
+        allow-create
+        default-first-option
+        @change="convertTonePinyin"
+        class="pinyin-input"
+      >
+        <el-option v-for="item in pinyinList" :key="item.pinyin" :value="item.pinyin.replace(/,/g, '')">
+          <span style="float: left">{{ item.pinyin ? item.pinyin.replace(/,/g, '') : '' }}</span>
+          <span style="float: right; font-size: 13px; color: #8492a6">{{
+            item.storage_type === 1 ? '机构库' : item.storage_type === 2 ? '全域库' : '个人库'
+          }}</span>
+        </el-option>
+      </el-select>
     </div>
     <span v-show="isEnable(dataContent.showPinyin)" class="tips"
       >一到四声分别用数字1-4表示,轻声用0表示,拼音间用空格隔开。</span
@@ -80,6 +97,7 @@ import RichText from '@/components/RichText.vue';
 import _ from 'lodash';
 import { fontFamilyList } from '@/views/book/courseware/data/table.js';
 import { isEnable } from '@/views/book/courseware/data/common';
+import { toolGetWordPinyinCorrectionList } from '@/api/pinyinCorrection';
 
 export default {
   name: 'CorrectPinyin',
@@ -138,6 +156,7 @@ export default {
         left: 0,
       },
       dataContent: { activeTextStyle: {}, note: {} },
+      pinyinList: [], // 拼音校正列表
     };
   },
   watch: {
@@ -157,6 +176,7 @@ export default {
         }
         this.$set(this.dataContent, 'showPinyin', _showPinyin);
         this.$set(this.dataContent, 'activeTextStyle', style);
+        this.getPinyinList();
       },
       deep: true,
     },
@@ -210,6 +230,19 @@ export default {
         this.$set(this.dataContent.activeTextStyle, 'textDecoration', style.textDecoration);
       }
     },
+    // 获取拼音校正库列表
+    getPinyinList() {
+      this.pinyinList = [];
+      toolGetWordPinyinCorrectionList({
+        word: this.dataContent.text,
+      })
+        .then((res) => {
+          if (res.status === 1) {
+            this.pinyinList = res.pinyin_correction_list;
+          }
+        })
+        .catch(() => {});
+    },
   },
 };
 </script>

+ 32 - 4
src/views/book/courseware/create/components/question/article/CheckPinyin.vue

@@ -61,7 +61,22 @@
             </span>
           </div>
         </div>
-        <el-input v-model="checkPinyinInput" type="text" class="checkPinyinInput" />
+        <!-- <el-input v-model="checkPinyinInput" type="text" class="checkPinyinInput" /> -->
+        <el-select
+          v-model="checkPinyinInput"
+          placeholder="请选择"
+          filterable
+          allow-create
+          default-first-option
+          class="checkPinyinInput"
+        >
+          <el-option v-for="item in pinyinList" :key="item.pinyin" :value="item.pinyin.replace(/,/g, '')">
+            <span style="float: left">{{ item.pinyin.replace(/,/g, '') }}</span>
+            <span style="float: right; font-size: 13px; color: #8492a6">{{
+              item.storage_type === 1 ? '机构库' : item.storage_type === 2 ? '全域库' : '个人库'
+            }}</span>
+          </el-option>
+        </el-select>
         <p class="tips">
           一到四声分别用数字1-4表示。拼音间用空格隔开,儿化音用_代替空格,如“骨朵儿”输入“gu1 duo3_er”。
         </p>
@@ -75,8 +90,7 @@
 </template>
 
 <script>
-// import { publicMethods, reparse } from '@/api/api';
-import th from 'element-ui/lib/locale/lang/th';
+import { toolGetWordPinyinCorrectionList } from '@/api/pinyinCorrection';
 
 export default {
   components: {},
@@ -108,6 +122,7 @@ export default {
         ['m̄', 'ḿ', 'm', 'm̀', 'm'],
       ],
       toneList: [' ', 'ˉ', 'ˊ', 'ˇ', 'ˋ'],
+      pinyinList: [], // 拼音校正列表
     };
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
@@ -166,7 +181,20 @@ export default {
     selectItem(item, index) {
       this.activeIndex = `${index}_${item.sentenceIndex}_${item.wordIndex}`;
       this.itemActive = item;
-      this.dialogFlag = true;
+      this.pinyinList = [];
+      toolGetWordPinyinCorrectionList({
+        word: item.text,
+      })
+        .then((res) => {
+          if (res.status === 1) {
+            this.pinyinList = res.pinyin_correction_list;
+          }
+          this.dialogFlag = true;
+        })
+        .catch(() => {
+          this.dialogFlag = true;
+        });
+
       this.checkPinyinInput = '';
     },
     cancleDialog() {

+ 32 - 4
src/views/book/courseware/create/components/question/image_text/CheckPinyin.vue

@@ -53,7 +53,22 @@
             </span>
           </div>
         </div>
-        <el-input v-model="checkPinyinInput" type="text" class="checkPinyinInput" />
+        <!-- <el-input v-model="checkPinyinInput" type="text" class="checkPinyinInput" /> -->
+        <el-select
+          v-model="checkPinyinInput"
+          placeholder="请选择"
+          filterable
+          allow-create
+          default-first-option
+          class="checkPinyinInput"
+        >
+          <el-option v-for="item in pinyinList" :key="item.pinyin" :value="item.pinyin.replace(/,/g, '')">
+            <span style="float: left">{{ item.pinyin.replace(/,/g, '') }}</span>
+            <span style="float: right; font-size: 13px; color: #8492a6">{{
+              item.storage_type === 1 ? '机构库' : item.storage_type === 2 ? '全域库' : '个人库'
+            }}</span>
+          </el-option>
+        </el-select>
         <p class="tips">
           一到四声分别用数字1-4表示。拼音间用空格隔开,儿化音用_代替空格,如“骨朵儿”输入“gu1 duo3_er”。
         </p>
@@ -67,8 +82,7 @@
 </template>
 
 <script>
-// import { publicMethods, reparse } from '@/api/api';
-import th from 'element-ui/lib/locale/lang/th';
+import { toolGetWordPinyinCorrectionList } from '@/api/pinyinCorrection';
 
 export default {
   components: {},
@@ -100,6 +114,7 @@ export default {
         ['m̄', 'ḿ', 'm', 'm̀', 'm'],
       ],
       toneList: [' ', 'ˉ', 'ˊ', 'ˇ', 'ˋ'],
+      pinyinList: [], // 拼音校正列表
     };
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
@@ -158,7 +173,20 @@ export default {
     selectItem(item, index) {
       this.activeIndex = index;
       this.itemActive = item;
-      this.dialogFlag = true;
+      this.pinyinList = [];
+      toolGetWordPinyinCorrectionList({
+        word: item.wordsName ? item.wordsName : item.onebest,
+      })
+        .then((res) => {
+          if (res.status === 1) {
+            this.pinyinList = res.pinyin_correction_list;
+          }
+          this.dialogFlag = true;
+        })
+        .catch(() => {
+          this.dialogFlag = true;
+        });
+
       this.checkPinyinInput = '';
     },
     cancleDialog() {