修复存在的问题
This commit is contained in:
parent
b9d475db37
commit
b54b1738d4
|
@ -316,7 +316,7 @@ export default function EditSpacePost() {
|
|||
}))
|
||||
}
|
||||
autoSize={{ minRows: 6, maxRows: 15 }}
|
||||
value={formData.paidText.includes("\n") ? formData.paidText.slice(1): formData.paidText}
|
||||
value={formData.paidText.startsWith("\n") ? formData.paidText.slice(1): formData.paidText}
|
||||
style={{ "--font-size": "14px" }}
|
||||
className="bg-[#FFFFFF1A] rounded-2xl mt-2 mb-4 p-2 h-full"
|
||||
/>
|
||||
|
|
|
@ -91,7 +91,7 @@ export default function StreamerPosts({ id }) {
|
|||
{data?.map((item, index) => (
|
||||
<List.Item key={index}>
|
||||
{/* <RenderItem item={item} /> */}
|
||||
<PostItem data={item} type="post" />
|
||||
<PostItem data={item} type="post" showFollow={false}/>
|
||||
</List.Item>
|
||||
))}
|
||||
</List>
|
||||
|
|
|
@ -17,6 +17,7 @@ export default function PostItem({
|
|||
follow,
|
||||
date = new Date(),
|
||||
data = {},
|
||||
showFollow = true,
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isOpenText, setIsOpenText] = useState(false);
|
||||
|
@ -167,7 +168,7 @@ export default function PostItem({
|
|||
<div className="flex-1">
|
||||
<div className="flex justify-between items-center ">
|
||||
<span className="text-md">{data.streamer_ext?.name}</span>
|
||||
{type == "post" && (
|
||||
{type == "post" && showFollow && (
|
||||
<span
|
||||
onClick={() => handleFollow(isFollow, data?.mid, setIsFollow)}
|
||||
className="rounded-full bg-[#FFFFFF1A] px-2 py-1 text-xs text-white font-medium"
|
||||
|
|
|
@ -43,18 +43,7 @@ export default function UploadImgs({
|
|||
}));
|
||||
setFilesUrls(list);
|
||||
// 将filesUrls转变为每组四个的二维数组
|
||||
const newList = [];
|
||||
for (let i = 0; i < list.length; i += 4) {
|
||||
newList.push(list.slice(i, i + 4));
|
||||
}
|
||||
const newColumns = newList.map((it, index) => {
|
||||
return {
|
||||
id: "column-" + index,
|
||||
title: "Column " + index,
|
||||
items: it,
|
||||
};
|
||||
});
|
||||
setColumns(newColumns);
|
||||
handleMakeColumns(list);
|
||||
} else {
|
||||
setFilesUrls([]);
|
||||
setColumns([]);
|
||||
|
@ -133,7 +122,7 @@ export default function UploadImgs({
|
|||
playsInline
|
||||
controls
|
||||
muted={true}
|
||||
controlslist="nodownload"
|
||||
controlsList="nodownload"
|
||||
>
|
||||
<source src={videoUrl} />
|
||||
</video>
|
||||
|
@ -153,9 +142,25 @@ export default function UploadImgs({
|
|||
// videoD.src = url;
|
||||
getVideoBase64(url).then((src) => {
|
||||
setFrameImage((old) => ({ ...old, src }));
|
||||
setFilesUrls([{ url: src, id: "0" }]);
|
||||
const list = [{ url: src, id: "0" }]
|
||||
setFilesUrls(list);
|
||||
handleMakeColumns(list);
|
||||
});
|
||||
};
|
||||
const handleMakeColumns = (list) => {
|
||||
const newList = [];
|
||||
for (let i = 0; i < list.length; i += 4) {
|
||||
newList.push(list.slice(i, i + 4));
|
||||
}
|
||||
const newColumns = newList.map((it, index) => {
|
||||
return {
|
||||
id: "column-" + index,
|
||||
title: "Column " + index,
|
||||
items: it,
|
||||
};
|
||||
});
|
||||
setColumns(newColumns);
|
||||
}
|
||||
const reorder = (list, startIndex, endIndex) => {
|
||||
const result = Array.from(list);
|
||||
const removing = result[startIndex];
|
||||
|
@ -178,33 +183,49 @@ export default function UploadImgs({
|
|||
const newList = reorder(
|
||||
assets,
|
||||
parseInt(source.droppableId.match(/\d+/)[0], 10) * 4 + source.index,
|
||||
parseInt(destination.droppableId.match(/\d+/)[0], 10) * 4 + destination.index
|
||||
parseInt(destination.droppableId.match(/\d+/)[0], 10) * 4 +
|
||||
destination.index
|
||||
);
|
||||
getImgs([...newList]);
|
||||
const start = columns.find((column) => column.id === source.droppableId);
|
||||
const end = columns.find((column) => column.id === destination.droppableId);
|
||||
const startItems = Array.from(start.items);
|
||||
let endItems = Array.from(end.items);
|
||||
const newColumns = columns.map((column) => {
|
||||
if (column.id === start.id) {
|
||||
startItems.splice(source.index, 1, end.items[destination.index]);
|
||||
return { ...column, items: startItems };
|
||||
}
|
||||
if (column.id === end.id) {
|
||||
endItems.splice(destination.index, 1, start.items[source.index]);
|
||||
return { ...column, items: endItems };
|
||||
}
|
||||
if (destination.droppableId === source.droppableId) {
|
||||
const itemToMove = startItems[source.index];
|
||||
startItems.splice(source.index, 1);
|
||||
startItems.splice(destination.index, 0, itemToMove);
|
||||
const newColumns = columns.map((column) => {
|
||||
if (column.id === start.id) {
|
||||
return { ...column, items: startItems };
|
||||
}
|
||||
if (column.id === end.id) {
|
||||
return { ...column, items: endItems };
|
||||
}
|
||||
return column;
|
||||
});
|
||||
setColumns(newColumns);
|
||||
getImgs([...newList]);
|
||||
} else {
|
||||
const newColumns = columns.map((column) => {
|
||||
if (column.id === start.id) {
|
||||
startItems.splice(source.index, 1, end.items[destination.index]);
|
||||
return { ...column, items: startItems };
|
||||
}
|
||||
if (column.id === end.id) {
|
||||
endItems.splice(destination.index, 1, start.items[source.index]);
|
||||
return { ...column, items: endItems };
|
||||
}
|
||||
|
||||
return column;
|
||||
});
|
||||
setColumns(newColumns);
|
||||
return column;
|
||||
});
|
||||
setColumns(newColumns);
|
||||
getImgs([...newList]);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div className="event-none">
|
||||
<DragDropContext
|
||||
onDragEnd={onDragEnd}
|
||||
>
|
||||
{columns.map((column,index) => (
|
||||
<DragDropContext onDragEnd={onDragEnd}>
|
||||
{columns.map((column, index) => (
|
||||
<Droppable
|
||||
direction="horizontal"
|
||||
key={column.id}
|
||||
|
@ -230,7 +251,9 @@ export default function UploadImgs({
|
|||
className="rounded relative mr-1 mb-1 h-full"
|
||||
>
|
||||
<div
|
||||
onClick={() => showPhotos(filesUrls, index*4+ind)}
|
||||
onClick={() =>
|
||||
showPhotos(filesUrls, index * 4 + ind)
|
||||
}
|
||||
style={{ height: "calc(25vw - 0.75rem)" }}
|
||||
className="h-full pb-1"
|
||||
>
|
||||
|
@ -244,7 +267,7 @@ export default function UploadImgs({
|
|||
</div>
|
||||
<div
|
||||
className="h-6 w-6 bg-[#33333380] absolute top-0 right-0 flex justify-center items-center rounded-bl"
|
||||
onClick={() => handleRemoveItem(index*4+ind)}
|
||||
onClick={() => handleRemoveItem(index * 4 + ind)}
|
||||
>
|
||||
<FontAwesomeIcon icon={faClose} size="xl" />
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue