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

系统配置-百度词典配置

natasha преди 2 седмици
родител
ревизия
d331b34bb5

+ 10 - 0
src/api/user.js

@@ -66,3 +66,13 @@ export function ReplyMessage(data) {
 export function GetMyMessageCount(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=message_manager-GetMyMessageCount`, data);
 }
+
+// 得到百度词典配置
+export function getSysConfigBaiduDict() {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=sys_config_manager-GetSysConfig_BaiduDict`);
+}
+
+// 设置百度词典配置
+export function setSysConfigBaiduDict(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=sys_config_manager-SetSysConfig_BaiduDict`, data);
+}

+ 5 - 0
src/router/modules/basic.js

@@ -108,6 +108,11 @@ export const SystemConfigPage = {
       name: 'voiceEngineConfig',
       component: () => import('@/views/system_config/voiceengine'),
     },
+    {
+      path: 'baiduDict',
+      name: 'BaiduDictConfig',
+      component: () => import('@/views/system_config/baidu_dict'),
+    },
   ],
 };
 

+ 8 - 3
src/views/book/courseware/preview/components/table/TablePreview.vue

@@ -57,7 +57,7 @@
                         <div
                           v-for="(item, index) in col.rich_text_list"
                           :key="index"
-                          class="pinyin-text"
+                          class="pinyin-text pinyin-text-sentence"
                           :class="[
                             index === 0 ? 'pinyin-text-left' : '',
                             item.type === 'audio' ? 'pinyin-text-audio' : '',
@@ -387,7 +387,7 @@
                           <div
                             v-for="(item, index) in col.rich_text_list"
                             :key="index"
-                            class="pinyin-text"
+                            class="pinyin-text pinyin-text-sentence"
                             :class="[
                               index === 0 ? 'pinyin-text-left' : '',
                               item.type === 'audio' ? 'pinyin-text-audio' : '',
@@ -754,7 +754,12 @@ export default {
         } else if (item.text && typeof item.text === 'string' && item.text.includes('<audio')) {
           blocks.push(this.parseAudioBlock(item, tagStack));
         } else if (item.is_style === 'true' || item.is_style === true) {
-          this.handleStyleTag(item, tagStack);
+          if (item.text.includes('<br')) {
+            blocks.push({ type: 'newline' });
+            paragraphIndex += 1;
+          } else {
+            this.handleStyleTag(item, tagStack);
+          }
         } else if (item.text === '\n') {
           blocks.push({ type: 'newline' });
           paragraphIndex += 1;

+ 117 - 0
src/views/system_config/baidu_dict/index.vue

@@ -0,0 +1,117 @@
+<template>
+  <div class="system_config">
+    <MenuPage cur-key="baiduDict" />
+    <div class="btn-box">
+      <el-button type="primary" :loading="refresh_loading" @click="getInfo">刷新</el-button>
+      <el-button type="primary" :loading="loading" @click="onSubmit">应用</el-button>
+    </div>
+    <el-form ref="configForm" :model="configForm" label-width="110px" :rules="rules" class="config-form">
+      <el-form-item label="键值(APIKEY)" prop="api_key">
+        <el-input
+          v-model="configForm.api_key"
+          autocomplete="off"
+          placeholder="请输入应用接口键值(APIKEY)"
+          maxlength="100"
+          @blur="handleTrim('configForm', 'api_key')"
+        />
+      </el-form-item>
+      <el-form-item label="密钥" prop="secret_key">
+        <el-input
+          v-model="configForm.secret_key"
+          autocomplete="off"
+          placeholder="请输入密钥"
+          maxlength="200"
+          @blur="handleTrim('configForm', 'secret_key')"
+        />
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import { getSysConfigBaiduDict, setSysConfigBaiduDict } from '@/api/user';
+import MenuPage from '../common/menu.vue';
+export default {
+  name: 'BaiduDictConfig',
+  components: { MenuPage },
+  data() {
+    return {
+      configForm: {
+        api_key: '',
+        secret_key: '',
+      },
+      rules: {
+        api_key: [{ required: true, message: '请输入应用接口键值(APIKEY)', trigger: 'blur' }],
+        secret_key: [{ required: true, message: '请输入密钥', trigger: 'blur' }],
+      },
+      loading: false,
+      refresh_loading: false,
+    };
+  },
+  created() {
+    this.getInfo();
+  },
+  methods: {
+    // 去掉前后空格
+    handleTrim(form, fild) {
+      this[form][fild] = this[form][fild].trim();
+    },
+    getInfo() {
+      this.refresh_loading = true;
+      getSysConfigBaiduDict()
+        .then((res) => {
+          this.refresh_loading = false;
+          if (res.status === 1) {
+            this.configForm.api_key = res.api_key;
+            this.configForm.secret_key = res.secret_key;
+          }
+        })
+        .catch(() => {
+          this.refresh_loading = false;
+        });
+    },
+    // 应用
+    onSubmit() {
+      this.loading = true;
+      setSysConfigBaiduDict(this.configForm)
+        .then((res) => {
+          this.loading = false;
+          if (res.status === 1) {
+            this.$message.success('操作成功!');
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+@use '@/styles/mixin.scss' as *;
+
+.system_config {
+  @include page-base;
+
+  .btn-box {
+    width: 100%;
+    max-width: 1148px;
+    padding: 5px 0;
+    margin: 0 auto;
+    border-bottom: $border;
+  }
+
+  .config-form {
+    width: 100%;
+    max-width: 1148px;
+    height: calc(100vh - 200px);
+    margin: 10px auto;
+    overflow: auto;
+
+    :deep .el-input--small {
+      width: 304px;
+    }
+  }
+}
+</style>

+ 1 - 0
src/views/system_config/common/menu.vue

@@ -30,6 +30,7 @@ export default {
         { key: 'sys', name: '系统配置' },
         { key: 'mail', name: '邮箱配置' },
         { key: 'voiceEngine', name: '语音引擎配置' },
+        { key: 'baiduDict', name: '百度词典配置' },
       ],
     };
   },