李志伟 3 年之前
父節點
當前提交
153839472f
共有 100 個檔案被更改,包括 4903 行新增0 行删除
  1. 14
    0
      .editorconfig
  2. 5
    0
      .env.development
  3. 6
    0
      .env.production
  4. 8
    0
      .env.staging
  5. 4
    0
      .eslintignore
  6. 198
    0
      .eslintrc.js
  7. 16
    0
      .gitignore
  8. 5
    0
      .travis.yml
  9. 21
    0
      LICENSE
  10. 16
    0
      babel.config.js
  11. 35
    0
      build/index.js
  12. 24
    0
      jest.config.js
  13. 9
    0
      jsconfig.json
  14. 57
    0
      mock/index.js
  15. 81
    0
      mock/mock-server.js
  16. 29
    0
      mock/table.js
  17. 84
    0
      mock/user.js
  18. 25
    0
      mock/utils.js
  19. 69
    0
      package.json
  20. 8
    0
      postcss.config.js
  21. 二進制
      public/favicon.ico
  22. 17
    0
      public/index.html
  23. 28
    0
      src/App.vue
  24. 46
    0
      src/api/answer.js
  25. 46
    0
      src/api/game.js
  26. 46
    0
      src/api/gameCharacter.js
  27. 38
    0
      src/api/gamelevelquestion.js
  28. 60
    0
      src/api/oss.js
  29. 55
    0
      src/api/question.js
  30. 77
    0
      src/api/user.js
  31. 二進制
      src/assets/404_images/404.png
  32. 二進制
      src/assets/404_images/404_cloud.png
  33. 78
    0
      src/components/Breadcrumb/index.vue
  34. 108
    0
      src/components/GameCharacter/edit.vue
  35. 146
    0
      src/components/GameCharacter/index.vue
  36. 44
    0
      src/components/Hamburger/index.vue
  37. 231
    0
      src/components/Question/drawer.vue
  38. 282
    0
      src/components/Question/edit.vue
  39. 169
    0
      src/components/Question/index.vue
  40. 62
    0
      src/components/SvgIcon/index.vue
  41. 68
    0
      src/components/UploadImage/index.vue
  42. 67
    0
      src/components/UploadImageList/index.vue
  43. 9
    0
      src/icons/index.js
  44. 二進制
      src/icons/logo.jpg
  45. 1
    0
      src/icons/svg/app.svg
  46. 1
    0
      src/icons/svg/appconfig.svg
  47. 1
    0
      src/icons/svg/captcha.svg
  48. 1
    0
      src/icons/svg/dashboard.svg
  49. 1
    0
      src/icons/svg/example.svg
  50. 1
    0
      src/icons/svg/eye-open.svg
  51. 1
    0
      src/icons/svg/eye.svg
  52. 1
    0
      src/icons/svg/form.svg
  53. 1
    0
      src/icons/svg/game.svg
  54. 1
    0
      src/icons/svg/gamePerson.svg
  55. 1
    0
      src/icons/svg/link.svg
  56. 1
    0
      src/icons/svg/nested.svg
  57. 1
    0
      src/icons/svg/password.svg
  58. 1
    0
      src/icons/svg/phone.svg
  59. 1
    0
      src/icons/svg/question.svg
  60. 1
    0
      src/icons/svg/table.svg
  61. 1
    0
      src/icons/svg/tree.svg
  62. 1
    0
      src/icons/svg/user.svg
  63. 1
    0
      src/icons/svg/wx.svg
  64. 22
    0
      src/icons/svgo.yml
  65. 40
    0
      src/layout/components/AppMain.vue
  66. 217
    0
      src/layout/components/Navbar.vue
  67. 26
    0
      src/layout/components/Sidebar/FixiOSBug.js
  68. 41
    0
      src/layout/components/Sidebar/Item.vue
  69. 43
    0
      src/layout/components/Sidebar/Link.vue
  70. 82
    0
      src/layout/components/Sidebar/Logo.vue
  71. 95
    0
      src/layout/components/Sidebar/SidebarItem.vue
  72. 61
    0
      src/layout/components/Sidebar/index.vue
  73. 3
    0
      src/layout/components/index.js
  74. 95
    0
      src/layout/index.vue
  75. 45
    0
      src/layout/mixin/ResizeHandler.js
  76. 43
    0
      src/main.js
  77. 60
    0
      src/permission.js
  78. 182
    0
      src/router/index.js
  79. 16
    0
      src/settings.js
  80. 8
    0
      src/store/getters.js
  81. 21
    0
      src/store/index.js
  82. 49
    0
      src/store/modules/app.js
  83. 30
    0
      src/store/modules/game.js
  84. 32
    0
      src/store/modules/settings.js
  85. 70
    0
      src/store/modules/user.js
  86. 49
    0
      src/styles/element-ui.scss
  87. 65
    0
      src/styles/index.scss
  88. 28
    0
      src/styles/mixin.scss
  89. 226
    0
      src/styles/sidebar.scss
  90. 48
    0
      src/styles/transition.scss
  91. 25
    0
      src/styles/variables.scss
  92. 27
    0
      src/utils/auth.js
  93. 10
    0
      src/utils/get-page-title.js
  94. 117
    0
      src/utils/index.js
  95. 71
    0
      src/utils/request.js
  96. 17
    0
      src/utils/upload.js
  97. 20
    0
      src/utils/validate.js
  98. 228
    0
      src/views/404.vue
  99. 281
    0
      src/views/course/edit.vue
  100. 0
    0
      src/views/course/index.vue

+ 14
- 0
.editorconfig 查看文件

@@ -0,0 +1,14 @@
1
+# http://editorconfig.org
2
+root = true
3
+
4
+[*]
5
+charset = utf-8
6
+indent_style = space
7
+indent_size = 2
8
+end_of_line = lf
9
+insert_final_newline = true
10
+trim_trailing_whitespace = true
11
+
12
+[*.md]
13
+insert_final_newline = false
14
+trim_trailing_whitespace = false

+ 5
- 0
.env.development 查看文件

@@ -0,0 +1,5 @@
1
+# just a flag
2
+ENV = 'development'
3
+
4
+# base api
5
+VUE_APP_BASE_API = '/api'

+ 6
- 0
.env.production 查看文件

@@ -0,0 +1,6 @@
1
+# just a flag
2
+ENV = 'production'
3
+
4
+# base api
5
+VUE_APP_BASE_API = '/prod-api'
6
+

+ 8
- 0
.env.staging 查看文件

@@ -0,0 +1,8 @@
1
+NODE_ENV = production
2
+
3
+# just a flag
4
+ENV = 'staging'
5
+
6
+# base api
7
+VUE_APP_BASE_API = '/stage-api'
8
+

+ 4
- 0
.eslintignore 查看文件

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

+ 198
- 0
.eslintrc.js 查看文件

@@ -0,0 +1,198 @@
1
+module.exports = {
2
+  root: true,
3
+  parserOptions: {
4
+    parser: 'babel-eslint',
5
+    sourceType: 'module'
6
+  },
7
+  env: {
8
+    browser: true,
9
+    node: true,
10
+    es6: true,
11
+  },
12
+  extends: ['plugin:vue/recommended', 'eslint:recommended'],
13
+
14
+  // add your custom rules here
15
+  //it is base on https://github.com/vuejs/eslint-config-vue
16
+  rules: {
17
+    "vue/max-attributes-per-line": [2, {
18
+      "singleline": 10,
19
+      "multiline": {
20
+        "max": 1,
21
+        "allowFirstLine": false
22
+      }
23
+    }],
24
+    "vue/singleline-html-element-content-newline": "off",
25
+    "vue/multiline-html-element-content-newline":"off",
26
+    "vue/name-property-casing": ["error", "PascalCase"],
27
+    "vue/no-v-html": "off",
28
+    'accessor-pairs': 2,
29
+    'arrow-spacing': [2, {
30
+      'before': true,
31
+      'after': true
32
+    }],
33
+    'block-spacing': [2, 'always'],
34
+    'brace-style': [2, '1tbs', {
35
+      'allowSingleLine': true
36
+    }],
37
+    'camelcase': [0, {
38
+      'properties': 'always'
39
+    }],
40
+    'comma-dangle': [2, 'never'],
41
+    'comma-spacing': [2, {
42
+      'before': false,
43
+      'after': true
44
+    }],
45
+    'comma-style': [2, 'last'],
46
+    'constructor-super': 2,
47
+    'curly': [2, 'multi-line'],
48
+    'dot-location': [2, 'property'],
49
+    'eol-last': 2,
50
+    'eqeqeq': ["error", "always", {"null": "ignore"}],
51
+    'generator-star-spacing': [2, {
52
+      'before': true,
53
+      'after': true
54
+    }],
55
+    'handle-callback-err': [2, '^(err|error)$'],
56
+    'indent': [2, 2, {
57
+      'SwitchCase': 1
58
+    }],
59
+    'jsx-quotes': [2, 'prefer-single'],
60
+    'key-spacing': [2, {
61
+      'beforeColon': false,
62
+      'afterColon': true
63
+    }],
64
+    'keyword-spacing': [2, {
65
+      'before': true,
66
+      'after': true
67
+    }],
68
+    'new-cap': [2, {
69
+      'newIsCap': true,
70
+      'capIsNew': false
71
+    }],
72
+    'new-parens': 2,
73
+    'no-array-constructor': 2,
74
+    'no-caller': 2,
75
+    'no-console': 'off',
76
+    'no-class-assign': 2,
77
+    'no-cond-assign': 2,
78
+    'no-const-assign': 2,
79
+    'no-control-regex': 0,
80
+    'no-delete-var': 2,
81
+    'no-dupe-args': 2,
82
+    'no-dupe-class-members': 2,
83
+    'no-dupe-keys': 2,
84
+    'no-duplicate-case': 2,
85
+    'no-empty-character-class': 2,
86
+    'no-empty-pattern': 2,
87
+    'no-eval': 2,
88
+    'no-ex-assign': 2,
89
+    'no-extend-native': 2,
90
+    'no-extra-bind': 2,
91
+    'no-extra-boolean-cast': 2,
92
+    'no-extra-parens': [2, 'functions'],
93
+    'no-fallthrough': 2,
94
+    'no-floating-decimal': 2,
95
+    'no-func-assign': 2,
96
+    'no-implied-eval': 2,
97
+    'no-inner-declarations': [2, 'functions'],
98
+    'no-invalid-regexp': 2,
99
+    'no-irregular-whitespace': 2,
100
+    'no-iterator': 2,
101
+    'no-label-var': 2,
102
+    'no-labels': [2, {
103
+      'allowLoop': false,
104
+      'allowSwitch': false
105
+    }],
106
+    'no-lone-blocks': 2,
107
+    'no-mixed-spaces-and-tabs': 2,
108
+    'no-multi-spaces': 2,
109
+    'no-multi-str': 2,
110
+    'no-multiple-empty-lines': [2, {
111
+      'max': 1
112
+    }],
113
+    'no-native-reassign': 2,
114
+    'no-negated-in-lhs': 2,
115
+    'no-new-object': 2,
116
+    'no-new-require': 2,
117
+    'no-new-symbol': 2,
118
+    'no-new-wrappers': 2,
119
+    'no-obj-calls': 2,
120
+    'no-octal': 2,
121
+    'no-octal-escape': 2,
122
+    'no-path-concat': 2,
123
+    'no-proto': 2,
124
+    'no-redeclare': 2,
125
+    'no-regex-spaces': 2,
126
+    'no-return-assign': [2, 'except-parens'],
127
+    'no-self-assign': 2,
128
+    'no-self-compare': 2,
129
+    'no-sequences': 2,
130
+    'no-shadow-restricted-names': 2,
131
+    'no-spaced-func': 2,
132
+    'no-sparse-arrays': 2,
133
+    'no-this-before-super': 2,
134
+    'no-throw-literal': 2,
135
+    'no-trailing-spaces': 2,
136
+    'no-undef': 2,
137
+    'no-undef-init': 2,
138
+    'no-unexpected-multiline': 2,
139
+    'no-unmodified-loop-condition': 2,
140
+    'no-unneeded-ternary': [2, {
141
+      'defaultAssignment': false
142
+    }],
143
+    'no-unreachable': 2,
144
+    'no-unsafe-finally': 2,
145
+    'no-unused-vars': [2, {
146
+      'vars': 'all',
147
+      'args': 'none'
148
+    }],
149
+    'no-useless-call': 2,
150
+    'no-useless-computed-key': 2,
151
+    'no-useless-constructor': 2,
152
+    'no-useless-escape': 0,
153
+    'no-whitespace-before-property': 2,
154
+    'no-with': 2,
155
+    'one-var': [2, {
156
+      'initialized': 'never'
157
+    }],
158
+    'operator-linebreak': [2, 'after', {
159
+      'overrides': {
160
+        '?': 'before',
161
+        ':': 'before'
162
+      }
163
+    }],
164
+    'padded-blocks': [2, 'never'],
165
+    'quotes': [2, 'single', {
166
+      'avoidEscape': true,
167
+      'allowTemplateLiterals': true
168
+    }],
169
+    'semi': [2, 'never'],
170
+    'semi-spacing': [2, {
171
+      'before': false,
172
+      'after': true
173
+    }],
174
+    'space-before-blocks': [2, 'always'],
175
+    'space-before-function-paren': [2, 'never'],
176
+    'space-in-parens': [2, 'never'],
177
+    'space-infix-ops': 2,
178
+    'space-unary-ops': [2, {
179
+      'words': true,
180
+      'nonwords': false
181
+    }],
182
+    'spaced-comment': [2, 'always', {
183
+      'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
184
+    }],
185
+    'template-curly-spacing': [2, 'never'],
186
+    'use-isnan': 2,
187
+    'valid-typeof': 2,
188
+    'wrap-iife': [2, 'any'],
189
+    'yield-star-spacing': [2, 'both'],
190
+    'yoda': [2, 'never'],
191
+    'prefer-const': 2,
192
+    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
193
+    'object-curly-spacing': [2, 'always', {
194
+      objectsInObjects: false
195
+    }],
196
+    'array-bracket-spacing': [2, 'never']
197
+  }
198
+}

+ 16
- 0
.gitignore 查看文件

@@ -0,0 +1,16 @@
1
+.DS_Store
2
+node_modules/
3
+dist/
4
+npm-debug.log*
5
+yarn-debug.log*
6
+yarn-error.log*
7
+package-lock.json
8
+tests/**/coverage/
9
+
10
+# Editor directories and files
11
+.idea
12
+.vscode
13
+*.suo
14
+*.ntvs*
15
+*.njsproj
16
+*.sln

+ 5
- 0
.travis.yml 查看文件

@@ -0,0 +1,5 @@
1
+language: node_js
2
+node_js: 10
3
+script: npm run test
4
+notifications:
5
+  email: false

+ 21
- 0
LICENSE 查看文件

@@ -0,0 +1,21 @@
1
+MIT License
2
+
3
+Copyright (c) 2017-present PanJiaChen
4
+
5
+Permission is hereby granted, free of charge, to any person obtaining a copy
6
+of this software and associated documentation files (the "Software"), to deal
7
+in the Software without restriction, including without limitation the rights
8
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+copies of the Software, and to permit persons to whom the Software is
10
+furnished to do so, subject to the following conditions:
11
+
12
+The above copyright notice and this permission notice shall be included in all
13
+copies or substantial portions of the Software.
14
+
15
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+SOFTWARE.

+ 16
- 0
babel.config.js 查看文件

@@ -0,0 +1,16 @@
1
+module.exports = {
2
+  presets: [
3
+    // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
4
+    // '@vue/cli-plugin-babel/preset',
5
+    // 之前一直报错说core.js 把上面这句话改为下面的就可以了
6
+    ['@vue/cli-plugin-babel/preset', { useBuiltIns: 'entry' }]
7
+  ],
8
+  'env': {
9
+    'development': {
10
+      // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
11
+      // This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
12
+      // https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
13
+      'plugins': ['dynamic-import-node']
14
+    }
15
+  }
16
+}

+ 35
- 0
build/index.js 查看文件

@@ -0,0 +1,35 @@
1
+const { run } = require('runjs')
2
+const chalk = require('chalk')
3
+const config = require('../vue.config.js')
4
+const rawArgv = process.argv.slice(2)
5
+const args = rawArgv.join(' ')
6
+
7
+if (process.env.npm_config_preview || rawArgv.includes('--preview')) {
8
+  const report = rawArgv.includes('--report')
9
+
10
+  run(`vue-cli-service build ${args}`)
11
+
12
+  const port = 9526
13
+  const publicPath = config.publicPath
14
+
15
+  var connect = require('connect')
16
+  var serveStatic = require('serve-static')
17
+  const app = connect()
18
+
19
+  app.use(
20
+    publicPath,
21
+    serveStatic('./dist', {
22
+      index: ['index.html', '/']
23
+    })
24
+  )
25
+
26
+  app.listen(port, function () {
27
+    console.log(chalk.green(`> Preview at  http://localhost:${port}${publicPath}`))
28
+    if (report) {
29
+      console.log(chalk.green(`> Report at  http://localhost:${port}${publicPath}report.html`))
30
+    }
31
+
32
+  })
33
+} else {
34
+  run(`vue-cli-service build ${args}`)
35
+}

+ 24
- 0
jest.config.js 查看文件

@@ -0,0 +1,24 @@
1
+module.exports = {
2
+  moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
3
+  transform: {
4
+    '^.+\\.vue$': 'vue-jest',
5
+    '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
6
+      'jest-transform-stub',
7
+    '^.+\\.jsx?$': 'babel-jest'
8
+  },
9
+  moduleNameMapper: {
10
+    '^@/(.*)$': '<rootDir>/src/$1'
11
+  },
12
+  snapshotSerializers: ['jest-serializer-vue'],
13
+  testMatch: [
14
+    '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
15
+  ],
16
+  collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'],
17
+  coverageDirectory: '<rootDir>/tests/unit/coverage',
18
+  // 'collectCoverage': true,
19
+  'coverageReporters': [
20
+    'lcov',
21
+    'text-summary'
22
+  ],
23
+  testURL: 'http://localhost/'
24
+}

+ 9
- 0
jsconfig.json 查看文件

@@ -0,0 +1,9 @@
1
+{
2
+  "compilerOptions": {
3
+    "baseUrl": "./",
4
+    "paths": {
5
+        "@/*": ["src/*"]
6
+    }
7
+  },
8
+  "exclude": ["node_modules", "dist"]
9
+}

+ 57
- 0
mock/index.js 查看文件

@@ -0,0 +1,57 @@
1
+const Mock = require('mockjs')
2
+const { param2Obj } = require('./utils')
3
+
4
+const user = require('./user')
5
+const table = require('./table')
6
+
7
+const mocks = [
8
+  ...user,
9
+  ...table
10
+]
11
+
12
+// for front mock
13
+// please use it cautiously, it will redefine XMLHttpRequest,
14
+// which will cause many of your third-party libraries to be invalidated(like progress event).
15
+function mockXHR() {
16
+  // mock patch
17
+  // https://github.com/nuysoft/Mock/issues/300
18
+  Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
19
+  Mock.XHR.prototype.send = function() {
20
+    if (this.custom.xhr) {
21
+      this.custom.xhr.withCredentials = this.withCredentials || false
22
+
23
+      if (this.responseType) {
24
+        this.custom.xhr.responseType = this.responseType
25
+      }
26
+    }
27
+    this.proxy_send(...arguments)
28
+  }
29
+
30
+  function XHR2ExpressReqWrap(respond) {
31
+    return function(options) {
32
+      let result = null
33
+      if (respond instanceof Function) {
34
+        const { body, type, url } = options
35
+        // https://expressjs.com/en/4x/api.html#req
36
+        result = respond({
37
+          method: type,
38
+          body: JSON.parse(body),
39
+          query: param2Obj(url)
40
+        })
41
+      } else {
42
+        result = respond
43
+      }
44
+      return Mock.mock(result)
45
+    }
46
+  }
47
+
48
+  for (const i of mocks) {
49
+    Mock.mock(new RegExp(i.url), i.type || 'get', XHR2ExpressReqWrap(i.response))
50
+  }
51
+}
52
+
53
+module.exports = {
54
+  mocks,
55
+  mockXHR
56
+}
57
+

+ 81
- 0
mock/mock-server.js 查看文件

@@ -0,0 +1,81 @@
1
+const chokidar = require('chokidar')
2
+const bodyParser = require('body-parser')
3
+const chalk = require('chalk')
4
+const path = require('path')
5
+const Mock = require('mockjs')
6
+
7
+const mockDir = path.join(process.cwd(), 'mock')
8
+
9
+function registerRoutes(app) {
10
+  let mockLastIndex
11
+  const { mocks } = require('./index.js')
12
+  const mocksForServer = mocks.map(route => {
13
+    return responseFake(route.url, route.type, route.response)
14
+  })
15
+  for (const mock of mocksForServer) {
16
+    app[mock.type](mock.url, mock.response)
17
+    mockLastIndex = app._router.stack.length
18
+  }
19
+  const mockRoutesLength = Object.keys(mocksForServer).length
20
+  return {
21
+    mockRoutesLength: mockRoutesLength,
22
+    mockStartIndex: mockLastIndex - mockRoutesLength
23
+  }
24
+}
25
+
26
+function unregisterRoutes() {
27
+  Object.keys(require.cache).forEach(i => {
28
+    if (i.includes(mockDir)) {
29
+      delete require.cache[require.resolve(i)]
30
+    }
31
+  })
32
+}
33
+
34
+// for mock server
35
+const responseFake = (url, type, respond) => {
36
+  return {
37
+    url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
38
+    type: type || 'get',
39
+    response(req, res) {
40
+      console.log('request invoke:' + req.path)
41
+      res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
42
+    }
43
+  }
44
+}
45
+
46
+module.exports = app => {
47
+  // parse app.body
48
+  // https://expressjs.com/en/4x/api.html#req.body
49
+  app.use(bodyParser.json())
50
+  app.use(bodyParser.urlencoded({
51
+    extended: true
52
+  }))
53
+
54
+  const mockRoutes = registerRoutes(app)
55
+  var mockRoutesLength = mockRoutes.mockRoutesLength
56
+  var mockStartIndex = mockRoutes.mockStartIndex
57
+
58
+  // watch files, hot reload mock server
59
+  chokidar.watch(mockDir, {
60
+    ignored: /mock-server/,
61
+    ignoreInitial: true
62
+  }).on('all', (event, path) => {
63
+    if (event === 'change' || event === 'add') {
64
+      try {
65
+        // remove mock routes stack
66
+        app._router.stack.splice(mockStartIndex, mockRoutesLength)
67
+
68
+        // clear routes cache
69
+        unregisterRoutes()
70
+
71
+        const mockRoutes = registerRoutes(app)
72
+        mockRoutesLength = mockRoutes.mockRoutesLength
73
+        mockStartIndex = mockRoutes.mockStartIndex
74
+
75
+        console.log(chalk.magentaBright(`\n > Mock Server hot reload success! changed  ${path}`))
76
+      } catch (error) {
77
+        console.log(chalk.redBright(error))
78
+      }
79
+    }
80
+  })
81
+}

+ 29
- 0
mock/table.js 查看文件

@@ -0,0 +1,29 @@
1
+const Mock = require('mockjs')
2
+
3
+const data = Mock.mock({
4
+  'items|30': [{
5
+    id: '@id',
6
+    title: '@sentence(10, 20)',
7
+    'status|1': ['published', 'draft', 'deleted'],
8
+    author: 'name',
9
+    display_time: '@datetime',
10
+    pageviews: '@integer(300, 5000)'
11
+  }]
12
+})
13
+
14
+module.exports = [
15
+  {
16
+    url: '/vue-admin-template/table/list',
17
+    type: 'get',
18
+    response: config => {
19
+      const items = data.items
20
+      return {
21
+        code: 20000,
22
+        data: {
23
+          total: items.length,
24
+          items: items
25
+        }
26
+      }
27
+    }
28
+  }
29
+]

+ 84
- 0
mock/user.js 查看文件

