feat: 活动详情

This commit is contained in:
eric
2022-11-21 16:31:46 +08:00
parent 8f6f130556
commit 692799c503
46 changed files with 153 additions and 1680 deletions

View File

@@ -10,7 +10,7 @@ const details = () => {
const [dataSource, setdataSource] = useState<any>([]);
const [bottomheight, setbottomheight] = useState(0);
let $instance: any = getCurrentInstance();
const { id } = $instance?.router?.params??{}; //活动id
const { id } = $instance?.router?.params ?? {}; //活动id
useEffect(() => {
// 设置标题
@@ -33,7 +33,7 @@ const details = () => {
setdataSource(res?.data ?? []);
},
};
getTableid(objParams) //指定活动详情id
getTableid(objParams); //指定活动详情id
// getTable(objParams);
}, []);
@@ -42,32 +42,41 @@ const details = () => {
return (
<View className={`detailContent`}>
<View>
<View>{`活动标题活动标题活动标题活动标题活动标题活动标题活动标题`}</View>
<View>{dataSource?.title}</View>
<Image
width="100%"
height="180px"
fit="cover"
src="https://img.yzcdn.cn/vant/cat.jpeg"
// src="https://img.yzcdn.cn/vant/cat.jpeg"
src={dataSource?.images?.[0]?.url}
/>
<View>
<Cell
isLink
icon="clock"
title="2022年11月22日"
linkType="navigateTo"
url="/pages/dashboard/index"
title={`开始时间 ${dataSource?.startTime}`}
// isLink
// linkType="navigateTo"
// url="/pages/dashboard/index"
/>
<Cell
isLink
icon="location"
title="广东省深圳市龙华区你好"
title={`${dataSource?.address}`}
linkType="navigateTo"
url="/pages/dashboard/index"
/>
<Cell
icon="friends"
title={`已报名人数 ${dataSource?.useridArr?.length??0}`}
// isLink
// linkType="navigateTo"
// url="/pages/dashboard/index"
/>
</View>
{/* 头像列表 */}
<View className="imagesArr">
{/* <View className="imagesArr">
{[1, 2, 3, 4].map((item: any) => {
return (
<Image
@@ -79,13 +88,13 @@ const details = () => {
/>
);
})}
</View>
</View> */}
</View>
{/* 富文本 */}
<View onClick={() => {}} className="RichText">
{/* <View>{dataSource?.[0]?.actTitle}</View> */}
<RichText nodes={dataSource?.[0]?.richText} />
<RichText nodes={dataSource?.richText} />
</View>
<View

View File

@@ -1,18 +1,33 @@
import { View } from "@tarojs/components";
import react, { useEffect } from "react";
import { Card, DropdownMenu } from "@antmjs/vantui";
import react, { useEffect, useState } from "react";
import { DropdownMenu } from "@antmjs/vantui";
import { DropdownItem } from "@antmjs/vantui";
import TabbarCom from "../components/TabbarCom";
import Taro from "@tarojs/taro";
import ActiveCard from "../components/ActiveCard";
import './index.scss'
import { getTable } from "../../utils/index";
const activityList = () => {
const [details,setdetails]=useState<any>([]) //活动详情
useEffect(() => {
// 设置标题
definePageConfig({
navigationBarTitleText: "活动列表",
});
let objParams = {
tableName: "details",
// id: "80516fb66370bcf300b8f43c5f4dd52b",
okFun: (res) => {
console.log("details--", res);
setdetails(res?.data??[])
},
};
getTable(objParams);
}, []);
const [state, setState] = react.useState({
@@ -52,31 +67,25 @@ const activityList = () => {
<DropdownItem value={state.value2} options={state.option2} />
</DropdownMenu>
</View>
{[1, 2].map((item: any) => {
{details.map((item: any,index:any) => {
return (
<View
onClick={() => {
console.log("Card");
Taro.navigateTo({
url: "/pages/activityList/components/details/index",
url: `/pages/activityList/components/details/index?id=${item?._id}`,
});
}}
>
{/* 活动卡片 */}
<ActiveCard />
{/* <Card
num=""
price=""
desc="报名中"
title="周末爬山"
thumb="cloud://cloud1-5g5xrgza12a0dd6d.636c-cloud1-5g5xrgza12a0dd6d-1253665791/images.jpg"
/> */}
{/* 活动卡片 */}
<ActiveCard dataSource={item} />
</View>
);
})}
<TabbarCom active={1} />
</View>
);

View File

@@ -67,7 +67,6 @@ const Home = () => {
setdetails(res?.data??[])
},
};
getTable(objParams);
}, []);

View File

@@ -8,7 +8,7 @@ import {
TabbarItem,
} from "@antmjs/vantui";
import { OpenData, View } from "@tarojs/components";
import react, { useEffect } from "react";
import react, { useEffect, useState } from "react";
import TabbarCom from "../components/TabbarCom";
import { Image } from "@antmjs/vantui";
// import styles from './index.module.scss'
@@ -16,10 +16,15 @@ import "./index.module.scss";
import { Tab, Tabs } from "@antmjs/vantui";
import Taro from "@tarojs/taro";
import ActiveCard from "../components/ActiveCard";
import { getTable } from "../../utils/index";
const my = (props: any) => {
// const [active, setActive] = react.useState(props?.active ?? 0);
const [userInfo, setuserInfo] = useState({}); //用户信息
const [detailsData, setdetailsData] = useState<any>([]); //活动详情
const [currentIndex, setcurrentIndex] = useState(0);
// 云函数,-获取手机号
const getLogin = (e: any) => {
Taro.cloud
@@ -38,18 +43,45 @@ const my = (props: any) => {
});
};
const getDetails = () => {
let objParams = {
tableName: "details",
// id: "80516fb66370bcf300b8f43c5f4dd52b",
okFun: (res) => {
console.log("details--", res);
setdetailsData(res?.data ?? []);
},
};
getTable(objParams);
};
useEffect(() => {
// 设置标题
definePageConfig({
navigationBarTitleText: "我的",
});
getDetails();
}, []);
const CardCom = () => {
// console.log("details===", details);
return (
<View>
{[1, 2, 3, 4].splice(0, 2).map((item: any) => {
return <ActiveCard />;
{detailsData.splice(0, 2).map((item: any, index: any) => {
return (
<View
onClick={() => {
console.log("Card");
Taro.navigateTo({
url: `/pages/activityList/components/details/index?id=${item?._id}`,
});
}}
>
{/* 活动卡片 */}
<ActiveCard dataSource={item} />
</View>
);
})}
</View>
);
@@ -99,22 +131,26 @@ const my = (props: any) => {
</View>
</View>
{/* <Button
open-type="getUserInfo"
lang="zh_CN"
onGetUserInfo={onGetUserInfo}
{/* <View>
<Tabs
sticky={true}
active={currentIndex}
onClick={(e: any) => {
console.log("e", e);
setcurrentIndex(e?.detail?.index ?? 0);
}}
>
获取用户信息
</Button> */}
<View>
<Tabs sticky={true}>
<Tab title="待审核">{CardCom()}</Tab>
<Tab title="已报名">{CardCom()}</Tab>
<Tab title="待参加">{CardCom()}</Tab>
<Tab title="已结束">{CardCom()}</Tab>
<Tab title="待审核">
<View>{CardCom()}</View>
</Tab>
<Tab title="已报名">
<View>222</View>
</Tab>
<Tab title="待参加">333</Tab>
<Tab title="已结束">44</Tab>
</Tabs>
</View>
</View> */}
<View className="cellArr">
<Cell icon="manager" title="打卡记录" isLink />
@@ -149,8 +185,7 @@ const my = (props: any) => {
/>
</View>
{/* <Button className='btn-max-w' plain type='primary' >按钮</Button> */}
{/* tabbar */}
<TabbarCom active={2} />
</View>
);