Refine multi-platform publishing status handling
This commit is contained in:
@@ -26,7 +26,14 @@
|
||||
|
||||
<el-card shadow="never" class="publish-card">
|
||||
<div class="list-toolbar">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true" size="small" class="query-form">
|
||||
<el-form
|
||||
ref="queryForm"
|
||||
:model="queryParams"
|
||||
:inline="true"
|
||||
size="small"
|
||||
class="query-form"
|
||||
@submit.native.prevent="handleQuery"
|
||||
>
|
||||
<el-form-item prop="codeName">
|
||||
<el-input
|
||||
v-model="queryParams.codeName"
|
||||
@@ -34,7 +41,6 @@
|
||||
clearable
|
||||
placeholder="搜索项目名称"
|
||||
prefix-icon="el-icon-search"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@@ -491,13 +497,11 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('YIDAIMA_EXTENSION_READY', this.handleExtensionReady)
|
||||
window.addEventListener('YIDAIMA_PUBLISH_STATUS', this.handleExtensionStatus)
|
||||
window.addEventListener('YIDAIMA_PUBLISH_ACCEPTED', this.handlePublishAccepted)
|
||||
this.pingExtension()
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.removeEventListener('YIDAIMA_EXTENSION_READY', this.handleExtensionReady)
|
||||
window.removeEventListener('YIDAIMA_PUBLISH_STATUS', this.handleExtensionStatus)
|
||||
window.removeEventListener('YIDAIMA_PUBLISH_ACCEPTED', this.handlePublishAccepted)
|
||||
if (this.extensionTimer) clearTimeout(this.extensionTimer)
|
||||
},
|
||||
@@ -573,7 +577,7 @@ export default {
|
||||
this.handleQuery()
|
||||
},
|
||||
statusMeta(status) {
|
||||
return status === 'SUCCEEDED' ? PUBLISHED_STATUS_META : UNPUBLISHED_STATUS_META
|
||||
return status ? PUBLISHED_STATUS_META : UNPUBLISHED_STATUS_META
|
||||
},
|
||||
isEmptyPublishTime(value) {
|
||||
return !value || String(value).indexOf('1970-01-01') === 0
|
||||
@@ -594,24 +598,6 @@ export default {
|
||||
this.extensionConnected = true
|
||||
this.extensionVersion = detail.version || ''
|
||||
},
|
||||
handleExtensionStatus(event) {
|
||||
const detail = event && event.detail
|
||||
if (!detail || detail.source !== 'yidaima-publisher-extension') return
|
||||
this.getList()
|
||||
if (detail.status === 'READY_TO_PUBLISH') {
|
||||
this.$notify.success({
|
||||
title: '资料填写完成',
|
||||
message: '请在' + (PLATFORM_NAMES[detail.platform] || '平台') + '页面检查后手动发布',
|
||||
duration: 6000
|
||||
})
|
||||
} else if (detail.status === 'FAILED' || detail.status === 'LOGIN_REQUIRED') {
|
||||
this.$notify.warning({
|
||||
title: detail.status === 'FAILED' ? '发布准备失败' : '需要登录',
|
||||
message: detail.message || '请前往平台页面处理',
|
||||
duration: 6000
|
||||
})
|
||||
}
|
||||
},
|
||||
handlePublishAccepted(event) {
|
||||
const detail = event && event.detail
|
||||
if (!detail || detail.source !== 'yidaima-publisher-extension') return
|
||||
|
||||
Reference in New Issue
Block a user