浏览代码

游戏模块v1.1

李志伟 3 年前
父节点
当前提交
8ffe1f7959

+ 7
- 6
src/components/GameCharacter/edit.vue 查看文件

71
   },
71
   },
72
   methods: {
72
   methods: {
73
     onSubmit() {
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
         if (this.characterId) {
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
             this.$message('修改实例成功')
82
             this.$message('修改实例成功')
82
             // 告诉父页面实例表需要刷新
83
             // 告诉父页面实例表需要刷新
83
             this.$emit('handleRefreshGameCharacter', true)
84
             this.$emit('handleRefreshGameCharacter', true)
84
           })
85
           })
85
         } else {
86
         } else {
86
-          saveGameCharacter(this.form).then((res) => {
87
+          saveGameCharacter(data).then((res) => {
87
             this.$message('添加实例成功')
88
             this.$message('添加实例成功')
88
             // 告诉父页面实例表需要刷新
89
             // 告诉父页面实例表需要刷新
89
             this.$emit('handleRefreshGameCharacter', true)
90
             this.$emit('handleRefreshGameCharacter', true)

+ 7
- 6
src/components/Question/edit.vue 查看文件

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

+ 4
- 3
src/views/gameManage/edit.vue 查看文件

133
     onSubmit() {
133
     onSubmit() {
134
       if (this.gameForm.title && this.gameForm.resultMode) {
134
       if (this.gameForm.title && this.gameForm.resultMode) {
135
         if (this.gameId) {
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
             this.$message('修改成功')
141
             this.$message('修改成功')
141
             this.$router.go(-1)
142
             this.$router.go(-1)
142
           })
143
           })

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

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