2026-05-29 18:16:34 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<template v-if="visibility === 'interactive'">
|
|
|
|
|
|
<slot />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<div v-else-if="visibility === 'readonly'" class="pg-readonly" :title="`${widgetId} 当前为只读`">
|
|
|
|
|
|
<slot />
|
|
|
|
|
|
<div class="pg-mask" />
|
|
|
|
|
|
</div>
|
2026-05-29 23:51:57 +08:00
|
|
|
|
<el-empty v-else class="pg-hidden">
|
|
|
|
|
|
<template #description>
|
|
|
|
|
|
<p class="pg-hidden-title">当前账号无权查看此功能</p>
|
|
|
|
|
|
<p class="pg-hidden-hint">控件:{{ widgetId }}。若应为管理员可见,请尝试顶部切换「管理员/运营」或刷新页面。</p>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-empty>
|
2026-05-29 18:16:34 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { computed } from 'vue'
|
|
|
|
|
|
import { useAuthStore } from '@/stores/auth'
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{ widgetId: string }>()
|
|
|
|
|
|
const auth = useAuthStore()
|
|
|
|
|
|
const visibility = computed(() => auth.widgetOf(props.widgetId))
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.pg-readonly { position: relative; }
|
|
|
|
|
|
.pg-mask {
|
|
|
|
|
|
position: absolute; inset: 0; background: rgba(255, 255, 255, 0.3);
|
|
|
|
|
|
pointer-events: all; cursor: not-allowed;
|
|
|
|
|
|
}
|
2026-05-29 23:51:57 +08:00
|
|
|
|
.pg-hidden { padding: 48px 16px; }
|
|
|
|
|
|
.pg-hidden-title { margin: 0 0 6px; font-size: 14px; color: var(--mg-text-light, #fff); }
|
|
|
|
|
|
.pg-hidden-hint { margin: 0; font-size: 12px; color: var(--mg-text-muted, rgba(255,255,255,.65)); }
|
2026-05-29 18:16:34 +08:00
|
|
|
|
</style>
|