李志伟 3 vuotta sitten
vanhempi
commit
2764eb1bb0

+ 0
- 94
src/api/characterLib.js Näytä tiedosto

@@ -1,94 +0,0 @@
1
-import request from '@/utils/request'
2
-
3
-
4
-/**
5
-* 保存特征库
6
-* @param {*} data 
7
-* @returns 
8
-*/
9
-export const saveCharacterLib = (data) => request({
10
-  url: '/admin/character-lib',
11
-  method: 'post',
12
-  data
13
-})
14
-
15
-/**
16
- * 特征库列表
17
- * @param {*} params 
18
- * @returns 
19
- */
20
-export const getCharacterLibList = (params) => request({
21
-  url: '/admin/character-lib', params
22
-})
23
-
24
-/**
25
- * 删除特征库
26
- * @param {*} data 
27
- * @returns 
28
- */
29
-export const deleteCharacterLib = (id) => request({
30
-  url: `/admin/character-lib/${id}`, method: 'delete'
31
-})
32
-/**
33
- * 更新特征库
34
- * @param {*} data 
35
- * @returns 
36
- */
37
-export const UpdateCharacterLib = (data, id) => request({
38
-  url: `/admin/character-lib/${id}`, method: 'put', data
39
-})
40
-/**
41
- * 查询特征库详情
42
- * @param {*} params 
43
- * @returns 
44
- */
45
-export const getCharacterLibDetail = (id) => request({
46
-  url: `/admin/character-lib/${id}`
47
-})
48
-
49
-
50
-
51
-/**
52
-* 保存实例库
53
-* @param {*} data 
54
-* @returns 
55
-*/
56
-export const saveCharacterResult = (data) => request({
57
-  url: '/admin/character-result',
58
-  method: 'post',
59
-  data
60
-})
61
-
62
-/**
63
- * 实例库列表
64
- * @param {*} params 
65
- * @returns 
66
- */
67
-export const getCharacterResultList = (params) => request({
68
-  url: '/admin/character-result', params
69
-})
70
-
71
-/**
72
- * 删除实例库
73
- * @param {*} data 
74
- * @returns 
75
- */
76
-export const deleteCharacterResult = (id) => request({
77
-  url: `/admin/character-result/${id}`, method: 'delete'
78
-})
79
-/**
80
- * 更新实例库
81
- * @param {*} data 
82
- * @returns 
83
- */
84
-export const UpdateCharacterResult = (data, id) => request({
85
-  url: `/admin/character-result/${id}`, method: 'put', data
86
-})
87
-/**
88
- * 查询实例库详情
89
- * @param {*} params 
90
- * @returns 
91
- */
92
-export const getCharacterResultDetail = (id) => request({
93
-  url: `/admin/character-result/${id}`
94
-})

+ 0
- 46
src/api/characterWord.js Näytä tiedosto

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

+ 11
- 11
src/api/game.js Näytä tiedosto

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

+ 46
- 0
src/api/gameCharacter.js Näytä tiedosto

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

+ 0
- 80
src/components/AddAnswer/index.vue Näytä tiedosto

@@ -1,80 +0,0 @@
1
-<template>
2
-  <div class="answer">
3
-    <el-row :gutter="20">
4
-      <el-col :span="5">
5
-        <el-select
6
-          v-model="value.option"
7
-          filterable
8
-          allow-create
9
-          default-first-option
10
-          placeholder="请选择"
11
-        >
12
-          <el-option
13
-            v-for="item in options"
14
-            :key="item.value"
15
-            :label="item.label"
16
-            :value="item.value"
17
-          />
18
-        </el-select>
19
-      </el-col>
20
-      <el-col :span="17">
21
-        <el-input v-model="value.content" />
22
-      </el-col>
23
-      <el-col :span="1">
24
-        <el-button type="danger" @click="handleDelete">X</el-button>
25
-      </el-col>
26
-    </el-row>
27
-  </div>
28
-</template>
29
-<script>
30
-export default {
31
-  name: 'Answer',
32
-  props: {
33
-    value: {
34
-      type: Object,
35
-      default: () => ({})
36
-    }
37
-  },
38
-  data() {
39
-    return {
40
-      options: [
41
-        {
42
-          value: 'A',
43
-          label: 'A'
44
-        },
45
-        {
46
-          value: 'B',
47
-          label: 'B'
48
-        },
49
-        {
50
-          value: 'C',
51
-          label: 'C'
52
-        },
53
-        {
54
-          value: 'D',
55
-          label: 'D'
56
-        },
57
-        {
58
-          value: '对',
59
-          label: '对'
60
-        },
61
-        {
62
-          value: '错',
63
-          label: '错'
64
-        }
65
-      ]
66
-    }
67
-  },
68
-  methods: {
69
-    handleDelete() {
70
-      this.$emit('handleDelete', this.value)
71
-    }
72
-  }
73
-}
74
-</script>
75
-<style>
76
-.answer {
77
-  margin: 10px 0;
78
-  width: 500px;
79
-}
80
-</style>

+ 1
- 1
src/components/AddAnswerMatching/index.vue Näytä tiedosto

