李志伟 3 년 전
부모
커밋
e47f2c7afb
46개의 변경된 파일189개의 추가작업 그리고 3447개의 파일을 삭제
  1. 0
    111
      README-zh.md
  2. 0
    61
      src/api/AppControllerApi.js
  3. 0
    59
      src/api/WeChatApi.js
  4. 0
    46
      src/api/answer.js
  5. 0
    46
      src/api/game.js
  6. 0
    46
      src/api/gameCharacter.js
  7. 0
    10
      src/api/gamePerson.js
  8. 0
    38
      src/api/gamelevelquestion.js
  9. 0
    60
      src/api/oss.js
  10. 10
    0
      src/api/person.js
  11. 10
    0
      src/api/prize.js
  12. 0
    55
      src/api/question.js
  13. 0
    21
      src/api/signup.js
  14. 0
    9
      src/api/user.js
  15. 0
    29
      src/layout/components/Navbar.vue
  16. 0
    1
      src/main.js
  17. 0
    60
      src/permission.js
  18. 11
    98
      src/router/index.js
  19. 1
    4
      src/store/getters.js
  20. 0
    2
      src/store/index.js
  21. 0
    67
      src/store/modules/user.js
  22. 0
    25
      src/utils/auth.js
  23. 1
    3
      src/utils/request.js
  24. 0
    17
      src/utils/upload.js
  25. 0
    213
      src/views/AppController/index.vue
  26. 80
    0
      src/views/Prize/index.vue
  27. 0
    194
      src/views/WeChatConfig/Edit.vue
  28. 0
    145
      src/views/WeChatConfig/index.vue
  29. 0
    207
      src/views/gameManage/edit.vue
  30. 0
    147
      src/views/gameManage/index.vue
  31. 0
    146
      src/views/gamePerson/index.vue
  32. 0
    261
      src/views/login/forgotPassword.vue
  33. 0
    246
      src/views/login/index.vue
  34. 0
    329
      src/views/login/register.vue
  35. 76
    0
      src/views/person/index.vue
  36. 0
    153
      src/views/question/drawer.vue
  37. 0
    209
      src/views/question/edit.vue
  38. 0
    118
      src/views/question/index.vue
  39. 0
    5
      tests/unit/.eslintrc.js
  40. 0
    70
      tests/unit/components/Breadcrumb.spec.js
  41. 0
    18
      tests/unit/components/Hamburger.spec.js
  42. 0
    22
      tests/unit/components/SvgIcon.spec.js
  43. 0
    30
      tests/unit/utils/formatTime.spec.js
  44. 0
    14
      tests/unit/utils/param2Obj.spec.js
  45. 0
    35
      tests/unit/utils/parseTime.spec.js
  46. 0
    17
      tests/unit/utils/validate.spec.js

+ 0
- 111
README-zh.md 파일 보기

