feat:完成仅自己可见功能

This commit is contained in:
橙子
2023-03-26 01:28:48 +08:00
parent c83fcb7f26
commit b6f4cbfb4f
77 changed files with 932 additions and 242 deletions

View File

@@ -0,0 +1,29 @@
/**
* v-hasDiscussPermi 操作权限处理
*/
import useUserStore from '@/stores/user'
//传一个值一个主题id的创建者id判断当前主题是否为自己创建拥有*:*:*,直接跳过
export default {
mounted(el, binding, vnode) {
const { value } = binding
const all_permission = "*:*:*";
const permissions = useUserStore().permissions
const userId = useUserStore().id
if (value && value instanceof Array && value.length > 0) {
const permissionFlag = value
const hasPermissions = permissions.some(permission => {
return all_permission === permission || permissionFlag==userId
})
if (!hasPermissions) {
el.parentNode && el.parentNode.removeChild(el)
}
} else {
throw new Error(`请设置操作主题用户签值`)
}
}
}