Skip to content

Commit f607a0d

Browse files
authored
Fix: Repeat the shortcut keys for "Next" and "Skip"
1 parent 6bdb0e4 commit f607a0d

File tree

5 files changed

+30
-36
lines changed

5 files changed

+30
-36
lines changed
Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<script setup lang="ts">
2-
3-
import { GITHUB } from "../config/env.ts";
4-
import ChannelIcons from "../components/channel-icons/ChannelIcons.vue";
5-
import WeChat from "../components/channel-icons/WeChat.vue";
2+
import { APP_NAME, GITHUB } from '../config/env.ts'
3+
import ChannelIcons from '../components/channel-icons/ChannelIcons.vue'
4+
import WeChat from '../components/channel-icons/WeChat.vue'
65
</script>
76

87
<template>
9-
<h1>Type Words</h1>
8+
<h1>{{ APP_NAME }}</h1>
109
<div class="w-120">
1110
<p class="text-xl">
1211
{{ $t('about_thanks') }}
@@ -15,29 +14,18 @@ import WeChat from "../components/channel-icons/WeChat.vue";
1514
{{ $t('github_address') }}<a :href="GITHUB" target="_blank">{{ GITHUB }}</a>
1615
</p>
1716
<div class="flex flex-col gap-2 mt-20">
17+
<div class="">常见问题: <RouterLink to="/help">常见问题解答</RouterLink></div>
18+
<div class="flex items-center">{{ $t('about_wechat_feedback') }}<WeChat /></div>
1819
<div class="">
19-
常见问题: <RouterLink to="/help">常见问题解答</RouterLink>
20-
</div>
21-
<div class="flex items-center">
22-
{{ $t('about_wechat_feedback') }}<WeChat/>
23-
</div>
24-
<div class="">
25-
{{ $t('about_ticket_feedback') }}<a :href="`https://v.wjx.cn/vm/ev0W7fv.aspx#`"
26-
target="_blank">https://v.wjx.cn/vm/ev0W7fv.aspx#</a>
20+
{{ $t('about_ticket_feedback')
21+
}}<a :href="`https://v.wjx.cn/vm/ev0W7fv.aspx#`" target="_blank">https://v.wjx.cn/vm/ev0W7fv.aspx#</a>
2722
</div>
2823
<div class="flex items-center">
2924
{{ $t('about_other_channels') }}
30-
<ChannelIcons type="horizontal"
31-
:share="false"
32-
:wechat="false"
33-
:github="false"
34-
/>
25+
<ChannelIcons type="horizontal" :share="false" :wechat="false" :github="false" />
3526
</div>
3627
</div>
37-
3828
</div>
3929
</template>
4030

41-
<style scoped lang="scss">
42-
43-
</style>
31+
<style scoped lang="scss"></style>