@@ -1,111 +0,0 @@
1
-# vue-admin-template
2
-
3
-> 这是一个极简的 vue admin 管理后台。它只包含了 Element UI & axios & iconfont & permission control & lint,这些搭建后台必要的东西。
4
-
5
-[线上地址](http://panjiachen.github.io/vue-admin-template)
6
-
7
-[国内访问](https://panjiachen.gitee.io/vue-admin-template)
8
-
9
-目前版本为 `v4.0+` 基于 `vue-cli` 进行构建,若你想使用旧版本,可以切换分支到[tag/3.11.0](https://github.com/PanJiaChen/vue-admin-template/tree/tag/3.11.0),它不依赖 `vue-cli`。
10
-
11
-<p align="center">
12
-  <b>SPONSORED BY</b>
13
-</p>
14
-<p align="center">
15
-   <a href="https://finclip.com?from=vue_element" title="FinClip" target="_blank">
16
-      <img height="200px" src="https://gitee.com/panjiachen/gitee-cdn/raw/master/vue%E8%B5%9E%E5%8A%A9.png" title="FinClip">
17
-   </a>
18
-</p>
19
-
20
-## Extra
21
-
22
-如果你想要根据用户角色来动态生成侧边栏和 router,你可以使用该分支[permission-control](https://github.com/PanJiaChen/vue-admin-template/tree/permission-control)
23
-
24
-## 相关项目
25
-
26
-- [vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)
27
-
28
-- [electron-vue-admin](https://github.com/PanJiaChen/electron-vue-admin)
29
-
30
-- [vue-typescript-admin-template](https://github.com/Armour/vue-typescript-admin-template)
31
-
32
-- [awesome-project](https://github.com/PanJiaChen/vue-element-admin/issues/2312)
33
-
34
-写了一个系列的教程配套文章,如何从零构建后一个完整的后台项目:
35
-
36
-- [手摸手,带你用 vue 撸后台 系列一(基础篇)](https://juejin.im/post/59097cd7a22b9d0065fb61d2)
37
-- [手摸手,带你用 vue 撸后台 系列二(登录权限篇)](https://juejin.im/post/591aa14f570c35006961acac)
38
-- [手摸手,带你用 vue 撸后台 系列三 (实战篇)](https://juejin.im/post/593121aa0ce4630057f70d35)
39
-- [手摸手,带你用 vue 撸后台 系列四(vueAdmin 一个极简的后台基础模板,专门针对本项目的文章,算作是一篇文档)](https://juejin.im/post/595b4d776fb9a06bbe7dba56)
40
-- [手摸手,带你封装一个 vue component](https://segmentfault.com/a/1190000009090836)
41
-
42
-## Build Setup
43
-
44
-```bash
45
-# 克隆项目
46
-git clone https://github.com/PanJiaChen/vue-admin-template.git
47
-
48
-# 进入项目目录
49
-cd vue-admin-template
50
-
51
-# 安装依赖
52
-npm install
53
-
54
-# 建议不要直接使用 cnpm 安装以来,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
55
-npm install --registry=https://registry.npm.taobao.org
56
-
57
-# 启动服务
58
-npm run dev
59
-```
60
-
61
-浏览器访问 [http://localhost:9528](http://localhost:9528)
62
-
63
-## 发布
64
-
65
-```bash
66
-# 构建测试环境
67
-npm run build:stage
68
-
69
-# 构建生产环境
70
-npm run build:prod
71
-```
72
-
73
-## 其它
74
-
75
-```bash
76
-# 预览发布环境效果
77
-npm run preview
78
-
79
-# 预览发布环境效果 + 静态资源分析
80
-npm run preview -- --report
81
-
82
-# 代码格式检查
83
-npm run lint
84
-
85
-# 代码格式检查并自动修复
86
-npm run lint -- --fix
87
-```
88
-
89
-更多信息请参考 [使用文档](https://panjiachen.github.io/vue-element-admin-site/zh/)
90
-
91
-## 购买贴纸
92
-
93
-你也可以通过 购买[官方授权的贴纸](https://smallsticker.com/product/vue-element-admin) 的方式来支持 vue-element-admin - 每售出一张贴纸,我们将获得 2 元的捐赠。
94
-
95
-## Demo
96
-
97
-![demo](https://github.com/PanJiaChen/PanJiaChen.github.io/blob/master/images/demo.gif)
98
-
99
-## Browsers support
100
-
101
-Modern browsers and Internet Explorer 10+.
102
-
103
-| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)</br>Safari |
104
-| --------- | --------- | --------- | --------- |
105
-| IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions
106
-
107
-## License
108
-
109
-[MIT](https://github.com/PanJiaChen/vue-admin-template/blob/master/LICENSE) license.
110
-
111
-Copyright (c) 2017-present PanJiaChen

+ 0
- 61
src/api/AppControllerApi.js 파일 보기

@@ -1,61 +0,0 @@
1
-
2
-
3
-
4
-import request from '@/utils/request'
5
-
6
-/**
7
-* 应用管理列表
8
-* @param {*} data
9
-* @returns
10
-*/
11
-export const getAppControllerList = (params) => request({
12
-  url: '/admin/app', params
13
-
14
-})
15
-
16
-
17
-/**
18
-* 保存应用管理
19
-* @param {*} data
20
-* @returns
21
-*/
22
-export const saveAppController = (data) => request({
23
-  url: '/admin/app',
24
-  method: 'post',
25
-  data
26
-})
27
-
28
-/**
29
-* 应用管理详情
30
-* @param {*} 
31
-* @returns
32
-*/
33
-export const detailsAppController = (id) => request({
34
-  url: `admin/app/${id}`,
35
-
36
-  method: 'get',
37
-})
38
-
39
-/**
40
-* 修改应用管理
41
-* @param {*} 
42
-* @returns
43
-*/
44
-export const ChangeAppController = (data, id) => request({
45
-  url: `admin/app/${id}`,
46
-
47
-  method: 'put',
48
-  data
49
-})
50
-
51
-/**
52
-* 删除应用管理
53
-* @param {*} 
54
-* @returns
55
-*/
56
-export const DeleteAppController = (id) => request({
57
-  url: `admin/app/${id}`,
58
-  method: 'delete',
59
-})
60
-
61
-

+ 0
- 59
src/api/WeChatApi.js 파일 보기

@@ -1,59 +0,0 @@
1
-import request from '@/utils/request'
2
-
3
-/**
4
-* 配置列表
5
-* @param {*} data
6
-* @returns
7
-*/
8
-export const getConfigList = (params) => request({
9
-  url: '/admin/wx/config', params
10
-
11
-})
12
-
13
-
14
-
15
-/**
16
-* 保存配置
17
-* @param {*} data
18
-* @returns
19
-*/
20
-export const saveConfig = (data) => request({
21
-  url: '/admin/wx/config',
22
-  method: 'post',
23
-  data
24
-})
25
-
26
-/**
27
-* 详情配置
28
-* @param {*} 
29
-* @returns
30
-*/
31
-export const detailsConfig = (id) => request({
32
-  url: `admin/wx/config/${id}`,
33
-
34
-  method: 'get',
35
-})
36
-
37
-/**
38
-* 修改配置
39
-* @param {*} 
40
-* @returns
41
-*/
42
-export const ChangeConfig = (data, id) => request({
43
-  url: `admin/wx/config/${id}`,
44
-
45
-  method: 'put',
46
-  data
47
-})
48
-
49
-/**
50
-* 删除配置
51
-* @param {*} 
52
-* @returns
53
-*/
54
-export const DeleteConfig = (id) => request({
55
-  url: `admin/wx/config/${id}`,
56
-  method: 'delete',
57
-})
58
-
59
-

+ 0
- 46
src/api/answer.js 파일 보기

@@ -1,46 +0,0 @@
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
-})

+ 0
- 46
src/api/game.js 파일 보기

@@ -1,46 +0,0 @@
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
-})

+ 0
- 46
src/api/gameCharacter.js 파일 보기

@@ -1,46 +0,0 @@
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
-})

+ 0
- 10
src/api/gamePerson.js 파일 보기

@@ -1,10 +0,0 @@
1
-import request from '@/utils/request'
2
-
3
-/**
4
- * 游戏结果列表
5
- * @param {*} params
6
- * @returns
7
- */
8
-export const getGamePersonList = (params) => request({
9
-  url: '/admin/game-person', params
10
-})

+ 0
- 38
src/api/gamelevelquestion.js 파일 보기

@@ -1,38 +0,0 @@
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
-})

+ 0
- 60
src/api/oss.js 파일 보기

@@ -1,60 +0,0 @@
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
-}

+ 10
- 0
src/api/person.js 파일 보기

@@ -0,0 +1,10 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+ * 游戏题库列表
5
+ * @param {*} params
6
+ * @returns
7
+ */
8
+export const getPersonList = (params) => request({
9
+  url: '/taPerson', params
10
+})

+ 10
- 0
src/api/prize.js 파일 보기

@@ -0,0 +1,10 @@
1
+import request from '@/utils/request'
2
+
3
+/**
4
+ * 游戏题库列表
5
+ * @param {*} params
6
+ * @returns
7
+ */
8
+export const getPrizeList = (params) => request({
9
+  url: '/taPrize', params
10
+})

+ 0
- 55
src/api/question.js 파일 보기

@@ -1,55 +0,0 @@
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
-})

+ 0
- 21
src/api/signup.js 파일 보기

@@ -1,21 +0,0 @@
1
-import request from '@/utils/request'
2
-
3
-/**
4
-* 注册账号
5
-* @param {*} data
6
-* @returns
7
-*/
8
-export const signUp = (data) => request({
9
-  url: '/admin/signup',
10
-  method: 'post',
11
-  data
12
-})
13
-
14
-/**
15
- * 获取验证码
16
- * @param {*} params
17
- * @returns
18
- */
19
-export const getCaptcha = (params) => request({
20
-  url: '/admin/captcha', params
21
-})

+ 0
- 9
src/api/user.js 파일 보기

@@ -1,9 +0,0 @@
1
-import request from '@/utils/request'
2
-
3
-export function login(data) {
4
-  return request({
5
-    url: '/admin/login',
6
-    method: 'post',
7
-    data
8
-  })
9
-}

+ 0
- 29
src/layout/components/Navbar.vue 파일 보기

@@ -3,31 +3,6 @@
3 3
     <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
4 4
 
5 5
     <breadcrumb class="breadcrumb-container" />
6
-
7
-    <div class="right-menu">
8
-      <el-dropdown class="avatar-container" trigger="click">
9
-        <div class="avatar-wrapper">
10
-          <img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar">
11
-          <i class="el-icon-caret-bottom" />
12
-        </div>
13
-        <el-dropdown-menu slot="dropdown" class="user-dropdown">
14
-          <router-link to="/">
15
-            <el-dropdown-item>
16
-              Home
17
-            </el-dropdown-item>
18
-          </router-link>
19
-          <a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/">
20
-            <el-dropdown-item>Github</el-dropdown-item>
21
-          </a>
22
-          <a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/">
23
-            <el-dropdown-item>Docs</el-dropdown-item>
24
-          </a>
25
-          <el-dropdown-item divided @click.native="logout">
26
-            <span style="display:block;">Log Out</span>
27
-          </el-dropdown-item>
28
-        </el-dropdown-menu>
29
-      </el-dropdown>
30
-    </div>
31 6
   </div>
32 7
 </template>
33 8
 
@@ -50,10 +25,6 @@ export default {
50 25
   methods: {
51 26
     toggleSideBar() {
52 27
       this.$store.dispatch('app/toggleSideBar')
53
-    },
54
-    async logout() {
55
-      await this.$store.dispatch('user/logout')
56
-      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
57 28
     }
58 29
   }
59 30
 }

+ 0
- 1
src/main.js 파일 보기

@@ -13,7 +13,6 @@ import store from './store'
13 13
 import router from './router'
14 14
 
15 15
 import '@/icons' // icon
16
-import '@/permission' // permission control
17 16
 
18 17
 /**
19 18
  * If you don't want to use mock-server

+ 0
- 60
src/permission.js 파일 보기

@@ -1,60 +0,0 @@
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
-})

+ 11
- 98
src/router/index.js 파일 보기

@@ -43,127 +43,40 @@ export const constantRoutes = [
43 43
     }]
44 44
   },
45 45
 
46
-  {
47
-    path: '/question',
48
-    component: Layout,
49
-    meta: { title: '测试题库管理', icon: 'form' },
50
-    children: [
51
-      {
52
-        path: 'question',
53
-        name: '题库列表',
54
-        component: () => import('@/views/question/index'),
55
-        meta: { title: '测试题库列表', icon: 'question' }
56
-      },
57
-      {
58
-        hidden: true,
59
-        path: 'question/deit',
60
-        name: 'questionEdit',
61
-        component: () => import('@/views/question/edit'),
62
-        meta: { title: '题目编辑', icon: 'question' }
63
-      }
64
-    ]
65
-  },
46
+  // 奖品管理
66 47
 
67 48
   {
68
-    path: '/gameManage',
69
-    component: Layout,
70
-    name: '游戏管理',
71
-    meta: { title: '游戏管理', icon: 'form' },
72
-    children: [
73
-      {
74
-        path: 'gameManage',
75
-        name: '游戏列表',
76
-        component: () => import('@/views/gameManage/index'),
77
-        meta: { title: '游戏列表', icon: 'game' }
78
-      },
79
-      {
80
-        hidden: true,
81
-        path: 'gameManage/edit',
82
-        name: 'gameEdit',
83
-        component: () => import('@/views/gameManage/edit'),
84
-        meta: { title: '编辑游戏', icon: 'form' }
85
-      }
86
-    ]
87
-  },
88
-  {
89
-    path: '/gamePerson',
49
+    path: '/Prize',
90 50
     component: Layout,
91
-    meta: { title: '游戏结果管理', icon: 'form' },
51
+    meta: { title: '奖品管理', icon: 'form' },
92 52
     children: [
93 53
       {
94
-        path: 'gamePerson',
54
+        path: 'Prize',
95 55
         name: '',
96
-        component: () => import('@/views/gamePerson/index'),
97
-        meta: { title: '游戏结果列表', icon: 'gamePerson' }
56
+        component: () => import('@/views/Prize/index'),
57
+        meta: { title: '奖品管理', icon: 'game' }
98 58
       }
99 59
     ]
100 60
   },
101
-
102
-  // 微信配置
103
-
104 61
   {
105
-    path: '/WeChatConfig',
62
+    path: '/Person',
106 63
     component: Layout,
107
-    meta: { title: '微信配置', icon: 'form' },
64
+    meta: { title: '中奖人员管理', icon: 'form' },
108 65
     children: [
109 66
       {
110
-        path: 'WeChatConfig',
111
-        name: 'WeChatConfig',
112
-        component: () => import('@/views/WeChatConfig/index'),
113
-        meta: { title: '微信配置', icon: 'wx' }
114
-      },
115
-      {
116
-        hidden: true,
117
-        path: 'WeChatConfig/Edit',
118
-        name: '配置编辑',
119
-        component: () => import('@/views/WeChatConfig/Edit'),
120
-        meta: { title: '配置编辑', icon: 'form' }
121
-      }
122
-    ]
123
-  },
124
-
125
-  // 应用管理
126
-
127
-  {
128
-    path: '/AppController',
129
-    component: Layout,
130
-    meta: { title: '应用管理', icon: 'form' },
131
-    children: [
132
-      {
133
-        path: 'AppController',
67
+        path: 'Person',
134 68
         name: '',
135
-        component: () => import('@/views/AppController/index'),
136
-        meta: { title: '应用管理', icon: 'appconfig' }
69
+        component: () => import('@/views/person/index'),
70
+        meta: { title: '中奖人员列表', icon: 'gamePerson' }
137 71
       }
138 72
     ]
139 73
   },
140 74
 
141
-  {
142
-    path: '/login',
143
-    component: () => import('@/views/login/index'),
144
-    hidden: true
145
-  },
146
-
147
-  {
148
-    path: '/login/register',
149
-    component: () => import('@/views/login/register'),
150
-    hidden: true,
151
-    name: 'register'
152
-  },
153
-
154
-  {
155
-    path: '/login/forgotPassword',
156
-    component: () => import('@/views/login/forgotPassword'),
157
-    hidden: true,
158
-    name: 'forgotPassword'
159
-  },
160
-
161 75
   {
162 76
     path: '/404',
163 77
     component: () => import('@/views/404'),
164 78
     hidden: true
165 79
   },
166
-
167 80
   {
168 81
     path: 'external-link',
169 82
     component: Layout,

+ 1
- 4
src/store/getters.js 파일 보기

@@ -1,8 +1,5 @@
1 1
 const getters = {
2 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
3
+  device: state => state.app.device
7 4
 }
8 5
 export default getters

+ 0
- 2
src/store/index.js 파일 보기

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

+ 0
- 67
src/store/modules/user.js 파일 보기

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

+ 0
- 25
src/utils/auth.js 파일 보기

@@ -1,25 +0,0 @@
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
-
14
-export function removeToken() {
15
-  return Cookies.remove(TokenKey)
16
-}
17
-
18
-const UserIdKey = 'user'
19
-
20
-export function setUserId(userId) {
21
-  return Cookies.set(UserIdKey, userId)
22
-}
23
-export function getUserId() {
24
-  return Cookies.get(UserIdKey)
25
-}

+ 1
- 3
src/utils/request.js 파일 보기

@@ -1,7 +1,6 @@
1 1
 import axios from 'axios'
2 2
 import { Message } from 'element-ui'
3 3
 import store from '@/store'
4
-import { getToken, getUserId } from '@/utils/auth'
5 4
 
6 5
 // create an axios instance
7 6
 const service = axios.create({
@@ -19,8 +18,7 @@ service.interceptors.request.use(
19 18
       // let each request carry token
20 19
       // ['X-Token'] is a custom headers key
21 20
       // please modify it according to the actual situation
22
-      config.headers['X-Authorization-JWT'] = getToken()
23
-      config.headers['x-userid'] = getUserId()
21
+  
24 22
     }
25 23
     return config
26 24
   },

+ 0
- 17
src/utils/upload.js 파일 보기

@@ -1,17 +0,0 @@
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
-}

+ 0
- 213
src/views/AppController/index.vue 파일 보기

@@ -1,213 +0,0 @@
1
-<template>
2
-  <div class="body">
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="dialogFormVisible = true"
10
-        >新建应用</el-button>
11
-      </div>
12
-      <div class="text item">
13
-        <el-table stripe :data="tableData" border style="width: 100%">
14
-          <el-table-column prop="appName" label="应用名称" min-width="100" />
15
-
16
-          <el-table-column align="center" label="操作" min-width="100" width="500">
17
-            <template slot-scope="scope">
18
-              <el-link
19
-                :underline="false"
20
-                style="margin-right:1em"
21
-                type="primary"
22
-                @click="handeldialog(scope.row.appId)"
23
-              >编辑</el-link>
24
-              <el-popconfirm
25
-                icon="el-icon-info"
26
-                icon-color="red"
27
-                title="确定要删除该配置吗?"
28
-                @onConfirm="handleDelete(scope.row.appId)"
29
-              >
30
-                <el-link slot="reference" type="danger" :underline="false">删除</el-link>
31
-              </el-popconfirm>
32
-            </template>
33
-          </el-table-column>
34
-        </el-table>
35
-        <el-pagination
36
-          v-show="WxTotal!==0"
37
-          style="float:right; margin:20px 0"
38
-          :total="WxTotal"
39
-          :current-page="currentPage"
40
-          :page-size="pageSize"
41
-          :page-sizes="[pageSize, 20, 35,40,50,80,100]"
42
-          layout="total, prev, pager, next, sizes"
43
-          @size-change="handleSizeChange"
44
-          @current-change="handleCurrentChange"
45
-        />
46
-      </div>
47
-    </el-card>
48
-    <el-dialog
49
-      :title="!APP_ID?'新建应用':'修改应用'"
50
-      :visible.sync="dialogFormVisible"
51
-      :show-close="false"
52
-      :close-on-click-modal="false"
53
-    >
54
-      <el-form
55
-        ref="ruleForm"
56
-        :model="ruleForm"
57
-        :rules="rules"
58
-        label-width="10vw"
59
-        class="demo-ruleForm"
60
-      >
61
-        <el-form-item label="应用名称" prop="appName" style="width:30vw">
62
-          <el-input v-model="ruleForm.appName" />
63
-        </el-form-item>
64
-      </el-form>
65
-      <div slot="footer" class="dialog-footer">
66
-        <el-button type="primary" @click="submitForm('ruleForm')">{{ !APP_ID?'新建应用':'修改应用' }}</el-button>
67
-
68
-        <el-button @click="closeDialog('ruleForm')">取 消</el-button>
69
-      </div>
70
-    </el-dialog>
71
-  </div>
72
-</template>
73
-<script>
74
-import {
75
-  getAppControllerList,
76
-  DeleteAppController,
77
-  saveAppController,
78
-  detailsAppController,
79
-  ChangeAppController
80
-} from '@/api/AppControllerApi'
81
-
82
-export default {
83
-  data() {
84
-    return {
85
-      APP_ID: '',
86
-      ruleForm: {
87
-        appName: '',
88
-        secret: ''
89
-      },
90
-      rules: {
91
-        appName: [
92
-          { required: true, message: '请输入应用名称', trigger: 'blur' }
93
-        ]
94
-      },
95
-      appName: undefined,
96
-      dialogFormVisible: false,
97
-      tableData: [],
98
-      //
99
-      pageSize: 10,
100
-      currentPage: 1,
101
-      WxTotal: 0 // 条目总数
102
-    }
103
-  },
104
-  // -----------模态框事件------------
105
-  watch: {
106
-    APP_ID: function (newAppID, oldVal) {
107
-      detailsAppController(newAppID).then((res) => {
108
-        this.ruleForm = res.data
109
-      })
110
-    }
111
-  },
112
-  mounted() {
113
-    this.onSearch()
114
-    if (this.APP_ID) {
115
-      detailsAppController(this.APP_ID).then((res) => {
116
-        this.ruleForm = res.data
117
-      })
118
-    }
119
-  },
120
-  methods: {
121
-    // 取消
122
-    closeDialog(formName) {
123
-      this.APP_ID = ''
124
-      this.$refs[formName].resetFields()
125
-
126
-      this.dialogFormVisible = false
127
-    },
128
-    // 确定
129
-    handeldialog(e) {
130
-      this.APP_ID = e
131
-      this.dialogFormVisible = true
132
-    },
133
-
134
-    submitForm(formName) {
135
-      this.$refs[formName].validate((valid) => {
136
-        if (valid) {
137
-          if (this.APP_ID == '') {
138
-            saveAppController(this.ruleForm)
139
-              .then((e) => {
140
-                this.$message.success('配置保存成功')
141
-                this.dialogFormVisible = false
142
-                this.$refs[formName].resetFields()
143
-                this.onSearch()
144
-
145
-                console.log('保存字段', e)
146
-              })
147
-              .catch((e) => {
148
-                this.$message.error('保存失败', e)
149
-              })
150
-          } else {
151
-            ChangeAppController(this.ruleForm, this.APP_ID).then((res) => {
152
-              this.$message.success('配置修改成功')
153
-              this.dialogFormVisible = false
154
-              this.onSearch()
155
-            })
156
-          }
157
-        } else {
158
-          return false
159
-        }
160
-      })
161
-    },
162
-
163
-    // -----------模态框事件结束------------
164
-
165
-    // 改变每页显示条数
166
-    handleSizeChange(val) {
167
-      this.pageSize = val
168
-      this.changePagination()
169
-    },
170
-    // 改变页码
171
-    handleCurrentChange(val) {
172
-      this.currentPage = val
173
-      this.changePagination()
174
-    },
175
-    // 改变分页组件重新查询数据
176
-    changePagination() {
177
-      getAppControllerList({
178
-        pageNum: this.currentPage,
179
-        pageSize: this.pageSize
180
-      }).then((res) => {
181
-        this.tableData = res.data.records
182
-      })
183
-    },
184
-
185
-    handleAdd() {
186
-      // this.$router.push({ path: 'AppController/Edit' });
187
-      this.dialogFormVisible = true
188
-    },
189
-
190
-    handleDelete(APP_DELETE) {
191
-      DeleteAppController(APP_DELETE).then(() => {
192
-        this.onSearch()
193
-      })
194
-    },
195
-    onSearch() {
196
-      getAppControllerList({
197
-        pageNum: this.currentPage,
198
-        pageSize: this.pageSize
199
-      }).then((res) => {
200
-        console.log('🚀 ~ file: index.vue ~ line 118 ~ onSearch ~ res', res)
201
-        this.tableData = res.data.records
202
-        this.WxTotal = res.data.total
203
-      })
204
-    },
205
-    onReset() {
206
-      this.appName = ''
207
-
208
-      this.onSearch()
209
-    }
210
-  }
211
-}
212
-</script>
213
-

+ 80
- 0
src/views/Prize/index.vue 파일 보기

@@ -0,0 +1,80 @@
1
+<template>
2
+  <div class="body" style="font-size:14px">
3
+    <el-table stripe :data="tableData" border style="width: 100%">
4
+      <el-table-column prop="name" label="名称" />
5
+      <el-table-column prop="thumb" label="游戏图标">
6
+        <template slot-scope="scope">
7
+          <el-image :src="scope.row.gameImage" style="width: 100px; height: 100px" />
8
+        </template>
9
+      </el-table-column>
10
+      <el-table-column prop="totalNum" label="库存" />
11
+      <el-table-column prop="exitsNum" label="库存" />
12
+      <el-table-column prop="sortNo" label="序号" />
13
+      <el-table-column prop="rate" label="中奖率">
14
+        <template slot-scope="scope">
15
+          {{ scope.row.rate }}%
16
+        </template>
17
+      </el-table-column>
18
+    </el-table>
19
+    <el-pagination
20
+      v-show="gameTotal!==0"
21
+      style="float:right; margin:20px 0"
22
+      :total="gameTotal"
23
+      :current-page="currentPage"
24
+      :page-sizes="[4, 10, 20, 50]"
25
+      :page-size="pageSize"
26
+      layout="total, prev, pager, next, sizes"
27
+      @size-change="handleSizeChange"
28
+      @current-change="handleCurrentChange"
29
+    />
30
+  </div>
31
+</template>
32
+<script>
33
+import { getPrizeList } from '@/api/prize'
34
+
35
+export default {
36
+  data() {
37
+    return {
38
+      tableData: [],
39
+      pageSize: 10,
40
+      currentPage: 1,
41
+      gameTotal: 0 // 条目总数
42
+    }
43
+  },
44
+  mounted() {
45
+    this.onSearch()
46
+  },
47
+  methods: {
48
+    // 改变每页显示条数
49
+    handleSizeChange(val) {
50
+      this.pageSize = val
51
+      this.changePagination()
52
+    },
53
+    // 改变页码
54
+    handleCurrentChange(val) {
55
+      this.currentPage = val
56
+      this.changePagination()
57
+    },
58
+    // 改变分页组件重新查询数据
59
+    changePagination() {
60
+      getPrizeList({
61
+        pageNum: this.currentPage,
62
+        pageSize: this.pageSize
63
+      }).then((res) => {
64
+        this.tableData = res.data.records
65
+      })
66
+    },
67
+    onSearch() {
68
+      getPrizeList({
69
+        pageSize: this.pageSize
70
+      }).then((res) => {
71
+        this.tableData = res.data.records
72
+        this.gameTotal = res.data.total
73
+        this.pageSize = res.data.size
74
+      })
75
+    }
76
+  }
77
+}
78
+</script>
79
+<style>
80
+</style>

+ 0
- 194
src/views/WeChatConfig/Edit.vue 파일 보기

@@ -1,194 +0,0 @@
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-input v-model="ruleForm.appName" />
15
-            </el-form-item>
16
-            <el-form-item label="二维码" prop="qrCode">
17
-              <img
18
-                width="150"
19
-                alt="二维码"
20
-                src="https://cdn4.buysellads.net/uu/1/41334/1550855401-cc_light.png"
21
-              />
22
-            </el-form-item>
23
-            <el-form-item label="类型" prop="appType">
24
-              <el-select v-model="ruleForm.appType" placeholder="请选择类型">
25
-                <el-option label="小程序" value="ma" />
26
-                <el-option label="公众号" value="md" />
27
-              </el-select>
28
-            </el-form-item>
29
-            <el-form-item style="width:30vw" label="AppID" prop="appid">
30
-              <el-input v-model="ruleForm.appid" />
31
-            </el-form-item>
32
-            <el-form-item style="width:30vw" label="Secret" prop="secret">
33
-              <el-input v-model="ruleForm.secret" />
34
-            </el-form-item>
35
-            <el-form-item style="width:30vw" label="Token" prop="token">
36
-              <el-input v-model="ruleForm.token" />
37
-            </el-form-item>
38
-            <el-form-item style="width:30vw" label="AesKey" prop="aesKey">
39
-              <el-input v-model="ruleForm.aesKey" />
40
-            </el-form-item>
41
-            <el-form-item style="width:30vw" label="消息格式类型" prop="msgDataFormat">
42
-              <el-input v-model="ruleForm.msgDataFormat" />
43
-            </el-form-item>
44
-            <el-form-item style="width:30vw" label="接口代理地址" prop="httpPoxyHost">
45
-              <el-input v-model="ruleForm.httpPoxyHost" />
46
-            </el-form-item>
47
-            <el-form-item style="width:30vw" label="接口代理端口" prop="httpProxyPort">
48
-              <el-input v-model="ruleForm.httpProxyPort" type="Number" />
49
-            </el-form-item>
50
-            <el-form-item style="width:30vw" label="第三方接口地址" prop="apiUrl">
51
-              <el-input v-model="ruleForm.apiUrl" />
52
-            </el-form-item>
53
-            <el-form-item label="发布状态" prop="status">
54
-              <el-select v-model="ruleForm.status" placeholder="请选择状态">
55
-                <el-option label="发布" :value="1" />
56
-                <el-option label="未发布" :value="0" />
57
-              </el-select>
58
-            </el-form-item>
59
-
60
-            <el-form-item>
61
-              <el-button
62
-                type="primary"
63
-                @click="submitForm('ruleForm')"
64
-              >{{ !configId?'新建配置':'修改配置' }}</el-button>
65
-              <!-- <el-button type="primary" @click="submitForm('ruleForm')">应用配置</el-button> -->
66
-              <el-button @click="resetForm('ruleForm')">重置</el-button>
67
-            </el-form-item>
68
-          </el-form>
69
-        </el-col>
70
-      </el-row>
71
-    </el-card>
72
-  </div>
73
-</template>
74
-
75
-<script>
76
-import { saveConfig, detailsConfig, ChangeConfig } from '@/api/WeChatApi'
77
-
78
-export default {
79
-  data() {
80
-    return {
81
-      configId: '',
82
-      ruleForm: {
83
-        appName: '',
84
-        appid: '',
85
-        appType: '',
86
-        aesKey: '',
87
-        apiUrl: '',
88
-        resource: '',
89
-        httpPoxyHost: '',
90
-        msgDataFormat: 'Json',
91
-        secret: '',
92
-        token: '',
93
-        httpProxyPort: null,
94
-        status: null
95
-      },
96
-      rules: {
97
-        appName: [
98
-          { required: true, message: '请输入配置名称', trigger: 'blur' }
99
-        ],
100
-        appid: [{ required: true, message: '请输入AppID', trigger: 'blur' }],
101
-        appType: [{ required: true, message: '请选择类型', trigger: 'blur' }],
102
-        aesKey: [{ required: true, message: '请选择AesKey', trigger: 'blur' }],
103
-        apiUrl: [
104
-          { required: true, message: '请选择第三方接口地址', trigger: 'blur' }
105
-        ],
106
-        httpPoxyHost: [
107
-          { required: true, message: '请输入接口代理地址', trigger: 'blur' }
108
-        ],
109
-        httpProxyPort: [
110
-          { required: true, message: '请输入接口代理端口', trigger: 'blur' }
111
-        ],
112
-        msgDataFormat: [
113
-          { required: true, message: '请输入消息格式类型', trigger: 'blur' }
114
-        ],
115
-        secret: [{ required: true, message: '请输入Secret', trigger: 'blur' }],
116
-        token: [{ required: true, message: '请输入Token', trigger: 'blur' }],
117
-
118
-        status: [{ required: true, message: '请选择状态', trigger: 'blur' }]
119
-      }
120
-    }
121
-  },
122
-
123
-  watch: {
124
-    configId: function (val, oldVal) {
125
-      if (val) {
126
-        this.configId = val
127
-        detailsConfig(val)
128
-          .then((res) => {
129
-            this.ruleForm = res.data
130
-          })
131
-          .catch((e) => {
132
-            this.$message.error('ID有误。')
133
-            this.$router.go(-1)
134
-          })
135
-      }
136
-    }
137
-  },
138
-  mounted() {
139
-    if (this.$route?.query.configId) {
140
-      this.configId = this.$route.query.configId
141
-      detailsConfig(this.configId)
142
-        .then((res) => {
143
-          this.ruleForm = res.data
144
-        })
145
-        .catch((e) => {
146
-          this.$message.error('ID有误。')
147
-          this.$router.go(-1)
148
-        })
149
-    }
150
-  },
151
-  methods: {
152
-    submitForm(formName) {
153
-      this.$refs[formName].validate((valid) => {
154
-        if (valid) {
155
-          if (this.configId === '') {
156
-            saveConfig(this.ruleForm)
157
-              .then((e) => {
158
-                this.$message.success('配置保存成功')
159
-                this.$router.go(-1)
160
-                console.log('保存字段', e)
161
-              })
162
-              .catch((e) => {
163
-                this.$message.error('保存失败', e)
164
-              })
165
-          } else {
166
-            ChangeConfig(this.ruleForm, this.configId)
167
-              .then((res) => {
168
-                this.$message.success('配置修改成功')
169
-                this.$router.go(-1)
170
-              })
171
-              .catch((e) => {
172
-                console.log(e)
173
-              })
174
-          }
175
-        } else {
176
-          return false
177
-        }
178
-      })
179
-    },
180
-    resetForm(formName) {
181
-      this.$refs[formName].resetFields()
182
-    }
183
-  }
184
-}
185
-</script>
186
-
187
-<style scoped >
188
-.demo-ruleForm {
189
-  margin-top: 1em;
190
-}
191
-</style>
192
-
193
-<style lang="scss" scoped>
194
-</style>

+ 0
- 145
src/views/WeChatConfig/index.vue 파일 보기

@@ -1,145 +0,0 @@
1
-<template>
2
-  <div class="body">
3
-    <el-card class="box-card" shadow="never">
4
-      <div slot="header" class="clearfix">
5
-        <el-button type="primary" style="float: right" icon="el-icon-plus" @click="handleAdd">新建配置</el-button>
6
-      </div>
7
-      <div class="text item">
8
-        <el-table stripe :data="tableData" border style="width: 100%">
9
-          <el-table-column prop="appName" label="配置名称" />
10
-
11
-          <el-table-column prop="picture" label="二维码" align="center">
12
-            <template slot-scope="scope">
13
-              <!-- :src="scope.row.qrCode" -->
14
-              <el-popover placement="right" trigger="hover" style="cursor: pointer;">
15
-                <el-image
16
-                  slot="reference"
17
-                  src="https://cdn4.buysellads.net/uu/1/41334/1550855401-cc_light.png"
18
-                  alt="scope.row.image_url"
19
-                  style="max-height: 110px;max-width: 110px"
20
-                />
21
-                <el-image src="https://cdn4.buysellads.net/uu/1/41334/1550855401-cc_light.png" />
22
-              </el-popover>
23
-
24
-              <!-- <img
25
-                src="https://cdn4.buysellads.net/uu/1/41334/1550855401-cc_light.png"
26
-                min-width="70"
27
-                height="80"
28
-              />-->
29
-            </template>
30
-          </el-table-column>
31
-
32
-          <el-table-column prop="createDate" label="状态" align="center" width="200">
33
-            <template slot-scope="scope">
34
-              <el-tag
35
-                :type="scope.row.status==1?'success':'danger'"
36
-                size="small "
37
-                effect="dark"
38
-              >{{ scope.row.status==1?'发布':'未发布' }}</el-tag>
39
-            </template>
40
-          </el-table-column>
41
-          <el-table-column align="center" label="操作" min-width="100" width="280">
42
-            <template slot-scope="scope">
43
-              <el-link :underline="false" style="margin-right:1em" type="primary">
44
-                <router-link
45
-                  :to="{path:'WeChatConfig/Edit',query: { configId: scope.row.configId }}"
46
-                >编辑</router-link>
47
-              </el-link>
48
-              <el-popconfirm
49
-                icon="el-icon-info"
50
-                icon-color="red"
51
-                title="确定要删除该配置吗?"
52
-                @onConfirm="handleDelete(scope.row)"
53
-              >
54
-                <el-link slot="reference" :underline="false" type="danger">删除</el-link>
55
-              </el-popconfirm>
56
-            </template>
57
-          </el-table-column>
58
-        </el-table>
59
-        <el-pagination
60
-          v-show="WxTotal!==0"
61
-          style="float:right; margin:20px 0"
62
-          :total="WxTotal"
63
-          :current-page="currentPage"
64
-          :page-size="pageSize"
65
-          :page-sizes="[pageSize, 20, 35,40,50,80,100]"
66
-          layout="total, prev, pager, next, sizes"
67
-          @size-change="handleSizeChange"
68
-          @current-change="handleCurrentChange"
69
-        />
70
-      </div>
71
-    </el-card>
72
-  </div>
73
-</template>
74
-<script>
75
-import { getConfigList, DeleteConfig } from '@/api/WeChatApi'
76
-
77
-export default {
78
-  data() {
79
-    return {
80
-      appName: undefined,
81
-      daterange: '',
82
-      tableData: [],
83
-      endDate: undefined,
84
-      startDate: undefined,
85
-      //
86
-      pageSize: 10,
87
-      currentPage: 1,
88
-      WxTotal: 0 // 条目总数
89
-    }
90
-  },
91
-  mounted() {
92
-    this.onSearch()
93
-  },
94
-  methods: {
95
-    // 改变每页显示条数
96
-    handleSizeChange(val) {
97
-      this.pageSize = val
98
-      this.changePagination()
99
-    },
100
-    // 改变页码
101
-    handleCurrentChange(val) {
102
-      this.currentPage = val
103
-      this.changePagination()
104
-    },
105
-    // 改变分页组件重新查询数据
106
-    changePagination() {
107
-      getConfigList({
108
-        // title: this.title,
109
-        // startDate: this.startDate,
110
-        // endDate: this.endDate,
111
-        pageNum: this.currentPage,
112
-        pageSize: this.pageSize
113
-      }).then((res) => {
114
-        this.tableData = res.data.records
115
-      })
116
-    },
117
-
118
-    handleAdd() {
119
-      this.$router.push({ path: 'WeChatConfig/Edit' })
120
-    },
121
-
122
-    handleDelete(row) {
123
-      DeleteConfig(row.configId).then(() => {
124
-        this.onSearch()
125
-      })
126
-    },
127
-    onSearch() {
128
-      getConfigList({
129
-        pageNum: this.currentPage,
130
-        pageSize: this.pageSize
131
-      }).then((res) => {
132
-        this.tableData = res.data.records
133
-        this.WxTotal = res.data.total
134
-      })
135
-    },
136
-    onReset() {
137
-      this.appName = ''
138
-
139
-      this.onSearch()
140
-    }
141
-  }
142
-}
143
-</script>
144
-<style lang="scss" scoped>
145
-</style>

+ 0
- 207
src/views/gameManage/edit.vue 파일 보기

@@ -1,207 +0,0 @@
1
-<template>
2
-  <div class="body_edit">
3
-    <el-tabs v-model="activeName">
4
-      <el-tab-pane label="游戏详情" name="game">
5
-        <el-form ref="form" :rules="rules" class="gameForm" :model="gameForm" label-width="100px">
6
-          <el-form-item label="游戏名称:" prop="title">
7
-            <el-input v-model="gameForm.title" />
8
-          </el-form-item>
9
-          <el-form-item label="游戏图标:">
10
-            <UploadImage
11
-              :icon="gameForm.gameImage"
12
-              @handleChange="handleChange"
13
-              @handleDeleteIcon="handleDeleteIcon"
14
-            />
15
-          </el-form-item>
16
-          <el-form-item label="游戏类型:" prop="resultMode">
17
-            <el-select
18
-              v-model="gameForm.resultMode"
19
-              filterable
20
-              style="width:100%"
21
-              default-first-option
22
-              placeholder="请选择"
23
-              :disabled="gameId ? true : false"
24
-            >
25
-              <el-option
26
-                v-for="item in resultList"
27
-                :key="item.value"
28
-                :label="item.label"
29
-                :value="item.value"
30
-              />
31
-            </el-select>
32
-          </el-form-item>
33
-          <el-form-item class="editBottomItem">
34
-            <el-button type="primary" @click="onSubmit('form')">保存</el-button>
35
-            <el-button @click="onCancel">取消</el-button>
36
-          </el-form-item>
37
-        </el-form>
38
-      </el-tab-pane>
39
-      <el-tab-pane v-if="gameForm.resultMode!=='examination'" label="关联特征" name="game-character" :disabled="gameId ? false : true">
40
-        <el-row :gutter="20" style="padding-top: 20px">
41
-          <el-col :span="12">
42
-            <GameCharacter
43
-              ref="GameCharacter"
44
-              :gameId="gameId"
45
-              @handleAddGameCharacter="characterId = undefined"
46
-              @handleCloseGameCharacter="characterId = undefined"
47
-              @handleEditGameCharacter="handleEditGameCharacter"
48
-            />
49
-          </el-col>
50
-          <el-col :span="12">
51
-            <GameCharacterEdit
52
-              :characterId="characterId"
53
-              :gameId="gameId"
54
-              @handleRefreshGameCharacter="handleRefreshGameCharacter"
55
-              @handleEditGameCharacter="handleEditGameCharacter"
56
-            />
57
-          </el-col>
58
-        </el-row>
59
-      </el-tab-pane>
60
-      <el-tab-pane label="游戏题库" name="question" :disabled="gameId ? false : true">
61
-        <el-row :gutter="20" style="padding-top: 20px">
62
-          <el-col :span="12">
63
-            <Question
64
-              ref="Question"
65
-              :gameId="gameId"
66
-              :resultMode="gameForm.resultMode"
67
-              @handleAddQuestion="gameQuestionMapId = 0"
68
-              @handleCloseQuestion="gameQuestionMapId = 0"
69
-              @handleEditQuestion="handleEditQuestion"
70
-            />
71
-          </el-col>
72
-          <el-col :span="12">
73
-            <QuestionEdit
74
-              :gameQuestionMapId="gameQuestionMapId"
75
-              :gameId="gameId"
76
-              :resultMode="gameForm.resultMode"
77
-              @handleRefreshQuestion="handleRefreshQuestion"
78
-              @handleEditQuestion="handleEditQuestion"
79
-            />
80
-          </el-col>
81
-        </el-row>
82
-      </el-tab-pane>
83
-    </el-tabs>
84
-  </div>
85
-</template>
86
-<script>
87
-import { saveGame, UpdateGame, getGameDetail } from '@/api/game'
88
-import UploadImage from '@/components/UploadImage/index.vue'
89
-import GameCharacter from '@/components/GameCharacter/index.vue'
90
-import GameCharacterEdit from '@/components/GameCharacter/edit.vue'
91
-import Question from '@/components/Question/index.vue'
92
-import QuestionEdit from '@/components/Question/edit.vue'
93
-export default {
94
-  components: {
95
-    UploadImage,
96
-    GameCharacter,
97
-    GameCharacterEdit,
98
-    Question,
99
-    QuestionEdit
100
-  },
101
-  data() {
102
-    return {
103
-      rules: {
104
-        title: [{ required: true, message: '请输入游戏名称', trigger: 'blur' }],
105
-        resultMode: [
106
-          { required: true, message: '请选择游戏类型', trigger: 'blur' }
107
-        ]
108
-      },
109
-      gameForm: {
110
-        title: undefined,
111
-        gameImage: undefined,
112
-        resultMode: undefined,
113
-        status: 1
114
-      },
115
-      resultList: [
116
-        {
117
-          value: 'examination',
118
-          label: '测试'
119
-        },
120
-        {
121
-          value: 'character_matched',
122
-          label: '匹配'
123
-        }
124
-      ],
125
-      gameId: undefined,
126
-      activeName: 'game',
127
-      gameQuestionMapId: 0,
128
-      characterId: undefined
129
-    }
130
-  },
131
-  watch: {
132
-    '$route.query.id': {
133
-      handler(val) {
134
-        if (val) {
135
-          // 有值代表是编辑状态 查询详情  没有值就是新增
136
-          this.gameId = val
137
-          getGameDetail(val).then((res) => {
138
-            this.gameForm = res.data
139
-          })
140
-        }
141
-      },
142
-      immediate: true // 页面加载时就启动
143
-    }
144
-  },
145
-  methods: {
146
-    onCancel() {
147
-      this.$router.go(-1)
148
-    },
149
-    onSubmit(form) {
150
-      this.$refs[form].validate((valid) => {
151
-        if (valid) {
152
-          if (this.gameId) {
153
-            const data = { ...this.gameForm }
154
-            if (!data.gameImage) {
155
-              data.gameImage = ''
156
-            }
157
-            UpdateGame(data, this.gameId).then((res) => {
158
-              this.$message('修改成功')
159
-              this.$router.go(-1)
160
-            })
161
-          } else {
162
-            saveGame(this.gameForm).then((res) => {
163
-              this.$message('保存成功')
164
-              this.$router.replace({
165
-                name: 'gameEdit',
166
-                query: { id: res.data.gameId }
167
-              })
168
-            })
169
-          }
170
-        } else {
171
-          return false
172
-        }
173
-      })
174
-    },
175
-    handleChange(val) {
176
-      this.gameForm.gameImage = val
177
-    },
178
-    handleDeleteIcon() {
179
-      this.gameForm.gameImage = ''
180
-    },
181
-
182
-    // 特征页面方法
183
-    // 改变编辑特征页面的初始值
184
-    handleEditGameCharacter(val) {
185
-      this.characterId = val
186
-    },
187
-    handleRefreshGameCharacter() {
188
-      this.$refs.GameCharacter.onSearch()
189
-    },
190
-    handleEditQuestion(val) {
191
-      this.gameQuestionMapId = val
192
-    },
193
-    handleRefreshQuestion() {
194
-      this.$refs.Question.onSearch()
195
-    }
196
-  }
197
-}
198
-</script>
199
-<style scoped>
200
-.gameForm {
201
-  width: 700px;
202
-}
203
-.editBottomItem > div {
204
-  margin: 0 !important;
205
-  text-align: center;
206
-}
207
-</style>

+ 0
- 147
src/views/gameManage/index.vue 파일 보기

@@ -1,147 +0,0 @@
1
-<template>
2
-  <div class="body" style="font-size:14px">
3
-    <el-card class="box-card" shadow="never">
4
-      游戏名称:
5
-      <el-input v-model="title" style="width: 200px; margin-right: 20px" />测试时间:
6
-      <el-date-picker
7
-        v-model="daterange"
8
-        type="daterange"
9
-        range-separator="至"
10
-        start-placeholder="开始日期"
11
-        end-placeholder="结束日期"
12
-        value-format="yyyy-MM-dd"
13
-        style="margin-right: 20px"
14
-        @change="dateChange"
15
-      />
16
-      <div style="float:right">
17
-        <el-button type="primary" @click="onSearch">查询</el-button>
18
-        <el-button @click="onReset">重置</el-button>
19
-        <el-button type="primary" icon="el-icon-plus" @click="handleAdd">添加游戏</el-button>
20
-      </div>
21
-    </el-card>
22
-    <el-table stripe :data="tableData" border style="width: 100%">
23
-      <el-table-column prop="title" label="游戏名称" />
24
-      <el-table-column prop="gameImage" label="游戏图标">
25
-        <template slot-scope="scope">
26
-          <el-image :src="scope.row.gameImage" style="width: 100px; height: 100px" />
27
-        </template>
28
-      </el-table-column>
29
-      <el-table-column prop="createDate" label="创建时间">
30
-        <template slot-scope="scope">
31
-          {{
32
-            scope.row.createDate.substr(0, 10)
33
-          }}
34
-        </template>
35
-      </el-table-column>
36
-      <el-table-column fixed="right" label="操作">
37
-        <template slot-scope="scope">
38
-          <el-link :underline="false" style="margin-right:1em" type="primary">
39
-            <router-link
40
-              :to="{name: 'gameEdit', query: { id: scope.row.gameId }}"
41
-            >编辑</router-link>
42
-          </el-link>
43
-          <el-popconfirm
44
-            icon="el-icon-info"
45
-            icon-color="red"
46
-            title="确定删除这个游戏吗?"
47
-            @onConfirm="handleDelete(scope.row)"
48
-          >
49
-            <el-button slot="reference" type="text" style="color:red">删除</el-button>
50
-          </el-popconfirm>
51
-        </template>
52
-      </el-table-column>
53
-    </el-table>
54
-    <el-pagination
55
-      v-show="gameTotal!==0"
56
-      style="float:right; margin:20px 0"
57
-      :total="gameTotal"
58
-      :current-page="currentPage"
59
-      :page-sizes="[4, 10, 20, 50]"
60
-      :page-size="pageSize"
61
-      layout="total, prev, pager, next, sizes"
62
-      @size-change="handleSizeChange"
63
-      @current-change="handleCurrentChange"
64
-    />
65
-  </div>
66
-</template>
67
-<script>
68
-import { getGameList, deleteGame } from '@/api/game'
69
-
70
-export default {
71
-  data() {
72
-    return {
73
-      title: undefined,
74
-      daterange: undefined,
75
-      tableData: [],
76
-      endDate: undefined,
77
-      startDate: undefined,
78
-      //
79
-      pageSize: 10,
80
-      currentPage: 1,
81
-      gameTotal: 0 // 条目总数
82
-    }
83
-  },
84
-  mounted() {
85
-    this.onSearch()
86
-  },
87
-  methods: {
88
-    // 改变每页显示条数
89
-    handleSizeChange(val) {
90
-      this.pageSize = val
91
-      this.changePagination()
92
-    },
93
-    // 改变页码
94
-    handleCurrentChange(val) {
95
-      this.currentPage = val
96
-      this.changePagination()
97
-    },
98
-    // 改变分页组件重新查询数据
99
-    changePagination() {
100
-      getGameList({
101
-        title: this.title,
102
-        startDate: this.startDate,
103
-        endDate: this.endDate,
104
-        pageNum: this.currentPage,
105
-        pageSize: this.pageSize
106
-      }).then((res) => {
107
-        this.tableData = res.data.records
108
-      })
109
-    },
110
-    handleAdd() {
111
-      this.$router.push({ name: 'gameEdit' })
112
-    },
113
-    handleDelete(row) {
114
-      deleteGame(row.gameId).then(() => {
115
-        this.onSearch()
116
-      })
117
-    },
118
-    onSearch() {
119
-      getGameList({
120
-        title: this.title,
121
-        startDate: this.startDate,
122
-        endDate: this.endDate,
123
-        pageSize: this.pageSize
124
-      }).then((res) => {
125
-        this.tableData = res.data.records
126
-        this.gameTotal = res.data.total
127
-        this.pageSize = res.data.size
128
-      })
129
-    },
130
-    onReset() {
131
-      this.title = undefined
132
-      this.daterange = undefined
133
-      this.startDate = undefined
134
-      this.endDate = undefined
135
-      this.currentPage = 1
136
-      this.pageSize = 10
137
-      this.onSearch()
138
-    },
139
-    dateChange(val) {
140
-      this.startDate = this.daterange[0]
141
-      this.endDate = this.daterange[1]
142
-    }
143
-  }
144
-}
145
-</script>
146
-<style>
147
-</style>

+ 0
- 146
src/views/gamePerson/index.vue 파일 보기

@@ -1,146 +0,0 @@
1
-<template>
2
-  <div class="body" style="font-size:14px">
3
-    <el-card class="box-card" shadow="never">
4
-      游戏名称:
5
-      <el-input v-model="gameTitle" style="width: 200px; margin-right: 20px" />
6
-      用户昵称:
7
-      <el-input v-model="nickName" style="width: 200px; margin-right: 20px" />
8
-      手机号:
9
-      <el-input v-model="phone" style="width: 200px; margin-right: 20px" />
10
-      创建时间:
11
-      <el-date-picker
12
-        v-model="daterange"
13
-        type="daterange"
14
-        range-separator="至"
15
-        start-placeholder="开始日期"
16
-        end-placeholder="结束日期"
17
-        value-format="yyyy-MM-dd"
18
-        style="margin-right: 20px"
19
-        @change="dateChange"
20
-      />
21
-      <div style="float:right">
22
-        <el-button type="primary" @click="onSearch">查询</el-button>
23
-        <el-button @click="onReset">重置</el-button>
24
-      </div>
25
-    </el-card>
26
-    <el-table stripe :data="tableData" border style="width: 100%">
27
-      <el-table-column prop="gameTitle" label="游戏名称" />
28
-      <el-table-column prop="resultMode" label="游戏类型">
29
-        <template slot-scope="scope">
30
-          {{
31
-            scope.row.resultMode=='examination'?'测试':'匹配'
32
-          }}
33
-        </template>
34
-      </el-table-column>
35
-      <el-table-column prop="nickName" label="用户昵称" />
36
-      <el-table-column prop="avatar" label="用户头像">
37
-        <template slot-scope="scope">
38
-          <el-image :src="scope.row.avatar" style="width: 100px; height: 100px" />
39
-        </template>
40
-      </el-table-column>
41
-      <el-table-column prop="phone" label="手机号" />
42
-      <el-table-column prop="score" label="答题分数" />
43
-      <el-table-column prop="characterName" label="实例结果" />
44
-      <el-table-column prop="createDate" label="参与时间">
45
-        <template slot-scope="scope">
46
-          {{
47
-            scope.row.createDate.substr(0, 10)
48
-          }}
49
-        </template>
50
-      </el-table-column>
51
-    </el-table>
52
-    <el-pagination
53
-      v-show="gameTotal!==0"
54
-      style="float:right; margin:20px 0"
55
-      :total="gameTotal"
56
-      :current-page="currentPage"
57
-      :page-sizes="[4, 10, 20, 50]"
58
-      :page-size="pageSize"
59
-      layout="total, prev, pager, next, sizes"
60
-      @size-change="handleSizeChange"
61
-      @current-change="handleCurrentChange"
62
-    />
63
-  </div>
64
-</template>
65
-<script>
66
-import { getGamePersonList } from '@/api/gamePerson'
67
-
68
-export default {
69
-  data() {
70
-    return {
71
-      characterId: undefined,
72
-      gameTitle: undefined,
73
-      nickName: undefined,
74
-      phone: undefined,
75
-      daterange: undefined,
76
-      tableData: [],
77
-      endDate: undefined,
78
-      startDate: undefined,
79
-      //
80
-      pageSize: 10,
81
-      currentPage: 1,
82
-      gameTotal: 0 // 条目总数
83
-    }
84
-  },
85
-  mounted() {
86
-    this.onSearch()
87
-  },
88
-  methods: {
89
-    // 改变每页显示条数
90
-    handleSizeChange(val) {
91
-      this.pageSize = val
92
-      this.changePagination()
93
-    },
94
-    // 改变页码
95
-    handleCurrentChange(val) {
96
-      this.currentPage = val
97
-      this.changePagination()
98
-    },
99
-    // 改变分页组件重新查询数据
100
-    changePagination() {
101
-      getGamePersonList({
102
-        gameTitle: this.gameTitle,
103
-        nickName: this.nickName,
104
-        phone: this.phone,
105
-        startDate: this.startDate,
106
-        endDate: this.endDate,
107
-        pageNum: this.currentPage,
108
-        pageSize: this.pageSize
109
-      }).then((res) => {
110
-        this.tableData = res.data.records
111
-      })
112
-    },
113
-    onSearch() {
114
-      getGamePersonList({
115
-        gameTitle: this.gameTitle,
116
-        nickName: this.nickName,
117
-        phone: this.phone,
118
-        startDate: this.startDate,
119
-        endDate: this.endDate,
120
-        pageSize: this.pageSize
121
-      }).then((res) => {
122
-        this.tableData = res.data.records
123
-        this.gameTotal = res.data.total
124
-        this.pageSize = res.data.size
125
-      })
126
-    },
127
-    onReset() {
128
-      this.gameTitle = undefined
129
-      this.nickName = undefined
130
-      this.phone = undefined
131
-      this.daterange = undefined
132
-      this.startDate = undefined
133
-      this.endDate = undefined
134
-      this.currentPage = 1
135
-      this.pageSize = 10
136
-      this.onSearch()
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>

+ 0
- 261
src/views/login/forgotPassword.vue 파일 보기

@@ -1,261 +0,0 @@
1
-<template>
2
-  <div class="login-container">
3
-    <el-form
4
-      ref="regisiterForm"
5
-      :model="regisiterForm"
6
-      :rules="regisiterRules"
7
-      class="login-form"
8
-      auto-complete="on"
9
-      label-position="left"
10
-    >
11
-      <div class="title-container">
12
-        <h3 class="title">找回密码</h3>
13
-      </div>
14
-
15
-      <el-form-item prop="phone">
16
-        <span class="svg-container">
17
-          <svg-icon icon-class="password" />
18
-        </span>
19
-        <el-input
20
-          ref="phone"
21
-          v-model="regisiterForm.phone"
22
-          type="tel"
23
-          placeholder="手机号"
24
-          name="phone"
25
-          tabindex="1"
26
-        />
27
-      </el-form-item>
28
-
29
-      <el-form-item prop="captcha" style="width:65%">
30
-        <span class="svg-container">
31
-          <svg-icon icon-class="password" />
32
-        </span>
33
-        <el-input
34
-          ref="captcha"
35
-          v-model="regisiterForm.captcha"
36
-          type="text"
37
-          placeholder="验证码"
38
-          tabindex="2"
39
-          name="captcha"
40
-        />
41
-        <el-button style="position: absolute;right: -150px;top: 6px;" :disabled="disabled" @click="sendCode">{{ btnText }}</el-button>
42
-      </el-form-item>
43
-      <el-form-item prop="password">
44
-        <span class="svg-container">
45
-          <svg-icon icon-class="password" />
46
-        </span>
47
-        <el-input
48
-          ref="password"
49
-          v-model="regisiterForm.password"
50
-          type="text"
51
-          placeholder="密码"
52
-          name="password"
53
-          tabindex="3"
54
-          @keyup.enter.native="handleLogin"
55
-        />
56
-      </el-form-item>
57
-      <el-button
58
-        :loading="loading"
59
-        type="primary"
60
-        style="width: 100%; margin-bottom: 30px"
61
-        @click.native.prevent="handleLogin"
62
-      >找回密码</el-button>
63
-    </el-form>
64
-  </div>
65
-</template>
66
-<script>
67
-import { getCaptcha, signUp } from '@/api/signup'
68
-import md5 from 'js-md5'
69
-export default {
70
-  name: 'Login',
71
-  data() {
72
-    const validatePhone = (rule, value, callback) => {
73
-      if (!value) {
74
-        return callback(new Error('手机号不能为空'))
75
-      } else {
76
-        const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
77
-        if (reg.test(value)) {
78
-          callback()
79
-        } else {
80
-          return callback(new Error('请输入正确的手机号'))
81
-        }
82
-      }
83
-    }
84
-    return {
85
-      regisiterForm: {
86
-        password: '',
87
-        phone: undefined,
88
-        captcha: undefined
89
-      },
90
-      regisiterRules: {
91
-        password: [
92
-          { required: true, trigger: 'change', message: '请输入密码' }
93
-        ],
94
-        phone: [
95
-          { required: true, trigger: 'change', validator: validatePhone }
96
-        ],
97
-        captcha: [
98
-          { required: true, trigger: 'change', message: '请输入验证码' }
99
-        ]
100
-      },
101
-      disabled: false,
102
-      btnText: '发送验证码',
103
-      time: 0,
104
-      loading: false
105
-    }
106
-  },
107
-  methods: {
108
-    sendCode() {
109
-      this.disabled = true
110
-
111
-      this.$refs.regisiterForm.validateField('phone', (errorMessage) => {
112
-        if (errorMessage) {
113
-          this.$message.error(errorMessage)
114
-
115
-          this.disabled = false
116
-        } else {
117
-          getCaptcha({ phone: this.regisiterForm.phone })
118
-            .then((e) => {})
119
-            .catch((res) => {
120
-            })
121
-          this.time = 60
122
-          const timer = setInterval(() => {
123
-            this.time-- // 倒计时递减
124
-            this.btnText = `${this.time}s后重新发送`
125
-            if (this.time === 0) {
126
-              this.disabled = false
127
-              this.btnText = '重新发送'
128
-              this.time = this.countDown
129
-              clearInterval(timer)
130
-            }
131
-          }, 1000)
132
-        }
133
-      })
134
-    },
135
-    handleLogin() {
136
-      this.$refs.regisiterForm.validate((valid) => {
137
-        if (valid) {
138
-          this.regisiterForm.password = md5(this.regisiterForm.password)
139
-          // signUp(this.regisiterForm).then((res) => {
140
-          this.$message('修改密码成功')
141
-          this.$router.push({ path: '/login' })
142
-          // })
143
-        } else {
144
-          return false
145
-        }
146
-      })
147
-    }
148
-  }
149
-}
150
-</script>
151
-
152
-<style lang="scss">
153
-/* 修复input 背景不协调 和光标变色 */
154
-/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
155
-
156
-$bg: #283443;
157
-$light_gray: #fff;
158
-$cursor: #fff;
159
-
160
-@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
161
-  .login-container .el-input input {
162
-    color: $cursor;
163
-  }
164
-}
165
-
166
-/* reset element-ui css */
167
-.login-container {
168
-  .el-input {
169
-    display: inline-block;
170
-    height: 47px;
171
-    width: 85%;
172
-
173
-    input {
174
-      background: transparent;
175
-      border: 0px;
176
-      -webkit-appearance: none;
177
-      border-radius: 0px;
178
-      padding: 12px 5px 12px 15px;
179
-      color: $light_gray;
180
-      height: 47px;
181
-      caret-color: $cursor;
182
-
183
-      &:-webkit-autofill {
184
-        box-shadow: 0 0 0px 1000px $bg inset !important;
185
-        -webkit-text-fill-color: $cursor !important;
186
-      }
187
-    }
188
-  }
189
-
190
-  .el-form-item {
191
-    border: 1px solid rgba(255, 255, 255, 0.1);
192
-    background: rgba(0, 0, 0, 0.1);
193
-    border-radius: 5px;
194
-    color: #454545;
195
-  }
196
-}
197
-</style>
198
-
199
-<style lang="scss" scoped>
200
-$bg: #2d3a4b;
201
-$dark_gray: #889aa4;
202
-$light_gray: #eee;
203
-
204
-.login-container {
205
-  min-height: 100%;
206
-  width: 100%;
207
-  background-color: $bg;
208
-  overflow: hidden;
209
-
210
-  .login-form {
211
-    position: relative;
212
-    width: 520px;
213
-    max-width: 100%;
214
-    padding: 160px 35px 0;
215
-    margin: 0 auto;
216
-    overflow: hidden;
217
-  }
218
-
219
-  .tips {
220
-    font-size: 14px;
221
-    color: #fff;
222
-    margin-bottom: 10px;
223
-
224
-    span {
225
-      &:first-of-type {
226
-        margin-right: 16px;
227
-      }
228
-    }
229
-  }
230
-
231
-  .svg-container {
232
-    padding: 6px 5px 6px 15px;
233
-    color: $dark_gray;
234
-    vertical-align: middle;
235
-    width: 30px;
236
-    display: inline-block;
237
-  }
238
-
239
-  .title-container {
240
-    position: relative;
241
-
242
-    .title {
243
-      font-size: 26px;
244
-      color: $light_gray;
245
-      margin: 0px auto 40px auto;
246
-      text-align: center;
247
-      font-weight: bold;
248
-    }
249
-  }
250
-
251
-  .show-pwd {
252
-    position: absolute;
253
-    right: 10px;
254
-    top: 7px;
255
-    font-size: 16px;
256
-    color: $dark_gray;
257
-    cursor: pointer;
258
-    user-select: none;
259
-  }
260
-}
261
-</style>

+ 0
- 246
src/views/login/index.vue 파일 보기

@@ -1,246 +0,0 @@
1
-<template>
2
-  <div class="login-container">
3
-    <el-form
4
-      ref="loginForm"
5
-      :model="loginForm"
6
-      :rules="loginRules"
7
-      class="login-form"
8
-      auto-complete="on"
9
-      label-position="left"
10
-    >
11
-      <div class="title-container">
12
-        <h3 class="title">答题管理系统</h3>
13
-      </div>
14
-
15
-      <el-form-item prop="userName">
16
-        <span class="svg-container">
17
-          <svg-icon icon-class="user" />
18
-        </span>
19
-        <el-input
20
-          ref="userName"
21
-          v-model="loginForm.userName"
22
-          placeholder="用户名"
23
-          name="userName"
24
-          type="text"
25
-          tabindex="1"
26
-          auto-complete="on"
27
-        />
28
-      </el-form-item>
29
-
30
-      <el-form-item prop="password">
31
-        <span class="svg-container">
32
-          <svg-icon icon-class="password" />
33
-        </span>
34
-        <el-input
35
-          :key="passwordType"
36
-          ref="password"
37
-          v-model="loginForm.password"
38
-          :type="passwordType"
39
-          placeholder="密码"
40
-          name="password"
41
-          tabindex="2"
42
-          auto-complete="on"
43
-          @keyup.enter.native="handleLogin"
44
-        />
45
-        <span class="show-pwd" @click="showPwd">
46
-          <svg-icon
47
-            :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"
48
-          />
49
-        </span>
50
-      </el-form-item>
51
-
52
-      <el-button
53
-        :loading="loading"
54
-        type="primary"
55
-        style="width: 100%; margin-bottom: 30px"
56
-        @click.native.prevent="handleLogin"
57
-      >登录</el-button>
58
-      <el-link :underline="false" style="margin:0" type="primary">
59
-        <router-link
60
-          :to="{name: 'register'}"
61
-        >注册账号</router-link>
62
-      </el-link>
63
-      <el-link :underline="false" style="float:right" type="primary">
64
-        <router-link
65
-          :to="{name: 'forgotPassword'}"
66
-        >忘记密码</router-link>
67
-      </el-link>
68
-    </el-form>
69
-  </div>
70
-</template>
71
-<script>
72
-import md5 from 'js-md5'
73
-export default {
74
-  name: 'Login',
75
-  data() {
76
-    return {
77
-      loginForm: {
78
-        userName: '',
79
-        password: ''
80
-      },
81
-      loginRules: {
82
-        userName: [
83
-          { required: true, message: '请输入用户名', trigger: 'change' }
84
-        ],
85
-        password: [
86
-          { required: true, trigger: 'change', message: '请输入密码' }
87
-        ]
88
-      },
89
-      loading: false,
90
-      passwordType: 'password',
91
-      redirect: undefined
92
-    }
93
-  },
94
-  watch: {
95
-    $route: {
96
-      handler: function(route) {
97
-        this.redirect = route.query && route.query.redirect
98
-      },
99
-      immediate: true
100
-    }
101
-  },
102
-  methods: {
103
-    showPwd() {
104
-      if (this.passwordType === 'password') {
105
-        this.passwordType = ''
106
-      } else {
107
-        this.passwordType = 'password'
108
-      }
109
-      this.$nextTick(() => {
110
-        this.$refs.password.focus()
111
-      })
112
-    },
113
-    handleLogin() {
114
-      this.$refs.loginForm.validate((valid) => {
115
-        if (valid) {
116
-          this.loading = true
117
-          this.loginForm.password = md5(this.loginForm.password)
118
-          this.$store
119
-            .dispatch('user/login', this.loginForm)
120
-            .then(() => {
121
-              this.$router.push({ path: '/' })
122
-              this.loading = false
123
-            })
124
-            .catch(() => {
125
-              this.loading = false
126
-            })
127
-        } else {
128
-          console.log('error submit!!')
129
-          return false
130
-        }
131
-      })
132
-    }
133
-  }
134
-}
135
-</script>
136
-
137
-<style lang="scss">
138
-/* 修复input 背景不协调 和光标变色 */
139
-/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
140
-
141
-$bg: #283443;
142
-$light_gray: #fff;
143
-$cursor: #fff;
144
-
145
-@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
146
-  .login-container .el-input input {
147
-    color: $cursor;
148
-  }
149
-}
150
-
151
-/* reset element-ui css */
152
-.login-container {
153
-  .el-input {
154
-    display: inline-block;
155
-    height: 47px;
156
-    width: 85%;
157
-
158
-    input {
159
-      background: transparent;
160
-      border: 0px;
161
-      -webkit-appearance: none;
162
-      border-radius: 0px;
163
-      padding: 12px 5px 12px 15px;
164
-      color: $light_gray;
165
-      height: 47px;
166
-      caret-color: $cursor;
167
-
168
-      &:-webkit-autofill {
169
-        box-shadow: 0 0 0px 1000px $bg inset !important;
170
-        -webkit-text-fill-color: $cursor !important;
171
-      }
172
-    }
173
-  }
174
-
175
-  .el-form-item {
176
-    border: 1px solid rgba(255, 255, 255, 0.1);
177
-    background: rgba(0, 0, 0, 0.1);
178
-    border-radius: 5px;
179
-    color: #454545;
180
-  }
181
-}
182
-</style>
183
-
184
-<style lang="scss" scoped>
185
-$bg: #2d3a4b;
186
-$dark_gray: #889aa4;
187
-$light_gray: #eee;
188
-
189
-.login-container {
190
-  min-height: 100%;
191
-  width: 100%;
192
-  background-color: $bg;
193
-  overflow: hidden;
194
-
195
-  .login-form {
196
-    position: relative;
197
-    width: 520px;
198
-    max-width: 100%;
199
-    padding: 160px 35px 0;
200
-    margin: 0 auto;
201
-    overflow: hidden;
202
-  }
203
-
204
-  .tips {
205
-    font-size: 14px;
206
-    color: #fff;
207
-    margin-bottom: 10px;
208
-
209
-    span {
210
-      &:first-of-type {
211
-        margin-right: 16px;
212
-      }
213
-    }
214
-  }
215
-
216
-  .svg-container {
217
-    padding: 6px 5px 6px 15px;
218
-    color: $dark_gray;
219
-    vertical-align: middle;
220
-    width: 30px;
221
-    display: inline-block;
222
-  }
223
-
224
-  .title-container {
225
-    position: relative;
226
-
227
-    .title {
228
-      font-size: 26px;
229
-      color: $light_gray;
230
-      margin: 0px auto 40px auto;
231
-      text-align: center;
232
-      font-weight: bold;
233
-    }
234
-  }
235
-
236
-  .show-pwd {
237
-    position: absolute;
238
-    right: 10px;
239
-    top: 7px;
240
-    font-size: 16px;
241
-    color: $dark_gray;
242
-    cursor: pointer;
243
-    user-select: none;
244
-  }
245
-}
246
-</style>

+ 0
- 329
src/views/login/register.vue 파일 보기

@@ -1,329 +0,0 @@
1
-<template>
2
-  <div class="login-container">
3
-    <el-form
4
-      ref="regisiterForm"
5
-      :model="regisiterForm"
6
-      :rules="regisiterRules"
7
-      class="login-form"
8
-      auto-complete="on"
9
-      label-position="left"
10
-    >
11
-      <div class="title-container">
12
-        <h3 class="title">注册账号</h3>
13
-      </div>
14
-
15
-      <el-form-item prop="name">
16
-        <span class="svg-container">
17
-          <svg-icon icon-class="user" />
18
-        </span>
19
-        <el-input
20
-          ref="name"
21
-          v-model="regisiterForm.name"
22
-          placeholder="用户名"
23
-          name="name"
24
-          type="text"
25
-          tabindex="1"
26
-        />
27
-      </el-form-item>
28
-
29
-      <el-form-item prop="password">
30
-        <span class="svg-container">
31
-          <svg-icon icon-class="password" />
32
-        </span>
33
-        <el-input
34
-          :key="passwordType"
35
-          ref="password"
36
-          v-model="regisiterForm.password"
37
-          :type="passwordType"
38
-          placeholder="密码"
39
-          name="password"
40
-          tabindex="2"
41
-        />
42
-        <span class="show-pwd" @click="showPwd">
43
-          <svg-icon
44
-            :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"
45
-          />
46
-        </span>
47
-      </el-form-item>
48
-      <el-form-item prop="password2">
49
-        <span class="svg-container">
50
-          <svg-icon icon-class="password" />
51
-        </span>
52
-        <el-input
53
-          ref="password2"
54
-          v-model="regisiterForm.password2"
55
-          type="text"
56
-          placeholder="确认密码"
57
-          name="password2"
58
-          tabindex="3"
59
-        />
60
-      </el-form-item>
61
-      <el-form-item prop="phone">
62
-        <span class="svg-container">
63
-          <svg-icon icon-class="password" />
64
-        </span>
65
-        <el-input
66
-          ref="phone"
67
-          v-model="regisiterForm.phone"
68
-          type="tel"
69
-          placeholder="手机号"
70
-          name="phone"
71
-          tabindex="4"
72
-        />
73
-      </el-form-item>
74
-
75
-      <el-form-item prop="captcha" style="width:65%">
76
-        <span class="svg-container">
77
-          <svg-icon icon-class="password" />
78
-        </span>
79
-        <el-input
80
-          ref="captcha"
81
-          v-model="regisiterForm.captcha"
82
-          type="text"
83
-          placeholder="验证码"
84
-          tabindex="5"
85
-          name="captcha"
86
-          @keyup.enter.native="handleLogin"
87
-        />
88
-        <el-button style="position: absolute;right: -150px;top: 6px;" :disabled="disabled" @click="sendCode">{{ btnText }}</el-button>
89
-      </el-form-item>
90
-
91
-      <el-button
92
-        :loading="loading"
93
-        type="primary"
94
-        style="width: 100%; margin-bottom: 30px"
95
-        @click.native.prevent="handleLogin"
96
-      >注册</el-button>
97
-      <el-link :underline="false" style="margin:0" type="primary">
98
-        <router-link
99
-          :to="{path: '/login'}"
100
-        >登录系统</router-link>
101
-      </el-link>
102
-      <el-link :underline="false" style="float:right" type="primary">
103
-        <router-link
104
-          :to="{name: 'forgotPassword'}"
105
-        >忘记密码</router-link>
106
-      </el-link>
107
-    </el-form>
108
-  </div>
109
-</template>
110
-<script>
111
-import { getCaptcha, signUp } from '@/api/signup'
112
-import md5 from 'js-md5'
113
-export default {
114
-  name: 'Login',
115
-  data() {
116
-    const validatePhone = (rule, value, callback) => {
117
-      if (!value) {
118
-        return callback(new Error('手机号不能为空'))
119
-      } else {
120
-        const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
121
-        if (reg.test(value)) {
122
-          callback()
123
-        } else {
124
-          return callback(new Error('请输入正确的手机号'))
125
-        }
126
-      }
127
-    }
128
-    return {
129
-      regisiterForm: {
130
-        name: undefined,
131
-        password: undefined,
132
-        phone: undefined,
133
-        captcha: '619400',
134
-        password2: undefined
135
-      },
136
-      regisiterRules: {
137
-        name: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
138
-        password: [
139
-          { required: true, trigger: 'change', message: '请输入密码' }
140
-        ],
141
-        password2: [
142
-          { required: true, trigger: 'change', message: '请再次输入密码' }
143
-        ],
144
-        phone: [
145
-          { required: true, trigger: 'change', validator: validatePhone }
146
-        ],
147
-        captcha: [
148
-          { required: true, trigger: 'change', message: '请输入验证码' }
149
-        ]
150
-      },
151
-      disabled: false,
152
-      btnText: '发送验证码',
153
-      time: 0,
154
-      loading: false,
155
-      passwordType: 'password'
156
-    }
157
-  },
158
-  methods: {
159
-    sendCode() {
160
-      this.disabled = true
161
-
162
-      this.$refs.regisiterForm.validateField('phone', (errorMessage) => {
163
-        if (errorMessage) {
164
-          this.$message.error(errorMessage)
165
-
166
-          this.disabled = false
167
-        } else {
168
-          getCaptcha({ phone: this.regisiterForm.phone })
169
-            .then((e) => {})
170
-            .catch((res) => {
171
-              // console.log(res)
172
-            })
173
-          this.time = 60
174
-          const timer = setInterval(() => {
175
-            this.time-- // 倒计时递减
176
-            this.btnText = `${this.time}s后重新发送`
177
-            if (this.time === 0) {
178
-              this.disabled = false
179
-              this.btnText = '重新发送'
180
-              this.time = this.countDown
181
-              clearInterval(timer)
182
-            }
183
-          }, 1000)
184
-        }
185
-      })
186
-    },
187
-    showPwd() {
188
-      if (this.passwordType === 'password') {
189
-        this.passwordType = ''
190
-      } else {
191
-        this.passwordType = 'password'
192
-      }
193
-      this.$nextTick(() => {
194
-        this.$refs.password.focus()
195
-      })
196
-    },
197
-    handleLogin() {
198
-      this.$refs.regisiterForm.validate((valid) => {
199
-        if (valid) {
200
-          if (this.regisiterForm.password !== this.regisiterForm.password2) {
201
-            this.$message('密码输入不一致请重新输入')
202
-            this.$refs.password2.focus()
203
-            return false
204
-          } else {
205
-            this.regisiterForm.password = md5(this.regisiterForm.password)
206
-            signUp(this.regisiterForm).then((res) => {
207
-              this.$message('注册成功')
208
-              this.$router.push({ path: '/login' })
209
-            })
210
-          }
211
-        } else {
212
-          return false
213
-        }
214
-      })
215
-    }
216
-  }
217
-}
218
-</script>
219
-
220
-<style lang="scss">
221
-/* 修复input 背景不协调 和光标变色 */
222
-/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */
223
-
224
-$bg: #283443;
225
-$light_gray: #fff;
226
-$cursor: #fff;
227
-
228
-@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
229
-  .login-container .el-input input {
230
-    color: $cursor;
231
-  }
232
-}
233
-
234
-/* reset element-ui css */
235
-.login-container {
236
-  .el-input {
237
-    display: inline-block;
238
-    height: 47px;
239
-    width: 85%;
240
-
241
-    input {
242
-      background: transparent;
243
-      border: 0px;
244
-      -webkit-appearance: none;
245
-      border-radius: 0px;
246
-      padding: 12px 5px 12px 15px;
247
-      color: $light_gray;
248
-      height: 47px;
249
-      caret-color: $cursor;
250
-
251
-      &:-webkit-autofill {
252
-        box-shadow: 0 0 0px 1000px $bg inset !important;
253
-        -webkit-text-fill-color: $cursor !important;
254
-      }
255
-    }
256
-  }
257
-
258
-  .el-form-item {
259
-    border: 1px solid rgba(255, 255, 255, 0.1);
260
-    background: rgba(0, 0, 0, 0.1);
261
-    border-radius: 5px;
262
-    color: #454545;
263
-  }
264
-}
265
-</style>
266
-
267
-<style lang="scss" scoped>
268
-$bg: #2d3a4b;
269
-$dark_gray: #889aa4;
270
-$light_gray: #eee;
271
-
272
-.login-container {
273
-  min-height: 100%;
274
-  width: 100%;
275
-  background-color: $bg;
276
-  overflow: hidden;
277
-
278
-  .login-form {
279
-    position: relative;
280
-    width: 520px;
281
-    max-width: 100%;
282
-    padding: 160px 35px 0;
283
-    margin: 0 auto;
284
-    overflow: hidden;
285
-  }
286
-
287
-  .tips {
288
-    font-size: 14px;
289
-    color: #fff;
290
-    margin-bottom: 10px;
291
-
292
-    span {
293
-      &:first-of-type {
294
-        margin-right: 16px;
295
-      }
296
-    }
297
-  }
298
-
299
-  .svg-container {
300
-    padding: 6px 5px 6px 15px;
301
-    color: $dark_gray;
302
-    vertical-align: middle;
303
-    width: 30px;
304
-    display: inline-block;
305
-  }
306
-
307
-  .title-container {
308
-    position: relative;
309
-
310
-    .title {
311
-      font-size: 26px;
312
-      color: $light_gray;
313
-      margin: 0px auto 40px auto;
314
-      text-align: center;
315
-      font-weight: bold;
316
-    }
317
-  }
318
-
319
-  .show-pwd {
320
-    position: absolute;
321
-    right: 10px;
322
-    top: 7px;
323
-    font-size: 16px;
324
-    color: $dark_gray;
325
-    cursor: pointer;
326
-    user-select: none;
327
-  }
328
-}
329
-</style>

+ 76
- 0
src/views/person/index.vue 파일 보기

@@ -0,0 +1,76 @@
1
+<template>
2
+  <div class="body" style="font-size:14px">
3
+    <el-table stripe :data="tableData" border style="width: 100%">
4
+      <el-table-column prop="name" label="中奖人" />
5
+      <el-table-column prop="phone" label="手机号" />
6
+      <el-table-column prop="prizeName" label="奖项" />
7
+      <el-table-column prop="prizeDate" label="中奖时间">
8
+        <template slot-scope="scope">
9
+          {{
10
+            scope.row.prizeDate.substr(0, 10)
11
+          }}
12
+        </template>
13
+      </el-table-column>
14
+    </el-table>
15
+    <el-pagination
16
+      v-show="gameTotal!==0"
17
+      style="float:right; margin:20px 0"
18
+      :total="gameTotal"
19
+      :current-page="currentPage"
20
+      :page-sizes="[4, 10, 20, 50]"
21
+      :page-size="pageSize"
22
+      layout="total, prev, pager, next, sizes"
23
+      @size-change="handleSizeChange"
24
+      @current-change="handleCurrentChange"
25
+    />
26
+  </div>
27
+</template>
28
+<script>
29
+import { getPersonList } from '@/api/person'
30
+
31
+export default {
32
+  data() {
33
+    return {
34
+      tableData: [],
35
+      pageSize: 10,
36
+      currentPage: 1,
37
+      gameTotal: 0 // 条目总数
38
+    }
39
+  },
40
+  mounted() {
41
+    this.onSearch()
42
+  },
43
+  methods: {
44
+    // 改变每页显示条数
45
+    handleSizeChange(val) {
46
+      this.pageSize = val
47
+      this.changePagination()
48
+    },
49
+    // 改变页码
50
+    handleCurrentChange(val) {
51
+      this.currentPage = val
52
+      this.changePagination()
53
+    },
54
+    // 改变分页组件重新查询数据
55
+    changePagination() {
56
+      getPersonList({
57
+        pageNum: this.currentPage,
58
+        pageSize: this.pageSize
59
+      }).then((res) => {
60
+        this.tableData = res.data.records
61
+      })
62
+    },
63
+    onSearch() {
64
+      getPersonList({
65
+        pageSize: this.pageSize
66
+      }).then((res) => {
67
+        this.tableData = res.data.records
68
+        this.gameTotal = res.data.total
69
+        this.pageSize = res.data.size
70
+      })
71
+    }
72
+  }
73
+}
74
+</script>
75
+<style>
76
+</style>

+ 0
- 153
src/views/question/drawer.vue 파일 보기

@@ -1,153 +0,0 @@
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 slot="prepend" v-model="form.option" filterable allow-create default-first-option style="width:100px" placeholder="请选择">
18
-                <el-option
19
-                  v-for="item in options"
20
-                  :key="item.value"
21
-                  :label="item.label"
22
-                  :value="item.value"
23
-                />
24
-              </el-select>
25
-            </el-input>
26
-          </el-form-item>
27
-          <el-form-item style="text-align:center">
28
-            <el-button @click="handleClose">取 消</el-button>
29
-            <el-button type="primary" @click="onSubmit('form')">确 定</el-button>
30
-          </el-form-item>
31
-        </el-form>
32
-      </div>
33
-    </el-drawer>
34
-  </div>
35
-</template>
36
-<script>
37
-import { getAnswerDetail, saveAnswer, UpdateAnswer } from '@/api/answer'
38
-export default {
39
-  props: {
40
-    dialog: Boolean,
41
-    questionId: String,
42
-    answerId: String
43
-  },
44
-  data() {
45
-    return {
46
-      rules: {
47
-        content: [{ required: true, message: '请输入答案内容', trigger: 'blur' }]
48
-      },
49
-      form: {
50
-        option: undefined,
51
-        content: undefined,
52
-        sortNo: 1,
53
-        status: 1
54
-      },
55
-      formLabelWidth: '120px',
56
-      options: [
57
-        {
58
-          value: 'A',
59
-          label: 'A'
60
-        },
61
-        {
62
-          value: 'B',
63
-          label: 'B'
64
-        },
65
-        {
66
-          value: 'C',
67
-          label: 'C'
68
-        },
69
-        {
70
-          value: 'D',
71
-          label: 'D'
72
-        },
73
-        {
74
-          value: 'true',
75
-          label: '对'
76
-        },
77
-        {
78
-          value: 'false',
79
-          label: '错'
80
-        }
81
-      ]
82
-    }
83
-  },
84
-  watch: {
85
-    answerId() {
86
-      if (this.answerId) {
87
-        getAnswerDetail(this.answerId).then((res) => {
88
-          this.form = res.data
89
-        })
90
-      }
91
-    }
92
-  },
93
-  methods: {
94
-    onSubmit(form) {
95
-      this.$refs[form].validate((valid) => {
96
-        if (valid) {
97
-          if (this.form.option) {
98
-            const data = { ...this.form }
99
-            switch (data.option) {
100
-              case 'A':data.sortNo = 1; break
101
-              case 'B':data.sortNo = 2; break
102
-              case 'C':data.sortNo = 3; break
103
-              case 'D':data.sortNo = 4; break
104
-              case 'E':data.sortNo = 5; break
105
-              case 'F':data.sortNo = 6; break
106
-              case 'G':data.sortNo = 7; break
107
-              case 'H':data.sortNo = 8; break
108
-              case 'I':data.sortNo = 9; break
109
-              case 'J':data.sortNo = 10; break
110
-              case 'true':data.sortNo = 1; break
111
-              case 'false':data.sortNo = 2; break
112
-              default:break
113
-            }
114
-            if (this.answerId) {
115
-              UpdateAnswer(data, this.answerId).then((res) => {
116
-                this.$message('修改成功')
117
-                this.$emit('handleEditDrawer', true)
118
-                this.form = {
119
-                  option: undefined,
120
-                  content: undefined
121
-                }
122
-              })
123
-            } else {
124
-              data.questionId = this.questionId
125
-              saveAnswer(data).then((res) => {
126
-                this.$message('添加成功')
127
-                this.$emit('handleEditDrawer', true)
128
-                this.form = {
129
-                  option: undefined,
130
-                  content: undefined
131
-                }
132
-              })
133
-            }
134
-          } else {
135
-            this.$message('请在灰色下拉菜单中添加选项')
136
-          }
137
-        } else {
138
-          return false
139
-        }
140
-      })
141
-    },
142
-    handleClose() {
143
-      this.$emit('handleCloseDrawer', true)
144
-      this.form = {
145
-        option: undefined,
146
-        content: undefined
147
-      }
148
-    }
149
-  }
150
-}
151
-</script>
152
-<style>
153
-</style>

+ 0
- 209
src/views/question/edit.vue 파일 보기

@@ -1,209 +0,0 @@
1
-<template>
2
-  <div class="body_edit">
3
-    <h2 style="text-align: center">
4
-      游戏题目{{ questionId ? "编辑" : "添加" }}
5
-    </h2>
6
-    <el-form ref="form" :rules="rules" :model="form" label-width="90px">
7
-      <el-form-item label="题目:" prop="title">
8
-        <el-input 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-form-item>
16
-      <el-form-item v-if="questionId!==undefined" label="正确选项:">
17
-        <!-- filterable可搜索 multiple可多选 default-first-option回车可选-->
18
-        <el-select
19
-          v-model="form.rightAnswer"
20
-          style="width:100%"
21
-          multiple
22
-          filterable
23
-          default-first-option
24
-          placeholder="请选择"
25
-        >
26
-          <el-option
27
-            v-for="item in rightList"
28
-            :key="item"
29
-            :label="item"
30
-            :value="item"
31
-          />
32
-        </el-select>
33
-      </el-form-item>
34
-      <el-form-item>
35
-        <el-button type="primary" @click="onSubmit('form')">确定</el-button>
36
-        <el-button @click="$router.go(-1)">返回</el-button>
37
-      </el-form-item>
38
-    </el-form>
39
-    <el-card v-if="questionId!==undefined" shadow="never" body-style="padding:0" class="box-card">
40
-      <div slot="header" class="clearfix">
41
-        <h3 style="float:left">答案列表</h3>
42
-        <el-button
43
-          type="primary"
44
-          style="float: right"
45
-          icon="el-icon-plus"
46
-          @click="onAddAnswer"
47
-        >添加答案</el-button>
48
-      </div>
49
-      <ul style="list-style-type: none;margin:24px 0 24px -40px">
50
-        <li v-for="answer in answerList" :key="answer.answerId" class="answerli">
51
-          <div style="flex:1;width: 100%;overflow: hidden;display: flex;" @click="handleEdit(answer)">
52
-            <span style="width:45px">{{ answer.option }}</span>
53
-            <span style="flex:1">{{ answer.content }}</span>
54
-          </div>
55
-          <el-popconfirm
56
-            style="width:30px"
57
-            icon="el-icon-info"
58
-            icon-color="red"
59
-            title="确定删除这个答案吗?"
60
-            @onConfirm="handleDelete(answer)"
61
-          >
62
-            <el-button slot="reference" type="text" class="deleteQuestion" style="color:red">删除</el-button>
63
-          </el-popconfirm>
64
-        </li>
65
-      </ul>
66
-    </el-card>
67
-    <QuestionDrawer
68
-      :dialog="dialog"
69
-      :question-id="questionId"
70
-      :answer-id="answerId"
71
-      @handleCloseDrawer="handleCloseDrawer"
72
-      @handleEditDrawer="handleEditDrawer"
73
-    />
74
-  </div>
75
-</template>
76
-<script>
77
-
78
-import { saveQuestion, UpdateQuestion, getQuestionDetail } from '@/api/question'
79
-import { getAnswerList, deleteAnswer } from '@/api/answer'
80
-import QuestionDrawer from '@/views/question/drawer.vue'
81
-
82
-export default {
83
-  components: {
84
-    QuestionDrawer
85
-  },
86
-  data() {
87
-    return {
88
-      questionId: undefined,
89
-      rules: {
90
-        title: [{ required: true, message: '请输入游戏名称', trigger: 'blur' }]
91
-      },
92
-      form: {
93
-        title: undefined,
94
-        optType: undefined,
95
-        rightAnswer: undefined,
96
-        questionId: undefined
97
-      },
98
-      // 答案列表(包括选项 内容 特征词列表)
99
-      answerList: [],
100
-      answerId: undefined,
101
-      // 正确答案数据源
102
-      rightList: [],
103
-      dialog: false
104
-    }
105
-  },
106
-  watch: {
107
-    '$route.query.id': {
108
-      handler(val) {
109
-        if (val) {
110
-          this.questionId = val
111
-          getQuestionDetail(this.questionId).then((res) => {
112
-            this.form = res.data
113
-            this.form.rightAnswer = res.data.rightAnswer?.split(',')
114
-          })
115
-          this.handleAnswerList()
116
-        }
117
-      },
118
-      immediate: true // 页面加载时就启动
119
-    }
120
-  },
121
-  methods: {
122
-    // 添加答案
123
-    onAddAnswer() {
124
-      this.answerId = undefined
125
-      this.dialog = true
126
-    },
127
-    // 编辑答案
128
-    handleEdit(val) {
129
-      this.answerId = val.answerId
130
-      this.dialog = true
131
-    },
132
-    // 删除答案
133
-    handleDelete(val) {
134
-      deleteAnswer(val.answerId).then((res) => {
135
-        this.$message('删除答案成功')
136
-        this.handleAnswerList()
137
-      })
138
-    },
139
-    // 关闭答案抽屉
140
-    handleCloseDrawer() {
141
-      this.dialog = false
142
-    },
143
-    // 编辑答案抽屉成功重新查询列表
144
-    handleEditDrawer(val) {
145
-      this.handleCloseDrawer()
146
-      this.handleAnswerList()
147
-    },
148
-    // 查询当前问题答案列表
149
-    handleAnswerList() {
150
-      getAnswerList({ questionId: this.questionId }).then((res) => {
151
-        this.answerList = res.data.records
152
-        // 给正确答按下拉菜单数据源赋值
153
-        const list = []
154
-        this.answerList.map(item => {
155
-          list.push(item.option)
156
-        })
157
-        this.rightList = list
158
-      })
159
-    },
160
-    onSubmit(form) {
161
-      this.$refs[form].validate((valid) => {
162
-        if (valid) {
163
-          if (this.form.optType) {
164
-            const data = { ...this.form }
165
-            data.status = 1
166
-            if (this.questionId) {
167
-              if (data.rightAnswer) {
168
-                data.rightAnswer = data.rightAnswer.sort().toString()
169
-              }
170
-              UpdateQuestion(data, this.questionId).then((res) => {
171
-                this.$message('修改问题成功')
172
-              })
173
-            } else {
174
-              saveQuestion(data).then((res) => {
175
-                this.$message('添加问题成功')
176
-                this.$router.replace({
177
-                  name: 'questionEdit',
178
-                  query: { id: res.data.questionId }
179
-                })
180
-              })
181
-            }
182
-          } else {
183
-            this.$message('请选择题型')
184
-          }
185
-        } else {
186
-          return false
187
-        }
188
-      })
189
-    }
190
-  }
191
-}
192
-</script>
193
-<style scoped lang="scss">
194
-.answerli {
195
-  width: 100%;
196
-  overflow: hidden;
197
-  display: flex;
198
-  line-height:40px;
199
-  background-color: white;
200
-  padding:0 8px;
201
-  border: 1px solid #f0f2f5;
202
-}
203
-.answerli:hover {
204
-  background-color: rgb(230, 247, 255);
205
-}
206
-.answerli:nth-of-type(even) {
207
-  background: #f0f2f5;
208
-}
209
-</style>

+ 0
- 118
src/views/question/index.vue 파일 보기

@@ -1,118 +0,0 @@
1
-<template>
2
-  <div class="body" style="font-size:14px">
3
-    <el-card class="box-card" shadow="never">
4
-      题库名称:
5
-      <el-input v-model="title" style="width: 200px; margin-right: 20px" />
6
-      <div style="float:right">
7
-        <el-button type="primary" @click="onSearch">查询</el-button>
8
-        <el-button @click="onReset">重置</el-button>
9
-        <el-button type="primary" icon="el-icon-plus" @click="handleAdd">添加题目</el-button>
10
-      </div>
11
-    </el-card>
12
-    <el-table stripe :data="tableData" border style="width: 100%">
13
-      <el-table-column prop="title" label="题目名称" />
14
-      <el-table-column prop="createDate" label="创建时间">
15
-        <template slot-scope="scope">
16
-          {{
17
-            scope.row.createDate.substr(0, 10)
18
-          }}
19
-        </template>
20
-      </el-table-column>
21
-      <el-table-column fixed="right" label="操作">
22
-        <template slot-scope="scope">
23
-          <el-link :underline="false" style="margin-right:1em" type="primary">
24
-            <router-link
25
-              :to="{name: 'questionEdit', query: { id: scope.row.questionId }}"
26
-            >编辑</router-link>
27
-          </el-link>
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="gameTotal!==0"
41
-      style="float:right; margin:20px 0"
42
-      :total="gameTotal"
43
-      :current-page="currentPage"
44
-      :page-sizes="[4, 10, 20, 50]"
45
-      :page-size="pageSize"
46
-      layout="total, prev, pager, next, sizes"
47
-      @size-change="handleSizeChange"
48
-      @current-change="handleCurrentChange"
49
-    />
50
-  </div>
51
-</template>
52
-<script>
53
-import { getQuestionList, deleteQuestion } from '@/api/question'
54
-
55
-export default {
56
-  data() {
57
-    return {
58
-      title: undefined,
59
-      tableData: [],
60
-      //
61
-      pageSize: 10,
62
-      currentPage: 1,
63
-      gameTotal: 0 // 条目总数
64
-    }
65
-  },
66
-  mounted() {
67
-    this.onSearch()
68
-  },
69
-  methods: {
70
-    // 改变每页显示条数
71
-    handleSizeChange(val) {
72
-      this.pageSize = val
73
-      this.changePagination()
74
-    },
75
-    // 改变页码
76
-    handleCurrentChange(val) {
77
-      this.currentPage = val
78
-      this.changePagination()
79
-    },
80
-    // 改变分页组件重新查询数据
81
-    changePagination() {
82
-      getQuestionList({
83
-        title: this.title,
84
-        pageNum: this.currentPage,
85
-        pageSize: this.pageSize
86
-      }).then((res) => {
87
-        this.tableData = res.data.records
88
-      })
89
-    },
90
-    handleAdd() {
91
-      this.$router.push({ name: 'questionEdit' })
92
-    },
93
-    handleDelete(row) {
94
-      deleteQuestion(row.questionId).then(() => {
95
-        this.onSearch()
96
-      })
97
-    },
98
-    onSearch() {
99
-      getQuestionList({
100
-        title: this.title,
101
-        pageSize: this.pageSize
102
-      }).then((res) => {
103
-        this.tableData = res.data.records
104
-        this.gameTotal = res.data.total
105
-        this.pageSize = res.data.size
106
-      })
107
-    },
108
-    onReset() {
109
-      this.title = undefined
110
-      this.currentPage = 1
111
-      this.pageSize = 10
112
-      this.onSearch()
113
-    }
114
-  }
115
-}
116
-</script>
117
-<style>
118
-</style>

+ 0
- 5
tests/unit/.eslintrc.js 파일 보기

@@ -1,5 +0,0 @@
1
-module.exports = {
2
-  env: {
3
-    jest: true
4
-  }
5
-}

+ 0
- 70
tests/unit/components/Breadcrumb.spec.js 파일 보기

@@ -1,70 +0,0 @@
1
-import { mount, createLocalVue } from '@vue/test-utils'
2
-import VueRouter from 'vue-router'
3
-import ElementUI from 'element-ui'
4
-import Breadcrumb from '@/components/Breadcrumb/index.vue'
5
-
6
-const localVue = createLocalVue()
7
-localVue.use(VueRouter)
8
-localVue.use(ElementUI)
9
-
10
-const routes = [
11
-  {
12
-    path: '/',
13
-    name: 'home',
14
-    children: [{
15
-      path: 'dashboard',
16
-      name: 'dashboard'
17
-    }]
18
-  },  
19
-]
20
-
21
-const router = new VueRouter({
22
-  routes
23
-})
24
-
25
-describe('Breadcrumb.vue', () => {
26
-  const wrapper = mount(Breadcrumb, {
27
-    localVue,
28
-    router
29
-  })
30
-  it('dashboard', () => {
31
-    router.push('/dashboard')
32
-    const len = wrapper.findAll('.el-breadcrumb__inner').length
33
-    expect(len).toBe(1)
34
-  })
35
-  it('normal route', () => {
36
-    router.push('/menu/menu1')
37
-    const len = wrapper.findAll('.el-breadcrumb__inner').length
38
-    expect(len).toBe(2)
39
-  })
40
-  it('nested route', () => {
41
-    router.push('/menu/menu1/menu1-2/menu1-2-1')
42
-    const len = wrapper.findAll('.el-breadcrumb__inner').length
43
-    expect(len).toBe(4)
44
-  })
45
-  it('no meta.title', () => {
46
-    router.push('/menu/menu1/menu1-2/menu1-2-2')
47
-    const len = wrapper.findAll('.el-breadcrumb__inner').length
48
-    expect(len).toBe(3)
49
-  })
50
-  // it('click link', () => {
51
-  //   router.push('/menu/menu1/menu1-2/menu1-2-2')
52
-  //   const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner')
53
-  //   const second = breadcrumbArray.at(1)
54
-  //   console.log(breadcrumbArray)
55
-  //   const href = second.find('a').attributes().href
56
-  //   expect(href).toBe('#/menu/menu1')
57
-  // })
58
-  // it('noRedirect', () => {
59
-  //   router.push('/menu/menu1/menu1-2/menu1-2-1')
60
-  //   const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner')
61
-  //   const redirectBreadcrumb = breadcrumbArray.at(2)
62
-  //   expect(redirectBreadcrumb.contains('a')).toBe(false)
63
-  // })
64
-  it('last breadcrumb', () => {
65
-    router.push('/menu/menu1/menu1-2/menu1-2-1')
66
-    const breadcrumbArray = wrapper.findAll('.el-breadcrumb__inner')
67
-    const redirectBreadcrumb = breadcrumbArray.at(3)
68
-    expect(redirectBreadcrumb.contains('a')).toBe(false)
69
-  })
70
-})

+ 0
- 18
tests/unit/components/Hamburger.spec.js 파일 보기

@@ -1,18 +0,0 @@
1
-import { shallowMount } from '@vue/test-utils'
2
-import Hamburger from '@/components/Hamburger/index.vue'
3
-describe('Hamburger.vue', () => {
4
-  it('toggle click', () => {
5
-    const wrapper = shallowMount(Hamburger)
6
-    const mockFn = jest.fn()
7
-    wrapper.vm.$on('toggleClick', mockFn)
8
-    wrapper.find('.hamburger').trigger('click')
9
-    expect(mockFn).toBeCalled()
10
-  })
11
-  it('prop isActive', () => {
12
-    const wrapper = shallowMount(Hamburger)
13
-    wrapper.setProps({ isActive: true })
14
-    expect(wrapper.contains('.is-active')).toBe(true)
15
-    wrapper.setProps({ isActive: false })
16
-    expect(wrapper.contains('.is-active')).toBe(false)
17
-  })
18
-})

+ 0
- 22
tests/unit/components/SvgIcon.spec.js 파일 보기

@@ -1,22 +0,0 @@
1
-import { shallowMount } from '@vue/test-utils'
2
-import SvgIcon from '@/components/SvgIcon/index.vue'
3
-describe('SvgIcon.vue', () => {
4
-  it('iconClass', () => {
5
-    const wrapper = shallowMount(SvgIcon, {
6
-      propsData: {
7
-        iconClass: 'test'
8
-      }
9
-    })
10
-    expect(wrapper.find('use').attributes().href).toBe('#icon-test')
11
-  })
12
-  it('className', () => {
13
-    const wrapper = shallowMount(SvgIcon, {
14
-      propsData: {
15
-        iconClass: 'test'
16
-      }
17
-    })
18
-    expect(wrapper.classes().length).toBe(1)
19
-    wrapper.setProps({ className: 'test' })
20
-    expect(wrapper.classes().includes('test')).toBe(true)
21
-  })
22
-})

+ 0
- 30
tests/unit/utils/formatTime.spec.js 파일 보기

@@ -1,30 +0,0 @@
1
-import { formatTime } from '@/utils/index.js'
2
-
3
-describe('Utils:formatTime', () => {
4
-  const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01"
5
-  const retrofit = 5 * 1000
6
-
7
-  it('ten digits timestamp', () => {
8
-    expect(formatTime((d / 1000).toFixed(0))).toBe('7月13日17时54分')
9
-  })
10
-  it('test now', () => {
11
-    expect(formatTime(+new Date() - 1)).toBe('刚刚')
12
-  })
13
-  it('less two minute', () => {
14
-    expect(formatTime(+new Date() - 60 * 2 * 1000 + retrofit)).toBe('2分钟前')
15
-  })
16
-  it('less two hour', () => {
17
-    expect(formatTime(+new Date() - 60 * 60 * 2 * 1000 + retrofit)).toBe('2小时前')
18
-  })
19
-  it('less one day', () => {
20
-    expect(formatTime(+new Date() - 60 * 60 * 24 * 1 * 1000)).toBe('1天前')
21
-  })
22
-  it('more than one day', () => {
23
-    expect(formatTime(d)).toBe('7月13日17时54分')
24
-  })
25
-  it('format', () => {
26
-    expect(formatTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54')
27
-    expect(formatTime(d, '{y}-{m}-{d}')).toBe('2018-07-13')
28
-    expect(formatTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54')
29
-  })
30
-})

+ 0
- 14
tests/unit/utils/param2Obj.spec.js 파일 보기

@@ -1,14 +0,0 @@
1
-import { param2Obj } from '@/utils/index.js'
2
-describe('Utils:param2Obj', () => {
3
-  const url = 'https://github.com/PanJiaChen/vue-element-admin?name=bill&age=29&sex=1&field=dGVzdA==&key=%E6%B5%8B%E8%AF%95'
4
-
5
-  it('param2Obj test', () => {
6
-    expect(param2Obj(url)).toEqual({
7
-      name: 'bill',
8
-      age: '29',
9
-      sex: '1',
10
-      field: window.btoa('test'),
11
-      key: '测试'
12
-    })
13
-  })
14
-})

+ 0
- 35
tests/unit/utils/parseTime.spec.js 파일 보기

@@ -1,35 +0,0 @@
1
-import { parseTime } from '@/utils/index.js'
2
-
3
-describe('Utils:parseTime', () => {
4
-  const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01"
5
-  it('timestamp', () => {
6
-    expect(parseTime(d)).toBe('2018-07-13 17:54:01')
7
-  })
8
-  it('timestamp string', () => {
9
-    expect(parseTime((d + ''))).toBe('2018-07-13 17:54:01')
10
-  })
11
-  it('ten digits timestamp', () => {
12
-    expect(parseTime((d / 1000).toFixed(0))).toBe('2018-07-13 17:54:01')
13
-  })
14
-  it('new Date', () => {
15
-    expect(parseTime(new Date(d))).toBe('2018-07-13 17:54:01')
16
-  })
17
-  it('format', () => {
18
-    expect(parseTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54')
19
-    expect(parseTime(d, '{y}-{m}-{d}')).toBe('2018-07-13')
20
-    expect(parseTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54')
21
-  })
22
-  it('get the day of the week', () => {
23
-    expect(parseTime(d, '{a}')).toBe('五') // 星期五
24
-  })
25
-  it('get the day of the week', () => {
26
-    expect(parseTime(+d + 1000 * 60 * 60 * 24 * 2, '{a}')).toBe('日') // 星期日
27
-  })
28
-  it('empty argument', () => {
29
-    expect(parseTime()).toBeNull()
30
-  })
31
-
32
-  it('null', () => {
33
-    expect(parseTime(null)).toBeNull()
34
-  })
35
-})

+ 0
- 17
tests/unit/utils/validate.spec.js 파일 보기

@@ -1,17 +0,0 @@
1
-import { validUsername, isExternal } from '@/utils/validate.js'
2
-
3
-describe('Utils:validate', () => {
4
-  it('validUsername', () => {
5
-    expect(validUsername('admin')).toBe(true)
6
-    expect(validUsername('editor')).toBe(true)
7
-    expect(validUsername('xxxx')).toBe(false)
8
-  })
9
-  it('isExternal', () => {
10
-    expect(isExternal('https://github.com/PanJiaChen/vue-element-admin')).toBe(true)
11
-    expect(isExternal('http://github.com/PanJiaChen/vue-element-admin')).toBe(true)
12
-    expect(isExternal('github.com/PanJiaChen/vue-element-admin')).toBe(false)
13
-    expect(isExternal('/dashboard')).toBe(false)
14
-    expect(isExternal('./dashboard')).toBe(false)
15
-    expect(isExternal('dashboard')).toBe(false)
16
-  })
17
-})