|
@@ -28,16 +28,26 @@
|
|
<div class="text">{{ item.label }}</div>
|
|
<div class="text">{{ item.label }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <i class="userIcon" />
|
|
|
|
|
|
+ <div ref="userRef" class="userIcon" @click="handleShowBox">
|
|
|
|
+ <div v-show="showBox" class="log-out-box">
|
|
|
|
+ <div class="log-out" @click="handleShowTip">退出登录</div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <Dialog v-model="showTip" class="tip" type="xs" title="提示" @close="showTip = false" @confirm="logout">确定注销并退出系统吗?</Dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup name="headerSection">
|
|
<script lang="ts" setup name="headerSection">
|
|
import usePermissionStore from '@/store/modules/permission';
|
|
import usePermissionStore from '@/store/modules/permission';
|
|
|
|
+import useUserStore from '@/store/modules/user';
|
|
|
|
+import { onClickOutside} from "@vueuse/core";
|
|
|
|
+import { onClickOutside} from "@vueuse/core";
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
|
+const userStore = useUserStore();
|
|
const permissionStore = usePermissionStore();
|
|
const permissionStore = usePermissionStore();
|
|
|
|
+const userRef = ref();
|
|
// type 1 系统内地址 2 外链
|
|
// type 1 系统内地址 2 外链
|
|
const menuState = computed(() => {
|
|
const menuState = computed(() => {
|
|
return permissionStore.menuState;
|
|
return permissionStore.menuState;
|
|
@@ -56,6 +66,22 @@ const clickMenu = (item) => {
|
|
router.push({ path: item.path });
|
|
router.push({ path: item.path });
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+let showBox = ref(false);
|
|
|
|
+let showTip = ref(false);
|
|
|
|
+onClickOutside(userRef, (event) => {
|
|
|
|
+ showBox.value = false;
|
|
|
|
+});
|
|
|
|
+const handleShowBox = () => {
|
|
|
|
+ showBox.value = true;
|
|
|
|
+};
|
|
|
|
+const handleShowTip = () => {
|
|
|
|
+ showBox.value = false;
|
|
|
|
+ showTip.value = true;
|
|
|
|
+};
|
|
|
|
+const logout = async () => {
|
|
|
|
+ await userStore.logout();
|
|
|
|
+ location.href = import.meta.env.VITE_APP_CONTEXT_PATH + '#/';
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
@@ -169,6 +195,29 @@ const clickMenu = (item) => {
|
|
margin-top: 54px;
|
|
margin-top: 54px;
|
|
margin-left: 57px;
|
|
margin-left: 57px;
|
|
margin-right: 57px;
|
|
margin-right: 57px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ position: relative;
|
|
|
|
+ .log-out-box {
|
|
|
|
+ position: absolute;
|
|
|
|
+ bottom: -100px;
|
|
|
|
+ left: -30px;
|
|
|
|
+ border: 1px solid #2db3e9;
|
|
|
|
+ .log-out {
|
|
|
|
+ width: 200px;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: column;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ align-items: center;
|
|
|
|
+ padding: 20px 0;
|
|
|
|
+ color: #ffffff;
|
|
|
|
+ font-size: 38px;
|
|
|
|
+ background: #0d2c70;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ &:hover {
|
|
|
|
+ background: #1b4ea5;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|