packages/core/src/config/env.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ export const SAVE_DICT_KEY = {
7373
//18版本,移除单独保存的 app version字段,转移到 settingStore的webAppVersion里面
7474
//19:修复快捷键下一个单词和跳过单词重复了
7575
//20:修复19版本未导入变量,导致抛错所有用户setting变默认值的bug
76+
//21:修复快捷键下一个单词和跳过单词重复了
7677
export const SAVE_SETTING_KEY = {
7778
key: 'typing-word-setting',
78-
version: 20,
79+
version: 21,
7980
}
8081

8182
//5版本,不再单独保存 app version字段

packages/core/src/stores/setting.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ export const useSettingStore = defineStore('setting', {
153153
let configStr = await get(SAVE_SETTING_KEY.key)
154154
let data = await checkAndUpgradeSaveSetting(configStr)
155155

156-
//特殊处理
157-
const shouldRefreshUpdatedAt = !!(data as any)?.__firstTimePatchedFromSnapshot ?? false
158-
delete (data as any)?.__firstTimePatchedFromSnapshot
156+
//如果升级了,那么要保持本地比线上新,不然会被覆盖
157+
const shouldRefreshUpdatedAt = (data as any)?.__updateLocalData ?? false
158+
delete (data as any)?.__updateLocalData
159159
if (shouldRefreshUpdatedAt) {
160160
await set(
161161
SAVE_SETTING_KEY.key,

packages/core/src/utils/http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { AppEnv, ENV } from '../config/env.ts'
44
import { Toast } from '@typewords/base'
55

66
export const axiosInstance: AxiosInstance = axios.create({
7-
baseURL: ENV.API,
7+
// baseURL: ENV.API,
88
timeout: 15000,
99
})
1010

packages/core/src/utils/index.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,22 @@ export async function checkAndUpgradeSaveSetting(val: any) {
122122
let state: SettingState & { [key: string]: any } = data.val
123123
if (typeof state !== 'object') return defaultState
124124
state.load = false
125+
debugger
125126
let version = Number(data.version)
127+
//为了保持永远是最新的快捷键选项列表,但保留住用户的自定义设置,去掉无效的快捷键选项
128+
//例: 2版本,可能有快捷键A。3版本没有了
129+
checkRiskKey(defaultState.shortcutKeyMap, state.shortcutKeyMap)
130+
131+
let updateLocalData = false
126132
if (version <= 17) {
127133
defaultState.webAppVersion = (await get(APP_VERSION.key)) ?? APP_VERSION.version
128-
}
129-
if (version <= 18) {
130-
defaultState.shortcutKeyMap[ShortcutKey.Next] = DefaultShortcutKeyMap[ShortcutKey.Next]
134+
updateLocalData = true
131135
}
132136
//3/20晚上10点25推的代码,这个地方出了一个bug,ShortcutKey没导入,导致抛异常后返回了默认值,所有的用户的setting都变成默认值了。
133137
//在这里读取之前的快照,如果存在则从里面读取setting的firstTime,
134138
//判断是否与当前值相等,不相等则取快照的值并将本地的update_at更新,以免被远程覆盖
135139
if (version === 19) {
136140
try {
137-
let firstTimePatchedFromSnapshot = false
138141
const snapshotCutoffTime = new Date('2026-03-20T22:25:00+08:00').getTime()
139142
const rawIndex = (await get(BACKUP_INDEX_KEY)) as Array<{ key?: string; createdAt?: number }> | null
140143
const index = Array.isArray(rawIndex) ? rawIndex : []
@@ -154,20 +157,22 @@ export async function checkAndUpgradeSaveSetting(val: any) {
154157
const currentFirstTime = Number(state?.firstTime)
155158
if (Number.isFinite(snapshotFirstTime) && snapshotFirstTime > 0 && snapshotFirstTime !== currentFirstTime) {
156159
state.firstTime = snapshotFirstTime
157-
firstTimePatchedFromSnapshot = true
160+
updateLocalData = true
158161
}
159-
;(defaultState as any).__firstTimePatchedFromSnapshot = firstTimePatchedFromSnapshot
160162
}
161163
} catch (e) {
162164
console.warn('firstTime 快照回填跳过或失败,忽略并继续', e)
163165
}
164166
}
165167

166-
//为了保持永远是最新的快捷键选项列表,但保留住用户的自定义设置,去掉无效的快捷键选项
167-
//例: 2版本,可能有快捷键A。3版本没有了
168-
checkRiskKey(defaultState.shortcutKeyMap, state.shortcutKeyMap)
168+
if (version <= 20) {
169+
defaultState.shortcutKeyMap[ShortcutKey.Next] = DefaultShortcutKeyMap[ShortcutKey.Next]
170+
updateLocalData = true
171+
}
172+
169173
delete state.shortcutKeyMap
170174
checkRiskKey(defaultState, state)
175+
;(defaultState as any).__updateLocalData = updateLocalData
171176
return defaultState
172177
} catch (e) {
173178
await saveHashSnapshot('数据解析异常-自动备份', '')

0 commit comments

Comments
 (0)