|
|
@@ -1,6 +1,17 @@
|
|
|
<template>
|
|
|
<div id="app">
|
|
|
<router-view />
|
|
|
+ <el-dialog
|
|
|
+ :title="$t('notificationProps.title')"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ width="30%"
|
|
|
+ >
|
|
|
+ <span>{{ $t('notificationProps.description') }}</span>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false">{{ $t('notificationProps.cancelButtonText') }}</el-button>
|
|
|
+ <el-button type="primary" @click="notificationreRresh">{{ $t('notificationProps.confirmButtonText') }}</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -9,52 +20,72 @@ import store from './store'
|
|
|
|
|
|
export default {
|
|
|
name: 'App',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ dialogVisible: false
|
|
|
+ }
|
|
|
+ },
|
|
|
created() {
|
|
|
const self = this
|
|
|
const language = store.state.app.language
|
|
|
document.body.addEventListener('plugin_web_update_notice', (e) => {
|
|
|
const { version, options } = e.detail
|
|
|
console.log(version, options)
|
|
|
- if (language === 'en') {
|
|
|
- self.$confirm('System update detected, please refresh the page?', '📢 System update', {
|
|
|
- distinguishCancelAndClose: true,
|
|
|
- closeOnClickModal: false,
|
|
|
- customClass: 'message_refresh',
|
|
|
- confirmButtonText: 'refresh',
|
|
|
- cancelButtonText: 'dismiss'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- location.reload()
|
|
|
- })
|
|
|
- .catch(action => {
|
|
|
- self.$message({
|
|
|
- type: 'info',
|
|
|
- message: action === 'cancel'
|
|
|
- ? 'Abandon'
|
|
|
- : 'Stay on the current page'
|
|
|
- })
|
|
|
- })
|
|
|
- } else {
|
|
|
- self.$confirm('检测到系统更新,请刷新页面?', '📢 系统更新', {
|
|
|
- distinguishCancelAndClose: true,
|
|
|
- closeOnClickModal: false,
|
|
|
- customClass: 'message_refresh',
|
|
|
- confirmButtonText: '刷新',
|
|
|
- cancelButtonText: '放弃'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- location.reload()
|
|
|
- })
|
|
|
- .catch(action => {
|
|
|
- self.$message({
|
|
|
- type: 'info',
|
|
|
- message: action === 'cancel'
|
|
|
- ? '放弃'
|
|
|
- : '停留在当前页面'
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
+ self.dialogVisible = true
|
|
|
+ // if (language === 'en') {
|
|
|
+ // self.$confirm('System update detected, please refresh the page?', '📢 System update', {
|
|
|
+ // distinguishCancelAndClose: true,
|
|
|
+ // closeOnClickModal: false,
|
|
|
+ // customClass: 'message_refresh',
|
|
|
+ // confirmButtonText: 'refresh',
|
|
|
+ // cancelButtonText: 'dismiss'
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+ // location.reload()
|
|
|
+ // })
|
|
|
+ // .catch(action => {
|
|
|
+ // self.$message({
|
|
|
+ // type: 'info',
|
|
|
+ // message: action === 'cancel'
|
|
|
+ // ? 'Abandon'
|
|
|
+ // : 'Stay on the current page'
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // self.$confirm('检测到系统更新,请刷新页面?', '📢 系统更新', {
|
|
|
+ // distinguishCancelAndClose: true,
|
|
|
+ // closeOnClickModal: false,
|
|
|
+ // customClass: 'message_refresh',
|
|
|
+ // confirmButtonText: '刷新',
|
|
|
+ // cancelButtonText: '放弃'
|
|
|
+ // })
|
|
|
+ // .then(() => {
|
|
|
+ // location.reload()
|
|
|
+ // })
|
|
|
+ // .catch(action => {
|
|
|
+ // self.$message({
|
|
|
+ // type: 'info',
|
|
|
+ // message: action === 'cancel'
|
|
|
+ // ? '放弃'
|
|
|
+ // : '停留在当前页面'
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // }
|
|
|
})
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ notificationreRresh() {
|
|
|
+ // setTimeout()
|
|
|
+ location.reload()
|
|
|
+ this.dialogVisible = false
|
|
|
+ },
|
|
|
+ handleClose(done) {
|
|
|
+ this.$confirm('确认关闭?')
|
|
|
+ .then(_ => {
|
|
|
+ done()
|
|
|
+ })
|
|
|
+ .catch(_ => {})
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|