|
@@ -12,6 +12,7 @@ const contentsPositionStore = useContentsPositionStore();
|
|
|
const solutions = ref([]);
|
|
const solutions = ref([]);
|
|
|
const selectedSolutions = reactive([]);
|
|
const selectedSolutions = reactive([]);
|
|
|
const totalProfit = ref({});
|
|
const totalProfit = ref({});
|
|
|
|
|
+const loopActive = ref(false);
|
|
|
|
|
|
|
|
const psOptions = reactive({
|
|
const psOptions = reactive({
|
|
|
bet: 10000,
|
|
bet: 10000,
|
|
@@ -305,8 +306,21 @@ const formatSolution = (solution, eventsList) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const updateSolutions = async () => {
|
|
const updateSolutions = async () => {
|
|
|
- const { solutions: solutionsList, gamesEvents: eventsList } = await getSolutions();
|
|
|
|
|
- solutions.value = solutionsList?.map(solution => formatSolution(solution, eventsList)) ?? [];
|
|
|
|
|
|
|
+ getSolutions()
|
|
|
|
|
+ .then(({ solutions: solutionsList, gamesEvents: eventsList }) => {
|
|
|
|
|
+ solutions.value = solutionsList?.map(solution => formatSolution(solution, eventsList)) ?? [];
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(error => {
|
|
|
|
|
+ console.error('Failed to update solutions:', error);
|
|
|
|
|
+ message.error('获取中单方案失败');
|
|
|
|
|
+ })
|
|
|
|
|
+ .finally(() => {
|
|
|
|
|
+ if (loopActive.value) {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ updateSolutions();
|
|
|
|
|
+ }, 1000 * 10);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const showTotalProfit = async () => {
|
|
const showTotalProfit = async () => {
|
|
@@ -336,17 +350,13 @@ const toggleSolution = (sid, timestamp) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-let updateTimer = null;
|
|
|
|
|
-
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
|
|
+ loopActive.value = true;
|
|
|
updateSolutions();
|
|
updateSolutions();
|
|
|
- updateTimer = setInterval(() => {
|
|
|
|
|
- updateSolutions();
|
|
|
|
|
- }, 1000 * 10);
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|
|
|
- clearInterval(updateTimer);
|
|
|
|
|
|
|
+ loopActive.value = false;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
|