|
|
@@ -8,6 +8,18 @@ import dayjs from 'dayjs';
|
|
|
import MatchCard from '../components/match_card.vue';
|
|
|
|
|
|
const solutions = ref([]);
|
|
|
+const selectedSolutions = reactive([]);
|
|
|
+
|
|
|
+const solutionsList = computed(() => {
|
|
|
+ const startTimestamp = selectedSolutions[0]?.timestamp ?? 0;
|
|
|
+ return solutions.value.map(item => {
|
|
|
+ const selected = selectedSolutions.findIndex(sol => sol.sid === item.sid) >= 0;
|
|
|
+ const disabled = !selected && (item.info.jc.timestamp < startTimestamp + 1000 * 60 * 60 * 2);
|
|
|
+ // console.log(new Date(item.info.jc.timestamp), new Date(startTimestamp), disabled);
|
|
|
+ return { ...item, selected, disabled };
|
|
|
+ })
|
|
|
+ .filter(item => !item.disabled);
|
|
|
+});
|
|
|
|
|
|
const getSolutions = async () => {
|
|
|
try {
|
|
|
@@ -177,6 +189,19 @@ const updateSolutions = async () => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+const toggleSolution = (sid, timestamp) => {
|
|
|
+ const findIndex = selectedSolutions.findIndex(item => item.sid === sid);
|
|
|
+ if (findIndex >= 0) {
|
|
|
+ selectedSolutions.splice(findIndex, 1);
|
|
|
+ }
|
|
|
+ else if (selectedSolutions.length < 2) {
|
|
|
+ selectedSolutions.push({ sid, timestamp });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ selectedSolutions.splice(1, 1, { sid, timestamp });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
let updateTimer = null;
|
|
|
|
|
|
onMounted(() => {
|
|
|
@@ -203,7 +228,10 @@ onUnmounted(() => {
|
|
|
<em>利润</em>
|
|
|
</div>
|
|
|
<div class="solution-list">
|
|
|
- <div class="solution-item" v-for="{ sid, sol: {win_average}, info: {jc, ps, ob} } in solutions" :key="sid">
|
|
|
+ <div class="solution-item"
|
|
|
+ v-for="{ sid, sol: {win_average}, info: {jc, ps, ob}, selected, disabled } in solutionsList" :key="sid"
|
|
|
+ :class="{'selected': selected, 'disabled': disabled}"
|
|
|
+ >
|
|
|
<MatchCard platform="jc"
|
|
|
:eventId="jc.eventId"
|
|
|
:leagueName="jc.leagueName"
|
|
|
@@ -232,7 +260,7 @@ onUnmounted(() => {
|
|
|
:events="ob.events ?? []"
|
|
|
:selected="ob.selected ?? []"/>
|
|
|
|
|
|
- <div class="solution-profit">{{ win_average }}</div>
|
|
|
+ <div class="solution-profit" @click="!disabled && toggleSolution(sid, jc.timestamp)">{{ win_average }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -268,6 +296,13 @@ onUnmounted(() => {
|
|
|
display: flex;
|
|
|
border-radius: 10px;
|
|
|
background-color: hsl(var(--card));
|
|
|
+ &.selected {
|
|
|
+ background-color: hsl(var(--primary) / 0.15);
|
|
|
+ }
|
|
|
+ &.disabled {
|
|
|
+ filter: blur(15px);
|
|
|
+ cursor: not-allowed;
|
|
|
+ }
|
|
|
&:not(:last-child) {
|
|
|
margin-bottom: 20px;
|
|
|
}
|