@@ -0,0 +1,84 @@
1
+
2
+const tokens = {
3
+  admin: {
4
+    token: 'admin-token'
5
+  },
6
+  editor: {
7
+    token: 'editor-token'
8
+  }
9
+}
10
+
11
+const users = {
12
+  'admin-token': {
13
+    roles: ['admin'],
14
+    introduction: 'I am a super administrator',
15
+    avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
16
+    name: 'Super Admin'
17
+  },
18
+  'editor-token': {
19
+    roles: ['editor'],
20
+    introduction: 'I am an editor',
21
+    avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
22
+    name: 'Normal Editor'
23
+  }
24
+}
25
+
26
+module.exports = [
27
+  // user login
28
+  {
29
+    url: '/vue-admin-template/user/login',
30
+    type: 'post',
31
+    response: config => {
32
+      const { username } = config.body
33
+      const token = tokens[username]
34
+
35
+      // mock error
36
+      if (!token) {
37
+        return {
38
+          code: 60204,
39
+          message: 'Account and password are incorrect.'
40
+        }
41
+      }
42
+
43
+      return {
44
+        code: 1000,
45
+        data: token
46
+      }
47
+    }
48
+  },
49
+
50
+  // get user info
51
+  {
52
+    url: '/vue-admin-template/user/info\.*',
53
+    type: 'get',
54
+    response: config => {
55
+      const { token } = config.query
56
+      const info = users[token]
57
+
58
+      // mock error
59
+      if (!info) {
60
+        return {
61
+          code: 50008,
62
+          message: 'Login failed, unable to get user details.'
63
+        }
64
+      }
65
+
66
+      return {
67
+        code: 1000,
68
+        data: info
69
+      }
70
+    }
71
+  },
72
+
73
+  // user logout
74
+  {
75
+    url: '/vue-admin-template/user/logout',
76
+    type: 'post',
77
+    response: _ => {
78
+      return {
79
+        code: 1000,
80
+        data: 'success'
81
+      }
82
+    }
83
+  }
84
+]

+ 25
- 0
mock/utils.js 查看文件

@@ -0,0 +1,25 @@
1
+/**
2
+ * @param {string} url
3
+ * @returns {Object}
4
+ */
5
+function param2Obj(url) {
6
+  const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
7
+  if (!search) {
8
+    return {}
9
+  }
10
+  const obj = {}
11
+  const searchArr = search.split('&')
12
+  searchArr.forEach(v => {
13
+    const index = v.indexOf('=')
14
+    if (index !== -1) {
15
+      const name = v.substring(0, index)
16
+      const val = v.substring(index + 1, v.length)
17
+      obj[name] = val
18
+    }
19
+  })
20
+  return obj
21
+}
22
+
23
+module.exports = {
24
+  param2Obj
25
+}

+ 69
- 0
package.json 查看文件

@@ -0,0 +1,69 @@
1
+{
2
+  "name": "vue-admin-template",
3
+  "version": "4.4.0",
4
+  "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint",
5
+  "author": "Pan <panfree23@gmail.com>",
6
+  "scripts": {
7
+    "dev": "vue-cli-service serve",
8
+    "build:prod": "vue-cli-service build",
9
+    "build:stage": "vue-cli-service build --mode staging",
10
+    "preview": "node build/index.js --preview",
11
+    "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
12
+    "lint": "eslint --ext .js,.vue src",
13
+    "test:unit": "jest --clearCache && vue-cli-service test:unit",
14
+    "test:ci": "npm run lint && npm run test:unit"
15
+  },
16
+  "dependencies": {
17
+    "ali-oss": "^6.16.0",
18
+    "axios": "^0.18.1",
19
+    "axios-retry": "^3.2.4",
20
+    "core-js": "^2.6.12",
21
+    "element-ui": "2.13.2",
22
+    "js-cookie": "2.2.0",
23
+    "js-md5": "^0.7.3",
24
+    "normalize.css": "7.0.0",
25
+    "nprogress": "0.2.0",
26
+    "path-to-regexp": "2.4.0",
27
+    "qrcodejs2": "0.0.2",
28
+    "vue": "2.6.10",
29
+    "vue-axios": "^3.4.0",
30
+    "vue-axios-plugin": "^1.3.0",
31
+    "vue-router": "3.0.6",
32
+    "vuedraggable": "^2.24.3",
33
+    "vuex": "3.1.0"
34
+  },
35
+  "devDependencies": {
36
+    "@vue/cli-plugin-babel": "4.4.4",
37
+    "@vue/cli-plugin-eslint": "4.4.4",
38
+    "@vue/cli-plugin-unit-jest": "4.4.4",
39
+    "@vue/cli-service": "4.4.4",
40
+    "@vue/test-utils": "1.0.0-beta.29",
41
+    "autoprefixer": "9.5.1",
42
+    "babel-eslint": "10.1.0",
43
+    "babel-jest": "23.6.0",
44
+    "babel-plugin-dynamic-import-node": "2.3.3",
45
+    "chalk": "2.4.2",
46
+    "connect": "3.6.6",
47
+    "eslint": "6.7.2",
48
+    "eslint-plugin-vue": "6.2.2",
49
+    "html-webpack-plugin": "3.2.0",
50
+    "mockjs": "1.0.1-beta3",
51
+    "runjs": "4.3.2",
52
+    "sass": "1.26.8",
53
+    "sass-loader": "8.0.2",
54
+    "script-ext-html-webpack-plugin": "2.1.3",
55
+    "serve-static": "1.13.2",
56
+    "svg-sprite-loader": "4.1.3",
57
+    "svgo": "1.2.2",
58
+    "vue-template-compiler": "2.6.10"
59
+  },
60
+  "browserslist": [
61
+    "> 1%",
62
+    "last 2 versions"
63
+  ],
64
+  "engines": {
65
+    "node": ">=8.9",
66
+    "npm": ">= 3.0.0"
67
+  },
68
+  "license": "MIT"
69
+}

+ 8
- 0
postcss.config.js 查看文件

@@ -0,0 +1,8 @@
1
+// https://github.com/michael-ciniawsky/postcss-load-config
2
+
3
+module.exports = {
4
+  'plugins': {
5
+    // to edit target browsers: use "browserslist" field in package.json
6
+    'autoprefixer': {}
7
+  }
8
+}

二進制
public/favicon.ico 查看文件


+ 17
- 0
public/index.html 查看文件

@@ -0,0 +1,17 @@
1
+<!DOCTYPE html>
2
+<html>
3
+  <head>
4
+    <meta charset="utf-8">
5
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
7
+    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8
+    <title><%= webpackConfig.name %></title>
9
+  </head>
10
+  <body>
11
+    <noscript>
12
+      <strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13
+    </noscript>
14
+    <div id="app"></div>
15
+    <!-- built files will be auto injected -->
16
+  </body>
17
+</html>

+ 28
- 0
src/App.vue 查看文件

@@ -0,0 +1,28 @@
1
+<template>
2
+  <div id="app">
3
+    <router-view />
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  name: 'App'
10
+}
11
+</script>
12
+<style>
13
+.body_edit {
14
+  padding: 24px;
15
+  font-size: 14px;
16
+  background: white;
17
+  height: 100%;
18
+}
19
+.box-card {
20
+  margin-bottom: 16px;
21
+}
22
+.body {
23
+  padding: 24px;
24
+}
25
+.el-form-item__content .el-input-group{
26
+  vertical-align: middle;
27
+}
28
+</style>

+ 46
- 0
src/api/answer.js 查看文件

@@ -0,0 +1,46 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+* 保存答案
5
+* @param {*} data
6
+* @returns
7
+*/
8
+export const saveAnswer = (data) => request({
9
+  url: '/admin/answer',
10
+  method: 'post',
11
+  data
12
+})
13
+
14
+/**
15
+ * 答案列表
16
+ * @param {*} params
17
+ * @returns
18
+ */
19
+export const getAnswerList = (params) => request({
20
+  url: '/admin/answer', params
21
+})
22
+
23
+/**
24
+ * 删除答案
25
+ * @param {*} data
26
+ * @returns
27
+ */
28
+export const deleteAnswer = (id) => request({
29
+  url: `/admin/answer/${id}`, method: 'delete'
30
+})
31
+/**
32
+ * 更新答案
33
+ * @param {*} data
34
+ * @returns
35
+ */
36
+export const UpdateAnswer = (data, id) => request({
37
+  url: `/admin/answer/${id}`, method: 'put', data
38
+})
39
+/**
40
+ * 查询答案详情
41
+ * @param {*} params
42
+ * @returns
43
+ */
44
+export const getAnswerDetail = (id, params) => request({
45
+  url: `/admin/answer/${id}`, params
46
+})

+ 46
- 0
src/api/game.js 查看文件

@@ -0,0 +1,46 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+* 保存游戏
5
+* @param {*} data
6
+* @returns
7
+*/
8
+export const saveGame = (data) => request({
9
+  url: '/admin/game',
10
+  method: 'post',
11
+  data
12
+})
13
+
14
+/**
15
+ * 游戏列表
16
+ * @param {*} params
17
+ * @returns
18
+ */
19
+export const getGameList = (params) => request({
20
+  url: '/admin/game', params
21
+})
22
+
23
+/**
24
+ * 删除游戏
25
+ * @param {*} data
26
+ * @returns
27
+ */
28
+export const deleteGame = (id) => request({
29
+  url: `/admin/game/${id}`, method: 'delete'
30
+})
31
+/**
32
+ * 更新游戏
33
+ * @param {*} data
34
+ * @returns
35
+ */
36
+export const UpdateGame = (data, id) => request({
37
+  url: `/admin/game/${id}`, method: 'put', data
38
+})
39
+/**
40
+ * 查询游戏详情
41
+ * @param {*} params
42
+ * @returns
43
+ */
44
+export const getGameDetail = (id) => request({
45
+  url: `/admin/game/${id}`
46
+})

+ 46
- 0
src/api/gameCharacter.js 查看文件

@@ -0,0 +1,46 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+* 保存特征
5
+* @param {*} data
6
+* @returns
7
+*/
8
+export const saveGameCharacter = (data) => request({
9
+  url: '/admin/game-character',
10
+  method: 'post',
11
+  data
12
+})
13
+
14
+/**
15
+ * 特征列表
16
+ * @param {*} params
17
+ * @returns
18
+ */
19
+export const getGameCharacterList = (params) => request({
20
+  url: '/admin/game-character', params
21
+})
22
+
23
+/**
24
+ * 删除特征
25
+ * @param {*} data
26
+ * @returns
27
+ */
28
+export const deleteGameCharacter = (id) => request({
29
+  url: `/admin/game-character/${id}`, method: 'delete'
30
+})
31
+/**
32
+ * 更新特征
33
+ * @param {*} data
34
+ * @returns
35
+ */
36
+export const UpdateGameCharacter = (data, id) => request({
37
+  url: `/admin/game-character/${id}`, method: 'put', data
38
+})
39
+/**
40
+ * 查询特征详情
41
+ * @param {*} params
42
+ * @returns
43
+ */
44
+export const getGameCharacterDetail = (id) => request({
45
+  url: `/admin/game-character/${id}`
46
+})

+ 38
- 0
src/api/gamelevelquestion.js 查看文件

@@ -0,0 +1,38 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+ * 删除关联
5
+ * @param {*} data
6
+ * @returns
7
+ */
8
+export const deleteGameLeverQuestion = (id) => request({
9
+  url: `/admin/game-level-question/${id}`, method: 'delete'
10
+})
11
+/**
12
+ * 更新测试游戏问题的分数
13
+ * @param {*} data
14
+ * @returns
15
+ */
16
+export const UpdateGameLeverQuestion = (data, id) => request({
17
+  url: `/admin/game-level-question/${id}`, method: 'put', data
18
+})
19
+
20
+/**
21
+* 添加关联游戏和题库的接口
22
+* @param {*} data
23
+* @returns
24
+*/
25
+export const saveGameLeverQuestion = (data) => request({
26
+  url: '/admin/game-level-question',
27
+  method: 'post',
28
+  data
29
+})
30
+
31
+/**
32
+ * 查询关联详情
33
+ * @param {*} params
34
+ * @returns
35
+ */
36
+export const getGameLeverQuestionDetail = (id, params) => request({
37
+  url: `/admin/game-level-question/${id}`, params
38
+})

+ 60
- 0
src/api/oss.js 查看文件

@@ -0,0 +1,60 @@
1
+import OSS from 'ali-oss'
2
+import request from '@/utils/request'
3
+
4
+let client
5
+let stsInfo
6
+
7
+/**
8
+ * 获取 OSS-STS 临时凭证
9
+ * @returns
10
+ */
11
+export const getSTSToken = () => request({ url: '/admin/oss-sts' })
12
+
13
+/**
14
+ * 获取 OSS 客户端
15
+ * @returns
16
+ */
17
+export function getOSSClient() {
18
+  if (client) {
19
+    return Promise.resolve(client)
20
+  }
21
+
22
+  return getSTSToken().then((sts) => {
23
+    stsInfo = sts
24
+    client = new OSS({
25
+      accessKeyId: sts.data.accessKeyId,
26
+      accessKeySecret: sts.data.accessKeySecret,
27
+      stsToken: sts.data.stsToken,
28
+      bucket: sts.data.bucket,
29
+      endpoint: sts.data.endpoint,
30
+      refreshSTSTokenInterval: 25 * 60 * 1000, // 每25min刷新一次
31
+      refreshSTSToken: () => {
32
+        return getSTSToken().then((res) => {
33
+          return {
34
+            accessKeyId: res.accessKeyId,
35
+            accessKeySecret: res.accessKeySecret,
36
+            stsToken: res.stsToken
37
+          }
38
+        })
39
+      }
40
+    })
41
+
42
+    return client
43
+  })
44
+}
45
+
46
+/**
47
+ * 上传文件到 OSS
48
+ * @param {*} file
49
+ * @returns
50
+ */
51
+export function upload(file) {
52
+  return getOSSClient().then(() => {
53
+    const data = new FormData()
54
+    data.append('file', file)
55
+    const now = new Date()
56
+    const fileName = `${stsInfo.path}/${now.valueOf()}-${file.name}`
57
+
58
+    return client.put(fileName, file).then((res) => res.url)
59
+  })
60
+}

+ 55
- 0
src/api/question.js 查看文件

@@ -0,0 +1,55 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+* 保存游戏题库
5
+* @param {*} data
6
+* @returns
7
+*/
8
+export const saveQuestion = (data) => request({
9
+  url: '/admin/question',
10
+  method: 'post',
11
+  data
12
+})
13
+
14
+/**
15
+ * 游戏题库列表
16
+ * @param {*} params
17
+ * @returns
18
+ */
19
+export const getQuestionList = (params) => request({
20
+  url: '/admin/question', params
21
+})
22
+
23
+/**
24
+ * 删除游戏题库
25
+ * @param {*} data
26
+ * @returns
27
+ */
28
+export const deleteQuestion = (id) => request({
29
+  url: `/admin/question/${id}`, method: 'delete'
30
+})
31
+/**
32
+ * 更新游戏题库
33
+ * @param {*} data
34
+ * @returns
35
+ */
36
+export const UpdateQuestion = (data, id) => request({
37
+  url: `/admin/question/${id}`, method: 'put', data
38
+})
39
+/**
40
+ * 查询游戏题库详情
41
+ * @param {*} params
42
+ * @returns
43
+ */
44
+export const getQuestionDetail = (id, params) => request({
45
+  url: `/admin/question/${id}`, params
46
+})
47
+
48
+/**
49
+ * 更新游戏题目顺序
50
+ * @param {*} data
51
+ * @returns
52
+ */
53
+export const UpdateQuestionSort = (data, id) => request({
54
+  url: `/admin/game/${id}/sort`, method: 'put', data
55
+})

+ 77
- 0
src/api/user.js 查看文件

@@ -0,0 +1,77 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+* 用户列表
5
+* @param {*} data
6
+* @returns
7
+*/
8
+export const getUserList = (params) => request({
9
+  url: '/admin/user', params
10
+})
11
+
12
+/**
13
+ * 登录
14
+ * @param {*} data
15
+ * @returns
16
+ */
17
+export function login(data) {
18
+  return request({
19
+    url: '/admin/login',
20
+    method: 'post',
21
+    data
22
+  })
23
+}
24
+
25
+/**
26
+* 注册账号
27
+* @param {*} data
28
+* @returns
29
+*/
30
+export const signUp = (data) => request({
31
+  url: '/admin/signup',
32
+  method: 'post',
33
+  data
34
+})
35
+
36
+/**
37
+ * 获取验证码
38
+ * @param {*} params
39
+ * @returns
40
+ */
41
+export const getCaptcha = (params) => request({
42
+  url: '/admin/captcha', params
43
+})
44
+
45
+/**
46
+ * 修改密码
47
+ * @param {*} data
48
+ * @returns
49
+ */
50
+export const changePassword = (data) => request({
51
+  url: '/admin/change-password', method: 'put', data
52
+})
53
+/**
54
+ * 启用账号
55
+ * @param {*} data
56
+ * @returns
57
+ */
58
+export const enableUser = (id) => request({
59
+  url: `/admin/user/${id}/on`, method: 'put'
60
+})
61
+/**
62
+ * 禁用账号
63
+ * @param {*} data
64
+ * @returns
65
+ */
66
+export const disableUser = (id) => request({
67
+  url: `/admin/user/${id}/off`, method: 'put'
68
+})
69
+
70
+/**
71
+ * 找回密码
72
+ * @param {*} data
73
+ * @returns
74
+ */
75
+export const findPassword = (data) => request({
76
+  url: '/admin/find-password', method: 'put', data
77
+})

二進制
src/assets/404_images/404.png 查看文件


二進制
src/assets/404_images/404_cloud.png 查看文件


+ 78
- 0
src/components/Breadcrumb/index.vue 查看文件

@@ -0,0 +1,78 @@
1
+<template>
2
+  <el-breadcrumb class="app-breadcrumb" separator="/">
3
+    <transition-group name="breadcrumb">
4
+      <el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
5
+        <span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
6
+        <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
7
+      </el-breadcrumb-item>
8
+    </transition-group>
9
+  </el-breadcrumb>
10
+</template>
11
+
12
+<script>
13
+import pathToRegexp from 'path-to-regexp'
14
+
15
+export default {
16
+  data() {
17
+    return {
18
+      levelList: null
19
+    }
20
+  },
21
+  watch: {
22
+    $route() {
23
+      this.getBreadcrumb()
24
+    }
25
+  },
26
+  created() {
27
+    this.getBreadcrumb()
28
+  },
29
+  methods: {
30
+    getBreadcrumb() {
31
+      // only show routes with meta.title
32
+      let matched = this.$route.matched.filter(item => item.meta && item.meta.title)
33
+      const first = matched[0]
34
+
35
+      if (!this.isDashboard(first)) {
36
+        matched = [{ path: '/dashboard', meta: { title: '工作台' }}].concat(matched)
37
+      }
38
+
39
+      this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
40
+    },
41
+    isDashboard(route) {
42
+      const name = route && route.name
43
+      if (!name) {
44
+        return false
45
+      }
46
+      return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase()
47
+    },
48
+    pathCompile(path) {
49
+      // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
50
+      const { params } = this.$route
51
+      var toPath = pathToRegexp.compile(path)
52
+      return toPath(params)
53
+    },
54
+    handleLink(item) {
55
+      const { redirect, path } = item
56
+      if (redirect) {
57
+        this.$router.push(redirect)
58
+        return
59
+      }
60
+      this.$router.push(this.pathCompile(path))
61
+    }
62
+  }
63
+}
64
+</script>
65
+
66
+<style lang="scss" scoped>
67
+.app-breadcrumb.el-breadcrumb {
68
+  display: inline-block;
69
+  font-size: 14px;
70
+  line-height: 50px;
71
+  margin-left: 8px;
72
+
73
+  .no-redirect {
74
+    color: #97a8be;
75
+    cursor: text;
76
+  }
77
+}
78
+</style>

+ 108
- 0
src/components/GameCharacter/edit.vue 查看文件

@@ -0,0 +1,108 @@
1
+<template>
2
+  <div style="padding: 20px">
3
+    <h2 style="text-align: center">
4
+      特征实例{{ characterId ? "编辑" : "添加" }}
5
+    </h2>
6
+    <el-form ref="form" :model="form" :rules="rules" label-width="150px">
7
+      <el-form-item label="实例名称:" prop="name">
8
+        <el-input
9
+          v-model="form.name"
10
+          placeholder="请输入实例名(必填)"
11
+        />
12
+      </el-form-item>
13
+      <el-form-item label="实例图片:">
14
+        <UploadImage :icon="form.thumb" @handleChange="handleChange" @handleDeleteIcon="handleDeleteIcon" />
15
+      </el-form-item>
16
+      <el-form-item label="实例描述:">
17
+        <el-input v-model="form.desc" type="textarea" />
18
+      </el-form-item>
19
+      <el-form-item>
20
+        <el-button type="primary" @click="onSubmit('form')">确定</el-button>
21
+        <el-button @click="$router.go(-1)">返回</el-button>
22
+      </el-form-item>
23
+    </el-form>
24
+  </div>
25
+</template>
26
+<script>
27
+import { getGameCharacterDetail, UpdateGameCharacter, saveGameCharacter } from '@/api/gameCharacter'
28
+import UploadImage from '@/components/UploadImage/index.vue'
29
+export default {
30
+  components: {
31
+    UploadImage
32
+  },
33
+  props: {
34
+    gameId: String,
35
+    characterId: String
36
+  },
37
+  data() {
38
+    return {
39
+      form: {
40
+        gameId: undefined,
41
+        name: undefined,
42
+        thumb: undefined,
43
+        desc: undefined,
44
+        characterId: undefined,
45
+        status: 1
46
+      },
47
+      rules: {
48
+        name: [{ required: true, message: '请输入特征名称', trigger: 'blur' }]
49
+      }
50
+    }
51
+  },
52
+  watch: {
53
+    characterId: function() {
54
+      if (this.characterId) {
55
+        getGameCharacterDetail(this.characterId).then((res) => {
56
+          this.form = res.data
57
+        })
58
+      } else {
59
+        this.form = {
60
+          name: undefined,
61
+          thumb: undefined,
62
+          desc: undefined,
63
+          characterId: undefined
64
+        }
65
+      }
66
+    }
67
+  },
68
+  methods: {
69
+    onSubmit(form) {
70
+      this.$refs[form].validate((valid) => {
71
+        if (valid) {
72
+          const data = { ...this.form }
73
+          data.gameId = this.gameId
74
+          if (this.characterId) {
75
+            data.characterId = this.characterId
76
+            if (!data.thumb) {
77
+              data.thumb = ''
78
+            }
79
+            UpdateGameCharacter(data, this.characterId).then((res) => {
80
+              this.$message('修改实例成功')
81
+              // 告诉父页面实例表需要刷新
82
+              this.$emit('handleRefreshGameCharacter', true)
83
+            })
84
+          } else {
85
+            saveGameCharacter(data).then((res) => {
86
+              this.$message('添加实例成功')
87
+              // 告诉父页面实例表需要刷新
88
+              this.$emit('handleRefreshGameCharacter', true)
89
+              // 把当前页改为编辑页面
90
+              this.$emit('handleEditGameCharacter', res.data.characterId)
91
+            })
92
+          }
93
+        } else {
94
+          return false
95
+        }
96
+      })
97
+    },
98
+    handleChange(val) {
99
+      this.form.thumb = val
100
+    },
101
+    handleDeleteIcon() {
102
+      this.form.thumb = ''
103
+    }
104
+  }
105
+}
106
+</script>
107
+<style>
108
+</style>

+ 146
- 0
src/components/GameCharacter/index.vue 查看文件

