Просмотр исходного кода

添加 首信易支付配置页面

dusenyao 3 лет назад
Родитель
Сommit
fab7fc2a4c

+ 26 - 86
.eslintrc.js

@@ -82,19 +82,17 @@ module.exports = {
       }
     ],
     'comma-style': [2, 'last'],
-    'constructor-super': 2,
     curly: [2, 'multi-line'],
     'dot-location': [2, 'property'],
     'eol-last': 2,
-    eqeqeq: ['error', 'always', { null: 'ignore' }],
+    eqeqeq: [1, 'always'],
     'generator-star-spacing': [
       2,
       {
-        before: true,
+        before: false,
         after: true
       }
     ],
-    'handle-callback-err': [2, '^(err|error)$'],
     indent: [
       2,
       2,
@@ -125,11 +123,7 @@ module.exports = {
       }
     ],
     'no-caller': 2,
-    'no-control-regex': 0,
-    'no-dupe-class-members': 2,
-    'no-empty-pattern': 2,
     'no-eval': 2,
-    'no-fallthrough': 2,
     'no-labels': [
       2,
       {
@@ -137,7 +131,6 @@ module.exports = {
         allowSwitch: false
       }
     ],
-    'no-mixed-spaces-and-tabs': 2,
     'no-multi-spaces': 2,
     'no-multiple-empty-lines': [
       2,
@@ -145,12 +138,8 @@ module.exports = {
         max: 1
       }
     ],
-    'no-new-symbol': 2,
-    'no-path-concat': 2,
     'no-return-assign': [2, 'except-parens'],
-    'no-self-assign': 2,
     'no-sequences': 2,
-    'no-this-before-super': 2,
     'no-trailing-spaces': 2,
     'no-unmodified-loop-condition': 2,
     'no-unneeded-ternary': [
@@ -159,9 +148,8 @@ module.exports = {
         defaultAssignment: false
       }
     ],
-    'no-unsafe-finally': 2,
     'no-unused-vars': [
-      2,
+      1,
       {
         vars: 'all',
         args: 'none'
@@ -169,7 +157,6 @@ module.exports = {
     ],
     'no-useless-computed-key': 2,
     'no-useless-constructor': 2,
-    'no-useless-escape': 0,
     'no-whitespace-before-property': 2,
     'one-var': [
       2,
@@ -196,7 +183,7 @@ module.exports = {
         allowTemplateLiterals: true
       }
     ],
-    semi: [0, 'never'],
+    semi: [2, 'always'],
     'semi-spacing': [
       2,
       {
@@ -222,8 +209,6 @@ module.exports = {
       }
     ],
     'template-curly-spacing': [2, 'never'],
-    'use-isnan': 2,
-    'valid-typeof': 2,
     'wrap-iife': [2, 'any'],
     'yield-star-spacing': [2, 'both'],
     'object-curly-spacing': [
@@ -233,84 +218,47 @@ module.exports = {
         objectsInObjects: false
       }
     ],
-    'no-alert': 0,
+    'no-alert': process.env.NODE_ENV === 'production' ? 1 : 0,
     'no-array-constructor': 2,
-    'no-bitwise': 0,
-    'no-catch-shadow': 2,
-    'no-class-assign': 2,
-    'no-cond-assign': 2,
-    'no-const-assign': 2,
-    'no-constant-condition': 2,
-    'no-continue': 0,
-    'no-delete-var': 2,
+    'no-bitwise': 1,
     'no-div-regex': 1,
-    'no-dupe-keys': 2,
-    'no-dupe-args': 2,
-    'no-duplicate-case': 2,
     'no-else-return': 2,
-    'no-empty': 2,
-    'no-empty-character-class': 2,
-    'no-empty-label': 0,
+    'no-empty': 1,
     'no-eq-null': 2,
-    'no-ex-assign': 2,
     'no-extend-native': 2,
     'no-extra-bind': 2,
-    'no-extra-boolean-cast': 2,
     'no-extra-parens': [2, 'functions'],
-    'no-extra-semi': 2,
     'no-floating-decimal': 2,
-    'no-func-assign': 2,
     'no-implicit-coercion': 1,
     'no-implied-eval': 2,
     'no-inline-comments': 0,
-    'no-inner-declarations': [2, 'functions'],
-    'no-invalid-regexp': 2,
     'no-invalid-this': 2,
-    'no-irregular-whitespace': 2,
     'no-iterator': 2,
     'no-label-var': 2,
     'no-lone-blocks': 2,
     'no-lonely-if': 2,
     'no-loop-func': 1,
-    'no-mixed-requires': [0, false],
     'linebreak-style': [0, 'windows'],
     'no-multi-str': 2,
-    'no-native-reassign': 2,
-    'no-negated-in-lhs': 2,
     'no-nested-ternary': 0,
     'no-new': 1,
     'no-new-func': 1,
     'no-new-object': 2,
-    'no-new-require': 2,
     'no-new-wrappers': 2,
-    'no-obj-calls': 2,
-    'no-octal': 2,
     'no-octal-escape': 2,
     'no-param-reassign': 2,
-    'no-plusplus': 0,
-    'no-process-env': 0,
-    'no-process-exit': 0,
+    'no-plusplus': [1, { allowForLoopAfterthoughts: true }],
     'no-proto': 2,
-    'no-redeclare': 2,
-    'no-regex-spaces': 2,
-    'no-restricted-modules': 0,
-    'no-script-url': 0,
     'no-self-compare': 2,
-    'no-shadow-restricted-names': 2,
-    'no-spaced-func': 2,
-    'no-sparse-arrays': 2,
-    'no-sync': 0,
+    'func-call-spacing': 2,
     'no-ternary': 0,
     'no-throw-literal': 2,
-    'no-undef': 2,
     'no-undef-init': 2,
-    'no-unexpected-multiline': 2,
     'no-underscore-dangle': 1,
-    'no-unreachable': 2,
     'no-use-before-define': 2,
     'no-useless-call': 2,
     'no-void': 2,
-    'no-var': 0,
+    'no-var': 2,
     'no-warning-comments': [
       1,
       {
@@ -318,45 +266,37 @@ module.exports = {
         location: 'start'
       }
     ],
-    'no-with': 2,
     'array-bracket-spacing': [2, 'never'],
-    'arrow-parens': 0,
-    'block-scoped-var': 0,
-    'computed-property-spacing': [0, 'never'],
+    'arrow-parens': [1, 'as-needed'],
+    'computed-property-spacing': [1, 'never'],
     'consistent-return': 0,
-    'consistent-this': [2, 'that'],
-    'default-case': 0,
+    'default-case': 1,
     'dot-notation': [
       0,
       {
         allowKeywords: true
       }
     ],
-    'func-names': 0,
+    'func-names': 1,
     'func-style': [0, 'declaration'],
     'guard-for-in': 0,
     'id-length': 0,
-    'init-declarations': 0,
+    'init-declarations': 1,
     'lines-around-comment': 0,
-    'max-depth': [0, 4],
-    'max-len': [0, 100, 4],
-    'max-nested-callbacks': [0, 2],
-    'max-params': [0, 3],
-    'max-statements': [0, 10],
+    'max-depth': [1, 4],
+    'max-len': [1, { code: 120, ignoreUrls: true, ignoreTemplateLiterals: true, ignoreRegExpLiterals: true }],
+    'max-nested-callbacks': 1,
+    'max-params': [1, 6],
+    'max-statements': [1, 40],
     'new-parens': 2,
-    'object-shorthand': 0,
-    'operator-assignment': [0, 'always'],
-    'prefer-spread': 0,
-    'prefer-reflect': 0,
-    'quote-props': [0, 'always'],
-    radix: 2,
+    'object-shorthand': 1,
+    'operator-assignment': 1,
+    'prefer-spread': 1,
+    'quote-props': [1, 'as-needed'],
+    radix: [1, 'as-needed'],
     'id-match': 0,
-    'require-yield': 0,
-    'sort-vars': 0,
-    'space-after-keywords': [0, 'always'],
-    'space-return-throw-case': 0,
+    'sort-vars': [1, { ignoreCase: true }],
     strict: 2,
-    'valid-jsdoc': 0,
     'vars-on-top': 2,
     'wrap-regex': 0,
     yoda: [2, 'never']

+ 2 - 1
package.json

@@ -6,7 +6,8 @@
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
     "test:unit": "vue-cli-service test:unit",
-    "lint": "eslint --ext .js,.vue src"
+    "lint": "eslint --ext .js,.vue src",
+    "lint:css": "stylelint **/*.{html,vue,css,sass,scss,less}"
   },
   "dependencies": {
     "axios": "^0.21.4",

+ 1 - 1
src/api/ajax.js

@@ -5,6 +5,6 @@ export function getContent(MethodName, data, loading) {
     url: `/GCLSFileServer/ServiceInterface?MethodName=${MethodName}`,
     method: 'post',
     data,
-    loading: loading
+    loading
   });
 }

+ 29 - 0
src/api/settings.js

@@ -29,3 +29,32 @@ export function SetLiveRoomConfig(data) {
     data
   });
 }
+
+/**
+ * 得到首信易支付配置
+ * @param {Object} data
+ */
+export function GetSysConfig_SXYZF(data) {
+  let params = getRequestParameter('sys_config_manager-GetSysConfig_SXYZF');
+
+  return request({
+    method: 'post',
+    url: process.env.VUE_APP_FileServer,
+    params,
+    data
+  });
+}
+/**
+ * 更新首信易支付配置
+ * @param {Object} data
+ */
+export function UpdateSysConfig_SXYZF(data) {
+  let params = getRequestParameter('sys_config_manager-UpdateSysConfig_SXYZF');
+
+  return request({
+    method: 'post',
+    url: process.env.VUE_APP_FileServer,
+    params,
+    data
+  });
+}

+ 1 - 1
src/layouts/index.vue

@@ -29,9 +29,9 @@ export default {
   padding-top: 130px;
 
   .app-main {
-    background-color: #f5f5f5;
     height: 100%;
     overflow-y: auto;
+    background-color: #f5f5f5;
   }
 }
 </style>

+ 13 - 0
src/router/index.js

@@ -154,9 +154,22 @@ const routes = [
         children: [
           {
             path: '/settings/LiveRoomConfig',
+            meta: {
+              name: 'LiveRoomConfig'
+            },
             components: {
+              // 命名视图
               configure: () => import('@/views/settings/configure/LiveRoomConfig.vue')
             }
+          },
+          {
+            path: '/settings/SXYZFConfig',
+            meta: {
+              name: 'SXYZFConfig'
+            },
+            components: {
+              configure: () => import('@/views/settings/configure/SXYZFConfig.vue')
+            }
           }
         ]
       }

+ 3 - 20
src/store/modules/user.js

@@ -4,16 +4,8 @@ import { resetRouter } from '@/router';
 import { login } from '@/api/user';
 
 const getDefaultSate = () => {
-  const {
-    session_id,
-    user_code,
-    user_real_name,
-    user_type,
-    user_name,
-    popedom_code_list,
-    image_url,
-    is_inner
-  } = getUserInfo();
+  const { session_id, user_code, user_real_name, user_type, user_name, popedom_code_list, image_url, is_inner } =
+    getUserInfo();
 
   return {
     session_id,
@@ -36,16 +28,7 @@ const mutations = {
 
   [user.SET_USER_INFO]: (
     state,
-    {
-      user_code,
-      user_real_name,
-      user_type,
-      session_id,
-      popedom_code_list,
-      user_name,
-      image_url,
-      is_inner
-    }
+    { user_code, user_real_name, user_type, session_id, popedom_code_list, user_name, image_url, is_inner }
   ) => {
     state.user_code = user_code;
     state.user_real_name = user_real_name;

+ 2 - 2
src/views/404.vue

@@ -12,11 +12,11 @@ export default {
 
 <style lang="scss">
 .http-404 {
-  transform: translate(-50%, -50%);
   position: absolute;
   top: 40%;
   left: 50%;
-  color: rgb(0, 174, 255);
   font-size: 32px;
+  color: rgb(0, 174, 255);
+  transform: translate(-50%, -50%);
 }
 </style>

+ 3 - 14
src/views/login/index.vue

@@ -7,12 +7,7 @@
       <div class="login-container-title">欢迎使用全球汉语教学平台后台管理系统</div>
       <div class="login-container-admin">
         <div class="login-container-admin-title">管理员登录</div>
-        <el-form
-          ref="loginForm"
-          class="login-container-admin-form"
-          :model="loginForm"
-          :rules="loginRules"
-        >
+        <el-form ref="loginForm" class="login-container-admin-form" :model="loginForm" :rules="loginRules">
           <el-form-item prop="user_name">
             <el-input
               ref="user_name"
@@ -42,12 +37,7 @@
           </el-form-item>
 
           <el-form-item>
-            <el-button
-              class="login-button"
-              :disabled="!isAgree"
-              :loading="loading"
-              @click.native.prevent="handleLogin"
-            >
+            <el-button class="login-button" :disabled="!isAgree" :loading="loading" @click.native.prevent="handleLogin">
               登录
             </el-button>
           </el-form-item>
@@ -135,8 +125,7 @@ export default {
   min-width: 1000px;
   height: 100%;
   padding-top: 55px;
-  background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)),
-    url('../../assets/login.png');
+  background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url('../../assets/login.png');
   background-size: cover;
 
   // 主容器

+ 97 - 0
src/views/settings/configure/SXYZFConfig.vue

@@ -0,0 +1,97 @@
+<template>
+  <div class="config">
+    <el-form ref="form" :model="form" label-width="240px">
+      <el-form-item label="商户唯一标识">
+        <el-input v-model="form.merchant_id" />
+      </el-form-item>
+      <el-form-item label="支付结束通知事件调用的后台地址">
+        <el-input v-model="form.pay_finish_notify_request_server_url" />
+      </el-form-item>
+      <el-form-item label="支付成功后回调的前端页面地址">
+        <el-input v-model="form.pay_success_callback_page_url" /><span>(供支付成功后显示一个页面展示)</span>
+      </el-form-item>
+      <el-form-item label="私钥证书文件">
+        <el-upload action="private" :http-request="upload" :show-file-list="false">
+          <el-input v-model="form.private_key_file_name" disabled />
+          <el-button class="upload-file" type="primary">上传文件</el-button>
+        </el-upload>
+      </el-form-item>
+      <el-form-item label="私钥密码">
+        <el-input v-model="form.private_key_password" />
+      </el-form-item>
+      <el-form-item label="公钥证书文件">
+        <el-upload action="public" :http-request="upload" :show-file-list="false">
+          <el-input v-model="form.public_key_file_name" disabled />
+          <el-button class="upload-file" type="primary">上传文件</el-button>
+        </el-upload>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="UpdateSysConfig_SXYZF">应用</el-button>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import { GetSysConfig_SXYZF, UpdateSysConfig_SXYZF } from '@/api/settings';
+import { fileUpload } from '@/api/app';
+
+export default {
+  data() {
+    return {
+      form: {
+        merchant_id: '',
+        pay_finish_notify_request_server_url: '',
+        pay_success_callback_page_url: '',
+        private_key_file_id: '',
+        private_key_file_name: '',
+        private_key_password: '',
+        public_key_file_id: '',
+        public_key_file_name: ''
+      }
+    };
+  },
+  created() {
+    GetSysConfig_SXYZF().then(res => {
+      this.form = res;
+    });
+  },
+  methods: {
+    // 上传文件
+    upload(file) {
+      fileUpload('Open', file).then(({ file_info_list }) => {
+        this.$message.success('上传成功');
+        if (file_info_list.length <= 0) return;
+        let fileInfo = file_info_list[0];
+        if (file.action === 'private') {
+          this.form.private_key_file_name = fileInfo.file_name;
+          this.form.private_key_file_id = fileInfo.file_id;
+          return;
+        }
+        if (file.action === 'public') {
+          this.form.public_key_file_name = fileInfo.file_name;
+          this.form.public_key_file_id = fileInfo.file_id;
+        }
+      });
+    },
+
+    UpdateSysConfig_SXYZF() {
+      UpdateSysConfig_SXYZF({ ...this.form }).then(() => {
+        this.$message.success('更新首信易支付配置成功');
+      });
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.config {
+  .el-input {
+    width: 480px;
+  }
+
+  .upload-file {
+    margin-left: 12px;
+  }
+}
+</style>

+ 12 - 6
src/views/settings/index.vue

@@ -1,10 +1,13 @@
 <template>
   <el-container class="settings">
     <el-aside width="200px">
-      <el-menu default-active="1" @select="handleSelect">
-        <el-menu-item index="1">
+      <el-menu :default-active="curName" @select="handleSelect">
+        <el-menu-item index="LiveRoomConfig">
           <span slot="title">场景视频对接配置</span>
         </el-menu-item>
+        <el-menu-item index="SXYZFConfig">
+          <span slot="title">首信易支付</span>
+        </el-menu-item>
       </el-menu>
     </el-aside>
 
@@ -19,18 +22,21 @@
 <script>
 export default {
   data() {
-    return {};
+    return {
+      curName: this.$route.meta.name
+    };
   },
   methods: {
-    handleSelect() {
-      // this.$router.push('/settings/LiveRoomConfig');
+    handleSelect(key) {
+      if (this.$route.meta.name === key) return;
+      this.$router.push(`/settings/${key}`);
     }
   }
 };
 </script>
 
 <style lang="scss">
-@import '~@/styles/mixin.scss';
+@import '~@/styles/mixin';
 
 .settings {
   @include container;

+ 6 - 22
src/views/upload/uploadDetail.vue

@@ -4,21 +4,13 @@
     <div class="book-vocab-content">
       <el-form ref="searchForm" :model="searchForm" :rules="courseListRules" size="mini">
         <el-form-item label="资源键值" label-width="90px" prop="resource_key">
-          <el-input
-            v-model="searchForm.resource_key"
-            autocomplete="off"
-            placeholder="请输入资源键值"
-          ></el-input>
+          <el-input v-model="searchForm.resource_key" autocomplete="off" placeholder="请输入资源键值"></el-input>
         </el-form-item>
         <el-form-item label="资源名称" label-width="90px" prop="name">
           <el-input v-model="searchForm.name" placeholder="请输入资源名称"></el-input>
         </el-form-item>
         <el-form-item label="备注" label-width="90px" prop="memo">
-          <el-input
-            v-model="searchForm.memo"
-            placeholder="请输入资源备注"
-            type="textarea"
-          ></el-input>
+          <el-input v-model="searchForm.memo" placeholder="请输入资源备注" type="textarea"></el-input>
         </el-form-item>
         <el-form-item label="上传资源" label-width="90px" prop="fileList">
           <el-upload
@@ -37,13 +29,7 @@
           </el-upload>
         </el-form-item>
       </el-form>
-      <el-button
-        v-if="resourceKey === ''"
-        class="submitBtn"
-        size="mini"
-        type="primary"
-        @click="saveWord"
-      >
+      <el-button v-if="resourceKey === ''" class="submitBtn" size="mini" type="primary" @click="saveWord">
         保存资源
       </el-button>
     </div>
@@ -101,7 +87,7 @@ export default {
   },
   watch: {
     resourceKey: {
-      handler: function (val) {
+      handler(val) {
         this.$refs.searchForm.resetFields();
         if (val) {
           this.searchForm.resource_key = val;
@@ -181,9 +167,7 @@ export default {
     },
     handleExceed(files, fileList) {
       this.$message.warning(
-        `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
-          files.length + fileList.length
-        } 个文件`
+        `当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`
       );
     },
     handlePreview(file) {
@@ -223,8 +207,8 @@ export default {
 
   &-content {
     width: 100%;
-    margin: 0 auto;
     padding: 20px 0;
+    margin: 0 auto;
   }
 
   .submitBtn {

+ 6 - 12
src/views/upload/uploadList.vue

@@ -26,9 +26,7 @@
           <el-table-column fixed="right" label="操作" width="100">
             <template slot-scope="{ row }">
               <el-button size="small" type="text" @click="handleView(row)">查看</el-button>
-              <el-button size="small" type="text" @click="handleEdit(row.resource_key)">
-                编辑
-              </el-button>
+              <el-button size="small" type="text" @click="handleEdit(row.resource_key)">编辑</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -47,11 +45,7 @@
       </div>
     </div>
     <el-dialog :before-close="handleClose" :visible.sync="dialogFlag">
-      <upload-detail
-        :resource-key="resource_key"
-        :upload-type="uploadType"
-        @closeDialog="closeDialog"
-      ></upload-detail>
+      <upload-detail :resource-key="resource_key" :upload-type="uploadType" @closeDialog="closeDialog"></upload-detail>
     </el-dialog>
   </div>
 </template>
@@ -145,7 +139,7 @@ export default {
 </script>
 
 <style lang="scss" scope>
-@import '~@/styles/mixin.scss';
+@import '~@/styles/mixin';
 
 .book-vocab {
   width: 100%;
@@ -153,14 +147,14 @@ export default {
 
   &-content {
     width: 1200px;
-    margin: 0 auto;
     padding: 30px 0;
+    margin: 0 auto;
 
     &-create {
-      width: 100%;
       display: flex;
-      justify-content: flex-start;
       align-items: center;
+      justify-content: flex-start;
+      width: 100%;
       margin-bottom: 20px;
     }
 

+ 4 - 4
src/views/vocabulary/index.vue

@@ -120,7 +120,7 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-@import '~@/styles/mixin.scss';
+@import '~@/styles/mixin';
 
 .book-vocab {
   width: 100%;
@@ -128,14 +128,14 @@ export default {
 
   &-content {
     width: 1200px;
-    margin: 0 auto;
     padding: 30px 0;
+    margin: 0 auto;
 
     &-create {
-      width: 100%;
       display: flex;
-      justify-content: flex-start;
       align-items: center;
+      justify-content: flex-start;
+      width: 100%;
       margin-bottom: 20px;
     }
 

+ 5 - 7
src/views/vocabulary/vocabDetail.vue

@@ -41,9 +41,7 @@
           </el-table-column>
           <el-table-column fixed="right" label="操作" width="120">
             <template slot-scope="scope">
-              <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">
-                删除
-              </el-button>
+              <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)"> 删除 </el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -174,25 +172,25 @@ export default {
 
   &-content {
     width: 1200px;
-    margin: 0 auto;
     padding: 30px 0;
+    margin: 0 auto;
 
     .changeLang {
       margin-right: 10px;
     }
 
     &-create {
-      width: 100%;
       display: flex;
-      justify-content: flex-start;
       align-items: center;
+      justify-content: flex-start;
+      width: 100%;
       margin-bottom: 20px;
     }
 
     &-search {
       display: flex;
-      justify-content: space-between;
       align-items: flex-start;
+      justify-content: space-between;
     }
 
     &-table {