pnpm-取消置顶

This commit is contained in:
luJianJun 2023-08-21 10:34:05 +08:00
parent cf4fedbee2
commit 5f061ddf14

View File

@ -26,11 +26,7 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P
let instance = instanceItem || { id: '', name: '' } let instance = instanceItem || { id: '', name: '' }
const isTouchDevice = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0 const isTouchDevice = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0
const handleClick = () => { //置顶数据排序
// console.log(dataList)
}
//获取置顶数据
const getToppingItem = (arr: any) => { const getToppingItem = (arr: any) => {
let toppingArr: { id: string, istop: boolean }[] = [] let toppingArr: { id: string, istop: boolean }[] = []
let copyArr: any[]=[] let copyArr: any[]=[]
@ -41,11 +37,11 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P
toppingArr.push(arr[i]) toppingArr.push(arr[i])
} }
}) })
console.log(arr) // console.log([...copyArr,...toppingArr])
return [...copyArr,...toppingArr] return [...copyArr,...toppingArr]
} }
//设置置顶 //设置数据置顶
const setItemTop = (uniqid: string, item: any) => { const setItemTop = (uniqid: string, item: any) => {
return new Promise((res, rej) => { return new Promise((res, rej) => {
fetchData({ uniqid }, function (data) { fetchData({ uniqid }, function (data) {
@ -55,7 +51,7 @@ export default ({ instanceData, key, setList, infoList, popShow,setErrorFun }: P
setErrorFun(data.message) setErrorFun(data.message)
} }
res(null) 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={[ class={[
'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={handleClick}
> >
<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" />