From fe55fae1f737f6f3978870a8cfc9771f2edb93c4 Mon Sep 17 00:00:00 2001 From: luJianJun <2587063613@qq.com> Date: Thu, 24 Aug 2023 14:19:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Send.tsx | 2 +- .../conversations/ConversationSidebarItem.tsx | 8 +- src/components/header/Header.tsx | 4 +- src/pages/chat/components/dataList.tsx | 103 +++++++++++------- src/pages/chat/components/iframe.tsx | 2 +- src/pages/chat/components/listItem.tsx | 17 ++- src/pages/chat/css/list.css | 4 +- 7 files changed, 86 insertions(+), 54 deletions(-) diff --git a/src/components/Send.tsx b/src/components/Send.tsx index 895e4ef..092a1d6 100644 --- a/src/components/Send.tsx +++ b/src/components/Send.tsx @@ -197,7 +197,7 @@ export default () => { } return ( -
+
}> diff --git a/src/components/conversations/ConversationSidebarItem.tsx b/src/components/conversations/ConversationSidebarItem.tsx index 6158059..3aff7d8 100644 --- a/src/components/conversations/ConversationSidebarItem.tsx +++ b/src/components/conversations/ConversationSidebarItem.tsx @@ -18,6 +18,12 @@ export default ({ instance }: Props) => { const handleClick = () => { 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) showConversationSidebar.set(false) } @@ -38,7 +44,7 @@ export default ({ instance }: Props) => {
{instance.icon ? instance.icon :
}
-
{ instance.name || t('conversations.untitled') }
+
{instance.name || t('conversations.untitled')}
{ }) }) return ( -
+
{ // dataItemLists.set([{id:'1'},{id:'2'},{id:'3'},{id:'4'},{id:'5'},{id:'6'}]) @@ -30,7 +31,7 @@ export default () => { if (data.code === 200) { setList('data', () => [...data.data]) } else { - setErrorFun(data.message) + // setErrorFun(data.message) } }, '/chat/api', 'GET'); } @@ -115,21 +116,22 @@ export default () => { // if (isMobile()) { // location.pathname = '/' // } else { - // newlyAdded() - let itemList = conversationMapSortList.get() - let setName = JSON.parse(sessionStorage.getItem('dialogueName') as any) || '未命名对话' - let numList: number[] = [] - itemList.map((res, i) => { - if (checkName(res.name, setName.name)) numList.push(i) - }) + // newlyAdded() + let itemList = conversationMapSortList.get() + let setName = JSON.parse(sessionStorage.getItem('dialogueName') as any) || '未命名对话' + let numList: number[] = [] + itemList.map((res, i) => { + if (checkName(res.name, setName.name)) numList.push(i) + }) - if (setName.switch) { - addConversation({ name: setNameNum(setName.name, numList), systemInfo: setName.systemInfo }) - showConversationEditModal.set(true) - setName.switch = false - sessionStorage.setItem('dialogueName', JSON.stringify({ name: setName.name, switch: false })) - } - chatShow.set(false) + if (setName.switch) { + addConversation({ name: setNameNum(setName.name, numList), systemInfo: setName.systemInfo }) + showConversationEditModal.set(true) + setName.switch = false + sessionStorage.setItem('dialogueName', JSON.stringify({ name: setName.name, switch: false })) + } + chatShow.set(false) + setDataInfo() // } } else if (popType() === 'delete') { handleDelete(deleteItem['e'] as any, deleteItem['key'] as any) @@ -138,37 +140,52 @@ export default () => { } //显示错误提示 - const setErrorFun = (message: string) => { - // console.log(message) - setErrorShow({ - message, - show: true - }) - } + // const setErrorFun = (message: string) => { + // // console.log(message) + // setErrorShow({ + // message, + // show: true + // }) + // } //查看记录内容 - const chatWatch = (id:string='')=>{ + const chatWatch = (id: string = '') => { chatShow.set(true) showConversationSidebar.set(false) 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 = () => ( -
-
-
-
- - {errorShow().message} -
-
-
{ setErrorShow({ show: false, message: errorShow().message }) }} > - Dismiss -
-
-
- ) + // const ErrorState = () => ( + //
+ //
+ //
+ //
+ // + // {errorShow().message} + //
+ //
+ //
{ setErrorShow({ show: false, message: errorShow().message }) }} > + // Dismiss + //
+ //
+ //
+ // ) onMount(() => { getList() @@ -196,15 +213,17 @@ export default () => {
- + {/* - + */}
{(instance, i) => ( - + )} diff --git a/src/pages/chat/components/iframe.tsx b/src/pages/chat/components/iframe.tsx index edfcbe6..08c298d 100644 --- a/src/pages/chat/components/iframe.tsx +++ b/src/pages/chat/components/iframe.tsx @@ -12,7 +12,7 @@ export default () => { let id: any = '' id = useStore(uniqid) as any return ( -
+
) diff --git a/src/pages/chat/components/listItem.tsx b/src/pages/chat/components/listItem.tsx index e2ff144..a3a2e59 100644 --- a/src/pages/chat/components/listItem.tsx +++ b/src/pages/chat/components/listItem.tsx @@ -1,6 +1,6 @@ import { keys } from 'idb-keyval' import '../css/list.css' -import { createSignal } from 'solid-js' +import { createSignal,splitProps } from 'solid-js' import { fetchData } from '../../../http/api' type dataList = { @@ -17,18 +17,20 @@ interface Props { setList: Function, infoList: any, 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 let instance = instanceItem || { id: '', name: '',uniqid:'' } const isTouchDevice = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0 + // const [clickInfoTof]=splitProps(props,["clickInfo"]) + // console.log(clickInfoTof) - //置顶数据排序 + //置顶数据排序 const getToppingItem = (arr: any) => { let toppingArr: { id: string, istop: boolean }[] = [] let copyArr: any[]=[] @@ -50,7 +52,7 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun,chat if (data.code === 200) { item.istop = item.istop ? 0 : 1 } else { - setErrorFun(data.message) + // setErrorFun(data.message) } res(null) }, !item.istop?'/chat/top':'/chat/cancelTop', 'POST'); @@ -71,10 +73,13 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun,chat return (
chatWatch(instance.uniqid)} > + {/* {clickInfo.toString()} */}
diff --git a/src/pages/chat/css/list.css b/src/pages/chat/css/list.css index 53982a4..73f3380 100644 --- a/src/pages/chat/css/list.css +++ b/src/pages/chat/css/list.css @@ -112,6 +112,6 @@ border-top:1px solid #e9ecef; } -.chat-list-box{ - max-height:; +.click-bg{ + background: rgba(246, 246, 246, 1) !important; } \ No newline at end of file