Browse Source

升级项目

dusenyao 2 years ago
parent
commit
d1ee3a0e6d
21 changed files with 1998 additions and 1986 deletions
  1. 4 0
      .eslintignore
  2. 308 0
      .eslintrc.js
  3. 8 0
      .prettierrc.js
  4. 6 0
      .stylelintignore
  5. 8 4
      babel.config.js
  6. BIN
      dist.rar
  7. 12 0
      jsconfig.json
  8. 0 57
      mock/index.js
  9. 0 81
      mock/mock-server.js
  10. 0 29
      mock/table.js
  11. 0 84
      mock/user.js
  12. 0 25
      mock/utils.js
  13. 753 544
      package-lock.json
  14. 74 76
      package.json
  15. 2 3
      src/api/api.js
  16. 213 313
      src/views/Textanalysis/index.vue
  17. 193 313
      src/views/corpus/Result.vue
  18. 115 202
      src/views/teacher-dev/Preview.vue
  19. 101 122
      src/views/teacher-dev/TextAnalysis.vue
  20. 79 0
      stylelint.config.js
  21. 122 133
      vue.config.js

+ 4 - 0
.eslintignore

@@ -0,0 +1,4 @@
+build/*.js
+src/assets
+public
+dist

+ 308 - 0
.eslintrc.js

@@ -0,0 +1,308 @@
+module.exports = {
+  root: true,
+
+  // 为什么是这样的parser配置?https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
+  parser: 'vue-eslint-parser',
+  parserOptions: {
+    parser: '@babel/eslint-parser',
+    sourceType: 'module',
+    ecmaVersion: 7,
+    ecmaFeatures: {
+      impliedStrict: true,
+    },
+  },
+
+  globals: {
+    Rtc: true,
+    DocumentUpload: true,
+  },
+
+  env: {
+    node: true,
+    browser: true,
+  },
+
+  extends: [
+    'eslint:recommended',
+    'plugin:vue/recommended',
+    'plugin:prettier/recommended',
+    '@vue/eslint-config-prettier',
+  ],
+
+  plugins: [
+    // 注意这里不能配置 html 选项,为什么?https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files
+    'vue',
+    'prettier',
+  ],
+
+  rules: {
+    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
+    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
+    'vue/multi-word-component-names': 0,
+    'vue/max-attributes-per-line': [
+      2,
+      {
+        singleline: 8,
+        multiline: {
+          max: 1,
+        },
+      },
+    ],
+    'vue/html-self-closing': [
+      1,
+      {
+        html: {
+          void: 'always',
+          normal: 'never',
+          component: 'always',
+        },
+        svg: 'always',
+        math: 'always',
+      },
+    ],
+    'accessor-pairs': 2,
+    'arrow-spacing': [
+      2,
+      {
+        before: true,
+        after: true,
+      },
+    ],
+    'block-spacing': [2, 'always'],
+    'brace-style': [
+      2,
+      '1tbs',
+      {
+        allowSingleLine: true,
+      },
+    ],
+    camelcase: [
+      0,
+      {
+        properties: 'always',
+      },
+    ],
+    'comma-dangle': [0],
+    'comma-spacing': [
+      2,
+      {
+        before: false,
+        after: true,
+      },
+    ],
+    'comma-style': [2, 'last'],
+    curly: [2, 'multi-line'],
+    'dot-location': [2, 'property'],
+    'eol-last': 2,
+    eqeqeq: [2, 'always'],
+    'generator-star-spacing': [
+      2,
+      {
+        before: false,
+        after: true,
+      },
+    ],
+    indent: [
+      2,
+      2,
+      {
+        SwitchCase: 1,
+      },
+    ],
+    'jsx-quotes': [2, 'prefer-single'],
+    'key-spacing': [
+      2,
+      {
+        beforeColon: false,
+        afterColon: true,
+      },
+    ],
+    'keyword-spacing': [
+      2,
+      {
+        before: true,
+        after: true,
+      },
+    ],
+    'new-cap': [
+      2,
+      {
+        newIsCap: true,
+        capIsNew: false,
+      },
+    ],
+    'no-caller': 2,
+    'no-eval': 2,
+    'no-labels': [
+      2,
+      {
+        allowLoop: false,
+        allowSwitch: false,
+      },
+    ],
+    'no-multi-spaces': 2,
+    'no-multiple-empty-lines': [
+      2,
+      {
+        max: 1,
+      },
+    ],
+    'no-return-assign': [2, 'except-parens'],
+    'no-sequences': 2,
+    'no-trailing-spaces': 2,
+    'no-unmodified-loop-condition': 2,
+    'no-unneeded-ternary': [
+      2,
+      {
+        defaultAssignment: false,
+      },
+    ],
+    'no-unused-vars': [1],
+    'no-useless-computed-key': 2,
+    'no-useless-constructor': 2,
+    'no-whitespace-before-property': 2,
+    'one-var': [
+      2,
+      {
+        initialized: 'never',
+      },
+    ],
+    'operator-linebreak': [
+      2,
+      'after',
+      {
+        overrides: {
+          '?': 'before',
+          ':': 'before',
+        },
+      },
+    ],
+    'padded-blocks': [2, 'never'],
+    quotes: [
+      2,
+      'single',
+      {
+        avoidEscape: true,
+        allowTemplateLiterals: true,
+      },
+    ],
+    semi: [2, 'always'],
+    'semi-spacing': [
+      2,
+      {
+        before: false,
+        after: true,
+      },
+    ],
+    'space-before-blocks': [2, 'always'],
+    'space-in-parens': [2, 'never'],
+    'space-infix-ops': 2,
+    'space-unary-ops': [
+      2,
+      {
+        words: true,
+        nonwords: false,
+      },
+    ],
+    'spaced-comment': [
+      2,
+      'always',
+      {
+        markers: ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','],
+      },
+    ],
+    'template-curly-spacing': [2, 'never'],
+    'wrap-iife': [2, 'any'],
+    'yield-star-spacing': [2, 'both'],
+    'object-curly-spacing': [2, 'always'],
+    'no-alert': process.env.NODE_ENV === 'production' ? 1 : 0,
+    'no-array-constructor': 2,
+    'no-bitwise': 1,
+    'no-div-regex': 1,
+    'no-else-return': 2,
+    'no-empty': 1,
+    'no-eq-null': 2,
+    'no-extend-native': 2,
+    'no-multi-assign': 1,
+    'no-negated-condition': 2,
+    'no-duplicate-imports': 2,
+    'no-extra-bind': 2,
+    'no-tabs': 2,
+    'no-extra-parens': [2, 'functions'],
+    'no-floating-decimal': 2,
+    'no-implicit-coercion': 1,
+    'no-implied-eval': 2,
+    'no-inline-comments': 0,
+    'no-invalid-this': 2,
+    'no-iterator': 2,
+    'no-label-var': 2,
+    'no-lone-blocks': 2,
+    'no-lonely-if': 2,
+    'linebreak-style': [0, 'windows'],
+    'no-multi-str': 2,
+    'no-nested-ternary': 0,
+    'no-new': 1,
+    'no-new-func': 1,
+    'no-new-object': 2,
+    'no-new-wrappers': 2,
+    'no-octal-escape': 2,
+    'no-param-reassign': 2,
+    'no-plusplus': [1, { allowForLoopAfterthoughts: true }],
+    'no-proto': 2,
+    'no-self-compare': 2,
+    'func-call-spacing': 2,
+    'no-ternary': 0,
+    'no-throw-literal': 2,
+    'no-undef-init': 2,
+    'no-use-before-define': 2,
+    'no-useless-call': 2,
+    'no-void': 2,
+    'no-var': 2,
+    'prefer-rest-params': 2,
+    'prefer-template': 2,
+    'no-warning-comments': [
+      1,
+      {
+        terms: ['todo', 'fix', '!', '?'],
+        location: 'start',
+      },
+    ],
+    'array-bracket-spacing': [2, 'never'],
+    'computed-property-spacing': [1, 'never'],
+    'consistent-return': 0,
+    'default-case': 1,
+    'func-names': 1,
+    'func-style': 0,
+    'guard-for-in': 0,
+    'id-length': 0,
+    'init-declarations': 1,
+    'lines-around-comment': 0,
+    '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': 1,
+    'operator-assignment': 1,
+    'prefer-spread': 1,
+    'quote-props': [1, 'as-needed'],
+    radix: [1, 'as-needed'],
+    'id-match': 0,
+    'sort-vars': [1, { ignoreCase: true }],
+    strict: 2,
+    'vars-on-top': 2,
+    'wrap-regex': 0,
+    yoda: [2, 'never'],
+  },
+
+  // jest 测试配置
+  overrides: [
+    {
+      files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
+      env: {
+        jest: true,
+      },
+    },
+  ],
+};

+ 8 - 0
.prettierrc.js

@@ -0,0 +1,8 @@
+module.exports = {
+  tabWidth: 2,
+  printWidth: 120,
+  semi: true,
+  singleQuote: true,
+  endOfLine: 'auto',
+  arrowParens: 'always'
+};

+ 6 - 0
.stylelintignore

@@ -0,0 +1,6 @@
+public/**
+src/assets/**
+node_modules/*
+
+tests
+dist

+ 8 - 4
babel.config.js

@@ -1,5 +1,9 @@
 module.exports = {
-  presets: [
-    '@vue/cli-plugin-babel/preset'
-  ]
-}
+  presets: ['@vue/cli-plugin-babel/preset'],
+  env: {
+    development: {
+      // 解决Vue热加载编译速度慢问题
+      plugins: ['dynamic-import-node'],
+    },
+  },
+};

BIN
dist.rar


+ 12 - 0
jsconfig.json

@@ -0,0 +1,12 @@
+{
+  "compilerOptions": {
+    "baseUrl": "./",
+    "paths": {
+      "@/*": ["src/*"]
+    }
+  },
+  "exclude": ["node_modules", "dist"],
+  "vueCompilerOptions": {
+    "target": 2
+  }
+}

+ 0 - 57
mock/index.js

@@ -1,57 +0,0 @@
-const Mock = require('mockjs')
-const { param2Obj } = require('./utils')
-
-const user = require('./user')
-const table = require('./table')
-
-const mocks = [
-  ...user,
-  ...table
-]
-
-// for front mock
-// please use it cautiously, it will redefine XMLHttpRequest,
-// which will cause many of your third-party libraries to be invalidated(like progress event).
-function mockXHR() {
-  // mock patch
-  // https://github.com/nuysoft/Mock/issues/300
-  Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
-  Mock.XHR.prototype.send = function() {
-    if (this.custom.xhr) {
-      this.custom.xhr.withCredentials = this.withCredentials || false
-
-      if (this.responseType) {
-        this.custom.xhr.responseType = this.responseType
-      }
-    }
-    this.proxy_send(...arguments)
-  }
-
-  function XHR2ExpressReqWrap(respond) {
-    return function(options) {
-      let result = null
-      if (respond instanceof Function) {
-        const { body, type, url } = options
-        // https://expressjs.com/en/4x/api.html#req
-        result = respond({
-          method: type,
-          body: JSON.parse(body),
-          query: param2Obj(url)
-        })
-      } else {
-        result = respond
-      }
-      return Mock.mock(result)
-    }
-  }
-
-  for (const i of mocks) {
-    Mock.mock(new RegExp(i.url), i.type || 'get', XHR2ExpressReqWrap(i.response))
-  }
-}
-
-module.exports = {
-  mocks,
-  mockXHR
-}
-

+ 0 - 81
mock/mock-server.js

@@ -1,81 +0,0 @@
-const chokidar = require('chokidar')
-const bodyParser = require('body-parser')
-const chalk = require('chalk')
-const path = require('path')
-const Mock = require('mockjs')
-
-const mockDir = path.join(process.cwd(), 'mock')
-
-function registerRoutes(app) {
-  let mockLastIndex
-  const { mocks } = require('./index.js')
-  const mocksForServer = mocks.map(route => {
-    return responseFake(route.url, route.type, route.response)
-  })
-  for (const mock of mocksForServer) {
-    app[mock.type](mock.url, mock.response)
-    mockLastIndex = app._router.stack.length
-  }
-  const mockRoutesLength = Object.keys(mocksForServer).length
-  return {
-    mockRoutesLength: mockRoutesLength,
-    mockStartIndex: mockLastIndex - mockRoutesLength
-  }
-}
-
-function unregisterRoutes() {
-  Object.keys(require.cache).forEach(i => {
-    if (i.includes(mockDir)) {
-      delete require.cache[require.resolve(i)]
-    }
-  })
-}
-
-// for mock server
-const responseFake = (url, type, respond) => {
-  return {
-    url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
-    type: type || 'get',
-    response(req, res) {
-      console.log('request invoke:' + req.path)
-      res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
-    }
-  }
-}
-
-module.exports = app => {
-  // parse app.body
-  // https://expressjs.com/en/4x/api.html#req.body
-  app.use(bodyParser.json())
-  app.use(bodyParser.urlencoded({
-    extended: true
-  }))
-
-  const mockRoutes = registerRoutes(app)
-  var mockRoutesLength = mockRoutes.mockRoutesLength
-  var mockStartIndex = mockRoutes.mockStartIndex
-
-  // watch files, hot reload mock server
-  chokidar.watch(mockDir, {
-    ignored: /mock-server/,
-    ignoreInitial: true
-  }).on('all', (event, path) => {
-    if (event === 'change' || event === 'add') {
-      try {
-        // remove mock routes stack
-        app._router.stack.splice(mockStartIndex, mockRoutesLength)
-
-        // clear routes cache
-        unregisterRoutes()
-
-        const mockRoutes = registerRoutes(app)
-        mockRoutesLength = mockRoutes.mockRoutesLength
-        mockStartIndex = mockRoutes.mockStartIndex
-
-        console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed  ${path}`))
-      } catch (error) {
-        console.log(chalk.redBright(error))
-      }
-    }
-  })
-}

+ 0 - 29
mock/table.js

@@ -1,29 +0,0 @@
-const Mock = require('mockjs')
-
-const data = Mock.mock({
-  'items|30': [{
-    id: '@id',
-    title: '@sentence(10, 20)',
-    'status|1': ['published', 'draft', 'deleted'],
-    author: 'name',
-    display_time: '@datetime',
-    pageviews: '@integer(300, 5000)'
-  }]
-})
-
-module.exports = [
-  {
-    url: '/vue-admin-template/table/list',
-    type: 'get',
-    response: config => {
-      const items = data.items
-      return {
-        code: 20000,
-        data: {
-          total: items.length,
-          items: items
-        }
-      }
-    }
-  }
-]

+ 0 - 84
mock/user.js

@@ -1,84 +0,0 @@
-
-const tokens = {
-  admin: {
-    token: 'admin-token'
-  },
-  editor: {
-    token: 'editor-token'
-  }
-}
-
-const users = {
-  'admin-token': {
-    roles: ['admin'],
-    introduction: 'I am a super administrator',
-    avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
-    name: 'Super Admin'
-  },
-  'editor-token': {
-    roles: ['editor'],
-    introduction: 'I am an editor',
-    avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
-    name: 'Normal Editor'
-  }
-}
-
-module.exports = [
-  // user login
-  {
-    url: '/vue-admin-template/user/login',
-    type: 'post',
-    response: config => {
-      const { username } = config.body
-      const token = tokens[username]
-
-      // mock error
-      if (!token) {
-        return {
-          code: 60204,
-          message: 'Account and password are incorrect.'
-        }
-      }
-
-      return {
-        code: 20000,
-        data: token
-      }
-    }
-  },
-
-  // get user info
-  {
-    url: '/vue-admin-template/user/info\.*',
-    type: 'get',
-    response: config => {
-      const { token } = config.query
-      const info = users[token]
-
-      // mock error
-      if (!info) {
-        return {
-          code: 50008,
-          message: 'Login failed, unable to get user details.'
-        }
-      }
-
-      return {
-        code: 20000,
-        data: info
-      }
-    }
-  },
-
-  // user logout
-  {
-    url: '/vue-admin-template/user/logout',
-    type: 'post',
-    response: _ => {
-      return {
-        code: 20000,
-        data: 'success'
-      }
-    }
-  }
-]

+ 0 - 25
mock/utils.js

@@ -1,25 +0,0 @@
-/**
- * @param {string} url
- * @returns {Object}
- */
-function param2Obj(url) {
-  const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
-  if (!search) {
-    return {}
-  }
-  const obj = {}
-  const searchArr = search.split('&')
-  searchArr.forEach(v => {
-    const index = v.indexOf('=')
-    if (index !== -1) {
-      const name = v.substring(0, index)
-      const val = v.substring(index + 1, v.length)
-      obj[name] = val
-    }
-  })
-  return obj
-}
-
-module.exports = {
-  param2Obj
-}

