mirror of
https://github.com/certd/certd.git
synced 2026-04-30 01:07:28 +08:00
chore: tip
This commit is contained in:
@@ -8,14 +8,20 @@
|
|||||||
<div class="flex flex-col order-count-text weight-bold">
|
<div class="flex flex-col order-count-text weight-bold">
|
||||||
<div class="count-text ml-4 flex items-center">
|
<div class="count-text ml-4 flex items-center">
|
||||||
<fs-icon icon="noto:fire" class="fs-20 mr-2"></fs-icon>
|
<fs-icon icon="noto:fire" class="fs-20 mr-2"></fs-icon>
|
||||||
<span> 已有 </span>
|
<template v-if="stage.vipTotal > 0">
|
||||||
<span class="count-number color-red font-bold text-2xl ml-1 mr-1"> {{ todayOrderCount.vipTotal }} </span> 位小伙伴赞助,
|
<span> 已有 </span>
|
||||||
<span v-if="stage.orderCount === 0">
|
<span class="count-number color-red font-bold text-2xl ml-1 mr-1"> {{ stage.vipTotal }} </span> 位小伙伴赞助,
|
||||||
{{ todayOrderCount.title }}
|
<span>
|
||||||
</span>
|
{{ stage.title }}
|
||||||
<span v-else>
|
</span>
|
||||||
{{ stage.title }}
|
</template>
|
||||||
</span>
|
<template v-else>
|
||||||
|
<span> 今日赞助 </span>
|
||||||
|
<span class="count-number color-red font-bold text-2xl ml-1 mr-1"> {{ stage.orderCount }} </span> 人,
|
||||||
|
<span>
|
||||||
|
{{ stage.title }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -114,14 +120,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, nextTick, onMounted, reactive, Ref, ref } from "vue";
|
|
||||||
import { message, Modal } from "ant-design-vue";
|
import { message, Modal } from "ant-design-vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import { computed, nextTick, onMounted, onUnmounted, reactive, Ref, ref } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { useSettingStore } from "/@/store/settings";
|
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { utils } from "/@/utils";
|
import { useSettingStore } from "/@/store/settings";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -235,12 +240,13 @@ const vipTypeDefine: any = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const TodayVipOrderCountRef: Ref = ref({});
|
const TodayVipOrderCountRef: Ref = ref({ enabled: false, current: 0, stages: [] });
|
||||||
|
|
||||||
async function getTodayVipOrderCount() {
|
async function getTodayVipOrderCount() {
|
||||||
const res = await api.getTodayVipOrderCount();
|
const res = await api.getTodayVipOrderCount();
|
||||||
if (res) {
|
if (res) {
|
||||||
TodayVipOrderCountRef.value = res;
|
TodayVipOrderCountRef.value = res;
|
||||||
|
TodayVipOrderCountRef.value.current = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,32 +259,50 @@ const todayOrderCount = computed(() => {
|
|||||||
}
|
}
|
||||||
const lastStage = countInfo?.stages?.[countInfo?.stages?.length - 1] || {};
|
const lastStage = countInfo?.stages?.[countInfo?.stages?.length - 1] || {};
|
||||||
lastStage.orderCount = orderCount;
|
lastStage.orderCount = orderCount;
|
||||||
|
|
||||||
|
const stages: any = [];
|
||||||
|
stages.push({
|
||||||
|
title: countInfo.title,
|
||||||
|
vipTotal: countInfo?.vipTotal || 0,
|
||||||
|
orderCount: orderCount,
|
||||||
|
bg: lastStage.bg,
|
||||||
|
});
|
||||||
|
if (lastStage.orderCount > 0) {
|
||||||
|
stages.push(lastStage);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
orderCount: orderCount,
|
stages: stages,
|
||||||
title: lastStage.title || "",
|
|
||||||
stages: countInfo?.stages,
|
|
||||||
vipTotal: countInfo?.vipTotal || 0,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
async function scrollOrderCount() {
|
async function scrollOrderCount() {
|
||||||
const stages = todayOrderCount.value.stages;
|
const stages = todayOrderCount.value.stages;
|
||||||
if (!stages.length) {
|
if (stages.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let index = 0;
|
let index = 0;
|
||||||
for (const stage of stages) {
|
const doScroll = () => {
|
||||||
TodayVipOrderCountRef.value.current = index;
|
TodayVipOrderCountRef.value.current = index;
|
||||||
// await utils.sleep(500);
|
|
||||||
index++;
|
index++;
|
||||||
}
|
if (index >= stages.length) {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
doScroll();
|
||||||
|
scrollOrderCountIntervalRef.value = setInterval(doScroll, 7000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scrollOrderCountIntervalRef: Ref = ref(null);
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getTodayVipOrderCount();
|
await getTodayVipOrderCount();
|
||||||
|
await nextTick();
|
||||||
await scrollOrderCount();
|
await scrollOrderCount();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
clearInterval(scrollOrderCountIntervalRef.value);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
|
|||||||
@@ -84,5 +84,9 @@ export function startProxyServer(opts:{port:number}) {
|
|||||||
logger.info(`[proxy] 正向代理服务器运行在 http://0.0.0.0:${port}`);
|
logger.info(`[proxy] 正向代理服务器运行在 http://0.0.0.0:${port}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
proxyServer.close(() => {
|
||||||
|
logger.info('[proxy] 正向代理服务器已关闭');
|
||||||
|
});
|
||||||
|
|
||||||
return proxyServer
|
return proxyServer
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user