feat: 再次报名
This commit is contained in:
8
dist/base.wxml
vendored
8
dist/base.wxml
vendored
@@ -129,14 +129,6 @@
|
|||||||
</video>
|
</video>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template name="tmpl_0_59">
|
|
||||||
<web-view src="{{i.p0}}" bindmessage="eh" bindload="eh" binderror="eh" style="{{i.st}}" class="{{i.cl}}" bindtap="eh" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
|
|
||||||
<block wx:for="{{i.cn}}" wx:key="sid">
|
|
||||||
<template is="{{xs.e(cid+1)}}" data="{{i:item,l:l}}" />
|
|
||||||
</block>
|
|
||||||
</web-view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template name="tmpl_0_36">
|
<template name="tmpl_0_36">
|
||||||
<official-account bindload="eh" binderror="eh" style="{{i.st}}" class="{{i.cl}}" bindtap="eh" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}"></official-account>
|
<official-account bindload="eh" binderror="eh" style="{{i.st}}" class="{{i.cl}}" bindtap="eh" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}"></official-account>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
dist/pages/home/index.js
vendored
2
dist/pages/home/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -17,6 +17,11 @@ import moment from "moment";
|
|||||||
|
|
||||||
const details = () => {
|
const details = () => {
|
||||||
const [dataSource, setdataSource] = useState<any>([]);
|
const [dataSource, setdataSource] = useState<any>([]);
|
||||||
|
const [status, setstatus] = useState<any>("0");
|
||||||
|
const [detailStatus, setdetailStatus] = useState<any>();
|
||||||
|
const [disable, setdisable] = useState<any>(false); //按钮禁用状态
|
||||||
|
const [statusName, setstatusName] = useState("");
|
||||||
|
|
||||||
const [bottomheight, setbottomheight] = useState(0);
|
const [bottomheight, setbottomheight] = useState(0);
|
||||||
let $instance: any = getCurrentInstance();
|
let $instance: any = getCurrentInstance();
|
||||||
const { id } = $instance?.router?.params ?? {}; //活动id
|
const { id } = $instance?.router?.params ?? {}; //活动id
|
||||||
@@ -26,6 +31,14 @@ const details = () => {
|
|||||||
const [show, setShow] = react.useState(false);
|
const [show, setShow] = react.useState(false);
|
||||||
const [value, setValue] = react.useState("");
|
const [value, setValue] = react.useState("");
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (status === "1" || detailStatus !== "1") {
|
||||||
|
setdisable(true);
|
||||||
|
} else {
|
||||||
|
setdisable(false);
|
||||||
|
}
|
||||||
|
}, [status, detailStatus]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 设置标题
|
// 设置标题
|
||||||
definePageConfig({
|
definePageConfig({
|
||||||
@@ -62,26 +75,23 @@ const details = () => {
|
|||||||
console.log("callFunction test result: ", res);
|
console.log("callFunction test result: ", res);
|
||||||
let newopenId: any = res?.result?.event?.userInfo?.openId;
|
let newopenId: any = res?.result?.event?.userInfo?.openId;
|
||||||
setopenId(newopenId);
|
setopenId(newopenId);
|
||||||
console.log("dataSource ", dataSource);
|
|
||||||
// 检查是否已报名
|
|
||||||
if ((dataSource?.useridArr ?? []).includes(newopenId)) {
|
|
||||||
setisCheckin(true);
|
|
||||||
} else {
|
|
||||||
setisCheckin(false);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [dataSource]);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const { screenHeight, safeArea = {} } = Taro.getSystemInfoSync();
|
const { screenHeight, safeArea = {} } = Taro.getSystemInfoSync();
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let newBottom = screenHeight - safeArea?.bottom ?? 0;
|
let newBottom = screenHeight - safeArea?.bottom ?? 0;
|
||||||
setbottomheight(newBottom);
|
setbottomheight(newBottom);
|
||||||
|
|
||||||
getDetail();
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (openId) {
|
||||||
|
getDetail();
|
||||||
|
}
|
||||||
|
}, [openId]);
|
||||||
|
|
||||||
// 获取详情
|
// 获取详情
|
||||||
const getDetail = () => {
|
const getDetail = () => {
|
||||||
let objParams = {
|
let objParams = {
|
||||||
@@ -89,7 +99,27 @@ const details = () => {
|
|||||||
id: id,
|
id: id,
|
||||||
okFun: (res) => {
|
okFun: (res) => {
|
||||||
console.log("res", res);
|
console.log("res", res);
|
||||||
setdataSource(res?.data ?? []);
|
setdataSource(res?.data ?? {});
|
||||||
|
console.log("dataSource ", dataSource);
|
||||||
|
|
||||||
|
setdetailStatus(res?.data?.Status ?? "");
|
||||||
|
let newpeopleArr = res?.data?.peopleArr ?? [];
|
||||||
|
|
||||||
|
if (newpeopleArr?.length > 0) {
|
||||||
|
newpeopleArr.forEach((item: any) => {
|
||||||
|
if (item?.openid === openId) {
|
||||||
|
setstatus(item?.status ?? "0");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setstatus("0");
|
||||||
|
}
|
||||||
|
// 检查是否已报名
|
||||||
|
if ((res?.data?.useridArr ?? []).includes(openId)) {
|
||||||
|
setisCheckin(true);
|
||||||
|
} else {
|
||||||
|
setisCheckin(false);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
getTableid(objParams); //指定活动详情id
|
getTableid(objParams); //指定活动详情id
|
||||||
@@ -103,10 +133,10 @@ const details = () => {
|
|||||||
label: "活动待开放",
|
label: "活动待开放",
|
||||||
value: "0",
|
value: "0",
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: "立即报名", //开放中
|
// label: "立即报名", //开放中
|
||||||
value: "1",
|
// value: "1",
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
label: "活动已取消",
|
label: "活动已取消",
|
||||||
value: "2",
|
value: "2",
|
||||||
@@ -125,17 +155,34 @@ const details = () => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// 按钮文本
|
||||||
const btnContent = () => {
|
const btnContent = () => {
|
||||||
if (isCheckin) {
|
console.log("detailStatus,status,openid", detailStatus, status, openId);
|
||||||
return "取消报名";
|
let newstatusName = "立即报名";
|
||||||
|
// 开放中
|
||||||
|
if (detailStatus === "1") {
|
||||||
|
if (status === "0" ) {
|
||||||
|
newstatusName = "立即报名";
|
||||||
|
}
|
||||||
|
if (status === "4") {
|
||||||
|
newstatusName = "再次报名";
|
||||||
|
}
|
||||||
|
if (status === "2") {
|
||||||
|
newstatusName = "取消报名";
|
||||||
|
}
|
||||||
|
if (status === "1") {
|
||||||
|
newstatusName = "待审核";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return btnStatus.map((item: any) => {
|
btnStatus.forEach((item: any) => {
|
||||||
let status: any = dataSource?.Status;
|
let status: any = dataSource?.Status;
|
||||||
if (item?.value === status) {
|
if (item?.value === status) {
|
||||||
return item?.label;
|
newstatusName = item?.label;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// setstatusName(newstatusName);
|
||||||
|
return newstatusName;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -189,7 +236,11 @@ const details = () => {
|
|||||||
|
|
||||||
<Cell
|
<Cell
|
||||||
icon="friends"
|
icon="friends"
|
||||||
title={`已报名人数 ${dataSource?.useridArr?.length ?? 0}`}
|
// title={`已报名人数 ${dataSource?.useridArr?.length ?? 0}`}
|
||||||
|
title={`已报名人数 ${(dataSource?.peopleArr??[]).filter((item:any)=>{
|
||||||
|
return item?.status ==='2'
|
||||||
|
})?.length>>0}`}
|
||||||
|
|
||||||
// isLink
|
// isLink
|
||||||
// linkType="navigateTo"
|
// linkType="navigateTo"
|
||||||
// url="/pages/dashboard/index"
|
// url="/pages/dashboard/index"
|
||||||
@@ -228,54 +279,88 @@ const details = () => {
|
|||||||
show={show}
|
show={show}
|
||||||
onClose={() => setShow(false)}
|
onClose={() => setShow(false)}
|
||||||
>
|
>
|
||||||
<View
|
<View className="wechatCode">
|
||||||
className="wechatCode"
|
|
||||||
>
|
|
||||||
<Image
|
<Image
|
||||||
showMenuByLongpress={true}
|
showMenuByLongpress={true}
|
||||||
width={300}
|
width={300}
|
||||||
height={300}
|
height={300}
|
||||||
src={dataSource?.qrCode}
|
src={dataSource?.qrCode}
|
||||||
// src='cloud://citynew-0givkbre03955d8c.6369-citynew-0givkbre03955d8c-1253655588/images/touxiang/download-1.jpg'
|
// src='cloud://citynew-0givkbre03955d8c.6369-citynew-0givkbre03955d8c-1253655588/images/touxiang/download-1.jpg'
|
||||||
></Image>
|
></Image>
|
||||||
|
|
||||||
<Button style={{width:'130px',marginTop:'20px'}} type="primary" round size="small" onClick={()=>{
|
<Button
|
||||||
setShow(false)
|
style={{ width: "130px", marginTop: "20px" }}
|
||||||
}}>关闭</Button>
|
type="primary"
|
||||||
|
round
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
setShow(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
关闭
|
||||||
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
<Cell title="组件调用" onClick={() => setShow(true)} />
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
{/* 调试按钮 */}
|
||||||
|
{/* <Cell title="组件调用" onClick={() => setShow(true)} /> */}
|
||||||
|
|
||||||
<View
|
<View
|
||||||
className={`detailBtn`}
|
className={`detailBtn`}
|
||||||
style={{ bottom: `${bottomheight ?? 0}px` }}
|
style={{ bottom: `${bottomheight ?? 0}px` }}
|
||||||
>
|
>
|
||||||
{/* style={{width:'375px'}} */}
|
{/* style={{width:'375px'}} */}
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type={disable ? "warning" : "primary"}
|
||||||
block
|
block
|
||||||
disabled={!["1"].includes(dataSource?.Status)}
|
// disabled={disable}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (isCheckin) {
|
if (disable) {
|
||||||
|
setShow(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// if (isCheckin) {
|
||||||
|
if (status === "2") {
|
||||||
// 取消报名
|
// 取消报名
|
||||||
|
let peopleArrItem = (dataSource?.peopleArr ?? []).map(
|
||||||
|
(item, index, arr) => {
|
||||||
|
if (item?.openid === openId) {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
status: "4", //报名后取消
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
updateTableid({
|
updateTableid({
|
||||||
tableName: "details",
|
tableName: "details",
|
||||||
id: id,
|
id: id,
|
||||||
objData: {
|
objData: {
|
||||||
// ..._.cloneDeep(dataSource),
|
// 删除用户报名记录
|
||||||
useridArr: [
|
// useridArr: [
|
||||||
...(dataSource?.useridArr ?? []).filter(
|
// ...(dataSource?.useridArr ?? []).filter(
|
||||||
(value, index, arr) => {
|
// (value, index, arr) => {
|
||||||
return value !== openId;
|
// return value !== openId;
|
||||||
}
|
// }
|
||||||
),
|
// ),
|
||||||
|
// ],
|
||||||
|
// peopleArr: [
|
||||||
|
// ...(dataSource?.peopleArr ?? []).filter(
|
||||||
|
// (item, index, arr) => {
|
||||||
|
// return item?.openid !== openId;
|
||||||
|
// }
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
peopleArr: [
|
||||||
|
...peopleArrItem
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
okFun: (res: any) => {
|
okFun: (res: any) => {
|
||||||
// console.log("res333", res);
|
|
||||||
// 报名成功
|
|
||||||
Toast.success({
|
Toast.success({
|
||||||
message: "取消成功",
|
message: "取消成功",
|
||||||
selector: "#vanToast-demo2",
|
selector: "#vanToast-demo2",
|
||||||
@@ -293,6 +378,22 @@ const details = () => {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 放鸽子
|
||||||
|
if (status === "4") {
|
||||||
|
Toast.fail({
|
||||||
|
message: "再次报名需审核!",
|
||||||
|
selector: "#vanToast-demo2",
|
||||||
|
duration: 2000,
|
||||||
|
onClose: () => {
|
||||||
|
// 跳转到目的页面,打开新页面
|
||||||
|
setShow(true)
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
let isin: any = phoneLogin();
|
let isin: any = phoneLogin();
|
||||||
if (!isin) {
|
if (!isin) {
|
||||||
//重新登录- 跳转到我的页面
|
//重新登录- 跳转到我的页面
|
||||||
@@ -320,14 +421,22 @@ const details = () => {
|
|||||||
..._.cloneDeep(dataSource?.useridArr ?? []),
|
..._.cloneDeep(dataSource?.useridArr ?? []),
|
||||||
openId,
|
openId,
|
||||||
],
|
],
|
||||||
|
peopleArr: [
|
||||||
|
..._.cloneDeep(dataSource?.peopleArr ?? []),
|
||||||
|
{
|
||||||
|
openid: openId,
|
||||||
|
status: "1", //待审核
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
okFun: (res: any) => {
|
okFun: (res: any) => {
|
||||||
console.log("res333", res);
|
console.log("res333", res);
|
||||||
// 报名成功
|
// 报名成功
|
||||||
Toast.success({
|
Toast.success({
|
||||||
message: "报名成功",
|
message: "报名成功,审核中",
|
||||||
selector: "#vanToast-demo2",
|
selector: "#vanToast-demo2",
|
||||||
onClose: () => {
|
onClose: () => {
|
||||||
|
setShow(true);
|
||||||
// 刷新数据
|
// 刷新数据
|
||||||
getDetail();
|
getDetail();
|
||||||
|
|
||||||
@@ -348,6 +457,7 @@ const details = () => {
|
|||||||
>
|
>
|
||||||
{/* 立即参加 */}
|
{/* 立即参加 */}
|
||||||
{btnContent()}
|
{btnContent()}
|
||||||
|
{/* {`立即报名`} */}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Toast id="vanToast-demo2" />
|
<Toast id="vanToast-demo2" />
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
padding-left:5px;
|
padding-left:5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.middle {
|
.middle {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
.homeContent{
|
.homeContent {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
padding-bottom: 150px;
|
padding-bottom: 150px;
|
||||||
.tagStyle{
|
.tagStyle {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tagArr{
|
.tagArr {
|
||||||
// display: flex;
|
// display: flex;
|
||||||
// flex-direction: row;
|
// flex-direction: row;
|
||||||
// align-items: center;
|
// align-items: center;
|
||||||
// justify-content: center;
|
// justify-content: center;
|
||||||
padding: 50px;
|
padding: 50px;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconStyle{
|
.iconStyle {
|
||||||
color: #95de64;
|
color: #95de64;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topHome{
|
.topHome {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ const Home = () => {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* 轮播图 */}
|
{/* 轮播图 */}
|
||||||
<View className="demo-box">
|
<View className="Swiper-box">
|
||||||
<Swiper
|
<Swiper
|
||||||
height={180}
|
height={180}
|
||||||
paginationColor="#426543"
|
paginationColor="#426543"
|
||||||
|
|||||||
Reference in New Issue
Block a user