@@ -0,0 +1,146 @@
1
+<template>
2
+  <div class="body" style="font-size:14px">
3
+    <el-card class="box-card" shadow="never">
4
+      <div slot="header" class="clearfix">
5
+        <el-button
6
+          type="primary"
7
+          style="float: right"
8
+          icon="el-icon-plus"
9
+          @click="handleAdd"
10
+        >添加特征</el-button>
11
+      </div>
12
+      <!-- <el-button type="primary" style="float: right; margin-bottom: 20px;" icon="el-icon-plus" @click="handleAdd">添加特征</el-button> -->
13
+      <el-table stripe :data="tableData" border style="width: 100%">
14
+        <el-table-column prop="name" label="实例名称" />
15
+        <el-table-column prop="thumb" label="实例图片">
16
+          <template slot-scope="scope">
17
+            <el-image :src="scope.row.thumb" style="width: 100px; height: 100px" />
18
+          </template>
19
+        </el-table-column>
20
+        <el-table-column prop="createDate" label="创建时间">
21
+          <template slot-scope="scope">{{
22
+            scope.row.createDate.substr(0, 10)
23
+          }}</template>
24
+        </el-table-column>
25
+        <el-table-column fixed="right" label="操作">
26
+          <template slot-scope="scope">
27
+            <el-button style="margin-right:1em" type="text" @click="handleEdit(scope.row)">编辑</el-button>
28
+            <el-popconfirm
29
+              icon="el-icon-info"
30
+              icon-color="red"
31
+              title="确定删除这个特征吗?"
32
+              @onConfirm="handleDelete(scope.row)"
33
+            >
34
+              <el-button slot="reference" type="text" style="color:red">删除</el-button>
35
+            </el-popconfirm>
36
+          </template>
37
+        </el-table-column>
38
+      </el-table>
39
+      <el-pagination
40
+        v-show="characterTotal!==0"
41
+        style="float:right; margin:20px 0"
42
+        :total="characterTotal"
43
+        :current-page="currentPage"
44
+        :page-size="pageSize"
45
+        layout="total, prev, pager, next, sizes"
46
+        @size-change="handleSizeChange"
47
+        @current-change="handleCurrentChange"
48
+      />
49
+    </el-card>
50
+  </div>
51
+</template>
52
+<script>
53
+import { getGameCharacterList, deleteGameCharacter } from '@/api/gameCharacter'
54
+
55
+export default {
56
+  props: {
57
+    gameId: String
58
+  },
59
+  data() {
60
+    return {
61
+      name: undefined,
62
+      daterange: '',
63
+      tableData: [],
64
+      endDate: undefined,
65
+      startDate: undefined,
66
+      pageSize: 10,
67
+      currentPage: 1,
68
+      characterTotal: 0
69
+    }
70
+  },
71
+  watch: {
72
+    gameId: {
73
+      handler(val) {
74
+        if (this.gameId) {
75
+          this.onSearch()
76
+        }
77
+      },
78
+      immediate: true // 页面加载时就启动
79
+    }
80
+  },
81
+  methods: {
82
+    // 改变每页显示条数
83
+    handleSizeChange(val) {
84
+      this.pageSize = val
85
+      this.changePagination()
86
+    },
87
+    // 改变页码
88
+    handleCurrentChange(val) {
89
+      this.currentPage = val
90
+      this.changePagination()
91
+    },
92
+    // 改变分页组件重新查询数据
93
+    changePagination() {
94
+      getGameCharacterList({
95
+        gameId: this.gameId,
96
+        pageNum: this.currentPage,
97
+        pageSize: this.pageSize
98
+      }).then((res) => {
99
+        this.tableData = res.data.records
100
+        // 讲特征列表写入store 供问题答案特征下拉使用
101
+        const list = []
102
+        this.tableData.map(item => {
103
+          list.push({ characterId: item.characterId, name: item.name })
104
+        })
105
+        this.$store.dispatch('game/setWordListValue', list).then(() => {})
106
+      })
107
+    },
108
+    handleAdd() {
109
+      this.$emit('handleAddGameCharacter', true)
110
+    },
111
+    handleEdit(row) {
112
+      this.$emit('handleEditGameCharacter', row.characterId)
113
+    },
114
+    handleDelete(row) {
115
+      deleteGameCharacter(row.characterId).then(() => {
116
+        // 让父组件给右边编辑特征页面一个空的characterId
117
+        // 防止当前特征正在编辑时删除了右边再次进行保存会报错
118
+        this.$message('删除特征成功')
119
+        this.$emit('handleCloseGameCharacter', true)
120
+        this.onSearch()
121
+      })
122
+    },
123
+    onSearch() {
124
+      getGameCharacterList({
125
+        gameId: this.gameId
126
+      }).then((res) => {
127
+        this.tableData = res.data.records
128
+        this.characterTotal = res.data.total
129
+        this.pageSize = res.data.size
130
+        // 讲特征列表写入store 供问题答案特征下拉使用
131
+        const list = []
132
+        this.tableData.map(item => {
133
+          list.push({ characterId: item.characterId, name: item.name })
134
+        })
135
+        this.$store.dispatch('game/setWordListValue', list).then(() => {})
136
+      })
137
+    },
138
+    dateChange(val) {
139
+      this.startDate = this.daterange[0]
140
+      this.endDate = this.daterange[1]
141
+    }
142
+  }
143
+}
144
+</script>
145
+<style>
146
+</style>

+ 44
- 0
src/components/Hamburger/index.vue 查看文件

@@ -0,0 +1,44 @@
1
+<template>
2
+  <div style="padding: 0 15px;" @click="toggleClick">
3
+    <svg
4
+      :class="{'is-active':isActive}"
5
+      class="hamburger"
6
+      viewBox="0 0 1024 1024"
7
+      xmlns="http://www.w3.org/2000/svg"
8
+      width="64"
9
+      height="64"
10
+    >
11
+      <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z" />
12
+    </svg>
13
+  </div>
14
+</template>
15
+
16
+<script>
17
+export default {
18
+  name: 'Hamburger',
19
+  props: {
20
+    isActive: {
21
+      type: Boolean,
22
+      default: false
23
+    }
24
+  },
25
+  methods: {
26
+    toggleClick() {
27
+      this.$emit('toggleClick')
28
+    }
29
+  }
30
+}
31
+</script>
32
+
33
+<style scoped>
34
+.hamburger {
35
+  display: inline-block;
36
+  vertical-align: middle;
37
+  width: 20px;
38
+  height: 20px;
39
+}
40
+
41
+.hamburger.is-active {
42
+  transform: rotate(180deg);
43
+}
44
+</style>

+ 231
- 0
src/components/Question/drawer.vue 查看文件

@@ -0,0 +1,231 @@
1
+<template>
2
+  <div>
3
+    <el-drawer
4
+      ref="drawer"
5
+      :show-close="false"
6
+      :wrapperClosable="false"
7
+      :title="answerId ?'编辑答案' : '添加答案'"
8
+      :before-close="handleClose"
9
+      :visible.sync="dialog"
10
+      direction="ltr"
11
+      custom-class="demo-drawer"
12
+    >
13
+      <div class="demo-drawer__content">
14
+        <el-form ref="form" :model="form" :rules="rules" style="margin:20px">
15
+          <el-form-item label="答案:" prop="content" :label-width="formLabelWidth">
16
+            <el-input v-model="form.content" placeholder="请输入答案(必填)">
17
+              <el-select
18
+                slot="prepend"
19
+                v-model="form.option"
20
+                filterable
21
+                allow-create
22
+                default-first-option
23
+                style="width:100px"
24
+                placeholder="请选择"
25
+              >
26
+                <el-option
27
+                  v-for="item in options"
28
+                  :key="item.value"
29
+                  :label="item.label"
30
+                  :value="item.value"
31
+                />
32
+              </el-select>
33
+            </el-input>
34
+          </el-form-item>
35
+          <el-form-item label="匹配特征:" :label-width="formLabelWidth">
36
+            <el-select
37
+              v-model="form.characterList"
38
+              multiple
39
+              filterable
40
+              default-first-option
41
+              placeholder="请选择特征"
42
+              style="width:100%"
43
+            >
44
+              <el-option
45
+                v-for="item in wordList"
46
+                :key="item.characterId"
47
+                :label="item.name"
48
+                :value="item.characterId"
49
+              />
50
+            </el-select>
51
+          </el-form-item>
52
+          <el-form-item style="text-align:center">
53
+            <el-button @click="handleClose">取 消</el-button>
54
+            <el-button type="primary" @click="onSubmit('form')">确 定</el-button>
55
+          </el-form-item>
56
+        </el-form>
57
+      </div>
58
+    </el-drawer>
59
+  </div>
60
+</template>
61
+<script>
62
+import { getAnswerDetail, saveAnswer, UpdateAnswer } from '@/api/answer'
63
+export default {
64
+  props: {
65
+    dialog: Boolean,
66
+    questionId: String,
67
+    answerId: String,
68
+    gameId: String
69
+  },
70
+  data() {
71
+    return {
72
+      rules: {
73
+        content: [
74
+          { required: true, message: '请输入答案内容', trigger: 'blur' }
75
+        ]
76
+      },
77
+      form: {
78
+        option: undefined,
79
+        content: undefined,
80
+        characterList: [],
81
+        sortNo: 1,
82
+        status: 1
83
+      },
84
+      formLabelWidth: '120px',
85
+      options: [
86
+        {
87
+          value: 'A',
88
+          label: 'A'
89
+        },
90
+        {
91
+          value: 'B',
92
+          label: 'B'
93
+        },
94
+        {
95
+          value: 'C',
96
+          label: 'C'
97
+        },
98
+        {
99
+          value: 'D',
100
+          label: 'D'
101
+        },
102
+        {
103
+          value: 'true',
104
+          label: '对'
105
+        },
106
+        {
107
+          value: 'false',
108
+          label: '错'
109
+        }
110
+      ]
111
+    }
112
+  },
113
+  computed: {
114
+    wordList() {
115
+      return this.$store.state.game.wordList
116
+    }
117
+  },
118
+  watch: {
119
+    answerId() {
120
+      if (this.answerId) {
121
+        getAnswerDetail(this.answerId, { gameId: this.gameId }).then((res) => {
122
+          this.form = res.data
123
+          if (res.data.characterList) {
124
+            const list = []
125
+            res.data.characterList.map((item) => {
126
+              list.push(item.characterId)
127
+            })
128
+            this.form.characterList = list
129
+          }
130
+        })
131
+      }
132
+    }
133
+  },
134
+  methods: {
135
+    onSubmit(form) {
136
+      this.$refs[form].validate((valid) => {
137
+        if (valid) {
138
+          if (this.form.option) {
139
+            const list = this.wordList.filter((item) =>
140
+              this.form.characterList.includes(item.characterId)
141
+            )
142
+            const data = { ...this.form }
143
+            if (list) {
144
+              list.map((item) => {
145
+                item.gameId = this.gameId
146
+              })
147
+              data.characterList = list
148
+            }
149
+            switch (data.option) {
150
+              case 'A':
151
+                data.sortNo = 1
152
+                break
153
+              case 'B':
154
+                data.sortNo = 2
155
+                break
156
+              case 'C':
157
+                data.sortNo = 3
158
+                break
159
+              case 'D':
160
+                data.sortNo = 4
161
+                break
162
+              case 'E':
163
+                data.sortNo = 5
164
+                break
165
+              case 'F':
166
+                data.sortNo = 6
167
+                break
168
+              case 'G':
169
+                data.sortNo = 7
170
+                break
171
+              case 'H':
172
+                data.sortNo = 8
173
+                break
174
+              case 'I':
175
+                data.sortNo = 9
176
+                break
177
+              case 'J':
178
+                data.sortNo = 10
179
+                break
180
+              case 'true':
181
+                data.sortNo = 1
182
+                break
183
+              case 'false':
184
+                data.sortNo = 2
185
+                break
186
+              default:
187
+                break
188
+            }
189
+            if (this.answerId) {
190
+              UpdateAnswer(data, this.answerId).then((res) => {
191
+                this.$message('修改成功')
192
+                this.$emit('handleEditDrawer', true)
193
+                this.form = {
194
+                  option: undefined,
195
+                  content: undefined,
196
+                  characterList: []
197
+                }
198
+              })
199
+            } else {
200
+              data.questionId = this.questionId
201
+              saveAnswer(data).then((res) => {
202
+                this.$message('添加成功')
203
+                this.$emit('handleEditDrawer', true)
204
+                this.form = {
205
+                  option: undefined,
206
+                  content: undefined,
207
+                  characterList: []
208
+                }
209
+              })
210
+            }
211
+          } else {
212
+            this.$message('请在灰色下来菜单中添加选项')
213
+          }
214
+        } else {
215
+          return false
216
+        }
217
+      })
218
+    },
219
+    handleClose() {
220
+      this.$emit('handleCloseDrawer', true)
221
+      this.form = {
222
+        option: undefined,
223
+        content: undefined,
224
+        characterList: []
225
+      }
226
+    }
227
+  }
228
+}
229
+</script>
230
+<style>
231
+</style>

+ 282
- 0
src/components/Question/edit.vue 查看文件

@@ -0,0 +1,282 @@
1
+<template>
2
+  <div style="padding: 20px">
3
+    <h2 style="text-align: center">
4
+      游戏题目{{ gameQuestionMapId!==0 ? "编辑" : "添加" }}
5
+    </h2>
6
+    <el-form ref="form" :model="form" label-width="90px">
7
+      <el-form-item label="题目:">
8
+        <el-input v-if="resultMode === 'character_matched'" v-model="form.title" placeholder="请输入实例名(必填)">
9
+          <el-select slot="prepend" v-model="form.optType" style="width:100px" placeholder="请选择">
10
+            <el-option label="单选题" value="single" />
11
+            <el-option label="多选题" value="many" />
12
+            <el-option label="判断题" value="judgment" />
13
+          </el-select>
14
+        </el-input>
15
+        <el-select
16
+          v-else
17
+          v-model="nowQuestionId"
18
+          filterable
19
+          default-first-option
20
+          style="width:100%"
21
+          placeholder="请选择"
22
+          :disabled="gameQuestionMapId!==0"
23
+        >
24
+          <el-option
25
+            v-for="item in questionList"
26
+            :key="item.questionId"
27
+            :label="item.title"
28
+            :value="item.questionId"
29
+          />
30
+        </el-select>
31
+      </el-form-item>
32
+      <el-form-item v-if="resultMode==='examination'" label="分数">
33
+        <el-input v-model="form.score" type="number" min="1" max="50" />
34
+      </el-form-item>
35
+      <el-form-item
36
+        v-if="gameQuestionMapId!==0 && resultMode === 'examination'"
37
+        label="正确选项:"
38
+      >
39
+        <!-- filterable可搜索 multiple可多选 default-first-option回车可选-->
40
+        <el-select
41
+          v-model="form.rightAnswer"
42
+          disabled
43
+          style="width:100%"
44
+          multiple
45
+          filterable
46
+          default-first-option
47
+          placeholder="请选择"
48
+        >
49
+          <el-option
50
+            v-for="item in rightList"
51
+            :key="item"
52
+            :label="item"
53
+            :value="item"
54
+          />
55
+        </el-select>
56
+      </el-form-item>
57
+      <el-form-item>
58
+        <el-button type="primary" @click="onSubmit">确定</el-button>
59
+        <el-button @click="$router.go(-1)">返回</el-button>
60
+      </el-form-item>
61
+    </el-form>
62
+    <el-card v-if="gameQuestionMapId!==0" shadow="never" body-style="padding:0" class="box-card">
63
+      <div slot="header" class="clearfix">
64
+        <h3 style="float:left">答案列表</h3>
65
+        <el-button
66
+          v-if=" resultMode !== 'examination'"
67
+          type="primary"
68
+          style="float: right"
69
+          icon="el-icon-plus"
70
+          @click="onAddAnswer"
71
+        >添加答案</el-button>
72
+      </div>
73
+      <ul style="list-style-type: none;margin:24px 0 24px -40px">
74
+        <li v-for="answer in answerList" :key="answer.answerId" class="answerli">
75
+          <div style="flex:1;width: 100%;overflow: hidden;display: flex;" @click="resultMode === 'examination'?'':handleEdit(answer)">
76
+            <span style="width:45px">{{ answer.option }}</span>
77
+            <span style="flex:1">{{ answer.content }}</span>
78
+          </div>
79
+          <el-popconfirm
80
+            v-if="resultMode !== 'examination'"
81
+            style="width:30px"
82
+            icon="el-icon-info"
83
+            icon-color="red"
84
+            title="确定删除这个答案吗?"
85
+            @onConfirm="handleDelete(answer)"
86
+          >
87
+            <el-button slot="reference" type="text" class="deleteQuestion" style="color:red">删除</el-button>
88
+          </el-popconfirm>
89
+        </li>
90
+      </ul>
91
+    </el-card>
92
+    <QuestionDrawer
93
+      :dialog="dialog"
94
+      :question-id="form.questionId"
95
+      :answer-id="answerId"
96
+      :game-id="gameId"
97
+      @handleCloseDrawer="handleCloseDrawer"
98
+      @handleEditDrawer="handleEditDrawer"
99
+    />
100
+  </div>
101
+</template>
102
+<script>
103
+
104
+import { getQuestionList } from '@/api/question'
105
+import { getAnswerList, deleteAnswer } from '@/api/answer'
106
+import { saveGameLeverQuestion, UpdateGameLeverQuestion, getGameLeverQuestionDetail } from '@/api/gamelevelquestion'
107
+import QuestionDrawer from '@/components/Question/drawer.vue'
108
+
109
+export default {
110
+  components: {
111
+    QuestionDrawer
112
+  },
113
+  props: {
114
+    gameQuestionMapId: {
115
+      type: Number,
116
+      required: true
117
+    },
118
+    gameId: {
119
+      type: String,
120
+      required: true
121
+    },
122
+    resultMode: String
123
+  },
124
+  data() {
125
+    return {
126
+      form: {
127
+        title: undefined,
128
+        optType: undefined,
129
+        rightAnswer: undefined,
130
+        gameId: undefined,
131
+        score: 0,
132
+        status: 1,
133
+        questionId: undefined
134
+      },
135
+      nowQuestionId: undefined, // 当前问题id用于获取答案列表 和匹配游戏模式传入答案编辑弹窗的questionId
136
+      questionList: [], // 用于存储测试模式下选择问题的下拉菜单的数据源
137
+      // 答案列表(包括选项 内容 特征词列表)
138
+      answerList: [],
139
+      answerId: undefined,
140
+      // 正确答案数据源
141
+      rightList: [],
142
+      dialog: false
143
+    }
144
+  },
145
+  watch: {
146
+    // 用于点击左边改变右边的页面
147
+    gameQuestionMapId: function() {
148
+      if (this.gameQuestionMapId !== 0) {
149
+        getGameLeverQuestionDetail(this.gameQuestionMapId, { gameId: this.gameId }).then((res) => {
150
+          this.form = res.data
151
+          this.form.rightAnswer = res.data.rightAnswer?.split(',')
152
+          this.nowQuestionId = res.data.questionId
153
+          getAnswerList({ questionId: res.data.questionId }).then((res) => {
154
+            this.answerList = res.data.records
155
+          })
156
+        })
157
+      } else {
158
+        this.form = {
159
+          title: undefined,
160
+          optType: undefined,
161
+          score: 0,
162
+          status: 1,
163
+          gameId: undefined,
164
+          rightAnswer: undefined,
165
+          questionId: undefined
166
+        }
167
+        this.nowQuestionId = undefined
168
+      }
169
+    }
170
+  },
171
+  mounted: function() {
172
+    getQuestionList({ pageSize: 999 }).then((res) => { this.questionList = res.data.records })
173
+  },
174
+  methods: {
175
+    // 添加答案
176
+    onAddAnswer() {
177
+      this.answerId = undefined
178
+      this.dialog = true
179
+    },
180
+    // 编辑答案
181
+    handleEdit(val) {
182
+      this.answerId = val.answerId
183
+      this.dialog = true
184
+    },
185
+    // 删除答案
186
+    handleDelete(val) {
187
+      deleteAnswer(val.answerId).then((res) => {
188
+        this.$message('删除答案成功')
189
+        this.handleAnswerList()
190
+      })
191
+    },
192
+    // 关闭答案抽屉
193
+    handleCloseDrawer() {
194
+      this.dialog = false
195
+    },
196
+    // 编辑答案抽屉成功重新查询列表
197
+    handleEditDrawer(val) {
198
+      this.handleCloseDrawer()
199
+      this.handleAnswerList()
200
+    },
201
+    // 查询当前问题答案列表
202
+    handleAnswerList() {
203
+      getAnswerList({ questionId: this.nowQuestionId }).then((res) => {
204
+        this.answerList = res.data.records
205
+      })
206
+    },
207
+    // 转换特征数组数据格式
208
+    handleToString(list) {
209
+      const nameList = []
210
+      list?.map(item => {
211
+        nameList.push(item.name)
212
+      })
213
+      return nameList.toString()
214
+    },
215
+    // 非空判断方法
216
+    handelNull() {
217
+      if (this.resultMode === 'examination') {
218
+        if (this.nowQuestionId) {
219
+          if (this.form.score && this.form.score !== 0) {
220
+            return true
221
+          } else {
222
+            this.$message('请输入本题分数')
223
+            return false
224
+          }
225
+        } else {
226
+          this.$message('请选择题目')
227
+          return false
228
+        }
229
+      } else {
230
+        if (this.form.optType) {
231
+          if (this.form.title) {
232
+            return true
233
+          } else {
234
+            this.$message('请输入题目')
235
+            return false
236
+          }
237
+        } else {
238
+          this.$message('请选择题型')
239
+          return false
240
+        }
241
+      }
242
+    },
243
+    onSubmit() {
244
+      if (this.handelNull()) {
245
+        const data = { ...this.form }
246
+        if (this.gameQuestionMapId === 0) {
247
+          saveGameLeverQuestion({ ...data, gameId: this.gameId, questionId: this.nowQuestionId }).then((res) => {
248
+            this.$message('添加问题成功')
249
+            this.$emit('handleRefreshQuestion', true)
250
+            this.$emit('handleEditQuestion', res.data.gameQuestionMapId)
251
+          })
252
+        } else {
253
+          if (data.rightAnswer) {
254
+            data.rightAnswer = data.rightAnswer.toString()
255
+          }
256
+          UpdateGameLeverQuestion({ ...data, gameId: this.gameId, questionId: this.nowQuestionId }, this.gameQuestionMapId).then((res) => {
257
+            this.$message('修改问题成功')
258
+            this.$emit('handleRefreshQuestion', true)
259
+          })
260
+        }
261
+      }
262
+    }
263
+  }
264
+}
265
+</script>
266
+<style scoped lang="scss">
267
+.answerli {
268
+  width: 100%;
269
+  overflow: hidden;
270
+  display: flex;
271
+  line-height:40px;
272
+  background-color: white;
273
+  padding:0 8px;
274
+  border: 1px solid #f0f2f5;
275
+}
276
+.answerli:hover {
277
+  background-color: rgb(230, 247, 255);
278
+}
279
+.answerli:nth-of-type(even) {
280
+  background: #f0f2f5;
281
+}
282
+</style>

+ 169
- 0
src/components/Question/index.vue 查看文件

