Background management permissions

use vue + element-ui to build a background project (scaffolding). Now you need to manage permissions in the background. As I have no experience, I would like to ask you for advice, such as how to dynamically generate routes when some pages are not displayed and some buttons cannot be clicked.

this is the path to the route index.js

import Vue from "vue"
import Router from" vue-router"
import login from"@ / components/login"
import home from"@ / components/home/home"
/ / Commodity Management-> Group Management
import groupingMent from"@ / components/manageMent/groupingMent"
import productList from"@ / components/manageMent/productList"
import brandMent from"@ / components/manageMent/brandMent"
import brandMentli from"@ / components/manageMent/brandMentli"
import categoryGoods from"@ / components/manageMent/categoryGoods"
import groupedTags from"@ / components/manageMent/ GroupedTags"
import groupCommodity from"@ / components/manageMent/groupCommodity"
import setAttribute from"@ / components/manageMent/setAttribute"
import catalogueList from"@ / components/manageMent/catalogueList"
import editBranddata from"@ / components/manageMent/editBranddata"
import twoReclassify from"@ / components/manageMent/twoReclassify"
import editorProperty from"@ / components/manageMent/editorProperty"
import propertCreate from"@ / components/manageMent/propertCreate"
import addGroupedshop from"@ / components/manageMent/addGroupedshop"
/ / Commodity Management-> Commodity list
import saleGoods from"@ / components/ ManageMent/productList/saleGoods"
import tradeChandise from"@ / components/manageMent/productList/tradeChandise"
import redactGoods from"@ / components/manageMent/productList/redactGoods"
import materialList from"@ / components/manageMent/productList/materialList"
import addMerchandise from"@ / components/manageMent/productList/addMerchandise"
Vue.use (Router)

export default new Router ({
routes: [{

  path: "/login",
  name: "/login",
  component: login
},
{
  path: "/home",
  name: "/home",
  component: home
},
// ->
{
  path: "/groupingMent",
  name: "/groupingMent",
  component: groupingMent
},
{
  path: "/productList",
  name: "/productList",
  component: productList
},
{
  path: "/brandMent",
  name: "/brandMent",
  component: brandMent
},
{
  path: "/brandMentli",
  name: "/brandMentli",
  component: brandMentli
},
{
  path: "/categoryGoods",
  name: "/categoryGoods",
  component: categoryGoods
},
{
  path: "/groupedTags",
  name: "/groupedTags",
  component: groupedTags
},
{
  path: "/groupCommodity",
  name: "/groupCommodity",
  component: groupCommodity
},
{
  path: "/setAttribute",
  name: "/setAttribute",
  component: setAttribute
},
{
  path: "/catalogueList",
  name: "/catalogueList",
  component: catalogueList
},

-

this is main.js "s
import Vue from "vue"
import App from". / App"
import router from". / router"
import ElementUI from "element-ui"
import" element-ui/lib/theme-chalk/index.css"
import axios from "axios"
import store from". / store"

import". / assets/Ueditor/ueditor.config.js"
import". / assets/Ueditor/ueditor.all.min.js"
import". / assets/Ueditor/lang/zh-cn/zh-cn.js"
import". / assets/Ueditor/ueditor.parse.min.js"

import moment from "moment"

Vue.use (ElementUI)

Vue.config.productionTip = false
Vue.prototype.axios = axios

/ eslint-disable no-new /
new Vue ({
el:"- sharpapp",
router,
store,
components: {

App

},
template:"< App/ >"
})


strictly speaking, the backend should return the menu, and the front end should dynamically generate routes and generate menue (center of gravity backend control).
but on my side, the front end and the back end work together on OK. The
page does not display: the backend returns the status code according to the role (each page has a request API with token,roleID). If the role does not match and does not have permission to return the corresponding status code, the frontend immediately jumps to the error page. The
button cannot be clicked: it is also a role judgment. Even if it can be clicked, the backend returns failure and success according to the operating role.


if I know that all routing paths cannot be blocked by directly entering the path on the page, but you can do permission authentication on the page
for example, when a user enters this page, use an identifier or cookie to determine whether he is logged in or has permission
if not, jump to an error page to remind him that he does not have permission. Visit


normally and refer to the backend management system. The front and rear ends are separated, and different roles see different pages


you can search vue-element-admin, on github where there are documents and specific items, you can refer to

Menu