22import { toTypedSchema } from ' @vee-validate/yup'
33import { Field , Form } from ' vee-validate'
44import * as yup from ' yup'
5- import { documentStorage } from ' @/utils/documentStorage'
6- import { store } from ' @/utils'
75import { usePostStore } from ' @/stores/post'
6+ import { store } from ' @/utils'
7+ import { documentStorage } from ' @/utils/documentStorage'
88
9- const emit = defineEmits ([` close ` ])
109const isOpen = defineModel <boolean >(` open ` , { default: false })
1110
1211const postStore = usePostStore ()
@@ -95,14 +94,8 @@ async function changeDocStorage() {
9594 }
9695
9796 // 确认切换
98- const confirmed = await new Promise ((resolve ) => {
99- if (window .confirm (` 切换存储平台将同步当前数据到新平台,是否继续? ` )) {
100- resolve (true )
101- }
102- else {
103- resolve (false )
104- }
105- })
97+ // eslint-disable-next-line no-alert
98+ const confirmed = window .confirm (` 切换存储平台将同步当前数据到新平台,是否继续? ` )
10699
107100 if (! confirmed ) {
108101 // 回滚选择
@@ -170,7 +163,7 @@ async function manualSync() {
170163 // 同步文档和配置
171164 await documentStorage .saveDocuments (currentDocuments )
172165 await documentStorage .saveCurrentDocumentId (currentId )
173-
166+
174167 if (config ) {
175168 await documentStorage .saveProjectConfig (config )
176169 toast .success (` 文档和配置已同步到云端 ` )
@@ -194,14 +187,8 @@ async function loadFromCloud() {
194187 return
195188 }
196189
197- const confirmed = await new Promise ((resolve ) => {
198- if (window .confirm (` 从云端加载将覆盖本地所有数据(包括文档和配置),是否继续? ` )) {
199- resolve (true )
200- }
201- else {
202- resolve (false )
203- }
204- })
190+ // eslint-disable-next-line no-alert
191+ const confirmed = window .confirm (` 从云端加载将覆盖本地所有数据(包括文档和配置),是否继续? ` )
205192
206193 if (! confirmed ) {
207194 return
@@ -226,7 +213,7 @@ async function loadFromCloud() {
226213 const localEngine = new (await import (' @/utils/documentStorage' )).LocalStorageDocumentEngine ()
227214 await localEngine .saveProjectConfig (result .config )
228215 console .log (' 配置已保存到 localStorage' )
229-
216+
230217 toast .success (` 文档和配置已从云端加载,刷新页面以应用配置 ` )
231218 }
232219 else {
@@ -323,7 +310,7 @@ onMounted(async () => {
323310 </Alert >
324311
325312 <div v-if =" docStorageType !== 'localStorage'" class =" flex gap-2" >
326- <Button @click = " testConnection " :disabled = " isSyncing " >
313+ <Button :disabled = " isSyncing " @click = " testConnection " >
327314 测试连接
328315 </Button >
329316 <Badge v-if =" connectionStatus === true" variant =" success" >
@@ -484,7 +471,7 @@ onMounted(async () => {
484471 </div >
485472
486473 <div class =" flex flex-col gap-2" >
487- <Button @click = " manualSync " :disabled =" isSyncing || docStorageType === 'localStorage'" >
474+ <Button :disabled =" isSyncing || docStorageType === 'localStorage'" @click = " manualSync " >
488475 <template v-if =" isSyncing " >
489476 同步中...
490477 </template >
@@ -493,7 +480,7 @@ onMounted(async () => {
493480 </template >
494481 </Button >
495482
496- <Button variant =" outline" @click = " loadFromCloud " :disabled =" isSyncing || docStorageType === 'localStorage'" >
483+ <Button variant =" outline" :disabled =" isSyncing || docStorageType === 'localStorage'" @click = " loadFromCloud " >
497484 从云端加载
498485 </Button >
499486 </div >
@@ -504,7 +491,7 @@ onMounted(async () => {
504491 </AlertDescription >
505492 </Alert >
506493
507- <Alert variant = " warning " >
494+ <Alert >
508495 <AlertDescription >
509496 <strong >注意:</strong >从云端加载会覆盖本地所有文档数据,请谨慎操作!
510497 </AlertDescription >
0 commit comments