123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432 |
- <template>
- <div class="common-layout">
- <el-container>
- <el-header
- class="nav"
- style="position: sticky; top: 0; left: 0; width: 100%; z-index: 999"
- >
- <div class="nav-top">
- <div>
- <img src="@/assets/images/logos.png" /><span
- >聚合智慧文档管理系统</span
- >
- </div>
- <div class="search">
- <el-input
- v-model="searchText"
- maxlength="32"
- class="w-50 m-2"
- size="small"
- placeholder="搜索文件"
- suffix-icon="Search"
- clearable
- @change="toSearch"
- @@keyup.enter="toSearch"
- />
- </div>
- <div>
- <el-dropdown
- @command="handleCommand"
- class="right-menu-item hover-effect"
- trigger="click"
- >
- <div class="avatar-wrapper">
- <img
- :src="
- userStore.avatar
- ? userStore.avatar
- : '@/assets/images/profile.png'
- "
- class="head-img"
- /><span>{{ userStore.name }}</span>
- </div>
- <template #dropdown>
- <el-dropdown-menu>
- <router-link to="/user/profile">
- <el-dropdown-item>个人中心</el-dropdown-item>
- </router-link>
- <el-dropdown-item divided command="logout">
- <span>退出登录</span>
- </el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- </div>
- </div>
- </el-header>
- <el-container>
- <el-aside width="92px" class="asides">
- <div class="aside-con">
- <router-link
- :to="item.path"
- v-for="(item, index) in menuList.data"
- :key="index"
- @click="clickPath(index, item)"
- ><div
- style="position: relative"
- :class="
- $route.path == item.path
- ? 'acitve-img-style img-style'
- : 'img-style'
- "
- >
- <img
- :src="$route.path == item.path ? item.beimgs : item.imgs"
- />
- <div class="text-style" v-if="$route.path != item.path">
- {{ item.label }}
- </div>
- <span
- class="yuandian"
- v-if="
- websoctStore.messOne?.fromId &&
- item.path == '/index' &&
- $route.path != item.path&&clickId!==index
- "
- ></span>
- </div> </router-link
- ><br />
- </div>
- </el-aside>
- <el-main class="main">
- <router-view v-if="isAlive"></router-view>
- </el-main>
- </el-container>
- </el-container>
- </div>
- </template>
- <script setup>
- import { nextTick, onMounted, provide, ref } from "vue";
- import { ElMessageBox } from "element-plus";
- import useAppStore from "@/store/modules/app";
- import useUserStore from "@/store/modules/user";
- import useSettingsStore from "@/store/modules/settings";
- import Cookies from "js-cookie";
- import chat from "@/assets/images/chat.png";
- import bechat from "@/assets/images/bechat.png";
- import zuijin from "@/assets/images/zuijin.png";
- import bezuijin from "@/assets/images/bezuijin.png";
- import colloect from "@/assets/images/colloect.png";
- import becolloect from "@/assets/images/becolloect.png";
- import system from "@/assets/images/system.png";
- import issystem from "@/assets/images/issystem.png";
- import my from "@/assets/images/my.png";
- import bemy from "@/assets/images/bemy.png";
- import bumen from "@/assets/images/bumen.png";
- import bebumen from "@/assets/images/bebumen.png";
- import common from "@/assets/images/common.png";
- import becommon from "@/assets/images/becommon.png";
- import chuanshu from "@/assets/images/chuanshu.png";
- import bechuanshu from "@/assets/images/bechuanshu.png";
- import highsearch from "@/assets/images/highsearch.png";
- import behighsearch from "@/assets/images/behighsearch.png";
- import manyBody from "@/assets/images/manyBody.png";
- import manyBodyFalse from "@/assets/images/manyBodyFalse.png";
- import { AppMain, Navbar, Settings, TagsView } from "./components";
- import { flieSearch } from "@/api/search/search.js";
- import { useRouter, useRoute } from "vue-router";
- import useWebsoctStore from "@/store/modules/websocket";
- const websoctStore = useWebsoctStore();
- const router = useRouter(); //注册路由
- const route = useRoute();
- const appStore = useAppStore();
- const userStore = useUserStore();
- const settingsStore = useSettingsStore();
- const searchText = ref(""); //搜索ipt的值
- const selectValue = ref(1); //文档空间类型
- const wangzhi=import.meta.env.VITE_APP_BASE_API
- const isAlive = ref(true);
- function reload() {
- isAlive.value = false;
- console.log(11);
- nextTick(() => {
- isAlive.value = true;
- });
- }
- provide("reload", reload);
- function toggleSideBar() {
- appStore.toggleSideBar();
- }
- const logingName = ref("");
- onMounted(() => {
- logingName.value = Cookies.get("username");
- // console.log('router',router)
- });
- function handleCommand(command) {
- switch (command) {
- case "setLayout":
- setLayout();
- break;
- case "logout":
- logout();
- break;
- default:
- break;
- }
- }
- function logout() {
- ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- userStore.logOut().then(() => {
- location.href = "/index";
- });
- })
- .catch(() => {});
- }
- // 跳转到全文搜索
- const toSearch = async () => {
- if (!searchText.value) return;
- // console.log('searchText = ',searchText.value);
- const query = {
- keyword: searchText.value,
- isAsc: "asc",
- orderByColumn: "createTime",
- pageSize:3,
- pageNum:1
- };
- const res = await flieSearch(query);
- // console.log("res", res);
- if (res) {
- // console.log("res", res);
- // console.log("router", route.path);
- if (route.path != "/search") {
- router.push({
- path: "/search",
- query: {
- searchData: JSON.stringify(res),
- searchText: searchText.value,
- },
- });
- } else {
- router.replace({
- path: "/allback",
- query: {
- searchData: JSON.stringify(res),
- searchText: searchText.value,
- },
- });
- }
- }
- };
- const emits = defineEmits(["setLayout"]);
- function setLayout() {
- emits("setLayout");
- }
- const clickId = ref("");
- const menuList = reactive({
- data: [
- {
- label: "会话消息",
- path: "/index",
- imgs: chat,
- beimgs: bechat,
- },
- // {
- // label: "接口",
- // path: "/swagger",
- // imgs: chat,
- // beimgs: bechat,
- // disabled:true
- // },
- {
- label: "最近文件",
- path: "/recent",
- imgs: zuijin,
- beimgs: bezuijin,
- },
- {
- label: "收藏文件",
- path: "/collect",
- imgs: colloect,
- beimgs: becolloect,
- },
- {
- label: "我的文件",
- path: "/myfile",
- imgs: my,
- beimgs: bemy,
- },
- {
- label: "部门文件",
- path: "/department",
- imgs: bumen,
- beimgs: bebumen,
- },
- {
- label: "公共文件",
- path: "/swagger",
- imgs: common,
- beimgs: becommon,
- },
- {
- label: "高级搜索",
- path: "/highsearch",
- imgs: highsearch,
- beimgs: behighsearch,
- },
- {
- label: "传输列表",
- path: "/transFile",
- imgs: chuanshu,
- beimgs: bechuanshu,
- },
- {
- label: "系统管理",
- path: "/admin",
- imgs: system,
- beimgs: issystem,
- },
- {
- label: "我的协作",
- path: "/myjoin",
- imgs: manyBody,
- beimgs: manyBodyFalse,
- },
- ],
- });
- const clickPath = (index, items) => {
- clickId.value = index;
- };
- </script>
- <style lang="scss" scoped>
- @import "@/assets/styles/mixin.scss";
- @import "@/assets/styles/variables.module.scss";
- //整体布局css
- .common-layout,
- .el-container {
- height: 94vh;
- }
- :deep .el-main {
- --el-main-padding: 8px !important;
- }
- .nav {
- background: #06286c;
- height: 48px;
- .nav-top {
- width: 98%;
- display: flex;
- justify-content: space-between;
- & > div:first-child {
- font-family: "Inter-SemiBold";
- }
- & > div:first-child,
- & > div:last-child {
- display: flex;
- align-items: center;
- color: #fff;
- & > img {
- width: 48px;
- height: 48px;
- }
- }
- }
- .head-img {
- border-radius: 12px;
- width: 24px;
- height: 24px;
- margin-right: 10px;
- }
- .avatar-wrapper {
- color: #fff;
- display: flex;
- align-items: center;
- }
- .search {
- .w-50,
- :deep .el-input {
- width: 400px;
- height: 32px;
- border-radius: 4px;
- margin-top: 8px;
- background: #6f85b5 !important;
- --el-input-border-color: #6f85b5;
- }
- ::v-deep .el-input__inner {
- color: #fff !important;
- }
- }
- :deep .el-input__wrapper {
- background: #1f3f7e !important;
- }
- }
- .asides {
- padding: 8px 10px !important;
- font-size: 14px;
- color: #000;
- background: #fff;
- }
- .main {
- background: #c7cbd8;
- }
- //侧边栏css
- .acitve-img-style {
- background-color: #f5f7f9;
- border-radius: 4px;
- }
- .img-style {
- width: 72px;
- height: 72px;
- display: flex;
- margin-bottom: 8px;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- & > img {
- width: 40px;
- height: 40px;
- }
- }
- .text-style {
- text-align: center;
- color: #000;
- }
- </style>
- <style lang="scss">
- .el-popper.is-light.type_popper {
- background-color: #1f3f7e !important;
- border-radius: 4px 4px 4px 4px !important;
- border: none !important;
- // padding: 0 16px !important;
- // box-sizing: border-box !important;
- }
- .el-popper__arrow::before {
- content: none;
- }
- //鼠标移动上去的选中色
- .type_popper {
- .el-select-dropdown__item.hover,
- .el-select-dropdown__item:hover {
- background: #6f85b5 !important;
- }
- //下拉框的文本颜色
- .el-select-dropdown__item {
- color: #a4b0d8 !important;
- }
- //选中之后的颜色
- .el-select-dropdown__item.selected {
- background: #6f85b5 !important;
- color: #fff !important;
- }
- }
- .yuandian {
- width: 8px;
- height: 8px;
- position: absolute;
- right: 8px;
- top: 6px;
- background: #fa5151;
- border-radius: 4px;
- }
- </style>
|