修正游戏主题编辑无法输入的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 dialogType = 'new'
private record: IRewardData = {type: 0}
private record: IRewardData = { type: 0 }
private dialogVisible = false
private modalRules = {
rank: [{ required: true, message: '请输入排名', trigger: 'blur' }

View File

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