forked from Leaf/amber-ui
改进 抽屉
This commit is contained in:
parent
7fca95c131
commit
6a38be0f2e
@ -1,36 +1,38 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mb-3">
|
<div v-if="assistants.length">
|
||||||
<n-button tertiary @click="showCreateDialog = true"> 新建助理 </n-button>
|
<div class="mb-3">
|
||||||
|
<n-button tertiary @click="showCreateDialog = true"> 新建助理 </n-button>
|
||||||
|
</div>
|
||||||
|
<n-list hoverable clickable>
|
||||||
|
<n-list-item
|
||||||
|
v-for="c in assistants"
|
||||||
|
:key="c.id"
|
||||||
|
@click="showEditAssistant(c.id ?? 0)"
|
||||||
|
>
|
||||||
|
<n-thing>
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<div>
|
||||||
|
{{ c.name }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<n-button
|
||||||
|
quaternary
|
||||||
|
circle
|
||||||
|
type="info"
|
||||||
|
@click.stop="showEditAssistant(c.id ?? 0)"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<n-icon size="16" class="cursor-pointer">
|
||||||
|
<SettingsOutline />
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
|
</n-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</n-thing>
|
||||||
|
</n-list-item>
|
||||||
|
</n-list>
|
||||||
</div>
|
</div>
|
||||||
<n-list hoverable clickable v-if="assistants.length">
|
|
||||||
<n-list-item
|
|
||||||
v-for="c in assistants"
|
|
||||||
:key="c.id"
|
|
||||||
@click="showEditAssistant(c.id ?? 0)"
|
|
||||||
>
|
|
||||||
<n-thing>
|
|
||||||
<div class="flex justify-between items-center">
|
|
||||||
<div>
|
|
||||||
{{ c.name }}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<n-button
|
|
||||||
quaternary
|
|
||||||
circle
|
|
||||||
type="info"
|
|
||||||
@click.stop="showEditAssistant(c.id ?? 0)"
|
|
||||||
>
|
|
||||||
<template #icon>
|
|
||||||
<n-icon size="16" class="cursor-pointer">
|
|
||||||
<SettingsOutline />
|
|
||||||
</n-icon>
|
|
||||||
</template>
|
|
||||||
</n-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</n-thing>
|
|
||||||
</n-list-item>
|
|
||||||
</n-list>
|
|
||||||
<div v-else class="text-center">
|
<div v-else class="text-center">
|
||||||
<n-result
|
<n-result
|
||||||
status="404"
|
status="404"
|
||||||
@ -148,7 +150,7 @@
|
|||||||
</n-drawer-content>
|
</n-drawer-content>
|
||||||
</n-drawer>
|
</n-drawer>
|
||||||
|
|
||||||
<n-drawer placement="left" v-model:show="showCreateDialog" :width="600">
|
<n-drawer placement="left" v-model:show="showCreateDialog" :width="drawerWidth">
|
||||||
<n-drawer-content closable title="新建助理">
|
<n-drawer-content closable title="新建助理">
|
||||||
<div v-if="currentAssistant">
|
<div v-if="currentAssistant">
|
||||||
<n-form>
|
<n-form>
|
||||||
@ -213,7 +215,7 @@ const assistantShares: Ref<EntityAssistantShare[]> = ref([]);
|
|||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const drawerWidth = computed(() => {
|
const drawerWidth = computed(() => {
|
||||||
if (isMobile.value) {
|
if (isMobile.value) {
|
||||||
return 300;
|
return 400;
|
||||||
} else {
|
} else {
|
||||||
return 600;
|
return 600;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ import { useIsMobile } from "@/utils/composables";
|
|||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const drawerWidth = computed(() => {
|
const drawerWidth = computed(() => {
|
||||||
if (isMobile.value) {
|
if (isMobile.value) {
|
||||||
return 300;
|
return 400;
|
||||||
} else {
|
} else {
|
||||||
return 600;
|
return 600;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ const createToolRequest: Ref<SchemaToolCreateRequest> = ref({
|
|||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const drawerWidth = computed(() => {
|
const drawerWidth = computed(() => {
|
||||||
if (isMobile.value) {
|
if (isMobile.value) {
|
||||||
return 300;
|
return 400;
|
||||||
} else {
|
} else {
|
||||||
return 600;
|
return 600;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import { useUserStore } from "../stores/user";
|
|||||||
import Guest from "../pages/guest/index.vue";
|
import Guest from "../pages/guest/index.vue";
|
||||||
import router from "../router";
|
import router from "../router";
|
||||||
import Header from "./Header.vue";
|
import Header from "./Header.vue";
|
||||||
import { useAppStore } from "@/stores/app";
|
|
||||||
import element from "@/config/element";
|
import element from "@/config/element";
|
||||||
import { useIsMobile } from "@/utils/composables";
|
import { useIsMobile } from "@/utils/composables";
|
||||||
const currentRoute = computed(() => router.currentRoute.value.name);
|
const currentRoute = computed(() => router.currentRoute.value.name);
|
||||||
|
@ -135,17 +135,13 @@ import leaflowpng from "@/assets/images/leaflow.png";
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const showDrawer = ref(false);
|
const showDrawer = ref(false);
|
||||||
const width = ref(200);
|
const width = computed(() => {
|
||||||
// const chatStore = useChatStore();
|
if (isMobile.value) {
|
||||||
|
return window.innerWidth - 100;
|
||||||
// 如果是手机,则 width 为全屏
|
} else {
|
||||||
if (isMobile.value) {
|
return window.innerWidth * 0.5;
|
||||||
// 获取屏幕宽度
|
}
|
||||||
width.value = window.innerWidth - 100;
|
})
|
||||||
} else {
|
|
||||||
// 获取当前屏幕宽度 40% 的宽度
|
|
||||||
width.value = window.innerWidth * 0.4;
|
|
||||||
}
|
|
||||||
|
|
||||||
const userPlacement = ref("bottom");
|
const userPlacement = ref("bottom");
|
||||||
if (isMobile.value) {
|
if (isMobile.value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user