File diff suppressed because it is too large
+ 753 - 544
package-lock.json


+ 74 - 76
package.json

@@ -1,78 +1,76 @@
 {
-    "name": "teacher-train",
-    "version": "0.1.0",
-    "private": true,
-    "scripts": {
-        "serve": "vue-cli-service serve",
-        "build": "vue-cli-service build",
-        "lint": "vue-cli-service lint",
-        "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
-    },
-    "dependencies": {
-        "@tinymce/tinymce-vue": "^3.2.8",
-        "axios": "^0.21.1",
-        "core-js": "^3.6.5",
-        "echarts": "^5.3.3",
-        "element-ui": "^2.15.1",
-        "emoji-vue": "^0.2.4",
-        "file-saver": "^2.0.5",
-        "hanzi-writer": "^3.4.0",
-        "html-docx-js": "^0.3.1",
-        "html2canvas": "^1.4.1",
-        "jquery": "^3.6.0",
-        "js-cookie": "^2.2.1",
-        "js-md5": "^0.7.3",
-        "jspdf": "^2.5.1",
-        "mockjs": "^1.1.0",
-        "node-sass": "^4.14.1",
-        "nprogress": "^0.2.0",
-        "opencc-js": "^1.0.4",
-        "sass-loader": "^9.0.0",
-        "script-ext-html-webpack-plugin": "^2.1.5",
-        "script-loader": "^0.7.2",
-        "tinymce": "^5.7.1",
-        "tui-image-editor": "^3.15.3",
-        "vue": "^2.6.11",
-        "vue-i18n": "^8.24.5",
-        "vue-pdf": "^4.2.0",
-        "vue-router": "^3.2.0",
-        "vuex": "^3.4.0",
-        "xlsx": "^0.17.4",
-        "ztree": "^3.5.24"
-    },
-    "devDependencies": {
-        "@vue/cli-plugin-babel": "~4.5.0",
-        "@vue/cli-plugin-eslint": "~4.5.0",
-        "@vue/cli-plugin-router": "~4.5.0",
-        "@vue/cli-plugin-vuex": "~4.5.0",
-        "@vue/cli-service": "~4.5.0",
-        "babel-eslint": "^10.1.0",
-        "compression-webpack-plugin": "^6.1.1",
-        "eslint": "^6.7.2",
-        "eslint-plugin-vue": "^6.2.2",
-        "svg-sprite-loader": "^6.0.11",
-        "svgo": "1.2.2",
-        "vue-template-compiler": "^2.6.11"
-    },
-    "eslintConfig": {
-        "root": true,
-        "env": {
-            "node": true
-        },
-        "extends": [
-            "plugin:vue/essential",
-            "eslint:recommended"
-        ],
-        "parserOptions": {
-            "parser": "babel-eslint"
-        },
-        "rules": {
-            "vue/no-unused-components": "off"
-        }
-    },
-    "browserslist": [
-        "> 1%",
-        "last 2 versions",
-        "not dead"
-    ]
+  "name": "teacher-train",
+  "version": "0.1.0",
+  "private": true,
+  "scripts": {
+    "dev": "vue-cli-service serve",
+    "build": "vue-cli-service build",
+    "lint": "vue-cli-service lint",
+    "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
+  },
+  "dependencies": {
+    "@tinymce/tinymce-vue": "^3.2.8",
+    "axios": "^0.21.4",
+    "canvg": "3.0.10",
+    "core-js": "^3.32.2",
+    "echarts": "^5.4.3",
+    "element-ui": "^2.15.14",
+    "emoji-vue": "^0.2.4",
+    "file-saver": "^2.0.5",
+    "hanzi-writer": "^3.4.0",
+    "html-docx-js": "^0.3.1",
+    "html2canvas": "^1.4.1",
+    "jquery": "^3.6.0",
+    "js-base64": "^3.7.5",
+    "js-cookie": "^2.2.1",
+    "js-md5": "^0.7.3",
+    "jspdf": "^2.5.1",
+    "nprogress": "^0.2.0",
+    "opencc-js": "^1.0.5",
+    "script-loader": "^0.7.2",
+    "tinymce": "^5.10.7",
+    "tui-color-picker": "^2.2.8",
+    "tui-image-editor": "^3.15.3",
+    "vue": "^2.6.14",
+    "vue-i18n": "^8.28.2",
+    "vue-pdf": "^4.3.0",
+    "vue-router": "^3.6.5",
+    "vuex": "^3.6.2",
+    "xlsx": "^0.17.5",
+    "ztree": "^3.5.24"
+  },
+  "devDependencies": {
+    "@babel/core": "^7.22.20",
+    "@babel/eslint-parser": "^7.22.15",
+    "@rushstack/eslint-patch": "^1.4.0",
+    "@vue/cli-plugin-babel": "~4.5.19",
+    "@vue/cli-plugin-eslint": "~4.5.19",
+    "@vue/cli-plugin-router": "~4.5.19",
+    "@vue/cli-plugin-vuex": "~4.5.19",
+    "@vue/cli-service": "~4.5.19",
+    "@vue/eslint-config-prettier": "^8.0.0",
+    "@vue/preload-webpack-plugin": "^2.0.0",
+    "compression-webpack-plugin": "^6.1.1",
+    "eslint": "^8.50.0",
+    "eslint-plugin-prettier": "^5.0.0",
+    "eslint-plugin-vue": "^9.17.0",
+    "prettier": "3.0.3",
+    "sass": "^1.68.0",
+    "sass-loader": "^10.4.1",
+    "stylelint": "^15.10.3",
+    "stylelint-config-recess-order": "^4.3.0",
+    "stylelint-config-recommended-scss": "^13.0.0",
+    "stylelint-config-recommended-vue": "^1.5.0",
+    "stylelint-config-standard-scss": "^11.0.0",
+    "stylelint-declaration-block-no-ignored-properties": "^2.7.0",
+    "stylelint-webpack-plugin": "^4.1.1",
+    "svg-sprite-loader": "^6.0.11",
+    "svgo": "3.0.2",
+    "vue-template-compiler": "^2.6.14"
+  },
+  "browserslist": [
+    "> 1%",
+    "last 2 versions",
+    "not dead"
+  ]
 }

