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

View File

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

View File

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