zq преди 2 седмици
родител
ревизия
710ca40ff8

+ 20 - 0
src/api/config.js

@@ -0,0 +1,20 @@
+import { http } from '@/utils/http';
+
+// 得到系统配置
+export function GetSysConfig() {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=sys_config_manager-GetSysConfig`);
+}
+
+// 设置系统配置
+export function SetSysConfig(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=sys_config_manager-SetSysConfig`, data);
+}
+// 得到语音引擎配置
+export function GetSysConfig_SpeechEngine() {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=sys_config_manager-GetSysConfig_SpeechEngine`);
+}
+
+// 设置语音引擎配置
+export function SetSysConfig_SpeechEngine(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=sys_config_manager-SetSysConfig_SpeechEngine`, data);
+}

+ 12 - 2
src/router/modules/basic.js

@@ -87,7 +87,7 @@ export const UserManagePage = {
 export const SystemConfigPage = {
   path: '/system_config',
   component: DEFAULT,
-  redirect: '/system_config/mail',
+  redirect: '/system_config/sys',
   meta: {
     title: '系统管理',
     icon: 'setting',
@@ -96,7 +96,17 @@ export const SystemConfigPage = {
     {
       path: 'mail',
       name: 'MailConfig',
-      component: () => import('@/views/system_config'),
+      component: () => import('@/views/system_config/mail'),
+    },
+    {
+      path: 'sys',
+      name: 'SysConfig',
+      component: () => import('@/views/system_config/sys'),
+    },
+    {
+      path: 'voiceEngine',
+      name: 'voiceEngineConfig',
+      component: () => import('@/views/system_config/voiceengine'),
     },
   ],
 };

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

@@ -26,7 +26,11 @@ export default {
     return {
       activeKey: this.curKey,
       // 子菜单列表
-      subMenuList: [{ key: 'mail', name: '邮箱配置' }],
+      subMenuList: [
+        { key: 'sys', name: '系统配置' },
+        { key: 'mail', name: '邮箱配置' },
+        { key: 'voiceEngine', name: '语音引擎配置' },
+      ],
     };
   },
   methods: {

+ 2 - 2
src/views/system_config/index.vue → src/views/system_config/mail/index.vue

@@ -54,7 +54,7 @@
 
 <script>
 import { getSysConfigMailbox, setSysConfigMailbox } from '@/api/user';
-import MenuPage from './common/menu.vue';
+import MenuPage from '../common/menu.vue';
 export default {
   name: 'MailConfig',
   components: { MenuPage },
@@ -149,7 +149,7 @@ export default {
   .config-form {
     width: 100%;
     max-width: 1148px;
-    height: calc(100vh - 190px);
+    height: calc(100vh - 200px);
     margin: 10px auto;
     overflow: auto;
 

+ 122 - 0
src/views/system_config/sys/index.vue

@@ -0,0 +1,122 @@
+<template>
+  <div class="system_config">
+    <MenuPage cur-key="sys" />
+    <div class="btn-box">
+      <el-button type="primary" :loading="refresh_loading" @click="getInfo">刷新</el-button>
+      <el-button type="primary" :loading="loading" @click="onSubmit('configForm')">应用</el-button>
+    </div>
+    <el-form ref="configForm" :model="configForm" label-width="150px" :rules="rules" class="config-form">
+      <el-form-item label="系统主机地址" prop="host_address">
+        <el-input
+          v-model="configForm.host_address"
+          autocomplete="off"
+          placeholder="请输入系统主机地址"
+          maxlength="100"
+          @blur="handleTrim('configForm', 'host_address')"
+        />
+      </el-form-item>
+      <el-form-item label=" 文本分析页面地址" prop="text_analyser_page_address">
+        <el-input
+          v-model="configForm.text_analyser_page_address"
+          autocomplete="off"
+          placeholder="请输入文本分析页面地址"
+          maxlength="200"
+          @blur="handleTrim('configForm', 'text_analyser_page_address')"
+        />
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import { GetSysConfig, SetSysConfig } from '@/api/config';
+import MenuPage from '../common/menu.vue';
+export default {
+  name: 'SysConfig',
+  components: { MenuPage },
+  data() {
+    return {
+      configForm: {
+        host_address: '',
+        text_analyser_page_address: '',
+      },
+      rules: {
+        host_address: [{ required: true, message: '请输入系统主机地址', trigger: 'blur' }],
+        text_analyser_page_address: [{ required: true, message: '请输入文本分析页面地址', trigger: 'blur' }],
+      },
+      loading: false,
+      refresh_loading: false,
+    };
+  },
+  created() {
+    this.getInfo();
+  },
+  methods: {
+    // 去掉前后空格
+    handleTrim(form, field) {
+      this[form][field] = this[form][field].trim();
+    },
+    getInfo() {
+      this.refresh_loading = true;
+      GetSysConfig()
+        .then((res) => {
+          this.refresh_loading = false;
+          if (res.status === 1) {
+            this.configForm = res;
+          }
+        })
+        .catch(() => {
+          this.refresh_loading = false;
+        });
+    },
+    // 应用
+    onSubmit(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          this.loading = true;
+          SetSysConfig(this.configForm)
+            .then((res) => {
+              this.loading = false;
+              if (res.status === 1) {
+                this.$message.success('操作成功!');
+              }
+            })
+            .catch(() => {
+              this.loading = false;
+            });
+        } else {
+          return 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>

+ 145 - 0
src/views/system_config/voiceengine/index.vue

@@ -0,0 +1,145 @@
+<template>
+  <div class="system_config">
+    <MenuPage cur-key="voiceEngine" />
+    <div class="btn-box">
+      <el-button type="primary" :loading="refresh_loading" @click="getInfo">刷新</el-button>
+      <el-button type="primary" :loading="loading" @click="onSubmit('configForm')">应用</el-button>
+    </div>
+    <el-form ref="configForm" :model="configForm" label-width="110px" :rules="rules" class="config-form">
+      <el-form-item label="应用 ID" prop="appid">
+        <el-input
+          v-model="configForm.appid"
+          autocomplete="off"
+          placeholder="请输入应用 ID"
+          maxlength="100"
+          :autocomplete="'new-appid'"
+          @blur="handleTrim('configForm', 'appid')"
+        />
+      </el-form-item>
+      <el-form-item label=" 令牌" prop="token">
+        <el-input
+          v-model="configForm.token"
+          autocomplete="off"
+          placeholder="请输入令牌"
+          maxlength="200"
+          @blur="handleTrim('configForm', 'token')"
+        />
+      </el-form-item>
+      <el-form-item label=" 密钥" prop="key">
+        <el-input
+          v-model="configForm.key"
+          :type="newPwdFlag ? 'text' : 'password'"
+          autocomplete="off"
+          placeholder="请输入密钥"
+          maxlength="200"
+          :autocomplete="'new-password'"
+          @blur="handleTrim('configForm', 'key')"
+        >
+          <i v-if="newPwdFlag" slot="suffix" class="el-icon-view show-icon" @click="changeIcon('newPwdFlag')"></i>
+          <i v-else slot="suffix" class="show-icon" @click="changeIcon('newPwdFlag')">
+            <svg-icon icon-class="eye-invisible" />
+          </i>
+        </el-input>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import { GetSysConfig_SpeechEngine, SetSysConfig_SpeechEngine } from '@/api/config';
+import MenuPage from '../common/menu.vue';
+export default {
+  name: 'voiceEngineConfig',
+  components: { MenuPage },
+  data() {
+    return {
+      configForm: {
+        appid: '',
+        token: '',
+        key: '',
+      },
+      rules: {
+        appid: [{ required: true, message: '请输入应用 ID', trigger: 'blur' }],
+        token: [{ required: true, message: '请输入令牌', trigger: 'blur' }],
+        key: [{ required: true, message: '请输入密钥', trigger: 'blur' }],
+      },
+      newPwdFlag: false, // 查看新密码
+      loading: false,
+      refresh_loading: false,
+    };
+  },
+  created() {
+    this.getInfo();
+  },
+  methods: {
+    // 去掉前后空格
+    handleTrim(form, field) {
+      this[form][field] = this[form][field].trim();
+    },
+    changeIcon(flag) {
+      this[flag] = !this[flag];
+    },
+    getInfo() {
+      this.refresh_loading = true;
+      GetSysConfig_SpeechEngine()
+        .then((res) => {
+          this.refresh_loading = false;
+          if (res.status === 1) {
+            this.configForm = res;
+          }
+        })
+        .catch(() => {
+          this.refresh_loading = false;
+        });
+    },
+    // 应用
+    onSubmit(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          this.loading = true;
+          SetSysConfig_SpeechEngine(this.configForm)
+            .then((res) => {
+              this.loading = false;
+              if (res.status === 1) {
+                this.$message.success('操作成功!');
+              }
+            })
+            .catch(() => {
+              this.loading = false;
+            });
+        } else {
+          return 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>