Compare commits

...

3 Commits

Author SHA1 Message Date
xiaojunnuo 82786c580a chore: tip 2026-02-05 00:42:25 +08:00
xiaojunnuo e19743f705 perf: count tip 2026-02-05 00:07:15 +08:00
xiaojunnuo 9166a57930 perf: 当域名管理中没有域名时,创建流水线时不展开域名选择框 2026-02-04 23:09:16 +08:00
3 changed files with 69 additions and 17 deletions
@@ -9,6 +9,7 @@
:options="optionsRef"
:value="value"
v-bind="attrs"
:open="openProp"
@click="onClick"
@update:value="emit('update:value', $event)"
>
@@ -56,11 +57,11 @@
</template>
<script setup lang="ts">
import { computed, defineComponent, ref, Ref, useAttrs } from "vue";
import { request } from "/@/api/service";
import { Dicts } from "../lib/dicts";
import { useRouter } from "vue-router";
import { useDomainImport, useDomainImportManage } from "/@/views/certd/cert/domain/use";
import { Dicts } from "../lib/dicts";
import { request } from "/@/api/service";
import { openRouteInNewWindow } from "/@/vben/utils";
import { useDomainImportManage } from "/@/views/certd/cert/domain/use";
defineOptions({
name: "DomainSelector",
@@ -82,6 +83,7 @@ const props = defineProps<{
search?: boolean;
pager?: boolean;
value?: any[];
open?: boolean;
}>();
const emit = defineEmits<{
@@ -90,6 +92,15 @@ const emit = defineEmits<{
const attrs = useAttrs();
const hasOptions: Ref = ref(null);
const openProp = computed(() => {
if (hasOptions.value == null) {
return false;
}
return hasOptions.value;
});
const searchKeyRef = ref("");
const optionsRef = ref([]);
const message = ref("");
@@ -143,6 +154,13 @@ const getOptions = async () => {
}
optionsRef.value = options;
if (hasOptions.value == null) {
if (options.length > 0) {
hasOptions.value = true;
} else {
hasOptions.value = false;
}
}
pagerRef.value.total = list.length;
if (props.pager) {
if (res.total != null) {
@@ -8,9 +8,20 @@
<div class="flex flex-col order-count-text weight-bold">
<div class="count-text ml-4 flex items-center">
<fs-icon icon="noto:fire" class="fs-20 mr-2"></fs-icon>
<span> 今日赞助 </span>
<span class="count-number color-red font-bold text-2xl ml-1 mr-1"> {{ stage.orderCount }} </span>
<span> {{ stage.title }} </span>
<template v-if="stage.vipTotal > 0">
<span> 已有 </span>
<span class="count-number color-red font-bold text-2xl ml-1 mr-1"> {{ stage.vipTotal }} </span> 位小伙伴赞助
<span>
{{ stage.title }}
</span>
</template>
<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>
@@ -109,14 +120,13 @@
</template>
<script lang="ts" setup>
import { computed, nextTick, onMounted, reactive, Ref, ref } from "vue";
import { message, Modal } from "ant-design-vue";
import dayjs from "dayjs";
import { computed, nextTick, onMounted, onUnmounted, reactive, Ref, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { useSettingStore } from "/@/store/settings";
import * as api from "./api";
import { utils } from "/@/utils";
import { useSettingStore } from "/@/store/settings";
const { t } = useI18n();
const router = useRouter();
@@ -230,12 +240,13 @@ const vipTypeDefine: any = {
},
};
const TodayVipOrderCountRef: Ref = ref({});
const TodayVipOrderCountRef: Ref = ref({ enabled: false, current: 0, stages: [] });
async function getTodayVipOrderCount() {
const res = await api.getTodayVipOrderCount();
if (res) {
TodayVipOrderCountRef.value = res;
TodayVipOrderCountRef.value.current = 0;
}
}
@@ -248,31 +259,50 @@ const todayOrderCount = computed(() => {
}
const lastStage = countInfo?.stages?.[countInfo?.stages?.length - 1] || {};
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 {
enabled: enabled,
orderCount: orderCount,
title: lastStage.title || "",
stages: countInfo?.stages,
stages: stages,
};
});
async function scrollOrderCount() {
const stages = todayOrderCount.value.stages;
if (!stages.length) {
if (stages.length === 0) {
return;
}
let index = 0;
for (const stage of stages) {
const doScroll = () => {
TodayVipOrderCountRef.value.current = index;
await utils.sleep(500);
index++;
}
if (index >= stages.length) {
index = 0;
}
};
doScroll();
scrollOrderCountIntervalRef.value = setInterval(doScroll, 7000);
}
const scrollOrderCountIntervalRef: Ref = ref(null);
onMounted(async () => {
await getTodayVipOrderCount();
await nextTick();
await scrollOrderCount();
});
onUnmounted(() => {
clearInterval(scrollOrderCountIntervalRef.value);
});
</script>
<style lang="less">
@@ -84,5 +84,9 @@ export function startProxyServer(opts:{port:number}) {
logger.info(`[proxy] 正向代理服务器运行在 http://0.0.0.0:${port}`);
});
proxyServer.close(() => {
logger.info('[proxy] 正向代理服务器已关闭');
});
return proxyServer
}