|
@@ -91,7 +91,9 @@ export class DetailInfoComponent {
|
|
|
}
|
|
|
setTurn() {
|
|
|
this.turns = Array.from({ length: this.data.frequencyTimes }, (_, i) => i);
|
|
|
- this.currentTurn = this.turns[0];
|
|
|
+ if (this.currentTurn === -1 || !this.turns.includes(this.currentTurn)) {
|
|
|
+ this.currentTurn = this.turns[0];
|
|
|
+ }
|
|
|
}
|
|
|
setRounds() {
|
|
|
const rounds = this.data?.plans || [];
|
|
@@ -108,9 +110,12 @@ export class DetailInfoComponent {
|
|
|
time: `${dayjs(item.startDate).format('MM/DD')} - ${dayjs(item.endDate).format('MM/DD')}`,
|
|
|
};
|
|
|
});
|
|
|
- const firstId = this.rounds[0]?.meta.id;
|
|
|
- const recentId = this.rounds.find(item => item.state === 'current')?.meta.id;
|
|
|
- this.selectedRoundId = recentId || firstId;
|
|
|
+ if (this.selectedRoundId === -1 || !this.rounds.find(item => item.meta.id === this.selectedRoundId)) {
|
|
|
+ // 如果未选择轮次,则选择当前轮次
|
|
|
+ const firstId = this.rounds[0]?.meta.id;
|
|
|
+ const recentId = this.rounds.find(item => item.state === 'current')?.meta.id;
|
|
|
+ this.selectedRoundId = recentId || firstId;
|
|
|
+ }
|
|
|
const currentRound = this.rounds.find(item => item.meta.id === this.selectedRoundId);
|
|
|
if (currentRound) {
|
|
|
this.onRoundChange(currentRound);
|