ow
This commit is contained in:
1 parent
936cd3b940
commit
ac0112b4a3
20 files changed
+169
-99
No files matched your search
@@ -219,7 +219,6 @@
|
||||
<text class="file-name" @click="onPickBackup(b)">{{ b.name }}</text>
|
||||
<view class="file-acts">
|
||||
<view class="ico ico-path" @click.stop="onShowPath(b)"></view>
|
||||
<view class="ico ico-share" @click.stop="onShareFile(b)"></view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -243,7 +242,7 @@ import { listPasswords, getPassword, savePassword, deletePassword, getSessionKey
|
||||
import { generatePassword } from '@/utils/crypto';
|
||||
import { pickImageAsBase64 } from '@/utils/image';
|
||||
// #ifdef APP-PLUS
|
||||
import { exportBackupFile, shareBackupFile, listBackupFiles, readBackupFile, clearBackupFiles, pickSecFile, readBackupFromUri } from '@/utils/backup';
|
||||
import { exportBackupFile, listBackupFiles, readBackupFile, clearBackupFiles, pickSecFile, readBackupFromUri } from '@/utils/backup';
|
||||
// #endif
|
||||
|
||||
const ADVANCED = '高级';
|
||||
@@ -496,9 +495,8 @@ async function onExport() {
|
||||
}
|
||||
try {
|
||||
const dump = await getExportPlainDump();
|
||||
const url = await exportBackupFile(dump, pwd);
|
||||
uni.showToast({ title: '备份已生成', icon: 'none' });
|
||||
await shareBackupFile(url);
|
||||
await exportBackupFile(dump, pwd);
|
||||
uni.showToast({ title: '备份已生成,可在导入列表查看', icon: 'none' });
|
||||
} catch (e: any) {
|
||||
uni.showToast({ title: e?.message || '导出失败', icon: 'none' });
|
||||
}
|
||||
@@ -526,15 +524,15 @@ async function onPickBackup(item: { name: string; localUrl: string }) {
|
||||
}
|
||||
|
||||
async function onPickFromFiles() {
|
||||
const uri = await pickSecFile();
|
||||
if (!uri) {
|
||||
uni.showToast({ title: '未选择文件', icon: 'none' });
|
||||
const picked = await pickSecFile();
|
||||
if (!picked.uri) {
|
||||
uni.showToast({ title: picked.error || '未选择文件', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
const pwd = await askPassword('输入所选备份文件的密码');
|
||||
if (pwd === null) return;
|
||||
try {
|
||||
const dump = await readBackupFromUri(uri, pwd);
|
||||
const dump = await readBackupFromUri(picked.uri, pwd);
|
||||
confirmRestore(dump, pwd);
|
||||
} catch (e: any) {
|
||||
uni.showToast({ title: e?.message || '恢复失败', icon: 'none' });
|
||||
@@ -586,14 +584,10 @@ function onShowPath(item: { name: string; localUrl: string }) {
|
||||
uni.showModal({ title: '文件路径', content: item.localUrl, showCancel: false, confirmText: '知道了' });
|
||||
}
|
||||
|
||||
async function onShareFile(item: { name: string; localUrl: string }) {
|
||||
await shareBackupFile(item.localUrl);
|
||||
}
|
||||
|
||||
function onClearBackupFiles() {
|
||||
uni.showModal({
|
||||
title: '清空备份文件',
|
||||
content: '将删除本机 _doc/backups 下所有 .sec 备份(已分享到外部的副本不受影响)。确定继续?',
|
||||
content: '将删除本机 _doc/backups 下所有 .sec 备份(已转移到外部的副本不受影响)。确定继续?',
|
||||
confirmText: '清空',
|
||||
confirmColor: '#e53935',
|
||||
success: async (res) => {
|
||||
@@ -1053,7 +1047,6 @@ async function onSave() {
|
||||
.file-acts {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.ico-path {
|
||||
@@ -1062,12 +1055,6 @@ async function onSave() {
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235a6472'%3E%3Cpath d='M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
.ico-share {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235a6472'%3E%3Cpath d='M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z'/%3E%3C/svg%3E");
|
||||
}
|
||||
|
||||
.list {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user