增加退出账号前提示

This commit is contained in:
zh
2025-11-21 09:30:16 +08:00
parent cd9f855a47
commit 19c6f47e8a

View File

@ -13,18 +13,10 @@
</div> </div>
</div> </div>
</div> --> </div> -->
<el-tooltip <el-tooltip v-for="(item, i) of setList" :key="item.id" :content="t('iconTitle.' + item.name)" effect="customized"
v-for="(item, i) of setList" :hide-after="0">
:key="item.id" <div class="set_item" :class="{ 'last-item': i === setList.length - 1, 'first-item': i === 0 }"
:content="t('iconTitle.' + item.name)" @click="item.callback">
effect="customized"
:hide-after="0"
>
<div
class="set_item"
:class="{ 'last-item': i === setList.length - 1 }"
@click="item.callback"
>
<svg-icon :name="item.icon" :size="20"></svg-icon> <svg-icon :name="item.icon" :size="20"></svg-icon>
</div> </div>
</el-tooltip> </el-tooltip>
@ -52,6 +44,12 @@ eventBus.on('settingPop', (data) => {
data ? setPupRef.value.open('current') : setPupRef.value.close() data ? setPupRef.value.open('current') : setPupRef.value.close()
}) })
const logout = async (e) => { const logout = async (e) => {
ElMessageBox.confirm('您确定要退出当前账号?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
let res = await LoginApi.logout() let res = await LoginApi.logout()
if (window.earth) { if (window.earth) {
window.earth.destroy() window.earth.destroy()
@ -66,6 +64,9 @@ const logout = async (e) => {
}) })
// localStorage.clear() // localStorage.clear()
} }
})
.catch(() => {
})
} }
const fullScreen = (item) => { const fullScreen = (item) => {
@ -78,25 +79,24 @@ const resetShow = (item) => {
const setList = ref([ const setList = ref([
// 标准版本 // 标准版本
// {id: 4, index: 2, icon: 'layerTitleBg', className: 'header_public', callback: this.setShow},
{ {
id: 0, id: 0,
index: 0, index: 0,
icon: 'beidou', icon: 'out_login',
name: 'locate', name: 'logout',
className: 'header_public', className: 'header_public',
dbcallback: (e) => {}, dbcallback: null,
callback: (e) => {} callback: logout
// dbcallback: this.flyTo,
// callback: this.locate,
}, },
{ {
id: 1, id: 1,
index: 1, index: 1,
icon: 'sys_reset', icon: 'sys_set',
name: 'set',
className: 'header_public', className: 'header_public',
name: 'reset',
dbcallback: null, dbcallback: null,
callback: resetShow callback: setShow
}, },
{ {
id: 2, id: 2,
@ -109,30 +109,33 @@ const setList = ref([
}, },
{ {
id: 3, id: 3,
index: 3, index: 4,
icon: 'sys_set', icon: 'sys_reset',
name: 'set',
className: 'header_public', className: 'header_public',
name: 'reset',
dbcallback: null, dbcallback: null,
callback: setShow callback: resetShow
}, },
// {id: 4, index: 2, icon: 'layerTitleBg', className: 'header_public', callback: this.setShow},
{ {
id: 4, id: 4,
index: 4, index: 4,
icon: 'out_login', icon: 'beidou',
name: 'logout', name: 'locate',
className: 'header_public', className: 'header_public',
dbcallback: null, dbcallback: (e) => { },
callback: logout callback: (e) => { }
} // dbcallback: this.flyTo,
// callback: this.locate,
},
]) ])
ipcRenderer.invoke('getIsFullScreen').then((res) => { ipcRenderer.invoke('getIsFullScreen').then((res) => {
setList.value[2].icon = res ? 'full_screen_exit' : 'full_screen' setList.value[2].icon = res ? 'full_screen_exit' : 'full_screen'
setList.value[2].name = res ? 'shrink' : 'fullScreen'
}) })
ipcRenderer.on('fullscreen-status-changed', (event, isFullscreen) => { ipcRenderer.on('fullscreen-status-changed', (event, isFullscreen) => {
setList.value[2].icon = isFullscreen ? 'full_screen_exit' : 'full_screen' setList.value[2].icon = isFullscreen ? 'full_screen_exit' : 'full_screen'
setList.value[2].name = isFullscreen ? 'shrink' : 'fullScreen'
}) })
</script> </script>
@ -147,6 +150,7 @@ ipcRenderer.on('fullscreen-status-changed', (event, isFullscreen) => {
// background: var(--svg-headColorbg); // background: var(--svg-headColorbg);
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: row-reverse;
// justify-content: space-between; // justify-content: space-between;
// border: 1px solid var(--svg-headColor3); // border: 1px solid var(--svg-headColor3);
padding: 10px 0; padding: 10px 0;
@ -167,15 +171,13 @@ ipcRenderer.on('fullscreen-status-changed', (event, isFullscreen) => {
top: 0; top: 0;
bottom: 0; bottom: 0;
width: 1px; width: 1px;
background: linear-gradient( background: linear-gradient(180deg,
180deg,
rgba(var(--color-base1), 0), rgba(var(--color-base1), 0),
rgba(var(--color-base1), 1), rgba(var(--color-base1), 1),
rgba(204, 204, 204, 0) rgba(204, 204, 204, 0));
);
} }
.set_item.last-item::after { .set_item.first-item::after {
display: none; display: none;
} }