李志伟 vor 3 Jahren
Ursprung
Commit
8a55d7c32a

+ 12
- 0
src/api/person.js Datei anzeigen

@@ -8,3 +8,15 @@ import request from '@/utils/request'
8 8
 export const getPersonList = (params) => request({
9 9
   url: '/taPerson', params
10 10
 })
11
+
12
+/**
13
+* 导出表格
14
+* @param {*} data
15
+* @returns
16
+*/
17
+export const excelPerson = (params) => request({
18
+  url: '/taPerson',
19
+  method: 'post',
20
+  params,
21
+  responseType: 'blob'
22
+})

+ 0
- 108
src/components/GameCharacter/edit.vue Datei anzeigen

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

+ 0
- 146
src/components/GameCharacter/index.vue Datei anzeigen

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

+ 0
- 194
src/components/Question/drawer.vue Datei anzeigen

@@ -1,194 +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 label="匹配特征:" :label-width="formLabelWidth">
28
-            <el-select
29
-              v-model="form.characterList"
30
-              multiple
31
-              filterable
32
-              default-first-option
33
-              placeholder="请选择特征"
34
-              style="width:100%"
35
-            >
36
-              <el-option
37
-                v-for="item in wordList"
38
-                :key="item.characterId"
39
-                :label="item.name"
40
-                :value="item.characterId"
41
-              />
42
-            </el-select>
43
-          </el-form-item>
44
-          <el-form-item style="text-align:center">
45
-            <el-button @click="handleClose">取 消</el-button>
46
-            <el-button type="primary" @click="onSubmit('form')">确 定</el-button>
47
-          </el-form-item>
48
-        </el-form>
49
-      </div>
50
-    </el-drawer>
51
-  </div>
52
-</template>
53
-<script>
54
-import { getAnswerDetail, saveAnswer, UpdateAnswer } from '@/api/answer'
55
-export default {
56
-  props: {
57
-    dialog: Boolean,
58
-    questionId: String,
59
-    answerId: String,
60
-    gameId: String
61
-  },
62
-  data() {
63
-    return {
64
-      rules: {
65
-        content: [{ required: true, message: '请输入答案内容', trigger: 'blur' }]
66
-      },
67
-      form: {
68
-        option: undefined,
69
-        content: undefined,
70
-        characterList: [],
71
-        sortNo: 1,
72
-        status: 1
73
-      },
74
-      formLabelWidth: '120px',
75
-      options: [
76
-        {
77
-          value: 'A',
78
-          label: 'A'
79
-        },
80
-        {
81
-          value: 'B',
82
-          label: 'B'
83
-        },
84
-        {
85
-          value: 'C',
86
-          label: 'C'
87
-        },
88
-        {
89
-          value: 'D',
90
-          label: 'D'
91
-        },
92
-        {
93
-          value: 'true',
94
-          label: '对'
95
-        },
96
-        {
97
-          value: 'false',
98
-          label: '错'
99
-        }
100
-      ]
101
-    }
102
-  },
103
-  computed: {
104
-    wordList() {
105
-      return this.$store.state.game.wordList
106
-    }
107
-  },
108
-  watch: {
109
-    answerId() {
110
-      if (this.answerId) {
111
-        getAnswerDetail(this.answerId, { gameId: this.gameId }).then((res) => {
112
-          this.form = res.data
113
-          if (res.data.characterList) {
114
-            const list = []
115
-            res.data.characterList.map(item => {
116
-              list.push(item.characterId)
117
-            })
118
-            this.form.characterList = list
119
-          }
120
-        })
121
-      }
122
-    }
123
-  },
124
-  methods: {
125
-    onSubmit(form) {
126
-      this.$refs[form].validate((valid) => {
127
-        if (valid) {
128
-          if (this.form.option) {
129
-            const list = this.wordList.filter(item => this.form.characterList.includes(item.characterId))
130
-            const data = { ...this.form }
131
-            if (list) {
132
-              list.map(item => {
133
-                item.gameId = this.gameId
134
-              })
135
-              data.characterList = list
136
-            }
137
-            switch (data.option) {
138
-              case 'A':data.sortNo = 1; break
139
-              case 'B':data.sortNo = 2; break
140
-              case 'C':data.sortNo = 3; break
141
-              case 'D':data.sortNo = 4; break
142
-              case 'E':data.sortNo = 5; break
143
-              case 'F':data.sortNo = 6; break
144
-              case 'G':data.sortNo = 7; break
145
-              case 'H':data.sortNo = 8; break
146
-              case 'I':data.sortNo = 9; break
147
-              case 'J':data.sortNo = 10; break
148
-              case 'true':data.sortNo = 1; break
149
-              case 'false':data.sortNo = 2; break
150
-              default:break
151
-            }
152
-            if (this.answerId) {
153
-              UpdateAnswer(data, this.answerId).then((res) => {
154
-                this.$message('修改成功')
155
-                this.$emit('handleEditDrawer', true)
156
-                this.form = {
157
-                  option: undefined,
158
-                  content: undefined,
159
-                  characterList: []
160
-                }
161
-              })
162
-            } else {
163
-              data.questionId = this.questionId
164
-              saveAnswer(data).then((res) => {
165
-                this.$message('添加成功')
166
-                this.$emit('handleEditDrawer', true)
167
-                this.form = {
168
-                  option: undefined,
169
-                  content: undefined,
170
-                  characterList: []
171
-                }
172
-              })
173
-            }
174
-          } else {
175
-            this.$message('请在灰色下来菜单中添加选项')
176
-          }
177
-        } else {
178
-          return false
179
-        }
180
-      })
181
-    },
182
-    handleClose() {
183
-      this.$emit('handleCloseDrawer', true)
184
-      this.form = {
185
-        option: undefined,
186
-        content: undefined,
187
-        characterList: []
188
-      }
189
-    }
190
-  }
191
-}
192
-</script>
193
-<style>
194
-</style>

