李志伟 3 anni fa
parent
commit
8ffe1f7959

+ 7
- 6
src/components/GameCharacter/edit.vue Vedi File

@@ -71,19 +71,20 @@ export default {
71 71
   },
72 72
   methods: {
73 73
     onSubmit() {
74
-      this.form.characterId = this.characterId
75
-      if (this.form.name) {
74
+      const data = { ...this.form }
75
+      data.characterId = this.characterId
76
+      if (data.name) {
76 77
         if (this.characterId) {
77
-          if (!this.form.thumb) {
78
-            this.form.thumb = ''
78
+          if (!data.thumb) {
79
+            data.thumb = ''
79 80
           }
80
-          UpdateGameCharacter(this.form, this.characterId).then((res) => {
81
+          UpdateGameCharacter(data, this.characterId).then((res) => {
81 82
             this.$message('修改实例成功')
82 83
             // 告诉父页面实例表需要刷新
83 84
             this.$emit('handleRefreshGameCharacter', true)
84 85
           })
85 86
         } else {
86
-          saveGameCharacter(this.form).then((res) => {
87
+          saveGameCharacter(data).then((res) => {
87 88
             this.$message('添加实例成功')
88 89
             // 告诉父页面实例表需要刷新
89 90
             this.$emit('handleRefreshGameCharacter', true)

+ 7
- 6
src/components/Question/edit.vue Vedi File

@@ -18,6 +18,7 @@
18 18
         <!-- filterable可搜索 multiple可多选 default-first-option回车可选-->
19 19
         <el-select
20 20
           v-model="form.rightAnswer"
21
+          style="width:100%"
21 22
           multiple
22 23
           filterable
23 24
           default-first-option
@@ -172,19 +173,19 @@ export default {
172 173
     },
173 174
     onSubmit() {
174 175
       if (this.form.title && this.form.optType) {
175
-        this.form.gameId = this.gameId
176
+        const data = { ...this.form }
177
+        data.gameId = this.gameId
176 178
         if (this.questionId) {
177
-          if (this.form.rightAnswer) {
178
-            this.form.rightAnswer = this.form.rightAnswer.toString()
179
+          if (data.rightAnswer) {
180
+            data.rightAnswer = data.rightAnswer.toString()
179 181
           }
180
-          UpdateQuestion(this.form, this.questionId).then((res) => {
182
+          UpdateQuestion(data, this.questionId).then((res) => {
181 183
             this.$message('修改问题成功')
182 184
             // 告诉父页面实例表需要刷新并且关闭当前组件
183 185
             this.$emit('handleRefreshQuestion', true)
184
-            this.form.rightAnswer = res.data.rightAnswer?.split(',')
185 186
           })
186 187
         } else {
187
-          saveQuestion(this.form).then((res) => {
188
+          saveQuestion(data).then((res) => {
188 189
             this.$message('添加问题成功')
189 190
             // 告诉父页面实例表需要刷新并且关闭当前组件
190 191
             this.$emit('handleRefreshQuestion', true)

+ 4
- 3
src/views/gameManage/edit.vue Vedi File

@@ -133,10 +133,11 @@ export default {
133 133
     onSubmit() {
134 134
       if (this.gameForm.title && this.gameForm.resultMode) {
135 135
         if (this.gameId) {
136
-          if (!this.gameForm.gameImage) {
137
-            this.gameForm.gameImage = ''
136
+          const data = { ...this.gameForm }
137
+          if (!data.gameImage) {
138
+            data.gameImage = ''
138 139
           }
139
-          UpdateGame(this.gameForm, this.gameId).then((res) => {
140
+          UpdateGame(data, this.gameId).then((res) => {
140 141
             this.$message('修改成功')
141 142
             this.$router.go(-1)
142 143
           })

+ 1
- 0
src/views/gameManage/index.vue Vedi File

@@ -53,6 +53,7 @@
53 53
       style="float:right; margin:20px 0"
54 54
       :total="gameTotal"
55 55
       :current-page="currentPage"
56
+      :page-sizes="[4, 10, 20, 50]"
56 57
       :page-size="pageSize"
57 58
       layout="total, prev, pager, next, sizes"
58 59
       @size-change="handleSizeChange"