perf: optimize the SheetSettingModel component style (halo-dev/console#471)

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/3445/head
Ryan Wang 2022-02-26 12:06:40 +08:00 committed by GitHub
parent 3d963c8a2a
commit b0ca8b8a30
3 changed files with 21 additions and 22 deletions

View File

@ -27,7 +27,7 @@
</a-row> </a-row>
<SheetSettingModal <SheetSettingModal
:post="sheetToStage" :sheet="sheetToStage"
:savedCallback="onSheetSavedCallback" :savedCallback="onSheetSavedCallback"
:visible.sync="sheetSettingVisible" :visible.sync="sheetSettingVisible"
@onUpdate="onUpdateFromSetting" @onUpdate="onUpdateFromSetting"

View File

@ -244,7 +244,7 @@
</div> </div>
<SheetSettingModal <SheetSettingModal
:loading="sheetSettingLoading" :loading="sheetSettingLoading"
:post="selectedSheet" :sheet="selectedSheet"
:savedCallback="onSheetSavedCallback" :savedCallback="onSheetSavedCallback"
:visible.sync="sheetSettingVisible" :visible.sync="sheetSettingVisible"
@onClose="selectedSheet = {}" @onClose="selectedSheet = {}"

View File

@ -68,21 +68,20 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="封面图:"> <a-form-item label="封面图:">
<div class="post-thumb"> <a-space direction="vertical">
<a-space direction="vertical"> <img
<img :src="form.model.thumbnail || '/images/placeholder.jpg'"
:src="form.model.thumbnail || '/images/placeholder.jpg'" alt="Sheet cover thumbnail"
alt="Post cover thumbnail" class="w-1/2 cursor-pointer"
class="img" style="border-radius: 4px"
@click="attachmentSelectVisible = true" @click="attachmentSelectVisible = true"
/> />
<a-input <a-input
v-model="form.model.thumbnail" v-model="form.model.thumbnail"
allow-clear allow-clear
placeholder="点击封面图选择图片,或者输入外部链接" placeholder="点击封面图选择图片,或者输入外部链接"
></a-input> ></a-input>
</a-space> </a-space>
</div>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-tab-pane> </a-tab-pane>
@ -113,7 +112,6 @@
</div> </div>
<template slot="footer"> <template slot="footer">
<slot name="extraFooter" /> <slot name="extraFooter" />
<a-button :disabled="loading" @click="modalVisible = false"> 关闭</a-button>
<ReactiveButton <ReactiveButton
v-if="!form.model.id" v-if="!form.model.id"
:errored="form.draftSaveErrored" :errored="form.draftSaveErrored"
@ -134,6 +132,7 @@
@callback="handleSavedCallback" @callback="handleSavedCallback"
@click="handleCreateOrUpdate()" @click="handleCreateOrUpdate()"
></ReactiveButton> ></ReactiveButton>
<a-button :disabled="loading" @click="modalVisible = false">关闭</a-button>
</template> </template>
<AttachmentSelectModal <AttachmentSelectModal
:multiSelect="false" :multiSelect="false"
@ -168,7 +167,7 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
post: { sheet: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
}, },
@ -229,13 +228,13 @@ export default {
watch: { watch: {
modalVisible(value) { modalVisible(value) {
if (value) { if (value) {
this.form.model = Object.assign({}, this.post) this.form.model = Object.assign({}, this.sheet)
if (!this.form.model.slug && !this.form.model.id) { if (!this.form.model.slug && !this.form.model.id) {
this.handleGenerateSlug() this.handleGenerateSlug()
} }
} }
}, },
post: { sheet: {
deep: true, deep: true,
handler(value) { handler(value) {
this.form.model = Object.assign({}, value) this.form.model = Object.assign({}, value)
@ -247,7 +246,7 @@ export default {
}, },
methods: { methods: {
/** /**
* Creates or updates a post * Creates or updates a sheet
*/ */
async handleCreateOrUpdate(preStatus = 'PUBLISHED') { async handleCreateOrUpdate(preStatus = 'PUBLISHED') {
if (!this.form.model.title) { if (!this.form.model.title) {