@@ -48,7 +48,7 @@
48 48
 export default {
49 49
   name: 'Answer',
50 50
   props: {
51
-    libId: String,
51
+    characterId: String,
52 52
     value: {
53 53
       type: Object,
54 54
       default: () => ({})

+ 1
- 1
src/components/Breadcrumb/index.vue Näytä tiedosto

@@ -33,7 +33,7 @@ export default {
33 33
       const first = matched[0]
34 34
 
35 35
       if (!this.isDashboard(first)) {
36
-        matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched)
36
+        matched = [{ path: '/dashboard', meta: { title: '首页' }}].concat(matched)
37 37
       }
38 38
 
39 39
       this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)

+ 0
- 135
src/components/CharacterResult/edit.vue Näytä tiedosto

@@ -1,135 +0,0 @@
1
-<template>
2
-  <div style="padding: 20px">
3
-    <h2 style="text-align: center">
4
-      特征实例{{ resultId ? "编辑" : "添加" }}
5
-    </h2>
6
-    <el-form ref="form" :model="form" label-width="150px" size="mini">
7
-      <el-form-item label="实例名称:">
8
-        <el-input
9
-          v-model="form.name"
10
-          placeholder="请输入实例名(必填)"
11
-        />
12
-      </el-form-item>
13
-      <el-form-item label="特征库图标:">
14
-        <UploadImage :icon="form.thumb" @handleChange="handleChange" @handleDeleteIcon="handleDeleteIcon" />
15
-      </el-form-item>
16
-      <el-form-item label="实例描述:">
17
-        <el-input v-model="form.desc" type="textarea" />
18
-      </el-form-item>
19
-
20
-      <el-form-item label="特征词:">
21
-        <el-select
22
-          v-model="nowList"
23
-          multiple
24
-          filterable
25
-          default-first-option
26
-          placeholder="请选择"
27
-        >
28
-          <el-option
29
-            v-for="item in wordList"
30
-            :key="item.wordId"
31
-            :label="item.word"
32
-            :value="item.wordId"
33
-          />
34
-        </el-select>
35
-      </el-form-item>
36
-      <el-form-item>
37
-        <el-button type="primary" @click="onSubmit">确定</el-button>
38
-        <el-button @click="$router.go(-1)">返回</el-button>
39
-      </el-form-item>
40
-    </el-form>
41
-  </div>
42
-</template>
43
-<script>
44
-import {
45
-  saveCharacterResult,
46
-  UpdateCharacterResult,
47
-  getCharacterResultDetail
48
-} from '@/api/characterLib'
49
-import UploadImage from '@/components/UploadImage/index.vue'
50
-export default {
51
-  components: {
52
-    UploadImage
53
-  },
54
-  props: {
55
-    libId: String,
56
-    resultId: String,
57
-    wordList: {
58
-      type: Array,
59
-      required: true
60
-    }
61
-  },
62
-  data() {
63
-    return {
64
-      form: {
65
-        name: undefined,
66
-        thumb: undefined,
67
-        desc: undefined,
68
-        libId: undefined,
69
-        wordList: []
70
-      },
71
-      nowList: []
72
-    }
73
-  },
74
-  watch: {
75
-    resultId: function() {
76
-      if (this.resultId) {
77
-        this.nowList = []
78
-        getCharacterResultDetail(this.resultId).then((res) => {
79
-          this.form = res.data
80
-          const list = res.data.wordList
81
-          list.map((item) => {
82
-            this.nowList.push(item.wordId)
83
-          })
84
-        })
85
-      } else {
86
-        this.form = {
87
-          name: undefined,
88
-          thumb: undefined,
89
-          desc: undefined,
90
-          libId: undefined,
91
-          wordList: []
92
-        }
93
-        this.nowList = []
94
-      }
95
-    }
96
-  },
97
-  methods: {
98
-    onSubmit() {
99
-      this.form.wordList = this.wordList.filter((item) =>
100
-        this.nowList.some((v) => v === item.wordId)
101
-      )
102
-      this.form.libId = this.libId
103
-      if (this.form.name) {
104
-        if (this.resultId) {
105
-          if (!this.form.thumb) {
106
-            this.form.thumb = ''
107
-          }
108
-          UpdateCharacterResult(this.form, this.resultId).then((res) => {
109
-            this.$message('修改实例成功')
110
-            // 告诉父页面实例表需要刷新并且关闭当前组件
111
-            this.$emit('handleRefresh', true)
112
-          })
113
-        } else {
114
-          saveCharacterResult(this.form).then((res) => {
115
-            this.$message('添加实例成功')
116
-            // 告诉父页面实例表需要刷新并且关闭当前组件
117
-            this.$emit('handleRefresh', true)
118
-            this.$emit('handleEdit', res.data.resultId)
119
-          })
120
-        }
121
-      } else {
122
-        this.$message('请输入实例名')
123
-      }
124
-    },
125
-    handleChange(val) {
126
-      this.form.thumb = val
127
-    },
128
-    handleDeleteIcon() {
129
-      this.form.thumb = ''
130
-    }
131
-  }
132
-}
133
-</script>
134
-<style>
135
-</style>

+ 0
- 125
src/components/CharacterResult/index.vue Näytä tiedosto

@@ -1,125 +0,0 @@
1
-<template>
2
-  <div class="body">
3
-    <div class="noshadowCard">
4
-      <el-card class="box-card">
5
-        实例名称:<el-input
6
-          v-model="name"
7
-          size="mini"
8
-          style="width: 150px; margin-right: 20px"
9
-        />
10
-        创建时间:
11
-        <el-date-picker
12
-          v-model="daterange"
13
-          size="mini"
14
-          type="daterange"
15
-          range-separator="至"
16
-          start-placeholder="开始日期"
17
-          end-placeholder="结束日期"
18
-          value-format="yyyy-MM-dd"
19
-          style="width:220px; margin-right: 20px"
20
-          @change="dateChange"
21
-        />
22
-
23
-        <el-button type="primary" size="mini" @click="onSearch">查询</el-button>
24
-        <el-button size="mini" @click="onReset">重置</el-button>
25
-        <el-button type="primary" size="mini" @click="handleAddRusult">添加实例</el-button>
26
-      </el-card>
27
-    </div>
28
-    <el-table stripe :data="tableData" border style="width: 100%">
29
-      <el-table-column prop="name" label="实例名称" />
30
-      <el-table-column prop="thumb" label="图片">
31
-        <template slot-scope="scope">
32
-          <el-image
33
-            :src="scope.row.thumb"
34
-            style="width: 100px; height: 100px"
35
-          />
36
-        </template>
37
-      </el-table-column>
38
-      <el-table-column prop="createDate" label="创建时间">
39
-        <template slot-scope="scope">{{
40
-          scope.row.createDate.substr(0, 10)
41
-        }}</template>
42
-      </el-table-column>
43
-      <el-table-column fixed="right" label="操作">
44
-        <template slot-scope="scope">
45
-          <el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
46
-          <el-popconfirm
47
-            icon="el-icon-info"
48
-            icon-color="red"
49
-            title="这个实例确定删除吗?"
50
-            @onConfirm="handleDelete(scope.row)"
51
-          >
52
-            <el-button slot="reference" type="text">删除</el-button>
53
-          </el-popconfirm>
54
-        </template>
55
-      </el-table-column>
56
-    </el-table>
57
-  </div>
58
-</template>
59
-<script>
60
-import {
61
-  getCharacterResultList,
62
-  deleteCharacterResult
63
-} from '@/api/characterLib'
64
-
65
-export default {
66
-  props: {
67
-    libId: String
68
-  },
69
-  data() {
70
-    return {
71
-      name: undefined,
72
-      daterange: undefined,
73
-      tableData: [],
74
-      endDate: undefined,
75
-      startDate: undefined
76
-    }
77
-  },
78
-  watch: {
79
-    libId: function() {
80
-      this.onSearch()
81
-    }
82
-  },
83
-  methods: {
84
-    // 添加实例
85
-    handleAddRusult() {
86
-      this.$emit('handleAddRusult', true)
87
-    },
88
-    handleEdit(row) {
89
-      // 向外传送数据row.resultId
90
-      this.$emit('handleEdit', row.resultId)
91
-    },
92
-    handleDelete(row) {
93
-      deleteCharacterResult(row.resultId).then(() => {
94
-        this.$message('删除实例成功')
95
-        this.onSearch()
96
-        // 关闭编辑实例页面防止编辑页面还没关闭就删除当前实例了
97
-        this.$emit('handleClose', true)
98
-      })
99
-    },
100
-    onSearch() {
101
-      getCharacterResultList({ libId: this.libId, name: this.name, startDate: this.startDate, endDate: this.endDate }).then(
102
-        (res) => {
103
-          this.tableData = res.data.records
104
-        }
105
-      )
106
-    },
107
-    onReset() {
108
-      this.name = ''
109
-      this.daterange = ''
110
-      this.startDate = ''
111
-      this.endDate = ''
112
-      this.onSearch()
113
-    },
114
-    dateChange(val) {
115
-      this.startDate = this.daterange[0]
116
-      this.endDate = this.daterange[1]
117
-    }
118
-  }
119
-}
120
-</script>
121
-<style>
122
-.noshadowCard > .box-card {
123
-  box-shadow: none;
124
-}
125
-</style>

+ 7
- 0
src/components/GameCharacter/edit.vue Näytä tiedosto

@@ -0,0 +1,7 @@
1
+<template>
2
+  <div>特征编辑</div>
3
+</template>
4
+<script>
5
+</script>
6
+<style>
7
+</style>

src/views/characterLibManage/index.vue → src/components/GameCharacter/index.vue Näytä tiedosto

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <div class="body" style="font-size:14px">
3 3
     <el-card class="box-card">
4
-      特征库名称:<el-input
4
+      实例名称:<el-input
5 5
         v-model="name"
6 6
         size="mini"
7 7
         style="width: 200px; margin-right: 20px"
@@ -24,8 +24,8 @@
24 24
       <el-button type="primary" size="mini" @click="handleAdd">添加特征库</el-button>
25 25
     </el-card>
26 26
     <el-table stripe :data="tableData" border style="width: 100%">
27
-      <el-table-column prop="name" label="特征库名称" />
28
-      <el-table-column prop="icon" label="特征库图标">
27
+      <el-table-column prop="name" label="实例名称" />
28
+      <el-table-column prop="thumb" label="实例图片">
29 29
         <template slot-scope="scope">
30 30
           <el-image :src="scope.row.icon" style="width: 100px; height: 100px" />
31 31
         </template>
@@ -41,7 +41,7 @@
41 41
           <el-popconfirm
42 42
             icon="el-icon-info"
43 43
             icon-color="red"
44
-            title="这个特征库确定删除吗?"
44
+            title="确定删除这个特征吗?"
45 45
             @onConfirm="handleDelete(scope.row)"
46 46
           >
47 47
             <el-button slot="reference" type="text">删除</el-button>
@@ -52,9 +52,12 @@
52 52
   </div>
53 53
 </template>
54 54
 <script>
55
-import { getCharacterLibList, deleteCharacterLib } from '@/api/characterLib'
55
+import { getGameCharacterList, deleteGameCharacter } from '@/api/gameCharacter'
56 56
 
57 57
 export default {
58
+  props: {
59
+    gameId: String
60
+  },
58 61
   data() {
59 62
     return {
60 63
       name: undefined,
@@ -69,21 +72,23 @@ export default {
69 72
   },
70 73
   methods: {
71 74
     handleAdd() {
72
-      this.$router.push({ name: 'characterLibEdit' })
75
+      this.$emit('handleAddGameCharcter', true)
73 76
     },
74 77
     handleEdit(row) {
75
-      this.$router.push({
76
-        name: 'characterLibEdit',
77
-        query: { id: row.libId }
78
-      })
78
+      this.$emit('handleEditGameCharcter', row.characterId)
79 79
     },
80 80
     handleDelete(row) {
81
-      deleteCharacterLib(row.libId).then(() => {
81
+      deleteGameCharacter(row.characterId).then(() => {
82
+        // 让父组件给右边编辑特征页面一个空的characterId
83
+        // 防止当前特征正在编辑时删除了右边再次进行保存会报错
84
+        this.$message('删除特征成功')
85
+        this.$emit('handleCloseGameCharcter', true)
82 86
         this.onSearch()
83 87
       })
84 88
     },
85 89
     onSearch() {
86
-      getCharacterLibList({
90
+      getGameCharacterList({
91
+        gameId: this.gameId,
87 92
         name: this.name,
88 93
         startDate: this.startDate,
89 94
         endDate: this.endDate

+ 4
- 4
src/components/Question/edit.vue Näytä tiedosto

@@ -23,7 +23,7 @@
23 23
 
24 24
         <div v-for="(answer, index) in form.answerList" :key="index">
25 25
           <AddAnswerMatching
26
-            :libId="libId"
26
+            :characterId="characterId"
27 27
             :value="answer"
28 28
             :wordList="wordList"
29 29
             @change="handleChange"
@@ -69,7 +69,7 @@ export default {
69 69
   },
70 70
   props: {
71 71
     gameId: String,
72
-    libId: String,
72
+    characterId: String,
73 73
     questionId: String
74 74
   },
75 75
   data() {
@@ -155,7 +155,7 @@ export default {
155 155
     },
156 156
 
157 157
     handleWordListChange(val, list) {
158
-      getCharacterLibDetail(this.libId).then((res) => {
158
+      getCharacterLibDetail(this.characterId).then((res) => {
159 159
         this.wordList = res.data.wordList
160 160
       })
161 161
       const index = this.form.answerList.indexOf(val)
@@ -163,7 +163,7 @@ export default {
163 163
         list.some((v) => v === item.wordId)
164 164
       )
165 165
       val.characterWordList.map(item => {
166
-        item = { ...item, libId: this.libId }
166
+        item = { ...item, characterId: this.characterId }
167 167
       })
168 168
       this.$set(this.form.answerList, index, val)
169 169
     },

+ 0
- 106
src/components/TagComponents/index.vue Näytä tiedosto

@@ -1,106 +0,0 @@
1
-<template>
2
-  <div style="margin-top:20px">
3
-    <el-tag
4
-      :key="tag"
5
-      v-for="tag in dynamicTags"
6
-      closable
7
-      :disable-transitions="false"
8
-      @close="handleClose(tag)"
9
-    >
10
-      {{ tag }}
11
-    </el-tag>
12
-    <el-input
13
-      class="input-new-tag"
14
-      v-if="inputVisible"
15
-      v-model="inputValue"
16
-      ref="saveTagInput"
17
-      size="small"
18
-      @keyup.enter.native="handleInputConfirm"
19
-      @blur="handleInputConfirm"
20
-    >
21
-    </el-input>
22
-    <el-button v-else class="button-new-tag" size="small" @click="showInput"
23
-      >添加特征词</el-button
24
-    >
25
-  </div>
26
-</template>
27
-
28
-<script>
29
-export default {
30
-  props: {
31
-    value: {
32
-      type: Array,
33
-      required: true,
34
-    },
35
-  },
36
-  data() {
37
-    return {
38
-      inputVisible: false,
39
-      inputValue: "",
40
-    };
41
-  },
42
-  computed: {
43
-    dynamicTags() {
44
-      let tags = [];
45
-      this.value.map((item) => {
46
-        tags.push(item.word);
47
-      });
48
-      return tags;
49
-    },
50
-  },
51
-  methods: {
52
-    //删除特征词
53
-    handleClose(tag) {
54
-      if (this.value && this.value[0].wordId) {
55
-        this.$confirm("确认删除该修饰词?", {
56
-          showCancelButton: true,
57
-          confirmButtonText: "确定",
58
-          cancelButtonText: "取消",
59
-        })
60
-          .then((_) => {
61
-            this.$emit("handleDelete", tag);
62
-            this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
63
-          })
64
-          .catch((_) => {});
65
-      } else {
66
-        this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
67
-        this.$emit("handleDelete", tag);
68
-      }
69
-    },
70
-
71
-    showInput() {
72
-      this.inputVisible = true;
73
-      this.$nextTick((_) => {
74
-        this.$refs.saveTagInput.$refs.input.focus();
75
-      });
76
-    },
77
-    //添加特征词
78
-    handleInputConfirm() {
79
-      let inputValue = this.inputValue;
80
-      if (inputValue) {
81
-        this.dynamicTags.push(inputValue);
82
-        this.$emit("handleAdd", inputValue);
83
-      }
84
-      this.inputVisible = false;
85
-      this.inputValue = "";
86
-    },
87
-  },
88
-};
89
-</script>
90
-<style>
91
-.el-tag + .el-tag {
92
-  margin-left: 10px;
93
-}
94
-.button-new-tag {
95
-  margin-left: 10px;
96
-  height: 32px;
97
-  line-height: 30px;
98
-  padding-top: 0;
99
-  padding-bottom: 0;
100
-}
101
-.input-new-tag {
102
-  width: 90px;
103
-  margin-left: 10px;
104
-  vertical-align: bottom;
105
-}
106
-</style>

+ 1
- 0
src/icons/svg/app.svg Näytä tiedosto

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

+ 1
- 0
src/icons/svg/game.svg Näytä tiedosto

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

+ 1
- 2
src/permission.js Näytä tiedosto

@@ -28,8 +28,7 @@ router.beforeEach(async(to, from, next) => {
28 28
       const hasGetUserInfo = store.getters.name
29 29
       if (hasGetUserInfo) {
30 30
         next()
31
-      } 
32
-      else {
31
+      } else {
33 32
         try {
34 33
           next()
35 34
         } catch (error) {

+ 2
- 44
src/router/index.js Näytä tiedosto

@@ -43,48 +43,6 @@ export const constantRoutes = [
43 43
     }]
44 44
   },
45 45
 
46
-  {
47
-    path: '/questionList',
48
-    component: Layout,
49
-    name: '题库管理',
50
-    meta: { title: '题库管理', icon: 'form' },
51
-    children: [
52
-      {
53
-        path: 'questionList',
54
-        name: '题库列表',
55
-        component: () => import('@/views/questionList/index'),
56
-        meta: { title: '题库列表', icon: 'form' }
57
-      },
58
-      {
59
-        path: 'questionList/edit',
60
-        name: '编辑题目',
61
-        component: () => import('@/views/questionList/edit')
62
-        // meta: { title: '编辑题目', icon: 'form' }
63
-      }]
64
-  },
65
-
66
-  {
67
-    path: '/characterLibManage',
68
-    component: Layout,
69
-    name: '特征库管理',
70
-    meta: { title: '特征管理', icon: 'form' },
71
-    children: [
72
-      {
73
-        path: 'characterLibManage',
74
-        name: 'characterLibList',
75
-        component: () => import('@/views/characterLibManage/index'),
76
-        meta: { title: '特征库列表', icon: 'form' }
77
-      },
78
-      {
79
-        hidden: true,
80
-        path: 'characterLibManage/edit',
81
-        name: 'characterLibEdit',
82
-        component: () => import('@/views/characterLibManage/edit'),
83
-        meta: { title: '编辑特征库', icon: 'form' }
84
-      }
85
-    ]
86
-  },
87
-
88 46
   {
89 47
     path: '/gameManage',
90 48
     component: Layout,
@@ -95,7 +53,7 @@ export const constantRoutes = [
95 53
         path: 'gameManage',
96 54
         name: '游戏列表',
97 55
         component: () => import('@/views/gameManage/index'),
98
-        meta: { title: '游戏列表', icon: 'form' }
56
+        meta: { title: '游戏列表', icon: 'game' }
99 57
       },
100 58
       {
101 59
         hidden: true,
@@ -116,7 +74,7 @@ export const constantRoutes = [
116 74
         path: 'appManage',
117 75
         name: '应用列表',
118 76
         component: () => import('@/views/appManage/index'),
119
-        meta: { title: '应用列表', icon: 'form' }
77
+        meta: { title: '应用列表', icon: 'app' }
120 78
       },
121 79
       {
122 80
         hidden: true,

+ 0
- 212
src/views/characterLibManage/edit.vue Näytä tiedosto

@@ -1,212 +0,0 @@
1
-<template>
2
-  <div class="body_edit">
3
-    <el-tabs v-model="activeName">
4
-      <el-tab-pane label="特征库" name="characterLib">
5
-        <el-row :gutter="20">
6
-          <el-col :span="13">
7
-            <el-form
8
-              ref="form"
9
-              :model="characterLib"
10
-              label-width="150px"
11
-              size="mini"
12
-            >
13
-              <el-form-item label="特征库名称:">
14
-                <el-input v-model="characterLib.name" />
15
-              </el-form-item>
16
-              <el-form-item label="特征库图标:">
17
-                <UploadImage :icon="characterLib.icon" @handleChange="handleChange" @handleDeleteIcon="handleDeleteIcon" />
18
-              </el-form-item>
19
-              <el-form-item label="特征库描述:">
20
-                <el-input v-model="characterLib.remark" type="textarea" />
21
-              </el-form-item>
22
-              <el-form-item class="editBottomItem">
23
-                <el-button type="primary" @click="onEdit">修改</el-button>
24
-                <el-button @click="onCancel">取消</el-button>
25
-              </el-form-item>
26
-            </el-form>
27
-          </el-col>
28
-          <el-col :span="11">
29
-            特征词列表
30
-            <TagComponents
31
-              :value="characterLib.wordList"
32
-              @handleDelete="handleDelete"
33
-              @handleAdd="handleAdd"
34
-            />
35
-          </el-col>
36
-        </el-row>
37
-      </el-tab-pane>
38
-      <el-tab-pane label="特征实例" name="characterResult" :disabled="libId ? false : true">
39
-        <el-row :gutter="20" style="padding-top: 20px">
40
-          <el-col :span="13">
41
-            <CharacterResult
42
-              ref="CharacterResult"
43
-              :libId="characterLib.libId"
44
-              @handleEdit="handleEdit"
45
-              @handleClose="handleClose"
46
-              @handleAddRusult="resultId = undefined"
47
-            />
48
-          </el-col>
49
-          <el-col :span="11">
50
-            <CharacterResultEdit
51
-              :result-id="resultId"
52
-              :lib-id="characterLib.libId"
53
-              :wordList="characterLib.wordList"
54
-              @handleRefresh="handleRefresh"
55
-            />
56
-          </el-col>
57
-        </el-row>
58
-      </el-tab-pane>
59
-    </el-tabs>
60
-  </div>
61
-</template>
62
-<script>
63
-import { UpdateCharacterLib, getCharacterLibDetail, saveCharacterLib } from '@/api/characterLib'
64
-import { deleteCharacterWord, saveCharacterWord } from '@/api/characterWord'
65
-import UploadImage from '@/components/UploadImage/index.vue'
66
-import CharacterResult from '@/components/CharacterResult/index.vue'
67
-import CharacterResultEdit from '@/components/CharacterResult/edit.vue'
68
-import TagComponents from '@/components/TagComponents/index.vue'
69
-
70
-export default {
71
-  components: {
72
-    UploadImage,
73
-    CharacterResult,
74
-    CharacterResultEdit,
75
-    TagComponents
76
-  },
77
-  data() {
78
-    return {
79
-      characterLib: {
80
-        libId: undefined,
81
-        name: undefined,
82
-        icon: undefined,
83
-        remark: undefined,
84
-        wordList: []
85
-      },
86
-      resultId: undefined,
87
-      libId: undefined,
88
-      activeName: 'characterLib'
89
-    }
90
-  },
91
-  watch: {
92
-    '$route.query.id'() {
93
-      if (this.$route?.query.id) {
94
-        this.libId = this.$route.query.id
95
-        getCharacterLibDetail(this.$route.query.id).then((res) => {
96
-          this.characterLib = res.data
97
-        })
98
-      }
99
-    }
100
-  },
101
-  // 进入页面执行的方法
102
-  mounted: function() {
103
-    if (this.$route?.query.id) {
104
-      this.libId = this.$route.query.id
105
-      getCharacterLibDetail(this.$route.query.id).then((res) => {
106
-        this.characterLib = res.data
107
-      })
108
-    }
109
-  },
110
-
111
-  methods: {
112
-    // 上方实例库的方法
113
-    onCancel() {
114
-      this.$router.go(-1)
115
-    },
116
-    onEdit() {
117
-      if (this.libId) {
118
-        UpdateCharacterLib(this.characterLib, this.characterLib.libId).then(
119
-          (res) => {
120
-            this.$message('修改成功')
121
-          }
122
-        )
123
-      } else {
124
-        saveCharacterLib(this.characterLib, this.characterLib.libId).then(
125
-          (res) => {
126
-            this.$message('添加成功')
127
-            this.$router.replace({
128
-              name: 'characterLibEdit',
129
-              query: { id: res.data.libId }
130
-            })
131
-          }
132
-        )
133
-      }
134
-    },
135
-    // 添加图片
136
-    handleChange(val) {
137
-      this.characterLib.icon = val
138
-    },
139
-    // 删除图片
140
-    handleDeleteIcon() {
141
-      this.characterLib.icon = ''
142
-    },
143
-    // 特征词列表的方法
144
-    handleDelete(val) {
145
-      if (this.characterLib.libId) {
146
-        let nowWordId
147
-        this.characterLib.wordList.map((item) => {
148
-          if (item.word === val) {
149
-            nowWordId = item.wordId
150
-          }
151
-        })
152
-        // 调用删除接口
153
-        deleteCharacterWord(nowWordId).then(() => {
154
-          this.characterLib.wordList.map((item) => {
155
-            if (item.word === val) {
156
-              this.characterLib.wordList.splice(
157
-                this.characterLib.wordList.indexOf(item),
158
-                1
159
-              )
160
-            }
161
-          })
162
-        })
163
-      } else {
164
-        // 直接删除当前项
165
-        this.characterLib.wordList.map((item) => {
166
-          if (item.word === val) {
167
-            this.characterLib.wordList.splice(
168
-              this.characterLib.wordList.indexOf(item),
169
-              1
170
-            )
171
-          }
172
-        })
173
-      }
174
-    },
175
-    handleAdd(val) {
176
-      if (this.characterLib.libId) {
177
-        saveCharacterWord({
178
-          libId: this.characterLib.libId,
179
-          word: val,
180
-          wordId: undefined
181
-        }).then((res) => {
182
-          this.characterLib.wordList.push(res.data)
183
-        })
184
-      } else {
185
-        this.characterLib.wordList.push({
186
-          libId: this.characterLib.libId,
187
-          word: val,
188
-          wordId: undefined
189
-        })
190
-      }
191
-    },
192
-
193
-    // 实例列表的方法
194
-    handleEdit(val) {
195
-      this.resultId = val
196
-    },
197
-    handleClose() {
198
-      this.resultId = undefined
199
-    },
200
-    // 实例编辑页面调用实例列表的刷新方法 兄弟组件调用方法
201
-    handleRefresh() {
202
-      this.$refs.CharacterResult.onSearch()
203
-    }
204
-  }
205
-}
206
-</script>
207
-<style>
208
-.editBottomItem > div {
209
-  margin: 0 !important;
210
-  text-align: center;
211
-}
212
-</style>

+ 67
- 43
src/views/gameManage/edit.vue Näytä tiedosto

@@ -10,29 +10,47 @@
10 10
           <el-form-item label="游戏图标:">
11 11
             <UploadImage :icon="gameForm.gameImage" @handleChange="handleChange" @handleDeleteIcon="handleDeleteIcon" />
12 12
           </el-form-item>
13
-          <el-form-item label="特征库名称:">
13
+          <el-form-item label="游戏类型:">
14 14
             <el-select
15
-              v-model="gameForm.libId"
15
+              v-model="gameForm.resultMode"
16 16
               filterable
17 17
               default-first-option
18 18
               placeholder="请选择"
19 19
               :disabled="gameId ? true : false"
20 20
             >
21 21
               <el-option
22
-                v-for="item in libList"
23
-                :key="item.libId"
24
-                :label="item.name"
25
-                :value="item.libId"
22
+                v-for="item in resultList"
23
+                :key="item.value"
24
+                :label="item.label"
25
+                :value="item.value"
26 26
               />
27 27
             </el-select>
28 28
           </el-form-item>
29
-
30 29
           <el-form-item class="editBottomItem">
31 30
             <el-button type="primary" @click="onSubmit">保存</el-button>
32 31
             <el-button @click="onCancel">取消</el-button>
33 32
           </el-form-item>
34 33
         </el-form>
35 34
       </el-tab-pane>
35
+      <el-tab-pane
36
+        label="关联特征"
37
+        name="game-character"
38
+        :disabled="gameId ? false : true"
39
+      >
40
+        <el-row :gutter="20" style="padding-top: 20px">
41
+          <el-col :span="13">
42
+            <GameCharacter
43
+              :gameId='gameId'
44
+              @handleAddGameCharcter='characterId = undefined'
45
+              @handleCloseGameCharcter='characterId = undefined'
46
+              @handleEditGameCharcter='handleEditGameCharcter'
47
+            />
48
+          </el-col>
49
+          <el-col :span="11">
50
+            <GameCharacterEdit :characterId='characterId'/>
51
+          </el-col>
52
+        </el-row>
53
+      </el-tab-pane>
36 54
       <el-tab-pane
37 55
         label="游戏题库"
38 56
         name="question"
@@ -40,16 +58,8 @@
40 58
       >
41 59
         <el-row :gutter="20" style="padding-top: 20px">
42 60
           <el-col :span="13">
43
-            <QuestionList
44
-              ref="questionList"
45
-              :gameId="gameId"
46
-              @handleEdit="handleEdit"
47
-              @handleClose="handleClose"
48
-              @handleAdd="questionId = undefined"
49
-            />
50 61
           </el-col>
51 62
           <el-col :span="11">
52
-            <QuestionDetail :gameId="gameId" :libId="gameForm.libId" :questionId="questionId" @handleRefresh="handleRefresh" />
53 63
           </el-col>
54 64
         </el-row>
55 65
       </el-tab-pane>
@@ -58,27 +68,36 @@
58 68
 </template>
59 69
 <script>
60 70
 import { saveGame, UpdateGame, getGameDetail } from '@/api/game'
61
-import { getCharacterLibList } from '@/api/characterLib'
62 71
 import UploadImage from '@/components/UploadImage/index.vue'
63
-import QuestionList from '@/components/Question/index.vue'
64
-import QuestionDetail from '@/components/Question/edit.vue'
72
+import GameCharacter from '@/components/GameCharacter/index.vue'
73
+import GameCharacterEdit from '@/components/GameCharacter/edit.vue'
65 74
 export default {
66 75
   components: {
67 76
     UploadImage,
68
-    QuestionList,
69
-    QuestionDetail
77
+    GameCharacter,
78
+    GameCharacterEdit
70 79
   },
71 80
   data() {
72 81
     return {
73 82
       gameForm: {
74 83
         title: undefined,
75 84
         gameImage: undefined,
76
-        libId: undefined
85
+        resultMode: undefined
77 86
       },
78
-      libList: [],
87
+      resultList: [
88
+        {
89
+          value: 'examination',
90
+          label: '测试'
91
+        },
92
+        {
93
+          value: 'character_matched',
94
+          label: '匹配'
95
+        }
96
+      ],
79 97
       gameId: undefined,
80 98
       activeName: 'game',
81
-      questionId: undefined
99
+      questionId: undefined,
100
+      characterId: undefined
82 101
     }
83 102
   },
84 103
   watch: {
@@ -96,34 +115,32 @@ export default {
96 115
         this.gameForm = res.data
97 116
       })
98 117
     }
99
-    getCharacterLibList().then((res) => {
100
-      const list = res.data.records
101
-      list.map((item) => {
102
-        this.libList.push({ libId: item.libId, name: item.name })
103
-      })
104
-    })
105 118
   },
106 119
   methods: {
107 120
     onCancel() {
108 121
       this.$router.go(-1)
109 122
     },
110 123
     onSubmit() {
111
-      if (this.gameId) {
112
-        if (!this.gameForm.gameImage) {
113
-          this.gameForm.gameImage = ''
124
+      if (this.gameForm.title && this.gameForm.resultMode) {
125
+        if (this.gameId) {
126
+          if (!this.gameForm.gameImage) {
127
+            this.gameForm.gameImage = ''
128
+          }
129
+          UpdateGame(this.gameForm, this.gameId).then((res) => {
130
+            this.$message('修改成功')
131
+            this.$router.go(-1)
132
+          })
133
+        } else {
134
+          saveGame(this.gameForm).then((res) => {
135
+            this.$message('保存成功')
136
+            this.$router.replace({
137
+              name: 'gameEdit',
138
+              query: { id: res.data.gameId }
139
+            })
140
+          })
114 141
         }
115
-        UpdateGame(this.gameForm, this.gameId).then((res) => {
116
-          this.$message('修改成功')
117
-          this.$router.go(-1)
118
-        })
119 142
       } else {
120
-        saveGame(this.gameForm).then((res) => {
121
-          this.$message('保存成功')
122
-          this.$router.replace({
123
-            name: 'gameEdit',
124
-            query: { id: res.data.gameId }
125
-          })
126
-        })
143
+        this.$message('请输入游戏名称和游戏类型')
127 144
       }
128 145
     },
129 146
     handleChange(val) {
@@ -132,6 +149,13 @@ export default {
132 149
     handleDeleteIcon() {
133 150
       this.gameForm.gameImage = ''
134 151
     },
152
+
153
+    // 特征页面方法
154
+    // 改变编辑特征页面的初始值
155
+    handleEditGameCharcter(val) {
156
+      this.characterId = val
157
+    },
158
+
135 159
     handleEdit(val) {
136 160
       this.questionId = val
137 161
     },

+ 2
- 29
src/views/gameManage/index.vue Näytä tiedosto

@@ -6,22 +6,6 @@
6 6
         size="mini"
7 7
         style="width: 200px; margin-right: 20px"
8 8
       />
9
-      特征库名称:
10
-      <el-select
11
-        v-model="libId"
12
-        size="mini"
13
-        filterable
14
-        default-first-option
15
-        placeholder="请选择"
16
-        style="width: 200px; margin-right: 20px"
17
-      >
18
-        <el-option
19
-          v-for="item in libList"
20
-          :key="item.libId"
21
-          :label="item.name"
22
-          :value="item.libId"
23
-        />
24
-      </el-select>
25 9
       创建时间:
26 10
       <el-date-picker
27 11
         v-model="daterange"
@@ -45,7 +29,6 @@
45 29
           <el-image :src="scope.row.gameImage" style="width: 100px; height: 100px" />
46 30
         </template>
47 31
       </el-table-column>
48
-      <el-table-column prop="characterName" label="特征库名称" />
49 32
       <el-table-column prop="createDate" label="创建时间">
50 33
         <template slot-scope="scope">{{
51 34
           scope.row.createDate.substr(0, 10)
@@ -68,29 +51,21 @@
68 51
   </div>
69 52
 </template>
70 53
 <script>
71
-import { getCharacterLibList } from '@/api/characterLib'
72 54
 import { getGameList, deleteGame } from '@/api/game'
73 55
 
74 56
 export default {
75 57
   data() {
76 58
     return {
77
-      libId: undefined,
59
+      characterId: undefined,
78 60
       title: undefined,
79 61
       daterange: undefined,
80 62
       tableData: [],
81 63
       endDate: undefined,
82
-      startDate: undefined,
83
-      libList: []
64
+      startDate: undefined
84 65
     }
85 66
   },
86 67
   mounted() {
87 68
     this.onSearch()
88
-    getCharacterLibList().then((res) => {
89
-      const list = res.data.records
90
-      list.map((item) => {
91
-        this.libList.push({ libId: item.libId, name: item.name })
92
-      })
93
-    })
94 69
   },
95 70
   methods: {
96 71
     handleAdd() {
@@ -110,7 +85,6 @@ export default {
110 85
     onSearch() {
111 86
       getGameList({
112 87
         title: this.title,
113
-        libId: this.libId,
114 88
         startDate: this.startDate,
115 89
         endDate: this.endDate
116 90
       }).then((res) => {
@@ -119,7 +93,6 @@ export default {
119 93
     },
120 94
     onReset() {
121 95
       this.title = undefined
122
-      this.libId = undefined
123 96
       this.daterange = undefined
124 97
       this.startDate = undefined
125 98
       this.endDate = undefined

+ 43
- 49
src/views/login/index.vue Näytä tiedosto

@@ -9,7 +9,7 @@
9 9
       label-position="left"
10 10
     >
11 11
       <div class="title-container">
12
-        <h3 class="title">Login Form</h3>
12
+        <h3 class="title">答题管理系统</h3>
13 13
       </div>
14 14
 
15 15
       <el-form-item prop="userName">
@@ -19,7 +19,7 @@
19 19
         <el-input
20 20
           ref="userName"
21 21
           v-model="loginForm.userName"
22
-          placeholder="Username"
22
+          placeholder="用户名"
23 23
           name="userName"
24 24
           type="text"
25 25
           tabindex="1"
@@ -36,7 +36,7 @@
36 36
           ref="password"
37 37
           v-model="loginForm.password"
38 38
           :type="passwordType"
39
-          placeholder="Password"
39
+          placeholder="密码"
40 40
           name="password"
41 41
           tabindex="2"
42 42
           auto-complete="on"
@@ -54,95 +54,89 @@
54 54
         type="primary"
55 55
         style="width: 100%; margin-bottom: 30px"
56 56
         @click.native.prevent="handleLogin"
57
-        >Login</el-button
58
-      >
59
-
60
-      <div class="tips">
61
-        <span style="margin-right: 20px">userName: admin</span>
62
-        <span> password: any</span>
63
-      </div>
57
+      >登录</el-button>
64 58
     </el-form>
65 59
   </div>
66 60
 </template>
67 61
 <script>
68
-import { validUsername } from "@/utils/validate";
69
-import md5 from "js-md5";
62
+import { validUsername } from '@/utils/validate'
63
+import md5 from 'js-md5'
70 64
 export default {
71
-  name: "Login",
65
+  name: 'Login',
72 66
   data() {
73 67
     const validateUsername = (rule, value, callback) => {
74 68
       if (!validUsername(value)) {
75
-        callback(new Error("Please enter the correct user name"));
69
+        callback(new Error('请输入用户名'))
76 70
       } else {
77
-        callback();
71
+        callback()
78 72
       }
79
-    };
73
+    }
80 74
     const validatePassword = (rule, value, callback) => {
81 75
       if (value.length < 6) {
82
-        callback(new Error("The password can not be less than 6 digits"));
76
+        callback(new Error('请输入密码'))
83 77
       } else {
84
-        callback();
78
+        callback()
85 79
       }
86
-    };
80
+    }
87 81
     return {
88 82
       loginForm: {
89
-        userName: "",
90
-        password: "",
83
+        userName: '',
84
+        password: ''
91 85
       },
92 86
       loginRules: {
93 87
         userName: [
94
-          { required: true, trigger: "blur", validator: validateUsername },
88
+          { required: true, trigger: 'blur', validator: validateUsername }
95 89
         ],
96 90
         password: [
97
-          { required: true, trigger: "blur", validator: validatePassword },
98
-        ],
91
+          { required: true, trigger: 'blur', validator: validatePassword }
92
+        ]
99 93
       },
100 94
       loading: false,
101
-      passwordType: "password",
102
-      redirect: undefined,
103
-    };
95
+      passwordType: 'password',
96
+      redirect: undefined
97
+    }
104 98
   },
105 99
   watch: {
106 100
     $route: {
107
-      handler: function (route) {
108
-        this.redirect = route.query && route.query.redirect;
101
+      handler: function(route) {
102
+        this.redirect = route.query && route.query.redirect
109 103
       },
110
-      immediate: true,
111
-    },
104
+      immediate: true
105
+    }
112 106
   },
113 107
   methods: {
114 108
     showPwd() {
115
-      if (this.passwordType === "password") {
116
-        this.passwordType = "";
109
+      if (this.passwordType === 'password') {
110
+        this.passwordType = ''
117 111
       } else {
118
-        this.passwordType = "password";
112
+        this.passwordType = 'password'
119 113
       }
120 114
       this.$nextTick(() => {
121
-        this.$refs.password.focus();
122
-      });
115
+        this.$refs.password.focus()
116
+      })
123 117
     },
124 118
     handleLogin() {
125 119
       this.$refs.loginForm.validate((valid) => {
126 120
         if (valid) {
127
-          this.loading = true;
128
-          this.loginForm.password = md5(this.loginForm.password);
121
+          this.loading = true
122
+          this.loginForm.password = md5(this.loginForm.password)
129 123
           this.$store
130
-            .dispatch("user/login", this.loginForm)
124
+            .dispatch('user/login', this.loginForm)
131 125
             .then(() => {
132
-              this.$router.push({ path: "/" });
133
-              this.loading = false;
126
+              this.$router.push({ path: '/' })
127
+              this.loading = false
134 128
             })
135 129
             .catch(() => {
136
-              this.loading = false;
137
-            });
130
+              this.loading = false
131
+            })
138 132
         } else {
139
-          console.log("error submit!!");
140
-          return false;
133
+          console.log('error submit!!')
134
+          return false
141 135
         }
142
-      });
143
-    },
144
-  },
145
-};
136
+      })
137
+    }
138
+  }
139
+}
146 140
 </script>
147 141
 
148 142
 <style lang="scss">

+ 0
- 111
src/views/questionList/edit.vue Näytä tiedosto

@@ -1,111 +0,0 @@
1
-<template>
2
-  <div class="body_edit">
3
-    <h2 style="text-align: center">题目编辑</h2>
4
-    <el-form ref="form" :model="form" label-width="150px" size="mini">
5
-      <el-form-item label="题目:">
6
-        <el-input v-model="form.title" type="textarea" />
7
-      </el-form-item>
8
-      <el-form-item label="题目类型:">
9
-        <el-select v-model="form.optType" placeholder="请选择">
10
-          <el-option label="单选题" value="1" />
11
-          <el-option label="多选题" value="2" />
12
-          <el-option label="判断题" value="3" />
13
-        </el-select>
14
-      </el-form-item>
15
-      <el-form-item label="答案:">
16
-        <el-button type="primary" @click="onAddAnswer">添加答案</el-button>
17
-
18
-        <div v-for="(answer, index) in form.answerList" :key="index">
19
-          <AddAnswer
20
-            :value="answer"
21
-            @change="handleChange"
22
-            @handleDelete="() => handleDelete(answer)"
23
-          />
24
-        </div>
25
-      </el-form-item>
26
-      <el-form-item label="正确选项:">
27
-        <!-- <el-input v-model="form.option"></el-input> -->
28
-        <!-- filterable可搜索 multiple可多选 default-first-option回车可选-->
29
-        <el-select
30
-          v-model="rightList"
31
-          multiple
32
-          filterable
33
-          default-first-option
34
-          placeholder="请选择"
35
-        >
36
-          <el-option
37
-            v-for="item in form.answerList"
38
-            :key="item.option"
39
-            :label="item.option"
40
-            :value="item.option"
41
-          />
42
-        </el-select>
43
-      </el-form-item>
44
-      <el-form-item>
45
-        <el-button type="primary" @click="onSubmit">确定</el-button>
46
-        <el-button @click="onCancel">取消</el-button>
47
-      </el-form-item>
48
-    </el-form>
49
-  </div>
50
-</template>
51
-<script>
52
-import AddAnswer from '@/components/AddAnswer/index.vue'
53
-import { saveQuestion } from '@/api/question'
54
-export default {
55
-  components: {
56
-    AddAnswer
57
-  },
58
-  data() {
59
-    return {
60
-      form: {
61
-        title: undefined,
62
-        optType: undefined,
63
-        answerList: [],
64
-        option: undefined
65
-      },
66
-      rightList: undefined
67
-    }
68
-  },
69
-  // 进入页面执行的方法
70
-  mounted: function() {
71
-    if (this.$route?.query.row) {
72
-      this.form.title = this.$route.query.row.title
73
-      this.form.optType = this.$route.query.row.optType
74
-    }
75
-  },
76
-
77
-  methods: {
78
-    // 添加答案按钮事件
79
-    onAddAnswer() {
80
-      this.form.answerList.push({
81
-        answerId: undefined,
82
-        questionId: undefined,
83
-        contentType: undefined,
84
-        content: undefined
85
-      })
86
-    },
87
-    onCancel() {
88
-      this.$router.go(-1)
89
-    },
90
-    onSubmit() {
91
-      this.form.option = this.rightList.toString()
92
-      saveQuestion(this.form).then((res) => {
93
-        console.log(res)
94
-      })
95
-    },
96
-    handleChange(answer) {
97
-      const index = this.form.answerList.indexOf(answer)
98
-      this.$set(this.form.answerList, index, answer)
99
-    },
100
-    handleDelete(answer) {
101
-      this.form.answerList.splice(this.form.answerList.indexOf(answer), 1)
102
-    }
103
-  }
104
-}
105
-</script>
106
-<style>
107
-.body_edit {
108
-  padding: 20px;
109
-  width: 1000px;
110
-}
111
-</style>

+ 0
- 137
src/views/questionList/index.vue Näytä tiedosto

@@ -1,137 +0,0 @@
1
-<template>
2
-  <div class="body">
3
-    <el-card class="box-card">
4
-      题目内容:<el-input
5
-        v-model="title"
6
-        style="width: 200px; margin-right: 20px"
7
-      />
8
-      题目类型:
9
-      <el-select
10
-        v-model="typeName"
11
-        placeholder="请选择"
12
-        clearable
13
-        style="width: 150px; margin-right: 20px"
14
-      >
15
-        <el-option
16
-          v-for="item in typeOptions"
17
-          :key="item.key"
18
-          :label="item.value"
19
-          :value="item.key"
20
-        />
21
-      </el-select>
22
-      状态:
23
-      <el-select
24
-        v-model="status"
25
-        placeholder="请选择"
26
-        clearable
27
-        style="width: 150px; margin-right: 20px"
28
-      >
29
-        <el-option
30
-          v-for="item in statusOptions"
31
-          :key="item.key"
32
-          :label="item.value"
33
-          :value="item.key"
34
-        />
35
-      </el-select>
36
-      <el-button type="primary" @click="onSearch">查询</el-button>
37
-      <el-button @click="onReset">重置</el-button>
38
-      <el-button type="primary" @click="handleAdd">添加问题</el-button>
39
-    </el-card>
40
-    <el-table stripe :data="tableData" border style="width: 100%">
41
-      <el-table-column prop="title" label="题目内容" />
42
-      <el-table-column prop="optType" label="题目类型">
43
-        <template slot-scope="scope">
44
-          {{ scope.row.optType===1?'单选题':scope.row.optType===2?'多选题':'判断题' }}
45
-        </template>
46
-      </el-table-column>
47
-      <el-table-column prop="status" label="状态" />
48
-      <el-table-column fixed="right" label="操作">
49
-        <template slot-scope="scope">
50
-          <el-button type="text">发布</el-button>
51
-          <el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
52
-          <el-button type="text">删除</el-button>
53
-        </template>
54
-      </el-table-column>
55
-    </el-table>
56
-  </div>
57
-</template>
58
-
59
-<script>
60
-export default {
61
-  data() {
62
-    return {
63
-      title: '',
64
-      typeOptions: [
65
-        {
66
-          key: 1,
67
-          value: '单选题'
68
-        },
69
-        {
70
-          key: 2,
71
-          value: '多选题'
72
-        },
73
-        {
74
-          key: 3,
75
-          value: '判断题'
76
-        }
77
-      ],
78
-      statusOptions: [
79
-        {
80
-          key: 1,
81
-          value: '已发布'
82
-        },
83
-        {
84
-          key: 0,
85
-          value: '未发布'
86
-        }
87
-      ],
88
-      typeName: '',
89
-      status: '',
90
-      tableData: [
91
-        {
92
-          title: '李寻欢是那部小说里的人物',
93
-          optType: 2,
94
-          status: '未发布'
95
-        },
96
-        {
97
-          title: '圆周率小数点后第六位是',
98
-          optType: 1,
99
-          status: '未发布'
100
-        },
101
-        {
102
-          title: '我们现在吃的大米是杂交水稻吗',
103
-          optType: 3,
104
-          status: '未发布'
105
-        },
106
-        {
107
-          title: '西游记里孙悟空号称齐天大圣那牛魔王称号是什么',
108
-          optType: 1,
109
-          status: '未发布'
110
-        }
111
-      ]
112
-    }
113
-  },
114
-  mounted() {
115
-  },
116
-  methods: {
117
-    handleAdd() {
118
-      this.$router.push({ path: 'questionList/edit' })
119
-    },
120
-    handleEdit(row) {
121
-      this.$router.push({ path: 'questionList/edit', query: { row: row }})
122
-    },
123
-    onSearch() {
124
-      console.log(this.title, this.typeName, this.status)
125
-    },
126
-    onReset() {
127
-      this.title = ''
128
-      this.typeName = ''
129
-      this.status = ''
130
-    }
131
-  }
132
-}
133
-</script>
134
-
135
-<style>
136
-
137
-</style>