feat: 打卡记录
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
.CheckinDetail{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 20px;
|
||||
.checkCom{
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,65 @@
|
||||
import { View } from "@tarojs/components";
|
||||
import react, { useEffect, useState } from "react";
|
||||
import { Image } from "@antmjs/vantui";
|
||||
|
||||
import "./index.scss";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { getTable } from "../../../../utils/index";
|
||||
|
||||
const CheckinDetail = () => {
|
||||
return <View>CheckinDetail</View>;
|
||||
const [checkArr, setcheckArr] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
// 设置标题
|
||||
definePageConfig({
|
||||
navigationBarTitleText: "打卡记录",
|
||||
});
|
||||
getcheckArr();
|
||||
}, []);
|
||||
|
||||
const getcheckArr = () => {
|
||||
Taro.cloud.callFunction({
|
||||
name: "getOpenid",
|
||||
complete: async (res: any) => {
|
||||
let openid: any = res?.result?.event?.userInfo?.openId;
|
||||
let postData = {
|
||||
tableName: "userInfo",
|
||||
keyValue: {
|
||||
openId: openid,
|
||||
},
|
||||
okFun: (res: any) => {
|
||||
console.log('res',res)
|
||||
let _id = res?.data?._id;
|
||||
setcheckArr(res?.data?.[0]?.checkInArr ?? []);
|
||||
},
|
||||
};
|
||||
getTable({...postData})
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const checkCom = () => {
|
||||
return checkArr.map((item: any) => {
|
||||
return (
|
||||
<View className="checkCom">
|
||||
<View>{item?.remark}</View>
|
||||
<View>
|
||||
<Image
|
||||
width="100%"
|
||||
height="150px"
|
||||
fit="cover"
|
||||
src={item.imageUrl}
|
||||
/>
|
||||
</View>
|
||||
{/* 打卡日期 */}
|
||||
<View>{item?.checkTime}</View>
|
||||
{location&& <View>{item?.location}</View>}
|
||||
</View>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
return <View className="CheckinDetail">{checkCom()}</View>;
|
||||
};
|
||||
|
||||
export default CheckinDetail;
|
||||
|
||||
@@ -38,7 +38,7 @@ export const addTable: any = ({ env, tableName, objData, okFun }: Typeint) => {
|
||||
});
|
||||
};
|
||||
|
||||
// 获取指定集合数据表
|
||||
// 获取指定集合数据表 (keyValue指定条件)
|
||||
export const getTable: any = ({ env, tableName, keyValue={}, okFun }: Typeint) => {
|
||||
// 数据库环境
|
||||
const db: any = Taro.cloud.database({
|
||||
|
||||
Reference in New Issue
Block a user