-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 实现图表历史数据,每次结算都可以与上次的打字记录进行对比。
- Loading branch information
Showing
11 changed files
with
500 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import YStorage from '@/common/YStorage'; | ||
|
||
// 处理图表数据,包括存储到本地缓存 | ||
export function handleChart(typingChartRecord: any, currentTitle: string) { | ||
let typingChartSpeed = []; | ||
let lastTypingChartSpeed = []; | ||
let typingChartAccuracy = []; | ||
let lastTypingChartAccuracy = []; | ||
if (typingChartRecord && typingChartRecord.speed) { | ||
typingChartSpeed = typingChartRecord.speed; | ||
const yStorage = YStorage.get('Y_STORAGE') || {}; | ||
|
||
if (yStorage.typingChartSpeed && yStorage.typingChartSpeed[currentTitle]) { | ||
lastTypingChartSpeed = yStorage.typingChartSpeed[currentTitle] || []; | ||
} | ||
|
||
YStorage.set( | ||
'Y_STORAGE', | ||
Object.assign(yStorage, { | ||
typingChartSpeed: { [currentTitle]: typingChartSpeed } | ||
}) | ||
); | ||
} | ||
if (typingChartRecord && typingChartRecord.accuracy) { | ||
typingChartAccuracy = typingChartRecord.accuracy; | ||
const yStorage = YStorage.get('Y_STORAGE') || {}; | ||
|
||
if (yStorage.typingChartAccuracy && yStorage.typingChartAccuracy[currentTitle]) { | ||
lastTypingChartAccuracy = yStorage.typingChartAccuracy[currentTitle] || []; | ||
} | ||
|
||
YStorage.set( | ||
'Y_STORAGE', | ||
Object.assign(yStorage, { | ||
typingChartAccuracy: { [currentTitle]: typingChartAccuracy } | ||
}) | ||
); | ||
} | ||
|
||
return { | ||
typingChartSpeed, | ||
lastTypingChartSpeed, | ||
typingChartAccuracy, | ||
lastTypingChartAccuracy | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.