ZaiZai 1 tahun lalu
induk
melakukan
e2c7c67858

+ 0 - 1
src/components/install.js

@@ -13,7 +13,6 @@ import 'hc-vue3-ui/scss'
 //导入其它样式
 import '../styles/app/main.scss'
 import '../styles/app/element.scss'
-import '../styles/app/theme.scss'
 
 //注册全局组件
 export const setupInstall = (App) => {

+ 5 - 56
src/layout/index.vue

@@ -1,35 +1,21 @@
 <template>
     <el-container class="hc-layout-box">
         <el-header class="hc-layout-header">
-            <div class="hc-layout-header-logo" :style="`width: ${isCollapse ? '90px' : '200px'};`" @click="logoClick">
-                <span v-if="!isCollapse" class="logo-name">{{ appLogoName }}</span>
-                <span v-else class="logo-name sub">管理后台</span>
-            </div>
-            <div class="header-top-collapse-bar" @click="collapseChange">
-                <hc-icon v-if="isCollapse" name="menu-unfold" />
-                <hc-icon v-else name="menu-fold" />
-            </div>
-            <div class="header-top-menu-bar">
-                <TopMenu />
-            </div>
             <div class="header-content-bar">
                 <hc-upload-bar />
                 <HcRefresh />
-                <HcColor />
-                <HcTheme />
                 <UserInfoBar @load="userInfoLoad" />
             </div>
         </el-header>
         <el-container class="hc-layout-container">
-            <el-aside class="hc-layout-aside" :class="[isCollapse ? 'is-collapse' : '']" :width="isCollapse ? '90px' : '200px'">
-                <MenuBar :collapse="isCollapse" :cur="menuBarKey" :datas="menuBarData" :msg-count="msgCount" @change="menuBarChange" />
+            <el-aside class="hc-layout-aside" width="200px">
+                <MenuBar :cur="menuBarKey" :datas="menuBarData" @change="menuBarChange" />
             </el-aside>
             <el-main class="hc-layout-main">
-                <div class="hc-router-menu-bar">
-                    <RouterMenu @load="routerMenuLoad" />
-                </div>
                 <div id="hc-main-box" class="hc-main-page">
-                    <MainBody />
+                    <hc-body>
+                        <router-view />
+                    </hc-body>
                 </div>
             </el-main>
         </el-container>
@@ -47,17 +33,9 @@ const router = useRouter()
 const store = useAppStore()
 
 //子组件
-import TopMenu from './modules/TopMenu.vue'
 import MenuBar from './modules/MenuBar.vue'
 import HcRefresh from './modules/Refresh.vue'
-import HcColor from './modules/Color.vue'
-import HcTheme from './modules/Theme.vue'
 import UserInfoBar from './modules/UserInfoBar.vue'
-import RouterMenu from './modules/RouterMenu.vue'
-import MainBody from './modules/mainBody.vue'
-
-//logo
-const appLogoName = ref(store.getLogoName)
 
 //菜单数据
 const menuBarKey = ref('')
@@ -68,46 +46,17 @@ onMounted(() => {
     initButtons()
 })
 
-//路由信息
-const routerMenuLoad = ({ key }) => {
-    menuBarKey.value = key
-}
-
-// 是否折叠
-const isCollapse = ref(false)
-const collapseChange = () => {
-    const bool = !isCollapse.value
-    isCollapse.value = bool
-    store.setCollapse(bool)
-}
-
 //菜单被点击
 const menuBarChange = ({ code }) => {
     menuBarKey.value = code
     router.push({ name: code })
 }
 
-//消息数量
-const msgCount = ref({
-    allCount: 0,
-    taskCount: 0,
-    messageCount: 0,
-    messageCount_1: 0,
-    messageCount_2: 0,
-    messageCount_3: 0,
-    messageCount_4: 0,
-    messageCount_5: 0,
-})
 
 //用户信息
 const userInfoLoad = ({ user_id }) => {
     console.log('用户信息', user_id)
 }
-
-//首页
-const logoClick = () => {
-    router.push({ name: 'index' })
-}
 </script>
 
 <style lang="scss">

+ 0 - 59
src/layout/modules/Color.vue

@@ -1,59 +0,0 @@
-<template>
-    <div class="header-icon-bar" @click="tapClick">
-        <el-tooltip content="主色调" placement="top">
-            <hc-icon name="palette" class="header-icon" />
-        </el-tooltip>
-        <i class="color-dot" :style="`background: ${color};`" />
-        <el-color-picker ref="colorRef" v-model="color" size="small" :predefine="colors" @change="colorChange" />
-    </div>
-</template>
-
-<script setup>
-import { onMounted, ref } from 'vue'
-import { useAppStore } from '~src/store'
-import { userConfigSave } from '~api/other'
-import { setElementMainColor } from 'js-fast-way'
-
-const store = useAppStore()
-
-//主题色
-const colorRef = ref(null)
-const color = ref(store.getColor)
-const colors = ['#4980F7', '#1ECC95', '#37c0fe', '#8044de', '#b745cb', '#e03997', '#e54d42', '#f37b1d', '#a5673f']
-
-//渲染完成
-onMounted(() => {
-    setElementMainColor(color.value)
-})
-
-//点击事件
-const tapClick = () => {
-    colorRef.value?.show()
-}
-
-//颜色改变
-const colorChange = (val) => {
-    store.setColor(val)
-    setElementMainColor(val)
-    userConfigSave({ color: val })
-}
-</script>
-
-<style lang="scss" scoped>
-.header-icon-bar .color-dot {
-    position: absolute;
-    width: 8px;
-    height: 5px;
-    bottom: 11.5px;
-    right: 0;
-}
-</style>
-
-<style lang="scss">
-.header-icon-bar .el-color-picker {
-    width: 0;
-    height: 0;
-    margin-top: 44px;
-    z-index: -1;
-}
-</style>

+ 2 - 2
src/layout/modules/Refresh.vue

@@ -10,7 +10,7 @@
 import { nextTick, ref } from 'vue'
 import { setRouterData } from '~sto/user'
 import { initButtons } from '~sto/app'
-import { delStoreValue } from '~src/utils/storage'
+import { delStore } from 'hc-vue3-ui'
 
 //被点击
 const isLoading = ref(false)
@@ -23,7 +23,7 @@ const tapClick = async () => {
         return { error: true, msg: '路由异常' }
     }
     //获取按钮权限数据
-    delStoreValue('buttons')
+    delStore('buttons')
     await nextTick()
     await initButtons()
     //刷新路由

+ 0 - 136
src/layout/modules/RouterMenu.vue

@@ -1,136 +0,0 @@
-<template>
-    <el-scrollbar>
-        <div class="hc-router-tab-box">
-            <div class="hc-router-tab-item" :class="(barRoutes.key === 'home' || barRoutes.key === 'index') ? 'cur' : ''" @click="toHomeClick">首页</div>
-            <template v-for="(item, index) in barMenuData" :key="item.key">
-                <div
-                    :class="item.key === barRoutes.key ? 'cur' : ''" class="hc-router-tab-item"
-                    @click="barMenuClick(item)" @contextmenu.prevent="barMenuContextMenu($event, item, index)"
-                >
-                    <span>{{ item.title }}</span>
-                    <div class="close-icon" @click.stop="barMenuCloseClick(item, index)">
-                        <hc-icon name="close" />
-                    </div>
-                </div>
-            </template>
-        </div>
-    </el-scrollbar>
-    <!-- 右键菜单 -->
-    <hc-context-menu ref="contextMenuRef" :datas="menusData" @item-click="handleMenuSelect" />
-</template>
-
-<script setup>
-import { onMounted, ref, watch } from 'vue'
-import { useRoute, useRouter } from 'vue-router'
-import { getStore, setStore } from 'hc-vue3-ui'
-
-const emit = defineEmits(['load'])
-//初始组合式
-const router = useRouter()
-const useRoutes = useRoute()
-
-//初始变量
-const barMenuData = ref(getStore('bar-menu-datas') || [])
-const barRoutes = ref({ key: '', path: '', title: '', query: null })
-
-//渲染完成
-onMounted(() => {
-    const { name, path, meta, query } = useRoutes
-    barRoutes.value = { path, key: name, title: meta?.title, query }
-    setBarMenuData()
-})
-
-//监听
-watch(() => [
-    useRoutes?.name,
-    useRoutes?.path,
-    useRoutes?.query,
-    useRoutes?.meta?.title,
-], ([key, path, query, title]) => {
-    barRoutes.value = { path, key, title, query }
-    setBarMenuData()
-})
-
-//设置菜单数据
-const setBarMenuData = () => {
-    const { key, path, title, query } = barRoutes.value
-    if (['home', 'index'].indexOf(key) === -1) {
-        const index = barMenuData.value.findIndex(item => item.key === key)
-        if (index === -1) {
-            barMenuData.value.push({ path, key: key, title, query })
-        }
-        setStore('bar-menu-datas', barMenuData.value)
-    }
-    emit('load', barRoutes.value)
-}
-
-//菜单被点击
-const barMenuClick = (item) => {
-    const { key } = barRoutes.value
-    if (key !== item.key) {
-        router.push({ name: item.key, query: item.query })
-    }
-}
-
-//鼠标右键菜单
-const contextMenuRef = ref(null)
-const barItem = ref({})
-const barItemIndex = ref(0)
-const menusData = ref([
-    { label: '关闭当前', key: 'close' },
-    { label: '关闭所有', key: 'all' },
-    { label: '关闭其它', key: 'other' },
-])
-const barMenuContextMenu = (event, item, index) => {
-    event.preventDefault()
-    barItem.value = item
-    barItemIndex.value = index
-    contextMenuRef.value?.showMenu(event)
-}
-
-//鼠标右键菜单被点击
-const handleMenuSelect = ({ key }) => {
-    if (key === 'close') {
-        barMenuCloseClick(barItem.value, barItemIndex.value)
-    } else if (key === 'all') {
-        barMenuData.value = []
-        setStore('bar-menu-datas', [])
-        router.push({ name: 'index' })
-    } else if (key === 'other') {
-        const { key } = barRoutes.value
-        barMenuData.value = barMenuData.value.filter(item => item.key === key)
-        setStore('bar-menu-datas', barMenuData.value)
-    }
-}
-
-//菜单关闭被点击
-const barMenuCloseClick = (item, index) => {
-    const total = barMenuData.value.length - 1
-    const { key } = barRoutes.value
-    barMenuData.value.splice(index, 1)
-    if (key === item.key) {
-        let items = {}
-        const indexs = barMenuData.value.length - 1
-        if (total > index) {
-            items = barMenuData.value[index]
-        } else if (indexs >= 0) {
-            items = barMenuData.value[indexs]
-        }
-        if (indexs < 0) {
-            setStore('bar-menu-datas', barMenuData.value)
-            router.push({ name: 'index' })
-        } else {
-            barRoutes.value = items
-            setStore('bar-menu-datas', barMenuData.value)
-            router.push({ name: items.key, query: items.query })
-        }
-    } else {
-        setStore('bar-menu-datas', barMenuData.value)
-    }
-}
-
-//点击了首页
-const toHomeClick = () => {
-    router.push({ name: 'index' })
-}
-</script>

+ 0 - 44
src/layout/modules/Theme.vue

@@ -1,44 +0,0 @@
-<template>
-    <el-dropdown size="large" trigger="click">
-        <div class="header-icon-bar">
-            <el-tooltip content="主题皮肤" placement="top">
-                <hc-icon name="t-shirt" class="header-icon" />
-            </el-tooltip>
-        </div>
-        <template #dropdown>
-            <el-dropdown-menu>
-                <el-dropdown-item @click="themeChange('default')">默认主题</el-dropdown-item>
-                <el-dropdown-item @click="themeChange('vip')">VIP主题</el-dropdown-item>
-            </el-dropdown-menu>
-        </template>
-    </el-dropdown>
-</template>
-
-<script setup>
-import { onMounted, ref } from 'vue'
-import { useAppStore } from '~src/store'
-import { userConfigSave } from '~api/other'
-
-const store = useAppStore()
-
-//主题
-const theme = ref(store.getTheme)
-
-//渲染完成
-onMounted(() => {
-    setThemeStyle()
-})
-
-//主题改变
-const themeChange = (val) => {
-    theme.value = val
-    store.setTheme(val)
-    setThemeStyle()
-    userConfigSave({ theme: val })
-}
-
-//设置主题样式
-const setThemeStyle = () => {
-    document.documentElement.setAttribute('class', `theme-${theme.value}`)
-}
-</script>

+ 0 - 41
src/layout/modules/TopMenu.vue

@@ -1,41 +0,0 @@
-<template>
-    <el-scrollbar>
-        <div v-for="item in topMenuData" :key="item.key" class="hc-top-menu-bar-item" @click="barMenuClick(item)">
-            <hc-icon v-if="item?.source" :name="item.source" />
-            <span class="name">{{ item.name }}</span>
-        </div>
-    </el-scrollbar>
-</template>
-
-<script setup>
-import { onMounted, ref } from 'vue'
-import { getArrValue, newWindow } from 'js-fast-way'
-import { isPathUrl } from '~uti/tools'
-import mainApi from '~api/system/menu-top'
-
-//渲染完成
-onMounted(() => {
-    getTopMenuData()
-})
-
-//获取顶部菜单
-const topMenuData = ref([])
-const getTopMenuData = async () => {
-    let menuData = []
-    const { data } = await mainApi.getData()
-    const res = getArrValue(data)
-    for (let i = 0; i < res.length; i++) {
-        if (isPathUrl(res[i].code)) {
-            menuData.push(res[i])
-        }
-    }
-    topMenuData.value = menuData
-}
-
-//菜单被点击
-const barMenuClick = (item) => {
-    if (isPathUrl(item.code)) {
-        newWindow(item.code)
-    }
-}
-</script>

+ 0 - 36
src/layout/modules/mainBody.vue

@@ -1,36 +0,0 @@
-<template>
-    <hc-body :padding="isPadding ? '12px' : '0px'">
-        <router-view v-slot="{ Component }">
-            <transition name="fade-transform">
-                <keep-alive :max="10">
-                    <component :is="Component" />
-                </keep-alive>
-            </transition>
-        </router-view>
-    </hc-body>
-</template>
-
-<script setup>
-import { onMounted, ref, watch } from 'vue'
-import { useRoute } from 'vue-router'
-
-//初始组合式
-const useRoutes = useRoute()
-
-//渲染完成
-onMounted(() => {
-    setBarRoutesData(useRoutes?.name)
-})
-
-//监听
-watch(() => useRoutes?.name, (name) => {
-    setBarRoutesData(name)
-})
-
-//判断数据
-const routes = ['/certificate/management', '/certificate/list', 'projectinfo/list']
-const isPadding = ref(true)
-const setBarRoutesData = (name) => {
-    isPadding.value = routes.indexOf(name) === -1
-}
-</script>

+ 5 - 5
src/router/index.js

@@ -7,7 +7,7 @@ import baseData from './modules/base'
 import { getRouterData } from './routers'
 
 //其它工具
-import { getToken } from "hc-vue3-ui"
+import { getToken } from 'hc-vue3-ui'
 import config from '~src/config/index'
 
 //设置路由数据
@@ -37,11 +37,11 @@ router.beforeResolve(async (to) => {
 
 router.afterEach((to) => {
     //根据当前跳转的路由设置显示在浏览器标签的title
-    let pageTitle = to.meta['title'], title = config.title;
-    if (to.path !== "/") {
-        window.document.title =  pageTitle?`${pageTitle} - ${title}`:title;
+    let pageTitle = to.meta['title'], title = config.title
+    if (to.path !== '/') {
+        window.document.title = pageTitle ? `${pageTitle} - ${title}` : title
     } else {
-        window.document.title = title;
+        window.document.title = title
     }
     window.scrollTo(0, 0)
     NProgress.done()

+ 1 - 1
src/router/routers.js

@@ -1,4 +1,4 @@
-import { getStore } from "hc-vue3-ui"
+import { getStore } from 'hc-vue3-ui'
 import { getArrValue } from 'js-fast-way'
 
 //获取路由菜单

+ 1 - 1
src/store/index.js

@@ -1,6 +1,6 @@
 import { defineStore } from 'pinia'
 import pinia from '~src/store/init'
-import { removeToken,removeRefreshToken, clearStoreAll,setStore,getStore } from 'hc-vue3-ui'
+import { clearStoreAll, getStore, removeRefreshToken, removeToken, setStore } from 'hc-vue3-ui'
 
 export const useAppStore = defineStore('main', {
     state: () => ({

+ 6 - 6
src/store/modules/app.js

@@ -1,14 +1,14 @@
 import pinia from '~src/store/init'
 import { useAppStore } from '~src/store'
-import { getButtons } from '~api/menu'
-import { getStore } from "hc-vue3-ui"
+//import { getButtons } from '~api/menu'
+import { getStore } from 'hc-vue3-ui'
 import { ArrToOneObj, getArrValue } from 'js-fast-way'
 
 const store = useAppStore(pinia)
 
 //按钮初始化
 export const initButtons = async () => {
-    const value = getStore('buttons')
+    /*const value = getStore('buttons')
     if (!value) {
         const { error, data } = await getButtons()
         if (error) return Promise.reject('error')
@@ -18,12 +18,12 @@ export const initButtons = async () => {
         return Promise.resolve(true)
     } else {
         return Promise.resolve(true)
-    }
+    }*/
 }
 
 //设置按钮
 const setButtonsData = async (data) => {
-    let buttonsArr = {}
+    /*let buttonsArr = {}
     await ArrToOneObj(data, 'code', buttonsArr)
-    return buttonsArr
+    return buttonsArr*/
 }

+ 6 - 6
src/store/modules/user.js

@@ -1,8 +1,8 @@
 import pinia from '~src/store/init'
 import { useAppStore } from '~src/store'
-import { getRoutes } from '~api/menu'
-import { setToken, getRefreshToken, setRefreshToken, setStore } from "hc-vue3-ui"
-import tokenData from '~src/router/modules/token'
+//import { getRoutes } from '~api/menu'
+import { getRefreshToken, setRefreshToken, setStore, setToken } from 'hc-vue3-ui'
+//import tokenData from '~src/router/modules/token'
 import { ArrToOneObj, getArrValue, getObjValue } from 'js-fast-way'
 //import { logout, refreshToken, userLogin } from '~api/user'
 
@@ -29,7 +29,7 @@ export const useAppLogin = async (form) => {
 
 //设置路由信息
 export const setRouterData = async () => {
-    const { error, data } = await getRoutes()
+    /*const { error, data } = await getRoutes()
     if (error) {
         return Promise.reject(false)
     }
@@ -42,7 +42,7 @@ export const setRouterData = async () => {
     store.setMenus(resData)
     setStore('route', routesObj)
     setStore('routes', routes)
-    return resData
+    return resData*/
 }
 
 //刷新token
@@ -67,5 +67,5 @@ export const RefreshToken = async () => {
 
 //登出
 export const LogOut = async () => {
-    return await logout()
+    //return await logout()
 }

+ 3 - 3
src/utils/tools.js

@@ -1,6 +1,6 @@
 import { nextTick } from 'vue'
 import { getArrValue } from 'js-fast-way'
-import { getBizDictionary, getDictionary } from '~api/other'
+//import { getBizDictionary, getDictionary } from '~api/other'
 
 //设置分割滑块
 export const setSplit = (ids, data) => {
@@ -32,7 +32,7 @@ export const isNumberReg = (text, lose = true) => {
 
 //获取字典数据
 export const getDictionaryData = async (code, biz = false) => {
-    let res = []
+    /*let res = []
     if (biz) {
         const { data } = await getBizDictionary({ code: code })
         res = getArrValue(data)
@@ -48,7 +48,7 @@ export const getDictionaryData = async (code, biz = false) => {
             value: Number(res[i]['dictKey']),
         })
     }
-    return newArr
+    return newArr*/
 }
 
 //判断是否为网址