feat:更新core 和首页代码
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import type { WorksheetType } from '../../core/models/worksheet';
|
||||
import type {
|
||||
WorksheetDefinition,
|
||||
WorksheetType,
|
||||
} from '../../core/models/worksheet';
|
||||
import {
|
||||
getWorksheetPath,
|
||||
getWorksheetsByAge,
|
||||
@@ -63,7 +66,7 @@ function toDisplayList(list: WorksheetType[]): DisplayItem[] {
|
||||
Page({
|
||||
data: {
|
||||
title: '分类',
|
||||
sourceItems: [] as WorksheetType[],
|
||||
sourceItems: [] as WorksheetDefinition[],
|
||||
items: [] as DisplayItem[],
|
||||
ageFilters: [
|
||||
{ key: 'all', label: '全部' },
|
||||
@@ -95,13 +98,11 @@ Page({
|
||||
const minAge = options.minAge != null ? Number(options.minAge) : NaN;
|
||||
const maxAge = options.maxAge != null ? Number(options.maxAge) : NaN;
|
||||
if (!Number.isNaN(minAge) && !Number.isNaN(maxAge)) {
|
||||
const map = new Map<string, WorksheetType>();
|
||||
const map = new Map<string, WorksheetDefinition>();
|
||||
const lo = Math.min(minAge, maxAge);
|
||||
const hi = Math.max(minAge, maxAge);
|
||||
for (let age = lo; age <= hi; age += 1) {
|
||||
getWorksheetsByAge(base, age).forEach((w) =>
|
||||
map.set(w.id, w),
|
||||
);
|
||||
getWorksheetsByAge(base, age).forEach((w) => map.set(w.id, w));
|
||||
}
|
||||
base = Array.from(map.values());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user