diff --git a/src/utils/authFuntion.ts b/src/utils/authFuntion.ts new file mode 100644 index 0000000000000000000000000000000000000000..21631f839af44e3074498cfdab1d6187cf8b31ea --- /dev/null +++ b/src/utils/authFuntion.ts @@ -0,0 +1,26 @@ +import { useUserStore } from '/@/store/userInfo' +import { judementSameArr } from '/@/utils/arrayOperation' + +export function auth(value: string): boolean { + const stores = useUserStore() + return stores.userInfos.authBtnList.some((v: string) => v === value) +} + +// Multiple permission verifications, true if one is satisfied +export function auths(value: Array): boolean { + let flag = false + const stores = useUserStore() + stores.userInfos.authBtnList.map((val: string) => { + value.map((v: string) => { + if (val === v) flag = true + }) + }) + return flag + } + + // Multiple permission verifications, true if all is satisfied +export function authAll(value: Array): boolean { + const stores = useUserStore() + return judementSameArr(value, stores.userInfos.authBtnList) + } + \ No newline at end of file