@@ -0,0 +1,169 @@
1
+<template>
2
+  <div class="body">
3
+    <el-card class="box-card" shadow="never" body-style="padding:0">
4
+      <div slot="header" class="clearfix">
5
+        <h3 style="float:left">题库列表</h3>
6
+        <h4 v-if="resultMode==='examination'" style="float:left;margin-left: 10px;">总分{{ totalScore }}</h4>
7
+        <el-button
8
+          type="primary"
9
+          style="float: right"
10
+          icon="el-icon-plus"
11
+          @click="handleAdd"
12
+        >添加题目</el-button>
13
+      </div>
14
+      <!-- <ul style="list-style-type: none;margin:24px 0 0 -40px">
15
+        <li v-for="item,index in tableData" :key="index" class="questionli" @click="handleEdit(item)">
16
+          <span style="width:45px">第{{ index+1 }}题</span>
17
+          <span style="width:45px">{{ item.optType === 'single'?'单选题':item.optType==='many'?'多选题':'判断题' }}</span>
18
+          <span style="flex:1">{{ item.title }}</span>
19
+          <el-popconfirm
20
+            style="width:30px"
21
+            icon="el-icon-info"
22
+            icon-color="red"
23
+            title="确定删除这个问题吗?"
24
+            @onConfirm="handleDelete(item)"
25
+          >
26
+            <el-button slot="reference" type="text" style="color:red">删除</el-button>
27
+          </el-popconfirm>
28
+        </li>
29
+      </ul> -->
30
+      <draggable v-model="tableData" chosen-class="chosen" force-fallback="true" group="people" animation="1000" @end="onEnd">
31
+        <transition-group>
32
+          <div v-for="item,index in tableData" :key="index" class="questionli" @click="handleEdit(item)">
33
+            <span style="width:45px">第{{ index+1 }}题</span>
34
+            <span style="width:45px">{{ item.optType === 'single'?'单选题':item.optType==='many'?'多选题':'判断题' }}</span>
35
+            <span style="flex:1">{{ item.title }}</span>
36
+            <el-popconfirm
37
+              style="width:30px"
38
+              icon="el-icon-info"
39
+              icon-color="red"
40
+              title="确定删除这个问题吗?"
41
+              @onConfirm="handleDelete(item)"
42
+            >
43
+              <el-button slot="reference" type="text" style="color:red">删除</el-button>
44
+            </el-popconfirm>
45
+          </div>
46
+        </transition-group>
47
+      </draggable>
48
+      <el-pagination
49
+        v-show="questionTotal!==0"
50
+        style="float:right; margin:24px 0"
51
+        :total="questionTotal"
52
+        :current-page="currentPage"
53
+        :page-size="pageSize"
54
+        layout="total, prev, pager, next, sizes"
55
+        @size-change="handleSizeChange"
56
+        @current-change="handleCurrentChange"
57
+      />
58
+    </el-card>
59
+  </div>
60
+</template>
61
+<script>
62
+import { getQuestionList, UpdateQuestionSort } from '@/api/question'
63
+import { deleteGameLeverQuestion } from '@/api/gamelevelquestion'
64
+import draggable from 'vuedraggable'
65
+
66
+export default {
67
+  // 注册draggable组件
68
+  components: {
69
+    draggable
70
+  },
71
+  props: {
72
+    gameId: {
73
+      type: String,
74
+      required: true
75
+    },
76
+    resultMode: String
77
+  },
78
+  data() {
79
+    return {
80
+      tableData: [],
81
+      pageSize: 20,
82
+      currentPage: 1,
83
+      questionTotal: 0, // 条目总数
84
+      totalScore: 0
85
+    }
86
+  },
87
+  watch: {
88
+    gameId: {
89
+      handler(val) {
90
+        if (val) {
91
+          this.onSearch()
92
+        }
93
+      },
94
+      immediate: true // 页面加载时就启动
95
+    }
96
+  },
97
+  methods: {
98
+    // 拖拽结束事件
99
+    onEnd() {
100
+      const sortList = []
101
+      this.tableData.map((item, index) => {
102
+        sortList.push({ sortNo: index, serialNo: item.gameQuestionMapId })
103
+      })
104
+      UpdateQuestionSort(sortList, this.gameId)
105
+    },
106
+    handleSizeChange(val) {
107
+      this.pageSize = val
108
+      this.changePagination()
109
+    },
110
+    handleCurrentChange(val) {
111
+      this.currentPage = val
112
+      this.changePagination()
113
+    },
114
+    changePagination() {
115
+      getQuestionList({ gameId: this.gameId, pageSize: this.pageSize, pageNum: this.currentPage }).then(
116
+        (res) => {
117
+          this.tableData = res.data.records
118
+        }
119
+      )
120
+    },
121
+    // 添加问题
122
+    handleAdd() {
123
+      this.$emit('handleAddQuestion', true)
124
+    },
125
+    handleEdit(row) {
126
+      // 向外传送数据row.gameQuestionMapId
127
+      this.$emit('handleEditQuestion', row.gameQuestionMapId)
128
+    },
129
+    handleDelete(row) {
130
+      deleteGameLeverQuestion(row.gameQuestionMapId).then(() => {
131
+        this.$message('删除问题成功')
132
+        this.onSearch()
133
+        // 关闭编辑问题页面防止编辑页面还没关闭就删除当前问题了
134
+        this.$emit('handleCloseQuestion', true)
135
+      })
136
+    },
137
+    onSearch() {
138
+      getQuestionList({ gameId: this.gameId, pageSize: this.pageSize }).then(
139
+        (res) => {
140
+          this.tableData = res.data.records
141
+          this.questionTotal = res.data.total
142
+          this.pageSize = res.data.size
143
+          this.totalScore = 0
144
+          res.data.records.map(item => {
145
+            this.totalScore += item.score
146
+          })
147
+        }
148
+      )
149
+    }
150
+  }
151
+}
152
+</script>
153
+<style scoped lang="scss">
154
+.questionli {
155
+  width: 100%;
156
+  overflow: hidden;
157
+  display: flex;
158
+  line-height:40px;
159
+  background-color: white;
160
+  padding:0 8px;
161
+  border: 1px solid #f0f2f5;
162
+}
163
+.questionli:nth-of-type(even) {
164
+  background: #f0f2f5;
165
+}
166
+.questionli:hover {
167
+  background-color: rgb(230, 247, 255);
168
+}
169
+</style>

+ 62
- 0
src/components/SvgIcon/index.vue 查看文件

@@ -0,0 +1,62 @@
1
+<template>
2
+  <div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" />
3
+  <svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners">
4
+    <use :xlink:href="iconName" />
5
+  </svg>
6
+</template>
7
+
8
+<script>
9
+// doc: https://panjiachen.github.io/vue-element-admin-site/feature/component/svg-icon.html#usage
10
+import { isExternal } from '@/utils/validate'
11
+
12
+export default {
13
+  name: 'SvgIcon',
14
+  props: {
15
+    iconClass: {
16
+      type: String,
17
+      required: true
18
+    },
19
+    className: {
20
+      type: String,
21
+      default: ''
22
+    }
23
+  },
24
+  computed: {
25
+    isExternal() {
26
+      return isExternal(this.iconClass)
27
+    },
28
+    iconName() {
29
+      return `#icon-${this.iconClass}`
30
+    },
31
+    svgClass() {
32
+      if (this.className) {
33
+        return 'svg-icon ' + this.className
34
+      } else {
35
+        return 'svg-icon'
36
+      }
37
+    },
38
+    styleExternalIcon() {
39
+      return {
40
+        mask: `url(${this.iconClass}) no-repeat 50% 50%`,
41
+        '-webkit-mask': `url(${this.iconClass}) no-repeat 50% 50%`
42
+      }
43
+    }
44
+  }
45
+}
46
+</script>
47
+
48
+<style scoped>
49
+.svg-icon {
50
+  width: 1em;
51
+  height: 1em;
52
+  vertical-align: -0.15em;
53
+  fill: currentColor;
54
+  overflow: hidden;
55
+}
56
+
57
+.svg-external-icon {
58
+  background-color: currentColor;
59
+  mask-size: cover!important;
60
+  display: inline-block;
61
+}
62
+</style>

+ 68
- 0
src/components/UploadImage/index.vue 查看文件

@@ -0,0 +1,68 @@
1
+<template>
2
+  <div class="uploadClass">
3
+    <el-upload
4
+      action="#"
5
+      list-type="picture-card"
6
+      :file-list="fileList"
7
+      :limit="1"
8
+      :on-remove="handleRemove"
9
+      :on-change="handleChange"
10
+      :auto-upload="false"
11
+      @http-request="customUploadFile"
12
+    >
13
+      <i class="el-icon-plus" />
14
+    </el-upload>
15
+  </div>
16
+</template>
17
+<script>
18
+import { uploadFile } from '@/utils/upload'
19
+export default {
20
+  props: {
21
+    icon: String
22
+  },
23
+  data() {
24
+    return {
25
+      dialogImageUrl: undefined,
26
+      dialogVisible: false,
27
+      fileList: []
28
+    }
29
+  },
30
+  watch: {
31
+    icon() {
32
+      if (this.icon) {
33
+        this.fileList = [{ name: 'image', url: this.icon }]
34
+      } else {
35
+        this.fileList = []
36
+      }
37
+    }
38
+  },
39
+  methods: {
40
+    customUploadFile(val) {
41
+      uploadFile({ file: val, onSuccess: this.onSuccess, onError: this.onError })
42
+    },
43
+    onSuccess(url) {
44
+      this.$emit('handleChange', url)
45
+    },
46
+    onError(e) {
47
+    },
48
+    handleRemove(file, fileList) {
49
+      this.fileList = []
50
+      this.$emit('handleDeleteIcon', true)
51
+    },
52
+    handleChange(file, fileList) {
53
+      this.customUploadFile(file.raw)
54
+    }
55
+  }
56
+}
57
+</script>
58
+<style>
59
+.uploadClass .el-upload--picture-card {
60
+  width: 100px;
61
+  height: 100px;
62
+  line-height: 106px;
63
+}
64
+.el-upload-list--picture-card .el-upload-list__item {
65
+  width: 100px;
66
+  height: 100px;
67
+}
68
+</style>

+ 67
- 0
src/components/UploadImageList/index.vue 查看文件

@@ -0,0 +1,67 @@
1
+<template>
2
+  <div class="uploadClass">
3
+    <el-upload
4
+      action="#"
5
+      list-type="picture-card"
6
+      :file-list="fileList"
7
+      :on-remove="handleRemove"
8
+      :on-change="handleChange"
9
+      :auto-upload="false"
10
+      @http-request="customUploadFile"
11
+    >
12
+      <i class="el-icon-plus" />
13
+    </el-upload>
14
+  </div>
15
+</template>
16
+<script>
17
+import { uploadFile } from '@/utils/upload'
18
+export default {
19
+  props: {
20
+    icon: String
21
+  },
22
+  data() {
23
+    return {
24
+      dialogImageUrl: undefined,
25
+      dialogVisible: false,
26
+      fileList: []
27
+    }
28
+  },
29
+  watch: {
30
+    icon() {
31
+      if (this.icon) {
32
+        this.fileList = [{ name: 'image', url: this.icon }]
33
+      } else {
34
+        this.fileList = []
35
+      }
36
+    }
37
+  },
38
+  methods: {
39
+    customUploadFile(val) {
40
+      uploadFile({ file: val, onSuccess: this.onSuccess, onError: this.onError })
41
+    },
42
+    onSuccess(url) {
43
+      this.$emit('handleChange', url)
44
+    },
45
+    onError(e) {
46
+    },
47
+    handleRemove(file, fileList) {
48
+      this.fileList = []
49
+      this.$emit('handleDeleteIcon', true)
50
+    },
51
+    handleChange(file, fileList) {
52
+      this.customUploadFile(file.raw)
53
+    }
54
+  }
55
+}
56
+</script>
57
+<style>
58
+.uploadClass .el-upload--picture-card {
59
+  width: 100px;
60
+  height: 100px;
61
+  line-height: 106px;
62
+}
63
+.el-upload-list--picture-card .el-upload-list__item {
64
+  width: 100px;
65
+  height: 100px;
66
+}
67
+</style>

+ 9
- 0
src/icons/index.js 查看文件

@@ -0,0 +1,9 @@
1
+import Vue from 'vue'
2
+import SvgIcon from '@/components/SvgIcon'// svg component
3
+
4
+// register globally
5
+Vue.component('svg-icon', SvgIcon)
6
+
7
+const req = require.context('./svg', false, /\.svg$/)
8
+const requireAll = requireContext => requireContext.keys().map(requireContext)
9
+requireAll(req)

二進制
src/icons/logo.jpg 查看文件


+ 1
- 0
src/icons/svg/app.svg 查看文件

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1640352608746" class="icon" viewBox="0 0 1026 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4118" xmlns:xlink="http://www.w3.org/1999/xlink" width="128.25" height="128"><defs><style type="text/css"></style></defs><path d="M371.732817 94.172314q25.773475 0 44.112294 17.843175t18.338819 43.616651l0 247.821878q0 25.773475-18.338819 44.112294t-44.112294 18.338819l-247.821878 0q-25.773475 0-43.616651-18.338819t-17.843175-44.112294l0-247.821878q0-25.773475 17.843175-43.616651t43.616651-17.843175l247.821878 0zM371.732817 589.81607q25.773475 0 44.112294 17.843175t18.338819 43.616651l0 248.813166q0 25.773475-18.338819 43.616651t-44.112294 17.843175l-247.821878 0q-25.773475 0-43.616651-17.843175t-17.843175-43.616651l0-248.813166q0-25.773475 17.843175-43.616651t43.616651-17.843175l247.821878 0zM868.367861 589.81607q25.773475 0 43.616651 17.843175t17.843175 43.616651l0 248.813166q0 25.773475-17.843175 43.616651t-43.616651 17.843175l-247.821878 0q-25.773475 0-44.112294-17.843175t-18.338819-43.616651l0-248.813166q0-25.773475 18.338819-43.616651t44.112294-17.843175l247.821878 0zM1006.156825 203.21394q19.82575 19.82575 19.82575 46.590513t-19.82575 45.599226l-184.379477 184.379477q-19.82575 19.82575-46.094869 19.82575t-46.094869-19.82575l-184.379477-184.379477q-18.834463-18.834463-18.834463-45.599226t18.834463-46.590513l184.379477-184.379477q19.82575-18.834463 46.094869-18.834463t46.094869 18.834463z" p-id="4119"></path></svg>

+ 1
- 0
src/icons/svg/appconfig.svg 查看文件

@@ -0,0 +1 @@
1
+<svg t="1640835131030" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9379" width="128" height="128"><path d="M1023.401462 126.021423v227.811239a125.680133 125.680133 0 0 1-125.59481 125.59481h-227.811239a125.680133 125.680133 0 0 1-125.59481-125.637471V126.021423A125.680133 125.680133 0 0 1 669.995413 0.426613h227.811239a125.680133 125.680133 0 0 1 125.59481 125.59481z m-543.931328 539.665201v227.811239a125.680133 125.680133 0 0 1-125.594811 125.552149h-227.811239a125.680133 125.680133 0 0 1-125.552149-125.594811v-227.811239a125.680133 125.680133 0 0 1 125.594811-125.552149h227.768577a125.680133 125.680133 0 0 1 125.594811 125.594811z m0-539.665201v227.811239a125.680133 125.680133 0 0 1-125.594811 125.59481h-227.811239A125.680133 125.680133 0 0 1 0.554597 353.790001V126.021423A126.021423 126.021423 0 0 1 126.106746 0.426613h227.768577a125.680133 125.680133 0 0 1 125.594811 125.59481z m225.336884 822.210863a29.222977 29.222977 0 0 0-34.171686 5.204676l-22.439833 23.122414c0 0.68258-1.066532 0.68258-1.706452 0.682581-1.066532 0-1.407822-0.34129-1.749112-0.682581l-42.490636-42.447974c-0.68258 0-0.68258-1.066532-0.68258-1.749113 0-1.023871 0.34129-1.365161 0.68258-1.706451l22.781124-22.823785a31.057412 31.057412 0 0 0 5.204676-34.171686l-2.772983-5.887257a189.842699 189.842699 0 0 1-8.276288-20.00814l-2.090403-6.228547a29.436284 29.436284 0 0 0-27.9858-20.050802h-2.389032a31.825315 31.825315 0 0 1-32.123944-32.081283c0-17.917738 14.163545-32.123944 32.123944-32.123945h2.389032a29.862896 29.862896 0 0 0 27.9858-20.050802l2.090403-6.185885c3.071612-6.911127 5.545966-14.163545 8.276288-20.050802l2.772983-5.844596a29.222977 29.222977 0 0 0-5.204676-34.171685l-22.781124-22.781124c-0.68258 0-0.68258-1.066532-0.68258-1.706452 0-1.066532 0.34129-1.407822 0.68258-1.749112l41.808055-42.490636c0-0.68258 1.023871-0.68258 1.706452-0.68258 1.023871 0 1.365161 0.34129 1.706451 0.68258l22.823785 22.781124c8.958869 7.934998 22.781124 10.366691 34.129025 5.204676l5.887256-2.772983a189.842699 189.842699 0 0 1 20.050802-8.276288l6.228547-2.090403a29.436284 29.436284 0 0 0 20.050802-27.9858v-2.389032c0-17.960399 14.120884-32.123944 32.081283-32.123944 17.917738 0 32.123944 14.163545 32.123945 32.123944v2.047742a29.862896 29.862896 0 0 0 20.34943 27.9858l6.228547 2.090403c6.911127 3.071612 13.822255 5.503305 20.050802 8.276288l5.844596 2.772983c11.390562 6.185886 25.554107 3.412902 34.171686-5.204676l22.781124-22.781124c0-0.68258 1.066532-0.68258 1.706451-0.68258 1.066532 0 1.407822 0.34129 1.749112 0.68258l42.490636 42.447974c0.68258 0 0.68258 1.066532 0.68258 1.749113 0 1.023871-0.34129 1.365161-0.68258 1.706451l-22.781124 22.823785a32.379912 32.379912 0 0 0-5.204676 34.171686l2.772983 5.887257c3.114273 6.527176 6.228547 13.779594 8.276288 20.00814l2.090403 6.228547a29.436284 29.436284 0 0 0 27.9858 20.050802h2.389032c17.960399 0 32.123944 14.120884 32.123944 32.081283 0 17.917738-14.163545 32.123944-32.123944 32.123945h-2.389032a29.862896 29.862896 0 0 0-27.9858 20.050802l-2.090403 6.185885c-3.071612 6.911127-5.545966 13.822255-8.276288 20.050802l-2.772983 5.844596a29.222977 29.222977 0 0 0 5.204676 34.171686l22.781124 22.781124c0.68258 0 0.68258 0.725242 0.68258 1.706451 0 1.066532-0.34129 1.407822-0.68258 1.749112l-42.490636 42.490636c0 0.34129-1.023871 0.68258-1.706451 0.68258-1.023871 0-1.365161-0.34129-1.706451-0.68258l-22.823785-22.781124a32.379912 32.379912 0 0 0-34.171686-5.204676l-5.887257 2.772983a189.842699 189.842699 0 0 1-20.050802 8.276288l-6.185886 2.090403a29.436284 29.436284 0 0 0-20.050801 27.9858v2.389032c0 17.960399-14.120884 32.123944-32.081284 32.123944a31.825315 31.825315 0 0 1-32.123944-32.123944v-2.389032a29.862896 29.862896 0 0 0-20.050802-27.9858l-6.185886-2.090403c-6.911127-3.071612-13.822255-5.545966-20.050801-8.276288l-5.844596-2.772983zM789.233693 718.415967c-34.768944 0-63.991921 28.839026-63.991921 63.991921s28.839026 63.991921 63.991921 63.991921 63.991921-28.839026 63.991921-63.991921c-0.810564-35.152895-28.455074-63.991921-63.991921-63.991921z" p-id="9380"></path></svg>

+ 1
- 0
src/icons/svg/captcha.svg 查看文件

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1644474272743" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6773" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M919.561369 245.727541c-0.899486-28.28623-24.311709-55.009871-52.010561-59.8409 0 0-107.385752-16.977673-167.643138-38.420031-75.231425-26.770713-149.681044-85.617983-149.681044-85.617983-23.220864-16.58063-58.83806-15.552208-80.374562 2.372024 0 0-52.704362 53.179177-151.044088 84.22117-90.852194 36.510542-163.464979 40.248679-163.464979 40.248679-27.402093 3.571339-50.991348 28.867468-51.522444 57.147558 0 0-3.690042 145.387251 0.966001 272.985348 1.759063 228.268914 271.994788 453.937606 408.55193 453.937606 134.416386 0 366.709963-157.224858 403.249157-450.619024C925.617295 347.953783 919.561369 245.727541 919.561369 245.727541zM709.887976 445.981401 477.54835 681.152515c-9.899464 10.018168-26.696012 11.174504-38.07927 2.124384l-121.329323-96.414887c-22.289656-17.711384-24.614607-48.538483-4.89038-69.169359 19.587104-20.48966 53.223179-23.199375 75.962066-5.403057l56.322773 44.083008 193.563484-182.358281c20.162202-18.995633 52.216245-18.458397 71.897493 0.325411-0.281409-0.293689-0.35918-0.693802-0.649799-0.984421l1.64036 1.64343c-0.290619-0.290619-0.696872-0.3776-0.99056-0.659009C729.922265 394.23076 729.659275 425.969625 709.887976 445.981401z" p-id="6774"></path></svg>

+ 1
- 0
src/icons/svg/dashboard.svg 查看文件

@@ -0,0 +1 @@
1
+<svg width="128" height="100" xmlns="http://www.w3.org/2000/svg"><path d="M27.429 63.638c0-2.508-.893-4.65-2.679-6.424-1.786-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.465 2.662-1.785 1.774-2.678 3.916-2.678 6.424 0 2.508.893 4.65 2.678 6.424 1.786 1.775 3.94 2.662 6.465 2.662 2.524 0 4.678-.887 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zm13.714-31.801c0-2.508-.893-4.65-2.679-6.424-1.785-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zM71.714 65.98l7.215-27.116c.285-1.23.107-2.378-.536-3.443-.643-1.064-1.56-1.762-2.75-2.094-1.19-.33-2.333-.177-3.429.462-1.095.639-1.81 1.573-2.143 2.804l-7.214 27.116c-2.857.237-5.405 1.266-7.643 3.088-2.238 1.822-3.738 4.152-4.5 6.992-.952 3.644-.476 7.098 1.429 10.364 1.905 3.265 4.69 5.37 8.357 6.317 3.667.947 7.143.474 10.429-1.42 3.285-1.892 5.404-4.66 6.357-8.305.762-2.84.619-5.607-.429-8.305-1.047-2.697-2.762-4.85-5.143-6.46zm47.143-2.342c0-2.508-.893-4.65-2.678-6.424-1.786-1.775-3.94-2.662-6.465-2.662-2.524 0-4.678.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.786 1.775 3.94 2.662 6.464 2.662 2.524 0 4.679-.887 6.465-2.662 1.785-1.775 2.678-3.916 2.678-6.424zm-45.714-45.43c0-2.509-.893-4.65-2.679-6.425C68.68 10.01 66.524 9.122 64 9.122c-2.524 0-4.679.887-6.464 2.661-1.786 1.775-2.679 3.916-2.679 6.425 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zm32 13.629c0-2.508-.893-4.65-2.679-6.424-1.785-1.775-3.94-2.662-6.464-2.662-2.524 0-4.679.887-6.464 2.662-1.786 1.774-2.679 3.916-2.679 6.424 0 2.508.893 4.65 2.679 6.424 1.785 1.774 3.94 2.662 6.464 2.662 2.524 0 4.679-.888 6.464-2.662 1.786-1.775 2.679-3.916 2.679-6.424zM128 63.638c0 12.351-3.357 23.78-10.071 34.286-.905 1.372-2.19 2.058-3.858 2.058H13.93c-1.667 0-2.953-.686-3.858-2.058C3.357 87.465 0 76.037 0 63.638c0-8.613 1.69-16.847 5.071-24.703C8.452 31.08 13 24.312 18.714 18.634c5.715-5.68 12.524-10.199 20.429-13.559C47.048 1.715 55.333.035 64 .035c8.667 0 16.952 1.68 24.857 5.04 7.905 3.36 14.714 7.88 20.429 13.559 5.714 5.678 10.262 12.446 13.643 20.301 3.38 7.856 5.071 16.09 5.071 24.703z"/></svg>

+ 1
- 0
src/icons/svg/example.svg 查看文件

@@ -0,0 +1 @@
1
+<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M96.258 57.462h31.421C124.794 27.323 100.426 2.956 70.287.07v31.422a32.856 32.856 0 0 1 25.971 25.97zm-38.796-25.97V.07C27.323 2.956 2.956 27.323.07 57.462h31.422a32.856 32.856 0 0 1 25.97-25.97zm12.825 64.766v31.421c30.46-2.885 54.507-27.253 57.713-57.712H96.579c-2.886 13.466-13.146 23.726-26.292 26.291zM31.492 70.287H.07c2.886 30.46 27.253 54.507 57.713 57.713V96.579c-13.466-2.886-23.726-13.146-26.291-26.292z"/></svg>

+ 1
- 0
src/icons/svg/eye-open.svg 查看文件

@@ -0,0 +1 @@
1
+<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="128" height="128"><defs><style/></defs><path d="M512 128q69.675 0 135.51 21.163t115.498 54.997 93.483 74.837 73.685 82.006 51.67 74.837 32.17 54.827L1024 512q-2.347 4.992-6.315 13.483T998.87 560.17t-31.658 51.669-44.331 59.99-56.832 64.34-69.504 60.16-82.347 51.5-94.848 34.687T512 896q-69.675 0-135.51-21.163t-115.498-54.826-93.483-74.326-73.685-81.493-51.67-74.496-32.17-54.997L0 513.707q2.347-4.992 6.315-13.483t18.816-34.816 31.658-51.84 44.331-60.33 56.832-64.683 69.504-60.331 82.347-51.84 94.848-34.816T512 128.085zm0 85.333q-46.677 0-91.648 12.331t-81.152 31.83-70.656 47.146-59.648 54.485-48.853 57.686-37.675 52.821-26.325 43.99q12.33 21.674 26.325 43.52t37.675 52.351 48.853 57.003 59.648 53.845T339.2 767.02t81.152 31.488T512 810.667t91.648-12.331 81.152-31.659 70.656-46.848 59.648-54.186 48.853-57.344 37.675-52.651T927.957 512q-12.33-21.675-26.325-43.648t-37.675-52.65-48.853-57.345-59.648-54.186-70.656-46.848-81.152-31.659T512 213.334zm0 128q70.656 0 120.661 50.006T682.667 512 632.66 632.661 512 682.667 391.339 632.66 341.333 512t50.006-120.661T512 341.333zm0 85.334q-35.328 0-60.33 25.002T426.666 512t25.002 60.33T512 597.334t60.33-25.002T597.334 512t-25.002-60.33T512 426.666z"/></svg>

