From c2b88a03f3d0d5ebe92949e64d17ee4d0ac3f6b7 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期二, 09 九月 2025 15:14:00 +0800
Subject: [PATCH] 发货清空缓存站点
---
zy-asrs-admin/src/views/IndexView.vue | 62 +++++++++++++++++++++++++++---
1 files changed, 55 insertions(+), 7 deletions(-)
diff --git a/zy-asrs-admin/src/views/IndexView.vue b/zy-asrs-admin/src/views/IndexView.vue
index e9b44a0..f615790 100644
--- a/zy-asrs-admin/src/views/IndexView.vue
+++ b/zy-asrs-admin/src/views/IndexView.vue
@@ -1,10 +1,13 @@
<script setup>
-import { nextTick, ref, inject, onMounted } from 'vue';
+import { nextTick, ref, inject, onMounted, h, reactive } from 'vue';
import { useRouter } from "vue-router";
import { get, post, postForm } from '@/utils/request.js'
import { logout } from '@/config.js';
import * as Icons from "@ant-design/icons-vue";
import { message } from 'ant-design-vue';
+// import type { MenuMode, MenuTheme } from 'ant-design-vue';
+// import { ItemType } from 'ant-design-vue';
+
import {
MenuUnfoldOutlined,
MenuFoldOutlined,
@@ -37,6 +40,8 @@
...Icons,
};
+
+
onMounted(() => {
let name = router.currentRoute.value.name;
let path = router.currentRoute.value.path;
@@ -59,10 +64,23 @@
}
})
+
+const state = reactive({
+ rootSubmenuKeys: [],
+ openKeys: ["/"],
+ selectedKeys: [],
+});
+
getMenu()
function getMenu() {
get('/api/auth/menu', {}).then((result) => {
menuCache.value = result.data.data;
+ let routes = menuCache.value.map(item =>{
+ return item.route
+ })
+ routes.unshift('/')
+ state.rootSubmenuKeys = routes
+ console.log(state.rootSubmenuKeys)
})
}
@@ -150,9 +168,9 @@
selectedKeys.value = [item.key]
// open menu
- let arr = item.key.split("/");
- let key = '/' + arr[1];
- openKeys.value = [key]
+ // let arr = item.key.split("/");
+ // let key = '/' + arr[1];
+ // openKeys.value = [key]
}
const switchLocale = async (locale) => {
@@ -186,13 +204,31 @@
const licenseDays = ref(365);
getLicenseDays();
function getLicenseDays() {
+ const currentDate = new Date();
+ const newDate = new Date(currentDate);
post('/api/license/getLicenseDays', {}).then((resp) => {
let result = resp.data;
let data = result.data;
if (result.code == 200) {
licenseDays.value = data;
+ if(data <= 15) {
+ newDate.setDate(currentDate.getDate() + data);
+ 銆�alert("璁稿彲璇佹湁鏁堟湡锛�" + data + "澶╋紝"銆�+銆�"鍒版湡鏃ユ湡锛�"銆�+銆�formatDate(newDate))
+ }
}
})
+}
+
+// 瀹屾暣鐨勬棩鏈熸牸寮忓寲鍑芥暟
+function formatDate(date, format = 'yyyy-MM-dd') {
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, '0');
+ const day = String(date.getDate()).padStart(2, '0');
+
+ return format
+ .replace('yyyy', year)
+ .replace('MM', month)
+ .replace('dd', day);
}
const switchHost = (item) => {
@@ -223,6 +259,18 @@
}
}
+const onOpenChange = (openKeys) => {
+ const latestOpenKey = openKeys.find(
+ (key) => state.openKeys.indexOf(key) === -1
+ );
+ if (state.rootSubmenuKeys.indexOf(latestOpenKey) === -1) {
+ state.openKeys = openKeys
+ } else {
+ state.openKeys = latestOpenKey ? [latestOpenKey] : [];
+ }
+ console.log(state.openKeys)
+}
+
</script>
<template>
@@ -230,8 +278,8 @@
<div class="sider-style">
<a-layout-sider class="main-sider" v-model:collapsed="collapsed" :trigger="null" theme="dark">
<div class="logo" />
- <a-menu v-model:openKeys="openKeys" v-model:selectedKeys="selectedKeys" @select="menuSelect" theme="dark"
- mode="inline" >
+ <a-menu v-model:openKeys="state.openKeys" v-model:selectedKeys="state.selectedKeys" @select="menuSelect" theme="dark"
+ mode="inline" @openChange="onOpenChange">
<div>
<a-menu-item key="/" name="涓婚〉">
<HomeOutlined /> {{ formatMessage('common.home', '涓婚〉') }}
@@ -356,7 +404,7 @@
<style scoped>
.ant-layout-sider ant-layout-sider-dark main-sider {
- min-height: 100vh;
+ max-height: 100vh;
background: #01101E;
}
--
Gitblit v1.9.1