提交 4173243b authored 作者: matian's avatar matian

updates

上级 6fb8d8d8
...@@ -128,10 +128,10 @@ const handleCancel = () => { ...@@ -128,10 +128,10 @@ const handleCancel = () => {
} }
// 确认 // 确认
const handleConfirm = async (formEl: FormInstance | undefined) => { const handleConfirm = async (formEl: FormInstance | undefined) => {
loading.value = true
if (!formEl) return if (!formEl) return
await formEl.validate(valid => { await formEl.validate(valid => {
if (valid) { if (valid) {
loading.value = true
form.files = JSON.stringify(form.files) form.files = JSON.stringify(form.files)
const params: any = Object.assign({}, form) const params: any = Object.assign({}, form)
createPosts(params).then(() => { createPosts(params).then(() => {
......
...@@ -18,7 +18,7 @@ interface Emits { ...@@ -18,7 +18,7 @@ interface Emits {
(e: 'update:isShowReplyDialog', isShowReplyDialog: boolean): void (e: 'update:isShowReplyDialog', isShowReplyDialog: boolean): void
(e: 'create'): void (e: 'create'): void
} }
const loading = ref(false)
const form: any = reactive({ const form: any = reactive({
content: '', content: '',
files: [] files: []
...@@ -65,9 +65,13 @@ const handleConfirm = async (formEl: FormInstance | undefined) => { ...@@ -65,9 +65,13 @@ const handleConfirm = async (formEl: FormInstance | undefined) => {
if (!formEl) return if (!formEl) return
await formEl.validate(valid => { await formEl.validate(valid => {
if (valid) { if (valid) {
loading.value = true
form.files = JSON.stringify(form.files) form.files = JSON.stringify(form.files)
const params: any = Object.assign({ discussion_id: props.discussionId, reply_type: '1', reply_id: '' }, form) const params: any = Object.assign({ discussion_id: props.discussionId, reply_type: '1', reply_id: '' }, form)
replyPosts(params).then(() => { replyPosts(params).then(() => {
loading.value = false
emit('update:isShowReplyDialog', false) emit('update:isShowReplyDialog', false)
emit('create') emit('create')
}) })
...@@ -109,7 +113,7 @@ const handleConfirm = async (formEl: FormInstance | undefined) => { ...@@ -109,7 +113,7 @@ const handleConfirm = async (formEl: FormInstance | undefined) => {
<template #footer> <template #footer>
<span> <span>
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm(ruleFormRef)">确认</el-button> <el-button type="primary" @click="handleConfirm(ruleFormRef)" :loading="loading">确认</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论