首页调整

dev
haoyuntao 7 months ago
parent 3e63234a7c
commit 60762f9175
  1. 27
      src/components/chat-scroll-view/chat-scroll-view.vue
  2. 23
      src/packages/pages/ai_talk/ai_talk.vue
  3. 67
      src/packages/pages/ai_talk/components/session-item.vue
  4. 59
      src/packages/pages/ai_talk/components/session-popup.vue
  5. 127
      src/pages/ai_creation/ai_creation.vue
  6. BIN
      src/static/images/user/toux.png
  7. 14
      src/styles/public.scss

@ -22,10 +22,10 @@
<template #top>
<slot name="top" />
<model-picker
<!-- <model-picker
v-if="!pluginOptions.pluginId"
v-model="modelKey"
/>
/> -->
<VipUse
v-if="pluginOptions.pluginId"
:plugin="pluginOptions.current"
@ -110,8 +110,19 @@
}"
/>
</view>
<view class="mb-[20rpx] flex items-center">
<view class="flex items-center mr-auto">
<view class="mb-[20rpx] flex items-center justify-between">
<view
class="text-xs flex items-center u-flex-1"
@click="backChatLock"
>
<u-icon
name="list"
class="mr-[4rpx]"
size="28"
/>
对话列表
</view>
<view class="flex items-center mr-auto u-flex-1">
<chat-plugins
v-if="type === 1"
v-model="pluginOptions.pluginId"
@ -125,8 +136,9 @@
></network-switch>
</view>
<view
class="flex text-content items-center flex-none"
class="flex text-content items-center "
>
<view
class="text-xs flex items-center"
@click="cleanChatLock"
@ -336,6 +348,8 @@ const modelKey = ref('')
const emit = defineEmits<{
(event: 'update:modelValue', value: any[]): void
(event: 'reader', value: any): void
(event: 'back', value: any): void
}>()
const appStore = useAppStore()
const router = useRouter()
@ -380,6 +394,9 @@ const isShowFileUpload = computed(() => {
pluginOptions.pluginId === 'gpt-4-all'
)
})
const backChatLock=()=>{
emit('back',false)
}
const pagingRef = shallowRef()
const queryList = async (pageNo: number, pageSize: number) => {

@ -18,22 +18,23 @@
:safeAreaInsetBottom="false"
:avatar="appStore.getChatConfig.chat_logo"
bottom="100rpx"
@back="handlerback"
>
<template #top>
<follow-official
<!-- <follow-official
:show="!!appStore.config.is_follow_official"
:title="appStore.getLoginConfig.involved_text"
/>
<session v-model="showPopup" />
<session v-model="showPopup" /> -->
</template>
<template #empty>
<view class="w-full">
<!-- <view class="w-full">
<div
class="my-[60rpx] text-center text-[50rpx] font-medium"
>
{{ appStore.getChatConfig.chat_title }}
</div>
<problem-example
<problem-example
v-if="problem.length"
:data="problem"
@click-item="(value:any) => chatRef.sendLock(value)"
@ -56,11 +57,11 @@
{{ indexData?.tips?.sub_title }}
</view>
</view>
</view>
</view> -->
</template>
</chat-scroll-view>
<!-- 会话弹窗 -->
<session-popup v-model="showPopup" />
<session-popup ref="popup" v-model="showPopup" />
<!-- 会话弹窗 -->
<problem-example-popup
v-model="showExamplePopup"
@ -82,7 +83,7 @@
<!-- #endif -->
</view>
<!-- <canvas canvas-id="canvasId" id="canvasId"></canvas> -->
<tabbar />
<!-- <tabbar /> -->
</view>
</template>
@ -113,9 +114,10 @@ import { useSessionList } from './components/useSessionList'
import agreement from '@/components/agreement/agreement.vue'
const { getSessionLists, sessionActive } = useSessionList()
const showPopup = ref(false)
const showPopup = ref(true)
const showExamplePopup = ref(false)
const problem = ref([])
const popup=ref(null)
//
const chatList = ref<any[]>([])
const chatRef = shallowRef()
@ -134,7 +136,10 @@ const modelKey = ref('')
const getProblemExample = async () => {
problem.value = await getSamplesLists()
}
const handlerback=()=>{
console.log(popup.value,'=====popup.value')
popup.value.showPopup()
}
const getDecorateFunc = async () => {
try {
const { data } = await getDecorate({ id: 8 })

@ -1,15 +1,18 @@
<template>
<view
class="px-[20rpx] h-[80rpx] flex items-center rounded-[8rpx] mb-[20rpx] cursor-pointer"
:class="{
' bg-page': isActive
}"
@click="activeId = itemId"
class="px-[20rpx] h-[110rpx] flex items-center rounded-[8rpx] mb-[20rpx] cursor-pointer"
@click="handlerId"
>
<u-icon name="chat" />
<!-- <u-icon name="chat" /> -->
<u-image
width="100"
height="100"
src="@/static/images/user/toux.png"
alt=""
/>
<view class="border">
<view class="ml-[20rpx] flex-1 min-w-0">
<u-input
<!-- <u-input
height="50"
v-if="isEdit"
:custom-style="{
@ -17,10 +20,15 @@
}"
v-model="nameInput"
border
/>
<view v-else class="line-clamp-1">{{ name }}</view>
/> -->
<view class="robbit">
<view class="zhusou mb-[10rpx]">机器人助手</view>
<view class="creat_time">{{creat_time}}</view>
</view>
<view class="line-clamp-1">{{ name }}</view>
</view>
<template v-if="isActive">
</view>
<!-- <template v-if="isActive">
<template v-if="isEdit">
<view
class="cursor-pointer mx-[12rpx] flex h-full"
@ -49,7 +57,7 @@
<u-icon name="trash" />
</view>
</template>
</template>
</template> -->
</view>
</template>
<script lang="ts" setup>
@ -60,10 +68,11 @@ const props = withDefaults(
modelValue: number | string
name: string
itemId: number | string
time:string
}>(),
{}
)
const emit = defineEmits(['update:modelValue', 'edit', 'delete'])
const emit = defineEmits(['update:modelValue', 'edit', 'delete','show'])
const nameInput = ref('')
const isEdit = ref(false)
@ -76,6 +85,7 @@ const activeId = computed({
emit('update:modelValue', value)
}
})
const creat_time=computed(() => props.time)
const isActive = computed(() => activeId.value === props.itemId)
@ -83,6 +93,10 @@ const handleEdit = () => {
isEdit.value = false
emit('edit', props.itemId, nameInput.value)
}
const handlerId=()=>{
activeId.value = props.itemId
emit('show', false)
}
watch(
() => props.modelValue,
() => {
@ -99,4 +113,31 @@ watch(
immediate: true
}
)
</script>
<style lang="scss" scoped>
.robbit{
display:flex;
justify-content: space-between;
margin-top: 30rpx;
.zhusou{
font-weight: bold;
font-size:32rpx;
color:#222222;
}
.creat_time{
font-size:24rpx;
color:#999999;
}
}
.line-clamp-1{
font-size:28rpx;
}
.border{
width:92%;
height:140rpx;
margin-left: 20rpx;
padding-bottom: 20rpx;
border-bottom: 1px solid #ccc;
}
</style>

@ -1,15 +1,15 @@
<template>
<u-popup v-model="show" mode="left" width="480rpx" safe-area-inset-bottom>
<u-popup v-model="show" mode="center" width="750rpx" height="100%" safe-area-inset-bottom>
<view class="flex flex-col h-full relative z-[9999]">
<view class="px-[20rpx] py-[20rpx]">
<u-button
<view class="px-[10rpx] py-[10rpx] delete">
<!-- <u-button
type="primary"
:custom-style="{ width: '100%' }"
@click="sessionAddLock"
:loading="isLock"
>
+ 新建会话
</u-button>
</u-button> -->
<view class="px-[10rpx] py-[10rpx]" @click="sessionClear"><u-icon name="trash" />删除所有会话</view>
</view>
<view class="flex-1 min-h-0">
<scroll-view scroll-y class="h-full">
@ -19,21 +19,24 @@
v-model="sessionActive"
:item-id="item.id"
:name="item.name"
:time="item.create_time"
@edit="sessionEdit"
@delete="sessionDelete"
@show="sessionDetail"
/>
</view>
</view>
</scroll-view>
</view>
<view class="px-[20rpx] py-[20rpx]">
<u-button
<view class="text-xs items-center create" @click="sessionAddTalk">
<u-icon name="plus" class="mt-[15rpx]" size="40" />
<view class="create-tx">新建</view>
</view>
<!-- <u-button
:custom-style="{ width: '100%' }"
@click="sessionClear"
>
删除所有会话
</u-button>
</view>
</u-button> -->
</view>
</u-popup>
</template>
@ -44,7 +47,7 @@ import { useAppStore } from '@/stores/app'
import { useSessionList } from './useSessionList'
import { useLockFn } from '@/hooks/useLockFn'
import SessionItem from './session-item.vue'
import { watch } from 'vue'
import { watch,defineExpose } from 'vue'
const props = defineProps({
modelValue: {
type: Boolean
@ -73,7 +76,14 @@ const {
const { lockFn: sessionAddLock, isLock } = useLockFn(async () => {
await sessionAdd()
})
const sessionAddTalk=()=>{
emit('update:modelValue', false)
sessionAdd()
}
const sessionDetail=(val)=>{
emit('update:modelValue', val)
}
const showPopup=()=>emit('update:modelValue', true)
const appStore = useAppStore()
watch(
() => appStore.getChatConfig,
@ -87,4 +97,27 @@ watch(
immediate: true
}
)
defineExpose({
showPopup
})
</script>
<style>
.delete{
display:flex;
justify-content: flex-end;
background-color: #f5f5f5;
}
.create{
position: fixed;
bottom:30rpx;
right:20rpx;
width:130rpx;
height:130rpx;
line-height: 40rpx;
text-align:center;
border-radius: 50%;
color:#fff;
font-size:32rpx;
background-color: #1668f7;
}
</style>

@ -0,0 +1,127 @@
<template>
<page-meta :page-style="$theme.pageStyle">
<!-- #ifndef H5 -->
<navigation-bar
:front-color="$theme.navColor"
:background-color="$theme.navBgColor"
/>
<!-- #endif -->
</page-meta>
<view class="ai-creation">
<view class="flex-1 min-h-0">
<scroll-view scroll-y class="h-full">
<view class="py-[14rpx] px-[30rpx]">
<u-search
v-model="keyword"
placeholder="请输入关键词搜索"
height="72"
bg-color="#fff"
:show-action="false"
@search="getData()"
/>
</view>
<view class="px-[30rpx]">
<template v-for="category in data" :key="category.id">
<view
class="py-[25rpx]"
v-if="
!(
category.model.length == 0 &&
category.name == '我的收藏'
)
"
>
<text class="font-medium text-lg">{{
category.name
}}</text>
</view>
<view
class="flex flex-wrap mx-[-10rpx] rounded-[14rpx]"
>
<view
class="w-1/2 px-[10rpx] mb-[20rpx]"
v-for="item in category.model"
:key="item.id"
>
<view
class="rounded-[16rpx] py-[24rpx] h-full w-full"
>
<router-navigate
:to="`/packages/pages/create/create?id=${item.id}`"
>
<view class="flex w-full">
<u-image
:src="item.image"
width="76"
height="76"
border-radius="8rpx"
class="flex-none"
/>
<view
class="ml-[14rpx] flex flex-col justify-around min-w-0"
>
<view
class="font-medium text-[30rpx]"
>{{ item.name }}</view
>
<view
class="text-[24rpx] text-[#666666] truncate"
>{{ item.tips }}</view
>
</view>
</view>
</router-navigate>
</view>
</view>
</view>
</template>
</view>
</scroll-view>
</view>
<tabbar />
</view>
</template>
<script setup lang="ts">
import { getCreationLists } from '@/api/chat'
import { onLoad, onPullDownRefresh, onShow } from '@dcloudio/uni-app'
import { ref } from 'vue'
const keyword = ref('')
const data = ref<any[]>([])
const getData = async () => {
data.value = await getCreationLists({
keyword: keyword.value
})
}
onShow(() => {
getData()
})
onPullDownRefresh(async () => {
await getData()
uni.stopPullDownRefresh()
})
</script>
<style lang="scss">
page {
height: 100%;
}
.ai-creation {
height: 100%;
display: flex;
flex-direction: column;
background: linear-gradient(
44.7deg,
#eaffff 0%,
#faf6ff 50%,
#f2f3ff 63%,
#eaffff 100%
);
background-size: cover;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@ -1,15 +1,15 @@
page {
background-color: $u-bg-color;
font-size: 28rpx;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: theme('fontFamily.sans')
background-color: $u-bg-color;
font-size: 28rpx;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: theme('fontFamily.sans')
}
uni-modal {
z-index: 999999 !important;
z-index: 999999 !important;
}
button::after {
border: initial;
border: initial;
}
Loading…
Cancel
Save