+ 1
- 0
src/icons/svg/eye.svg 查看文件

@@ -0,0 +1 @@
1
+<svg width="128" height="64" xmlns="http://www.w3.org/2000/svg"><path d="M127.072 7.994c1.37-2.208.914-5.152-.914-6.87-2.056-1.717-4.797-1.226-6.396.982-.229.245-25.586 32.382-55.74 32.382-29.24 0-55.74-32.382-55.968-32.627-1.6-1.963-4.57-2.208-6.397-.49C-.17 3.086-.399 6.275 1.2 8.238c.457.736 5.94 7.36 14.62 14.72L4.17 35.96c-1.828 1.963-1.6 5.152.228 6.87.457.98 1.6 1.471 2.742 1.471s2.284-.49 3.198-1.472l12.564-13.983c5.94 4.416 13.021 8.587 20.788 11.53l-4.797 17.418c-.685 2.699.686 5.397 3.198 6.133h1.37c2.057 0 3.884-1.472 4.341-3.68L52.6 42.83c3.655.736 7.538 1.227 11.422 1.227 3.883 0 7.767-.49 11.422-1.227l4.797 17.173c.457 2.208 2.513 3.68 4.34 3.68.457 0 .914 0 1.143-.246 2.513-.736 3.883-3.434 3.198-6.133l-4.797-17.172c7.767-2.944 14.848-7.114 20.788-11.53l12.336 13.738c.913.981 2.056 1.472 3.198 1.472s2.284-.49 3.198-1.472c1.828-1.963 1.828-4.906.228-6.87l-11.65-13.001c9.366-7.36 14.849-14.474 14.849-14.474z"/></svg>

+ 1
- 0
src/icons/svg/form.svg 查看文件

@@ -0,0 +1 @@
1
+<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M84.068 23.784c-1.02 0-1.877-.32-2.572-.96a8.588 8.588 0 0 1-1.738-2.237 11.524 11.524 0 0 1-1.042-2.621c-.232-.895-.348-1.641-.348-2.238V0h.278c.834 0 1.622.085 2.363.256.742.17 1.645.575 2.711 1.214 1.066.64 2.363 1.535 3.892 2.686 1.53 1.15 3.453 2.664 5.77 4.54 2.502 2.045 4.494 3.771 5.977 5.178 1.483 1.406 2.618 2.6 3.406 3.58.787.98 1.274 1.812 1.46 2.494.185.682.277 1.278.277 1.79v2.046H84.068zM127.3 84.01c.278.682.464 1.535.556 2.558.093 1.023-.37 2.003-1.39 2.94-.463.427-.88.832-1.25 1.215-.372.384-.696.704-.974.96a6.69 6.69 0 0 1-.973.767l-11.816-10.741a44.331 44.331 0 0 0 1.877-1.535 31.028 31.028 0 0 1 1.737-1.406c1.112-.938 2.317-1.343 3.615-1.215 1.297.128 2.363.405 3.197.83.927.427 1.923 1.173 2.989 2.239 1.065 1.065 1.876 2.195 2.432 3.388zM78.23 95.902c2.038 0 3.752-.511 5.143-1.534l-26.969 25.83H18.037c-1.761 0-3.684-.47-5.77-1.407a24.549 24.549 0 0 1-5.838-3.709 21.373 21.373 0 0 1-4.518-5.306c-1.204-2.003-1.807-4.07-1.807-6.202V16.495c0-1.79.44-3.665 1.32-5.626A18.41 18.41 0 0 1 5.04 5.562a21.798 21.798 0 0 1 5.213-3.964C12.198.533 14.237 0 16.37 0h53.24v15.984c0 1.62.278 3.367.834 5.242a16.704 16.704 0 0 0 2.572 5.179c1.159 1.577 2.665 2.898 4.518 3.964 1.853 1.066 4.078 1.598 6.673 1.598h20.295v42.325L85.458 92.45c1.02-1.364 1.529-2.856 1.529-4.476 0-2.216-.857-4.113-2.572-5.69-1.714-1.577-3.776-2.366-6.186-2.366H26.1c-2.409 0-4.448.789-6.116 2.366-1.668 1.577-2.502 3.474-2.502 5.69 0 2.217.834 4.092 2.502 5.626 1.668 1.535 3.707 2.302 6.117 2.302h52.13zM26.1 47.951c-2.41 0-4.449.789-6.117 2.366-1.668 1.577-2.502 3.473-2.502 5.69 0 2.216.834 4.092 2.502 5.626 1.668 1.534 3.707 2.302 6.117 2.302h52.13c2.409 0 4.47-.768 6.185-2.302 1.715-1.534 2.572-3.41 2.572-5.626 0-2.217-.857-4.113-2.572-5.69-1.714-1.577-3.776-2.366-6.186-2.366H26.1zm52.407 64.063l1.807-1.663 3.476-3.196a479.75 479.75 0 0 0 4.587-4.284 500.757 500.757 0 0 1 5.004-4.667c3.985-3.666 8.48-7.758 13.485-12.276l11.677 10.741-13.485 12.404-5.004 4.603-4.587 4.22a179.46 179.46 0 0 0-3.267 3.068c-.88.853-1.367 1.322-1.46 1.407-.463.341-.973.703-1.529 1.087-.556.383-1.112.703-1.668.959-.556.256-1.413.575-2.572.959a83.5 83.5 0 0 1-3.545 1.087 72.2 72.2 0 0 1-3.475.895c-1.112.256-1.946.426-2.502.511-1.112.17-1.854.043-2.224-.383-.371-.426-.464-1.151-.278-2.174.092-.511.278-1.279.556-2.302.278-1.023.602-2.067.973-3.132l1.042-3.005c.325-.938.58-1.577.765-1.918a10.157 10.157 0 0 1 2.224-2.941z"/></svg>

+ 1
- 0
src/icons/svg/game.svg 查看文件

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1640352521427" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2558" width="128" height="128" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M1008 435.328c-43.52-197.76-163.2-339.136-274.496-332.736h-4.48a184.96 184.96 0 0 0-120.96 44.8 128 128 0 0 1-188.736 2.56 184.96 184.96 0 0 0-123.52-47.36h-5.12C179.456 96.192 59.776 237.632 16.32 435.328c-46.72 209.92 10.88 403.776 128 431.872 85.696 21.12 179.712-53.12 242.432-175.936h253.44c64 123.52 156.736 197.12 242.432 176 114.56-28.8 171.52-222.08 125.44-431.936z m-594.432 11.52h-93.44v97.92h-75.52v-97.92H151.296v-78.72h93.44v-97.92h75.52v97.92h92.8l0.64 78.72z m268.16 9.6a49.28 49.28 0 1 1 46.656-49.28 48 48 0 0 1-46.72 49.28z m148.416 0a49.28 49.28 0 1 1 46.72-49.28 48 48 0 0 1-44.8 49.28h-1.92z" p-id="2559"></path></svg>

+ 1
- 0
src/icons/svg/gamePerson.svg 查看文件

@@ -0,0 +1 @@
1
+<svg t="1641526710072" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5136" width="128" height="128"><path d="M315.597609 894.219711c-62.13867 0-124.393261 0-188.573147 0 0-126.355131 0-252.968887 0-382.249435 63.490354 0 125.046818 0 188.573147 0C315.597609 639.418067 315.597609 765.974062 315.597609 894.219711zM603.685685 893.767018c-60.901509 0-122.853905 0-186.300688 0 0-254.759673 0-508.683912 0-766.051617 62.799822 0 123.42252 0 186.300688 0C603.685685 382.423109 603.685685 637.024689 603.685685 893.767018zM895.189246 894.492526c-62.46245 0-124.032506 0-187.932981 0 0-174.161518 0-348.696784 0-525.524295 61.721953 0 123.860622 0 187.932981 0C895.189246 543.870248 895.189246 718.462275 895.189246 894.492526z" p-id="5137"></path></svg>

+ 1
- 0
src/icons/svg/link.svg 查看文件

@@ -0,0 +1 @@
1
+<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M115.625 127.937H.063V12.375h57.781v12.374H12.438v90.813h90.813V70.156h12.374z"/><path d="M116.426 2.821l8.753 8.753-56.734 56.734-8.753-8.745z"/><path d="M127.893 37.982h-12.375V12.375H88.706V0h39.187z"/></svg>

+ 1
- 0
src/icons/svg/nested.svg 查看文件

@@ -0,0 +1 @@
1
+<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M.002 9.2c0 5.044 3.58 9.133 7.998 9.133 4.417 0 7.997-4.089 7.997-9.133 0-5.043-3.58-9.132-7.997-9.132S.002 4.157.002 9.2zM31.997.066h95.981V18.33H31.997V.066zm0 45.669c0 5.044 3.58 9.132 7.998 9.132 4.417 0 7.997-4.088 7.997-9.132 0-3.263-1.524-6.278-3.998-7.91-2.475-1.63-5.524-1.63-7.998 0-2.475 1.632-4 4.647-4 7.91zM63.992 36.6h63.986v18.265H63.992V36.6zm-31.995 82.2c0 5.043 3.58 9.132 7.998 9.132 4.417 0 7.997-4.089 7.997-9.132 0-5.044-3.58-9.133-7.997-9.133s-7.998 4.089-7.998 9.133zm31.995-9.131h63.986v18.265H63.992V109.67zm0-27.404c0 5.044 3.58 9.133 7.998 9.133 4.417 0 7.997-4.089 7.997-9.133 0-3.263-1.524-6.277-3.998-7.909-2.475-1.631-5.524-1.631-7.998 0-2.475 1.632-4 4.646-4 7.91zm31.995-9.13h31.991V91.4H95.987V73.135z"/></svg>

+ 1
- 0
src/icons/svg/password.svg 查看文件

@@ -0,0 +1 @@
1
+<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M108.8 44.322H89.6v-5.36c0-9.04-3.308-24.163-25.6-24.163-23.145 0-25.6 16.881-25.6 24.162v5.361H19.2v-5.36C19.2 15.281 36.798 0 64 0c27.202 0 44.8 15.281 44.8 38.961v5.361zm-32 39.356c0-5.44-5.763-9.832-12.8-9.832-7.037 0-12.8 4.392-12.8 9.832 0 3.682 2.567 6.808 6.407 8.477v11.205c0 2.718 2.875 4.962 6.4 4.962 3.524 0 6.4-2.244 6.4-4.962V92.155c3.833-1.669 6.393-4.795 6.393-8.477zM128 64v49.201c0 8.158-8.645 14.799-19.2 14.799H19.2C8.651 128 0 121.359 0 113.201V64c0-8.153 8.645-14.799 19.2-14.799h89.6c10.555 0 19.2 6.646 19.2 14.799z"/></svg>

+ 1
- 0
src/icons/svg/phone.svg 查看文件

@@ -0,0 +1 @@
1
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1644474191232" class="icon" viewBox="0 0 1046 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3853" xmlns:xlink="http://www.w3.org/1999/xlink" width="204.296875" height="200"><defs><style type="text/css"></style></defs><path d="M759.763478 616.136348c-53.826783 0-94.47513 48.37287-143.248695 48.372869-48.417391 0-260.85287-209.274435-260.85287-260.786087 0-51.46713 48.39513-76.822261 48.39513-130.226087C404.057043 235.074783 260.763826 0 202.039652 0 143.226435 0 0 104.893217 0 202.039652c0 281.177043 518.500174 820.157217 843.063652 820.157218 89.577739 0 202.150957-94.497391 202.150957-202.128696 0.75687-40.292174-232.114087-203.909565-285.473392-203.909565" p-id="3854"></path></svg>

+ 1
- 0
src/icons/svg/question.svg 查看文件

@@ -0,0 +1 @@
1
+<svg t="1641808834314" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3156" width="128" height="128"><path d="M687.510353 284.53208a58.008527 58.008527 0 0 1-58.622915-56.933347V35.90948a15.615711 15.615711 0 0 1 9.72782-13.823745 15.257318 15.257318 0 0 1 16.434896 3.27674l240.686747 233.877273a14.847725 14.847725 0 0 1 3.174341 16.383697 14.540531 14.540531 0 0 1-13.874943 8.908635h-197.525946z m0 56.933347h203.516235a29.74665 29.74665 0 0 1 21.350005 8.447844 30.565835 30.565835 0 0 1 9.21583 21.298806v538.818831a117.245831 117.245831 0 0 1-35.17375 81.560092 113.917893 113.917893 0 0 1-81.713688 32.357801H219.295015a113.764295 113.764295 0 0 1-81.713688-32.357801A117.245831 117.245831 0 0 1 102.407577 910.030908V113.988035A117.245831 117.245831 0 0 1 137.581327 32.427944 113.764295 113.764295 0 0 1 219.295015 0.070143h319.789284a31.231422 31.231422 0 0 1 31.538616 30.719431v196.809159c1.382374 64.152413 53.656607 115.095471 116.887438 113.866694m-409.592422 511.939329h468.164138a29.029863 29.029863 0 0 0 29.337058-28.466673 29.081062 29.081062 0 0 0-29.337058-28.517873H277.917931a29.081062 29.081062 0 0 0-29.337058 28.517873 29.029863 29.029863 0 0 0 29.337058 28.466673z m0-170.851239h468.164138a28.313076 28.313076 0 0 0 20.479622-8.038252 29.234659 29.234659 0 0 0 8.857436-20.428422 28.722669 28.722669 0 0 0-29.337058-28.159479H277.917931a28.722669 28.722669 0 0 0-29.337058 28.159479 29.439455 29.439455 0 0 0 8.806237 20.428422 28.517872 28.517872 0 0 0 20.530821 8.038252z m0-170.544045h292.704984a29.029863 29.029863 0 0 0 29.285859-28.466674 28.978664 28.978664 0 0 0-29.285859-28.466673H277.917931a28.978664 28.978664 0 0 0-29.337058 28.466673 29.029863 29.029863 0 0 0 29.337058 28.466674z" p-id="3157"></path></svg>

+ 1
- 0
src/icons/svg/table.svg 查看文件

@@ -0,0 +1 @@
1
+<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M.006.064h127.988v31.104H.006V.064zm0 38.016h38.396v41.472H.006V38.08zm0 48.384h38.396v41.472H.006V86.464zM44.802 38.08h38.396v41.472H44.802V38.08zm0 48.384h38.396v41.472H44.802V86.464zM89.598 38.08h38.396v41.472H89.598zm0 48.384h38.396v41.472H89.598z"/><path d="M.006.064h127.988v31.104H.006V.064zm0 38.016h38.396v41.472H.006V38.08zm0 48.384h38.396v41.472H.006V86.464zM44.802 38.08h38.396v41.472H44.802V38.08zm0 48.384h38.396v41.472H44.802V86.464zM89.598 38.08h38.396v41.472H89.598zm0 48.384h38.396v41.472H89.598z"/></svg>

+ 1
- 0
src/icons/svg/tree.svg 查看文件

@@ -0,0 +1 @@
1
+<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg"><path d="M126.713 90.023c.858.985 1.287 2.134 1.287 3.447v29.553c0 1.423-.429 2.6-1.287 3.53-.858.93-1.907 1.395-3.146 1.395H97.824c-1.145 0-2.146-.465-3.004-1.395-.858-.93-1.287-2.107-1.287-3.53V93.47c0-.875.19-1.696.572-2.462.382-.766.906-1.368 1.573-1.806a3.84 3.84 0 0 1 2.146-.657h9.725V69.007a3.84 3.84 0 0 0-.43-1.806 3.569 3.569 0 0 0-1.143-1.313 2.714 2.714 0 0 0-1.573-.492h-36.47v23.149h9.725c1.144 0 2.145.492 3.004 1.478.858.985 1.287 2.134 1.287 3.447v29.553c0 .876-.191 1.696-.573 2.463-.38.766-.905 1.368-1.573 1.806a3.84 3.84 0 0 1-2.145.656H51.915a3.84 3.84 0 0 1-2.145-.656c-.668-.438-1.216-1.04-1.645-1.806a4.96 4.96 0 0 1-.644-2.463V93.47c0-1.313.43-2.462 1.288-3.447.858-.986 1.907-1.478 3.146-1.478h9.582v-23.15h-37.9c-.953 0-1.74.356-2.359 1.068-.62.711-.93 1.56-.93 2.544v19.538h9.726c1.239 0 2.264.492 3.074 1.478.81.985 1.216 2.134 1.216 3.447v29.553c0 1.423-.405 2.6-1.216 3.53-.81.93-1.835 1.395-3.074 1.395H4.29c-.476 0-.93-.082-1.358-.246a4.1 4.1 0 0 1-1.144-.657 4.658 4.658 0 0 1-.93-1.067 5.186 5.186 0 0 1-.643-1.395 5.566 5.566 0 0 1-.215-1.56V93.47c0-.437.048-.875.143-1.313a3.95 3.95 0 0 1 .429-1.15c.19-.328.429-.656.715-.984.286-.329.572-.602.858-.821.286-.22.62-.383 1.001-.493.382-.11.763-.164 1.144-.164h9.726V61.619c0-.985.31-1.833.93-2.544.619-.712 1.358-1.068 2.216-1.068h44.335V39.62h-9.582c-1.24 0-2.288-.492-3.146-1.477a5.09 5.09 0 0 1-1.287-3.448V5.14c0-1.423.429-2.627 1.287-3.612.858-.985 1.907-1.477 3.146-1.477h25.743c.763 0 1.478.246 2.145.739a5.17 5.17 0 0 1 1.573 1.888c.382.766.573 1.587.573 2.462v29.553c0 1.313-.43 2.463-1.287 3.448-.859.985-1.86 1.477-3.004 1.477h-9.725v18.389h42.762c.954 0 1.74.355 2.36 1.067.62.711.93 1.56.93 2.545v26.925h9.582c1.239 0 2.288.492 3.146 1.478z"/></svg>

+ 1
- 0
src/icons/svg/user.svg 查看文件

@@ -0,0 +1 @@
1
+<svg width="130" height="130" xmlns="http://www.w3.org/2000/svg"><path d="M63.444 64.996c20.633 0 37.359-14.308 37.359-31.953 0-17.649-16.726-31.952-37.359-31.952-20.631 0-37.36 14.303-37.358 31.952 0 17.645 16.727 31.953 37.359 31.953zM80.57 75.65H49.434c-26.652 0-48.26 18.477-48.26 41.27v2.664c0 9.316 21.608 9.325 48.26 9.325H80.57c26.649 0 48.256-.344 48.256-9.325v-2.663c0-22.794-21.605-41.271-48.256-41.271z" stroke="#979797"/></svg>

+ 1
- 0
src/icons/svg/wx.svg 查看文件

@@ -0,0 +1 @@
1
+<svg t="1640834968791" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5597" width="64" height="64"><path d="M693.12 347.264c11.776 0 23.36 0.896 35.008 2.176-31.36-146.048-187.456-254.528-365.696-254.528C163.2 94.912 0 230.656 0 403.136c0 99.52 54.272 181.248 145.024 244.736L108.8 756.864l126.72-63.488c45.312 8.896 81.664 18.112 126.912 18.112 11.392 0 22.656-0.512 33.792-1.344-7.04-24.256-11.2-49.6-11.2-76.032C385.088 475.776 521.024 347.264 693.12 347.264zM498.304 249.024c27.392 0 45.376 17.984 45.376 45.248 0 27.136-17.984 45.312-45.376 45.312-27.072 0-54.336-18.176-54.336-45.312C443.968 266.944 471.168 249.024 498.304 249.024zM244.672 339.584c-27.2 0-54.592-18.176-54.592-45.312 0-27.264 27.392-45.248 54.592-45.248S289.92 266.944 289.92 294.272C289.92 321.408 271.872 339.584 244.672 339.584zM1024 629.76c0-144.896-145.024-262.976-307.904-262.976-172.48 0-308.224 118.144-308.224 262.976 0 145.28 135.808 262.976 308.224 262.976 36.096 0 72.512-9.024 108.736-18.112l99.392 54.528-27.264-90.624C969.728 783.872 1024 711.488 1024 629.76zM616.128 584.384c-17.984 0-36.224-17.92-36.224-36.224 0-18.048 18.24-36.224 36.224-36.224 27.52 0 45.376 18.176 45.376 36.224C661.504 566.464 643.648 584.384 616.128 584.384zM815.488 584.384c-17.856 0-36.032-17.92-36.032-36.224 0-18.048 18.112-36.224 36.032-36.224 27.264 0 45.376 18.176 45.376 36.224C860.864 566.464 842.752 584.384 815.488 584.384z" p-id="5598"></path></svg>

+ 22
- 0
src/icons/svgo.yml 查看文件

@@ -0,0 +1,22 @@
1
+# replace default config
2
+
3
+# multipass: true
4
+# full: true
5
+
6
+plugins:
7
+
8
+  # - name
9
+  #
10
+  # or:
11
+  # - name: false
12
+  # - name: true
13
+  #
14
+  # or:
15
+  # - name:
16
+  #     param1: 1
17
+  #     param2: 2
18
+
19
+- removeAttrs:
20
+    attrs:
21
+      - 'fill'
22
+      - 'fill-rule'

+ 40
- 0
src/layout/components/AppMain.vue 查看文件

@@ -0,0 +1,40 @@
1
+<template>
2
+  <section class="app-main">
3
+    <transition name="fade-transform" mode="out-in">
4
+      <router-view :key="key" />
5
+    </transition>
6
+  </section>
7
+</template>
8
+
9
+<script>
10
+export default {
11
+  name: 'AppMain',
12
+  computed: {
13
+    key() {
14
+      return this.$route.path
15
+    }
16
+  }
17
+}
18
+</script>
19
+
20
+<style scoped>
21
+.app-main {
22
+  /*50 = navbar  */
23
+  min-height: calc(100vh - 50px);
24
+  width: 100%;
25
+  position: relative;
26
+  overflow: hidden;
27
+}
28
+.fixed-header+.app-main {
29
+  padding-top: 50px;
30
+}
31
+</style>
32
+
33
+<style lang="scss">
34
+// fix css style bug in open el-dialog
35
+.el-popup-parent--hidden {
36
+  .fixed-header {
37
+    padding-right: 15px;
38
+  }
39
+}
40
+</style>

+ 217
- 0
src/layout/components/Navbar.vue 查看文件

