Skip to content

Commit

Permalink
feat(toolbox): 翻译工具写入校对信息
Browse files Browse the repository at this point in the history
  • Loading branch information
mark9804 committed May 2, 2024
1 parent f7c3cc6 commit e89415d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
<template #unchecked> 否 </template>
</n-switch>
</n-space>
<span style="flex: 1">翻译: </span
<span style="flex: 1">{{ config.isProofread ? "校对" : "翻译" }}: </span
><n-input
:placeholder="mainStore.getScenario.translator || '请输入姓名'"
@input="mainStore.setTranslator($event)"
:value="
config.isProofread
? config.getProofreader
: mainStore.getScenario.translator || '请输入姓名'
"
@input="handleStaffChange($event)"
></n-input
></n-space>
<n-tooltip>
Expand Down Expand Up @@ -46,8 +50,6 @@ import { computed, ref } from "vue";
import { useGlobalConfig } from "../store/configStore";
import { useScenarioStore } from "../store/scenarioEditorStore";
// import { Scenario } from '../types/content';
const mainStore = useScenarioStore();
const config = useGlobalConfig();
const hasFileSaved = ref(false);
Expand Down Expand Up @@ -94,6 +96,14 @@ function handleClearAllRequest() {
function handlePreviewModeRequest() {
config.setPreviewMode(!isPreviewMode.value);
}
function handleStaffChange(event: Event) {
if (config.isProofread) {
mainStore.setProofreader(event);
} else {
mainStore.setTranslator(event);
}
}
</script>
<style scoped lang="scss">
.footer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { defineStore } from 'pinia';
import { ContentLine, Scenario } from '../types/content';
import { defineStore } from "pinia";
import { ContentLine, Scenario } from "../types/content";

export type Language =
| 'TextCn'
| 'TextTw'
| 'TextJp'
| 'TextEn'
| 'TextKr'
| 'TextTh';
| "TextCn"
| "TextTw"
| "TextJp"
| "TextEn"
| "TextKr"
| "TextTh";

export const useScenarioStore = defineStore({
id: 'scenarioStore',
id: "scenarioStore",
state: () => {
return {
fileLoad: false,
scenario: {} as Scenario,
title: '',
title: "",
};
},
persist: true,
Expand Down Expand Up @@ -50,6 +50,7 @@ export const useScenarioStore = defineStore({
}
return prevLine + 1;
},
getProofreader: state => state.scenario.proofreader || "",
},
actions: {
loadFile() {
Expand All @@ -65,6 +66,9 @@ export const useScenarioStore = defineStore({
setTranslator(translator: string) {
this.scenario.translator = translator;
},
setProofreader(proofreader: string) {
this.scenario.proofreader = proofreader;
},
setContentLine(content: ContentLine, line: number) {
this.scenario.content[line] = content;
},
Expand All @@ -73,7 +77,7 @@ export const useScenarioStore = defineStore({
},
clearAll() {
this.scenario = {} as Scenario;
this.title = '';
this.title = "";
this.fileLoad = false;
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ export type Language =
export interface Scenario {
GroupId: number;
translator: string;
proofreader?: string;
content: ContentLine[];
}

0 comments on commit e89415d

Please sign in to comment.