Skip to content

Commit

Permalink
feat: 统一导入导出配置
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Feb 21, 2023
1 parent 3da5fcf commit 99ca865
Show file tree
Hide file tree
Showing 8 changed files with 341 additions and 70 deletions.
99 changes: 37 additions & 62 deletions components.d.ts
@@ -1,75 +1,50 @@
/*
* Copyright (c) 2023, Terwer . All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Terwer designates this
* particular file as subject to the "Classpath" exception as provided
* by Terwer in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
* or visit www.terwer.space if you need additional information or have any
* questions.
*/

/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import "@vue/runtime-core";
import '@vue/runtime-core'

export {}

declare module "@vue/runtime-core" {
declare module '@vue/runtime-core' {
export interface GlobalComponents {
ElAlert: typeof import("element-plus/es")["ElAlert"]
ElAutocomplete: typeof import("element-plus/es")["ElAutocomplete"]
ElButton: typeof import("element-plus/es")["ElButton"]
ElButtonGroup: typeof import("element-plus/es")["ElButtonGroup"]
ElCard: typeof import("element-plus/es")["ElCard"]
ElCheckbox: typeof import("element-plus/es")["ElCheckbox"]
ElCheckboxGroup: typeof import("element-plus/es")["ElCheckboxGroup"]
ElCol: typeof import("element-plus/es")["ElCol"]
ElContainer: typeof import("element-plus/es")["ElContainer"]
ElDatePicker: typeof import("element-plus/es")["ElDatePicker"]
ElDialog: typeof import("element-plus/es")["ElDialog"]
ElForm: typeof import("element-plus/es")["ElForm"]
ElFormItem: typeof import("element-plus/es")["ElFormItem"]
ElHeader: typeof import("element-plus/es")["ElHeader"]
ElIcon: typeof import("element-plus/es")["ElIcon"]
ElInput: typeof import("element-plus/es")["ElInput"]
ElMain: typeof import("element-plus/es")["ElMain"]
ElOption: typeof import("element-plus/es")["ElOption"]
ElPageHeader: typeof import("element-plus/es")["ElPageHeader"]
ElPagination: typeof import("element-plus/es")["ElPagination"]
ElPopover: typeof import("element-plus/es")["ElPopover"]
ElRadio: typeof import("element-plus/es")["ElRadio"]
ElRadioGroup: typeof import("element-plus/es")["ElRadioGroup"]
ElRow: typeof import("element-plus/es")["ElRow"]
ElSelect: typeof import("element-plus/es")["ElSelect"]
ElSkeleton: typeof import("element-plus/es")["ElSkeleton"]
ElSwitch: typeof import("element-plus/es")["ElSwitch"]
ElTable: typeof import("element-plus/es")["ElTable"]
ElTableColumn: typeof import("element-plus/es")["ElTableColumn"]
ElTabPane: typeof import("element-plus/es")["ElTabPane"]
ElTabs: typeof import("element-plus/es")["ElTabs"]
ElTag: typeof import("element-plus/es")["ElTag"]
ElTooltip: typeof import("element-plus/es")["ElTooltip"]
ElTreeSelect: typeof import("element-plus/es")["ElTreeSelect"]
ElAlert: typeof import('element-plus/es')['ElAlert']
ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
ElCard: typeof import('element-plus/es')['ElCard']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCol: typeof import('element-plus/es')['ElCol']
ElContainer: typeof import('element-plus/es')['ElContainer']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import('element-plus/es')['ElHeader']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElInput: typeof import('element-plus/es')['ElInput']
ElMain: typeof import('element-plus/es')['ElMain']
ElOption: typeof import('element-plus/es')['ElOption']
ElPageHeader: typeof import('element-plus/es')['ElPageHeader']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
}
export interface ComponentCustomProperties {
vLoading: typeof import("element-plus/es")["ElLoadingDirective"]
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}
88 changes: 88 additions & 0 deletions components/transport/ClearData.vue
@@ -0,0 +1,88 @@
<!--
- Copyright (c) 2023, Terwer . All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation. Terwer designates this
- particular file as subject to the "Classpath" exception as provided
- by Terwer in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
- or visit www.terwer.space if you need additional information or have any
- questions.
-->

<template>
<div>
<el-card class="box-card">
<template #header>
<div class="card-header">
<el-button type="primary" @click="handleClearSyp"
>{{ $t("setting.conf.clear.syp") }}
</el-button>
</div>
</template>
<el-alert
:title="$t('setting.conf.clear.tip')"
type="error"
:closable="false"
/>
</el-card>

<el-card class="box-card" v-if="isElectron">
<template #header>
<div class="card-header">
<el-button type="danger" @click="handleClearPicgo"
>{{ $t("setting.conf.clear.picgo") }}
</el-button>
</div>
</template>
<el-alert
:title="$t('setting.conf.clear.tip')"
type="error"
:closable="false"
/>
</el-card>
</div>
</template>

<script lang="ts" setup>
import { ElMessageBox } from "element-plus"
import { useI18n } from "vue-i18n"
import { clearConf } from "~/utils/configUtil"
import browserUtil, { isElectron } from "~/utils/browserUtil"
const { t } = useI18n()
const handleClearSyp = () => {
ElMessageBox.confirm(t("main.opt.warning.tip"), t("main.opt.warning"), {
confirmButtonText: t("main.opt.ok"),
cancelButtonText: t("main.opt.cancel"),
type: "warning",
})
.then(async () => {
clearConf()
browserUtil.reloadPageWithMessage(t("main.opt.success"))
})
.catch(() => {
// ElMessage({
// type: 'error',
// message: t("main.opt.failure"),
// })
})
}
const handleClearPicgo = () => {}
</script>
77 changes: 77 additions & 0 deletions components/transport/ExportData.vue
@@ -0,0 +1,77 @@
<!--
- Copyright (c) 2023, Terwer . All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation. Terwer designates this
- particular file as subject to the "Classpath" exception as provided
- by Terwer in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
- or visit www.terwer.space if you need additional information or have any
- questions.
-->

<template>
<div>
<el-card class="box-card">
<template #header>
<div class="card-header">
<el-button type="primary" @click="handleExportSyp">
{{ $t("setting.conf.export.syp") }}
</el-button>
</div>
<el-alert
:title="$t('setting.conf.export.syp.tip')"
type="success"
:closable="false"
/>
</template>
</el-card>

<el-card class="box-card" v-if="isElectron">
<template #header>
<div class="card-header">
<el-button type="danger" @click="handleExportPicgo">
{{ $t("setting.conf.export.picgo") }}
</el-button>
</div>
</template>
<el-alert
:title="$t('setting.conf.export.syp.tip')"
type="success"
:closable="false"
/>
</el-card>
</div>
</template>

<script lang="ts" setup>
import { isElectron } from "~/utils/browserUtil"
import { exportConf } from "~/utils/configUtil"
import { version } from "../../package.json"
const handleExportSyp = () => {
const confName = `sy-p-cfg-v${version}.json`
exportConf(confName)
}
const handleExportPicgo = () => {}
</script>

<style scoped>
.box-card {
margin-top: 16px;
}
</style>
75 changes: 75 additions & 0 deletions components/transport/ImportData.vue
@@ -0,0 +1,75 @@
<!--
- Copyright (c) 2023, Terwer . All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation. Terwer designates this
- particular file as subject to the "Classpath" exception as provided
- by Terwer in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
- or visit www.terwer.space if you need additional information or have any
- questions.
-->

<template>
<div>
<el-card class="box-card">
<template #header>
<div class="card-header">
<el-button type="primary" @click="handleImportSyp">
{{ $t("setting.conf.import.syp") }}
</el-button>
</div>
</template>
<el-alert
:title="$t('setting.conf.import.syp.tip')"
type="info"
:closable="false"
/>
</el-card>

<el-card class="box-card" v-if="isElectron">
<template #header>
<div class="card-header">
<el-button type="danger" @click="handleImportPicgo">
{{ $t("setting.conf.import.picgo") }}
</el-button>
</div>
</template>
<el-alert
:title="$t('setting.conf.import.picgo.tip')"
type="info"
:closable="false"
/>
</el-card>
</div>
</template>

<script lang="ts" setup>
import { isElectron } from "~/utils/browserUtil"
import { importConf } from "~/utils/configUtil"
const handleImportSyp = async () => {
await importConf()
}
const handleImportPicgo = () => {}
</script>

<style scoped>
.box-card {
margin-top: 16px;
}
</style>
23 changes: 22 additions & 1 deletion components/transport/TransportSelect.vue
Expand Up @@ -24,5 +24,26 @@
-->

<template>
<div>transport</div>
<div>
<el-tabs v-model="activeName" class="transport-tabs">
<el-tab-pane :label="$t('setting.conf.export')" name="export">
<export-data />
</el-tab-pane>
<el-tab-pane :label="$t('setting.conf.import')" name="import">
<import-data />
</el-tab-pane>
<el-tab-pane :label="$t('setting.conf.clear')" name="clear">
<clear-data />
</el-tab-pane>
</el-tabs>
</div>
</template>

<script lang="ts" setup>
import { ref } from "vue"
import ImportData from "~/components/transport/ImportData.vue"
import ExportData from "~/components/transport/ExportData.vue"
import ClearData from "~/components/transport/ClearData.vue"
const activeName = ref("export")
</script>

0 comments on commit 99ca865

Please sign in to comment.