菜单修改优化
This commit is contained in:
@@ -5,8 +5,9 @@
|
||||
<a class="back-link" href="/home">返回首页</a>
|
||||
</header>
|
||||
|
||||
<main class="entrances" aria-label="视频入口">
|
||||
<main class="entrances" :class="{ 'is-loading': permissionsLoading }" aria-label="视频与图片入口">
|
||||
<button
|
||||
v-if="hasMenuPermission('digital-human')"
|
||||
type="button"
|
||||
class="entrance-btn"
|
||||
:disabled="launching"
|
||||
@@ -14,12 +15,15 @@
|
||||
>
|
||||
数字人
|
||||
</button>
|
||||
<button type="button" class="entrance-btn" @click="openDeliveryWorkspace">
|
||||
<button v-if="hasMenuPermission('delivery-video')" type="button" class="entrance-btn" @click="openDeliveryWorkspace">
|
||||
带货视频
|
||||
</button>
|
||||
<button type="button" class="entrance-btn" @click="showSoon('混剪')">
|
||||
<button v-if="hasMenuPermission('mix-video')" type="button" class="entrance-btn" @click="showSoon('混剪')">
|
||||
混剪
|
||||
</button>
|
||||
<a v-if="hasMenuPermission('image')" class="entrance-btn" href="/image">
|
||||
图片
|
||||
</a>
|
||||
</main>
|
||||
|
||||
<div class="toast" :class="{ show: Boolean(statusText), error: statusType === 'error' }">
|
||||
@@ -64,17 +68,20 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, ref } from 'vue'
|
||||
import { onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
|
||||
import PageShell from '@/components/layout/PageShell.vue'
|
||||
import BrandTopBar from '@/pages/brand/components/BrandTopBar.vue'
|
||||
import DeliveryVideoWorkspace from '@/pages/image-video/components/DeliveryVideoWorkspace.vue'
|
||||
import { getCurrentUserAppColumnKeys } from '@/shared/api/permission'
|
||||
import { getPywebviewApi } from '@/shared/bridges/pywebview'
|
||||
import DownloadProgressPanel from '@/shared/components/DownloadProgressPanel.vue'
|
||||
|
||||
type ViewMode = 'menu' | 'delivery'
|
||||
|
||||
const currentView = ref<ViewMode>('menu')
|
||||
const allowedColumnKeys = ref(new Set<string>())
|
||||
const permissionsLoading = ref(true)
|
||||
const launching = ref(false)
|
||||
const statusText = ref('')
|
||||
const statusType = ref<'normal' | 'error'>('normal')
|
||||
@@ -103,6 +110,20 @@ function showSoon(name: string) {
|
||||
showStatus(`${name}暂未开通,敬请期待`)
|
||||
}
|
||||
|
||||
function hasMenuPermission(columnKey: string) {
|
||||
return allowedColumnKeys.value.has('wb') || allowedColumnKeys.value.has(columnKey)
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
allowedColumnKeys.value = new Set(await getCurrentUserAppColumnKeys())
|
||||
} catch (_error) {
|
||||
showStatus('菜单权限加载失败', 'error')
|
||||
} finally {
|
||||
permissionsLoading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
function openDeliveryWorkspace() {
|
||||
currentView.value = 'delivery'
|
||||
}
|
||||
@@ -265,6 +286,10 @@ async function launchDesktop() {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.entrances.is-loading {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.entrance-btn {
|
||||
width: 160px;
|
||||
height: 100px;
|
||||
|
||||
Reference in New Issue
Block a user