|
|
|
@ -8,6 +8,7 @@ import { useAdminStore } from "@/store/index.js"; |
|
|
|
import { storeToRefs } from "pinia"; |
|
|
|
import { WarnTriangleFilled } from "@element-plus/icons-vue"; |
|
|
|
import dayjs from "dayjs"; |
|
|
|
import {hasMenuPermission, permissionMapping} from "@/utils/menuTreePermission.js"; |
|
|
|
|
|
|
|
const adminStore = useAdminStore(); |
|
|
|
const { adminData, menuTree } = storeToRefs(adminStore); |
|
|
|
@ -213,8 +214,20 @@ const WriteCookiesTime = ref(null) |
|
|
|
const ReadCookies = ref(null) |
|
|
|
// 用来读的 cookie 的 value |
|
|
|
const ReadCookiesTime = ref(null) |
|
|
|
|
|
|
|
const addCoinConsumePermission = ref(false) // 新增金币消耗的权限状态 |
|
|
|
// 初始化权限状态 |
|
|
|
const initPermissions = async() => { |
|
|
|
if (!menuTree.value || !menuTree.value.length) return; |
|
|
|
addCoinConsumePermission.value = hasMenuPermission(menuTree.value, permissionMapping.add_gold_coin_consumption); |
|
|
|
|
|
|
|
}; |
|
|
|
// 这是添加消费信息的接口 |
|
|
|
const add = async function () { |
|
|
|
if (!addCoinConsumePermission) { |
|
|
|
ElMessage.error('暂无权限') |
|
|
|
return |
|
|
|
} |
|
|
|
try { |
|
|
|
// 验证输入数据 再验证一次 |
|
|
|
if (!validateInput()) { |
|
|
|
|