+ 0
- 282
src/components/Question/edit.vue Datei anzeigen

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

+ 0
- 169
src/components/Question/index.vue Datei anzeigen

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

+ 0
- 68
src/components/UploadImage/index.vue Datei anzeigen

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

+ 0
- 2
src/main.js Datei anzeigen

@@ -13,7 +13,6 @@ import store from './store'
13 13
 import router from './router'
14 14
 
15 15
 import '@/icons' // icon
16
-
17 16
 /**
18 17
  * If you don't want to use mock-server
19 18
  * you want to use MockJs for mock api
@@ -31,7 +30,6 @@ import '@/icons' // icon
31 30
 // Vue.use(ElementUI, { locale })
32 31
 // 如果想要中文版 element-ui,按如下方式声明
33 32
 Vue.use(ElementUI)
34
-
35 33
 Vue.config.productionTip = false
36 34
 
37 35
 new Vue({

+ 8
- 0
src/utils/download.js Datei anzeigen

@@ -0,0 +1,8 @@
1
+export function downloadBlob(blob, fileName) {
2
+  const url = window.URL.createObjectURL(blob)
3
+  const link = document.createElement('a')
4
+  link.href = url
5
+  link.setAttribute('download', fileName)
6
+  link.click()
7
+  window.URL.revokeObjectURL(url)
8
+}

+ 8
- 3
src/utils/request.js Datei anzeigen

@@ -1,6 +1,7 @@
1 1
 import axios from 'axios'
2 2
 import { Message } from 'element-ui'
3 3
 import store from '@/store'
4
+import { downloadBlob } from './download'
4 5
 
5 6
 // create an axios instance
6 7
 const service = axios.create({
@@ -18,7 +19,6 @@ service.interceptors.request.use(
18 19
       // let each request carry token
19 20
       // ['X-Token'] is a custom headers key
20 21
       // please modify it according to the actual situation
21
-  
22 22
     }
23 23
     return config
24 24
   },
@@ -43,8 +43,13 @@ service.interceptors.response.use(
43 43
    */
