修正游戏主题编辑无法输入的bug

This commit is contained in:
zhl 2021-06-09 20:08:22 +08:00
parent 01507e95fb
commit 8b06c58cac
2 changed files with 20 additions and 16 deletions

View File

@ -477,7 +477,7 @@ export default class extends Vue {
private tempTagView?: ITagView private tempTagView?: ITagView
private dialogType = 'new' private dialogType = 'new'
private record: IRewardData = {type: 0} private record: IRewardData = { type: 0 }
private dialogVisible = false private dialogVisible = false
private modalRules = { private modalRules = {
rank: [{ required: true, message: '请输入排名', trigger: 'blur' } rank: [{ required: true, message: '请输入排名', trigger: 'blur' }

View File

@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<el-form <el-form
ref="postForm" ref="postForm"
:model="postForm" :model="record"
:rules="rules" :rules="rules"
label-width="222px" label-width="222px"
class="form-container" class="form-container"
@ -11,14 +11,14 @@
prop="game_main_pic" prop="game_main_pic"
label="主页正中间图片" label="主页正中间图片"
> >
<upload-image v-model="postForm.game_main_pic"/> <upload-image v-model="record.game_main_pic"/>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
prop="bg_item_icon" prop="bg_item_icon"
label="背景图案" label="背景图案"
> >
<upload-image v-model="postForm.bg_item_icon"/> <upload-image v-model="record.bg_item_icon"/>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
@ -26,9 +26,9 @@
prop="game_single_btn" prop="game_single_btn"
> >
<el-input <el-input
v-model="postForm.game_single_btn" v-model="record.game_single_btn"
placeholder="主页上单人赛按钮文字" placeholder="主页上单人赛按钮文字"
name="game_single_btn" @input="inputBegin"
required required
/> />
</el-form-item> </el-form-item>
@ -37,9 +37,9 @@
prop="game_multi_btn" prop="game_multi_btn"
> >
<el-input <el-input
v-model="postForm.game_multi_btn" v-model="record.game_multi_btn"
placeholder="主页上多人赛按钮名字" placeholder="主页上多人赛按钮名字"
name="game_multi_btn" @input="inputBegin"
required required
/> />
</el-form-item> </el-form-item>
@ -102,7 +102,7 @@ export default class extends Vue {
} }
private shop = '' private shop = ''
private postForm: any = {} private record: any = {}
get userLevel() { get userLevel() {
return UserModule.level return UserModule.level
@ -121,18 +121,18 @@ export default class extends Vue {
} }
async created() { async created() {
this.postForm.shop = this.$route.params?.shop this.record.shop = this.$route.params?.shop
this.postForm.game = this.$route.params?.game this.record.game = this.$route.params?.game
this.postForm.version = this.$route.params?.version this.record.version = this.$route.params?.version
console.log(this.shop) console.log(this.shop)
await this.getRemoteData() await this.getRemoteData()
} }
async getRemoteData() { async getRemoteData() {
const { data } = await getGameTheme(this.postForm) const { data } = await getGameTheme(this.record)
this.postForm = Object.assign(this.postForm, data) this.record = Object.assign(this.record, data)
this.$forceUpdate() this.$forceUpdate()
console.log(this.postForm) console.log(this.record)
} }
private async onCancel() { private async onCancel() {
@ -152,7 +152,7 @@ export default class extends Vue {
private async saveVal() { private async saveVal() {
try { try {
await this.$refs.postForm.validate() await this.$refs.postForm.validate()
const { data } = await saveGameTheme(this.postForm) const { data } = await saveGameTheme(this.record)
this.$notify({ this.$notify({
title: 'Success', title: 'Success',
message: '操作成功', message: '操作成功',
@ -163,6 +163,10 @@ export default class extends Vue {
} }
} }
private inputBegin() {
this.$forceUpdate()
}
} }
</script> </script>