@@ -0,0 +1,217 @@
1
+<template>
2
+  <div class="navbar">
3
+    <hamburger
4
+      :is-active="sidebar.opened"
5
+      class="hamburger-container"
6
+      @toggleClick="toggleSideBar"
7
+    />
8
+
9
+    <breadcrumb class="breadcrumb-container" />
10
+
11
+    <div class="right-menu">
12
+      <el-dropdown class="avatar-container" trigger="click">
13
+        <div class="avatar-wrapper">
14
+          <img src="../../icons/logo.jpg" class="user-avatar">
15
+          <i class="el-icon-caret-bottom" />
16
+        </div>
17
+        <el-dropdown-menu slot="dropdown">
18
+          <el-dropdown-item @click.native="handlePassword">
19
+            <span>修改密码</span>
20
+          </el-dropdown-item>
21
+          <el-dropdown-item @click.native="logout">
22
+            <span>安全退出</span>
23
+          </el-dropdown-item>
24
+        </el-dropdown-menu>
25
+      </el-dropdown>
26
+    </div>
27
+    <el-dialog
28
+      title="修改密码"
29
+      :visible.sync="dialogFormVisible"
30
+      :show-close="false"
31
+      :close-on-click-modal="false"
32
+      style="width:800px; margin:auto"
33
+    >
34
+      <el-form
35
+        ref="ruleForm"
36
+        :model="ruleForm"
37
+        :rules="rules"
38
+        label-width="110px"
39
+        class="demo-ruleForm"
40
+      >
41
+        <el-form-item label="原密码" prop="originPassword">
42
+          <el-input ref="originPassword" v-model="ruleForm.originPassword" type="password" />
43
+        </el-form-item>
44
+        <el-form-item label="新密码" prop="newPassword">
45
+          <el-input ref="newPassword" v-model="ruleForm.newPassword" type="password" />
46
+        </el-form-item>
47
+        <el-form-item label="再次输入密码" prop="newPassword2">
48
+          <el-input ref="newPassword2" v-model="ruleForm.newPassword2" type="password" />
49
+        </el-form-item>
50
+      </el-form>
51
+      <div slot="footer" class="dialog-footer">
52
+        <el-button type="primary" @click="submit('ruleForm')">修改密码</el-button>
53
+        <el-button @click="onCancel">取 消</el-button>
54
+      </div>
55
+    </el-dialog>
56
+  </div>
57
+</template>
58
+
59
+<script>
60
+import { mapGetters } from 'vuex'
61
+import Breadcrumb from '@/components/Breadcrumb'
62
+import Hamburger from '@/components/Hamburger'
63
+import { changePassword } from '@/api/user'
64
+import md5 from 'js-md5'
65
+
66
+export default {
67
+  components: {
68
+    Breadcrumb,
69
+    Hamburger
70
+  },
71
+  data() {
72
+    return {
73
+      dialogFormVisible: false,
74
+      ruleForm: {
75
+        originPassword: undefined,
76
+        newPassword: undefined,
77
+        newPassword2: undefined
78
+      },
79
+      rules: {
80
+        originPassword: [
81
+          { required: true, message: '请输入原密码', trigger: 'blur' }
82
+        ],
83
+        newPassword: [
84
+          { required: true, message: '请输入新密码', trigger: 'blur' }
85
+        ],
86
+        newPassword2: [
87
+          { required: true, message: '请再次输入新密码', trigger: 'blur' }
88
+        ]
89
+      }
90
+    }
91
+  },
92
+  computed: {
93
+    ...mapGetters(['sidebar', 'avatar'])
94
+  },
95
+  methods: {
96
+    toggleSideBar() {
97
+      this.$store.dispatch('app/toggleSideBar')
98
+    },
99
+    async logout() {
100
+      await this.$store.dispatch('user/logout')
101
+      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
102
+    },
103
+    handlePassword() {
104
+      this.ruleForm.originPassword = ''
105
+      this.dialogFormVisible = true
106
+    },
107
+    submit(formName) {
108
+      this.$refs[formName].validate((val) => {
109
+        if (val) {
110
+          if (this.ruleForm.newPassword !== this.ruleForm.newPassword2) {
111
+            this.$message('两次密码不一致请重新输入')
112
+            this.$refs.newPassword2.focus()
113
+          } else {
114
+            var newData = { ...this.ruleForm }
115
+            newData.originPassword = md5(newData.originPassword)
116
+            newData.newPassword = md5(newData.newPassword)
117
+            changePassword(newData).then(() => {
118
+              this.$message('密码修改成功请重新登录')
119
+              this.onCancel()
120
+              this.logout()
121
+            })
122
+          }
123
+        } else {
124
+          return false
125
+        }
126
+      })
127
+    },
128
+    onCancel() {
129
+      this.dialogFormVisible = false
130
+      this.ruleForm = {
131
+        originPassword: undefined,
132
+        newPassword: undefined,
133
+        newPassword2: undefined
134
+      }
135
+    }
136
+  }
137
+}
138
+</script>
139
+
140
+<style lang="scss" scoped>
141
+.navbar {
142
+  height: 50px;
143
+  overflow: hidden;
144
+  position: relative;
145
+  background: #fff;
146
+  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
147
+
148
+  .hamburger-container {
149
+    line-height: 46px;
150
+    height: 100%;
151
+    float: left;
152
+    cursor: pointer;
153
+    transition: background 0.3s;
154
+    -webkit-tap-highlight-color: transparent;
155
+
156
+    &:hover {
157
+      background: rgba(0, 0, 0, 0.025);
158
+    }
159
+  }
160
+
161
+  .breadcrumb-container {
162
+    float: left;
163
+  }
164
+
165
+  .right-menu {
166
+    float: right;
167
+    height: 100%;
168
+    line-height: 50px;
169
+
170
+    &:focus {
171
+      outline: none;
172
+    }
173
+
174
+    .right-menu-item {
175
+      display: inline-block;
176
+      padding: 0 8px;
177
+      height: 100%;
178
+      font-size: 18px;
179
+      color: #5a5e66;
180
+      vertical-align: text-bottom;
181
+
182
+      &.hover-effect {
183
+        cursor: pointer;
184
+        transition: background 0.3s;
185
+
186
+        &:hover {
187
+          background: rgba(0, 0, 0, 0.025);
188
+        }
189
+      }
190
+    }
191
+
192
+    .avatar-container {
193
+      margin-right: 30px;
194
+
195
+      .avatar-wrapper {
196
+        margin-top: 5px;
197
+        position: relative;
198
+
199
+        .user-avatar {
200
+          cursor: pointer;
201
+          width: 40px;
202
+          height: 40px;
203
+          border-radius: 10px;
204
+        }
205
+
206
+        .el-icon-caret-bottom {
207
+          cursor: pointer;
208
+          position: absolute;
209
+          right: -20px;
210
+          top: 25px;
211
+          font-size: 12px;
212
+        }
213
+      }
214
+    }
215
+  }
216
+}
217
+</style>

+ 26
- 0
src/layout/components/Sidebar/FixiOSBug.js 查看文件

@@ -0,0 +1,26 @@
1
+export default {
2
+  computed: {
3
+    device() {
4
+      return this.$store.state.app.device
5
+    }
6
+  },
7
+  mounted() {
8
+    // In order to fix the click on menu on the ios device will trigger the mouseleave bug
9
+    // https://github.com/PanJiaChen/vue-element-admin/issues/1135
10
+    this.fixBugIniOS()
11
+  },
12
+  methods: {
13
+    fixBugIniOS() {
14
+      const $subMenu = this.$refs.subMenu
15
+      if ($subMenu) {
16
+        const handleMouseleave = $subMenu.handleMouseleave
17
+        $subMenu.handleMouseleave = (e) => {
18
+          if (this.device === 'mobile') {
19
+            return
20
+          }
21
+          handleMouseleave(e)
22
+        }
23
+      }
24
+    }
25
+  }
26
+}

+ 41
- 0
src/layout/components/Sidebar/Item.vue 查看文件

@@ -0,0 +1,41 @@
1
+<script>
2
+export default {
3
+  name: 'MenuItem',
4
+  functional: true,
5
+  props: {
6
+    icon: {
7
+      type: String,
8
+      default: ''
9
+    },
10
+    title: {
11
+      type: String,
12
+      default: ''
13
+    }
14
+  },
15
+  render(h, context) {
16
+    const { icon, title } = context.props
17
+    const vnodes = []
18
+
19
+    if (icon) {
20
+      if (icon.includes('el-icon')) {
21
+        vnodes.push(<i class={[icon, 'sub-el-icon']} />)
22
+      } else {
23
+        vnodes.push(<svg-icon icon-class={icon}/>)
24
+      }
25
+    }
26
+
27
+    if (title) {
28
+      vnodes.push(<span slot='title'>{(title)}</span>)
29
+    }
30
+    return vnodes
31
+  }
32
+}
33
+</script>
34
+
35
+<style scoped>
36
+.sub-el-icon {
37
+  color: currentColor;
38
+  width: 1em;
39
+  height: 1em;
40
+}
41
+</style>

+ 43
- 0
src/layout/components/Sidebar/Link.vue 查看文件

@@ -0,0 +1,43 @@
1
+<template>
2
+  <component :is="type" v-bind="linkProps(to)">
3
+    <slot />
4
+  </component>
5
+</template>
6
+
7
+<script>
8
+import { isExternal } from '@/utils/validate'
9
+
10
+export default {
11
+  props: {
12
+    to: {
13
+      type: String,
14
+      required: true
15
+    }
16
+  },
17
+  computed: {
18
+    isExternal() {
19
+      return isExternal(this.to)
20
+    },
21
+    type() {
22
+      if (this.isExternal) {
23
+        return 'a'
24
+      }
25
+      return 'router-link'
26
+    }
27
+  },
28
+  methods: {
29
+    linkProps(to) {
30
+      if (this.isExternal) {
31
+        return {
32
+          href: to,
33
+          target: '_blank',
34
+          rel: 'noopener'
35
+        }
36
+      }
37
+      return {
38
+        to: to
39
+      }
40
+    }
41
+  }
42
+}
43
+</script>

+ 82
- 0
src/layout/components/Sidebar/Logo.vue 查看文件

@@ -0,0 +1,82 @@
1
+<template>
2
+  <div class="sidebar-logo-container" :class="{'collapse':collapse}">
3
+    <transition name="sidebarLogoFade">
4
+      <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
5
+        <img v-if="logo" :src="logo" class="sidebar-logo">
6
+        <h1 v-else class="sidebar-title">{{ title }} </h1>
7
+      </router-link>
8
+      <router-link v-else key="expand" class="sidebar-logo-link" to="/">
9
+        <img v-if="logo" :src="logo" class="sidebar-logo">
10
+        <h1 class="sidebar-title">{{ title }} </h1>
11
+      </router-link>
12
+    </transition>
13
+  </div>
14
+</template>
15
+
16
+<script>
17
+export default {
18
+  name: 'SidebarLogo',
19
+  props: {
20
+    collapse: {
21
+      type: Boolean,
22
+      required: true
23
+    }
24
+  },
25
+  data() {
26
+    return {
27
+      title: '电网教培信息管理系统',
28
+      logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png'
29
+    }
30
+  }
31
+}
32
+</script>
33
+
34
+<style lang="scss" scoped>
35
+.sidebarLogoFade-enter-active {
36
+  transition: opacity 1.5s;
37
+}
38
+
39
+.sidebarLogoFade-enter,
40
+.sidebarLogoFade-leave-to {
41
+  opacity: 0;
42
+}
43
+
44
+.sidebar-logo-container {
45
+  position: relative;
46
+  width: 100%;
47
+  height: 50px;
48
+  line-height: 50px;
49
+  background: #2b2f3a;
50
+  text-align: center;
51
+  overflow: hidden;
52
+
53
+  & .sidebar-logo-link {
54
+    height: 100%;
55
+    width: 100%;
56
+
57
+    & .sidebar-logo {
58
+      width: 32px;
59
+      height: 32px;
60
+      vertical-align: middle;
61
+      margin-right: 12px;
62
+    }
63
+
64
+    & .sidebar-title {
65
+      display: inline-block;
66
+      margin: 0;
67
+      color: #fff;
68
+      font-weight: 600;
69
+      line-height: 50px;
70
+      font-size: 14px;
71
+      font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
72
+      vertical-align: middle;
73
+    }
74
+  }
75
+
76
+  &.collapse {
77
+    .sidebar-logo {
78
+      margin-right: 0px;
79
+    }
80
+  }
81
+}
82
+</style>

+ 95
- 0
src/layout/components/Sidebar/SidebarItem.vue 查看文件

@@ -0,0 +1,95 @@
1
+<template>
2
+  <div v-if="!item.hidden">
3
+    <template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
4
+      <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
5
+        <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
6
+          <item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
7
+        </el-menu-item>
8
+      </app-link>
9
+    </template>
10
+
11
+    <el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
12
+      <template slot="title">
13
+        <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
14
+      </template>
15
+      <sidebar-item
16
+        v-for="child in item.children"
17
+        :key="child.path"
18
+        :is-nest="true"
19
+        :item="child"
20
+        :base-path="resolvePath(child.path)"
21
+        class="nest-menu"
22
+      />
23
+    </el-submenu>
24
+  </div>
25
+</template>
26
+
27
+<script>
28
+import path from 'path'
29
+import { isExternal } from '@/utils/validate'
30
+import Item from './Item'
31
+import AppLink from './Link'
32
+import FixiOSBug from './FixiOSBug'
33
+
34
+export default {
35
+  name: 'SidebarItem',
36
+  components: { Item, AppLink },
37
+  mixins: [FixiOSBug],
38
+  props: {
39
+    // route object
40
+    item: {
41
+      type: Object,
42
+      required: true
43
+    },
44
+    isNest: {
45
+      type: Boolean,
46
+      default: false
47
+    },
48
+    basePath: {
49
+      type: String,
50
+      default: ''
51
+    }
52
+  },
53
+  data() {
54
+    // To fix https://github.com/PanJiaChen/vue-admin-template/issues/237
55
+    // TODO: refactor with render function
56
+    this.onlyOneChild = null
57
+    return {}
58
+  },
59
+  methods: {
60
+    hasOneShowingChild(children = [], parent) {
61
+      const showingChildren = children.filter(item => {
62
+        if (item.hidden) {
63
+          return false
64
+        } else {
65
+          // Temp set(will be used if only has one showing child)
66
+          this.onlyOneChild = item
67
+          return true
68
+        }
69
+      })
70
+
71
+      // When there is only one child router, the child router is displayed by default
72
+      if (showingChildren.length === 1) {
73
+        return true
74
+      }
75
+
76
+      // Show parent if there are no child router to display
77
+      if (showingChildren.length === 0) {
78
+        this.onlyOneChild = { ... parent, path: '', noShowingChildren: true }
79
+        return true
80
+      }
81
+
82
+      return false
83
+    },
84
+    resolvePath(routePath) {
85
+      if (isExternal(routePath)) {
86
+        return routePath
87
+      }
88
+      if (isExternal(this.basePath)) {
89
+        return this.basePath
90
+      }
91
+      return path.resolve(this.basePath, routePath)
92
+    }
93
+  }
94
+}
95
+</script>

+ 61
- 0
src/layout/components/Sidebar/index.vue 查看文件

@@ -0,0 +1,61 @@
1
+<template>
2
+  <div :class="{'has-logo':showLogo}">
3
+    <logo v-if="showLogo" :collapse="isCollapse" />
4
+    <el-scrollbar wrap-class="scrollbar-wrapper">
5
+      <el-menu
6
+        :default-active="activeMenu"
7
+        :collapse="isCollapse"
8
+        :background-color="variables.menuBg"
9
+        :text-color="variables.menuText"
10
+        :unique-opened="false"
11
+        :active-text-color="variables.menuActiveText"
12
+        :collapse-transition="false"
13
+        mode="vertical"
14
+      >
15
+        <sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" />
16
+      </el-menu>
17
+    </el-scrollbar>
18
+  </div>
19
+</template>
20
+
21
+<script>
22
+import { mapGetters } from 'vuex'
23
+import Logo from './Logo'
24
+import SidebarItem from './SidebarItem'
25
+import variables from '@/styles/variables.scss'
26
+import { getUserId } from '@/utils/auth'
27
+
28
+export default {
29
+  components: { SidebarItem, Logo },
30
+  computed: {
31
+    ...mapGetters([
32
+      'sidebar'
33
+    ]),
34
+    routes() {
35
+      var newData = this.$router.options.routes
36
+      if (getUserId() !== '1') {
37
+        newData.splice(6, 1)
38
+      }
39
+      return newData
40
+    },
41
+    activeMenu() {
42
+      const route = this.$route
43
+      const { meta, path } = route
44
+      // if set path, the sidebar will highlight the path you set
45
+      if (meta.activeMenu) {
46
+        return meta.activeMenu
47
+      }
48
+      return path
49
+    },
50
+    showLogo() {
51
+      return this.$store.state.settings.sidebarLogo
52
+    },
53
+    variables() {
54
+      return variables
55
+    },
56
+    isCollapse() {
57
+      return !this.sidebar.opened
58
+    }
59
+  }
60
+}
61
+</script>

+ 3
- 0
src/layout/components/index.js 查看文件

@@ -0,0 +1,3 @@
1
+export { default as Navbar } from './Navbar'
2
+export { default as Sidebar } from './Sidebar'
3
+export { default as AppMain } from './AppMain'

+ 95
- 0
src/layout/index.vue 查看文件

