feat: 打卡记录
This commit is contained in:
2
dist/app.js
vendored
2
dist/app.js
vendored
File diff suppressed because one or more lines are too long
@@ -37,6 +37,13 @@
|
|||||||
"query": "fileID=http%3A%2F%2Ftmp%2F8X3J8R5FfJma6891872b4a0e24b61c323769b8a8addb.png",
|
"query": "fileID=http%3A%2F%2Ftmp%2F8X3J8R5FfJma6891872b4a0e24b61c323769b8a8addb.png",
|
||||||
"launchMode": "default",
|
"launchMode": "default",
|
||||||
"scene": null
|
"scene": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "打卡记录",
|
||||||
|
"pathName": "pages/my/components/CheckinDetail/index",
|
||||||
|
"query": "",
|
||||||
|
"launchMode": "default",
|
||||||
|
"scene": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 { View } from "@tarojs/components";
|
||||||
import react, { useEffect, useState } from "react";
|
import react, { useEffect, useState } from "react";
|
||||||
|
import { Image } from "@antmjs/vantui";
|
||||||
|
|
||||||
import "./index.scss";
|
import "./index.scss";
|
||||||
|
import Taro from "@tarojs/taro";
|
||||||
|
import { getTable } from "../../../../utils/index";
|
||||||
|
|
||||||
const CheckinDetail = () => {
|
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;
|
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) => {
|
export const getTable: any = ({ env, tableName, keyValue={}, okFun }: Typeint) => {
|
||||||
// 数据库环境
|
// 数据库环境
|
||||||
const db: any = Taro.cloud.database({
|
const db: any = Taro.cloud.database({
|
||||||
|
|||||||
Reference in New Issue
Block a user