Skip to content

Commit

Permalink
fix(script): 修复一些显示BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Apr 24, 2023
1 parent 4ae7af0 commit eb4cbc1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/scripts/src/projects/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ export const BackgroundProject = Project.create({
});
if (gt(version['last-version'], infos.script.version)) {
const modal = $modal('confirm', {
width: 600,
content: $creator.notes([
`检测到新版本发布 ${version['last-version']} :`,
[...(version.notes || [])]
Expand Down
8 changes: 8 additions & 0 deletions packages/scripts/src/projects/zhs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ export const ZHSProject = Project.create({
if (course) {
// 存在则累加时间
course.time = course.time + val;
// 历史遗留问题,之前的倍速没有转换为数字,导致可能显示为字符串
if (typeof course.time === 'string') {
course.time = parseFloat(course.time);
}
} else {
// 不存在则新建
courses.push({ name: courseName, time: 0 });
Expand Down Expand Up @@ -235,6 +239,10 @@ export const ZHSProject = Project.create({
onactive() {
// 重置时间
this.cfg.stopTime = '0';
if (this.cfg.playbackRate) {
// 转换为数字
this.cfg.playbackRate = parseFloat(this.cfg.playbackRate.toString());
}
},
async oncomplete() {
// 置顶当前脚本
Expand Down

0 comments on commit eb4cbc1

Please sign in to comment.