ソースを参照

更新多语言

gcj 3 年 前
コミット
675c698e23

+ 15 - 3
src/permission.js

@@ -33,13 +33,21 @@ router.beforeEach(async (to, from, next) => {
           next()
         } catch (error) {
           Message.error(error || 'Has Error')
-          next(`/login?redirect=${to.path}`)
+          if (process.env.NODE_ENV == "development") {
+            next(`/login?redirect=${to.path}`)
+          } else {
+            window.location.href = "/"
+          }
           NProgress.done()
         }
       }
     } else {
       removeToken();
-      next(`/login?redirect=${to.path}`)
+      if (process.env.NODE_ENV == "development") {
+        next(`/login?redirect=${to.path}`)
+      } else {
+        window.location.href = "/"
+      }
       NProgress.done()
     }
     //=======重点部分以上=======
@@ -51,7 +59,11 @@ router.beforeEach(async (to, from, next) => {
       next()
     } else {
       // other pages that do not have permission to access are redirected to the login page.
-      next(`/login?redirect=${to.path}`)
+      if (process.env.NODE_ENV == "development") {
+        next(`/login?redirect=${to.path}`)
+      } else {
+        window.location.href = "/"
+      }
       NProgress.done()
     }
   }

+ 33 - 11
src/views/teacher-devEntering/creadDocument.vue

@@ -5,9 +5,13 @@
     v-if="isData"
   >
     <Header />
-    <Nav title="创建文档" />
+    <!-- 创建文档 -->
+    <Nav :title="$t('Key551')" />
     <div class="title">
-      <div>创建文档</div>
+      <div>
+        <!-- 创建文档 -->
+        {{ $t("Key551") }}
+      </div>
       <div class="btn">
         <!-- 完成 -->
         <el-button
@@ -34,19 +38,21 @@
         >
           <!-- 文档 -->
           <el-form-item :label="$t('Key225')" prop="name">
+            <!-- 请输入文档名称 -->
             <el-input
               v-model="form.name"
               style="width: 500px"
-              placeholder="请输入文档名称"
+              :placeholder="$t('Key552')"
               @change="form.name = form.name.trim()"
             ></el-input>
           </el-form-item>
           <!-- 作者 -->
           <el-form-item :label="$t('Key227')" prop="author">
+            <!-- 多个作者请用逗号隔开 -->
             <el-input
               v-model="form.author"
               style="width: 500px"
-              placeholder="多个作者请用逗号隔开"
+              :placeholder="$t('Key553')"
               @change="authorChange"
             ></el-input>
           </el-form-item>
@@ -90,11 +96,16 @@
           <!-- 分类 -->
           <el-form-item :label="$t('Key243')" prop="classify">
             <el-radio-group v-model="form.classify">
-              <el-radio label="TEXTBOOK">教辅资料</el-radio>
+              <el-radio label="TEXTBOOK">
+                <!-- 教辅资料 -->{{ $t("Key554") }}</el-radio
+              >
               <el-radio label="TEACHING">
                 <!-- 教研资料 -->{{ $t("Key214") }}
               </el-radio>
-              <el-radio label="TOOLBOOK">工具书</el-radio>
+              <el-radio label="TOOLBOOK">
+                <!-- 工具书 -->
+                {{ $t("Key554") }}
+              </el-radio>
             </el-radio-group>
           </el-form-item>
           <!-- 文档 -->
