From 5f061ddf14085cd10aa4433e593ec28bb5ae1f15 Mon Sep 17 00:00:00 2001 From: luJianJun <2587063613@qq.com> Date: Mon, 21 Aug 2023 10:34:05 +0800 Subject: [PATCH] =?UTF-8?q?pnpm-=E5=8F=96=E6=B6=88=E7=BD=AE=E9=A1=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/chat/components/listItem.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/pages/chat/components/listItem.tsx b/src/pages/chat/components/listItem.tsx index d23c3a7..65d819b 100644 --- a/src/pages/chat/components/listItem.tsx +++ b/src/pages/chat/components/listItem.tsx @@ -26,11 +26,7 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P let instance = instanceItem || { id: '', name: '' } const isTouchDevice = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0 - const handleClick = () => { - // console.log(dataList) - } - - //获取置顶数据 + //置顶数据排序 const getToppingItem = (arr: any) => { let toppingArr: { id: string, istop: boolean }[] = [] let copyArr: any[]=[] @@ -41,11 +37,11 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P toppingArr.push(arr[i]) } }) - console.log(arr) + // console.log([...copyArr,...toppingArr]) return [...copyArr,...toppingArr] } - //设置置顶 + //设置数据置顶 const setItemTop = (uniqid: string, item: any) => { return new Promise((res, rej) => { fetchData({ uniqid }, function (data) { @@ -55,7 +51,7 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P setErrorFun(data.message) } res(null) - }, '/chat/top', 'POST'); + }, !item.istop?'/chat/top':'/chat/cancelTop', 'POST'); }) } @@ -75,7 +71,7 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P class={[ 'group fi h-10 my-0.5 px-2 gap-2 hv-base rounded-md' ].join(' ')} - onClick={handleClick} + >