mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
🎈 perf(eslint): 第二次 eslint
剩下的全给过了,明天起来跑 devtool 改 bug Signed-off-by: BTMuli <BT-Muli@outlook.com> (cherry picked from commit 59baf08cf897d31cabce4741910ea83c1a3a52d9)
This commit is contained in:
@@ -1,59 +1,69 @@
|
||||
<template>
|
||||
<div v-if="loading">
|
||||
<t-loading :empty="loadingEmpty" :title="loadingTitle" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="lottery-div">
|
||||
<div class="lottery-title">抽奖详情 {{ timeStatus }}</div>
|
||||
<v-list class="lottery-list">
|
||||
<v-list-item>
|
||||
<template v-slot:prepend>
|
||||
<v-avatar>
|
||||
<v-img :src="lotteryCard.creator.avatar_url" />
|
||||
</v-avatar>
|
||||
</template>
|
||||
{{ lotteryCard.creator.nickname }}
|
||||
<v-list-item-subtitle>{{ lotteryCard.creator.introduce }}</v-list-item-subtitle>
|
||||
<template v-slot:append>发起人</template>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<v-list-item-title>{{ lotteryCard.participantWay }}</v-list-item-title>
|
||||
<v-list-item-subtitle>{{ lotteryCard.id }}</v-list-item-subtitle>
|
||||
<template v-slot:append>抽奖 ID</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<v-btn class="lottery-back" @click="backPost">返回</v-btn>
|
||||
<v-btn @click="showJson = true" class="card-dev-btn" v-show="appStore.devMode">
|
||||
<template v-slot:prepend>
|
||||
<img src="../assets/icons/arrow-right.svg" alt="right" />
|
||||
</template>
|
||||
JSON
|
||||
</v-btn>
|
||||
</div>
|
||||
<div class="dev-json" v-show="showJson">
|
||||
<json-viewer :value="jsonData" copyable boxed />
|
||||
</div>
|
||||
<div class="lottery-div">
|
||||
<div class="lottery-title">奖品详情</div>
|
||||
<div v-for="reward in lotteryCard.rewards">
|
||||
<v-list class="lottery-list">
|
||||
<v-list-item :title="reward.rewardName" :subtitle="'中奖人数' + reward.winnerNumber" />
|
||||
</v-list>
|
||||
<div class="lottery-grid">
|
||||
<v-list v-for="user in reward.users" class="lottery-sub-list">
|
||||
<v-list-item>
|
||||
<template v-slot:prepend>
|
||||
<v-avatar>
|
||||
<v-img :src="user.avatar_url" />
|
||||
</v-avatar>
|
||||
</template>
|
||||
{{ user.nickname }}
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="loading">
|
||||
<TLoading :empty="loadingEmpty" :title="loadingTitle" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="lottery-div">
|
||||
<div class="lottery-title">
|
||||
抽奖详情 {{ timeStatus }}
|
||||
</div>
|
||||
<v-list class="lottery-list">
|
||||
<v-list-item>
|
||||
<template #prepend>
|
||||
<v-avatar>
|
||||
<v-img :src="lotteryCard.creator.avatar_url" />
|
||||
</v-avatar>
|
||||
</template>
|
||||
{{ lotteryCard.creator.nickname }}
|
||||
<v-list-item-subtitle>{{ lotteryCard.creator.introduce }}</v-list-item-subtitle>
|
||||
<template #append>
|
||||
发起人
|
||||
</template>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<v-list-item-title>{{ lotteryCard.participantWay }}</v-list-item-title>
|
||||
<v-list-item-subtitle>{{ lotteryCard.id }}</v-list-item-subtitle>
|
||||
<template #append>
|
||||
抽奖 ID
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<v-btn class="lottery-back" @click="backPost">
|
||||
返回
|
||||
</v-btn>
|
||||
<v-btn v-show="appStore.devMode" class="card-dev-btn" @click="showJson = true">
|
||||
<template #prepend>
|
||||
<img src="../assets/icons/arrow-right.svg" alt="right">
|
||||
</template>
|
||||
JSON
|
||||
</v-btn>
|
||||
</div>
|
||||
<div v-show="showJson" class="dev-json">
|
||||
<JsonViewer :value="jsonData" copyable boxed />
|
||||
</div>
|
||||
<div class="lottery-div">
|
||||
<div class="lottery-title">
|
||||
奖品详情
|
||||
</div>
|
||||
<div v-for="reward in lotteryCard.rewards" :key="reward.rewardName">
|
||||
<v-list class="lottery-list">
|
||||
<v-list-item :title="reward.rewardName" :subtitle="'中奖人数' + reward.winnerNumber" />
|
||||
</v-list>
|
||||
<div class="lottery-grid">
|
||||
<v-list v-for="user in reward.users" :key="user.uid" class="lottery-sub-list">
|
||||
<v-list-item>
|
||||
<template #prepend>
|
||||
<v-avatar>
|
||||
<v-img :src="user.avatar_url" />
|
||||
</v-avatar>
|
||||
</template>
|
||||
{{ user.nickname }}
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// vue
|
||||
@@ -85,50 +95,50 @@ const showJson = ref(false as boolean);
|
||||
let jsonData = reactive({} as LotteryData);
|
||||
const timeStatus = ref("未知" as string);
|
||||
|
||||
function backPost() {
|
||||
window.history.back();
|
||||
function backPost () {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await appWindow.show();
|
||||
// 检查数据
|
||||
if (!lottery_id) {
|
||||
loadingEmpty.value = true;
|
||||
loadingTitle.value = "未找到数据";
|
||||
return;
|
||||
}
|
||||
// 获取数据
|
||||
loadingTitle.value = "正在获取数据...";
|
||||
jsonData = await MysOper.Lottery.get(lottery_id);
|
||||
if (!jsonData) {
|
||||
loadingEmpty.value = true;
|
||||
loadingTitle.value = "未找到数据";
|
||||
return;
|
||||
}
|
||||
await appWindow.setTitle("抽奖详情 " + jsonData.lottery_entity_summary);
|
||||
loadingTitle.value = "正在渲染数据...";
|
||||
lotteryCard.value = MysOper.Lottery.card.lottery(jsonData);
|
||||
if (jsonData.status === "Settled") {
|
||||
timeStatus.value = "已开奖";
|
||||
} else {
|
||||
await setInterval(() => {
|
||||
const timeNow = new Date().getTime();
|
||||
const timeDiff = Number(jsonData.draw_time) * 1000 - timeNow;
|
||||
if (timeDiff <= 0) {
|
||||
timeStatus.value = "已开奖";
|
||||
clearInterval(this);
|
||||
} else {
|
||||
const day = Math.floor(timeDiff / (24 * 3600 * 1000));
|
||||
const hour = Math.floor((timeDiff % (24 * 3600 * 1000)) / (3600 * 1000));
|
||||
const minute = Math.floor((timeDiff % (3600 * 1000)) / (60 * 1000));
|
||||
const second = Math.floor((timeDiff % (60 * 1000)) / 1000);
|
||||
timeStatus.value = `${day}天${hour}小时${minute}分${second}秒`;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
}, 200);
|
||||
await appWindow.show();
|
||||
// 检查数据
|
||||
if (!lottery_id) {
|
||||
loadingEmpty.value = true;
|
||||
loadingTitle.value = "未找到数据";
|
||||
return;
|
||||
}
|
||||
// 获取数据
|
||||
loadingTitle.value = "正在获取数据...";
|
||||
jsonData = await MysOper.Lottery.get(lottery_id);
|
||||
if (!jsonData) {
|
||||
loadingEmpty.value = true;
|
||||
loadingTitle.value = "未找到数据";
|
||||
return;
|
||||
}
|
||||
await appWindow.setTitle("抽奖详情 " + jsonData.lottery_entity_summary);
|
||||
loadingTitle.value = "正在渲染数据...";
|
||||
lotteryCard.value = MysOper.Lottery.card.lottery(jsonData);
|
||||
if (jsonData.status === "Settled") {
|
||||
timeStatus.value = "已开奖";
|
||||
} else {
|
||||
await setInterval(() => {
|
||||
const timeNow = new Date().getTime();
|
||||
const timeDiff = Number(jsonData.draw_time) * 1000 - timeNow;
|
||||
if (timeDiff <= 0) {
|
||||
timeStatus.value = "已开奖";
|
||||
clearInterval(this);
|
||||
} else {
|
||||
const day = Math.floor(timeDiff / (24 * 3600 * 1000));
|
||||
const hour = Math.floor((timeDiff % (24 * 3600 * 1000)) / (3600 * 1000));
|
||||
const minute = Math.floor((timeDiff % (3600 * 1000)) / (60 * 1000));
|
||||
const second = Math.floor((timeDiff % (60 * 1000)) / 1000);
|
||||
timeStatus.value = `${day}天${hour}小时${minute}分${second}秒`;
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
setTimeout(() => {
|
||||
loading.value = false;
|
||||
}, 200);
|
||||
});
|
||||
</script>
|
||||
<style lang="css">
|
||||
|
||||
Reference in New Issue
Block a user