@@ -175,7 +186,7 @@ export default {
     // 预览
     preview() {
       if (!this.isSubmit) {
-        this.$message.warning("请先保存再预览");
+        this.$message.warning(this.$t("Key556")); //"请先保存再预览"
         return;
       }
       const { href } = this.$router.resolve({
@@ -224,17 +235,17 @@ export default {
         }
       });
       if (flag) {
-        this.$message.warning("请填写完整");
+        this.$message.warning(this.$t("Key605")); //"请填写完整"
         this.loading = false;
         return;
       }
       if ((this.form.price * 1).toString() == "NaN") {
-        this.$message.warning("价格必须为数字");
+        this.$message.warning(this.$t("Key557")); //"价格必须为数字"
         this.loading = false;
         return;
       }
       if (this.form.fileList.length == 0) {
-        this.$message.warning("请上传文件");
+        this.$message.warning(this.$t("Key558")); // "请上传文件"
         this.loading = false;
         return;
       }
@@ -350,7 +361,8 @@ export default {
         .then((res) => {
           if (res.data.result.status == 4) {
             this.$router.push("/teacherdevEntering");
-            this.$message.warning("此课程处于上架状态不可以进行编辑");
+            // "此课程处于上架状态不可以进行编辑"
+            this.$message.warning(this.$t("Key559"));
             return;
           }
           for (let key in this.form) {
@@ -406,6 +418,16 @@ export default {
         "Key245",
         "Key246",
         "Key82",
+        "Key551",
+        "Key552",
+        "Key553",
+        "Key554",
+        "Key555",
+        "Key556",
+        "Key557",
+        "Key558",
+        "Key559",
+        "Key605",
       ],
     });
     this.isData = true;

+ 20 - 15
src/views/teacher-devEntering/discountCodeList.vue

@@ -77,19 +77,19 @@
           ></el-table-column>
           <!-- 使用者 -->
           <el-table-column
-            :label="$t('Key566')"
+            :label="$t('Key569')"
             prop="consumer_name"
             width="150"
           ></el-table-column>
           <!-- 使用时间 -->
           <el-table-column
-            :label="$t('Key567')"
+            :label="$t('Key568')"
             prop="use_time"
             width="200"
           ></el-table-column>
           <!-- 使用者所属机构 -->
           <el-table-column
-            label="使用者所属机构"
+            :label="$t('Key569')"
             prop="consumer_org_name"
             width="250"
           ></el-table-column>
@@ -103,9 +103,9 @@
           <el-table-column fixed="right" :label="$t('Key166')" prop width="100">
             <template slot-scope="scope">
               <!-- 删除 -->
-              <el-button @click="handleDel(scope.row)" type="text"
-                >删除</el-button
-              >
+              <el-button @click="handleDel(scope.row)" type="text">{{
+                $t("Key172")
+              }}</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -146,10 +146,7 @@ export default {
       page_capacity: 10, // 每页条数
       courseTotal: 0, // 数据总条数
       tableloading: true,
-      usedStatus: {
-        true: "已使用",
-        false: "未使用",
-      },
+      usedStatus: null,
       exportRadio: -1,
       exportLoading: false,
       goods_type: null,
@@ -163,11 +160,15 @@ export default {
         "Key8",
         "Key9",
         "Key39",
+        "Key83",
+        "Key94",
         "Key110",
         "Key164",
         "Key163",
         "Key166",
         "Key232",
+        "Key361",
+        "Key532",
         "Key560",
         "Key561",
         "Key562",
@@ -182,6 +183,10 @@ export default {
     });
 
     const _this = this;
+    _this.usedStatus = {
+      true: this.$t("Key564"), //"已使用",
+      false: this.$t("Key565"), //"未使用",
+    };
     _this.isData = true;
     _this.bookId = this.$route.query.bookId;
     _this.goods_type = this.$route.query.goods_type;
@@ -225,7 +230,7 @@ export default {
         this.$message(
           {
             type: "warning",
-            message: "请输入生成激活码数量!",
+            message: this.$t("Key561"), //"请输入生成激活码数量!",
           },
           2000
         );
@@ -257,9 +262,9 @@ export default {
     },
     // 删除书籍
     handleDel(row) {
-      this.$confirm("确定要删除此优惠码吗?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
+      this.$confirm("确定要删除此优惠码吗?", this.$t("Key361"), {
+        confirmButtonText: this.$t("Key94"), //"确定",
+        cancelButtonText: this.$t("Key83"), //"取消",
         type: "warning",
       })
         .then(() => {
@@ -275,7 +280,7 @@ export default {
               this.getList();
               this.$message({
                 type: "success",
-                message: "删除成功!",
+                message: this.$t("Key532"), //"删除成功!",
               });
             })
             .catch(() => {});

+ 123 - 123
vue.config.js

@@ -4,7 +4,7 @@ const defaultSettings = require('./src/settings.js')
 const CompressionPlugin = require('compression-webpack-plugin');
 
 function resolve(dir) {
-    return path.join(__dirname, dir)
+  return path.join(__dirname, dir)
 }
 
 const name = defaultSettings.title || '教研中心' // page title
@@ -15,132 +15,132 @@ const name = defaultSettings.title || '教研中心' // page title
 // You can change the port by the following methods:
 // port = 9528 npm run dev OR npm run dev --port = 9528
 const port = process.env.port || process.env.npm_config_port || 9590 // dev port
-    // All configuration item explanations can be find in https://cli.vuejs.org/config/
+// All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {
-    /**
-     * You will need to set publicPath if you plan to deploy your site under a sub path,
-     * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
-     * then publicPath should be set to "/bar/".
-     * In most cases please use '/' !!!
-     * Detail: https://cli.vuejs.org/config/#publicpath
-     */
-    publicPath: process.env.NODE_ENV === 'development' ? '/' : '/GCLS-TC',
-    // publicPath: '/',
-    outputDir: 'dist',
-    assetsDir: 'static',
-    lintOnSave: false,
-    productionSourceMap: false,
-    devServer: {
-        port: port,
-        open: true,
-        overlay: {
-            warnings: false,
-            errors: true
-        },
-        proxy: {
-            // change xxx-api/login => mock/login
-            // detail: https://cli.vuejs.org/config/#devserver-proxy
-            // http://mk.wmjh.cn
-            [process.env.VUE_APP_BASE_API]: {
-                target: `https://gcls.helxsoft.cn`,
-                changeOrigin: true,
-                pathRewrite: {
-                    ['^' + process.env.VUE_APP_BASE_API]: ''
-                }
-            },
-            [process.env.VUE_APP_PDF_API]: {
-                target: `https://gcls.helxsoft.cn`,
-                changeOrigin: true,
-                pathRewrite: {
-                    ['^' + process.env.VUE_APP_PDF_API]: '/'
-                }
-            }
-        },
-        after: require('./mock/mock-server.js')
+  /**
+   * You will need to set publicPath if you plan to deploy your site under a sub path,
+   * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
+   * then publicPath should be set to "/bar/".
+   * In most cases please use '/' !!!
+   * Detail: https://cli.vuejs.org/config/#publicpath
+   */
+  publicPath: process.env.NODE_ENV === 'development' ? '/' : '/GCLS-TC',
+  // publicPath: '/',
+  outputDir: 'dist',
+  assetsDir: 'static',
+  lintOnSave: false,
+  productionSourceMap: false,
+  devServer: {
+    port: port,
+    open: true,
+    overlay: {
+      warnings: false,
+      errors: true
     },
-    configureWebpack: {
-        // provide the app's title in webpack's name field, so that
-        // it can be accessed in index.html to inject the correct title.
-        name: name,
-        resolve: {
-            alias: {
-                '@': resolve('src')
-            }
-        },
-        plugins: [
-            new CompressionPlugin({
-                algorithm: 'gzip', // 使用gzip压缩
-                test: /\.js$|\.html$|\.css$/, // 匹配文件名
-                minRatio: 0.8, // 压缩率小于0.8才会压缩
-                threshold: 10240, // 对超过10k的数据压缩
-                deleteOriginalAssets: false // 是否删除未压缩的源文件,谨慎设置,如果希望提供非gzip的资源,可不设置或者设置为false(比如删除打包后的gz后还可以加载到原始资源文件)
-            })
-        ]
+    proxy: {
+      // change xxx-api/login => mock/login
+      // detail: https://cli.vuejs.org/config/#devserver-proxy
+      // http://mk.wmjh.cn
+      [process.env.VUE_APP_BASE_API]: {
+        target: `https://gcls.utschool.cn`,
+        changeOrigin: true,
+        pathRewrite: {
+          ['^' + process.env.VUE_APP_BASE_API]: ''
+        }
+      },
+      [process.env.VUE_APP_PDF_API]: {
+        target: `https://gcls.helxsoft.cn`,
+        changeOrigin: true,
+        pathRewrite: {
+          ['^' + process.env.VUE_APP_PDF_API]: '/'
+        }
+      }
     },
-    chainWebpack(config) {
-        // it can improve the speed of the first screen, it is recommended to turn on preload
-        config.plugin('preload').tap(() => [{
-            rel: 'preload',
-            // to ignore runtime.js
-            // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
-            fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
-            include: 'initial'
-        }])
+    after: require('./mock/mock-server.js')
+  },
+  configureWebpack: {
+    // provide the app's title in webpack's name field, so that
+    // it can be accessed in index.html to inject the correct title.
+    name: name,
+    resolve: {
+      alias: {
+        '@': resolve('src')
+      }
+    },
+    plugins: [
+      new CompressionPlugin({
+        algorithm: 'gzip', // 使用gzip压缩
+        test: /\.js$|\.html$|\.css$/, // 匹配文件名
+        minRatio: 0.8, // 压缩率小于0.8才会压缩
+        threshold: 10240, // 对超过10k的数据压缩
+        deleteOriginalAssets: false // 是否删除未压缩的源文件,谨慎设置,如果希望提供非gzip的资源,可不设置或者设置为false(比如删除打包后的gz后还可以加载到原始资源文件)
+      })
+    ]
+  },
+  chainWebpack(config) {
+    // it can improve the speed of the first screen, it is recommended to turn on preload
+    config.plugin('preload').tap(() => [{
+      rel: 'preload',
+      // to ignore runtime.js
+      // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
+      fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
+      include: 'initial'
+    }])
 
-        // when there are many pages, it will cause too many meaningless requests
-        config.plugins.delete('prefetch')
+    // when there are many pages, it will cause too many meaningless requests
+    config.plugins.delete('prefetch')
 
-        // set svg-sprite-loader
-        config.module
-            .rule('svg')
-            .exclude.add(resolve('src/icons'))
-            .end()
-        config.module
-            .rule('icons')
-            .test(/\.svg$/)
-            .include.add(resolve('src/icons'))
-            .end()
-            .use('svg-sprite-loader')
-            .loader('svg-sprite-loader')
-            .options({
-                symbolId: 'icon-[name]'
-            })
-            .end()
+    // set svg-sprite-loader
+    config.module
+      .rule('svg')
+      .exclude.add(resolve('src/icons'))
+      .end()
+    config.module
+      .rule('icons')
+      .test(/\.svg$/)
+      .include.add(resolve('src/icons'))
+      .end()
+      .use('svg-sprite-loader')
+      .loader('svg-sprite-loader')
+      .options({
+        symbolId: 'icon-[name]'
+      })
+      .end()
 
-        config.when(process.env.NODE_ENV !== 'development', config => {
-            config
-                .plugin('ScriptExtHtmlWebpackPlugin')
-                .after('html')
-                .use('script-ext-html-webpack-plugin', [{
-                    // `runtime` must same as runtimeChunk name. default is `runtime`
-                    inline: /runtime\..*\.js$/
-                }])
-                .end()
-            config.optimization.splitChunks({
-                    chunks: 'all',
-                    cacheGroups: {
-                        libs: {
-                            name: 'chunk-libs',
-                            test: /[\\/]node_modules[\\/]/,
-                            priority: 10,
-                            chunks: 'initial' // only package third parties that are initially dependent
-                        },
-                        elementUI: {
-                            name: 'chunk-elementUI', // split elementUI into a single package
-                            priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
-                            test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
-                        },
-                        commons: {
-                            name: 'chunk-commons',
-                            test: resolve('src/components'), // can customize your rules
-                            minChunks: 3, //  minimum common number
-                            priority: 5,
-                            reuseExistingChunk: true
-                        }
-                    }
-                })
-                // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
-            config.optimization.runtimeChunk('single')
-        })
-    }
+    config.when(process.env.NODE_ENV !== 'development', config => {
+      config
+        .plugin('ScriptExtHtmlWebpackPlugin')
+        .after('html')
+        .use('script-ext-html-webpack-plugin', [{
+          // `runtime` must same as runtimeChunk name. default is `runtime`
+          inline: /runtime\..*\.js$/
+        }])
+        .end()
+      config.optimization.splitChunks({
+        chunks: 'all',
+        cacheGroups: {
+          libs: {
+            name: 'chunk-libs',
+            test: /[\\/]node_modules[\\/]/,
+            priority: 10,
+            chunks: 'initial' // only package third parties that are initially dependent
+          },
+          elementUI: {
+            name: 'chunk-elementUI', // split elementUI into a single package
+            priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
+            test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
+          },
+          commons: {
+            name: 'chunk-commons',
+            test: resolve('src/components'), // can customize your rules
+            minChunks: 3, //  minimum common number
+            priority: 5,
+            reuseExistingChunk: true
+          }
+        }
+      })
+      // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
+      config.optimization.runtimeChunk('single')
+    })
+  }
 }