添加注释

master
yujialong 3 years ago
parent f726c58b19
commit 01fb5ff665
  1. 2
      src/libs/auth/generateBtnPermission.js
  2. 1
      src/pages/classification.vue
  3. 2
      src/pages/courseConfig.vue
  4. 4
      src/pages/role.vue
  5. 4
      src/plugins/auth/index.js

@ -6,7 +6,7 @@ import store from '@/store';
export default function(data){ export default function(data){
let result = [] let result = []
data.map(e => { data.map(e => {
if(e.select){ if(e.select){ // select为true则表示拥有该权限
e.children.map(n => { e.children.map(n => {
if(n.select){ if(n.select){
if(n.children.length){ if(n.children.length){

@ -64,6 +64,7 @@ export default {
this.$get(`${this.api.queryAllClassification}?schoolId=${this.schoolId}`).then(res => { this.$get(`${this.api.queryAllClassification}?schoolId=${this.schoolId}`).then(res => {
let list = res.data.classificationList let list = res.data.classificationList
let result = [] let result = []
//
list.map(n => { list.map(n => {
if(n.distinguish) result.push(n) if(n.distinguish) result.push(n)
}) })

@ -220,6 +220,7 @@ export default {
this.insertScript() this.insertScript()
this.id = this.$route.query.id this.id = this.$route.query.id
this.id && this.getData() this.id && this.getData()
//
if (window.history && window.history.pushState) { if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL); history.pushState(null, null, document.URL);
window.addEventListener("popstate", this.goBack, false); window.addEventListener("popstate", this.goBack, false);
@ -572,6 +573,7 @@ export default {
} }
} }
}, },
//
sortSection(chapterIndex,type,disabled,index){ sortSection(chapterIndex,type,disabled,index){
if(!disabled){ if(!disabled){
let list = this.chapters[chapterIndex].subsectionList let list = this.chapters[chapterIndex].subsectionList

@ -142,6 +142,7 @@ export default {
this.pageNo = val; this.pageNo = val;
this.getData(); this.getData();
}, },
//
getPer(){ getPer(){
if(!this.permissions.length){ if(!this.permissions.length){
this.$get(this.api.queryPermissionMenu).then(res => { this.$get(this.api.queryPermissionMenu).then(res => {
@ -156,11 +157,13 @@ export default {
this.permissions.length && this.$refs.per.setCheckedNodes([]) this.permissions.length && this.$refs.per.setCheckedNodes([])
this.roleVisible = true this.roleVisible = true
}, },
//
handleRolePer(data,permissions){ handleRolePer(data,permissions){
let result = data let result = data
if(permissions.length){ if(permissions.length){
permissions.map(e => { permissions.map(e => {
if(result.includes(e.id) && e.children.length){ if(result.includes(e.id) && e.children.length){
// ,idid,,,
e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id),1) e.children.every(n => result.includes(n)) || result.splice(result.indexOf(e.id),1)
} }
e.children.length && this.handleRolePer(data,e.children) e.children.length && this.handleRolePer(data,e.children)
@ -204,6 +207,7 @@ export default {
} }
let roleRes = await this.$post(this.api.saveOrUpdate,roleData) let roleRes = await this.$post(this.api.saveOrUpdate,roleData)
if(roleRes.success){ if(roleRes.success){
// ,(),
let permissionId = [...this.$refs.per.getHalfCheckedKeys(),...this.$refs.per.getCheckedKeys()] let permissionId = [...this.$refs.per.getHalfCheckedKeys(),...this.$refs.per.getCheckedKeys()]
let perData = { let perData = {
clientId: this.clientId, clientId: this.clientId,

@ -1,13 +1,14 @@
/** /**
* @description 鉴权指令 * @description 鉴权指令
* 当传入的权限当前用户没有时会移除该组件 * 当传入的权限当前用户没有时会移除该组件
* 用例<Tag v-auth">text</Tag> 或者:<Tag v-auth="'user:编辑'">text</Tag> * 用例<Tag v-auth>text</Tag> <Tag v-auth="'user:'">text</Tag>
* */ * */
import store from '@/store'; import store from '@/store';
export default { export default {
inserted (el, binding, vnode) { inserted (el, binding, vnode) {
let btnText = '' let btnText = ''
// 如果没传值,则取当前页面路由和按钮名字,否则,直接取传的值
if(binding.value){ if(binding.value){
btnText = binding.value btnText = binding.value
}else{ }else{
@ -17,6 +18,7 @@ export default {
if (btnText && btnPermissions && btnPermissions.length) { if (btnText && btnPermissions && btnPermissions.length) {
const isPermission = btnPermissions.includes(btnText); const isPermission = btnPermissions.includes(btnText);
if (!isPermission) { if (!isPermission) {
// 如果权限集合里没有这个按钮,则把这个按钮给移除
el.parentNode && el.parentNode.removeChild(el); el.parentNode && el.parentNode.removeChild(el);
} }
} }

Loading…
Cancel
Save