diff --git a/nezha-fronted/src/assets/css/common.scss b/nezha-fronted/src/assets/css/common.scss
index 12bdda464..95f54262b 100644
--- a/nezha-fronted/src/assets/css/common.scss
+++ b/nezha-fronted/src/assets/css/common.scss
@@ -439,20 +439,36 @@ input,
textarea {
font-family: Inter-Regular !important;
}
-.message-next {
- vertical-align: bottom;
- float: unset;
- font-size: 10px;
- margin-left: 190px;
- .message-next-continue {
- color: $--color-text-primary;
- font-weight: 400;
+.custom-message{
+ display: flex;
+ align-items: center;
+ .message-right {
+ padding-right: 128px;
+ position: relative;
}
- .message-next-content {
- color: $--color-text-link;
- font-weight: 600;
+ .message-right.hidden{
+ display: none;
+ }
+ .message-next {
+ width: 86px;
+ height: 24px;
+ line-height: 24px;
+ text-align: center;
+ border:1px solid $--message-success-font-color;
+ border-radius: 4px;
+ position: absolute;
+ right: 10px;
+ top: 0;
+ bottom: 0;
+ margin: auto;
+ cursor: pointer;
+ font-size: 14px;
+ span{
+ font-size: 12px;
+ }
}
}
+
.document-copy-block {
display: flex;
flex-wrap: nowrap;
diff --git a/nezha-fronted/src/components/common/mixin/editRigthBox.js b/nezha-fronted/src/components/common/mixin/editRigthBox.js
index b91994e3f..71b218ac4 100644
--- a/nezha-fronted/src/components/common/mixin/editRigthBox.js
+++ b/nezha-fronted/src/components/common/mixin/editRigthBox.js
@@ -1,3 +1,5 @@
+import i18n from '@/components/common/i18n'
+import { getUUID } from '../js/common'
export default {
data () {
return {
@@ -7,7 +9,8 @@ export default {
params: {},
emit: ''
},
- closeMessage: ''
+ closeMessage: null,
+ uuid: getUUID()
}
},
mounted () {
@@ -18,25 +21,55 @@ export default {
}
},
methods: {
- messageShow (msg, route, params, showNext = false, nextText = 'setup.next', emit) {
+ // 开启计时器 对message赋值
+ coutTime (msg, showNext, nextText, second) {
+ if (!this.closeMessage) {
+ return false
+ }
+ this.closeMessage.message =
+ `
+
${msg}
+
+ ,${i18n.t('tip.clickNext')}${i18n.t(nextText)}
+ ${i18n.t('tip.next')}
+ (${second}s)
+
+
+
`
+ this.$nextTick(() => {
+ const assetAdd = document.getElementById(`assetAdd${this.uuid}`)
+ assetAdd.addEventListener('click', this.saveNext)
+ })
+ setTimeout(() => {
+ --second
+ if (second === 0) {
+ this.closeMessage.close()
+ } else {
+ this.coutTime(msg, showNext, nextText, second)
+ }
+ }, 1000)
+ },
+ messageShow (msg, route, params, showNext = false, nextText = '', emit) {
+ // 如果存在弹框 则先清理掉
this.messageParams.route = route
this.messageParams.params = params
this.messageParams.emit = emit
this.closeMessage = this.$message({
- duration: showNext ? 5000 : 2000,
+ duration: showNext ? 30000 : 3000,
dangerouslyUseHTMLString: true,
type: 'success',
- message: `${msg} ${this.$t('overall.continue')} ${this.$t(nextText)}
`,
+ message: '',
onClose: () => {
- const assetAdd = document.getElementById('assetAdd')
+ const assetAdd = document.getElementById(`assetAdd${this.uuid}`)
assetAdd.removeEventListener('click', this.saveNext)
- this.closeMessage = ''
+ this.closeMessage = null
}
})
- const assetAdd = document.getElementById('assetAdd')
- assetAdd.addEventListener('click', this.saveNext)
+ // 对message赋值
+ this.coutTime(msg, showNext, nextText, 30)
},
saveNext () {
+ this.closeMessage.close()
if (!this.messageParams.route) {
this.$store.dispatch(this.messageParams.emit, this.messageParams.params)
return
@@ -45,7 +78,6 @@ export default {
path: this.messageParams.route,
query: this.messageParams.params
})
- this.closeMessage.close()
}
},
destroyed () {
diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue
index 8b3b742fa..b0ba4c75f 100644
--- a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue
@@ -744,7 +744,7 @@ export default {
this.$put(this.url, params).then(res => {
this.prevent_opt.save = false
if (res.code === 200) {
- this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, false, 'guide.addEndpoint')
+ this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, false, 'tip.endpoint')
this.esc(true)
} else {
this.$message.error(res.msg)
@@ -754,7 +754,7 @@ export default {
this.$post(this.url, params).then(res => {
this.prevent_opt.save = false
if (res.code === 200) {
- this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, true, 'guide.addEndpoint')
+ this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, true, 'tip.endpoint')
this.esc(true)
} else {
this.$message.error(res.msg)
diff --git a/nezha-fronted/src/components/common/rightBox/dcBox.vue b/nezha-fronted/src/components/common/rightBox/dcBox.vue
index 39f727fa1..803a058d1 100644
--- a/nezha-fronted/src/components/common/rightBox/dcBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/dcBox.vue
@@ -124,7 +124,7 @@ export default {
this.$put('/dc', param).then(response => {
this.prevent_opt.save = false
if (response.code === 200) {
- this.messageShow(this.$t('tip.saveSuccess'), '', { dcId: response.data.id, cabinetBoxShow: true }, false, 'overall.createCabinet', 'addCabinet')
+ this.messageShow(this.$t('tip.saveSuccess'), '', { dcId: response.data.id, cabinetBoxShow: true }, false, 'tip.cabinet', 'addCabinet')
this.esc(true)
} else {
this.$message.error(response.msg)
@@ -147,7 +147,7 @@ export default {
this.$post('/dc', param).then(response => {
this.prevent_opt.save = false
if (response.code === 200) {
- this.messageShow(this.$t('tip.saveSuccess'), '', { dcId: response.data.id, cabinetBoxShow: true }, true, 'overall.createCabinet', 'addCabinet')
+ this.messageShow(this.$t('tip.saveSuccess'), '', { dcId: response.data.id, cabinetBoxShow: true }, true, 'tip.cabinet', 'addCabinet')
this.esc(true)
} else {
this.$message.error(response.msg)
diff --git a/nezha-fronted/src/components/common/rightBox/moduleBox.vue b/nezha-fronted/src/components/common/rightBox/moduleBox.vue
index c8caf7270..7e1740dba 100644
--- a/nezha-fronted/src/components/common/rightBox/moduleBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/moduleBox.vue
@@ -935,7 +935,7 @@ export default {
this.$put('monitor/module', params).then(response => {
if (response.code === 200) {
// this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
- this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { projectId: this.editModule.projectId, moduleId: response.data.id }, false, 'guide.addEndpoint')
+ this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { projectId: this.editModule.projectId, moduleId: response.data.id }, false, 'tip.endpoint')
this.$store.commit('setReloadFacade')
this.esc(true)
} else {
@@ -946,7 +946,7 @@ export default {
} else {
this.$post('monitor/module', params).then(response => {
if (response.code === 200) {
- this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { projectId: this.editModule.projectId, moduleId: response.data.id }, true, 'guide.addEndpoint')
+ this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { projectId: this.editModule.projectId, moduleId: response.data.id }, true, 'tip.endpoint')
this.$store.commit('setReloadFacade')
this.esc(true)
} else {
diff --git a/nezha-fronted/src/components/common/rightBox/projectBox.vue b/nezha-fronted/src/components/common/rightBox/projectBox.vue
index dd8d99849..16d69fef7 100644
--- a/nezha-fronted/src/components/common/rightBox/projectBox.vue
+++ b/nezha-fronted/src/components/common/rightBox/projectBox.vue
@@ -72,7 +72,7 @@ export default {
this.$put('monitor/project', this.editProject).then(response => {
if (response.code === 200) {
// this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
- this.messageShow(this.$t('tip.saveSuccess'), '/module', { projectId: response.data.id }, false, 'overall.createModule')
+ this.messageShow(this.$t('tip.saveSuccess'), '/module', { projectId: response.data.id }, false, 'tip.module')
this.$store.commit('projectListChange')
this.$store.commit('setProject', this.project)
this.esc(true)
@@ -84,7 +84,7 @@ export default {
} else {
this.$post('monitor/project', this.editProject).then(response => {
if (response.code === 200) {
- this.messageShow(this.$t('tip.saveSuccess'), '/module', { projectId: response.data.id }, true, 'overall.createModule')
+ this.messageShow(this.$t('tip.saveSuccess'), '/module', { projectId: response.data.id }, true, 'tip.module')
this.$store.commit('projectListChange')
this.esc(true)
} else {