增加banneer占位图
This commit is contained in:
@@ -3,6 +3,7 @@ import ListCard from "@/components/ListCard";
|
||||
import ListLoadError from "@/components/ListLoadError";
|
||||
import ListCardSkeleton from "@/components/ListCardSkeleton";
|
||||
import { useReachBottom } from "@tarojs/taro";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { useUserInfo, useUserActions, useLastTestResult } from "@/store/userStore";
|
||||
import { NTRPTestEntryCard } from "@/components";
|
||||
import { EvaluateScene } from "@/store/evaluateStore";
|
||||
@@ -158,6 +159,35 @@ const ListContainer = (props) => {
|
||||
[evaluateFlag, data, hasTestInLastMonth, showNumber]
|
||||
);
|
||||
|
||||
// 渲染 banner 卡片
|
||||
const renderBanner = (item, index) => {
|
||||
if (!item?.banner_image_url) return null;
|
||||
return (
|
||||
<View
|
||||
key={item.id || `banner-${index}`}
|
||||
style={{
|
||||
maxHeight: "122px",
|
||||
overflow: "hidden",
|
||||
borderRadius: "12px",
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
src={item.banner_image_url}
|
||||
mode="widthFix"
|
||||
style={{ width: "100%", display: "block", maxHeight: "122px" }}
|
||||
onClick={() => {
|
||||
const target = item.banner_detail_url;
|
||||
if (target) {
|
||||
(Taro as any).navigateTo({
|
||||
url: `/other_pages/bannerDetail/index?img=${encodeURIComponent(target)}`,
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
// 渲染列表
|
||||
const renderList = () => {
|
||||
// 请求数据为空
|
||||
@@ -181,6 +211,9 @@ const ListContainer = (props) => {
|
||||
return (
|
||||
<>
|
||||
{memoizedList.map((match, index) => {
|
||||
if (match.type === "banner") {
|
||||
return renderBanner(match, index);
|
||||
}
|
||||
if (match.type === "evaluateCard") {
|
||||
return (
|
||||
<NTRPTestEntryCard key="evaluate" type={EvaluateScene.list} />
|
||||
|
||||
Reference in New Issue
Block a user