+ 2 - 3
src/api/api.js

@@ -1,5 +1,4 @@
 import request from "../utils/request"
-import Cookies from "js-cookie";
 import { getToken } from "@/utils/auth"
 
 // 文件流 /GCLSFileServer/WebFileDownload?
@@ -113,7 +112,7 @@ export function LearnWebSI(MethodName, data) {
         data,
     })
 }
-// 根据id获取文件信息 
+// 根据id获取文件信息
 export function GetFillemessage(MethodName, data) {
     return request({
         url: `/GCLSFileServer/ServiceInterface?MethodName=${MethodName}`,
@@ -353,4 +352,4 @@ export function postapi(data) {
         data: data.data
     })
 }
-// 子登录
+// 子登录

File diff suppressed because it is too large
+ 213 - 313
src/views/Textanalysis/index.vue


File diff suppressed because it is too large
+ 193 - 313
src/views/corpus/Result.vue


+ 115 - 202
src/views/teacher-dev/Preview.vue

@@ -1,91 +1,40 @@
 <template>
   <!-- 预览 -->
-  <div
-    class="tarcer-dev-Preview"
-    v-loading="loading"
-    v-if="isData"
-  >
+  <div class="tarcer-dev-Preview" v-loading="loading" v-if="isData">
     <Header />
 
-    <HeaderOne
-      v-if="!Ispreview && data"
-      :text="data.name"
-      :allList="allList"
-    />
-    <div
-      class="main"
-      v-if="data"
-    >
+    <HeaderOne v-if="!Ispreview && data" :text="data.name" :allList="allList" />
+    <div class="main" v-if="data">
       <div class="flassify">
         <div class="text">
           <p class="p1">{{ data.name }}</p>
           <p class="p2">
-            {{$t('Key227')}}:
-            <span
-              v-for="(item, i) in data.teacher"
-              :key="i + item"
-            >
-              {{ item }}{{ i == data.teacher.length - 1 ? "" : "," }}
+            {{ $t('Key227') }}:
+            <span v-for="(item, i) in data.teacher" :key="i + item">
+              {{ item }}{{ i == data.teacher.length - 1 ? '' : ',' }}
             </span>
           </p>
           <!-- <p>{{ data.updateTime }}</p> -->
         </div>
-        <div
-          class="pay_collect"
-          v-if="!Ispreview"
-        >
-          <div
-            class="price"
-            v-if="!data.isPurchased"
-          >
+        <div class="pay_collect" v-if="!Ispreview">
+          <div class="price" v-if="!data.isPurchased">
             ¥
-            <span
-              class="price_1"
-              v-html="changePrice(data.price * 1, 24, 16)"
-            ></span>
-          </div>
-          <div
-            class="pay"
-            @click="buy"
-            v-if="!data.isPurchased"
-          >
-            <!-- 购买 -->{{ $t("Key72") }}
+            <span class="price_1" v-html="changePrice(data.price * 1, 24, 16)"></span>
           </div>
-          <div
-            class="download"
-            v-if="data.isPurchased && IsDownload"
-          >
-            <img
-              @click="download"
-              src="../../assets/teacherdev/download.png"
-              alt=""
-            />
+          <div class="pay" @click="buy" v-if="!data.isPurchased"><!-- 购买 -->{{ $t('Key72') }}</div>
+          <div class="download" v-if="data.isPurchased && IsDownload">
+            <img @click="download" src="../../assets/teacherdev/download.png" alt="" />
             <!-- <span>DOWNLOAD</span> -->
           </div>
           <div class="collect">
-            <img
-              @click="changeCollect"
-              v-show="!data.isFavorite"
-              src="../../assets/teacherdev/collect4.png"
-              alt=""
-            />
-            <img
-              @click="changeCollect"
-              v-show="data.isFavorite"
-              src="../../assets/teacherdev/collect3.png"
-              alt=""
-            />
+            <img @click="changeCollect" v-show="!data.isFavorite" src="../../assets/teacherdev/collect4.png" alt="" />
+            <img @click="changeCollect" v-show="data.isFavorite" src="../../assets/teacherdev/collect3.png" alt="" />
           </div>
         </div>
       </div>
       <div :class="data.isPurchased || Ispreview ? 'buy' : 'NObuy'">
         <!--fileUrl需要改成安全地址 file_url_https -->
-        <iframe
-          :src="attachment[0].newpath"
-          width="100%"
-          height="1000px"
-          id="ifm"
-        ></iframe>
+        <iframe :src="attachment[0].newpath" width="100%" height="1000px" id="ifm"></iframe>
         <!-- <object
           type="text/html"
           height="1000px"
@@ -122,25 +71,10 @@
           {{ i / numPages }}
         </pdf> -->
       </div>
-      <div
-        v-if="!data.isPurchased && !Ispreview"
-        @click="buy"
-        class="buyBtn"
-      >
-        <!-- 点击购买 -->{{ $t("Key574") }}
-      </div>
+      <div v-if="!data.isPurchased && !Ispreview" @click="buy" class="buyBtn"><!-- 点击购买 -->{{ $t('Key574') }}</div>
     </div>
-    <el-dialog
-      :visible.sync="NopymentShow"
-      width="720px"
-      :before-close="closeNoPyment"
-    >
-      <div
-        class="dialogTitle"
-        slot="title"
-      >
-        <!-- 商品详情 -->{{ $t("Key52") }}
-      </div>
+    <el-dialog :visible.sync="NopymentShow" width="720px" :before-close="closeNoPyment">
+      <div class="dialogTitle" slot="title"><!-- 商品详情 -->{{ $t('Key52') }}</div>
       <Confirmorder
         ref="Confirmorder"
         :data="data"
@@ -156,41 +90,31 @@
       width="720px"
       :before-close="closePyment"
     >
-      <Payment
-        :data="data"
-        :orderNumber="orderNumber"
-        :closePyment="closePyment"
-      />
+      <Payment :data="data" :orderNumber="orderNumber" :closePyment="closePyment" />
     </el-dialog>
   </div>
 </template>
 
 <script>
-import Header from "@/components/Header";
-import HeaderOne from "@/components/teacher-dev/HeaderOne";
-import pdf from "vue-pdf";
-import Confirmorder from "@/components/payment/Confirmorder";
-import Payment from "@/components/payment/Payment";
-import { updateWordPack } from "@/utils/i18n";
-import { getToken, getConfig } from "@/utils/auth";
+import Header from '@/components/Header';
+import HeaderOne from '@/components/teacher-dev/HeaderOne';
+import pdf from 'vue-pdf';
+import Confirmorder from '@/components/payment/Confirmorder';
+import Payment from '@/components/payment/Payment';
+import { updateWordPack } from '@/utils/i18n';
+import { getToken, getConfig } from '@/utils/auth';
 
-const Base64 = require("js-base64").Base64;
+const Base64 = require('js-base64').Base64;
 
-import {
-  materialdetail,
-  materialvisit,
-  LearnWebSI,
-  Personamaterialdetail,
-  getContentFile,
-} from "@/api/api";
+import { materialdetail, materialvisit, LearnWebSI, Personamaterialdetail, getContentFile } from '@/api/api';
 export default {
-  name: "tarcer-dev-Preview",
+  name: 'tarcer-dev-Preview',
   components: {
     Header,
     HeaderOne,
     pdf,
     Confirmorder,
-    Payment,
+    Payment
   },
   data() {
     return {
@@ -200,7 +124,7 @@ export default {
       data: null,
       attachment: null,
       loading: false,
-      Ispreview: "", // 是不是预览
+      Ispreview: '', // 是不是预览
       NopymentShow: false, //添加订单弹窗
       PymentShow: false, //支付订单弹窗
       orderNumber: null, //订单号
@@ -208,7 +132,7 @@ export default {
       allList: null,
       isData: false,
       goods_detail_type: null,
-      file_preview_url: "",
+      file_preview_url: ''
     };
   },
   computed: {},
@@ -216,9 +140,9 @@ export default {
     // 下载
     download() {
       let userInfor = JSON.parse(getToken());
-      let UserCode = "",
-        UserType = "",
-        SessionID = "";
+      let UserCode = '',
+        UserType = '',
+        SessionID = '';
       if (userInfor) {
         UserCode = userInfor.user_code;
         UserType = userInfor.user_type;
@@ -229,19 +153,14 @@ export default {
         SessionID,
         UserCode,
         UserType,
-        FileID,
+        FileID
       };
       location.href =
         process.env.VUE_APP_BASE_API +
         `/GCLSFileServer/WebFileDownload?UserCode=${data.UserCode}&UserType=${data.UserType}&SessionID=${data.SessionID}&FileID=${data.FileID}`;
     },
     // 生成订单 同时切换到支付弹窗
-    changeOrderNumber(
-      val,
-      back_discount_code,
-      discount_money,
-      receivables_money
-    ) {
+    changeOrderNumber(val, back_discount_code, discount_money, receivables_money) {
       this.orderNumber = val;
       this.NopymentShow = false;
       this.data.back_discount_code = back_discount_code;
@@ -256,7 +175,7 @@ export default {
     },
     closePyment(str) {
       this.PymentShow = false;
-      if (str == "支付成功") {
+      if (str == '支付成功') {
         this.getdetail();
       }
     },
@@ -265,22 +184,20 @@ export default {
       price = price ? price : 0;
       price = price.toFixed(2);
       price = price.toString();
-      let arr = price.split(".");
-      let str = `<span style="font-size: ${fontSize1 ? fontSize1 : 16}px;">${arr[0]
-        }</span>.<span style="font-size: ${fontSize2 ? fontSize2 : 16}px;">${arr[1]
-        }</span>`;
+      let arr = price.split('.');
+      let str = `<span style="font-size: ${fontSize1 ? fontSize1 : 16}px;">${arr[0]}</span>.<span style="font-size: ${
+        fontSize2 ? fontSize2 : 16
+      }px;">${arr[1]}</span>`;
       return str;
     },
     // 获取pdf的页数
     getNumPages() {
       this.loading = true;
       let _this = this;
-      let loadingTask = pdf.createLoadingTask(
-        _this.attachment[0].fileRelativePath
-      );
+      let loadingTask = pdf.createLoadingTask(_this.attachment[0].fileRelativePath);
 
       loadingTask.promise
-        .then((pdf) => {
+        .then(pdf => {
           if (_this.data.isPurchased) {
             _this.numPages = pdf.numPages;
           } else {
@@ -288,34 +205,34 @@ export default {
           }
           _this.loading = false;
         })
-        .catch((err) => {
-          console.error("Pdf Loading failed", err);
+        .catch(err => {
+          console.error('Pdf Loading failed', err);
         });
     },
     // 修改收藏状态
     changeCollect() {
       this.loading = true;
       if (this.data.isFavorite) {
-        let Mname = "order-collection_manager-CancelMyGoodsCollection";
+        let Mname = 'order-collection_manager-CancelMyGoodsCollection';
         LearnWebSI(Mname, {
           goods_id_list: [this.materialId],
-          goods_type: 401,
+          goods_type: 401
         })
-          .then((res) => {
+          .then(res => {
             this.$message({
-              type: "success",
-              message: this.$t("Key396"), //"取消收藏成功",
+              type: 'success',
+              message: this.$t('Key396') //"取消收藏成功",
             });
             this.data.isFavorite = false;
 
             this.loading = false;
             // this.getdetail();
           })
-          .catch((res) => {
+          .catch(res => {
             this.loading = false;
           });
       } else {
-        let Mname = "order-collection_manager-AddMyCollection";
+        let Mname = 'order-collection_manager-AddMyCollection';
         LearnWebSI(Mname, {
           goods_id: this.materialId,
           goods_type: 401,
@@ -323,19 +240,19 @@ export default {
           goods_person_name_desc: this.data.teacher,
           goods_picture_id: this.data.coverFileId,
           goods_price: this.data.price,
-          goods_detail_type: this.goods_detail_type,
+          goods_detail_type: this.goods_detail_type
         })
-          .then((res) => {
+          .then(res => {
             this.$message({
-              type: "success",
-              message: this.$t("Key575"), //"收藏成功",
+              type: 'success',
+              message: this.$t('Key575') //"收藏成功",
             });
             this.data.isFavorite = true;
 
             this.loading = false;
             // this.getdetail();
           })
-          .catch((res) => {
+          .catch(res => {
             this.loading = false;
           });
       }
@@ -344,7 +261,7 @@ export default {
     buy() {
       if (!this.data.isAudited) {
         // "您还未通过审核不能购买"
-        this.$message.warning(this.$t("Key576"));
+        this.$message.warning(this.$t('Key576'));
         return;
       }
       this.NopymentShow = true;
@@ -354,19 +271,19 @@ export default {
       this.loading = true;
       materialdetail({
         materialId: this.materialId,
-        isSelectForUpdate: this.Ispreview ? true : false,
+        isSelectForUpdate: this.Ispreview ? true : false
       })
-        .then((res) => {
+        .then(res => {
           if (res.data.result) {
-            let index = res.data.result.tag.indexOf("downloadable");
+            let index = res.data.result.tag.indexOf('downloadable');
             if (index != -1) {
               this.IsDownload = true;
             }
             this.data = res.data.result;
-            this.data.pymentTeacher = "";
+            this.data.pymentTeacher = '';
             res.data.result.teacher.forEach((item, i) => {
               if (i != this.data.teacher.length - 1) {
-                this.data.pymentTeacher += item + ";";
+                this.data.pymentTeacher += item + ';';
               } else {
                 this.data.pymentTeacher += item;
               }
@@ -400,13 +317,11 @@ export default {
             // var previewUrl =
             //   originUrl + `&fullfilename=${this.attachment[0].name}`;
             // GC 找的免费的 需要后台部署  谷歌可以 火狐和edge不行
-            let path =
-              `${this.file_preview_url}/onlinePreview?url=` +
-              Base64.encode(this.attachment[0].fileUrlHttps);
+            let path = `${this.file_preview_url}/onlinePreview?url=` + Base64.encode(this.attachment[0].fileUrlHttps);
             this.attachment[0].newpath = path;
           }
         })
-        .catch((res) => {
+        .catch(res => {
           this.loading = false;
         });
     },
@@ -414,28 +329,26 @@ export default {
       this.loading = true;
       Personamaterialdetail({
         materialId: this.materialId,
-        isSelectForUpdate: this.Ispreview ? true : false,
+        isSelectForUpdate: this.Ispreview ? true : false
       })
-        .then((res) => {
+        .then(res => {
           if (res.data.result) {
-            let index = res.data.result.tag.indexOf("downloadable");
+            let index = res.data.result.tag.indexOf('downloadable');
             if (index != -1) {
               this.IsDownload = true;
             }
             this.data = res.data.result;
-            this.data.pymentTeacher = "";
+            this.data.pymentTeacher = '';
             res.data.result.teacher.forEach((item, i) => {
               if (i != this.data.teacher.length - 1) {
-                this.data.pymentTeacher += item + ";";
+                this.data.pymentTeacher += item + ';';
               } else {
                 this.data.pymentTeacher += item;
               }
             });
             this.data.fileType = this.data.tag[this.data.tag.length - 1];
             this.attachment = JSON.parse(res.data.result.attachment);
-            let path =
-              `${this.file_preview_url}/onlinePreview?url=` +
-              Base64.encode(this.attachment[0].fileUrlHttps);
+            let path = `${this.file_preview_url}/onlinePreview?url=` + Base64.encode(this.attachment[0].fileUrlHttps);
             this.attachment[0].newpath = path;
             this.loading = false;
             // if (
@@ -453,60 +366,60 @@ export default {
             this.changePrice(this.data.price * 1, 24, 16);
           }
         })
-        .catch((res) => {
+        .catch(res => {
           this.loading = false;
         });
     },
     getimgurl(item) {
-      let index = item.tag.indexOf("downloadable");
-      let type = "";
+      let index = item.tag.indexOf('downloadable');
+      let type = '';
       if (index != -1) {
         type = item.tag[2];
       } else {
         type = item.tag[1];
       }
       return type;
-    },
+    }
   },
   async created() {
     let data = JSON.parse(getConfig());
     this.file_preview_url = data.doc_preview_service_address;
     await updateWordPack({
       word_key_list: [
-        "Key5",
-        "Key8",
-        "Key9",
-        "Key39",
-        "Key43",
-        "Key52",
-        "Key53",
-        "Key54",
-        "Key55",
-        "Key58",
-        "Key72",
-        "Key94",
-        "Key475",
-        "Key109",
-        "Key131",
-        "Key214",
-        "Key232",
-        "Key108",
-        "Key396",
-        "Key472",
-        "Key473",
-        "Key474",
-        "Key572",
-        "Key574",
-        "Key575",
-        "Key576",
-        "Key696",
-        "Key697",
-        "Key227",
-        "Key803",
-        "Key790",
-        "Key791",
-        "Key792"
-      ],
+        'Key5',
+        'Key8',
+        'Key9',
+        'Key39',
+        'Key43',
+        'Key52',
+        'Key53',
+        'Key54',
+        'Key55',
+        'Key58',
+        'Key72',
+        'Key94',
+        'Key475',
+        'Key109',
+        'Key131',
+        'Key214',
+        'Key232',
+        'Key108',
+        'Key396',
+        'Key472',
+        'Key473',
+        'Key474',
+        'Key572',
+        'Key574',
+        'Key575',
+        'Key576',
+        'Key696',
+        'Key697',
+        'Key227',
+        'Key803',
+        'Key790',
+        'Key791',
+        'Key792'
+      ]
     });
     this.isData = true;
   },
@@ -514,23 +427,23 @@ export default {
     this.materialId = this.$route.query.id;
     this.Ispreview = this.$route.query.type;
     this.allList = this.$route.query.allList;
-    if (this.$route.query.invok_module == "GCLS-Personal") {
+    if (this.$route.query.invok_module == 'GCLS-Personal') {
       this.PersonalDetail();
     } else {
       if (this.materialId) {
         this.getdetail();
         if (!this.Ispreview) {
           materialvisit({
-            id: this.materialId,
+            id: this.materialId
           })
-            .then((res) => { })
-            .catch((res) => {
+            .then(res => {})
+            .catch(res => {
               this.loading = false;
             });
         }
       }
     }
-  },
+  }
 };
 </script>
 

+ 101 - 122
src/views/teacher-dev/TextAnalysis.vue

@@ -1,22 +1,16 @@
 <template>
-  <div class="TextAnalysis" v-loading="loading">
-    <Header />
+  <div v-loading="loading" class="TextAnalysis">
+    <HeaderPage />
     <div class="main">
       <div class="title">文本分析</div>
       <div class="input_main">
-        <el-input
-          type="textarea"
-          placeholder="请输入文本"
-          :autosize="{ minRows: 9 }"
-          v-model="txt"
-        >
-        </el-input>
+        <el-input v-model="txt" type="textarea" placeholder="请输入文本" :autosize="{ minRows: 9 }" />
         <div class="text_btn">
           <span class="left">{{ txt.length }}/1000</span>
           <span class="btn" @click="submit">分析</span>
         </div>
       </div>
-      <div class="list_main" v-if="data">
+      <div v-if="data" class="list_main">
         <div class="title">
           <span style="margin-right: 16px">分析记录:</span>
           <span>{{ data.total }}/20</span>
@@ -28,22 +22,9 @@
               {{ item.firstSentence }}
             </div>
             <div class="time">{{ item.createDate }}</div>
-            <div
-              class="cxjx"
-              @click="anewSubmit(item)"
-              v-if="item.analysisStatus == 3"
-            >
-              重新解析
-            </div>
-            <el-popconfirm
-              title="确定删除这一条记录吗?"
-              @confirm="deleteOne(item.id, i)"
-            >
-              <img
-                slot="reference"
-                src="../../assets/teacherdev/delete-one.png"
-                alt=""
-              />
+            <div v-if="item.analysisStatus == 3" class="cxjx" @click="anewSubmit(item)">重新解析</div>
+            <el-popconfirm title="确定删除这一条记录吗?" @confirm="deleteOne(item.id, i)">
+              <img slot="reference" src="../../assets/teacherdev/delete-one.png" alt="" />
             </el-popconfirm>
           </div>
         </div>
@@ -53,21 +34,20 @@
 </template>
 
 <script>
-//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
-//例如:import 《组件名称》from ‘《组件路径》';
-import Header from "@/components/Header";
-import { postapi } from "@/api/api";
-import { getToken } from "@/utils/auth";
+import HeaderPage from '@/components/Header';
+import { postapi } from '@/api/api';
+import { getToken } from '@/utils/auth';
+
 export default {
-  //import引入的组件需要注入到对象中才能使用
+  // import引入的组件需要注入到对象中才能使用
   components: {
-    Header,
+    HeaderPage,
   },
   props: {},
   data() {
-    //这里存放数据
+    // 这里存放数据
     return {
-      txt: "",
+      txt: '',
       loading: false,
       token: null,
       page: 1,
@@ -75,21 +55,27 @@ export default {
       data: null,
     };
   },
-  //计算属性 类似于data概念
+  // 计算属性 类似于data概念
   computed: {},
-  //监控data中数据变化
+  // 监控data中数据变化
   watch: {},
-  //方法集合
+  // 生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    let data = getToken();
+    this.token = JSON.parse(data);
+    this.getlist();
+  },
+  // 方法集合
   methods: {
     // 分析结果统计
     goresult(item) {
-      if (item.analysisStatus != 2) {
-        this.$message.warning("当前数据解析失败,请重新解析");
+      if (item.analysisStatus !== 2) {
+        this.$message.warning('当前数据解析失败,请重新解析');
         return;
       }
       window.open(
         this.$router.resolve({
-          path: "/textanalysis/Result",
+          path: '/textanalysis/Result',
           query: {
             partitionKey: item.partitionKey,
             subjectWords: item.subjectWords,
@@ -102,54 +88,54 @@ export default {
             pinyinDifficulty: item.pinyinDifficulty,
             wordDifficulty: item.wordDifficulty,
             vocabularyDifficulty: item.vocabularyDifficulty,
-            type: "文本分析",
+            type: '文本分析',
           },
         }).href,
-        "_blank"
+        '_blank',
       );
     },
     // 删除
     deleteOne(id, index) {
       this.loading = true;
       postapi({
-        url: "/GCLSTCServer/tools/TS/analysis/record/del",
+        url: '/GCLSTCServer/tools/TS/analysis/record/del',
         data: {
           id,
         },
       })
         .then((res) => {
           this.data.list.splice(index, 1);
-          this.data.total = this.data.total - 1;
+          this.data.total -= 1;
 
           let num = this.page * this.pageSize - this.pageSize + 1;
           this.data.list.forEach((item) => {
             item.number = num;
-            num++;
+            num += 1;
           });
           this.$message.success(res.msg);
           this.loading = false;
         })
-        .catch((res) => {
+        .catch(() => {
           this.loading = false;
         });
     },
     anewSubmit(item) {
       this.loading = true;
       postapi({
-        url: "/GCLSTCServer/tools/TS/reparse",
+        url: '/GCLSTCServer/tools/TS/reparse',
         data: {
           partitionKey: item.partitionKey,
         },
       })
         .then((res) => {
-          if (res.data.result.analysisStatus != 2) {
-            this.$message.warning("当前数据解析失败,请重新解析");
+          if (res.data.result.analysisStatus !== 2) {
+            this.$message.warning('当前数据解析失败,请重新解析');
             this.loading = false;
             return;
           }
           window.open(
             this.$router.resolve({
-              path: "/textanalysis/Result",
+              path: '/textanalysis/Result',
               query: {
                 partitionKey: res.data.result.partitionKey,
                 subjectWords: res.data.result.subjectWords,
@@ -162,46 +148,46 @@ export default {
                 pinyinDifficulty: res.data.result.pinyinDifficulty,
                 wordDifficulty: res.data.result.wordDifficulty,
                 vocabularyDifficulty: res.data.result.vocabularyDifficulty,
-                type: "文本分析",
+                type: '文本分析',
               },
             }).href,
-            "_blank"
+            '_blank',
           );
           this.getlist(true);
           // this.loading = false;
         })
-        .catch((res) => {
+        .catch(() => {
           this.loading = false;
         });
     },
     // 分析
-    submit(msg) {
-      if (this.txt == "") {
-        this.$message.warning("请先输入内容");
+    submit() {
+      if (this.txt === '') {
+        this.$message.warning('请先输入内容');
         return;
       }
       if (this.txt.length > 1000) {
-        this.$message.warning("超出字数限制");
+        this.$message.warning('超出字数限制');
         return;
       }
       this.loading = true;
       postapi({
-        url: "/GCLSTCServer/tools/TS/analys",
+        url: '/GCLSTCServer/tools/TS/analys',
         data: {
-          tenantId: "",
+          tenantId: '',
           text: this.txt,
         },
       })
         .then((res) => {
-          this.txt = "";
-          if (res.data.result.analysisStatus != 2) {
-            this.$message.warning("当前数据解析失败,请重新解析");
+          this.txt = '';
+          if (res.data.result.analysisStatus !== 2) {
+            this.$message.warning('当前数据解析失败,请重新解析');
             this.loading = false;
             return;
           }
           window.open(
             this.$router.resolve({
-              path: "/textanalysis/Result",
+              path: '/textanalysis/Result',
               query: {
                 partitionKey: res.data.result.partitionKey,
                 subjectWords: res.data.result.subjectWords,
@@ -214,22 +200,22 @@ export default {
                 pinyinDifficulty: res.data.result.pinyinDifficulty,
                 wordDifficulty: res.data.result.wordDifficulty,
                 vocabularyDifficulty: res.data.result.vocabularyDifficulty,
-                type: "文本分析",
+                type: '文本分析',
               },
             }).href,
-            "_blank"
+            '_blank',
           );
           this.getlist(true);
           // this.loading = false;
         })
-        .catch((res) => {
+        .catch(() => {
           this.loading = false;
         });
     },
     getlist(msg) {
       this.loading = true;
       postapi({
-        url: "/GCLSTCServer/tools/TS/analysis/record/list",
+        url: '/GCLSTCServer/tools/TS/analysis/record/list',
         data: {
           pageIndex: this.page,
           pageSize: this.pageSize,
@@ -239,7 +225,7 @@ export default {
           let num = this.page * this.pageSize - this.pageSize + 1;
           res.data.result.list.forEach((item) => {
             item.number = num;
-            num++;
+            num += 1;
           });
           this.data = res.data.result;
           if (msg) {
@@ -247,130 +233,123 @@ export default {
           }
           this.loading = false;
         })
-        .catch((res) => {
+        .catch(() => {
           this.loading = false;
         });
     },
   },
-  //生命周期 - 创建完成(可以访问当前this实例)
-  created() {
-    let data = getToken();
-    this.token = JSON.parse(data);
-    this.getlist();
-  },
-  //生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
-  //生命周期-创建之前
-  beforeCreated() {},
-  //生命周期-挂载之前
-  beforeMount() {},
-  //生命周期-更新之前
-  beforUpdate() {},
-  //生命周期-更新之后
-  updated() {},
-  //生命周期-销毁之前
-  beforeDestory() {},
-  //生命周期-销毁完成
-  destoryed() {},
-  //如果页面有keep-alive缓存功能,这个函数会触发
-  activated() {},
 };
 </script>
+
 <style lang="scss" scoped>
-/* @import url(); 引入css类 */
 .TextAnalysis {
   min-height: 100%;
+
   .main {
     min-height: 80.2vh;
-    background: #f6f6f6;
     padding-top: 54px;
     padding-bottom: 24px;
+    background: #f6f6f6;
+
     > div {
       width: 1200px;
       margin: 0 auto;
     }
+
     > .title {
-      font-weight: 700;
       font-size: 30px;
+      font-weight: 700;
       line-height: 43px;
       color: #2c2c2c;
     }
+
     .input_main {
       width: 1168px;
-      margin-top: 17px;
-      padding: 16px;
       min-height: 295px;
-      background: #ffffff;
+      padding: 16px;
+      margin-top: 17px;
+      background: #fff;
       border-radius: 4px;
+
       .text_btn {
-        margin-top: 16px;
         display: flex;
-        justify-content: space-between;
         align-items: center;
+        justify-content: space-between;
+        margin-top: 16px;
+
         .left {
-          font-weight: 400;
           font-size: 14px;
+          font-weight: 400;
           line-height: 26px;
-          color: #000000;
+          color: #000;
         }
+
         .btn {
-          font-weight: 500;
-          font-size: 16px;
-          line-height: 40px;
-          color: #000000;
           width: 124px;
           height: 40px;
-          background: #ffc600;
-          border: 1px solid rgba(0, 0, 0, 0.15);
-          box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.04);
-          border-radius: 4px;
+          font-size: 16px;
+          font-weight: 500;
+          line-height: 40px;
+          color: #000;
           text-align: center;
           cursor: pointer;
+          background: #ffc600;
+          border: 1px solid rgba(0, 0, 0, 15%);
+          border-radius: 4px;
+          box-shadow: 0 2px 0 rgba(0, 0, 0, 4%);
         }
       }
     }
+
     .list_main {
       margin-top: 37px;
+
       .title {
-        font-weight: 400;
         font-size: 16px;
+        font-weight: 400;
         line-height: 24px;
-        color: #000000;
+        color: #000;
       }
+
       .list {
         margin-top: 16px;
+
         > div {
           display: flex;
           align-items: center;
-          padding: 0 16px;
           height: 48px;
-          background: #ffffff;
-          border-bottom: 1px solid rgba(0, 0, 0, 0.08);
-
-          font-weight: 400;
+          padding: 0 16px;
           font-size: 16px;
-          color: #000000;
+          font-weight: 400;
+          color: #000;
+          background: #fff;
+          border-bottom: 1px solid rgba(0, 0, 0, 8%);
+
           .number {
             width: 20px;
-            text-align: right;
             margin-right: 24px;
+            text-align: right;
           }
+
           .txt {
             width: 774px;
+            margin-right: 24px;
             overflow: hidden;
-            white-space: nowrap;
             text-overflow: ellipsis;
-            margin-right: 24px;
+            white-space: nowrap;
             cursor: pointer;
           }
+
           .time {
             width: 190px;
             margin-right: 24px;
           }
+
           .cxjx {
             margin-right: 24px;
             cursor: pointer;
           }
+
           img {
             width: 24px;
             height: 24px;
@@ -381,4 +360,4 @@ export default {
     }
   }
 }
-</style>
+</style>

+ 79 - 0
stylelint.config.js

@@ -0,0 +1,79 @@
+module.exports = {
+  root: true,
+  defaultSeverity: 'warning',
+  extends: ['stylelint-config-recommended-scss', 'stylelint-config-recess-order', 'stylelint-config-standard-scss'],
+  plugins: ['stylelint-declaration-block-no-ignored-properties'],
+  rules: {
+    'scss/dollar-variable-pattern': null,
+    'selector-class-pattern': null,
+    'order/properties-alphabetical-order': null,
+    // 嵌套过多,建议关闭此规则
+    'no-descending-specificity': null,
+    'selector-max-id': 1,
+    'selector-pseudo-class-no-unknown': [
+      true,
+      {
+        ignorePseudoClasses: ['deep', 'global']
+      }
+    ],
+    'at-rule-no-unknown': [
+      true,
+      {
+        ignoreAtRules: [
+          'tailwind',
+          'apply',
+          'variants',
+          'responsive',
+          'screen',
+          'function',
+          'if',
+          'each',
+          'extend',
+          'include',
+          'mixin',
+          'at-root'
+        ]
+      }
+    ],
+    'rule-empty-line-before': [
+      'always',
+      {
+        ignore: ['after-comment', 'first-nested']
+      }
+    ],
+    'color-function-notation': 'legacy',
+    // 函数 url 链接不允许 shceme relative
+    'function-url-no-scheme-relative': true,
+    // 可组合成一个属性的写法,不允许拆开书写
+    'declaration-block-no-redundant-longhand-properties': true,
+    // 选择器最大深度
+    'selector-max-compound-selectors': 12,
+    // 最多2个类型选择器
+    'selector-max-type': 2,
+    // 不允许未知的动画
+    'no-unknown-animations': true,
+    // 在字体名称必须使用引号的地方使用引号,其他地方不能使用
+    'font-family-name-quotes': 'always-unless-keyword',
+    // url 函数内部必须有引号
+    'function-url-quotes': 'always',
+    'value-keyword-case': ['lower', { ignoreKeywords: ['optimizeLegibility', 'currentColor'] }],
+    'max-nesting-depth': [12, { ignore: ['blockless-at-rules', 'pseudo-classes'] }],
+    'selector-no-qualifying-type': [true, { ignore: ['attribute', 'class', 'id'] }]
+  },
+  ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
+  overrides: [
+    {
+      files: ['*.vue', '**/*.vue'],
+      extends: [
+        'stylelint-config-recess-order',
+        'stylelint-config-standard-scss',
+        'stylelint-config-recommended-vue/scss'
+      ],
+      rules: {
+        'keyframes-name-pattern': null,
+        'declaration-property-value-no-unknown': [true, { ignoreProperties: { '/.+/': '/(v-bind(.*))|($.*)/' } }],
+        'selector-pseudo-element-no-unknown': true
+      }
+    }
+  ]
+};

+ 122 - 133
vue.config.js

@@ -1,147 +1,136 @@
-'use strict'
-const path = require('path')
-const defaultSettings = require('./src/settings.js')
+const path = require('path');
+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
+const name = defaultSettings.title || '教研中心'; // page title
 
-// If your port is set to 80,
-// use administrator privileges to execute the command line.
-// For example, Mac: sudo npm run
-// 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/
+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/
 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
+  publicPath: process.env.NODE_ENV === 'development' ? '/' : '/GCLS-TC',
+  // publicPath: '/',
+  outputDir: 'dist',
+  assetsDir: 'static',
+  lintOnSave: false,
+  productionSourceMap: false,
+  devServer: {
+    public: `localhost:${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
+      // https://gcls.helxsoft.cn
+      [process.env.VUE_APP_BASE_API]: {
+        target: `https://gcls.helxsoft.cn/`,
+        changeOrigin: true,
+        pathRewrite: {
+          [`^${process.env.VUE_APP_BASE_API}`]: '',
         },
-        proxy: {
-            // change xxx-api/login => mock/login
-            // detail: https://cli.vuejs.org/config/#devserver-proxy
-            // http://mk.wmjh.cn
-            // https://gcls.helxsoft.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]: '/'
-                }
-            }
+      },
+      [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')
+      },
     },
-    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后还可以加载到原始资源文件)
-            })
-        ]
+  },
+  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,
+    resolve: {
+      alias: {
+        '@': resolve('src'),
+      },
     },
-    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'
-        }])
+    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');
+    });
+  },
+};

Some files were not shown because too many files changed in this diff