feat: 查询条件处理

This commit is contained in:
eric
2022-11-22 23:11:11 +08:00
parent 6b3d439bdd
commit 49daf7a423
5 changed files with 43 additions and 23 deletions

2
dist/common.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -25,7 +25,7 @@ const CheckIn = () => {
const [cloudfileID, setcloudfileID] = useState(); const [cloudfileID, setcloudfileID] = useState();
const [address, setaddress] = useState(); //地址 const [address, setaddress] = useState(); //地址
const [openid, setopenid] = useState(); const [openid, setopenid] = useState();
const [fileID, setfileID] = useState("");
const [value, setValue] = useState([ const [value, setValue] = useState([
// { // {
// url: "https://img.yzcdn.cn/vant/leaf.jpg", // url: "https://img.yzcdn.cn/vant/leaf.jpg",
@@ -65,17 +65,13 @@ const CheckIn = () => {
definePageConfig({ definePageConfig({
navigationBarTitleText: "打卡签到", navigationBarTitleText: "打卡签到",
}); });
}, []); }, []);
let $instance: any = getCurrentInstance();
console.log('$instance?.router?.params;',$instance?.router?.params)
const { fileID } = $instance?.router?.params;
console.log("fileID---", fileID);
useEffect(() => { useEffect(() => {
if ($instance?.router?.params?.fileID) { let $instance: any = getCurrentInstance();
let fileID: any = $instance?.router?.params?.fileID;
if (fileID) {
setfileID(fileID)
uploadTaro([fileID]); uploadTaro([fileID]);
} }

View File

@@ -39,7 +39,7 @@ const Home = () => {
// 系统配置 // 系统配置
const [systemConfig, setsystemConfig] = useState<any>({}); const [systemConfig, setsystemConfig] = useState<any>({});
// const [openid,setopenid]=useState() // const [openid,setopenid]=useState()
const onChange = (e) => {}; const onChange = (e) => {};
@@ -60,7 +60,6 @@ const Home = () => {
getsystemConfig(); //获取系统配置 getsystemConfig(); //获取系统配置
getdetails(); //获取活动详情 getdetails(); //获取活动详情
}, []); }, []);
const getdetails = async () => { const getdetails = async () => {
@@ -266,13 +265,18 @@ const Home = () => {
icon="star" icon="star"
text="打卡" text="打卡"
className="iconStyle" className="iconStyle"
onClick={() => { onClick={async() => {
// getLocation(); // getLocation();
let isin:any=phoneLogin() let isin: any =await phoneLogin();
if(isin){ console.log('isin',isin)
if (isin) {
chooseImage(); chooseImage();
} else {
Toast.fail({
message: "请先登录",
selector: "#vanToast-demo2",
});
} }
}} }}
/> />
<GridItem <GridItem

View File

@@ -46,11 +46,20 @@ export const getTable: any = ({ env, tableName, keyValue={}, okFun }: Typeint) =
}); });
let nowtable: any = db?.collection(tableName); let nowtable: any = db?.collection(tableName);
nowtable?.where(keyValue).get({ if(Object.keys(keyValue)?.length>0){
success: (res: any) => { nowtable?.where(keyValue).get({
okFun(res); success: (res: any) => {
}, okFun(res);
}); },
});
}else{
nowtable?.get({
success: (res: any) => {
okFun(res);
},
});
}
}; };
// 获取指定id数据数据 // 获取指定id数据数据
@@ -67,7 +76,9 @@ export const getTableid: any = ({
}); });
let nowtable: any = db?.collection(tableName); let nowtable: any = db?.collection(tableName);
nowtable
if(Object.keys(keyValue)?.length>0){
nowtable
?.doc(id) ?.doc(id)
.where(keyValue) .where(keyValue)
.get({ .get({
@@ -75,6 +86,15 @@ export const getTableid: any = ({
okFun(res); okFun(res);
}, },
}); });
}else{
nowtable
?.doc(id)?.get({
success: (res: any) => {
okFun(res);
},
});
}
}; };
// 更新数据 // 更新数据