提交 e14d412b 编写于 作者: View Design's avatar View Design

add private

上级 a02cedb6
import useConfig from '@/composables/useConfig';
const { deploymentType } = useConfig();
export default defineAppConfig({ export default defineAppConfig({
ui: { ui: {
primary: 'emerald', primary: deploymentType === 'saas' ? 'emerald' : 'blue',
gray: 'cool', gray: 'cool',
// notifications: { // notifications: {
// position: 'top-8 bottom-auto' // position: 'top-8 bottom-auto'
......
...@@ -15,4 +15,14 @@ useHead({ ...@@ -15,4 +15,14 @@ useHead({
nextTick(() => { nextTick(() => {
$updateUserInfo() $updateUserInfo()
}) })
const userId = useCookie('user-id', {
maxAge: 86400 * 28
});
// 初始化时,获取URL的query userId,如果有值,则赋值给 cookie:userId
const route = useRoute();
const queryUserId = route.query.userId;
if (queryUserId) {
userId.value = queryUserId;
}
</script> </script>
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
</div> </div>
</div> </div>
<UDivider/> <UDivider/>
<div <div v-if="deploymentType === 'saas'" class="bg-gray-100 dark:bg-gray-900 border-r border-gray-200 dark:border-gray-800 flex flex-col items-center justify-center">
class="bg-gray-100 dark:bg-gray-900 border-r border-gray-200 dark:border-gray-800 flex flex-col items-center justify-center">
<IUserInfo/> <IUserInfo/>
</div> </div>
<UModal v-model="isOpenCreate" :ui="{ width: 'w-full sm:max-w-screen-md' }"> <UModal v-model="isOpenCreate" :ui="{ width: 'w-full sm:max-w-screen-md' }">
...@@ -34,6 +33,7 @@ ...@@ -34,6 +33,7 @@
</template> </template>
<script setup> <script setup>
const { metaSymbol } = useShortcuts() const { metaSymbol } = useShortcuts()
const { deploymentType } = useConfig();
const isOpenCreate = ref(false) const isOpenCreate = ref(false)
const handleShowCreate = () => { const handleShowCreate = () => {
isOpenCreate.value = true isOpenCreate.value = true
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
to="/library" to="/library"
/> />
<ISearchHistory @sign="$openSign"/> <ISearchHistory @sign="$openSign"/>
<ClientOnly> <ClientOnly v-if="deploymentType === 'saas'">
<UButton <UButton
v-if="!$isSignIn" v-if="!$isSignIn"
class="flex gap-2 justify-center" class="flex gap-2 justify-center"
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
const MenuSider = inject('MenuSider', null) const MenuSider = inject('MenuSider', null)
const { $isSignIn, $isOpenSign } = storeToRefs(useUserStore()) const { $isSignIn, $isOpenSign } = storeToRefs(useUserStore())
const { $openSign, $closeSign } = useUserStore() const { $openSign, $closeSign } = useUserStore()
const { deploymentType } = useConfig();
function handleClose () { function handleClose () {
MenuSider && MenuSider.handleToggleAside() MenuSider && MenuSider.handleToggleAside()
$openSign() $openSign()
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
@click="handleCopyMD" @click="handleCopyMD"
/> />
<UButton <UButton
v-if="deploymentType === 'saas'"
size="xs" size="xs"
color="gray" color="gray"
leading-icon="i-heroicons-share-20-solid" leading-icon="i-heroicons-share-20-solid"
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
<script setup> <script setup>
const Search = inject('Search') const Search = inject('Search')
const toast = useToast() const toast = useToast()
const { deploymentType } = useConfig();
const props = defineProps({ const props = defineProps({
item: { item: {
type: Object, type: Object,
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
:label="$selectCollectionId.length ? '已收藏' : '收藏'" :label="$selectCollectionId.length ? '已收藏' : '收藏'"
@click="handleOpenSelect" @click="handleOpenSelect"
/> />
<UPopover v-model:open="isShareOpen"> <UPopover v-model:open="isShareOpen" v-if="deploymentType === 'saas'">
<UButton <UButton
:leading-icon="isOpen ? 'i-heroicons-share-16-solid' : 'i-heroicons-lock-closed-16-solid'" :leading-icon="isOpen ? 'i-heroicons-share-16-solid' : 'i-heroicons-lock-closed-16-solid'"
label="分享" label="分享"
...@@ -94,6 +94,7 @@ const { $isSignIn } = storeToRefs(useUserStore()) ...@@ -94,6 +94,7 @@ const { $isSignIn } = storeToRefs(useUserStore())
const { $selectCollectionId } = storeToRefs(useLibraryStore()) const { $selectCollectionId } = storeToRefs(useLibraryStore())
const { $openLibrarySelect, $setSelectCollectionId } = useLibraryStore() const { $openLibrarySelect, $setSelectCollectionId } = useLibraryStore()
const { findRecordCollection } = useCollectionRequest() const { findRecordCollection } = useCollectionRequest()
const { deploymentType } = useConfig();
const props = defineProps({ const props = defineProps({
query: { query: {
type: String, type: String,
......
export default function () {
return {
deploymentType: 'private', // saas || private
}
}
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
<IMenuSider fixed/> <IMenuSider fixed/>
</template> </template>
<script setup> <script setup>
const recommendQuestions = [ const { deploymentType } = useConfig();
let recommendQuestions = [
{ {
title: '介绍一下 ChatTTS 项目', title: '介绍一下 ChatTTS 项目',
c_id: 'c_WyRkNzi6MgBzOD32' c_id: 'c_WyRkNzi6MgBzOD32'
...@@ -52,6 +53,33 @@ const recommendQuestions = [ ...@@ -52,6 +53,33 @@ const recommendQuestions = [
// title: '有哪些有效的方法可以应对 DDoS 攻击?' // title: '有哪些有效的方法可以应对 DDoS 攻击?'
// } // }
] ]
if (deploymentType === 'private') {
recommendQuestions = [
{
title: '介绍一下 ChatTTS 项目',
c_id: 'c_WyRkNzi6MgBzOD32'
},
{
title: '用 TailwindCSS 写一个响应式布局的登录页面',
c_id: 'c_Upb8x5jxhYeRJXrI'
},
{
title: '归纳总结这篇文章 https://blog.csdn.net/csdnnews/article/details/139788492',
c_id: 'c_PESV6PxFRUSOrQis'
},
{
title: 'LangChain 的项目结构是怎样的',
c_id: 'c_8toZjUIGGJmh96fa'
},
{
title: '用 Python 写一个对列表去重的函数',
c_id: 'c_ZpIdBs6FQqtTq4u5'
},
{
title: '有哪些有效的方法可以应对 DDoS 攻击?',
},
]
}
const refCreate = ref(null) const refCreate = ref(null)
function handleSearch (item) { function handleSearch (item) {
if (!item.c_id) refCreate.value.handleQuickSearch(item.title) if (!item.c_id) refCreate.value.handleQuickSearch(item.title)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册