|
|
@@ -37,47 +37,49 @@ export default {
|
|
|
immediate: true
|
|
|
}
|
|
|
},
|
|
|
+ beforeRouteLeave (to, from, next) {
|
|
|
+ window.close()
|
|
|
+ next(false)
|
|
|
+ },
|
|
|
methods: {
|
|
|
getProgram () {
|
|
|
this.loading = true
|
|
|
this.error = null
|
|
|
- getProgram(this.id, { custom: true }).then(({ data }) => {
|
|
|
- try {
|
|
|
- const { id, status, name, resolutionRatio, itemJsonStr } = data
|
|
|
- const [width, height] = resolutionRatio.split('x')
|
|
|
- if (!width || !height) {
|
|
|
- this.showMessage('warning', '布局分辨率异常')
|
|
|
- return
|
|
|
- }
|
|
|
+ getProgram(this.id, { custom: true }).then(
|
|
|
+ ({ data }) => {
|
|
|
+ try {
|
|
|
+ const { id, status, name, resolutionRatio, itemJsonStr } = data
|
|
|
+ const [width, height] = resolutionRatio.split('x')
|
|
|
+ if (!width || !height) {
|
|
|
+ return this.showMessage('error', '布局分辨率异常,请联系管理员')
|
|
|
+ }
|
|
|
|
|
|
- if (status === State.READY) {
|
|
|
- if (this.accessSet.has(Access.MANAGE_CALENDAR)) {
|
|
|
- this.activeComponent = 'Designer'
|
|
|
+ if (status === State.READY) {
|
|
|
+ if (this.accessSet.has(Access.MANAGE_CALENDAR)) {
|
|
|
+ this.activeComponent = 'Designer'
|
|
|
+ } else {
|
|
|
+ return this.showMessage('warning', '暂无编辑权限,请联系管理员')
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.$message({
|
|
|
- type: 'warning',
|
|
|
- message: '暂无编辑权限'
|
|
|
- })
|
|
|
this.activeComponent = 'Viewer'
|
|
|
}
|
|
|
- } else {
|
|
|
- this.activeComponent = 'Viewer'
|
|
|
- }
|
|
|
|
|
|
- this.program = {
|
|
|
- id, status, name, resolutionRatio,
|
|
|
- detail: {
|
|
|
- width: Number(width),
|
|
|
- height: Number(height),
|
|
|
- ...JSON.parse(itemJsonStr)
|
|
|
+ this.program = {
|
|
|
+ id, status, name, resolutionRatio,
|
|
|
+ detail: {
|
|
|
+ width: Number(width),
|
|
|
+ height: Number(height),
|
|
|
+ ...JSON.parse(itemJsonStr)
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (e) {
|
|
|
+ this.showMessage('error', '布局解析失败')
|
|
|
}
|
|
|
- } catch (e) {
|
|
|
- this.showMessage('error', '布局解析失败')
|
|
|
+ },
|
|
|
+ err => {
|
|
|
+ this.showMessage('warning', err.errMessage || '获取布局失败')
|
|
|
}
|
|
|
- }, err => {
|
|
|
- this.showMessage('error', err.errMessage || '获取布局失败')
|
|
|
- }).finally(() => {
|
|
|
+ ).finally(() => {
|
|
|
this.loading = false
|
|
|
})
|
|
|
},
|
|
|
@@ -89,7 +91,7 @@ export default {
|
|
|
if (this.loading) {
|
|
|
return h('div', {
|
|
|
key: 'loading',
|
|
|
- class: 'c-ast c-lock',
|
|
|
+ class: 'c-ast',
|
|
|
directives: [
|
|
|
{
|
|
|
name: 'loading',
|
|
|
@@ -107,20 +109,19 @@ export default {
|
|
|
const { type, message } = this.error
|
|
|
return h('div', {
|
|
|
key: 'error',
|
|
|
- class: `c-ast c-lock ${type}`,
|
|
|
- directives: [
|
|
|
- {
|
|
|
- name: 'loading',
|
|
|
- value: true,
|
|
|
- modifiers: { lock: true }
|
|
|
- }
|
|
|
- ],
|
|
|
- attrs: {
|
|
|
- 'element-loading-text': `${message}`,
|
|
|
- 'element-loading-spinner': `el-icon-${type}`,
|
|
|
- 'element-loading-background': 'rgba(0, 0, 0, 0.8)'
|
|
|
- }
|
|
|
- })
|
|
|
+ class: `c-ast ${type}`
|
|
|
+ }, [
|
|
|
+ h('div', { staticClass: 'el-loading-spinner' }, [
|
|
|
+ h('i', { staticClass: `el-icon-${type}` }),
|
|
|
+ h('p', { staticClass: 'el-loading-text' }, message),
|
|
|
+ type === 'warning'
|
|
|
+ ? h('el-link', {
|
|
|
+ props: { type },
|
|
|
+ on: { click: this.getProgram }
|
|
|
+ }, '点击重试')
|
|
|
+ : null
|
|
|
+ ])
|
|
|
+ ])
|
|
|
}
|
|
|
|
|
|
return h(this.activeComponent, {
|
|
|
@@ -136,5 +137,28 @@ export default {
|
|
|
.c-ast {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
+ background-color: rgba(0, 0, 0, 0.8);
|
|
|
+
|
|
|
+ .el-loading-spinner > i {
|
|
|
+ font-size: 48px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-loading-text {
|
|
|
+ margin: 10px;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 18px;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.warning {
|
|
|
+ .el-loading-spinner > i {
|
|
|
+ color: $warning;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ &.error {
|
|
|
+ .el-loading-spinner > i {
|
|
|
+ color: $error;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|