feat: 打卡页面按钮

This commit is contained in:
huxiaoshuang
2022-11-25 14:55:28 +08:00
parent fdf1963adc
commit 954f781cf9
8 changed files with 76 additions and 21 deletions

View File

@@ -157,9 +157,10 @@ const Home = () => {
id: res?.data?.[0]?._id,
objData: {
checkInArr: [
// ...(res?.data?.[0]?.checkInArr ?? []),
...(res?.data?.[0]?.checkInArr ?? []),
{
imageUrl: data?.imageUrl,
checkTime :new Date().valueOf(),//打卡时间
// remark: fieldValues?.remark,
// location: address,
},

View File

@@ -1,10 +1,16 @@
.CheckinDetail{
display: flex;
flex-direction: column;
padding: 20px;
// padding: 20px;
padding: 60px;
.checkCom{
margin-top: 20px;
margin-top: 40px;
display: flex;
flex-direction: column;
}
}
--uploader-size{
// size: 260px;
}

View File

@@ -1,17 +1,28 @@
import { View } from "@tarojs/components";
import { Button, View } from "@tarojs/components";
import react, { useEffect, useState } from "react";
import { Image } from "@antmjs/vantui";
import { Image, Uploader } from "@antmjs/vantui";
import "./index.scss";
import Taro from "@tarojs/taro";
import { getTable } from "../../../../utils/index";
import moment from "moment";
const CheckinDetail = () => {
const [checkArr, setcheckArr] = useState([]);
const [value, setValue] = react.useState([
{
url: "https://img.yzcdn.cn/vant/leaf.jpg",
name: "图片1",
},
{
url: "https://img.yzcdn.cn/vant/tree.jpg",
},
]);
useEffect(() => {
// 设置标题
definePageConfig({
// 设置标题
definePageConfig({
navigationBarTitleText: "打卡记录",
});
getcheckArr();
@@ -28,12 +39,12 @@ const CheckinDetail = () => {
openId: openid,
},
okFun: (res: any) => {
console.log('res',res)
console.log("res", res);
let _id = res?.data?._id;
setcheckArr(res?.data?.[0]?.checkInArr ?? []);
},
};
getTable({...postData})
getTable({ ...postData });
},
});
};
@@ -42,18 +53,45 @@ const CheckinDetail = () => {
return checkArr.map((item: any) => {
return (
<View className="checkCom">
<View>{item?.remark}</View>
{/* 备注 */}
{item?.remark && <View>{item?.remark}</View>}
{/* 图片展示 */}
<View>
<Image
width="100%"
height="150px"
fit="cover"
src={item.imageUrl}
<Uploader
fileList={[
{
url: item?.imageUrl,
name: "",
},
]}
// onAfterRead={() => {}}
// onDelete={() => {}}
deletable={false}
disabled={true}
showUpload={false}
previewSize={300} //预览大小
/>
{/* <Image
width="80%"
height="80px"
fit="cover"
src={item?.imageUrl}
/> */}
</View>
<View>
{/* 打卡日期 */}
{item?.checkTime && (
<View>
{moment(item?.checkTime).format("YYYY-MM-DD HH:mm:ss")}
</View>
)}
{/* lbs定位 */}
{item?.location && <View>{item?.location}</View>}
{/* 删除按钮 */}
<View><Button></Button></View>
</View>
{/* 打卡日期 */}
<View>{item?.checkTime}</View>
{location&& <View>{item?.location}</View>}
</View>
);
});