wuhongbo пре 1 година
родитељ
комит
e2afdf0d68

BIN
client/src/assets/imgs/OA/layout/clearDay.png


BIN
client/src/assets/imgs/OA/layout/close.png


BIN
client/src/assets/imgs/OA/zdww.png


+ 6 - 165
client/src/views/OaSystem/oaLayout/header.vue

@@ -2,145 +2,22 @@
   <div class="header">
     <div class="header-left">
       <img src="@/assets/imgs/OA/zdww.png" alt="" />
-      <p
-        >{{ titleName }}
-        <!-- <span v-if="menuUlShow">|</span> {{ headerTitleName }} -->
-      </p>
+      <p>{{ titleName }} </p>
+    </div>
+    <div class="header-right">
+      <Weather />
     </div>
-    <!-- <div class="header-right">
-      <ul class="menuUl" v-if="menuUlShow">
-        <li v-for="(item, index) in reactiveData.routes" :key="index" v-show="item.alwaysShow">
-          <router-link :to="'/oaSystem/' + pathBossName + '/' + item.path">
-            <span>{{ item.name }}</span>
-          </router-link>
-        </li>
-      </ul>
-      <div class="header-user">
-        <ElDropdown class="custom-hover" :class="prefixCls" trigger="click">
-          <div class="flex items-center">
-            <ElAvatar
-              :src="avatar"
-              alt=""
-              class="w-[calc(var(--logo-height)-25px)] rounded-[50%]"
-            />
-            <span class="pl-[5px] c-white ml-5px text-14px <lg:hidden">
-              {{ userName }}
-            </span>
-          </div>
-          <template #dropdown>
-            <ElDropdownMenu>
-              <ElDropdownItem>
-                <Icon icon="ep:tools" />
-                <div @click="toProfile">{{ t('common.profile') }}</div>
-              </ElDropdownItem>
-              <ElDropdownItem divided @click="loginOut">
-                <Icon icon="ep:switch-button" />
-                <div>{{ t('common.loginOut') }}</div>
-              </ElDropdownItem>
-            </ElDropdownMenu>
-          </template>
-        </ElDropdown>
-      </div>
-    </div> -->
   </div>
 </template>
 <script setup lang="ts">
-import { useRouter } from 'vue-router'
-import { ElMessageBox } from 'element-plus'
-import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
-import { useDesign } from '@/hooks/web/useDesign'
-import avatarImg from '@/assets/imgs/avatar.gif'
-import { useUserStore } from '@/store/modules/user'
-import { useTagsViewStore } from '@/store/modules/tagsView'
 import { useAppStore } from '@/store/modules/app'
+import Weather from './weather.vue'
 defineOptions({ name: 'Header' })
-const { t } = useI18n()
-
-const { wsCache } = useCache()
-
-const { push, replace } = useRouter()
-
-const userStore = useUserStore()
 const appStore = useAppStore()
-const tagsViewStore = useTagsViewStore()
-
-const { getPrefixCls } = useDesign()
-
-const prefixCls = getPrefixCls('user-info')
-
-const user = wsCache.get(CACHE_KEY.USER)
-
-const avatar = user.user.avatar ? user.user.avatar : avatarImg
-
-const userName = user.user.nickname ? user.user.nickname : 'Admin'
 const titleName = ref(appStore.title)
-const loginOut = () => {
-  ElMessageBox.confirm(t('common.loginOutMessage'), t('common.reminder'), {
-    confirmButtonText: t('common.ok'),
-    cancelButtonText: t('common.cancel'),
-    type: 'warning'
-  })
-    .then(async () => {
-      await userStore.loginOut()
-      tagsViewStore.delAllViews()
-      replace('/login?redirect=/index')
-    })
-    .catch(() => {})
-}
-const toProfile = async () => {
-  push('/user/profile')
-}
-
-const reactiveData: any = reactive({
-  routes: []
-})
-const menuUlShow = ref(false) // 菜单列表是否显示,是首页就不显示
-const headerTitleName: any = ref('') // 标题名称
-const router = useRouter()
-
-const pathBossName = ref('')
-const initMenus = async () => {
-  const uid = router.currentRoute.value
-  let locals: any = localStorage.getItem('roleRouters')
-  let roleRouters = JSON.parse(JSON.parse(locals).v)[0].children
 
-  if (uid.path == '/oaSystem/home' || uid.path.indexOf('projectDetail') != -1) {
-    menuUlShow.value = false
-    reactiveData.routes = roleRouters
-  } else {
-    menuUlShow.value = true
-
-    let childName = uid.name
-    let childArr = roleRouters.slice(1, roleRouters.length)
-    await childFun(childName, childArr)
-  }
-}
-
-const childFun = async (name: any, arr: any) => {
-  reactiveData.routes = []
-  for (let i = 0; i < arr.length; i++) {
-    if (arr[i].children != null && arr[i].children) {
-      for (let j = 0; j < arr[i].children.length; j++) {
-        if (arr[i].children[j].path == name) {
-          pathBossName.value = arr[i].path
-          headerTitleName.value = arr[i].name
-          reactiveData.routes = arr[i].children
-        }
-      }
-    } else {
-      if (arr[i].path == name) {
-        headerTitleName.value = arr[i].name
-      }
-    }
-  }
-}
-watch(() => {
-  initMenus()
-})
 /** 初始化 **/
