|
|
@ -1,19 +1,51 @@ |
|
|
|
<template> |
|
|
|
<div class="s-option"> |
|
|
|
<div class="s-option-inner"> |
|
|
|
<div class="s-option-button" @click.stop="($ev) => handleClick(0, $ev)" v-glowing> |
|
|
|
<div |
|
|
|
v-if="sys.getConfig('userType') == 'member'" |
|
|
|
class="s-option-button" |
|
|
|
@click.stop="handleLogout" |
|
|
|
v-glowing |
|
|
|
> |
|
|
|
<div class="s-option-button_img"> |
|
|
|
<svg class="icon" aria-hidden="true"> |
|
|
|
<use xlink:href="#icon-setup"></use> |
|
|
|
<svg |
|
|
|
class="icon" |
|
|
|
aria-hidden="true" |
|
|
|
> |
|
|
|
<use xlink:href="#icon-logout"></use> |
|
|
|
</svg> |
|
|
|
</div> |
|
|
|
<div class="s-option-button_title"> |
|
|
|
{{ t("startMenu.power") }} |
|
|
|
{{ t("startMenu.logout") }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="s-option-button" @click.stop="($ev) => handleClick(1, $ev)" v-glowing> |
|
|
|
<div |
|
|
|
class="s-option-button" |
|
|
|
@click.stop="handleRecover" |
|
|
|
v-glowing |
|
|
|
> |
|
|
|
<div class="s-option-button_img"> |
|
|
|
<svg class="icon" aria-hidden="true"> |
|
|
|
<svg |
|
|
|
class="icon" |
|
|
|
aria-hidden="true" |
|
|
|
> |
|
|
|
<use xlink:href="#icon-huifu"></use> |
|
|
|
</svg> |
|
|
|
</div> |
|
|
|
<div class="s-option-button_title"> |
|
|
|
{{ t("startMenu.recover") }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
class="s-option-button" |
|
|
|
@click.stop="($ev) => handleClick(1, $ev)" |
|
|
|
v-glowing |
|
|
|
> |
|
|
|
<div class="s-option-button_img"> |
|
|
|
<svg |
|
|
|
class="icon" |
|
|
|
aria-hidden="true" |
|
|
|
> |
|
|
|
<use xlink:href="#icon-setting"></use> |
|
|
|
</svg> |
|
|
|
</div> |
|
|
@ -24,59 +56,40 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
import { emitEvent } from "@/system/event"; |
|
|
|
import { useSystem, Dialog, t, Menu, BrowserWindow } from "@/system"; |
|
|
|
import { vGlowing } from "@/util/glowingBorder"; |
|
|
|
import { fetchGet } from "@/system/config"; |
|
|
|
import { RestartApp } from "@/util/goutil"; |
|
|
|
import { BrowserWindow, Dialog, t, useSystem } from "@/system"; |
|
|
|
import { fetchGet } from "@/system/config"; |
|
|
|
import { emitEvent } from "@/system/event"; |
|
|
|
import { vGlowing } from "@/util/glowingBorder"; |
|
|
|
import { RestartApp } from "@/util/goutil"; |
|
|
|
|
|
|
|
const sys = useSystem(); |
|
|
|
|
|
|
|
const sys = useSystem(); |
|
|
|
function handleClick(key: number, ev: MouseEvent) { |
|
|
|
switch (key) { |
|
|
|
case 0: |
|
|
|
const actions = [ |
|
|
|
{ |
|
|
|
label: t("startMenu.shutdown"), |
|
|
|
click: () => { |
|
|
|
emitEvent("system.shutdown"); |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: t("startMenu.recover"), |
|
|
|
click: () => { |
|
|
|
function handleLogout() { |
|
|
|
const userInfo: any = sys.getConfig("userInfo"); |
|
|
|
fetchGet(userInfo.url + "/member/loginout").then(() => { |
|
|
|
RestartApp(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function handleRecover() { |
|
|
|
Dialog.showMessageBox({ |
|
|
|
title: t("startMenu.recover"), |
|
|
|
message: t("is.recover"), |
|
|
|
buttons: [t("startMenu.recover"), t("cancel")], |
|
|
|
}).then((res) => { |
|
|
|
//console.log(res) |
|
|
|
if (res.response === -1) { |
|
|
|
emitEvent("system.recover"); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
] |
|
|
|
if(sys.getConfig('userType') == 'member'){ |
|
|
|
actions.push({ |
|
|
|
label: '退出', |
|
|
|
click: () => { |
|
|
|
const userInfo:any = sys.getConfig('userInfo') |
|
|
|
fetchGet(userInfo.url + "/member/loginout").then(() => { |
|
|
|
RestartApp() |
|
|
|
}) |
|
|
|
}, |
|
|
|
}) |
|
|
|
} |
|
|
|
Menu.buildFromTemplate(actions).popup(ev); |
|
|
|
|
|
|
|
break; |
|
|
|
case 1: { |
|
|
|
function handleClick(key: number, ev: MouseEvent) { |
|
|
|
if (key === 1) { |
|
|
|
emitEvent("startMenu.set.click", { |
|
|
|
mouse: ev, |
|
|
|
}); |
|
|
|
//console.log(sys._rootState.windowMap) |
|
|
|
const winopt = sys._rootState.windowMap["Menulist"].get("setting"); |
|
|
|
|
|
|
|
if (winopt) { |
|
|
@ -91,16 +104,11 @@ function handleClick(key: number, ev: MouseEvent) { |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.s-option { |
|
|
|
.s-option { |
|
|
|
position: relative; |
|
|
|
width: var(--startmenu-icon-size); |
|
|
|
height: 100%; |
|
|
@ -155,13 +163,13 @@ function handleClick(key: number, ev: MouseEvent) { |
|
|
|
// background-color: var(--color-gray-hover); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.s-option:hover { |
|
|
|
.s-option:hover { |
|
|
|
.s-option-inner { |
|
|
|
transition-delay: 0.5s; |
|
|
|
width: var(--startmenu-icon-size-hover); |
|
|
|
box-shadow: 10px 0px 20px 0px rgba(0, 0, 0, 0.216); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|