|
|
@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<div style="position: absolute; right: 0; top: 2px;"> |
|
|
|
<el-button size="mini"> |
|
|
|
<el-button size="mini" @click="toVerifyOrLink"> |
|
|
|
<i class="iconfont icon-sulan" /> |
|
|
|
大屏预览 |
|
|
|
</el-button> |
|
|
@ -29,8 +29,8 @@ |
|
|
|
<el-dialog class="tip-dialog tip-middle-dialog" title="大屏预览网址" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="previewDialog" :before-close="handleClose"> |
|
|
|
<div class="setting-dialog"> |
|
|
|
<el-form ref="form" :model="form" :rules="rules"> |
|
|
|
<el-form-item label="网址" label-width="110px" prop="link"> |
|
|
|
<el-input v-model="form.link" style="width: 480px;" /> |
|
|
|
<el-form-item label="网址" label-width="110px" prop="preview_url"> |
|
|
|
<el-input v-model="form.preview_url" style="width: 480px;" /> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
@ -45,13 +45,18 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { FetchEditScreenSetting } from '@/api/digitalScreen/index' |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
import { encrypt } from '@/utils/rsaEncrypt' |
|
|
|
import { verifyMaintenance } from '@/api/system/param' |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'PreviewSetting', |
|
|
|
components: { |
|
|
|
props: { |
|
|
|
previewUrlParent: { |
|
|
|
type: String, |
|
|
|
default: null |
|
|
|
} |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
@ -64,10 +69,10 @@ export default { |
|
|
|
resetLoading: false, |
|
|
|
previewDialog: false, |
|
|
|
form: { |
|
|
|
link: '' |
|
|
|
preview_url: '' |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
link: [ |
|
|
|
preview_url: [ |
|
|
|
{ required: true, message: '网址不可为空', trigger: 'blur' } |
|
|
|
] |
|
|
|
} |
|
|
@ -78,31 +83,28 @@ export default { |
|
|
|
'baseApi' |
|
|
|
]) |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
previewUrlParent(newVal) { |
|
|
|
this.form.preview_url = newVal |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.form.preview_url = this.previewUrlParent |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
toVerifyOrLink() { |
|
|
|
console.log(' this.previewUrlParent', this.previewUrlParent) |
|
|
|
if (this.previewUrlParent && (this.previewUrlParent !== null || this.previewUrlParent !== '')) { |
|
|
|
window.open(this.previewUrlParent, '_blank') |
|
|
|
} else { |
|
|
|
this.toVerify('reset') |
|
|
|
} |
|
|
|
}, |
|
|
|
toVerify(btn) { |
|
|
|
this.verifyStatus = btn |
|
|
|
this.verifyDialogVisible = true |
|
|
|
// if (btn === 'reset') { |
|
|
|
// this.verifyDialogVisible = true |
|
|
|
// } else { |
|
|
|
// if (this.form.ip) { |
|
|
|
// if (this.showVerifyDialog) { |
|
|
|
// this.verifyDialogVisible = true |
|
|
|
// return false |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// this.$refs.form.validateField(['ip'], err => { |
|
|
|
// console.log('err', err) |
|
|
|
// if (err) { |
|
|
|
// return |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// } |
|
|
|
// } |
|
|
|
}, |
|
|
|
handleConfirm() { |
|
|
|
verifyMaintenance(encrypt(this.verfiyForm.verifyCode)).then((res) => { |
|
|
@ -111,17 +113,12 @@ export default { |
|
|
|
this.verfiyForm.verifyCode = '' |
|
|
|
this.showVerifyDialog = false |
|
|
|
this.previewDialog = true |
|
|
|
// if (this.verifyStatus === 'add') { |
|
|
|
// crudStockTask.FetchEditSetting(this.crud.form).then(res => { |
|
|
|
// this.$message({ message: '修改成功', type: 'success', offset: 8 }) |
|
|
|
// this.initData() |
|
|
|
// }).catch(() => { |
|
|
|
// }) |
|
|
|
// } else { |
|
|
|
// this.resetLoading = true |
|
|
|
// // 重启服务 |
|
|
|
// this.handleConnectAIService() |
|
|
|
// } |
|
|
|
|
|
|
|
if (this.previewUrlParent !== null || this.previewUrlParent !== '') { |
|
|
|
this.form.preview_url = this.previewUrlParent |
|
|
|
} else { |
|
|
|
this.form.preview_url = '' |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message({ message: '验证码错误!', type: 'error', offset: 8 }) |
|
|
|
} |
|
|
@ -130,9 +127,25 @@ export default { |
|
|
|
handleUrlConfirm() { |
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
console.log('submit!') |
|
|
|
this.previewDialog = false |
|
|
|
this.form.link = '' |
|
|
|
const param = { |
|
|
|
'code': 'preview_url', |
|
|
|
'context': this.form.preview_url, |
|
|
|
'remarks': null |
|
|
|
} |
|
|
|
FetchEditScreenSetting(param) |
|
|
|
.then((res) => { |
|
|
|
if (res.code !== 500) { |
|
|
|
this.$message.success('大屏预览地址更新成功') |
|
|
|
this.$emit('triggerInit') |
|
|
|
} else { |
|
|
|
this.$message.error('大屏预览地址更新失败') |
|
|
|
} |
|
|
|
this.handleClose() |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
this.$message.error('大屏预览地址更新失败') |
|
|
|
this.handleClose() |
|
|
|
}) |
|
|
|
} else { |
|
|
|
console.log('error submit!!') |
|
|
|
return false |
|
|
@ -147,7 +160,7 @@ export default { |
|
|
|
} |
|
|
|
if (this.$refs.form) { |
|
|
|
this.previewDialog = false |
|
|
|
this.form.link = '' |
|
|
|
this.form.preview_url = '' |
|
|
|
this.$refs.form.resetFields() |
|
|
|
} |
|
|
|
} |
|
|
|