已支付订单列表:where.payStatus = 1;
This commit is contained in:
+89
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
const store_modules_user = require("../store/modules/user.js");
|
||||
function arrayHas(array, value) {
|
||||
if (!value) {
|
||||
return true;
|
||||
}
|
||||
if (!array) {
|
||||
return false;
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
if (array.indexOf(value[i]) === -1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return array.indexOf(value) !== -1;
|
||||
}
|
||||
function arrayHasAny(array, value) {
|
||||
if (!value) {
|
||||
return true;
|
||||
}
|
||||
if (!array) {
|
||||
return false;
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
if (array.indexOf(value[i]) !== -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return array.indexOf(value) !== -1;
|
||||
}
|
||||
function hasRole(value) {
|
||||
const userStore = store_modules_user.useUserStore();
|
||||
return arrayHas(userStore == null ? void 0 : userStore.roles, value);
|
||||
}
|
||||
function hasAnyRole(value) {
|
||||
const userStore = store_modules_user.useUserStore();
|
||||
return arrayHasAny(userStore == null ? void 0 : userStore.roles, value);
|
||||
}
|
||||
function hasPermission(value) {
|
||||
const userStore = store_modules_user.useUserStore();
|
||||
return arrayHas(userStore == null ? void 0 : userStore.authorities, value);
|
||||
}
|
||||
function hasAnyPermission(value) {
|
||||
const userStore = store_modules_user.useUserStore();
|
||||
return arrayHasAny(userStore == null ? void 0 : userStore.authorities, value);
|
||||
}
|
||||
const permission = {
|
||||
install(app) {
|
||||
app.directive("role", {
|
||||
mounted: (el, binding) => {
|
||||
var _a;
|
||||
if (!hasRole(binding.value)) {
|
||||
(_a = el.parentNode) == null ? void 0 : _a.removeChild(el);
|
||||
}
|
||||
}
|
||||
});
|
||||
app.directive("any-role", {
|
||||
mounted: (el, binding) => {
|
||||
var _a;
|
||||
if (!hasAnyRole(binding.value)) {
|
||||
(_a = el.parentNode) == null ? void 0 : _a.removeChild(el);
|
||||
}
|
||||
}
|
||||
});
|
||||
app.directive("permission", {
|
||||
mounted: (el, binding) => {
|
||||
var _a;
|
||||
if (!hasPermission(binding.value)) {
|
||||
(_a = el.parentNode) == null ? void 0 : _a.removeChild(el);
|
||||
}
|
||||
}
|
||||
});
|
||||
app.directive("any-permission", {
|
||||
mounted: (el, binding) => {
|
||||
var _a;
|
||||
if (!hasAnyPermission(binding.value)) {
|
||||
(_a = el.parentNode) == null ? void 0 : _a.removeChild(el);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.permission = permission;
|
||||
Reference in New Issue
Block a user