add ai chat entry
This commit is contained in:
@@ -8,6 +8,29 @@
|
||||
:hide-nav="!tabBarStore.isShowing"
|
||||
@change="onChangeTab"
|
||||
>
|
||||
<template #rail-extra>
|
||||
<t-button
|
||||
class="ai-entry"
|
||||
:class="{ on: route.path.startsWith('/management/help') }"
|
||||
:aria-current="route.path.startsWith('/management/help') ? 'page' : undefined"
|
||||
variant="text"
|
||||
@click="router.push('/management/help')"
|
||||
>
|
||||
<t-icon name="file-1" size="1.375rem" />
|
||||
<span>使用说明</span>
|
||||
</t-button>
|
||||
<t-button
|
||||
v-if="userStore.hasRoles(gaoRoleCodes.storeManager)"
|
||||
class="ai-entry"
|
||||
:class="{ on: route.name === 'AiChat' }"
|
||||
:aria-current="route.name === 'AiChat' ? 'page' : undefined"
|
||||
variant="text"
|
||||
@click="router.push('/ai/chat')"
|
||||
>
|
||||
<t-icon name="robot-2" size="1.375rem" />
|
||||
<span>AI 小糕</span>
|
||||
</t-button>
|
||||
</template>
|
||||
<page-transition
|
||||
:keep-alive="shouldKeepAlive"
|
||||
:page-background="globalUIStore.bodyBackground"
|
||||
@@ -20,7 +43,7 @@
|
||||
import { AppShell, PageTransition, useLayout } from "timi-tdesign-mobile";
|
||||
import { useGlobalUIStore } from "@/store/globalUI";
|
||||
import { useTabBarStore } from "@/store/tabBarStore";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
import { gaoRoleCodes, permissionCodes } from "@/utils/permission";
|
||||
import { useUserStore } from "timi-web-api/store";
|
||||
import type { RouteLocationNormalizedLoaded } from "vue-router";
|
||||
|
||||
@@ -117,6 +140,10 @@ async function syncVisibleTab(): Promise<void> {
|
||||
watch(list, syncVisibleTab, { immediate: true });
|
||||
|
||||
function resolveTabValue(path: string): string {
|
||||
if (railVisible.value && path.startsWith("/management/help")) {
|
||||
return path;
|
||||
}
|
||||
|
||||
if (path.startsWith("/customers")) {
|
||||
return "/customers";
|
||||
}
|
||||
@@ -176,3 +203,32 @@ const pageClass = computed(() => ({
|
||||
}));
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.ai-entry {
|
||||
--td-button-border-radius: var(--tui-rail-item-radius, .75rem);
|
||||
|
||||
width: calc(100% - 1.25rem);
|
||||
height: auto;
|
||||
display: flex;
|
||||
margin: .125rem .625rem;
|
||||
padding: var(--tui-rail-item-padding, .75rem 0);
|
||||
color: var(--td-text-color-secondary);
|
||||
font-size: var(--tui-rail-item-font-size, .75rem);
|
||||
line-height: 1.4;
|
||||
flex-direction: column;
|
||||
|
||||
:deep(.t-button__content) {
|
||||
gap: .25rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
&.on {
|
||||
color: var(--tui-rail-active-color, var(--td-brand-color));
|
||||
font-weight: 600;
|
||||
background: var(--tui-rail-active-background, var(--td-brand-color-light));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user