-onMounted(() => {
-  initMenus()
-})
+onMounted(() => {})
 </script>
 <style lang="scss" scoped>
 .header {
@@ -169,42 +46,6 @@ onMounted(() => {
     display: flex;
     align-items: center;
     height: 100%;
-    .menuUl {
-      display: flex;
-      align-items: center;
-      height: 100%;
-      margin: 0;
-      border-right: 1px solid #45638e;
-      li {
-        width: 136px;
-        list-style: none;
-        height: 100%;
-        a {
-          width: 100%;
-          height: 100%;
-          display: block;
-          display: flex;
-          align-items: center;
-          justify-content: center;
-          text-decoration: none;
-          span {
-            color: #fff;
-            font-size: 16px;
-          }
-        }
-        .router-link-active {
-          background-color: #4e6e9e;
-        }
-      }
-    }
-
-    .header-user {
-      margin-left: 25px;
-    }
   }
 }
-
-.custom-hover {
-  background-color: transparent;
-}
 </style>

+ 45 - 30
client/src/views/OaSystem/oaLayout/menus.vue

@@ -3,6 +3,9 @@
     <div class="menus-user">
       <div class="userImg">
         <ElAvatar :src="avatar" alt="" class="userIcon" />
+        <div class="glBox">
+          <span>工龄{{ 30 }}年</span>
+        </div>
       </div>
       <div class="userInfo">
         <h4>{{ userName }}</h4>
@@ -16,24 +19,19 @@
       </div>
     </div>
     <div class="menus-tabs">
-      <el-menu
-        default-active="2"
-        class="el-menu-vertical-demo"
-        @open="handleOpen"
-        @close="handleClose"
-      >
+      <el-menu default-active="2" class="el-menu-vertical-demo">
         <div v-for="(item, index) in reactiveData.routes" :key="index">
-          <el-sub-menu :index="index" v-if="item.children">
+          <el-sub-menu :index="String(index)" v-if="item.children">
             <template #title>
-              <el-icon><location /></el-icon>
+              <Icon :icon="item.icon" />
               <span>{{ item.name }}</span>
             </template>
-            <el-menu-item @click="menuClick(l, i)" v-for="(l, i) in item.children" :key="i">{{
+            <el-menu-item @click="menuClick(item, i)" v-for="(l, i) in item.children" :key="i">{{
               l.name
             }}</el-menu-item>
           </el-sub-menu>
-          <el-menu-item @click="menuBossClick(item, index)" :index="index" v-else>
-            <el-icon><location /></el-icon>
+          <el-menu-item @click="menuClick(item, index)" :index="String(index)" v-else>
+            <Icon :icon="item.icon" />
             <span>{{ item.name }}</span>
           </el-menu-item>
         </div>
@@ -102,25 +100,18 @@ const initMenus = async () => {
 
   let childName = uid.name
   let childArr = roleRouters.slice(0, roleRouters.length)
-  console.log(childArr)
   reactiveData.routes = childArr
 }
 
-const handleOpen = (key: string, keyPath: string[]) => {
-  console.log(key, keyPath)
-}
-const handleClose = (key: string, keyPath: string[]) => {
-  console.log(key, keyPath)
-}
-const menuClick = (item, index) => {
-  push(item.path)
-}
-const menuBossClick = (item, index) => {
-  push(item.path)
+const menuClick = (item: any, idx: any) => {
+  if (item.children) {
+    push('/oaSystem/' + item.path + '/' + item.children[idx].path)
+  } else {
+    push('/oaSystem/' + item.path)
+  }
+  // push(item.path)
 }
-watch(() => {
-  initMenus()
-})
+
 /** 初始化 **/
 onMounted(() => {
   initMenus()
@@ -147,11 +138,29 @@ onMounted(() => {
       display: flex;
       align-items: center;
       justify-content: center;
-      padding: 2px;
+      padding: 3px;
+      position: relative;
       .userIcon {
         width: 100%;
         height: 100%;
       }
+      .glBox {
+        position: absolute;
+        bottom: -10px;
+        left: 50%;
+        margin-left: -32px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 64px;
+        height: 18px;
+        background: #f9a527;
+        border-radius: 14px 14px 14px 14px;
+        span {
+          color: #fff;
+          font-size: 12px;
+        }
+      }
     }
     .userInfo {
       width: 100%;
@@ -197,9 +206,15 @@ onMounted(() => {
   .menus-tabs {
     width: 100%;
     height: calc(100% - 250px);
-    .menuUl {
-      width: 100%;
-      height: 100%;
+  }
+}
+
+::v-deep .menus-tabs {
+  .el-menu {
+    border: none;
+    background-color: transparent;
+    span {
+      color: #fff;
     }
   }
 }

+ 76 - 12
client/src/views/OaSystem/oaLayout/tagList.vue

@@ -3,16 +3,28 @@
     <div class="tag-view">
       <ul>
         <li v-for="(item, index) in visitedViews" :key="index">
-          <router-link :to="{ ...item }" custom v-slot="{ navigate }" v-if="index != 0">
-            <el-tag
-              @click="navigate"
-              class="mx-1"
-              closable
-              :disable-transitions="false"
-              @close="closeSelectedTag(item, index)"
-            >
-              {{ item.meta.title }}
-            </el-tag>
+          <router-link :to="{ ...item }" exact v-slot="{ navigate }" v-if="index == 1">
+            <div class="homeBox" @click="navigate">
+              <Icon :icon="item.meta.icon || ''" />
+              <p>{{ item.meta.title }}</p>
+            </div>
+          </router-link>
+          <router-link
+            :to="{ ...item }"
+            exact
+            v-slot="{ navigate }"
+            v-else-if="index != 1 && index != 0"
+          >
+            <div class="fhomeBox" @click="navigate">
+              <div>
+                <Icon :icon="item.meta.icon || ''" />
+                <p>{{ item.meta.title }}</p>
+              </div>
+              <img
+                @click.stop.prevent="closeSelectedTag(item)"
+                src="@/assets/imgs/OA/layout/close.png"
+              />
+            </div>
           </router-link>
         </li>
       </ul>
@@ -20,6 +32,7 @@
   </div>
 </template>
 <script setup lang="ts">
+import { Icon } from '@/components/Icon'
 import type { RouteLocationNormalizedLoaded } from 'vue-router'
 import { useRouter } from 'vue-router'
 import { usePermissionStore } from '@/store/modules/permission'
@@ -36,7 +49,6 @@ const visitedViews = computed(() => tagsViewStore.getVisitedViews)
 // 初始化tag
 const initTags = () => {
   affixTagArr.value = filterAffixTags(unref(routers))
-
   for (const tag of unref(affixTagArr)) {
     // Must have tag name
     if (tag.name) {
@@ -118,15 +130,67 @@ li {
   display: flex;
   align-items: center;
   background-color: #fff;
-  border-radius: 24px;
+  border-radius: 20px;
   .tag-view {
+    width: 100%;
+    height: 100%;
     ul {
+      width: 100%;
+      height: 100%;
       display: flex;
       align-items: center;
       li {
+        height: 100%;
         cursor: pointer;
+        a {
+          display: block;
+          width: auto;
+          height: 100%;
+          border-radius: 20px 20px 20px 20px;
+          color: inherit;
+          text-decoration: none;
+          padding: 2px;
+          box-sizing: border-box;
+        }
+        .homeBox {
+          width: 90px;
+          height: 100%;
+          opacity: 1;
+          display: flex;
+          align-items: center;
+          justify-content: center;
+          p {
+            margin-left: 5px;
+          }
+        }
+        .fhomeBox {
+          width: 130px;
+          height: 100%;
+          display: flex;
+          align-items: center;
+          justify-content: space-between;
+          padding: 0 10px;
+          div {
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            p {
+              margin-left: 5px;
+            }
+          }
+          img {
+            cursor: pointer;
+            margin-top: 4px;
+            display: block;
+          }
+        }
       }
     }
   }
 }
+
+::v-deep .router-link-active {
+  border: 2px solid #2e77e6;
+  padding: 0px !important;
+}
 </style>

+ 13 - 0
client/src/views/OaSystem/oaLayout/weather.vue

@@ -0,0 +1,13 @@
+<template>
+  <div class="_weather">
+    <div class="tqBox">
+      <img src="@/assets/imgs/OA/layout/clearDay.png" alt="" />
+    </div>
+    <div class="posBox"></div>
+  </div>
+</template>
+<script setup lang="ts">
+/** 初始化 **/
+onMounted(() => {})
+</script>
+<style lang="scss" scoped></style>