1
shuishen
2022-12-27 31d45f9f68fa0dbab7d32482059429187ffed260
1
3 files modified
46 ■■■■ changed files
src/permission.js 12 ●●●● patch | view | raw | blame | history
src/utils/auth.js 4 ●●●● patch | view | raw | blame | history
src/views/lyout/index.vue 30 ●●●●● patch | view | raw | blame | history
src/permission.js
@@ -2,19 +2,19 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 16:16:10
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2022-08-18 17:18:58
 * @FilePath: \srs-psb\src\permission.js
 * @LastEditTime: 2022-12-27 09:00:06
 * @FilePath: \srs-police-affairs\src\permission.js
 * @Description: 路由守卫
 * 
 * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved. 
 */
import router from '@/router/page/index'
// import {
//     getToken
// } from './utils/auth'
import {
    getToken
} from './utils/auth'
router.beforeEach((to, from, next) => {
    // const meta = to.meta || {}
    const meta = to.meta || {}
    next()
    // if (getToken()) {
    //     if (to.path === '/login') { // 如果登录成功访问登录页跳转到主页
src/utils/auth.js
@@ -2,8 +2,8 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-07-28 17:50:14
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2022-08-05 11:45:20
 * @FilePath: \zhny-dsj\src\utils\auth.js
 * @LastEditTime: 2022-12-26 14:31:40
 * @FilePath: \srs-police-affairs\src\utils\auth.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export const getToken = () => {
src/views/lyout/index.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 16:18:24
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2022-12-19 11:24:14
 * @LastEditTime: 2022-12-27 09:32:53
 * @FilePath: \srs-police-affairs\src\views\lyout\index.vue
 * @Description: 
 * 
@@ -18,8 +18,8 @@
                    <div class="sub-nav-list" v-show="item.children && item.childrenFlag">
                        <div v-for="(subItem, subIndex) in item.children" :key="subIndex" @click="goToPath(subItem)">
                            {{
                                    subItem.menuName
                            }}
        subItem.menuName
}}
                        </div>
                    </div>
                </div>
@@ -37,8 +37,8 @@
                    <div class="sub-nav-list" v-show="item.children && item.childrenFlag">
                        <div v-for="(subItem, subIndex) in item.children" :key="subIndex" @click="goToPath(subItem)">
                            {{
                                    subItem.menuName
                            }}
        subItem.menuName
}}
                        </div>
                    </div>
                </div>
@@ -46,12 +46,12 @@
            <!-- 用户登录展示的 -->
            <div class="user-infor" @click="openUser">
                <div class="userIcon" :class="{on: userOn == true}">
                <div class="userIcon" :class="{ on: userOn == true }">
                    <i class="el-icon-user-solid"></i>
                </div>
                <div class="userDetail" v-if="isShowUserDetail">
                    <div class="triangle"></div>
                    <div class="userName">用户名:{{user.user_name}}</div>
                    <div class="userName">用户名:{{ user.user_name }}</div>
                    <div class="userBtn">
                        <div class="edit" @click="goTOLogout">
                            <img src="../../../public/img/bg/editLogin.webp" alt />
@@ -93,7 +93,7 @@
</template>
<script>
import getUserInfo from '@/utils/auth'
import { getUserInfo } from '@/utils/auth'
export default {
    data () {
        return {
@@ -148,14 +148,14 @@
            currentUrl: '/lyout/home',
            userOn: false,
            isShowUserDetail: false,
            user:{}
            user: {}
        }
    },
    created () {
        this.currentUrl = this.$route.path
        this.user = getUserInfo()
        console.log(this.user,4451211)
        console.log(this.user, 4451211)
    },
    watch: {
@@ -185,9 +185,9 @@
    methods: {
        //登出
        goTOLogout(){
        goTOLogout () {
            //跳转登录页
            this.$router.push({ path: "/login" });
            this.$router.push({ path: "/login" })
        },
        /**
         * @description: 路由跳转的事件
@@ -444,6 +444,7 @@
            .userIcon.on {
                color: rgba(252, 189, 86, 1);
            }
            .userDetail {
                width: 180px;
                height: 92px;
@@ -466,6 +467,7 @@
                    border-left-color: transparent;
                    border-right-color: transparent;
                }
                .userName {
                    width: 100%;
                    height: 40px;
@@ -477,6 +479,7 @@
                    position: absolute;
                    top: 0px;
                }
                .userBtn {
                    width: 100%;
                    height: 50px;
@@ -486,13 +489,14 @@
                    justify-content: space-around;
                    padding-top: 4px;
                    & > div {
                    &>div {
                        width: 100px;
                        height: 40px;
                        background-color: rgba(168, 222, 255, 0.6);
                        border-radius: 4px;
                        cursor: pointer;
                        line-height: 44px;
                        img {
                            width: 76px;
                            height: 20px;