提交 1829728e 编写于 作者: D DebugIsFalse

Merge branch 'main' of gitcode.com:git_bot/ai-fe

...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
:rows="5" :rows="5"
variant="none" variant="none"
:padded="false" :padded="false"
maxlength="2000"
/> />
<div class="flex justify-between"> <div class="flex justify-between">
<USelectMenu <USelectMenu
......
<template>
<UModal v-model="isOpenSelect" :ui="{ width: 'w-96 sm:max-w-screen-md' }">
<UCard :ui="{ ring: '', divide: 'divide-y divide-gray-100 dark:divide-gray-800' }">
<template #header>
<div class="flex items-center justify-between">
<div class="text-xl">选择集合</div>
<UButton
leading-icon="i-heroicons-x-mark-20-solid"
color="gray"
variant="ghost"
@click="handleClose"
/>
</div>
</template>
<div class="flex flex-col gap-4">
<UButton
leading-icon="i-heroicons-plus-20-solid"
label="创建新集合"
color="gray"
@click="handleOpenCreate"
/>
<div class="flex flex-col gap-2">
<UButton color="white" size="md" class="flex">
<div class="flex flex-grow justify-between items-center">
<div>前端开发</div>
<UIcon name="i-heroicons-check-circle-20-solid" class="text-primary text-lg" />
</div>
</UButton>
<UButton color="white" size="md" class="flex">
<div class="flex flex-grow justify-between items-center">
<div>后端开发</div>
</div>
</UButton>
</div>
</div>
</UCard>
</UModal>
</template>
<script setup>
const Library = inject('Library')
const isOpenSelect = ref(false)
function handleClose () {
isOpenSelect.value = false
}
function handleOpen (id) {
isOpenSelect.value = true
}
defineExpose({ handleOpen })
function handleOpenCreate () {
handleClose()
Library.handleOpenCreateLibrary()
}
</script>
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
variant="ghost" variant="ghost"
size="2xs" size="2xs"
icon="i-heroicons-plus" icon="i-heroicons-plus"
@click="handleOpenSelect"
/> />
</UTooltip> </UTooltip>
<UDropdown class="flex flex-grow" :items="actionItems"> <UDropdown class="flex flex-grow" :items="actionItems">
...@@ -55,12 +56,23 @@ ...@@ -55,12 +56,23 @@
<UDivider /> <UDivider />
</template> </template>
<script setup> <script setup>
const Library = inject('Library')
const textColor = 'text-gray-500 dark:text-gray-400' const textColor = 'text-gray-500 dark:text-gray-400'
const actionItems = [ const actionItems = [
[ [
{
label: '添加到收藏',
icon: 'i-heroicons-plus',
click: () => {
handleOpenSelect()
}
},
{ {
label: '更改集合', label: '更改集合',
icon: 'i-heroicons-squares-plus' icon: 'i-heroicons-squares-plus',
click: () => {
handleOpenSelect()
}
}, },
{ {
label: '从收藏中移除', label: '从收藏中移除',
...@@ -72,4 +84,7 @@ const actionItems = [ ...@@ -72,4 +84,7 @@ const actionItems = [
} }
] ]
] ]
function handleOpenSelect (id) {
Library.handleOpenSelect(id)
}
</script> </script>
\ No newline at end of file
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
size="xl" size="xl"
:padded="false" :padded="false"
variant="none" variant="none"
maxlength="2000"
/> />
<div class="flex flex-shrink-0 gap-2"> <div class="flex flex-shrink-0 gap-2">
<UButton <UButton
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
</div> </div>
</div> </div>
<ILibraryCreate ref="refCreate" /> <ILibraryCreate ref="refCreate" />
<ILibrarySelect ref="refSelect" />
</template> </template>
<script setup> <script setup>
const searchQuery = ref('') const searchQuery = ref('')
...@@ -60,4 +61,12 @@ const refCreate = ref(null) ...@@ -60,4 +61,12 @@ const refCreate = ref(null)
function handleOpenCreateLibrary () { function handleOpenCreateLibrary () {
refCreate.value.handleOpen() refCreate.value.handleOpen()
} }
const refSelect = ref(null)
function handleOpenSelect (id) {
refSelect.value.handleOpen(id)
}
provide('Library', {
handleOpenSelect,
handleOpenCreateLibrary
})
</script> </script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册