From f19b8d3466d2963c7f515bb22b3f9181519dbecf Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期四, 12 九月 2024 10:13:37 +0800 Subject: [PATCH] 调整 --- src/views/home/index.vue | 14 ---- src/layout/components/Sidebar/Logo.vue | 6 +- src/views/login/index.vue | 4 + src/layout/components/Navbar.vue | 38 ++++++------ src/layout/index.vue | 18 ++++++ src/styles/variables.scss | 4 src/layout/components/Sidebar/index.vue | 4 src/views/student/index.vue | 6 +- src/router/index.js | 56 +++++++++--------- 9 files changed, 78 insertions(+), 72 deletions(-) diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 0ca5cf6..53ce25c 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -3,27 +3,17 @@ <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> <breadcrumb class="breadcrumb-container" /> - + <!-- 鍥哄畾鍙充笂瑙� --> + <h3 style="position: fixed; top: 0; font-size: 16px; color: #5a5e66; " :style="'right:' + orgCss() ">{{ getOrgName() }}</h3> <div class="right-menu"> <el-dropdown class="avatar-container" trigger="click"> <div class="avatar-wrapper"> - <img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar"> - <i class="el-icon-caret-bottom" /> + {{ '浣犲ソ锛�' + getUserName() }} + <i class="el-icon-caret-bottom"></i> </div> <el-dropdown-menu slot="dropdown" class="user-dropdown"> - <router-link to="/"> - <el-dropdown-item> - Home - </el-dropdown-item> - </router-link> - <a target="_blank" href="https://github.com/PanJiaChen/vue-admin-template/"> - <el-dropdown-item>Github</el-dropdown-item> - </a> - <a target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/#/"> - <el-dropdown-item>Docs</el-dropdown-item> - </a> - <el-dropdown-item divided @click.native="logout"> - <span style="display:block;">Log Out</span> + <el-dropdown-item @click.native="logout"> + <span style="display:block;">閫�鍑虹櫥褰�</span> </el-dropdown-item> </el-dropdown-menu> </el-dropdown> @@ -48,12 +38,21 @@ ]) }, methods: { + orgCss() { + return JSON.parse(localStorage.getItem("user")).name.length * 20 + 100 + 'px'; + }, + getOrgName() { + return JSON.parse(localStorage.getItem("user")).staffs[0].org.name; + }, + getUserName() { + return JSON.parse(localStorage.getItem("user")).name; + }, toggleSideBar() { this.$store.dispatch('app/toggleSideBar') }, async logout() { - await this.$store.dispatch('user/logout') - this.$router.push(`/login?redirect=${this.$route.fullPath}`) + // await this.$store.dispatch('user/logout') + this.$router.push(`/login`) } } } @@ -112,11 +111,12 @@ } .avatar-container { - margin-right: 30px; + margin-right: 50px; .avatar-wrapper { margin-top: 5px; position: relative; + cursor: pointer; .user-avatar { cursor: pointer; diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue index 040fab6..cfbc216 100644 --- a/src/layout/components/Sidebar/Logo.vue +++ b/src/layout/components/Sidebar/Logo.vue @@ -24,8 +24,8 @@ }, data() { return { - title: 'Vue Admin Template', - logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png' + title: '鍙綋寰暀鍔�', + logo: 'https://s1.locimg.com/2024/09/11/ba34571897536.png' } } } @@ -64,7 +64,7 @@ & .sidebar-title { display: inline-block; margin: 0; - color: #fff; + color: #FFF; font-weight: 600; line-height: 50px; font-size: 14px; diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index da39034..ea7723a 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -1,5 +1,5 @@ <template> - <div :class="{'has-logo':showLogo}"> + <div :class="{'has-logo':showLogo}" style="border-right: 1px solid #DDE0E2;"> <logo v-if="showLogo" :collapse="isCollapse" /> <el-scrollbar wrap-class="scrollbar-wrapper"> <el-menu @@ -43,7 +43,7 @@ return path }, showLogo() { - return this.$store.state.settings.sidebarLogo + return true; }, variables() { return variables diff --git a/src/layout/index.vue b/src/layout/index.vue index db22a7b..dee6d98 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -14,6 +14,7 @@ <script> import { Navbar, Sidebar, AppMain } from './components' import ResizeMixin from './mixin/ResizeHandler' +import { login } from "@/api/user"; export default { name: 'Layout', @@ -42,7 +43,24 @@ } } }, + mounted() { + // 鑾峰彇鍦板潃鏍廲ode + let code = this.$route.query.code; + if (code) { + this.getUserDate(code); + } + // else { + // this.$router.push("/login"); + // } + }, methods: { + getUserDate(code) { + login({ + code: code, + }).then((res) => { + localStorage.setItem("user", JSON.stringify(res)); + }); + }, handleClickOutside() { this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) } diff --git a/src/router/index.js b/src/router/index.js index 429adb9..b259f99 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,32 +43,32 @@ hidden: true, }, - { - path: "/", - component: Layout, - redirect: "/home", - children: [ - { - path: "home", - name: "home", - component: () => import("@/views/home/index"), - meta: { title: "棣栭〉", icon: "dashboard" }, - }, - ], - }, - { - path: "/", - component: Layout, - redirect: "/curriculum", - children: [ - { - path: "/curriculum", - name: "Curriculum", - component: () => import("@/views/curriculum/index"), - meta: { title: "璇捐〃", icon: "table" }, - }, - ], - }, + // { + // path: "/", + // component: Layout, + // redirect: "/home", + // children: [ + // { + // path: "home", + // name: "home", + // component: () => import("@/views/home/index"), + // meta: { title: "棣栭〉", icon: "dashboard" }, + // }, + // ], + // }, + // { + // path: "/", + // component: Layout, + // redirect: "/curriculum", + // children: [ + // { + // path: "/curriculum", + // name: "Curriculum", + // component: () => import("@/views/curriculum/index"), + // meta: { title: "璇捐〃", icon: "table" }, + // }, + // ], + // }, { path: "/", component: Layout, @@ -78,7 +78,7 @@ path: "/student", name: "Student", component: () => import("@/views/student/index"), - meta: { title: "瀛﹀憳", icon: "table" }, + meta: { title: "瀛﹀憳鍒楄〃", icon: "table" }, }, ], }, @@ -91,7 +91,7 @@ path: "/class", name: "Class", component: () => import("@/views/class/index"), - meta: { title: "鐝骇", icon: "table" }, + meta: { title: "鐝骇鍒楄〃", icon: "table" }, }, ], }, diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 72dd7b0..a048ec5 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -1,9 +1,9 @@ // sidebar -$menuText:#323232; +$menuText:rgb(191, 203, 217); $menuActiveText:#409EFF; $subMenuActiveText:#409EFF; //https://github.com/ElemeFE/element/issues/12951 -$menuBg:rgb(119, 183, 228); +$menuBg:#304156; $menuHover:#c3e8ff; $subMenuBg:#c3ebff; diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 2d478c1..52c1a30 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -44,22 +44,8 @@ } }, mounted() { - // 鑾峰彇鍦板潃鏍廲ode - let code = this.$route.query.code; - if (code) { - this.getUserDate(code); - } else { - this.$router.push("/login"); - } }, methods: { - getUserDate(code) { - login({ - code: code, - }).then((res) => { - localStorage.setItem("user", JSON.stringify(res)); - }); - }, }, }; </script> diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 4ab0742..c391125 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -100,7 +100,7 @@ }; return { appid: "wx7103925df6236723", - redirect_uri: encodeURIComponent("https://dingdang.9village.cn"), + redirect_uri: encodeURIComponent("https://dingdang.9village.cn/#/student"), state: "1", href: "data:text/css;base64,LmltcG93ZXJCb3ggLnFyY29kZSB7CiAgICAgICAgICBib3JkZXI6IG5vbmU7CiAgICAgICAgICB3aWR0aDogMTQwcHg7CiAgICAgICAgICBoZWlnaHQ6IDE0MHB4OwogICAgICAgIH0=", // 鑷畾涔夋牱寮忛摼鎺� loginForm: { @@ -191,6 +191,8 @@ /* reset element-ui css */ .login-container { + // background-image: url('https://s1.locimg.com/2024/09/12/891ab39f72938.png'); + // background-size: contain; display: flex; align-items: center; justify-content: center; diff --git a/src/views/student/index.vue b/src/views/student/index.vue index 9e17455..905a089 100644 --- a/src/views/student/index.vue +++ b/src/views/student/index.vue @@ -10,10 +10,10 @@ <!-- <el-button type="primary" size="small" @click="showCreate">鏂板缓瀛﹀憳</el-button> --> <el-button type="primary" size="small" @click="handleExport">瀵煎嚭瀛﹀憳</el-button> <div style="width: 500px"> - <el-date-picker v-model="dateRange" type="daterange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" + <!-- <el-date-picker v-model="dateRange" type="daterange" range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡" value-format="yyyy-MM-dd" style="margin-right: 10px"> </el-date-picker> - <el-button type="primary" @click="handleExport2">瀵煎嚭璇惧寘</el-button> + <el-button type="primary" @click="handleExport2">瀵煎嚭璇惧寘</el-button> --> </div> <div style="width: 300px"> <el-input @@ -179,7 +179,7 @@ this.list = response.data.findPlayerByStaff.ls; this.total = response.data.findPlayerByStaff.pageOut.total; this.listLoading = false; - }); + }) }, handleSizeChange(val) { this.data.pageIn.size = val; -- Gitblit v1.8.0