Skip to content

Commit bb2818f

Browse files
committed
test
1 parent 851b303 commit bb2818f

File tree

4 files changed

+14
-40
lines changed

4 files changed

+14
-40
lines changed

.eslintrc.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ module.exports = {
1313
ecmaVersion: 2020
1414
},
1515
rules: {
16-
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
17-
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
16+
'no-console': 'off',
17+
'no-debugger': 'off',
1818
indent: 0,
1919
'space-before-function-paren': 0,
2020
semi: 0,
@@ -25,6 +25,6 @@ module.exports = {
2525
"prefer-const": ["off", {
2626
destructuring: "any",
2727
ignoreReadBeforeAssign: true
28-
}]
28+
}],
2929
}
3030
}

src/api/core/adapters/gcryptV1/adapter.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Created Date: 2023-11-26 17:14:30
55
* Author: Guoyi
66
* -----
7-
* Last Modified: 2024-02-18 23:41:34
7+
* Last Modified: 2024-02-19 09:19:51
88
* Modified By: Guoyi
99
* -----
1010
* Copyright (c) 2024 Guoyi Inc.
@@ -45,15 +45,11 @@ class GcryptV1Adapter implements AdapterBase {
4545
items: []
4646
}
4747
await this.KVPEngine.setData("entryKey", Buffer.from(entryKey))
48-
console.log("adapter.js-1")
4948
await this.KVPEngine.setData(entryKey, Buffer.from(JSON.stringify(fileTableData)))
50-
console.log("adapter.js-2")
5149
}
5250

5351
this.currentDirectory = new Addr("")
54-
console.log("adapter.js-3")
5552
this.currentFileTable = await this._getFileTable(this.currentDirectory)
56-
console.log("adapter.js-4")
5753
}
5854

5955
/**
@@ -109,7 +105,6 @@ class GcryptV1Adapter implements AdapterBase {
109105
return this.cachedFileTables[i].fileTable
110106
}
111107
}
112-
console.log("adapter.ts-5-缓存未命中-final")
113108

114109
// 缓存未命中
115110
if (foo.isRoot()) {

src/components/FileMgr/FileMgr.vue

+10-29
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,11 @@ const ClipBoardRef = ref()
207207
// <生命周期&初始化>
208208
const initAll = async () => {
209209
isLoading.value = true
210-
console.log("FileMgr.vue-1")
211210
212211
await gotoDir(props.adapter.getCurrentDirectory(), true)
213-
console.log("FileMgr.vue-2")
214212
watch(viewOptions, (newVal, oldVal) => {
215213
// 保存viewOptions
216-
console.log("FileMgr.vue-3")
217-
tryToSaveViewOptions(oldVal).then(() => {
218-
console.log("FileMgr.vue-4")
219-
})
214+
tryToSaveViewOptions(oldVal)
220215
}, { deep: true })
221216
222217
isLoading.value = false
@@ -237,7 +232,7 @@ const mergeOptions = () => {
237232
const options = reactive(mergeOptions())
238233
239234
onMounted(async () => {
240-
await initAll()
235+
initAll()
241236
})
242237
243238
// <核心功能-文件相关>
@@ -250,34 +245,20 @@ watch(() => props.directory, async (newVal) => {
250245
const gotoDir = async (arg: Addr, pushHistory: boolean) => {
251246
isLoading.value = true
252247
// 保存布局选项
253-
console.log("[2]FileMgr.vue-1")
254-
255248
await tryToSaveViewOptions()
256-
console.log("[2]FileMgr.vue-2")
257249
258250
// adapter切换当前目录
259251
await props.adapter.changeCurrentDirectory(arg)
260-
console.log("[2]FileMgr.vue-3")
261-
262252
// 更改currentFileTable
263253
currentDir.value = arg
264-
console.log("[2]FileMgr.vue-4")
265-
266254
currentFileTable.value = await props.adapter.getCurrentFileTable()
267-
console.log("[2]FileMgr.vue-5")
268255
269256
// 加载新的布局选项
270257
await tryToGetAndApplyViewOptions()
271-
console.log("[2]FileMgr.vue-6")
272-
273258
// 取消选择的所有item
274259
selectedItems.value.clear()
275-
console.log("[2]FileMgr.vue-7")
276-
277260
if (pushHistory) {
278-
console.log("[2]FileMgr.vue-8")
279261
operationHistory.value.push(lodash.cloneDeep(arg))
280-
console.log("[2]FileMgr.vue-9")
281262
}
282263
isLoading.value = false
283264
}
@@ -480,7 +461,7 @@ const handleFileImportClick = () => {
480461
}
481462
482463
// <外观选择相关>
483-
const viewOptions = ref<ViewOptions>({
464+
const defaultViewOptions = {
484465
itemDisplayMode: 1, // 0 list, 1 item
485466
itemSize: 5, // 区间[0,10]的整数, '5' stands for medium size
486467
sortBy: 0, // 0 name, 1 timeModify
@@ -489,7 +470,9 @@ const viewOptions = ref<ViewOptions>({
489470
showHiddenItem: 1,
490471
showExtName: 1,
491472
showThumbnails: 1
492-
})
473+
}
474+
475+
const viewOptions = ref<ViewOptions>(defaultViewOptions)
493476
494477
/**
495478
* 尝试保存布局选项
@@ -498,13 +481,11 @@ const tryToSaveViewOptions = async (optionsIn?: ViewOptions) => {
498481
if (!props.adapter.setExtraMeta || !options.allowSavingViewOptions || !currentFileTable.value) {
499482
return
500483
}
501-
console.log("FileMgr.vue-5")
502484
try {
503485
await props.adapter.setExtraMeta(
504486
currentFileTable.value.selfKey,
505487
'viewOptions',
506488
Buffer.from(JSON.stringify(viewOptions.value ?? optionsIn)))
507-
console.log("FileMgr.vue-6-final")
508489
} catch (e) {
509490
warn('尝试保存布局选项失败' + e.toString())
510491
}
@@ -518,11 +499,11 @@ const tryToGetAndApplyViewOptions = async () => {
518499
return
519500
}
520501
try {
521-
console.log('[3]-1')
522-
console.log(await props.adapter.getExtraMeta(currentFileTable.value.selfKey, 'viewOptions'))
523-
console.log((await props.adapter.getExtraMeta(currentFileTable.value.selfKey, 'viewOptions')).toString())
502+
if (!(await props.adapter.hasExtraMeta(currentFileTable.value.selfKey, 'viewOptions'))) {
503+
viewOptions.value = defaultViewOptions
504+
return
505+
}
524506
const obj = JSON.parse((await props.adapter.getExtraMeta(currentFileTable.value.selfKey, 'viewOptions')).toString())
525-
console.log('[3]-2')
526507
if (obj) {
527508
viewOptions.value = obj
528509
}

src/store/encryption.ts

-2
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ export const useEncryptionStore = defineStore("encryption", {
9999
await encryptionEngine.init(password)
100100
await KVPEngine.init(entryFileSrc, password, encryptionEngine)
101101
await adapter.initAdapter(KVPEngine, adapterGuid)
102-
console.log("encryption.ts-1")
103102
} catch (e) {
104-
console.log(e)
105103
notification.error("加载加密库失败:" + e.toString())
106104
error("加载加密库失败:" + e.toString())
107105
}

0 commit comments

Comments
 (0)