Skip to content

Commit

Permalink
差不多了
Browse files Browse the repository at this point in the history
  • Loading branch information
mark9804 committed Dec 27, 2023
1 parent 1df32b5 commit d2b956c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 47 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@
"dependencies": {
"@arco-design/web-vue": "~2.52.1",
"@arco-plugins/vite-vue": "^1.4.5",
"@tauri-apps/api": "^1.5.2",
"@vueuse/core": "^10.2.1",
"@tauri-apps/api": "^1.5.3",
"@vueuse/core": "^10.7.1",
"autoprefixer": "~10.4.16",
"axios": "^1.6.3",
"fastest-levenshtein": "^1.0.16",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"pinyin-pro": "^3.18.5",
"postcss": "~8.4.31",
"postcss": "~8.4.32",
"postcss-plugin-px2rem": "^0.8.1",
"postcss-preset-env": "^9.2.0",
"tailwindcss": "~3.3.5",
"postcss-preset-env": "^9.3.0",
"tailwindcss": "~3.3.7",
"tauri-settings": "^0.3.4",
"unplugin-auto-import": "^0.16.7",
"unplugin-vue-components": "^0.25.2",
"vue": "^3.3.7"
"vue": "^3.3.13"
},
"devDependencies": {
"@tauri-apps/cli": "^1.5.8",
"@tauri-apps/cli": "^1.5.9",
"@types/node": "^20.10.5",
"@vitejs/plugin-vue": "^5.0.0",
"eslint": "^8.56.0",
"husky": "^8.0.3",
"prettier": "^3.1.1",
"sass": "^1.69.5",
"typescript": "^5.1.6",
"vite": "^5.0.0",
"vue-tsc": "^1.8.5"
"typescript": "^5.3.3",
"vite": "^5.0.10",
"vue-tsc": "^1.8.27"
}
}
72 changes: 36 additions & 36 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/components/SettingsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,24 @@ watch(
}
);
const fetching = ref(false);
async function updateDictionary() {
fetching.value = true;
axios
.get(`https://translator.blue-archive.io/dictionary.json?t=${Date.now()}`)
.then(res => {
if (res.status === 200) {
useDictionary.setDictionary(res.data);
Message.success("词典更新成功");
} else {
throw new Error("获取词典更新失败");
}
})
.catch(err => {
Message.error(err.message);
}).finally(() => {
fetching.value = false;
});
}
Expand Down Expand Up @@ -91,7 +97,7 @@ watch(
</template>
<span>更新词典条目</span>
</a-tooltip>
<a-button type="primary" @click="updateDictionary">
<a-button type="primary" :loading="fetching" @click="updateDictionary">
更新
</a-button>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/utils/filterUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const specialCharacters = new RegExp(
);

export function similarity(s1: string | undefined | null, s2: string | undefined | null): number {
// @ts-ignore
if ([s1, s2].some(s => [undefined, null].includes(s))) return 0;
// @ts-ignore
return 1 - distance(s1, s2) / Math.max(s1.length, s2.length);
}

Expand Down

0 comments on commit d2b956c

Please sign in to comment.