添加排名奖励
This commit is contained in:
@@ -22,6 +22,7 @@ const videoLoaded = ref(false);
|
||||
const videoError = ref(false);
|
||||
const lotteryShow = ref(false)
|
||||
const lotteryType = ref("draw")
|
||||
const lotteryNoticeData = ref(null)
|
||||
|
||||
// 初始化全局音频实例
|
||||
const initGlobalAudio = () => {
|
||||
@@ -228,6 +229,8 @@ const handleLottery = () => {
|
||||
if (globalStore.draw_chances <= 0) {
|
||||
return weui.alert("还没有抽奖机会,快去参加活动吧")
|
||||
};
|
||||
lotteryType.value = 'draw'
|
||||
lotteryNoticeData.value = null
|
||||
globalToastEvent.emit(ToastType.SHOW_LOTTERY)
|
||||
|
||||
}
|
||||
@@ -307,12 +310,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 handleLoginSuccess = async () => {
|
||||
console.log("已登录")
|
||||
loginShow.value = false
|
||||
|
||||
await initUserGameInfos(true, true)
|
||||
await getNotice()
|
||||
}
|
||||
|
||||
if (isLogin()) {
|
||||
@@ -413,7 +424,7 @@ globalToastEvent.on(ToastType.SHOW_LOTTERY, async() => {
|
||||
<MyPhoto @go-photo-square="showPhotoSquare" v-model:show="isMyPhotoVisible" />
|
||||
<PhotoSquare @go-my-photo="showMyPhoto" v-model:show="isPhotoSquareVisible" />
|
||||
<Login :show="loginShow" @login-success="handleLoginSuccess" />
|
||||
<Lottery :show="lotteryShow" @close="lotteryShow = false" :type="lotteryType"></Lottery>
|
||||
<Lottery :show="lotteryShow" @close="lotteryShow = false" :type="lotteryType" :data="lotteryNoticeData"></Lottery>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -8,9 +8,12 @@
|
||||
<div class="lottery-prize">
|
||||
<div class="lottery-title" :class="props.type === 'notice' && 'notice'" ref="titleRef"
|
||||
v-show="activePrizeData.prize_code !== 'NO'"></div>
|
||||
<div class="lottery-desc" v-show="props.type === 'notice'">在刚刚结束的打榜活动中成功斩获<br /><strong>第[30]名</strong></div>
|
||||
<div class="lottery-desc" v-show="props.type === 'notice'">
|
||||
在刚刚结束的打榜活动中成功斩获<br /><strong>第[{{ activePrizeData.rank }}]名</strong>
|
||||
</div>
|
||||
<div class="lottery-image" :class="'USER_' + activePrizeData.prize_code" ref="lotteryImageRef"></div>
|
||||
<div class="lottery-name" v-show="activePrizeData.prize_code !== 'NO'">{{ activePrizeData.prize_name }}</div>
|
||||
<div class="lottery-name" v-show="activePrizeData.prize_code !== 'NO'">{{ activePrizeData.prize_name }}
|
||||
</div>
|
||||
<div class="lottery-btngroup" v-show="btngroupShow">
|
||||
<div class="btn-more" @click="handleBtnMore"></div>
|
||||
<div class="btn-kaixin" @click="handleLotteryAction" v-if="activePrizeData.prize_code !== 'NO'"></div>
|
||||
@@ -46,7 +49,8 @@ const btngroupShow = ref(false)
|
||||
gsap.registerPlugin()
|
||||
const props = defineProps({
|
||||
show: false,
|
||||
type: "draw"
|
||||
type: "draw",
|
||||
data: null
|
||||
})
|
||||
const emit = defineEmits(['close'])
|
||||
|
||||
@@ -63,9 +67,15 @@ const handleBtnMore = () => {
|
||||
closeThis()
|
||||
globalToastEvent.emit(ToastType.SHOW_AD)
|
||||
}
|
||||
const handleLotteryAction = () => {
|
||||
const readNotice = async () => {
|
||||
await Request(`notice/read`, { id: activePrizeData.value.noticeId })
|
||||
}
|
||||
const handleLotteryAction = async () => {
|
||||
//实物
|
||||
closeThis()
|
||||
if (props.type !== 'draw') {
|
||||
await readNotice()
|
||||
}
|
||||
if (activePrizeData.value.coupon_type === 'scene') {
|
||||
globalToastEvent.emit(ToastType.SHOW_ADDRESS, activePrizeData.value.id)
|
||||
}
|
||||
@@ -110,6 +120,24 @@ watch(() => props.show, async (newVal) => {
|
||||
let lottteryResult = null
|
||||
if (props.type === 'draw') {
|
||||
lottteryResult = await Request("lottery/draw", { pool: 'game', consume_type: 'points' })
|
||||
} else {
|
||||
if (!props.data) {
|
||||
weui.alert("获取排名奖励出错,请刷新页面重试")
|
||||
emit('close')
|
||||
return
|
||||
}
|
||||
|
||||
lottteryResult = {
|
||||
res: { status: 200 },
|
||||
json: {
|
||||
noticeId: props.data.id,
|
||||
id: props.data.data.prize.id,
|
||||
prize_code: props.data.data.prize.prize_code,
|
||||
prize_name: props.data.data.prize.name,
|
||||
coupon_type: props.data.data.prize.scene,
|
||||
rank: props.data.data.rank
|
||||
}
|
||||
}
|
||||
}
|
||||
// const userPicture = await getUserPicture()
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ const handleBtnMore = () => {
|
||||
</div>
|
||||
|
||||
<Popup v-model:show="isPopupVisible" />
|
||||
<Lottery :show="lotteryShow" @close="lotteryShow = false"></Lottery>
|
||||
<Lottery :show="lotteryShow" @close="lotteryShow = false" data="null" type="draw"></Lottery>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user