当前位置:网站首页>Cremb Pro backend sub administrator 403 problem analysis
Cremb Pro backend sub administrator 403 problem analysis
2022-06-09 22:00:00 【InfoQ】
Problem description :
Possible causes :
The final question :
Processing mode :

Final treatment :


import { getHeaderName, getHeaderSider, getMenuSider } from '@/libs/system';
getChilden(data) {
if(data.length && data[0].children) {
return this.getChilden(data[0].children)
}
return data[0].path
},
AccountLogin({
account: this.formInline.username,
pwd: this.formInline.password,
imgcode: this.formInline.code}).then(async res => {
msg();
if (!res.data.unique_auth.length)
return this.$Message.error(' You don't have any menu permission ');
this.$store.dispatch('admin/account/setPageTitle')
let expires = res.data.expires_time;
// Record user login information
util.cookies.set('uuid', res.data.user_info.id, {
expires: expires
});
util.cookies.set('token', res.data.token, {
expires: expires
});
util.cookies.set('expires_time', res.data.expires_time, {
expires: expires
});
const db = await this.$store.dispatch('admin/db/database', {
user: true
});
// Save menu information
// db.set('menus', res.data.menus).set('unique_auth', res.data.unique_auth).set('user_info', res.data.user_info).write();
db.set('unique_auth', res.data.unique_auth).set('user_info', res.data.user_info).write();
const menuSider = res.data.menus;
### Write menu
this.$store.commit('admin/menus/getmenusNav', menuSider);
let headerSider = getHeaderSider(res.data.menus);
### Write top-level menu
this.$store.commit('admin/menu/setHeader', headerSider);
### Find a jump submenu of the current menu
let toPath = this.getChilden(res.data.menus);
// Get sidebar menu
const headerName = getHeaderName({
path: toPath,
query:{},
params:{},
}, menuSider);
const filterMenuSider = getMenuSider(menuSider, headerName);
// Specifies the side menu currently displayed
this.$store.commit('admin/menu/setSider', filterMenuSider[0].children);
// Set the home page path
this.$store.commit('admin/menus/setIndexPath', toPath);
// Record user information
this.$store.dispatch('admin/user/set', {
name: res.data.user_info.account,
avatar: res.data.user_info.head_pic,
access: res.data.unique_auth,
logo: res.data.logo,
logoSmall: res.data.logo_square,
version: res.data.version,
newOrderAudioLink: res.data.newOrderAudioLink
});
// if (this.jigsaw) this.jigsaw.reset();
### The adjusted address also needs to be adjusted toPath It is the first submenu of the current jump
return this.$router.replace({ path: this.$route.query.redirect || toPath || '/admin/' });}).catch(res => { console.log(res); msg(); let data = res === undefined ? {} : res; this.errorNum++; this.captchas(); this.$Message.error(data.msg || ' Login failed ');});/**
* @description according to user Login user permission in , Authenticate and filter the top bar menu
*
*/
filterHeader(state, getters, rootState) {
function getChilden(data) {
if(data.children) {
return getChilden(data.children[0])
}
return data.path
}
// Before that, the first level jump path was obtained , Now change to get the first menu path of the submenu ,
// So when you click on the top menu , The jump path is guaranteed to be correct
// Call recursive functions
state.header.forEach(item => {
item.path = getChilden(item)
})
// @ jurisdiction
const userInfo = rootState.admin.user.info;
const access = userInfo.access;
if (access && access.length) {
return state.header.filter(item => {
let state = true;
if (item.auth && !includeArray(item.auth, access)) state = false;
return state;
});
} else {
return state.header.filter(item => {
let state = true;
if (item.auth && item.auth.length) state = false;
return state;
});
}
},/src/store/modules/admin/modules/menus.js
export default {
namespaced: true,
state: {
menusName: getMenusName(),
// Back to the home page path
indexPath: '',
},
mutations: {
getmenusNav (state, menuList) {
state.menusName = menuList;
let storage = window.localStorage;
storage.setItem('menuList', JSON.stringify(menuList));
},
/**
* @description Set to return to the home page path
* @param {Object} state vuex state
* @param {Array} menu menu
*/
setIndexPath(state, data) {
state.indexPath = data;
},
},
getters:{
// Added a strip path to get back to the home page , The login page has been set .
indexPath(state, getters) {
const menus = state.menusName;
if (menus.length && !state.indexPath) {
let getChilden = function(data) {
if(data.length && data[0].children) {
return getChilden(data[0].children)
}
return data[0].path
}
let toPath = getChilden(menus);
state.indexPath = toPath;
} else if (!menus.length && !state.indexPath) {
return '/admin/home'
}
return state.indexPath;
},
},
}/src/pages/system/error/403/index.vue
<template>
<div>
<Exception type="403" img-color :desc="$t('page.exception.e403')" :back-text="$t('page.exception.btn')" :redirect="indexPath"/>
</div>
</template>
<script>
import { mapGetters } from "vuex";
export default {
data(){
return {
}
},
computed: {
...mapGetters('admin/menus', [
'indexPath'
])
},
}
</script> link : https://pan.baidu.com/s/14G-bpVthImHD4eosZUNSFA?pwd=yu27
Extraction code : yu27Open source address
边栏推荐
- Highly recommended: data annotation platform doccano - introduction, installation, use and pit stepping records
- First encounter with Kunpeng code migration tool
- What are the advantages of realizing enterprise digital transformation with odoo?
- What is the difference between a WiFi 6 router and a WiFi 5 router
- spider pi 智能视觉六足机器人 直连模式下进行试玩 0603
- Discussion on solving LCA by multiplication method
- Why can't Google search page infinite?
- PaddleNLP--UIE(二)--小样本快速提升性能(含doccona标注)
- Cookie 和 Session 工作流程
- ST-Link V2 下载出现:internal command error&Error: Flash Download failed - Target DLL has been cancelled
猜你喜欢

TL, how do you manage project risks?

The application of prototype object strengthens the function of array object 0526

PaddleNLP--UIE(二)--小样本快速提升性能(含doccona标注)

The attribute inheritance of constructor in Es5 borrows the parent constructor method to inherit the prototype object

Spider PI intelligent vision hexapod robot VNC connecting robot 0603

ST-Link V2 下载出现:internal command error&Error: Flash Download failed - Target DLL has been cancelled

Browser from download to rendering

Deep learning and CV tutorial (13) | target detection (SSD, Yolo Series)

Design and Simulation of SD card reading and writing based on FPGA Verilog

Comprendre le go des modules go. MOD et go. SUM
随机推荐
es5中构造函数的属性继承 借用父构造函数 方法继承 原型对象
Basic use of WinForm programming control treeview tree view 20220527
Mqtt graphical client-mqttx installation and use tutorial
Save and copy drawings with minimal white space
Configuration du serveur DHCP et de la connexion client
深入理解 Go Modules 的 go.mod 与 go.sum
swagger上的model和返回的数据字段不一致的问题
Beautify aria theme to rival charging theme mirages
[play with Huawei cloud] initial experience of MapReduce service
Spider PI intelligent vision hexapod robot unpacking 0602
Leetcode:547. Circle of friends
Deeply understand the leftmost prefix principle of Federated indexes
Pychart always displays the collecting data solution after entering the debug mode
Sqlserver2012 does not allow to modify the table structure 0607
强烈推荐:数据标注平台doccano----简介、安装、使用、踩坑记录
What is the difference between a WiFi 6 router and a WiFi 5 router
Analysis of 403 problems of Pro backstage sub administrator
Shell record
spider pi 智能视觉六足机器人 vnc连接机器人 0603
Is it safe for flush to open an account? How to open an account?