权限刷新
This commit is contained in:
@@ -89,3 +89,7 @@ export function revenueStats(hostId) {
|
||||
export function getCustomServiceInfo() {
|
||||
return getAxios({ url: '/api/common/custom_service_info' })
|
||||
}
|
||||
|
||||
export function getCurrent() {
|
||||
return getAxios({ url: '/api/user/current' })
|
||||
}
|
||||
|
||||
@@ -16,7 +16,22 @@
|
||||
<!-- 权限遮罩层 -->
|
||||
<div class="permission-mask" ref="maskRef" :data-permission-guard="guardKey">
|
||||
<!-- 上方:锁提示区域 -->
|
||||
<div class="mask-top">
|
||||
<button @click="refreshPage" style="
|
||||
position: absolute; top: 20px; left: 20px;
|
||||
padding: 10px 20px;
|
||||
background: #fff;
|
||||
color: #000;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 4px 15px rgba(255, 59, 48, 0.3);
|
||||
transition: all 0.3s ease;
|
||||
backdrop-filter: blur(5px);
|
||||
">
|
||||
刷新权限
|
||||
</button> <div class="mask-top">
|
||||
|
||||
<div class="mask-content">
|
||||
<div class="lock-icon-wrapper">
|
||||
<svg class="lock-icon" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
@@ -67,10 +82,12 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { getPermissions } from '@/utils/storage'
|
||||
import { getPermissions,setPermissions } from '@/utils/storage'
|
||||
import cardBg from '@/assets/nav/card.png'
|
||||
import phoneIcon from '@/assets/nav/phone.png'
|
||||
import exchangeIcon from '@/assets/nav/exchange.png'
|
||||
import { getCurrent } from '@/api/account'
|
||||
import { setUser } from '@/utils/storage'
|
||||
|
||||
const props = defineProps({
|
||||
permissionKey: {
|
||||
@@ -150,6 +167,18 @@ const updateVisibleContacts = (excludeCurrent = false) => {
|
||||
visibleContacts.value = visibleIndices.value.map(i => props.contacts[i])
|
||||
}
|
||||
|
||||
const refreshPage = async () => {
|
||||
const res = await getCurrent()
|
||||
if (res) {
|
||||
setUser(res)
|
||||
setPermissions({
|
||||
bigBrother: res.bigBrother,
|
||||
crawl: res.crawl,
|
||||
webAi: res.webAi,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const shuffleContacts = () => {
|
||||
updateVisibleContacts(true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user