From 7a228d5837e006af03e76db757e0f559e131f4b4 Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期五, 23 五月 2025 13:37:17 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/components/layouts/TerminalLayout.vue | 126 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 126 insertions(+), 0 deletions(-) diff --git a/src/components/layouts/TerminalLayout.vue b/src/components/layouts/TerminalLayout.vue new file mode 100644 index 0000000..01ef462 --- /dev/null +++ b/src/components/layouts/TerminalLayout.vue @@ -0,0 +1,126 @@ +<template> + <div class="full-screen-container"> + <router-view class="router-view"> + <template v-slot:function> + <a-space> + <button class="button" @click="handleLogout">鍒囨崲鐢ㄦ埛</button> + <button class="button" @click="backToIndex">杩斿洖涓婚〉</button> + <button class="button">璁剧疆</button> + </a-space> + </template> + </router-view> + + <div class="footer" v-if="$route.path!=='/terminal/login'"> + <div>濮撳悕锛歿{nickname()}}</div> + <div>褰撳墠鏃堕棿锛歿{currentDateAndTime}}</div> + </div> + </div> +</template> + +<script> + import { mapActions, mapGetters } from 'vuex' + + import moment from 'moment' + + export default { + name: 'TerminalLayout', + data() { + return { + currentDateAndTime: null, + getDateAndTimeInterval: null + } + }, + watch: { + '$route.path': { + handler(val) { + if (val === '/terminal/index' || val === '/terminal/login') document.title = 'MDC鏅烘収杞﹂棿' + } + } + }, + created() { + this.getCurrentDateAndTime() + + }, + beforeDestroy() { + if (this.getDateAndTimeInterval) { + clearInterval(this.getDateAndTimeInterval) + this.getDateAndTimeInterval = null + } + }, + methods: { + ...mapActions(['Logout']), + + ...mapGetters(['nickname']), + + handleLogout() { + const that = this + + this.$confirm({ + title: '鎻愮ず', + content: '纭畾瑕佸垏鎹㈢敤鎴峰悧 ?', + onOk() { + return that.Logout({}).then(() => { + window.location.reload() + }).catch(err => { + that.$message.error({ + title: '閿欒', + description: err.message + }) + }) + }, + onCancel() { + } + }) + }, + + backToIndex() { + if (this.$route.path !== '/terminal/index') this.$router.push('/terminal/index') + }, + + // 鑾峰彇褰撳墠鏃ユ湡鍜屾椂闂达紙1绉掓洿鏂�1娆★級 + getCurrentDateAndTime() { + this.getDateAndTimeInterval = setInterval(() => this.currentDateAndTime = moment().format('YYYY-MM-DD HH:mm:ss'), 1000) + } + } + } +</script> + +<style scoped lang="less"> + .full-screen-container { + display: flex; + flex-direction: column; + height: 100vh; + + .router-view { + flex: 1; + padding: 24px; + display: flex; + flex-direction: column; + } + } + + .button { + font-weight: bold; + padding: 15px 15px; + border: 1px solid rgba(0, 0, 0, .2); + border-radius: 5px; + cursor: pointer; + box-shadow: 6px 6px 16px rgba(0, 0, 0, 0.2), + -6px -6px 16px rgba(255, 255, 255, 0.8), + inset 0 0 0 transparent; + + &:hover { + box-shadow: 0 0 0 transparent, + inset 6px 6px 12px rgba(0, 0, 0, 0.2), + inset -6px -6px 12px rgba(255, 255, 255, 0.8); + } + } + + .footer { + font-size: 16px; + padding: 12px 24px; + color: #000; + display: flex; + justify-content: space-between; + } +</style> \ No newline at end of file -- Gitblit v1.9.3