forked from laorange/paper-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request laorange#4 from laorange/dev
v1.1.0
- Loading branch information
Showing
26 changed files
with
263 additions
and
136 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,15 @@ | ||
<script setup lang="ts"> | ||
import {computed} from "vue"; | ||
import {useStore} from "../../store/useStore"; | ||
import UpdateLogDisplayUnit from "../components/UpdatedLogDisplayUnit.vue"; | ||
import InputArea from "./components/InputArea.vue"; | ||
import InputFuncButtons from "./components/InputFuncButtons.vue"; | ||
import OutputArea from "./components/OutputArea.vue"; | ||
import OutputFuncButtons from "./components/OutputFuncButtons.vue"; | ||
import TextHandlerConfig from "./components/TextHandlerConfig.vue"; | ||
import ThemeConfig from "./components/ThemeConfig.vue"; | ||
import HelpButton from "./components/HelpButton.vue"; | ||
import SelectionReplace from "./components/SelectionReplace.vue"; | ||
const store = useStore(); | ||
const cols = computed<string>(() => { | ||
if (store.copy.inputText.length > 500) { | ||
// 输入文本过长,转为在一行显示 | ||
return `1`; | ||
} else if (store.copy.outputText.length === 0) { | ||
return `1`; | ||
} else { | ||
return `1 850:2`; | ||
} | ||
}); | ||
import HeaderArea from "./components/HeaderArea/HeaderArea.vue"; | ||
import InputAndOutputArea from "./components/InputAndOutputArea/InputAndOutputArea.vue"; | ||
</script> | ||
|
||
<template> | ||
<div class="article-copy-tool"> | ||
<header> | ||
<h1>论文工具</h1> | ||
<n-space vertical> | ||
<n-space wrap="wrap" justify="center"> | ||
<n-space> | ||
<HelpButton/> | ||
<TextHandlerConfig/> | ||
</n-space> | ||
<n-space> | ||
<ThemeConfig/> | ||
<UpdateLogDisplayUnit v-model:show="store.showUpdateLog"/> | ||
</n-space> | ||
</n-space> | ||
<SelectionReplace/> | ||
</n-space> | ||
</header> | ||
|
||
<n-grid :cols="cols" x-gap="10" y-gap="20"> | ||
<n-gi> | ||
<InputArea/> | ||
<InputFuncButtons/> | ||
</n-gi> | ||
|
||
<n-gi v-if="store.copy.outputText.length"> | ||
<OutputArea/> | ||
<OutputFuncButtons/> | ||
</n-gi> | ||
</n-grid> | ||
<HeaderArea title="论文工具"/> | ||
<InputAndOutputArea/> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
h1 { | ||
text-align: center; | ||
} | ||
header { | ||
margin-bottom: 15px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-items: center; | ||
align-items: center; | ||
} | ||
</style> |
47 changes: 47 additions & 0 deletions
47
src/pages/article-copy-tool/components/HeaderArea/HeaderArea.vue
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,47 @@ | ||
<script setup lang="ts"> | ||
import UpdateLogDisplayUnit from "./components/UpdatedLogDisplayUnit.vue"; | ||
import TextHandlerConfig from "./components/TextHandlerConfig.vue"; | ||
import ThemeConfig from "./components/ThemeConfig.vue"; | ||
import HelpButton from "./components/HelpButton.vue"; | ||
import SelectionReplace from "./components/SelectionReplace/SelectionReplace.vue"; | ||
import AdditionalConfig from "./components/AdditionalConfig/AdditionalConfig.vue"; | ||
import {useStore} from "../../../../store/useStore"; | ||
defineProps<{ title: string }>(); | ||
const store = useStore(); | ||
</script> | ||
|
||
<template> | ||
<header> | ||
<h1>{{ title }}</h1> | ||
<n-space vertical> | ||
<n-space wrap="wrap" justify="center"> | ||
<n-space> | ||
<HelpButton/> | ||
<TextHandlerConfig/> | ||
</n-space> | ||
<n-space> | ||
<ThemeConfig/> | ||
<UpdateLogDisplayUnit v-model:show="store.showUpdateLog"/> | ||
</n-space> | ||
</n-space> | ||
<AdditionalConfig/> | ||
<SelectionReplace/> | ||
</n-space> | ||
</header> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
header { | ||
margin-bottom: 5px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-items: center; | ||
align-items: center; | ||
h1 { | ||
text-align: center; | ||
} | ||
} | ||
</style> |
53 changes: 53 additions & 0 deletions
53
.../article-copy-tool/components/HeaderArea/components/AdditionalConfig/AdditionalConfig.vue
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,53 @@ | ||
<script setup lang="ts"> | ||
import {useStore} from "../../../../../../store/useStore"; | ||
import ConfigSwitchButton from "./components/ConfigSwitchButton.vue"; | ||
import useClipboard from "vue-clipboard3"; | ||
import {onBeforeUnmount, onMounted} from "vue"; | ||
import {useMessage} from "naive-ui"; | ||
const store = useStore(); | ||
const {toClipboard} = useClipboard(); | ||
const message = useMessage(); | ||
const THRESHOLD_WIDTH = 600; | ||
const hasNotEnoughWidth = document.body.clientWidth < THRESHOLD_WIDTH; | ||
function onLeavePage() { | ||
if (document.hidden) { | ||
if (store.storage.copy.copyOutputWhenLeave && store.copy.outputText) { | ||
toClipboard(store.copy.outputText).then(() => message.success("复制输出文本: 成功")); | ||
} | ||
if (store.storage.copy.clearInputWhenLeave) store.copy.inputText = ""; | ||
} | ||
} | ||
onMounted(() => { | ||
document.addEventListener("visibilitychange", onLeavePage); | ||
if (hasNotEnoughWidth) { | ||
store.storage.copy.horizontalLayout = false; | ||
} | ||
}); | ||
onBeforeUnmount(() => { | ||
document.removeEventListener("visibilitychange", onLeavePage); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<n-space justify="center" align="center" wrap="wrap"> | ||
<n-space> | ||
<ConfigSwitchButton class="clear-input-when-leave-switch" label="自动清空输入" v-model:status="store.storage.copy.clearInputWhenLeave"/> | ||
<ConfigSwitchButton class="copy-output-when-leave-switch" label="自动复制输出" v-model:status="store.storage.copy.copyOutputWhenLeave"/> | ||
</n-space> | ||
<n-space> | ||
<ConfigSwitchButton class="auto-output-switch" label="实时输出" v-model:status="store.storage.copy.autoOutput"/> | ||
<ConfigSwitchButton class="horizontal-layout-switch" label="布局方式" v-model:status="store.storage.copy.horizontalLayout" | ||
true-label="水平" false-label="竖直" :disabled="hasNotEnoughWidth"/> | ||
</n-space> | ||
</n-space> | ||
</template> | ||
|
||
<style scoped> | ||
</style> |
28 changes: 28 additions & 0 deletions
28
...-tool/components/HeaderArea/components/AdditionalConfig/components/ConfigSwitchButton.vue
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,28 @@ | ||
<script setup lang="ts"> | ||
import {computed} from "vue"; | ||
const props = withDefaults(defineProps<{ | ||
label: string, status: boolean, trueLabel?: string, falseLabel?: string, disabled?: boolean, | ||
}>(), {trueLabel: "开", falseLabel: "关"}); | ||
const emits = defineEmits(["update:status"]); | ||
const statusLocal = computed<boolean>({ | ||
get: () => props.status, | ||
set: (newValue) => emits("update:status", newValue), | ||
}); | ||
const statusString = computed(() => statusLocal.value ? props.trueLabel : props.falseLabel); | ||
</script> | ||
|
||
<template> | ||
<n-button @click="statusLocal = !statusLocal" | ||
tertiary | ||
:disabled="!!disabled" | ||
:type="statusLocal ? `primary` : `default`"> | ||
{{ label }}:{{ statusString }} | ||
</n-button> | ||
</template> | ||
|
||
<style scoped> | ||
</style> |
2 changes: 1 addition & 1 deletion
2
...ticle-copy-tool/components/HelpButton.vue → ...ents/HeaderArea/components/HelpButton.vue
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
6 changes: 3 additions & 3 deletions
6
...copy-tool/components/SelectionReplace.vue → ...nts/SelectionReplace/SelectionReplace.vue
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
File renamed without changes.
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
2 changes: 1 addition & 1 deletion
2
...icle-copy-tool/components/ThemeConfig.vue → ...nts/HeaderArea/components/ThemeConfig.vue
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
2 changes: 1 addition & 1 deletion
2
...ages/components/UpdatedLogDisplayUnit.vue → ...Area/components/UpdatedLogDisplayUnit.vue
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.