feat(lottery):草创抽奖详情

This commit is contained in:
BTMuli
2023-03-30 22:52:28 +08:00
parent 842066f345
commit 9298f23ae9
5 changed files with 170 additions and 1 deletions

42
src/views/t-lottery.vue Normal file
View File

@@ -0,0 +1,42 @@
<template>
<div v-if="loading">
<t-loading :empty="loadingEmpty" :title="loadingTitle" />
</div>
<div v-else>
<h1>{{ lottery_id }}</h1>
{{ lottery }}
</div>
</template>
<script lang="ts" setup>
// vue
import { ref, onMounted } from "vue";
import { useRoute } from "vue-router";
import TLoading from "../components/t-loading.vue";
// plugins
import MysOper from "../plugins/Mys";
// loading
const loading = ref(true as boolean);
const loadingTitle = ref("正在加载");
const loadingEmpty = ref(false as boolean);
// 数据
const lottery_id = useRoute().params.lottery_id as string;
const lottery = ref({} as any);
onMounted(async () => {
// 检查数据
if (!lottery_id) {
loadingEmpty.value = true;
loadingTitle.value = "未找到数据";
return;
}
// 获取数据
loadingTitle.value = "正在获取数据...";
lottery.value = await MysOper.Lottery.get(lottery_id);
setInterval(() => {
loading.value = false;
}, 200);
});
</script>
<style></style>