fixAuth
yujialong 2 years ago
parent a0fb8bbcb1
commit e3473f4cb9
  1. 16
      src/directive/auth/index.js
  2. 26
      src/libs/auth/generateBtnPermission.js
  3. 4
      src/setting.js
  4. 3
      src/views/course/AddCurriculum.vue
  5. 8
      src/views/course/Curriculum.vue
  6. 22
      src/views/order/AddOrder.vue
  7. 22
      src/views/theoreticalCourse/list/buildPlatform/index.vue
  8. 22
      src/views/theoreticalCourse/list/courseManagement/index.vue

@ -9,18 +9,12 @@ import Setting from '@/setting'
export default {
inserted (el, binding, vnode) {
if (!Setting.dynamicRoute) return false
let btnText = ''
// 如果有传值,就取传的值,否则,就取页面路由和按钮名字拼接起来
if(binding.value){
btnText = binding.value
}else{
btnText = `${vnode.context.$route.path}:${el.innerText}`
}
const btnPermissions = store.state.btns
if (btnText && btnPermissions && btnPermissions.length) {
const isPermission = btnPermissions.includes(btnText)
const val = binding.value
const text = val && val.includes('/') ? val : vnode.context.$route.path + ':' + (val || el.innerText)
const { btns } = store.state
if (text && btns && btns.length) {
// 如果按钮集合里没有该权限,就把该按钮给去除
if (!isPermission) {
if (!btns.includes(text)) {
el.parentNode && el.parentNode.removeChild(el)
}
}

@ -2,23 +2,19 @@
* @description 生成按钮级别权限组
* */
import store from '@/store';
export default function(data){
let result = []
import store from '@/store'
const result = []
// 递归组合权限
function createAuth(data, auth) {
data.map(e => {
e.children.map(n => {
if(n.children.length){
result.push(`${e.path}:${n.name}`)
n.children.map(j => {
e.path ? result.push(`${e.path}:${n.name}:${j.name}`) : result.push(`${n.path}:${j.name}`)
j.children.map(k => {
e.path ? result.push(`${e.path}:${n.name}:${j.name}:${k.name}`) : result.push(`${n.path}:${j.name}:${k.name}`)
const text = (auth ? auth + ':' : '') + (auth ? e.name : e.path) // 第一级是路由,取path,子级取name
result.push(text)
e.children && e.children.length && createAuth(e.children, text)
})
})
}else{
result.push(`${e.path}:${n.name}`)
}
})
})
export default function(data) {
createAuth(data)
store.commit('addBtnAuth', result)
}

@ -11,7 +11,7 @@ if (isDev) {
jumpPath = 'http://192.168.31.125:8087/' // 本地调试-需要启动本地判分点系统
host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/'
// host = 'http://192.168.31.151:9000/'// 榕
host = 'http://192.168.31.51:9000/'// 榕
// host = 'http://192.168.31.137:9000/'// 赓
} else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/'
@ -45,7 +45,7 @@ const Setting = {
isDev,
isPro,
// 是否使用动态路由
dynamicRoute: false,
dynamicRoute: true,
/**
* @description 默认密码
*/

@ -668,15 +668,14 @@ export default {
checkeds.push(e)
}
})
if (item.systemId == this.curSystem) this.checkAll = true
} else {
res.map(e => {
const i = checkeds.findIndex(n => n.projectId == e.projectId && n.systemId == e.systemId)
i === -1 || checkeds.splice(i, 1)
})
if (item.systemId == this.curSystem) this.checkAll = false
}
this.checkedAll = JSON.parse(JSON.stringify(checkeds)) //
this.getProject(item)
}).catch(err => {})
},
//

@ -93,9 +93,9 @@
<el-table-column label="上架/下架" align="center">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isEnable"
:active-value="0"
:inactive-value="1"
v-model="scope.row.isShelves"
:active-value="1"
:inactive-value="0"
@change="changeSwitch($event, scope.row)"
v-auth="'/curriculum:上下架'">
</el-switch>
@ -294,7 +294,7 @@ export default {
},
//
changeSwitch(value, row) {
this.$post(`${this.api.isShelves}?cid=${row.cid}&isEnable=${value}`).then((res) => {
this.$post(`${this.api.isShelves}?cid=${row.cid}&isShelves=${value}`).then((res) => {
this.getData();
this.$message.success("修改上下架状态成功!");
}).catch((res) => {

@ -800,7 +800,8 @@ export default {
searchTimer: null,
titlesw:'',
orderRepeat: [],
repeatMsg: ''
repeatMsg: '',
clients: []
};
},
watch: {
@ -819,6 +820,7 @@ export default {
},
async created() {
this.getTeam()
this.getClients()
this.token = sessionStorage.getItem("token");
//
if (this.$route.query.val == 'isAdd') {
@ -984,11 +986,23 @@ export default {
console.log("🚀 ~ file: AddOrder.vue ~ line 979 ~ setStartDate ~ this.coursePermissions ", this.coursePermissions )
this.dataPlatformPermissions = list.filter(i => i.authority === 0);
},
//
getClients() {
this.$post(this.api.queryCustomer, {
countries: this.form.countries,
provinceId: '',
cityId: '',
searchContent: '',
page: 1,
size: 1000
}).then(res => {
this.clients = res.message.list
}).catch(res => {})
},
//
refreshCache() {
const { customerId } = this.form
const clients = this.$refs.client.listData
const curClient = clients.find(e => e.customerId == customerId)
const curClient = this.clients.find(e => e.customerId == customerId)
this.$post(`${this.api.refreshCache}?schoolId=${curClient ? curClient.schoolId : ''}`).then(res => {}).catch(res => {})
},
//
@ -1131,7 +1145,7 @@ export default {
let param = {
pageSize: 10,
pageNum: this.coursePage,
isEnable: 0, //
isShelves: 1, //
curriculumName: this.curriculumName
};
this.dataLoading = true;

@ -1,5 +1,5 @@
<template>
<!-- 课程管理 -->
<!-- 平台自建 -->
<div style="padding-top: 24px">
<div class="tool">
<ul class="filter" style="align-items: flex-start">
@ -29,8 +29,8 @@
</li>
</ul>
<div>
<el-button v-auth="'课程管理:新增'" type="primary" round @click="addCourse">新增</el-button>
<el-button v-auth="'课程管理:批量删除'" type="primary" round @click="delAllData">批量删除</el-button>
<el-button v-auth="'平台自建:新增'" type="primary" round @click="addCourse">新增</el-button>
<el-button v-auth="'平台自建:批量删除'" type="primary" round @click="delAllData">批量删除</el-button>
</div>
</div>
@ -61,19 +61,19 @@
</el-table-column>
<el-table-column label="操作" align="center" width="250">
<template slot-scope="scope">
<el-button v-auth="'课程管理:编辑信息'" type="text" @click="editCourse(scope.row)">编辑信息</el-button>
<el-divider v-auth="'课程管理:编辑信息'" direction="vertical"></el-divider>
<el-button v-auth="'课程管理:内容设置'" type="text" @click="config(scope.row)">内容设置</el-button>
<el-divider v-auth="'课程管理:内容设置'" direction="vertical"></el-divider>
<el-button v-auth="'课程管理:预览'" type="text" @click="preview(scope.row)">预览</el-button>
<el-divider v-auth="'课程管理:预览'" direction="vertical"></el-divider>
<el-button v-auth="'课程管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button v-auth="'平台自建:编辑信息'" type="text" @click="editCourse(scope.row)">编辑信息</el-button>
<el-divider v-auth="'平台自建:编辑信息'" direction="vertical"></el-divider>
<el-button v-auth="'平台自建:内容设置'" type="text" @click="config(scope.row)">内容设置</el-button>
<el-divider v-auth="'平台自建:内容设置'" direction="vertical"></el-divider>
<el-button v-auth="'平台自建:预览'" type="text" @click="preview(scope.row)">预览</el-button>
<el-divider v-auth="'平台自建:预览'" direction="vertical"></el-divider>
<el-button v-auth="'平台自建:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="可授权状态" align="center" width="120">
<template slot-scope="scope">
<el-switch
v-auth="'课程管理:启用'"
v-auth="'平台自建:禁用'"
v-model="scope.row.ztOpen"
:active-value="0"
:inactive-value="1"

@ -1,5 +1,5 @@
<template>
<!-- 课程管理 -->
<!-- 院校创建 -->
<div style="padding-top: 24px">
<div class="tool">
<ul class="filter" style="align-items: flex-start">
@ -28,8 +28,8 @@
</li>
</ul>
<div>
<!-- <el-button v-auth="'课程管理:新增'" type="primary" round @click="addCourse">新增</el-button> -->
<el-button v-auth="'课程管理:批量删除'" type="primary" round @click="delAllData">批量删除</el-button>
<!-- <el-button v-auth="'院校创建:新增'" type="primary" round @click="addCourse">新增</el-button> -->
<el-button v-auth="'院校创建:批量删除'" type="primary" round @click="delAllData">批量删除</el-button>
</div>
</div>
@ -60,19 +60,19 @@
</el-table-column>
<el-table-column label="操作" align="center" width="250">
<template slot-scope="scope">
<el-button v-auth="'课程管理:编辑信息'" type="text" @click="editCourse(scope.row)">编辑信息</el-button>
<el-divider v-auth="'课程管理:编辑信息'" direction="vertical"></el-divider>
<el-button v-auth="'课程管理:内容设置'" type="text" @click="config(scope.row)">内容设置</el-button>
<el-divider v-auth="'课程管理:内容设置'" direction="vertical"></el-divider>
<el-button v-auth="'课程管理:预览'" type="text" @click="preview(scope.row)">预览</el-button>
<el-divider v-auth="'课程管理:预览'" direction="vertical"></el-divider>
<el-button v-auth="'课程管理:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button>
<el-button v-auth="'院校创建:编辑信息'" type="text" @click="editCourse(scope.row)">编辑信息</el-button>
<el-divider v-auth="'院校创建:编辑信息'" direction="vertical"></el-divider>
<el-button v-auth="'院校创建:内容设置'" type="text" @click="config(scope.row)">内容设置</el-button>
<el-divider v-auth="'院校创建:内容设置'" direction="vertical"></el-divider>
<el-button v-auth="'院校创建:预览'" type="text" @click="preview(scope.row)">预览</el-button>
<el-divider v-auth="'院校创建:预览'" direction="vertical"></el-divider>
<el-button v-auth="'院校创建:删除'" type="text" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="可授权状态" align="center" width="120">
<template slot-scope="scope">
<el-switch
v-auth="'课程管理:启用'"
v-auth="'院校创建:禁用'"
v-model="scope.row.ztOpen"
:active-value="0"
:inactive-value="1"

Loading…
Cancel
Save