diff --git a/src/components/HomePage.vue b/src/components/HomePage.vue index 90cfda3..15a01e3 100644 --- a/src/components/HomePage.vue +++ b/src/components/HomePage.vue @@ -31,6 +31,34 @@ const lotteryShow = ref(false) const lotteryType = ref("draw") const lotteryNoticeData = ref(null) +//分享进来 +const fromShare = async () => { + const fromId = getParam("fromid") + if (!fromId) { + return + } + + const userinfos = Storage.get("userinfos") + if (fromId === userinfos.invite_code) { + weui.alert("不能接受自己的邀请哦~") + return + } + + const inviteInfos = await Request("invite/info", { invite_code: fromId, type: "mapai" }, "GET") + if (inviteInfos.res.status == 200) { + const isHelp = inviteInfos.json.helps.find(v => v.id === inviteInfos.json.id) + console.log(isHelp) + if (!isHelp) { + const result = await Request("invite/help", { invite_code: fromId, type: "mapai" }) + if (result.res.status == 200) { + weui.alert("受邀成功!") + } + } else { + weui.alert("您已接受过其他好友邀请,每人只能受邀一次哦~") + } + } +} + // 初始化全局音频实例 const initGlobalAudio = () => { if (!globalStore.globalAudio) { @@ -289,20 +317,20 @@ const initUserGameInfos = async (refresh_official, refresh_cap_scan) => { globalToastEvent.emit(ToastType.MOUNTED) } } -const getNotice = async () => { - const result = await Request('notice/latest', {}, "GET") - if (result?.json?.notification) { - lotteryType.value = 'notice' - lotteryNoticeData.value = result.json.notification - lotteryShow.value = true - } -} +// const getNotice = async () => { +// const result = await Request('notice/latest', {}, "GET") +// if (result?.json?.notification) { +// lotteryType.value = 'notice' +// lotteryNoticeData.value = result.json.notification +// lotteryShow.value = true +// } +// } const handleLoginSuccess = async () => { console.log("已登录") loginShow.value = false - + await fromShare() // await initUserGameInfos(true, true) - await getNotice() + // await getNotice() } if (isLogin()) { @@ -347,10 +375,6 @@ globalToastEvent.on(ToastType.SHOW_SWIPER, () => { }) - - - - const ruleShow = ref(false) globalToastEvent.on(ToastType.SHOW_RULE, () => { ruleShow.value = true @@ -367,6 +391,9 @@ const getUserLottery = async () => { const result = await Request("lottery", { pool: "all" }, "GET") if (result.res.status === 200) { prizelist.value = result.json.lottery_logs.length > 0 ? result.json.lottery_logs : [] + if(prizelist.value.length===0){ + weui.alert("您还没有中奖") + } } //TODO 上线换成上面的 // prizelist.value = [ diff --git a/src/components/Lottery.vue b/src/components/Lottery.vue index 298fe9d..ed86661 100644 --- a/src/components/Lottery.vue +++ b/src/components/Lottery.vue @@ -7,7 +7,6 @@