|
|
@@ -18,6 +18,7 @@ const loopTimer = ref(null);
|
|
|
const updateTimer = ref(null);
|
|
|
const minProfitRate = ref(2);
|
|
|
const marketType = ref(-1);
|
|
|
+const updateLoaderHide = ref(null);
|
|
|
|
|
|
const totalProfitVisible = ref(false);
|
|
|
|
|
|
@@ -323,8 +324,11 @@ const formatSolution = (solution, eventsList) => {
|
|
|
return solution;
|
|
|
}
|
|
|
|
|
|
-const updateSolutions = async () => {
|
|
|
+const updateSolutions = async (showLoading=false) => {
|
|
|
clearTimeout(loopTimer.value);
|
|
|
+ if (showLoading) {
|
|
|
+ updateLoaderHide.value = message.loading('正在获取数据...', 0);
|
|
|
+ }
|
|
|
getSolutions()
|
|
|
.then(({ solutions: solutionsList, gamesEvents: eventsList, mkCount: mkCountData }) => {
|
|
|
solutions.value = solutionsList?.map(solution => formatSolution(solution, eventsList)) ?? [];
|
|
|
@@ -335,6 +339,8 @@ const updateSolutions = async () => {
|
|
|
message.error('获取中单方案失败');
|
|
|
})
|
|
|
.finally(() => {
|
|
|
+ updateLoaderHide.value?.();
|
|
|
+ updateLoaderHide.value = null;
|
|
|
if (loopActive.value) {
|
|
|
loopTimer.value = setTimeout(() => {
|
|
|
updateSolutions();
|
|
|
@@ -390,6 +396,9 @@ watch(minProfitRate, (newVal) => {
|
|
|
});
|
|
|
|
|
|
watch(marketType, (newVal) => {
|
|
|
+ if (!updateLoaderHide.value) {
|
|
|
+ updateLoaderHide.value = message.loading('正在更新数据...', 0);
|
|
|
+ }
|
|
|
clearTimeout(updateTimer.value);
|
|
|
updateTimer.value = setTimeout(() => {
|
|
|
setLocalStorage('marketType', newVal);
|