@@ -0,0 +1,95 @@
1
+<template>
2
+  <div :class="classObj" class="app-wrapper">
3
+    <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
4
+    <sidebar class="sidebar-container" />
5
+    <div class="main-container">
6
+      <div :class="{'fixed-header':fixedHeader}">
7
+        <navbar />
8
+      </div>
9
+      <app-main />
10
+    </div>
11
+  </div>
12
+</template>
13
+
14
+<script>
15
+import { Navbar, Sidebar, AppMain } from './components'
16
+import ResizeMixin from './mixin/ResizeHandler'
17
+
18
+export default {
19
+  name: 'Layout',
20
+  components: {
21
+    Navbar,
22
+    Sidebar,
23
+    AppMain
24
+  },
25
+  mixins: [ResizeMixin],
26
+  computed: {
27
+    sidebar() {
28
+      return this.$store.state.app.sidebar
29
+    },
30
+    device() {
31
+      return this.$store.state.app.device
32
+    },
33
+    fixedHeader() {
34
+      return this.$store.state.settings.fixedHeader
35
+    },
36
+    classObj() {
37
+      return {
38
+        hideSidebar: !this.sidebar.opened,
39
+        openSidebar: this.sidebar.opened,
40
+        withoutAnimation: this.sidebar.withoutAnimation,
41
+        mobile: this.device === 'mobile'
42
+      }
43
+    }
44
+  },
45
+  methods: {
46
+    handleClickOutside() {
47
+      this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
48
+    }
49
+  }
50
+}
51
+</script>
52
+
53
+<style lang="scss" scoped>
54
+@import '~@/styles/mixin.scss';
55
+@import '~@/styles/variables.scss';
56
+
57
+.app-wrapper {
58
+  @include clearfix;
59
+  position: relative;
60
+  height: 100%;
61
+  width: 100%;
62
+  background-color: #f0f2f5;
63
+
64
+  &.mobile.openSidebar {
65
+    position: fixed;
66
+    top: 0;
67
+  }
68
+}
69
+.drawer-bg {
70
+  background: #000;
71
+  opacity: 0.3;
72
+  width: 100%;
73
+  top: 0;
74
+  height: 100%;
75
+  position: absolute;
76
+  z-index: 999;
77
+}
78
+
79
+.fixed-header {
80
+  position: fixed;
81
+  top: 0;
82
+  right: 0;
83
+  z-index: 9;
84
+  width: calc(100% - #{$sideBarWidth});
85
+  transition: width 0.28s;
86
+}
87
+
88
+.hideSidebar .fixed-header {
89
+  width: calc(100% - 54px);
90
+}
91
+
92
+.mobile .fixed-header {
93
+  width: 100%;
94
+}
95
+</style>

+ 45
- 0
src/layout/mixin/ResizeHandler.js 查看文件

@@ -0,0 +1,45 @@
1
+import store from '@/store'
2
+
3
+const { body } = document
4
+const WIDTH = 992 // refer to Bootstrap's responsive design
5
+
6
+export default {
7
+  watch: {
8
+    $route(route) {
9
+      if (this.device === 'mobile' && this.sidebar.opened) {
10
+        store.dispatch('app/closeSideBar', { withoutAnimation: false })
11
+      }
12
+    }
13
+  },
14
+  beforeMount() {
15
+    window.addEventListener('resize', this.$_resizeHandler)
16
+  },
17
+  beforeDestroy() {
18
+    window.removeEventListener('resize', this.$_resizeHandler)
19
+  },
20
+  mounted() {
21
+    const isMobile = this.$_isMobile()
22
+    if (isMobile) {
23
+      store.dispatch('app/toggleDevice', 'mobile')
24
+      store.dispatch('app/closeSideBar', { withoutAnimation: true })
25
+    }
26
+  },
27
+  methods: {
28
+    // use $_ for mixins properties
29
+    // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
30
+    $_isMobile() {
31
+      const rect = body.getBoundingClientRect()
32
+      return rect.width - 1 < WIDTH
33
+    },
34
+    $_resizeHandler() {
35
+      if (!document.hidden) {
36
+        const isMobile = this.$_isMobile()
37
+        store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop')
38
+
39
+        if (isMobile) {
40
+          store.dispatch('app/closeSideBar', { withoutAnimation: true })
41
+        }
42
+      }
43
+    }
44
+  }
45
+}

+ 43
- 0
src/main.js 查看文件

@@ -0,0 +1,43 @@
1
+import Vue from 'vue'
2
+
3
+import 'normalize.css/normalize.css' // A modern alternative to CSS resets
4
+
5
+import ElementUI from 'element-ui'
6
+import 'element-ui/lib/theme-chalk/index.css'
7
+// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
8
+
9
+import '@/styles/index.scss' // global css
10
+
11
+import App from './App'
12
+import store from './store'
13
+import router from './router'
14
+
15
+import '@/icons' // icon
16
+import '@/permission' // permission control
17
+
18
+/**
19
+ * If you don't want to use mock-server
20
+ * you want to use MockJs for mock api
21
+ * you can execute: mockXHR()
22
+ *
23
+ * Currently MockJs will be used in the production environment,
24
+ * please remove it before going online ! ! !
25
+ */
26
+// if (process.env.NODE_ENV === 'production') {
27
+//   const { mockXHR } = require('../mock')
28
+// mockXHR()
29
+// }
30
+
31
+// set ElementUI lang to EN
32
+// Vue.use(ElementUI, { locale })
33
+// 如果想要中文版 element-ui,按如下方式声明
34
+Vue.use(ElementUI)
35
+
36
+Vue.config.productionTip = false
37
+
38
+new Vue({
39
+  el: '#app',
40
+  router,
41
+  store,
42
+  render: h => h(App)
43
+})

+ 60
- 0
src/permission.js 查看文件

@@ -0,0 +1,60 @@
1
+import router from './router'
2
+import store from './store'
3
+import { Message } from 'element-ui'
4
+import NProgress from 'nprogress' // progress bar
5
+import 'nprogress/nprogress.css' // progress bar style
6
+import { getToken } from '@/utils/auth' // get token from cookie
7
+import getPageTitle from '@/utils/get-page-title'
8
+
9
+NProgress.configure({ showSpinner: false }) // NProgress Configuration
10
+
11
+const whiteList = ['/login', '/login/forgotPassword', '/login/register'] // no redirect whitelist
12
+
13
+router.beforeEach(async(to, from, next) => {
14
+  // start progress bar
15
+  NProgress.start()
16
+
17
+  // set page title
18
+  document.title = getPageTitle(to.meta.title)
19
+
20
+  // determine whether the user has logged in
21
+  const hasToken = getToken()
22
+  if (hasToken) {
23
+    if (to.path === '/login') {
24
+      // if is logged in, redirect to the home page
25
+      next({ path: '/' })
26
+      NProgress.done()
27
+    } else {
28
+      const hasGetUserInfo = store.getters.name
29
+      if (hasGetUserInfo) {
30
+        next()
31
+      } else {
32
+        try {
33
+          next()
34
+        } catch (error) {
35
+          // remove token and go to login page to re-login
36
+          await store.dispatch('user/resetToken')
37
+          Message.error(error || 'Has Error')
38
+          next(`/login?redirect=${to.path}`)
39
+          NProgress.done()
40
+        }
41
+      }
42
+    }
43
+  } else {
44
+    /* has no token*/
45
+
46
+    if (whiteList.indexOf(to.path) !== -1) {
47
+      // in the free login whitelist, go directly
48
+      next()
49
+    } else {
50
+      // other pages that do not have permission to access are redirected to the login page.
51
+      next(`/login?redirect=${to.path}`)
52
+      NProgress.done()
53
+    }
54
+  }
55
+})
56
+
57
+router.afterEach(() => {
58
+  // finish progress bar
59
+  NProgress.done()
60
+})

+ 182
- 0
src/router/index.js 查看文件

@@ -0,0 +1,182 @@
1
+import Vue from 'vue'
2
+import Router from 'vue-router'
3
+
4
+Vue.use(Router)
5
+
6
+/* Layout */
7
+import Layout from '@/layout'
8
+/**
9
+ * Note: sub-menu only appear when route children.length >= 1
10
+ * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
11
+ *
12
+ * hidden: true                   if set true, item will not show in the sidebar(default is false)
13
+ * alwaysShow: true               if set true, will always show the root menu
14
+ *                                if not set alwaysShow, when item has more than one children route,
15
+ *                                it will becomes nested mode, otherwise not show the root menu
16
+ * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
17
+ * name:'router-name'             the name is used by <keep-alive> (must set!!!)
18
+ * meta : {
19
+    roles: ['admin','editor']    control the page roles (you can set multiple roles)
20
+    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
21
+    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
22
+    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
23
+    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
24
+  }
25
+ */
26
+
27
+/**
28
+ * constantRoutes
29
+ * a base page that does not have permission requirements
30
+ * all roles can be accessed
31
+ */
32
+export const constantRoutes = [
33
+  {
34
+    path: '/',
35
+    component: Layout,
36
+    redirect: '/dashboard',
37
+    children: [{
38
+      path: 'dashboard',
39
+      name: 'Dashboard',
40
+      component: () => import('@/views/dashboard/index'),
41
+      meta: { title: '工作台', icon: 'dashboard' }
42
+    }]
43
+  },
44
+
45
+  // 学员管理
46
+  {
47
+    path: '/students',
48
+    component: Layout,
49
+    meta: { title: '学员管理', icon: 'form' },
50
+    children: [
51
+      {
52
+        path: 'semester',
53
+        name: '学期列表',
54
+        component: () => import('@/views/students/semester/list'),
55
+        meta: { title: '学期列表', icon: 'question' }
56
+      },
57
+      {
58
+        hidden: true,
59
+        path: 'semester/edit',
60
+        name: 'semesterEdit',
61
+        component: () => import('@/views/students/semester/edit'),
62
+        meta: { title: '学期编辑', icon: 'question' }
63
+      },
64
+      {
65
+        path: 'sutdentsList',
66
+        name: '学员列表',
67
+        component: () => import('@/views/students/studentsList'),
68
+        meta: { title: '课程列表', icon: 'question' }
69
+      }
70
+    ]
71
+  },
72
+
73
+  // 课程管理
74
+  {
75
+    path: '/course',
76
+    component: Layout,
77
+    meta: { title: '课程管理', icon: 'form' },
78
+    children: [
79
+      {
80
+        path: 'course',
81
+        name: '课程列表',
82
+        component: () => import('@/views/course/index'),
83
+        meta: { title: '课程列表', icon: 'question' }
84
+      },
85
+      {
86
+        hidden: true,
87
+        path: 'course/edit',
88
+        name: 'courseEdit',
89
+        component: () => import('@/views/course/edit'),
90
+        meta: { title: '课程编辑', icon: 'question' }
91
+      }
92
+    ]
93
+  },
94
+
95
+  // 照片墙
96
+  {
97
+    path: '/photoWall',
98
+    component: Layout,
99
+    meta: { title: '照片墙', icon: 'form' },
100
+    children: [
101
+      {
102
+        path: 'photoWall',
103
+        name: '照片列表',
104
+        component: () => import('@/views/photoWall/index'),
105
+        meta: { title: '照片墙', icon: 'question' }
106
+      },
107
+      {
108
+        hidden: true,
109
+        path: 'photoWall/edit',
110
+        name: 'photoWallEdit',
111
+        component: () => import('@/views/photoWall/edit'),
112
+        meta: { title: '照片编辑', icon: 'question' }
113
+      }
114
+    ]
115
+  },
116
+
117
+  // 问卷调查
118
+  {
119
+    path: '/questionnaire',
120
+    component: Layout,
121
+    meta: { title: '问卷调查', icon: 'form' },
122
+    children: [
123
+      {
124
+        path: 'questionnaire',
125
+        name: '问卷列表',
126
+        component: () => import('@/views/questionnaire/index'),
127
+        meta: { title: '问卷列表', icon: 'question' }
128
+      },
129
+      {
130
+        hidden: true,
131
+        path: 'questionnaire/edit',
132
+        name: 'questionEdit',
133
+        component: () => import('@/views/questionnaire/edit'),
134
+        meta: { title: '问卷编辑', icon: 'question' }
135
+      }
136
+    ]
137
+  },
138
+  {
139
+    path: '/login',
140
+    component: () => import('@/views/login/index'),
141
+    hidden: true
142
+  },
143
+
144
+  {
145
+    path: '/login/register',
146
+    component: () => import('@/views/login/register'),
147
+    hidden: true,
148
+    name: 'register'
149
+  },
150
+
151
+  {
152
+    path: '/login/forgotPassword',
153
+    component: () => import('@/views/login/forgotPassword'),
154
+    hidden: true,
155
+    name: 'forgotPassword'
156
+  },
157
+
158
+  {
159
+    path: '/404',
160
+    component: () => import('@/views/404'),
161
+    hidden: true
162
+  },
163
+
164
+  // 404 page must be placed at the end !!!
165
+  { path: '*', redirect: '/404', hidden: true }
166
+]
167
+
168
+const createRouter = () => new Router({
169
+  // mode: 'history', // require service support
170
+  scrollBehavior: () => ({ y: 0 }),
171
+  routes: constantRoutes
172
+})
173
+
174
+const router = createRouter()
175
+
176
+// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
177
+export function resetRouter() {
178
+  const newRouter = createRouter()
179
+  router.matcher = newRouter.matcher // reset router
180
+}
181
+
182
+export default router

+ 16
- 0
src/settings.js 查看文件

@@ -0,0 +1,16 @@
1
+module.exports = {
2
+
3
+  title: '电网教培信息管理系统',
4
+
5
+  /**
6
+   * @type {boolean} true | false
7
+   * @description Whether fix the header
8
+   */
9
+  fixedHeader: false,
10
+
11
+  /**
12
+   * @type {boolean} true | false
13
+   * @description Whether show the logo in sidebar
14
+   */
15
+  sidebarLogo: false
16
+}

+ 8
- 0
src/store/getters.js 查看文件

@@ -0,0 +1,8 @@
1
+const getters = {
2
+  sidebar: state => state.app.sidebar,
3
+  device: state => state.app.device,
4
+  token: state => state.user.token,
5
+  avatar: state => state.user.avatar,
6
+  name: state => state.user.name
7
+}
8
+export default getters

+ 21
- 0
src/store/index.js 查看文件

@@ -0,0 +1,21 @@
1
+import Vue from 'vue'
2
+import Vuex from 'vuex'
3
+import getters from './getters'
4
+import app from './modules/app'
5
+import settings from './modules/settings'
6
+import user from './modules/user'
7
+import game from './modules/game'
8
+
9
+Vue.use(Vuex)
10
+
11
+const store = new Vuex.Store({
12
+  modules: {
13
+    app,
14
+    settings,
15
+    user,
16
+    game
17
+  },
18
+  getters
19
+})
20
+
21
+export default store

+ 49
- 0
src/store/modules/app.js 查看文件

@@ -0,0 +1,49 @@
1
+import Cookies from 'js-cookie'
2
+
3
+const state = {
4
+  sidebar: {
5
+    opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
6
+    withoutAnimation: false
7
+  },
8
+  device: 'desktop'
9
+}
10
+
11
+// 定义Mutations
12
+const mutations = {
13
+  TOGGLE_SIDEBAR: state => {
14
+    state.sidebar.opened = !state.sidebar.opened
15
+    state.sidebar.withoutAnimation = false
16
+    if (state.sidebar.opened) {
17
+      Cookies.set('sidebarStatus', 1)
18
+    } else {
19
+      Cookies.set('sidebarStatus', 0)
20
+    }
21
+  },
22
+  CLOSE_SIDEBAR: (state, withoutAnimation) => {
23
+    Cookies.set('sidebarStatus', 0)
24
+    state.sidebar.opened = false
25
+    state.sidebar.withoutAnimation = withoutAnimation
26
+  },
27
+  TOGGLE_DEVICE: (state, device) => {
28
+    state.device = device
29
+  }
30
+}
31
+
32
+const actions = {
33
+  toggleSideBar({ commit }) {
34
+    commit('TOGGLE_SIDEBAR')
35
+  },
36
+  closeSideBar({ commit }, { withoutAnimation }) {
37
+    commit('CLOSE_SIDEBAR', withoutAnimation)
38
+  },
39
+  toggleDevice({ commit }, device) {
40
+    commit('TOGGLE_DEVICE', device)
41
+  }
42
+}
43
+
44
+export default {
45
+  namespaced: true,
46
+  state,
47
+  mutations,
48
+  actions
49
+}

+ 30
- 0
src/store/modules/game.js 查看文件

@@ -0,0 +1,30 @@
1
+const state = {
2
+  wordList: []// 设置初始特征列表
3
+}
4
+
5
+const getters = {
6
+  getwordList(state) {
7
+    return state.wordList // 返回当前特征列表
8
+  }
9
+}
10
+
11
+// 定义Mutations
12
+const mutations = {
13
+  setWordList(state, val) {
14
+    state.wordList = val // 改变当前特征列表
15
+  }
16
+}
17
+
18
+const actions = {
19
+  setWordListValue({ commit, state }, val) {
20
+    commit('setWordList', val)// 调用mutations方法
21
+  }
22
+}
23
+
24
+export default {
25
+  namespaced: true,
26
+  state,
27
+  getters,
28
+  mutations,
29
+  actions
30
+}

+ 32
- 0
src/store/modules/settings.js 查看文件

@@ -0,0 +1,32 @@
1
+import defaultSettings from '@/settings'
2
+
3
+const { showSettings, fixedHeader, sidebarLogo } = defaultSettings
4
+
5
+const state = {
6
+  showSettings: showSettings,
7
+  fixedHeader: fixedHeader,
8
+  sidebarLogo: sidebarLogo
9
+}
10
+
11
+const mutations = {
12
+  CHANGE_SETTING: (state, { key, value }) => {
13
+    // eslint-disable-next-line no-prototype-builtins
14
+    if (state.hasOwnProperty(key)) {
15
+      state[key] = value
16
+    }
17
+  }
18
+}
19
+
20
+const actions = {
21
+  changeSetting({ commit }, data) {
22
+    commit('CHANGE_SETTING', data)
23
+  }
24
+}
25
+
26
+export default {
27
+  namespaced: true,
28
+  state,
29
+  mutations,
30
+  actions
31
+}
32
+

+ 70
- 0
src/store/modules/user.js 查看文件

@@ -0,0 +1,70 @@
1
+import { login } from '@/api/user'
2
+import { getToken, setToken, removeToken, setUserId, removeUserId } from '@/utils/auth'
3
+import { resetRouter } from '@/router'
4
+import md5 from 'js-md5'
5
+
6
+const getDefaultState = () => {
7
+  return {
8
+    token: getToken()
9
+  }
10
+}
11
+
12
+const state = getDefaultState()
13
+
14
+// 定义Mutations
15
+const mutations = {
16
+  RESET_STATE: (state) => {
17
+    Object.assign(state, getDefaultState())
18
+  },
19
+  SET_TOKEN: (state, token) => {
20
+    state.token = token
21
+  }
22
+}
23
+// 在actions里面增加一个才可以在页面加
24
+// this.$store.dispatch('user/login', this.loginForm)调用api里面的方法
25
+const actions = {
26
+  // user login
27
+  login({ commit }, userInfo) {
28
+    const { userName, password } = userInfo
29
+    return new Promise((resolve, reject) => {
30
+      login({ userName: userName.trim(), password: md5(password) }).then(response => {
31
+        const { data } = response
32
+        commit('SET_TOKEN', data.token)
33
+        setToken(data.token)
34
+        setUserId(data.user.userId)
35
+        resolve()
36
+      }).catch(error => {
37
+        reject(error)
38
+      })
39
+    })
40
+  },
41
+
42
+  // user logout
43
+  logout({ commit, state }) {
44
+    return new Promise((resolve, reject) => {
45
+      removeToken() // must remove  token  first
46
+      removeUserId()
47
+      resetRouter()
48
+      commit('RESET_STATE')
49
+      resolve()
50
+    })
51
+  },
52
+
53
+  // remove token
54
+  resetToken({ commit }) {
55
+    return new Promise(resolve => {
56
+      removeToken() // must remove  token  first
57
+      removeUserId()
58
+      commit('RESET_STATE')
59
+      resolve()
60
+    })
61
+  }
62
+}
63
+
64
+export default {
65
+  namespaced: true,
66
+  state,
67
+  mutations,
68
+  actions
69
+}
70
+

+ 49
- 0
src/styles/element-ui.scss 查看文件

@@ -0,0 +1,49 @@
1
+// cover some element-ui styles
2
+
3
+.el-breadcrumb__inner,
4
+.el-breadcrumb__inner a {
5
+  font-weight: 400 !important;
6
+}
7
+
8
+.el-upload {
9
+  input[type="file"] {
10
+    display: none !important;
11
+  }
12
+}
13
+
14
+.el-upload__input {
15
+  display: none;
16
+}
17
+
18
+
19
+// to fixed https://github.com/ElemeFE/element/issues/2461
20
+.el-dialog {
21
+  transform: none;
22
+  left: 0;
23
+  position: relative;
24
+  margin: 0 auto;
25
+}
26
+
27
+// refine element ui upload
28
+.upload-container {
29
+  .el-upload {
30
+    width: 100%;
31
+
32
+    .el-upload-dragger {
33
+      width: 100%;
34
+      height: 200px;
35
+    }
36
+  }
37
+}
38
+
39
+// dropdown
40
+.el-dropdown-menu {
41
+  a {
42
+    display: block
43
+  }
44
+}
45
+
46
+// to fix el-date-picker css style
47
+.el-range-separator {
48
+  box-sizing: content-box;
49
+}

+ 65
- 0
src/styles/index.scss 查看文件

@@ -0,0 +1,65 @@
1
+@import './variables.scss';
2
+@import './mixin.scss';
3
+@import './transition.scss';
4
+@import './element-ui.scss';
5
+@import './sidebar.scss';
6
+
7
+body {
8
+  height: 100%;
9
+  -moz-osx-font-smoothing: grayscale;
10
+  -webkit-font-smoothing: antialiased;
11
+  text-rendering: optimizeLegibility;
12
+  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
13
+}
14
+
15
+label {
16
+  font-weight: 700;
17
+}
18
+
19
+html {
20
+  height: 100%;
21
+  box-sizing: border-box;
22
+}
23
+
24
+#app {
25
+  height: 100%;
26
+}
27
+
28
+*,
29
+*:before,
30
+*:after {
31
+  box-sizing: inherit;
32
+}
33
+
34
+a:focus,
35
+a:active {
36
+  outline: none;
37
+}
38
+
39
+a,
40
+a:focus,
41
+a:hover {
42
+  cursor: pointer;
43
+  color: inherit;
44
+  text-decoration: none;
45
+}
46
+
47
+div:focus {
48
+  outline: none;
49
+}
50
+
51
+.clearfix {
52
+  &:after {
53
+    visibility: hidden;
54
+    display: block;
55
+    font-size: 0;
56
+    content: " ";
57
+    clear: both;
58
+    height: 0;
59
+  }
60
+}
61
+
62
+// main-container global css
63
+.app-container {
64
+  padding: 20px;
65
+}

+ 28
- 0
src/styles/mixin.scss 查看文件

@@ -0,0 +1,28 @@
1
+@mixin clearfix {
2
+  &:after {
3
+    content: "";
4
+    display: table;
5
+    clear: both;
6
+  }
7
+}
8
+
9
+@mixin scrollBar {
10
+  &::-webkit-scrollbar-track-piece {
11
+    background: #d3dce6;
12
+  }
13
+
14
+  &::-webkit-scrollbar {
15
+    width: 6px;
16
+  }
17
+
18
+  &::-webkit-scrollbar-thumb {
19
+    background: #99a9bf;
20
+    border-radius: 20px;
21
+  }
22
+}
23
+
24
+@mixin relative {
25
+  position: relative;
26
+  width: 100%;
27
+  height: 100%;
28
+}

+ 226
- 0
src/styles/sidebar.scss 查看文件

@@ -0,0 +1,226 @@
1
+#app {
2
+
3
+  .main-container {
4
+    min-height: 100%;
5
+    transition: margin-left .28s;
6
+    margin-left: $sideBarWidth;
7
+    position: relative;
8
+  }
9
+
10
+  .sidebar-container {
11
+    transition: width 0.28s;
12
+    width: $sideBarWidth !important;
13
+    background-color: $menuBg;
14
+    height: 100%;
15
+    position: fixed;
16
+    font-size: 0px;
17
+    top: 0;
18
+    bottom: 0;
19
+    left: 0;
20
+    z-index: 1001;
21
+    overflow: hidden;
22
+
23
+    // reset element-ui css
24
+    .horizontal-collapse-transition {
25
+      transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
26
+    }
27
+
28
+    .scrollbar-wrapper {
29
+      overflow-x: hidden !important;
30
+    }
31
+
32
+    .el-scrollbar__bar.is-vertical {
33
+      right: 0px;
34
+    }
35
+
36
+    .el-scrollbar {
37
+      height: 100%;
38
+    }
39
+
40
+    &.has-logo {
41
+      .el-scrollbar {
42
+        height: calc(100% - 50px);
43
+      }
44
+    }
45
+
46
+    .is-horizontal {
47
+      display: none;
48
+    }
49
+
50
+    a {
51
+      display: inline-block;
52
+      width: 100%;
53
+      overflow: hidden;
54
+    }
55
+
56
+    .svg-icon {
57
+      margin-right: 16px;
58
+    }
59
+
60
+    .sub-el-icon {
61
+      margin-right: 12px;
62
+      margin-left: -2px;
63
+    }
64
+
65
+    .el-menu {
66
+      border: none;
67
+      height: 100%;
68
+      width: 100% !important;
69
+    }
70
+
71
+    // menu hover
72
+    .submenu-title-noDropdown,
73
+    .el-submenu__title {
74
+      &:hover {
75
+        background-color: $menuHover !important;
76
+      }
77
+    }
78
+
79
+    .is-active>.el-submenu__title {
80
+      color: $subMenuActiveText !important;
81
+    }
82
+
83
+    & .nest-menu .el-submenu>.el-submenu__title,
84
+    & .el-submenu .el-menu-item {
85
+      min-width: $sideBarWidth !important;
86
+      background-color: $subMenuBg !important;
87
+
88
+      &:hover {
89
+        background-color: $subMenuHover !important;
90
+      }
91
+    }
92
+  }
93
+
94
+  .hideSidebar {
95
+    .sidebar-container {
96
+      width: 54px !important;
97
+    }
98
+
99
+    .main-container {
100
+      margin-left: 54px;
101
+    }
102
+
103
+    .submenu-title-noDropdown {
104
+      padding: 0 !important;
105
+      position: relative;
106
+
107
+      .el-tooltip {
108
+        padding: 0 !important;
109
+
110
+        .svg-icon {
111
+          margin-left: 20px;
112
+        }
113
+
114
+        .sub-el-icon {
115
+          margin-left: 19px;
116
+        }
117
+      }
118
+    }
119
+
120
+    .el-submenu {
121
+      overflow: hidden;
122
+
123
+      &>.el-submenu__title {
124
+        padding: 0 !important;
125
+
126
+        .svg-icon {
127
+          margin-left: 20px;
128
+        }
129
+
130
+        .sub-el-icon {
131
+          margin-left: 19px;
132
+        }
133
+
134
+        .el-submenu__icon-arrow {
135
+          display: none;
136
+        }
137
+      }
138
+    }
139
+
140
+    .el-menu--collapse {
141
+      .el-submenu {
142
+        &>.el-submenu__title {
143
+          &>span {
144
+            height: 0;
145
+            width: 0;
146
+            overflow: hidden;
147
+            visibility: hidden;
148
+            display: inline-block;
149
+          }
150
+        }
151
+      }
152
+    }
153
+  }
154
+
155
+  .el-menu--collapse .el-menu .el-submenu {
156
+    min-width: $sideBarWidth !important;
157
+  }
158
+
159
+  // mobile responsive
160
+  .mobile {
161
+    .main-container {
162
+      margin-left: 0px;
163
+    }
164
+
165
+    .sidebar-container {
166
+      transition: transform .28s;
167
+      width: $sideBarWidth !important;
168
+    }
169
+
170
+    &.hideSidebar {
171
+      .sidebar-container {
172
+        pointer-events: none;
173
+        transition-duration: 0.3s;
174
+        transform: translate3d(-$sideBarWidth, 0, 0);
175
+      }
176
+    }
177
+  }
178
+
179
+  .withoutAnimation {
180
+
181
+    .main-container,
182
+    .sidebar-container {
183
+      transition: none;
184
+    }
185
+  }
186
+}
187
+
188
+// when menu collapsed
189
+.el-menu--vertical {
190
+  &>.el-menu {
191
+    .svg-icon {
192
+      margin-right: 16px;
193
+    }
194
+    .sub-el-icon {
195
+      margin-right: 12px;
196
+      margin-left: -2px;
197
+    }
198
+  }
199
+
200
+  .nest-menu .el-submenu>.el-submenu__title,
201
+  .el-menu-item {
202
+    &:hover {
203
+      // you can use $subMenuHover
204
+      background-color: $menuHover !important;
205
+    }
206
+  }
207
+
208
+  // the scroll bar appears when the subMenu is too long
209
+  >.el-menu--popup {
210
+    max-height: 100vh;
211
+    overflow-y: auto;
212
+
213
+    &::-webkit-scrollbar-track-piece {
214
+      background: #d3dce6;
215
+    }
216
+
217
+    &::-webkit-scrollbar {
218
+      width: 6px;
219
+    }
220
+
221
+    &::-webkit-scrollbar-thumb {
222
+      background: #99a9bf;
223
+      border-radius: 20px;
224
+    }
225
+  }
226
+}

+ 48
- 0
src/styles/transition.scss 查看文件

@@ -0,0 +1,48 @@
1
+// global transition css
2
+
3
+/* fade */
4
+.fade-enter-active,
5
+.fade-leave-active {
6
+  transition: opacity 0.28s;
7
+}
8
+
9
+.fade-enter,
10
+.fade-leave-active {
11
+  opacity: 0;
12
+}
13
+
14
+/* fade-transform */
15
+.fade-transform-leave-active,
16
+.fade-transform-enter-active {
17
+  transition: all .5s;
18
+}
19
+
20
+.fade-transform-enter {
21
+  opacity: 0;
22
+  transform: translateX(-30px);
23
+}
24
+
25
+.fade-transform-leave-to {
26
+  opacity: 0;
27
+  transform: translateX(30px);
28
+}
29
+
30
+/* breadcrumb transition */
31
+.breadcrumb-enter-active,
32
+.breadcrumb-leave-active {
33
+  transition: all .5s;
34
+}
35
+
36
+.breadcrumb-enter,
37
+.breadcrumb-leave-active {
38
+  opacity: 0;
39
+  transform: translateX(20px);
40
+}
41
+
42
+.breadcrumb-move {
43
+  transition: all .5s;
44
+}
45
+
46
+.breadcrumb-leave-active {
47
+  position: absolute;
48
+}

+ 25
- 0
src/styles/variables.scss 查看文件

@@ -0,0 +1,25 @@
1
+// sidebar
2
+$menuText:#bfcbd9;
3
+$menuActiveText:#409EFF;
4
+$subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951
5
+
6
+$menuBg:#304156;
7
+$menuHover:#263445;
8
+
9
+$subMenuBg:#1f2d3d;
10
+$subMenuHover:#001528;
11
+
12
+$sideBarWidth: 210px;
13
+
14
+// the :export directive is the magic sauce for webpack
15
+// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass
16
+:export {
17
+  menuText: $menuText;
18
+  menuActiveText: $menuActiveText;
19
+  subMenuActiveText: $subMenuActiveText;
20
+  menuBg: $menuBg;
21
+  menuHover: $menuHover;
22
+  subMenuBg: $subMenuBg;
23
+  subMenuHover: $subMenuHover;
24
+  sideBarWidth: $sideBarWidth;
25
+}

+ 27
- 0
src/utils/auth.js 查看文件

@@ -0,0 +1,27 @@
1
+import Cookies from 'js-cookie'
2
+
3
+const TokenKey = 'token'
4
+
5
+export function getToken() {
6
+  return Cookies.get(TokenKey)
7
+}
8
+
9
+export function setToken(token) {
10
+  return Cookies.set(TokenKey, token)
11
+}
12
+
13
+export function removeToken() {
14
+  return Cookies.remove(TokenKey)
15
+}
16
+
17
+const UserIdKey = 'user'
18
+
19
+export function setUserId(userId) {
20
+  return Cookies.set(UserIdKey, userId)
21
+}
22
+export function getUserId() {
23
+  return Cookies.get(UserIdKey)
24
+}
25
+export function removeUserId() {
26
+  return Cookies.remove(UserIdKey)
27
+}

+ 10
- 0
src/utils/get-page-title.js 查看文件

@@ -0,0 +1,10 @@
1
+import defaultSettings from '@/settings'
2
+
3
+const title = defaultSettings.title || 'Vue Admin Template'
4
+
5
+export default function getPageTitle(pageTitle) {
6
+  if (pageTitle) {
7
+    return `${pageTitle} - ${title}`
8
+  }
9
+  return `${title}`
10
+}

+ 117
- 0
src/utils/index.js 查看文件

