页面优化
This commit is contained in:
parent
44409b2bba
commit
fe55fae1f7
@ -197,7 +197,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={`relative shrink-0 border-t border-base pb-[env(safe-area-inset-bottom)] transition transition-colors duration-300 ${stateRootClass()} ${footerClass()}`}>
|
<div id='infoSend' class={`relative shrink-0 border-t border-base pb-[env(safe-area-inset-bottom)] transition transition-colors duration-300 ${stateRootClass()} ${footerClass()}`}>
|
||||||
<div class={`relative transition transition-height duration-240 ${stateHeightClass()}`}>
|
<div class={`relative transition transition-height duration-240 ${stateHeightClass()}`}>
|
||||||
<Switch fallback={<EmptyState />}>
|
<Switch fallback={<EmptyState />}>
|
||||||
<Match when={stateType() === 'login'}>
|
<Match when={stateType() === 'login'}>
|
||||||
|
@ -18,6 +18,12 @@ export default ({ instance }: Props) => {
|
|||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
chatShow.set(false)
|
chatShow.set(false)
|
||||||
|
let infoHeader = document.getElementById("infoHeader");
|
||||||
|
let infoSend = document.getElementById("infoSend");
|
||||||
|
if (!chatShow.get()) {
|
||||||
|
infoHeader.style.display = "flex";
|
||||||
|
infoSend.style.display = "flex";
|
||||||
|
}
|
||||||
currentConversationId.set(instance.id)
|
currentConversationId.set(instance.id)
|
||||||
showConversationSidebar.set(false)
|
showConversationSidebar.set(false)
|
||||||
}
|
}
|
||||||
@ -38,7 +44,7 @@ export default ({ instance }: Props) => {
|
|||||||
<div class="fcc w-8 h-8 rounded-full text-xl shrink-0">
|
<div class="fcc w-8 h-8 rounded-full text-xl shrink-0">
|
||||||
{instance.icon ? instance.icon : <div class="text-base i-carbon-chat" />}
|
{instance.icon ? instance.icon : <div class="text-base i-carbon-chat" />}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 truncate text-sm">{ instance.name || t('conversations.untitled') }</div>
|
<div class="flex-1 truncate text-sm">{instance.name || t('conversations.untitled')}</div>
|
||||||
<div class={isTouchDevice ? '' : 'hidden group-hover:block'}>
|
<div class={isTouchDevice ? '' : 'hidden group-hover:block'}>
|
||||||
<div
|
<div
|
||||||
class="inline-flex p-2 items-center gap-1 rounded-md hv-base"
|
class="inline-flex p-2 items-center gap-1 rounded-md hv-base"
|
||||||
|
@ -16,7 +16,9 @@ export default () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
return (
|
return (
|
||||||
<header onDblClick={scrollController().scrollToTop} class="shrink-0 absolute top-0 left-0 right-0 fi justify-between border-b border-base h-14 px-4">
|
<header onDblClick={scrollController().scrollToTop}
|
||||||
|
id='infoHeader'
|
||||||
|
class="shrink-0 absolute top-0 left-0 right-0 fi justify-between border-b border-base h-14 px-4">
|
||||||
<div class="fi overflow-hidden">
|
<div class="fi overflow-hidden">
|
||||||
<div
|
<div
|
||||||
class="fcc p-2 rounded-md text-xl hv-foreground md:hidden"
|
class="fcc p-2 rounded-md text-xl hv-foreground md:hidden"
|
||||||
|
@ -6,8 +6,9 @@ import { fetchData } from '../../../http/api'
|
|||||||
import { addConversation } from '@/stores/conversation'
|
import { addConversation } from '@/stores/conversation'
|
||||||
import { showConversationEditModal } from '@/stores/ui'
|
import { showConversationEditModal } from '@/stores/ui'
|
||||||
import { conversationMapSortList } from '@/stores/conversation'
|
import { conversationMapSortList } from '@/stores/conversation'
|
||||||
import { chatShow,uniqid } from '../ts/store';
|
import { chatShow, uniqid } from '../ts/store';
|
||||||
import { showConversationSidebar } from '@/stores/ui'
|
import { showConversationSidebar } from '@/stores/ui'
|
||||||
|
import { useStore } from '@nanostores/solid'
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
// dataItemLists.set([{id:'1'},{id:'2'},{id:'3'},{id:'4'},{id:'5'},{id:'6'}])
|
// dataItemLists.set([{id:'1'},{id:'2'},{id:'3'},{id:'4'},{id:'5'},{id:'6'}])
|
||||||
@ -30,7 +31,7 @@ export default () => {
|
|||||||
if (data.code === 200) {
|
if (data.code === 200) {
|
||||||
setList('data', () => [...data.data])
|
setList('data', () => [...data.data])
|
||||||
} else {
|
} else {
|
||||||
setErrorFun(data.message)
|
// setErrorFun(data.message)
|
||||||
}
|
}
|
||||||
}, '/chat/api', 'GET');
|
}, '/chat/api', 'GET');
|
||||||
}
|
}
|
||||||
@ -130,6 +131,7 @@ export default () => {
|
|||||||
sessionStorage.setItem('dialogueName', JSON.stringify({ name: setName.name, switch: false }))
|
sessionStorage.setItem('dialogueName', JSON.stringify({ name: setName.name, switch: false }))
|
||||||
}
|
}
|
||||||
chatShow.set(false)
|
chatShow.set(false)
|
||||||
|
setDataInfo()
|
||||||
// }
|
// }
|
||||||
} else if (popType() === 'delete') {
|
} else if (popType() === 'delete') {
|
||||||
handleDelete(deleteItem['e'] as any, deleteItem['key'] as any)
|
handleDelete(deleteItem['e'] as any, deleteItem['key'] as any)
|
||||||
@ -138,37 +140,52 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//显示错误提示
|
//显示错误提示
|
||||||
const setErrorFun = (message: string) => {
|
// const setErrorFun = (message: string) => {
|
||||||
// console.log(message)
|
// // console.log(message)
|
||||||
setErrorShow({
|
// setErrorShow({
|
||||||
message,
|
// message,
|
||||||
show: true
|
// show: true
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
//查看记录内容
|
//查看记录内容
|
||||||
const chatWatch = (id:string='')=>{
|
const chatWatch = (id: string = '') => {
|
||||||
chatShow.set(true)
|
chatShow.set(true)
|
||||||
showConversationSidebar.set(false)
|
showConversationSidebar.set(false)
|
||||||
uniqid.set(id)
|
uniqid.set(id)
|
||||||
|
setDataInfo()
|
||||||
|
}
|
||||||
|
const unId=useStore(uniqid)
|
||||||
|
|
||||||
|
//设置切换显示内容
|
||||||
|
const setDataInfo=()=>{
|
||||||
|
let infoSend = document.getElementById("infoSend");
|
||||||
|
let infoHeader = document.getElementById("infoHeader");
|
||||||
|
if (chatShow.get()) {
|
||||||
|
infoSend.style.display = "none";
|
||||||
|
infoHeader.style.display = "none";
|
||||||
|
} else {
|
||||||
|
infoHeader.style.display = "flex";
|
||||||
|
infoSend.style.display = "flex";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//提示弹窗
|
//提示弹窗
|
||||||
const ErrorState = () => (
|
// const ErrorState = () => (
|
||||||
<div class='tps-error-box'>
|
// <div class='tps-error-box'>
|
||||||
<div class="max-w-base h-full flex items-end flex-col justify-between gap-8 sm:(flex-row items-center) py-4 text-error text-sm" style="padding: 1rem;">
|
// <div class="max-w-base h-full flex items-end flex-col justify-between gap-8 sm:(flex-row items-center) py-4 text-error text-sm" style="padding: 1rem;">
|
||||||
<div class="flex-1 w-full">
|
// <div class="flex-1 w-full">
|
||||||
<div class="fi gap-0.5 mb-1">
|
// <div class="fi gap-0.5 mb-1">
|
||||||
<span i-carbon-warning />
|
// <span i-carbon-warning />
|
||||||
<span class="font-semibold">{errorShow().message}</span>
|
// <span class="font-semibold">{errorShow().message}</span>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
<div class="border border-error px-2 py-1 rounded-md hv-base hover:bg-white" onClick={() => { setErrorShow({ show: false, message: errorShow().message }) }} >
|
// <div class="border border-error px-2 py-1 rounded-md hv-base hover:bg-white" onClick={() => { setErrorShow({ show: false, message: errorShow().message }) }} >
|
||||||
Dismiss
|
// Dismiss
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
)
|
// )
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
getList()
|
getList()
|
||||||
@ -196,15 +213,17 @@ export default () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
<Show when={errorShow().show}>
|
{/* <Show when={errorShow().show}>
|
||||||
<ErrorState />
|
<ErrorState />
|
||||||
</Show>
|
</Show> */}
|
||||||
<div class="overflow-auto px-2">
|
<div class="overflow-auto px-2">
|
||||||
<div style={{ width: '100%' }}>
|
<div style={{ width: '100%' }}>
|
||||||
<For each={list.data}>
|
<For each={list.data}>
|
||||||
{(instance, i) => (
|
{(instance, i) => (
|
||||||
<Show when={instance.title}>
|
<Show when={instance.title}>
|
||||||
<ConversationSidebarItem chatWatch={chatWatch} popShow={popShow} setErrorFun={setErrorFun} instanceData={{ ...instance }} infoList={list.data} key={i as any} setList={setList} />
|
<ConversationSidebarItem
|
||||||
|
clickInfo={instance.uniqid==unId()}
|
||||||
|
chatWatch={chatWatch} popShow={popShow} instanceData={{ ...instance }} infoList={list.data} key={i as any} setList={setList} />
|
||||||
</Show>
|
</Show>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
|
@ -12,7 +12,7 @@ export default () => {
|
|||||||
let id: any = ''
|
let id: any = ''
|
||||||
id = useStore(uniqid) as any
|
id = useStore(uniqid) as any
|
||||||
return (
|
return (
|
||||||
<div style={{width:'100%',height:'100%'}}>
|
<div style={{width:'100%',height:'100%'}} id='iframe'>
|
||||||
<iframe src={`https://ansnid.com/share/?id=${id()}`} style={{width:'100%',height:'100%'}}></iframe>
|
<iframe src={`https://ansnid.com/share/?id=${id()}`} style={{width:'100%',height:'100%'}}></iframe>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { keys } from 'idb-keyval'
|
import { keys } from 'idb-keyval'
|
||||||
import '../css/list.css'
|
import '../css/list.css'
|
||||||
import { createSignal } from 'solid-js'
|
import { createSignal,splitProps } from 'solid-js'
|
||||||
import { fetchData } from '../../../http/api'
|
import { fetchData } from '../../../http/api'
|
||||||
|
|
||||||
type dataList = {
|
type dataList = {
|
||||||
@ -17,16 +17,18 @@ interface Props {
|
|||||||
setList: Function,
|
setList: Function,
|
||||||
infoList: any,
|
infoList: any,
|
||||||
popShow: Function,
|
popShow: Function,
|
||||||
setErrorFun:Function,
|
chatWatch:Function,
|
||||||
chatWatch:Function
|
clickInfo:any
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ({ instanceData, key, setList, infoList, popShow,setErrorFun,chatWatch }: Props) => {
|
export default ({ instanceData, key, setList, infoList, popShow,chatWatch,clickInfo }: Props,props:any) => {
|
||||||
|
|
||||||
//设置数据
|
//设置数据
|
||||||
const instanceItem = instanceData
|
const instanceItem = instanceData
|
||||||
let instance = instanceItem || { id: '', name: '',uniqid:'' }
|
let instance = instanceItem || { id: '', name: '',uniqid:'' }
|
||||||
const isTouchDevice = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
|
const isTouchDevice = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
|
||||||
|
// const [clickInfoTof]=splitProps(props,["clickInfo"])
|
||||||
|
// console.log(clickInfoTof)
|
||||||
|
|
||||||
//置顶数据排序
|
//置顶数据排序
|
||||||
const getToppingItem = (arr: any) => {
|
const getToppingItem = (arr: any) => {
|
||||||
@ -50,7 +52,7 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun,chat
|
|||||||
if (data.code === 200) {
|
if (data.code === 200) {
|
||||||
item.istop = item.istop ? 0 : 1
|
item.istop = item.istop ? 0 : 1
|
||||||
} else {
|
} else {
|
||||||
setErrorFun(data.message)
|
// setErrorFun(data.message)
|
||||||
}
|
}
|
||||||
res(null)
|
res(null)
|
||||||
}, !item.istop?'/chat/top':'/chat/cancelTop', 'POST');
|
}, !item.istop?'/chat/top':'/chat/cancelTop', 'POST');
|
||||||
@ -71,10 +73,13 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun,chat
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
|
clickInfo?
|
||||||
|
'group fi h-10 my-0.5 px-2 gap-2 hv-base rounded-md click-bg' :
|
||||||
'group fi h-10 my-0.5 px-2 gap-2 hv-base rounded-md'
|
'group fi h-10 my-0.5 px-2 gap-2 hv-base rounded-md'
|
||||||
].join(' ')}
|
].join(' ')}
|
||||||
onClick={()=>chatWatch(instance.uniqid)}
|
onClick={()=>chatWatch(instance.uniqid)}
|
||||||
>
|
>
|
||||||
|
{/* {clickInfo.toString()} */}
|
||||||
<div class="fcc w-8 h-8 rounded-full text-xl shrink-0">
|
<div class="fcc w-8 h-8 rounded-full text-xl shrink-0">
|
||||||
<div class="text-base i-carbon-chat" />
|
<div class="text-base i-carbon-chat" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -112,6 +112,6 @@
|
|||||||
border-top:1px solid #e9ecef;
|
border-top:1px solid #e9ecef;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-list-box{
|
.click-bg{
|
||||||
max-height:;
|
background: rgba(246, 246, 246, 1) !important;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user