feat: fix
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
&-scroll {
|
||||
flex: 0 0 auto;
|
||||
width: calc(100% - 116px);
|
||||
height: 100%;
|
||||
|
||||
&-content {
|
||||
display: flex;
|
||||
|
||||
@@ -131,7 +131,7 @@ export default function Participants(props) {
|
||||
};
|
||||
|
||||
const matchNtrpReq = matchNtrpRequestment(
|
||||
ntrp_level,
|
||||
userInfo?.ntrp_level,
|
||||
skill_level_min,
|
||||
skill_level_max
|
||||
);
|
||||
@@ -224,35 +224,17 @@ export default function Participants(props) {
|
||||
}
|
||||
if (waiting_start) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>已加入</Text>
|
||||
</>
|
||||
),
|
||||
text: "已加入",
|
||||
action: () => toast("您已参与了本次活动"),
|
||||
};
|
||||
} else if (is_substituting) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>已加入候补</Text>
|
||||
</>
|
||||
),
|
||||
text: "已加入候补",
|
||||
action: () => toast("您已加入候补,候补失败会全额退款~"),
|
||||
};
|
||||
} else if (can_pay) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>继续支付</Text>
|
||||
</>
|
||||
),
|
||||
text: "继续支付",
|
||||
action: checkPhoneAndExecute(async () => {
|
||||
const res = await OrderService.getUnpaidOrder(id);
|
||||
if (res.code === 0) {
|
||||
@@ -264,50 +246,24 @@ export default function Participants(props) {
|
||||
};
|
||||
} else if (!matchNtrpReq) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>立即加入</Text>
|
||||
</>
|
||||
),
|
||||
text: "立即加入1",
|
||||
available: false,
|
||||
action: () =>
|
||||
toast("您当前不符合此球局NTRP水平要求,去看看其他活动吧~"),
|
||||
};
|
||||
} else if (can_substitute) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>我要候补</Text>
|
||||
</>
|
||||
),
|
||||
text: "我要候补",
|
||||
action: checkPhoneAndExecute(handleJoinGame),
|
||||
};
|
||||
} else if (can_join) {
|
||||
return {
|
||||
text: () => {
|
||||
return (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>立即加入</Text>
|
||||
</>
|
||||
);
|
||||
},
|
||||
text: "立即加入2",
|
||||
action: checkPhoneAndExecute(handleJoinGame),
|
||||
};
|
||||
} else if (can_assess) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>立即加入</Text>
|
||||
</>
|
||||
),
|
||||
text: "立即加入3",
|
||||
action: checkPhoneAndExecute(handleSelfEvaluate),
|
||||
};
|
||||
}
|
||||
@@ -349,7 +305,11 @@ export default function Participants(props) {
|
||||
</View>
|
||||
)}
|
||||
{/* participants list */}
|
||||
<ScrollView refresherBackground="#FAFAFA" className={styles["participants-list-scroll"]} scrollX>
|
||||
<ScrollView
|
||||
refresherBackground="#FAFAFA"
|
||||
className={styles["participants-list-scroll"]}
|
||||
scrollX
|
||||
>
|
||||
<View
|
||||
className={styles["participants-list-scroll-content"]}
|
||||
style={{
|
||||
|
||||
@@ -13,6 +13,9 @@ import WechatLogo from "@/static/detail/wechat_icon.svg";
|
||||
import LinkIcon from "@/static/detail/link.svg";
|
||||
import CrossIcon from "@/static/detail/cross.svg";
|
||||
import { genNTRPRequirementText, navto } from "@/utils/helper";
|
||||
import { waitForAuthInit } from "@/utils/authInit";
|
||||
import { useUserActions } from "@/store/userStore";
|
||||
import { generatePosterImage, base64ToTempFilePath, delay } from "@/utils";
|
||||
import { DayOfWeekMap } from "../../config";
|
||||
import styles from "./index.module.scss";
|
||||
|
||||
@@ -22,6 +25,7 @@ dayjs.locale("zh-cn");
|
||||
export default forwardRef(({ id, from, detail, userInfo }, ref) => {
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [publishFlag, setPublishFlag] = useState(false);
|
||||
const { fetchUserInfo } = useUserActions();
|
||||
// const posterRef = useRef();
|
||||
const { max_participants, participant_count } = detail || {};
|
||||
|
||||
@@ -92,8 +96,59 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => {
|
||||
};
|
||||
});
|
||||
|
||||
async function handleGenPoster() {
|
||||
const {
|
||||
id,
|
||||
play_type,
|
||||
skill_level_max,
|
||||
skill_level_min,
|
||||
start_time,
|
||||
end_time,
|
||||
location_name,
|
||||
image_list,
|
||||
title,
|
||||
} = detail || {};
|
||||
// 先等待静默登录完成
|
||||
await waitForAuthInit();
|
||||
const userInfo = await fetchUserInfo();
|
||||
const { avatar_url, nickname } = userInfo;
|
||||
const startTime = dayjs(start_time);
|
||||
const endTime = dayjs(end_time);
|
||||
const dayofWeek = DayOfWeekMap.get(startTime.day());
|
||||
const gameLength = `${endTime.diff(startTime, "hour")}小时`;
|
||||
Taro.showLoading({ title: "生成中..." });
|
||||
const qrCodeUrlRes = await DetailService.getQrCodeUrl({
|
||||
page: "game_pages/detail/index",
|
||||
scene: `id=${id}`,
|
||||
});
|
||||
const qrCodeUrl = await base64ToTempFilePath(
|
||||
qrCodeUrlRes.data.qr_code_base64
|
||||
);
|
||||
await delay(100);
|
||||
const url = await generatePosterImage({
|
||||
playType: play_type,
|
||||
ntrp: `NTRP ${genNTRPRequirementText(skill_level_min, skill_level_max)}`,
|
||||
mainCoursal:
|
||||
image_list[0] && image_list[0].startsWith("http")
|
||||
? image_list[0]
|
||||
: "https://bimwe.oss-cn-shanghai.aliyuncs.com/front/ball/images/0621b8cf-f7d6-43ad-b852-7dc39f29a782.png",
|
||||
nickname,
|
||||
avatarUrl: avatar_url,
|
||||
title,
|
||||
locationName: location_name,
|
||||
date: `${startTime.format("M月D日")} (${dayofWeek})`,
|
||||
time: `${startTime.format("ah")}点 ${gameLength}`,
|
||||
qrCodeUrl,
|
||||
});
|
||||
Taro.hideLoading();
|
||||
Taro.showShareImageMenu({
|
||||
path: url,
|
||||
});
|
||||
}
|
||||
|
||||
async function handlePost() {
|
||||
navto(`/game_pages/sharePoster/index?id=${detail.id}`);
|
||||
// navto(`/game_pages/sharePoster/index?id=${detail.id}`);
|
||||
handleGenPoster();
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
font-family: "Quicksand";
|
||||
font-style: italic;
|
||||
// font-style: italic;
|
||||
font-size: 20px;
|
||||
border-radius: 16px 0 0 16px;
|
||||
border: 2px solid rgba(0, 0, 0, 0.06);
|
||||
@@ -183,3 +183,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rmbSymbol {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ function isFull(counts) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function RmbIcon() {
|
||||
return <Text className={styles.rmbSymbol}>¥</Text>;
|
||||
}
|
||||
|
||||
function matchNtrpRequestment(
|
||||
target?: string,
|
||||
min?: string,
|
||||
@@ -100,24 +104,29 @@ export default function StickyButton(props) {
|
||||
return () => {
|
||||
if (!userInfo?.phone) {
|
||||
Taro.showModal({
|
||||
title: '提示',
|
||||
content: '该功能需要绑定手机号',
|
||||
confirmText: '去绑定',
|
||||
cancelText: '取消',
|
||||
title: "提示",
|
||||
content: "该功能需要绑定手机号",
|
||||
confirmText: "去绑定",
|
||||
cancelText: "取消",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
const currentPath = Taro.getCurrentInstance().router?.path || '';
|
||||
const currentParams = Taro.getCurrentInstance().router?.params || {};
|
||||
const currentPath = Taro.getCurrentInstance().router?.path || "";
|
||||
const currentParams =
|
||||
Taro.getCurrentInstance().router?.params || {};
|
||||
const queryString = Object.keys(currentParams)
|
||||
.map(key => `${key}=${currentParams[key]}`)
|
||||
.join('&');
|
||||
const fullPath = queryString ? `${currentPath}?${queryString}` : currentPath;
|
||||
.map((key) => `${key}=${currentParams[key]}`)
|
||||
.join("&");
|
||||
const fullPath = queryString
|
||||
? `${currentPath}?${queryString}`
|
||||
: currentPath;
|
||||
|
||||
Taro.navigateTo({
|
||||
url: `/login_pages/index/index?redirect=${encodeURIComponent(fullPath)}`,
|
||||
url: `/login_pages/index/index?redirect=${encodeURIComponent(
|
||||
fullPath
|
||||
)}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -229,7 +238,8 @@ export default function StickyButton(props) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
{/* <Image className={styles.crrrencySymbol} src={RMB_ICON} /> */}
|
||||
<RmbIcon />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>已加入</Text>
|
||||
</>
|
||||
@@ -240,7 +250,7 @@ export default function StickyButton(props) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
<RmbIcon />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>已加入候补</Text>
|
||||
</>
|
||||
@@ -251,7 +261,7 @@ export default function StickyButton(props) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
<RmbIcon />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>继续支付</Text>
|
||||
</>
|
||||
@@ -269,7 +279,7 @@ export default function StickyButton(props) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
<RmbIcon />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>立即加入</Text>
|
||||
</>
|
||||
@@ -282,7 +292,7 @@ export default function StickyButton(props) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
<RmbIcon />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>我要候补</Text>
|
||||
</>
|
||||
@@ -294,7 +304,7 @@ export default function StickyButton(props) {
|
||||
text: () => {
|
||||
return (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
<RmbIcon />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>立即加入</Text>
|
||||
</>
|
||||
@@ -306,7 +316,7 @@ export default function StickyButton(props) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
<RmbIcon />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>立即加入</Text>
|
||||
</>
|
||||
|
||||
@@ -84,6 +84,8 @@
|
||||
// margin: -10px;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease-in-out;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
|
||||
@@ -162,8 +162,8 @@ function Index() {
|
||||
}
|
||||
|
||||
const backgroundImage = detail?.image_list?.[0]
|
||||
? { backgroundImage: `url(${detail?.image_list?.[0]})` }
|
||||
: {};
|
||||
? { opacity: 1, backgroundImage: `url(${detail?.image_list?.[0]})` }
|
||||
: { opacity: 0 };
|
||||
|
||||
const [glass, setGlass] = useState(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user