feat: 用户系统 — 注册/登录 + 数据云同步(收藏/最近/记录/书签) + 工具文件云端留档
This commit is contained in:
1 parent
fed65ceb80
commit
580c5997b4
12 files changed
+754
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useUserAuth } from '@/composable/user-auth';
|
||||
import { licenseHeaders } from '../license/license';
|
||||
import GenHistory from '@/tools/gen-history/GenHistory.vue';
|
||||
import { useGenHistory } from '@/tools/gen-history/gen-history';
|
||||
@@ -67,8 +68,12 @@ function onDrop(e: DragEvent) {
|
||||
handleFile(e.dataTransfer?.files?.[0]);
|
||||
}
|
||||
|
||||
const { cloudUpload } = useUserAuth();
|
||||
|
||||
function handleFile(file?: File | null) {
|
||||
if (!file) return;
|
||||
cloudUpload(file, 'ai-retouch').catch(() => {}); // 云端留档(登录后)
|
||||
|
||||
if (!file.type.startsWith('image/')) {
|
||||
error.value = '请选择图片文件(png/jpg/webp 等)';
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useUserAuth } from '@/composable/user-auth';
|
||||
import GenHistory from '@/tools/gen-history/GenHistory.vue';
|
||||
import { useGenHistory } from '@/tools/gen-history/gen-history';
|
||||
|
||||
@@ -22,10 +23,14 @@ function pickFile() {
|
||||
fileInput.value?.click();
|
||||
}
|
||||
|
||||
const { cloudUpload } = useUserAuth();
|
||||
|
||||
async function handleFile(file?: File | null) {
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
cloudUpload(file, 'image-ocr').catch(() => {}); // 云端留档(登录后)
|
||||
|
||||
if (!file.type.startsWith('image/')) {
|
||||
error.value = '请选择图片文件(png/jpg/webp/bmp 等)';
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useUserAuth } from '@/composable/user-auth';
|
||||
import exifr from 'exifr';
|
||||
import QRCode from 'qrcode';
|
||||
import { prepareZXingModule, readBarcodes } from 'zxing-wasm/reader';
|
||||
@@ -100,7 +101,12 @@ function onDrop(e: DragEvent) {
|
||||
addFiles(Array.from(e.dataTransfer?.files ?? []));
|
||||
}
|
||||
|
||||
const { cloudUpload } = useUserAuth();
|
||||
|
||||
function addFiles(list: File[]) {
|
||||
for (const f of list) {
|
||||
cloudUpload(f, 'image-tools').catch(() => {});
|
||||
}
|
||||
const imgs = list.filter(f => f.type.startsWith('image/'));
|
||||
if (!imgs.length) {
|
||||
errorMsg.value = '请选择图片文件';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useUserAuth } from '@/composable/user-auth';
|
||||
import GenHistory from '@/tools/gen-history/GenHistory.vue';
|
||||
import { useGenHistory } from '@/tools/gen-history/gen-history';
|
||||
|
||||
@@ -248,6 +249,8 @@ async function pickPdf() {
|
||||
pdfInput.value?.click();
|
||||
}
|
||||
|
||||
const { cloudUpload } = useUserAuth();
|
||||
|
||||
async function onPdfFile(e: Event) {
|
||||
const input = e.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
@@ -255,6 +258,7 @@ async function onPdfFile(e: Event) {
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
cloudUpload(file, 'label-designer').catch(() => {});
|
||||
loadingPdf.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useUserAuth } from '@/composable/user-auth';
|
||||
import GenHistory from '@/tools/gen-history/GenHistory.vue';
|
||||
import { useGenHistory } from '@/tools/gen-history/gen-history';
|
||||
|
||||
@@ -77,7 +78,10 @@ function onPaste(e: ClipboardEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
const { cloudUpload } = useUserAuth();
|
||||
|
||||
async function processFile(file: File) {
|
||||
cloudUpload(file, 'pdf-ocr').catch(() => {}); // 云端留档(登录后)
|
||||
if (!file.name.toLowerCase().endsWith('.pdf') && file.type !== 'application/pdf') {
|
||||
error.value = '请选择 PDF 文件';
|
||||
return;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useUserAuth } from '@/composable/user-auth';
|
||||
import { degrees, PDFDocument, rgb } from '@cantoo/pdf-lib';
|
||||
import { getDocument, GlobalWorkerOptions } from 'pdfjs-dist';
|
||||
import pdfWorkerUrl from 'pdfjs-dist/build/pdf.worker.min.js?url';
|
||||
@@ -71,7 +72,12 @@ function onDrop(e: DragEvent) {
|
||||
addFiles(Array.from(e.dataTransfer?.files ?? []));
|
||||
}
|
||||
|
||||
const { cloudUpload } = useUserAuth();
|
||||
|
||||
function addFiles(list: File[]) {
|
||||
for (const f of list) {
|
||||
cloudUpload(f, 'pdf-tools').catch(() => {});
|
||||
}
|
||||
const pdfs = list.filter(f => f.type === 'application/pdf' || f.name.toLowerCase().endsWith('.pdf'));
|
||||
if (!pdfs.length) {
|
||||
errorMsg.value = '请选择 PDF 文件';
|
||||
|
||||
Reference in new issue
Block a user