44 44
   response => {
45 45
     const res = response.data
46
-    // if the custom code is not 20000, it is judged as an error.
47
-    if (res.code !== 1000) {
46
+    const contextType = response.headers['content-type']
47
+    if (contextType.indexOf('application/vnd.ms-excel') > -1) {
48
+      const data = new Blob([res])
49
+      const content = response.headers['content-disposition']
50
+      const fileName = content.replace('attachment;filename=', '')
51
+      downloadBlob(data, decodeURIComponent(fileName))
52
+    } else if (res.code !== 1000) {
48 53
       Message({
49 54
         message: res.message || 'Error',
50 55
         type: 'error',

+ 5
- 2
src/views/person/index.vue Datei anzeigen

@@ -15,6 +15,7 @@
15 15
       <div style="float:right">
16 16
         <el-button type="primary" @click="onSearch">查询</el-button>
17 17
         <el-button @click="onReset">重置</el-button>
18
+        <el-button @click="excelOut">导出</el-button>
18 19
       </div>
19 20
     </el-card>
20 21
     <el-table stripe :data="tableData" border style="width: 100%">
@@ -43,8 +44,7 @@
43 44
   </div>
44 45
 </template>
45 46
 <script>
46
-import { getPersonList } from '@/api/person'
47
-
47
+import { getPersonList, excelPerson } from '@/api/person'
48 48
 export default {
49 49
   data() {
50 50
     return {
@@ -105,6 +105,9 @@ export default {
105 105
     dateChange(val) {
106 106
       this.startDate = this.daterange[0]
107 107
       this.endDate = this.daterange[1]
108
+    },
109
+    excelOut() {
110
+      excelPerson({ startDate: this.startDate, endDate: this.endDate })
108 111
     }
109 112
   }
110 113
 }

+ 13
- 0
yarn.lock Datei anzeigen

@@ -4749,6 +4749,7 @@ file-loader@^4.2.0:
4749 4749
     loader-utils "^1.2.3"
4750 4750
     schema-utils "^2.5.0"
4751 4751
 
4752
+
4752 4753
 file-uri-to-path@1.0.0:
4753 4754
   version "1.0.0"
4754 4755
   resolved "https://registry.npmmirror.com/file-uri-to-path/download/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
@@ -9092,6 +9093,11 @@ raw-body@2.4.2, raw-body@^2.2.0:
9092 9093
     iconv-lite "0.4.24"
9093 9094
     unpipe "1.0.0"
9094 9095
 
9096
+raw-loader@~0.5.1:
9097
+  version "0.5.1"
9098
+  resolved "https://registry.npmmirror.com/raw-loader/download/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa"
9099
+  integrity sha1-DD0L6u2KAclm2Xh793goElKpeao=
9100
+
9095 9101
 react-is@^16.8.4:
9096 9102
   version "16.13.1"
9097 9103
   resolved "https://registry.npmmirror.com/react-is/download/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
@@ -9601,6 +9607,13 @@ script-ext-html-webpack-plugin@2.1.3:
9601 9607
   dependencies:
9602 9608
     debug "^4.1.0"
9603 9609
 
9610
+script-loader@^0.7.2:
9611
+  version "0.7.2"
9612
+  resolved "https://registry.npmmirror.com/script-loader/download/script-loader-0.7.2.tgz#2016db6f86f25f5cf56da38915d83378bb166ba7"
9613
+  integrity sha1-IBbbb4byX1z1baOJFdgzeLsWa6c=
9614
+  dependencies:
9615
+    raw-loader "~0.5.1"
9616
+
9604 9617
 sdk-base@^2.0.1:
9605 9618
   version "2.0.1"
9606 9619
   resolved "https://registry.npmmirror.com/sdk-base/download/sdk-base-2.0.1.tgz#ba40289e8bdf272ed11dd9ea97eaf98e036d24c6"