@@ -0,0 +1,117 @@
1
+/**
2
+ * Created by PanJiaChen on 16/11/18.
3
+ */
4
+
5
+/**
6
+ * Parse the time to string
7
+ * @param {(Object|string|number)} time
8
+ * @param {string} cFormat
9
+ * @returns {string | null}
10
+ */
11
+export function parseTime(time, cFormat) {
12
+  if (arguments.length === 0 || !time) {
13
+    return null
14
+  }
15
+  const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
16
+  let date
17
+  if (typeof time === 'object') {
18
+    date = time
19
+  } else {
20
+    if ((typeof time === 'string')) {
21
+      if ((/^[0-9]+$/.test(time))) {
22
+        // support "1548221490638"
23
+        time = parseInt(time)
24
+      } else {
25
+        // support safari
26
+        // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
27
+        time = time.replace(new RegExp(/-/gm), '/')
28
+      }
29
+    }
30
+
31
+    if ((typeof time === 'number') && (time.toString().length === 10)) {
32
+      time = time * 1000
33
+    }
34
+    date = new Date(time)
35
+  }
36
+  const formatObj = {
37
+    y: date.getFullYear(),
38
+    m: date.getMonth() + 1,
39
+    d: date.getDate(),
40
+    h: date.getHours(),
41
+    i: date.getMinutes(),
42
+    s: date.getSeconds(),
43
+    a: date.getDay()
44
+  }
45
+  const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
46
+    const value = formatObj[key]
47
+    // Note: getDay() returns 0 on Sunday
48
+    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
49
+    return value.toString().padStart(2, '0')
50
+  })
51
+  return time_str
52
+}
53
+
54
+/**
55
+ * @param {number} time
56
+ * @param {string} option
57
+ * @returns {string}
58
+ */
59
+export function formatTime(time, option) {
60
+  if (('' + time).length === 10) {
61
+    time = parseInt(time) * 1000
62
+  } else {
63
+    time = +time
64
+  }
65
+  const d = new Date(time)
66
+  const now = Date.now()
67
+
68
+  const diff = (now - d) / 1000
69
+
70
+  if (diff < 30) {
71
+    return '刚刚'
72
+  } else if (diff < 3600) {
73
+    // less 1 hour
74
+    return Math.ceil(diff / 60) + '分钟前'
75
+  } else if (diff < 3600 * 24) {
76
+    return Math.ceil(diff / 3600) + '小时前'
77
+  } else if (diff < 3600 * 24 * 2) {
78
+    return '1天前'
79
+  }
80
+  if (option) {
81
+    return parseTime(time, option)
82
+  } else {
83
+    return (
84
+      d.getMonth() +
85
+      1 +
86
+      '月' +
87
+      d.getDate() +
88
+      '日' +
89
+      d.getHours() +
90
+      '时' +
91
+      d.getMinutes() +
92
+      '分'
93
+    )
94
+  }
95
+}
96
+
97
+/**
98
+ * @param {string} url
99
+ * @returns {Object}
100
+ */
101
+export function param2Obj(url) {
102
+  const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
103
+  if (!search) {
104
+    return {}
105
+  }
106
+  const obj = {}
107
+  const searchArr = search.split('&')
108
+  searchArr.forEach(v => {
109
+    const index = v.indexOf('=')
110
+    if (index !== -1) {
111
+      const name = v.substring(0, index)
112
+      const val = v.substring(index + 1, v.length)
113
+      obj[name] = val
114
+    }
115
+  })
116
+  return obj
117
+}

+ 71
- 0
src/utils/request.js 查看文件

@@ -0,0 +1,71 @@
1
+import axios from 'axios'
2
+import { Message } from 'element-ui'
3
+import store from '@/store'
4
+import { getToken, getUserId } from '@/utils/auth'
5
+
6
+// create an axios instance
7
+const service = axios.create({
8
+  baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
9
+  // withCredentials: true, // send cookies when cross-domain requests
10
+  timeout: 5000 // request timeout
11
+})
12
+
13
+// request interceptor
14
+service.interceptors.request.use(
15
+  config => {
16
+    // do something before request is sent
17
+
18
+    if (store.getters.token) {
19
+      // let each request carry token
20
+      // ['X-Token'] is a custom headers key
21
+      // please modify it according to the actual situation
22
+      config.headers['X-Authorization-JWT'] = getToken()
23
+      config.headers['x-userid'] = getUserId()
24
+    }
25
+    return config
26
+  },
27
+  error => {
28
+    // do something with request error
29
+    console.log(error) // for debug
30
+    return Promise.reject(error)
31
+  }
32
+)
33
+
34
+// response interceptor响应
35
+service.interceptors.response.use(
36
+  /**
37
+   * If you want to get http information such as headers or status
38
+   * Please return  response => response
39
+  */
40
+
41
+  /**
42
+   * Determine the request status by custom code
43
+   * Here is just an example
44
+   * You can also judge the status by HTTP Status Code
45
+   */
46
+  response => {
47
+    const res = response.data
48
+    // if the custom code is not 20000, it is judged as an error.
49
+    if (res.code !== 1000) {
50
+      Message({
51
+        message: res.message || 'Error',
52
+        type: 'error',
53
+        duration: 5 * 1000
54
+      })
55
+      return Promise.reject(new Error(res.message || 'Error'))
56
+    } else {
57
+      return res
58
+    }
59
+  },
60
+  error => {
61
+    console.log('err' + error) // for debug
62
+    Message({
63
+      message: error.message,
64
+      type: 'error',
65
+      duration: 5 * 1000
66
+    })
67
+    return Promise.reject(error)
68
+  }
69
+)
70
+
71
+export default service

+ 17
- 0
src/utils/upload.js 查看文件

@@ -0,0 +1,17 @@
1
+import { upload } from '@/api/oss'
2
+
3
+/**
4
+ * 获取 OSS 客户端
5
+ * @returns
6
+ */
7
+export function uploadFile({ file, onSuccess, onError }) {
8
+  upload(file).then((url) => {
9
+    onSuccess(url, file)
10
+  }).catch((e) => {
11
+    onError(e)
12
+  })
13
+
14
+  return {
15
+    abort: () => {}
16
+  }
17
+}

+ 20
- 0
src/utils/validate.js 查看文件

@@ -0,0 +1,20 @@
1
+/**
2
+ * Created by PanJiaChen on 16/11/18.
3
+ */
4
+
5
+/**
6
+ * @param {string} path
7
+ * @returns {Boolean}
8
+ */
9
+export function isExternal(path) {
10
+  return /^(https?:|mailto:|tel:)/.test(path)
11
+}
12
+
13
+/**
14
+ * @param {string} str
15
+ * @returns {Boolean}
16
+ */
17
+export function validUsername(str) {
18
+  const valid_map = ['admin', 'editor']
19
+  return valid_map.indexOf(str.trim()) >= 0
20
+}

+ 228
- 0
src/views/404.vue 查看文件

@@ -0,0 +1,228 @@
1
+<template>
2
+  <div class="wscn-http404-container">
3
+    <div class="wscn-http404">
4
+      <div class="pic-404">
5
+        <img class="pic-404__parent" src="@/assets/404_images/404.png" alt="404">
6
+        <img class="pic-404__child left" src="@/assets/404_images/404_cloud.png" alt="404">
7
+        <img class="pic-404__child mid" src="@/assets/404_images/404_cloud.png" alt="404">
8
+        <img class="pic-404__child right" src="@/assets/404_images/404_cloud.png" alt="404">
9
+      </div>
10
+      <div class="bullshit">
11
+        <div class="bullshit__oops">OOPS!</div>
12
+        <div class="bullshit__info">All rights reserved
13
+          <a style="color:#20a0ff" href="https://wallstreetcn.com" target="_blank">wallstreetcn</a>
14
+        </div>
15
+        <div class="bullshit__headline">{{ message }}</div>
16
+        <div class="bullshit__info">Please check that the URL you entered is correct, or click the button below to return to the homepage.</div>
17
+        <a href="" class="bullshit__return-home">Back to home</a>
18
+      </div>
19
+    </div>
20
+  </div>
21
+</template>
22
+
23
+<script>
24
+
25
+export default {
26
+  name: 'Page404',
27
+  computed: {
28
+    message() {
29
+      return 'The webmaster said that you can not enter this page...'
30
+    }
31
+  }
32
+}
33
+</script>
34
+
35
+<style lang="scss" scoped>
36
+.wscn-http404-container{
37
+  transform: translate(-50%,-50%);
38
+  position: absolute;
39
+  top: 40%;
40
+  left: 50%;
41
+}
42
+.wscn-http404 {
43
+  position: relative;
44
+  width: 1200px;
45
+  padding: 0 50px;
46
+  overflow: hidden;
47
+  .pic-404 {
48
+    position: relative;
49
+    float: left;
50
+    width: 600px;
51
+    overflow: hidden;
52
+    &__parent {
53
+      width: 100%;
54
+    }
55
+    &__child {
56
+      position: absolute;
57
+      &.left {
58
+        width: 80px;
59
+        top: 17px;
60
+        left: 220px;
61
+        opacity: 0;
62
+        animation-name: cloudLeft;
63
+        animation-duration: 2s;
64
+        animation-timing-function: linear;
65
+        animation-fill-mode: forwards;
66
+        animation-delay: 1s;
67
+      }
68
+      &.mid {
69
+        width: 46px;
70
+        top: 10px;
71
+        left: 420px;
72
+        opacity: 0;
73
+        animation-name: cloudMid;
74
+        animation-duration: 2s;
75
+        animation-timing-function: linear;
76
+        animation-fill-mode: forwards;
77
+        animation-delay: 1.2s;
78
+      }
79
+      &.right {
80
+        width: 62px;
81
+        top: 100px;
82
+        left: 500px;
83
+        opacity: 0;
84
+        animation-name: cloudRight;
85
+        animation-duration: 2s;
86
+        animation-timing-function: linear;
87
+        animation-fill-mode: forwards;
88
+        animation-delay: 1s;
89
+      }
90
+      @keyframes cloudLeft {
91
+        0% {
92
+          top: 17px;
93
+          left: 220px;
94
+          opacity: 0;
95
+        }
96
+        20% {
97
+          top: 33px;
98
+          left: 188px;
99
+          opacity: 1;
100
+        }
101
+        80% {
102
+          top: 81px;
103
+          left: 92px;
104
+          opacity: 1;
105
+        }
106
+        100% {
107
+          top: 97px;
108
+          left: 60px;
109
+          opacity: 0;
110
+        }
111
+      }
112
+      @keyframes cloudMid {
113
+        0% {
114
+          top: 10px;
115
+          left: 420px;
116
+          opacity: 0;
117
+        }
118
+        20% {
119
+          top: 40px;
120
+          left: 360px;
121
+          opacity: 1;
122
+        }
123
+        70% {
124
+          top: 130px;
125
+          left: 180px;
126
+          opacity: 1;
127
+        }
128
+        100% {
129
+          top: 160px;
130
+          left: 120px;
131
+          opacity: 0;
132
+        }
133
+      }
134
+      @keyframes cloudRight {
135
+        0% {
136
+          top: 100px;
137
+          left: 500px;
138
+          opacity: 0;
139
+        }
140
+        20% {
141
+          top: 120px;
142
+          left: 460px;
143
+          opacity: 1;
144
+        }
145
+        80% {
146
+          top: 180px;
147
+          left: 340px;
148
+          opacity: 1;
149
+        }
150
+        100% {
151
+          top: 200px;
152
+          left: 300px;
153
+          opacity: 0;
154
+        }
155
+      }
156
+    }
157
+  }
158
+  .bullshit {
159
+    position: relative;
160
+    float: left;
161
+    width: 300px;
162
+    padding: 30px 0;
163
+    overflow: hidden;
164
+    &__oops {
165
+      font-size: 32px;
166
+      font-weight: bold;
167
+      line-height: 40px;
168
+      color: #1482f0;
169
+      opacity: 0;
170
+      margin-bottom: 20px;
171
+      animation-name: slideUp;
172
+      animation-duration: 0.5s;
173
+      animation-fill-mode: forwards;
174
+    }
175
+    &__headline {
176
+      font-size: 20px;
177
+      line-height: 24px;
178
+      color: #222;
179
+      font-weight: bold;
180
+      opacity: 0;
181
+      margin-bottom: 10px;
182
+      animation-name: slideUp;
183
+      animation-duration: 0.5s;
184
+      animation-delay: 0.1s;
185
+      animation-fill-mode: forwards;
186
+    }
187
+    &__info {
188
+      font-size: 13px;
189
+      line-height: 21px;
190
+      color: grey;
191
+      opacity: 0;
192
+      margin-bottom: 30px;
193
+      animation-name: slideUp;
194
+      animation-duration: 0.5s;
195
+      animation-delay: 0.2s;
196
+      animation-fill-mode: forwards;
197
+    }
198
+    &__return-home {
199
+      display: block;
200
+      float: left;
201
+      width: 110px;
202
+      height: 36px;
203
+      background: #1482f0;
204
+      border-radius: 100px;
205
+      text-align: center;
206
+      color: #ffffff;
207
+      opacity: 0;
208
+      font-size: 14px;
209
+      line-height: 36px;
210
+      cursor: pointer;
211
+      animation-name: slideUp;
212
+      animation-duration: 0.5s;
213
+      animation-delay: 0.3s;
214
+      animation-fill-mode: forwards;
215
+    }
216
+    @keyframes slideUp {
217
+      0% {
218
+        transform: translateY(60px);
219
+        opacity: 0;
220
+      }
221
+      100% {
222
+        transform: translateY(0);
223
+        opacity: 1;
224
+      }
225
+    }
226
+  }
227
+}
228
+</style>

+ 281
- 0
src/views/course/edit.vue 查看文件

@@ -0,0 +1,281 @@
1
+<template>
2
+  <div>
3
+    <el-card class="box-card" shadow="never">
4
+      <el-row :gutter="24">
5
+        <el-col :span="18">
6
+          <el-form
7
+            ref="ruleForm"
8
+            :model="ruleForm"
9
+            :rules="rules"
10
+            label-width="10vw"
11
+            class="demo-ruleForm"
12
+          >
13
+            <el-form-item label="学期" prop="appName" style="width:30vw">
14
+              <el-select v-model="ruleForm.appType" filterable placeholder="请选择">
15
+                <el-option
16
+                  v-for="item in options"
17
+                  :key="item.value"
18
+                  :label="item.label"
19
+                  :value="item.value"
20
+                />
21
+              </el-select>
22
+            </el-form-item>
23
+            <el-form-item style="width:30vw" label="课程名" prop="course">
24
+              <el-input v-model="ruleForm.course" />
25
+            </el-form-item>
26
+            <el-form-item style="width:30vw" label="签到人数" prop="signInNum">
27
+              <el-input v-model="ruleForm.signInNum" />
28
+            </el-form-item>
29
+            <el-form-item style="width:30vw" label="二维码" prop="qcode">
30
+              <el-image :src="qcode" style="width: 100px; height: 100px" />
31
+            </el-form-item>
32
+            <!-- <el-form-item label="发布状态" prop="status">
33
+              <el-select v-model="ruleForm.status" placeholder="请选择状态">
34
+                <el-option label="发布" :value="1" />
35
+                <el-option label="未发布" :value="0" />
36
+              </el-select>
37
+            </el-form-item> -->
38
+
39
+            <el-form-item>
40
+              <el-button
41
+                type="primary"
42
+                @click="submitForm('ruleForm')"
43
+              >{{ !configId?'新建照片墙':'修改照片墙' }}</el-button>
44
+              <el-button @click="resetForm('ruleForm')">重置</el-button>
45
+            </el-form-item>
46
+          </el-form>
47
+        </el-col>
48
+      </el-row>
49
+    </el-card>
50
+  </div>
51
+</template>
52
+
53
+<script>
54
+// import { saveConfig, detailsConfig, ChangeConfig } from '@/api/WeChatApi'
55
+import QRCode from 'qrcodejs2'
56
+
57
+export default {
58
+  data() {
59
+    return {
60
+      configId: '',
61
+      gameForm: {
62
+        gameForm: undefined
63
+      },
64
+      qcode: undefined,
65
+      ruleForm: {
66
+        course: undefined,
67
+        signInNum: undefined,
68
+        appName: '',
69
+        appid: '',
70
+        appType: '',
71
+        aesKey: '',
72
+        apiUrl: '',
73
+        resource: '',
74
+        httpPoxyHost: '',
75
+        msgDataFormat: 'Json',
76
+        secret: '',
77
+        token: '',
78
+        httpProxyPort: null,
79
+        status: null
80
+      },
81
+      rules: {
82
+        appName: [
83
+          { required: true, message: '请输入配置名称', trigger: 'blur' }
84
+        ],
85
+        appid: [{ required: true, message: '请输入AppID', trigger: 'blur' }],
86
+        appType: [{ required: true, message: '请选择类型', trigger: 'blur' }],
87
+        aesKey: [{ required: true, message: '请选择AesKey', trigger: 'blur' }],
88
+        apiUrl: [
89
+          { required: true, message: '请选择第三方接口地址', trigger: 'blur' }
90
+        ],
91
+        httpPoxyHost: [
92
+          { required: true, message: '请输入接口代理地址', trigger: 'blur' }
93
+        ],
94
+        httpProxyPort: [
95
+          { required: true, message: '请输入接口代理端口', trigger: 'blur' }
96
+        ],
97
+        msgDataFormat: [
98
+          { required: true, message: '请输入消息格式类型', trigger: 'blur' }
99
+        ],
100
+        secret: [{ required: true, message: '请输入Secret', trigger: 'blur' }],
101
+        token: [{ required: true, message: '请输入Token', trigger: 'blur' }],
102
+
103
+        status: [{ required: true, message: '请选择状态', trigger: 'blur' }]
104
+      },
105
+      options: [{
106
+        value: '选项1',
107
+        label: '2022年第一学期'
108
+      }, {
109
+        value: '选项2',
110
+        label: '2022年第二学期'
111
+      }, {
112
+        value: '选项3',
113
+        label: '2023年第一学期'
114
+      }, {
115
+        value: '选项4',
116
+        label: '2023年第二学期'
117
+      }, {
118
+        value: '选项5',
119
+        label: '2024年第一学期'
120
+      }]
121
+    }
122
+  },
123
+
124
+  watch: {
125
+    configId: function(val, oldVal) {
126
+      if (val) {
127
+        this.configId = val
128
+      //   detailsConfig(val)
129
+      //     .then((res) => {
130
+      //       this.ruleForm = res.data
131
+      //     })
132
+      //     .catch((e) => {
133
+      //       this.$message.error('ID有误。')
134
+      //       this.$router.go(-1)
135
+      //     })
136
+      }
137
+    }
138
+  },
139
+  mounted() {
140
+    if (this.$route?.query.configId) {
141
+      this.configId = this.$route.query.configId
142
+      // detailsConfig(this.configId)
143
+      //   .then((res) => {
144
+      //     this.ruleForm = res.data
145
+      //   })
146
+      //   .catch((e) => {
147
+      //     this.$message.error('ID有误。')
148
+      //     this.$router.go(-1)
149
+      //   })
150
+    }
151
+    if (this.$route?.query.courseId) {
152
+      this.configId = this.$route.query.configId
153
+      // detailsConfig(this.configId)
154
+      //   .then((res) => {
155
+      //     this.ruleForm = res.data
156
+      //   })
157
+      //   .catch((e) => {
158
+      //     this.$message.error('ID有误。')
159
+      //     this.$router.go(-1)
160
+      //   })
161
+    }
162
+  },
163
+  methods: {
164
+    submitForm(formName) {
165
+      this.$refs[formName].validate((valid) => {
166
+        console.log(this.ruleForm)
167
+        // if (valid) {
168
+        //   if (this.configId === '') {
169
+        //     saveConfig(this.ruleForm)
170
+        //       .then((e) => {
171
+        //         this.$message.success('配置保存成功')
172
+        //         this.$router.go(-1)
173
+        //         console.log('保存字段', e)
174
+        //       })
175
+        //       .catch((e) => {
176
+        //         this.$message.error('保存失败', e)
177
+        //       })
178
+        //   } else {
179
+        //     ChangeConfig(this.ruleForm, this.configId)
180
+        //       .then((res) => {
181
+        //         this.$message.success('配置修改成功')
182
+        //         this.$router.go(-1)
183
+        //       })
184
+        //       .catch((e) => {
185
+        //         console.log(e)
186
+        //       })
187
+        //   }
188
+        // } else {
189
+        //   return false
190
+        // }
191
+      })
192
+    },
193
+    resetForm(formName) {
194
+      this.$refs[formName].resetFields()
195
+    },
196
+    handleChange(val) {
197
+      this.gameForm.gameImage = val
198
+    },
199
+    handleDeleteIcon() {
200
+      this.gameForm.gameImage = ''
201
+    },
202
+    // 生成二维码
203
+    qrcode(val) {
204
+      // eslint-disable-next-line no-unused-vars
205
+      const qrcode = new QRCode('qrcode', {
206
+        width: 200,
207
+        height: 200, // 高度
208
+        text: 'http://192.168.89.76:8080/?gameId=' + val.gameId
209
+      })
210
+    },
211
+    // 下载二维码
212
+    downloadQrcode(val) {
213
+      document.getElementById('qrcode').innerHTML = ''
214
+      this.qrcode(val) // 下载之前首先要有二维码
215
+      // 先找到canvas节点下的二维码图片
216
+      const myCanvas = document.getElementById('qrcode').getElementsByTagName('canvas')
217
+      const img = document.getElementById('qrcode').getElementsByTagName('img')
218
+      // 创建一个a节点
219
+      const a = document.createElement('a')
220
+      // 设置a的href属性将canvas变成png格式
221
+      const imgURL = myCanvas[0].toDataURL('image/jpg')
222
+      const ua = navigator.userAgent
223
+      if (ua.indexOf('Trident') !== -1 && ua.indexOf('Windows') !== -1) { // IE内核 并且  windows系统 情况下 才执行;
224
+        var bstr = atob(imgURL.split(',')[1])
225
+        var n = bstr.length
226
+        var u8arr = new Uint8Array(n)
227
+        while (n--) {
228
+          u8arr[n] = bstr.charCodeAt(n)
229
+        }
230
+        var blob = new Blob([u8arr])
231
+        window.navigator.msSaveOrOpenBlob(blob, val.title + '.png')
232
+      } else if (ua.indexOf('Firefox') > -1) { // 火狐兼容下载
233
+        const blob = this.base64ToBlob(imgURL) // new Blob([content]);
234
+        const evt = document.createEvent('HTMLEvents')
235
+        evt.initEvent('click', true, true)// initEvent 不加后两个参数在FF下会报错  事件类型,是否冒泡,是否阻止浏览器的默认行为
236
+        a.download = val.title + '.png'// 下载图片名称,如果填内容识别不到,下载为未知文件,所以我这里就不填为空
237
+        a.href = URL.createObjectURL(blob)
238
+        a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))// 兼容火狐
239
+      } else { // 谷歌兼容下载
240
+        img.src = imgURL
241
+        a.href = img.src
242
+        // 设置下载文件的名字
243
+        a.download = val.title + '.png'
244
+        // 点击
245
+        a.click()
246
+      }
247
+    },
248
+    // 返回对应二维码图片给表格
249
+    setCodeImg(val) {
250
+      document.getElementById('qrcode').innerHTML = ''
251
+      this.qrcode(val) // 下载之前首先要有二维码
252
+      // 先找到canvas节点下的二维码图片
253
+      const myCanvas = document.getElementById('qrcode').getElementsByTagName('canvas')
254
+      // 设置a的href属性将canvas变成png格式
255
+      const imgURL = myCanvas[myCanvas.length - 1].toDataURL('image/jpg')
256
+      return imgURL
257
+    },
258
+    // base64转blob
259
+    base64ToBlob(code) {
260
+      const parts = code.split(';base64,')
261
+      const contentType = parts[0].split(':')[1]
262
+      const raw = window.atob(parts[1])
263
+      const rawLength = raw.length
264
+      const uInt8Array = new Uint8Array(rawLength)
265
+      for (let i = 0; i < rawLength; ++i) {
266
+        uInt8Array[i] = raw.charCodeAt(i)
267
+      }
268
+      return new Blob([uInt8Array], { type: contentType })
269
+    }
270
+  }
271
+}
272
+</script>
273
+
274
+<style scoped >
275
+.demo-ruleForm {
276
+  margin-top: 1em;
277
+}
278
+</style>
279
+
280
+<style lang="scss" scoped>
281
+</style>

+ 0
- 0
src/views/course/index.vue 查看文件


部分文件因文件數量過多而無法顯示