init
This commit is contained in:
5
README.md
Normal file
5
README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Vue 3 + Vite
|
||||||
|
|
||||||
|
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||||
|
|
||||||
|
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).
|
||||||
13
index.html
Normal file
13
index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/png" href="/logo.png" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>memory-block-upload</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1118
package-lock.json
generated
Normal file
1118
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
22
package.json
Normal file
22
package.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "memory-block-upload",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"vue": "^3.5.22",
|
||||||
|
"vue-router": "^4.6.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitejs/plugin-vue": "^6.0.1",
|
||||||
|
"vite": "npm:rolldown-vite@7.1.14"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"vite": "npm:rolldown-vite@7.1.14"
|
||||||
|
}
|
||||||
|
}
|
||||||
3
src/App.vue
Normal file
3
src/App.vue
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<template>
|
||||||
|
<router-view />
|
||||||
|
</template>
|
||||||
6
src/main.js
Normal file
6
src/main.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { createApp } from 'vue'
|
||||||
|
import './style.css'
|
||||||
|
import App from './App.vue'
|
||||||
|
import router from './router'
|
||||||
|
|
||||||
|
createApp(App).use(router).mount('#app')
|
||||||
29
src/router/index.js
Normal file
29
src/router/index.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { createRouter, createWebHistory } from 'vue-router';
|
||||||
|
import StartPage from '../views/StartPage.vue';
|
||||||
|
import PhotoSelectionPage from '../views/PhotoSelectionPage.vue';
|
||||||
|
import UploadCompletePage from '../views/UploadCompletePage.vue';
|
||||||
|
|
||||||
|
const routes = [
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
name: 'StartPage',
|
||||||
|
component: StartPage,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/select',
|
||||||
|
name: 'PhotoSelectionPage',
|
||||||
|
component: PhotoSelectionPage,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/complete',
|
||||||
|
name: 'UploadCompletePage',
|
||||||
|
component: UploadCompletePage,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const router = createRouter({
|
||||||
|
history: createWebHistory(),
|
||||||
|
routes,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
23
src/style.css
Normal file
23
src/style.css
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* Base resets kept minimal */
|
||||||
|
*, *::before, *::after { box-sizing: border-box; }
|
||||||
|
|
||||||
|
:root {
|
||||||
|
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
min-width: 320px;
|
||||||
|
min-height: 100dvh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app {
|
||||||
|
width: 100%;
|
||||||
|
height: 100dvh;
|
||||||
|
max-width: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
374
src/views/PhotoSelectionPage.vue
Normal file
374
src/views/PhotoSelectionPage.vue
Normal file
@@ -0,0 +1,374 @@
|
|||||||
|
<template>
|
||||||
|
<div class="photo-selection-page" v-if="validated">
|
||||||
|
<div v-if="uploadError" class="error-toast" role="alert">
|
||||||
|
{{ uploadErrorMessage }}
|
||||||
|
<span v-if="uploadErrorCountdown">({{ uploadErrorCountdown }}s)</span>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<!-- 移除 h5 标题与验证提示,仅在验证通过时显示完整页面 -->
|
||||||
|
<!-- 悬浮选择按钮:左下角加号 -->
|
||||||
|
<div v-if="validated && !uploading" class="fab-select">
|
||||||
|
<button @click="autoOpenFileInput" class="select-trigger" aria-label="Select Photos">Add</button>
|
||||||
|
</div>
|
||||||
|
<input type="file" @change="onFileChange" multiple accept="image/*,.png,.jpg,.jpeg,.gif,.bmp,.webp,.heic,.heif,.tif,.tiff" ref="fileInput" style="display: none" />
|
||||||
|
<p class="status note" v-if="nonPreviewCount > 0">Selected {{ nonPreviewCount }} images are not previewable (still uploadable).</p>
|
||||||
|
<div v-if="loading" class="screen-mask" role="status" aria-live="polite">
|
||||||
|
<div class="mask-content">Loading...</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="uploading" class="screen-mask" role="status" aria-live="polite">
|
||||||
|
<div class="mask-content">Uploading...</div>
|
||||||
|
</div>
|
||||||
|
<div class="masonry" v-if="images.length">
|
||||||
|
<div v-for="(image, index) in images" :key="index" class="masonry-item">
|
||||||
|
<img :src="image" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 固定在屏幕底部的覆盖层(透明度 30%) -->
|
||||||
|
<div class="overlay">
|
||||||
|
<button @click="upload" :disabled="!files.length || uploading" class="upload-button">Upload</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'PhotoSelectionPage',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
images: [],
|
||||||
|
files: [],
|
||||||
|
nonPreviewCount: 0,
|
||||||
|
loading: false,
|
||||||
|
uploading: false,
|
||||||
|
validating: true,
|
||||||
|
validated: false,
|
||||||
|
validationError: false,
|
||||||
|
// toast state
|
||||||
|
uploadError: false,
|
||||||
|
uploadErrorMessage: '',
|
||||||
|
uploadErrorCountdown: 0,
|
||||||
|
uploadErrorTimer: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
const { code, machine, store } = this.$route.query || {};
|
||||||
|
this.validateParams({ code, machine, store })
|
||||||
|
.then((ok) => {
|
||||||
|
if (ok) {
|
||||||
|
this.validated = true;
|
||||||
|
this.validating = false;
|
||||||
|
// 验证通过后自动弹出文件选择框
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.autoOpenFileInput();
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.validationError = true;
|
||||||
|
this.validating = false;
|
||||||
|
// 验证未通过,返回上一页
|
||||||
|
this.$router.back();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.validationError = true;
|
||||||
|
this.validating = false;
|
||||||
|
// 异常情况下也返回上一页
|
||||||
|
this.$router.back();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
validateParams({ code, machine, store }) {
|
||||||
|
const ok = [code, machine, store].every(
|
||||||
|
(v) => typeof v === 'string' && v.trim() !== ''
|
||||||
|
);
|
||||||
|
return Promise.resolve(ok);
|
||||||
|
},
|
||||||
|
autoOpenFileInput() {
|
||||||
|
try {
|
||||||
|
if (this.$refs.fileInput) {
|
||||||
|
this.$refs.fileInput.click();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('自动打开文件选择器失败,可能被浏览器拦截。');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onFileChange(e) {
|
||||||
|
const incoming = Array.from(e.target.files || []);
|
||||||
|
const allowedExts = ['.png','.jpg','.jpeg','.gif','.bmp','.webp','.heic','.heif','.tif','.tiff'];
|
||||||
|
const isAllowed = (f) => {
|
||||||
|
const type = (f.type || '').toLowerCase();
|
||||||
|
const name = (f.name || '').toLowerCase();
|
||||||
|
const extOk = allowedExts.some((ext) => name.endsWith(ext));
|
||||||
|
const typeOk = type.startsWith('image/');
|
||||||
|
return typeOk || extOk;
|
||||||
|
};
|
||||||
|
|
||||||
|
const allowedFiles = incoming.filter((f) => f && isAllowed(f));
|
||||||
|
if (!allowedFiles.length) return;
|
||||||
|
|
||||||
|
this.loading = true;
|
||||||
|
this.nonPreviewCount = 0;
|
||||||
|
|
||||||
|
// 预览仅针对常见可在浏览器直接显示的格式
|
||||||
|
const previewableExts = ['.png','.jpg','.jpeg','.gif','.bmp','.webp'];
|
||||||
|
const previewableFiles = allowedFiles.filter((f) => {
|
||||||
|
const type = (f.type || '').toLowerCase();
|
||||||
|
const name = (f.name || '').toLowerCase();
|
||||||
|
const extOk = previewableExts.some((ext) => name.endsWith(ext));
|
||||||
|
return type.startsWith('image/') && extOk;
|
||||||
|
});
|
||||||
|
|
||||||
|
const nonPreviewFiles = allowedFiles.filter((f) => !previewableFiles.includes(f));
|
||||||
|
this.nonPreviewCount = nonPreviewFiles.length;
|
||||||
|
|
||||||
|
// 所有允许的文件都加入上传队列
|
||||||
|
allowedFiles.forEach((file) => this.files.push(file));
|
||||||
|
|
||||||
|
const promises = previewableFiles.map((file) => this.readFile(file));
|
||||||
|
|
||||||
|
Promise.all(promises)
|
||||||
|
.then((imgs) => {
|
||||||
|
this.images = this.images.concat(imgs);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
readFile(file) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = (e) => {
|
||||||
|
resolve(e.target.result);
|
||||||
|
};
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
upload() {
|
||||||
|
const { code, machine, store, baseUrl } = this.$route.query || {};
|
||||||
|
this.uploading = true;
|
||||||
|
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('code', code || '');
|
||||||
|
formData.append('machine', machine || '');
|
||||||
|
formData.append('store', store || '');
|
||||||
|
this.files.forEach((file) => formData.append('files', file, file.name));
|
||||||
|
|
||||||
|
const cleanBase = (baseUrl || '').replace(/\/+$/, '');
|
||||||
|
const endpoint = `${cleanBase}/kiosk-upload/upload`;
|
||||||
|
|
||||||
|
fetch(endpoint, { method: 'POST', body: formData })
|
||||||
|
.then((res) => {
|
||||||
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||||
|
return res.json().catch(() => ({}));
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.uploading = false;
|
||||||
|
this.$router.replace('/complete');
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('Upload failed:', err);
|
||||||
|
this.uploading = false;
|
||||||
|
// show lightweight toast, keep selected files for retry
|
||||||
|
this.showUploadError('Upload failed. Please try again.');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// toast helpers
|
||||||
|
showUploadError(message = 'Upload failed. Please try again.') {
|
||||||
|
this.uploadError = true;
|
||||||
|
this.uploadErrorMessage = message;
|
||||||
|
this.uploadErrorCountdown = 5;
|
||||||
|
this.clearUploadErrorTimer();
|
||||||
|
this.uploadErrorTimer = setInterval(() => {
|
||||||
|
if (this.uploadErrorCountdown > 1) {
|
||||||
|
this.uploadErrorCountdown -= 1;
|
||||||
|
} else {
|
||||||
|
this.uploadError = false;
|
||||||
|
this.clearUploadErrorTimer();
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
},
|
||||||
|
clearUploadErrorTimer() {
|
||||||
|
if (this.uploadErrorTimer) {
|
||||||
|
clearInterval(this.uploadErrorTimer);
|
||||||
|
this.uploadErrorTimer = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
this.clearUploadErrorTimer();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.photo-selection-page {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100dvh;
|
||||||
|
background-color: #ffffff; /* fallback */
|
||||||
|
/* 底部区域高度变量 */
|
||||||
|
--bottom-area: 15dvh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 使用与首页相同的背景图,并做模糊,仅作用于背景,不影响内容 */
|
||||||
|
.photo-selection-page::before {
|
||||||
|
content: "";
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background-image: url('/background.png');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center center;
|
||||||
|
filter: blur(10px);
|
||||||
|
transform: scale(1.04); /* 防止模糊边缘露白 */
|
||||||
|
opacity: 0.6; /* 背景透明度,避免过于抢眼 */
|
||||||
|
z-index: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 24px;
|
||||||
|
/* 预留底部覆盖层的空间,避免内容被遮挡 */
|
||||||
|
padding-bottom: calc(var(--bottom-area) + 20px);
|
||||||
|
max-width: none;
|
||||||
|
margin: 0;
|
||||||
|
background: transparent;
|
||||||
|
border-radius: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.status {
|
||||||
|
margin: 12px 0;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.status.note {
|
||||||
|
color: #666;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.screen-mask {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.35);
|
||||||
|
backdrop-filter: saturate(180%) blur(6px);
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
z-index: 999; /* above fab & bottom overlay */
|
||||||
|
}
|
||||||
|
|
||||||
|
.mask-content {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4列瀑布流 */
|
||||||
|
.masonry {
|
||||||
|
column-count: 4;
|
||||||
|
column-gap: 12px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.masonry-item {
|
||||||
|
break-inside: avoid;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.masonry-item img {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-trigger {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #e74c3c;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 1rem;
|
||||||
|
border: none;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 悬浮按钮容器:左下角,避开底部覆盖层与安全区 */
|
||||||
|
.fab-select {
|
||||||
|
position: fixed;
|
||||||
|
right: 16px;
|
||||||
|
bottom: calc(var(--bottom-area) + env(safe-area-inset-bottom) + 16px);
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 固定在屏幕底部的覆盖层 */
|
||||||
|
.overlay {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: var(--bottom-area);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
/* 无边距与边框 */
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border: none;
|
||||||
|
/* 透明度 30% */
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
backdrop-filter: saturate(180%) blur(8px);
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.upload-button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 60vw;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
aspect-ratio: 252 / 46;
|
||||||
|
font-size: 1rem;
|
||||||
|
background-color: #e74c3c;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
.error-toast {
|
||||||
|
position: fixed;
|
||||||
|
top: 16px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
max-width: 90%;
|
||||||
|
background-color: rgba(255, 255, 255, 0.95);
|
||||||
|
color: #ff4d4f;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-radius: 999px; /* pill style for single-line */
|
||||||
|
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
|
||||||
|
z-index: 1000;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.error-toast span { margin-left: 4px; opacity: 0.9; }
|
||||||
|
</style>
|
||||||
133
src/views/StartPage.vue
Normal file
133
src/views/StartPage.vue
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
<template>
|
||||||
|
<div class="start-page">
|
||||||
|
<!-- 悬浮错误提示,不影响布局 -->
|
||||||
|
<div v-if="error" class="error-toast">
|
||||||
|
Invalid QR code. Please try again.
|
||||||
|
<span v-if="errorCountdown">({{ errorCountdown }}s)</span>
|
||||||
|
</div>
|
||||||
|
<div class="center-container">
|
||||||
|
<img src="/logo.png" alt="Memory Block Logo" class="logo" />
|
||||||
|
<button @click="validateAndProceed" class="select-button">Select Photos</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'StartPage',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
error: false,
|
||||||
|
errorCountdown: 0,
|
||||||
|
errorTimer: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
validateAndProceed() {
|
||||||
|
const { code, machine, store } = this.$route.query || {};
|
||||||
|
const valid = [code, machine, store].every(
|
||||||
|
(v) => typeof v === 'string' && v.trim() !== ''
|
||||||
|
);
|
||||||
|
if (valid) {
|
||||||
|
this.error = false;
|
||||||
|
this.clearErrorTimer();
|
||||||
|
this.$router.push({ path: '/select', query: { code, machine, store } });
|
||||||
|
} else {
|
||||||
|
this.error = true;
|
||||||
|
this.errorCountdown = 5;
|
||||||
|
this.clearErrorTimer();
|
||||||
|
this.errorTimer = setInterval(() => {
|
||||||
|
if (this.errorCountdown > 1) {
|
||||||
|
this.errorCountdown -= 1;
|
||||||
|
} else {
|
||||||
|
this.error = false;
|
||||||
|
this.clearErrorTimer();
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clearErrorTimer() {
|
||||||
|
if (this.errorTimer) {
|
||||||
|
clearInterval(this.errorTimer);
|
||||||
|
this.errorTimer = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
this.clearErrorTimer();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.start-page {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100dvh;
|
||||||
|
min-height: 100dvh;
|
||||||
|
text-align: center;
|
||||||
|
background-image: url('/background.png');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center center;
|
||||||
|
background-color: #ffffff; /* fallback to avoid white gaps */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 悬浮错误提示,顶部居中,不影响布局 */
|
||||||
|
.error-toast {
|
||||||
|
position: fixed;
|
||||||
|
top: 16px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
max-width: 90%;
|
||||||
|
background-color: rgba(255, 255, 255, 0.95);
|
||||||
|
color: #ff4d4f;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-radius: 999px; /* pill style to match selection page */
|
||||||
|
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
|
||||||
|
z-index: 1000;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.error-toast span { margin-left: 4px; opacity: 0.9; }
|
||||||
|
|
||||||
|
.center-container {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
width: 100%;
|
||||||
|
max-width: 720px;
|
||||||
|
padding: 0 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
width: 90%;
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select-button {
|
||||||
|
margin-top: 24px;
|
||||||
|
width: 60vw;
|
||||||
|
aspect-ratio: 252 / 46;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: #e74c3c;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 1rem; /* align with Upload button */
|
||||||
|
border: none;
|
||||||
|
border-radius: 999px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
98
src/views/UploadCompletePage.vue
Normal file
98
src/views/UploadCompletePage.vue
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<template>
|
||||||
|
<div class="upload-complete-page">
|
||||||
|
<div class="overlay" aria-hidden="true"></div>
|
||||||
|
<div class="content">
|
||||||
|
<div class="success-icon" aria-hidden="true">
|
||||||
|
<svg class="check" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M20 6L9 17L4 12" stroke="#ffffff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<h1 class="title">Photos Uploaded!</h1>
|
||||||
|
<p class="sub">
|
||||||
|
Your main gallery is ready on the screen.<br />
|
||||||
|
You can close this window now
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'UploadCompletePage',
|
||||||
|
mounted() {
|
||||||
|
// Prevent navigating back: push a state and re-push on back
|
||||||
|
this._onPopState = () => {
|
||||||
|
window.history.pushState(null, '', window.location.href);
|
||||||
|
};
|
||||||
|
window.history.pushState(null, '', window.location.href);
|
||||||
|
window.addEventListener('popstate', this._onPopState);
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
if (this._onPopState) {
|
||||||
|
window.removeEventListener('popstate', this._onPopState);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.upload-complete-page {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100dvh;
|
||||||
|
min-height: 100dvh;
|
||||||
|
text-align: center;
|
||||||
|
background-image: url('/background.png'); /* same as StartPage */
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center center;
|
||||||
|
background-color: #ffffff; /* fallback */
|
||||||
|
}
|
||||||
|
|
||||||
|
.overlay {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
width: 100%;
|
||||||
|
max-width: 720px;
|
||||||
|
padding: 0 24px;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-icon {
|
||||||
|
width: 112px;
|
||||||
|
height: 112px;
|
||||||
|
margin: 0 auto 24px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #2ecc71; /* green */
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.check {
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.2px;
|
||||||
|
margin: 0 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.6;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
28
vite.config.js
Normal file
28
vite.config.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
|
// https://vite.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
server: {
|
||||||
|
host: true,
|
||||||
|
port: 5173,
|
||||||
|
proxy: {
|
||||||
|
'/kiosk-upload': {
|
||||||
|
// 将此替换为你的后端 baseUrl,例如 'https://api.example.com'
|
||||||
|
target: 'http://localhost',
|
||||||
|
changeOrigin: true, // 修改 Host 头为 target,避免后端基于 Host 的限制
|
||||||
|
secure: false, // 如果是自签名 HTTPS,在开发环境禁用证书校验
|
||||||
|
// 后端路径不同才需要 rewrite,例如后端路径是 '/api/upload'
|
||||||
|
// rewrite: (path) => path.replace(/^\/kiosk-upload/, '/api')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [vue()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': path.resolve(__dirname, './src'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user