|
|
@@ -1,7 +1,7 @@
|
|
|
<script setup>
|
|
|
import { requestClient } from '#/api/request';
|
|
|
-import { Button, message, Form, InputNumber, Drawer } from 'ant-design-vue';
|
|
|
-import { ref, reactive, computed, onMounted, onUnmounted } from 'vue';
|
|
|
+import { Button, message, Form, InputNumber, RadioGroup, Radio, Drawer } from 'ant-design-vue';
|
|
|
+import { ref, reactive, computed, watch, onMounted, onUnmounted } from 'vue';
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
import MatchCard from '../components/match_card.vue';
|
|
|
@@ -13,6 +13,10 @@ const solutions = ref([]);
|
|
|
const selectedSolutions = reactive([]);
|
|
|
const totalProfit = ref({});
|
|
|
const loopActive = ref(false);
|
|
|
+const loopTimer = ref(null);
|
|
|
+const updateTimer = ref(null);
|
|
|
+const minProfitRate = ref(2);
|
|
|
+const marketType = ref(-1);
|
|
|
|
|
|
const totalProfitVisible = ref(false);
|
|
|
|
|
|
@@ -97,7 +101,9 @@ const solutionsList = computed(() => {
|
|
|
|
|
|
const getSolutions = async () => {
|
|
|
try {
|
|
|
- const data = await requestClient.get('/pstery/get_solutions');
|
|
|
+ const win_min = minProfitRate.value * 100;
|
|
|
+ const mk = marketType.value;
|
|
|
+ const data = await requestClient.get('/pstery/get_solutions', { params: { win_min, mk } });
|
|
|
return data;
|
|
|
}
|
|
|
catch (error) {
|
|
|
@@ -317,6 +323,7 @@ const formatSolution = (solution, eventsList) => {
|
|
|
}
|
|
|
|
|
|
const updateSolutions = async () => {
|
|
|
+ clearTimeout(loopTimer.value);
|
|
|
getSolutions()
|
|
|
.then(({ solutions: solutionsList, gamesEvents: eventsList }) => {
|
|
|
solutions.value = solutionsList?.map(solution => formatSolution(solution, eventsList)) ?? [];
|
|
|
@@ -327,7 +334,7 @@ const updateSolutions = async () => {
|
|
|
})
|
|
|
.finally(() => {
|
|
|
if (loopActive.value) {
|
|
|
- setTimeout(() => {
|
|
|
+ loopTimer.value = setTimeout(() => {
|
|
|
updateSolutions();
|
|
|
}, 1000 * 10);
|
|
|
}
|
|
|
@@ -363,8 +370,41 @@ const toggleSolution = (sid, timestamp) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const setLocalStorage = (key, value) => {
|
|
|
+ localStorage.setItem(key, JSON.stringify(value));
|
|
|
+}
|
|
|
+
|
|
|
+const getLocalStorage = (key) => {
|
|
|
+ const value = localStorage.getItem(key);
|
|
|
+ return value ? JSON.parse(value) : null;
|
|
|
+}
|
|
|
+
|
|
|
+watch(minProfitRate, (newVal) => {
|
|
|
+ clearTimeout(updateTimer.value);
|
|
|
+ updateTimer.value = setTimeout(() => {
|
|
|
+ setLocalStorage('minProfitRate', newVal);
|
|
|
+ updateSolutions();
|
|
|
+ }, 1000);
|
|
|
+});
|
|
|
+
|
|
|
+watch(marketType, (newVal) => {
|
|
|
+ clearTimeout(updateTimer.value);
|
|
|
+ updateTimer.value = setTimeout(() => {
|
|
|
+ setLocalStorage('marketType', newVal);
|
|
|
+ updateSolutions();
|
|
|
+ }, 1000);
|
|
|
+});
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
loopActive.value = true;
|
|
|
+ const min_win_rate = getLocalStorage('minProfitRate');
|
|
|
+ const mk = getLocalStorage('marketType');
|
|
|
+ if (min_win_rate !== null) {
|
|
|
+ minProfitRate.value = min_win_rate;
|
|
|
+ }
|
|
|
+ if (mk !== null) {
|
|
|
+ marketType.value = mk;
|
|
|
+ }
|
|
|
updateSolutions();
|
|
|
});
|
|
|
|
|
|
@@ -379,16 +419,21 @@ onUnmounted(() => {
|
|
|
<div class="solution-container">
|
|
|
|
|
|
<div class="contents-header transition-all duration-200" :style="headerStyle">
|
|
|
- <!-- <div class="solution-options">
|
|
|
+ <div class="solution-options">
|
|
|
<Form layout="inline">
|
|
|
- <Form.Item label="PS 投注">
|
|
|
- <InputNumber size="small" placeholder="PS投注" min="1000" v-model:value="psOptions.bet" />
|
|
|
+ <Form.Item label="最小利润率(%)">
|
|
|
+ <InputNumber style="width: 60px" size="small" max="100" min="-100" placeholder="最小利润率(%)" v-model:value="minProfitRate"/>
|
|
|
</Form.Item>
|
|
|
- <Form.Item label="PS 返点">
|
|
|
- <InputNumber size="small" placeholder="PS返点" min="0" v-model:value="psOptions.rebate" />
|
|
|
+ <Form.Item label="盘口类型">
|
|
|
+ <RadioGroup v-model:value="marketType">
|
|
|
+ <Radio :value="-1">全部</Radio>
|
|
|
+ <Radio :value="2">滚球</Radio>
|
|
|
+ <Radio :value="1">今日</Radio>
|
|
|
+ <Radio :value="0">早盘</Radio>
|
|
|
+ </RadioGroup>
|
|
|
</Form.Item>
|
|
|
</Form>
|
|
|
- </div> -->
|
|
|
+ </div>
|
|
|
<div class="solution-header">
|
|
|
<span>PS</span>
|
|
|
<span>OB</span>
|
|
|
@@ -522,7 +567,7 @@ onUnmounted(() => {
|
|
|
}
|
|
|
|
|
|
.solution-container {
|
|
|
- padding-top: 31px;
|
|
|
+ padding-top: 74px;
|
|
|
}
|
|
|
|
|
|
.solution-item {
|