Compare commits

..
8 Commits
Author SHA1 Message Date
wonder 2d1fd2f1a0 ✨Feat: 单文件上传 2025-11-18 23:10:13 +08:00
wonder 74c9a8c983 🐛Fix: 修复首页 2025-11-18 20:04:50 +08:00
wonder 5d33d29e59 ✨Feat: 首页目录构建 2025-11-18 20:00:39 +08:00
wonder b5575b1ba6 🔄Update: 导入 Element-plus 2025-11-18 19:18:04 +08:00
wonder aa41e6345c 🔄Update: 应用路由 2025-11-18 19:10:22 +08:00
wonder b0993ebec2 🔄Update: 添加路由 2025-11-18 18:57:44 +08:00
wonder dd2830ef7c 🔄Update: 后端项目初始化 2025-11-18 15:32:09 +08:00
wonder 818dcc0e99 🔄Update: 后端项目初始化 2025-11-18 15:30:45 +08:00
22 changed files with 13053 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
.idea
target
+23
View File
@@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
+24
View File
@@ -0,0 +1,24 @@
# frontend
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
+5
View File
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}
+12439
View File
File diff suppressed because it is too large Load Diff
+46
View File
@@ -0,0 +1,46 @@
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.8.3",
"element-plus": "^2.11.8",
"plupload": "^2.3.9",
"vue": "^3.2.13",
"vue-router": "^4.6.3"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "@babel/eslint-parser"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

+17
View File
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
+90
View File
@@ -0,0 +1,90 @@
<template>
<div id="app">
<el-container class="my-container">
<el-header class="my-header">
<span style="color: aliceblue; font-size: x-large;">MyUploader</span>
</el-header>
<el-container>
<el-aside>
<el-menu style="height: 100%">
<el-menu-item index="singleFileUpload" @click="redirectUrl('/single-file-upload')">
<i class="el-icon-menu"></i>
<span >单文件上传</span>
</el-menu-item>
<el-menu-item index="multiFileUpload" @click="redirectUrl('/multi-file-upload')">
<i class="el-icon-menu"></i>
<span >多文件上传</span>
</el-menu-item>
<el-menu-item index="bigFileUpload" @click="redirectUrl('/big-file-upload')">
<i class="el-icon-menu"></i>
<span >大文件上传</span>
</el-menu-item>
<el-menu-item index="stopFileUpload" @click="redirectUrl('/stop-file-upload')">
<i class="el-icon-menu"></i>
<span >断点续传</span>
</el-menu-item>
<el-menu-item index="quickUpload" @click="redirectUrl('/quick-upload')">
<i class="el-icon-menu"></i>
<span >文件秒传</span>
</el-menu-item>
<el-menu-item index="pictureUpload" @click="redirectUrl('/picture-upload')">
<i class="el-icon-menu"></i>
<span >图片上传</span>
</el-menu-item>
</el-menu>
</el-aside>
<el-main class="my-main">
<router-view></router-view>
</el-main>
</el-container>
</el-container>
</div>
</template>
<script>
export default {
name: 'App',
data () {
return {
default: this.$route.name
}
},
methods: {
redirectUrl(val) {
this.$router.push(val)
}
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
position: absolute;
text-align: center;
color: #2c3e50;
top: 0;
left: 0;
bottom: 0;
width: 100%;
}
.my-container {
margin: 0 auto;
position: absolute;
width: 100%;
height: 100%;
}
.my-header {
background-color: deepskyblue;
height: 20px;
font-size: large;
display: flex;
justify-content: center;
align-items: center;
}
.my-main {
margin: 1em 1em;
}
</style>
+8
View File
@@ -0,0 +1,8 @@
<script>
const server_config = {
url: 'http://localhost:8080'
};
export default {
server_config
}
</script>
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

+29
View File
@@ -0,0 +1,29 @@
<template>
大文件上传
</template>
<script>
export default {
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
+66
View File
@@ -0,0 +1,66 @@
<template>
<div>
<el-button>I am ElButton</el-button>
</div>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
import { ElButton } from 'element-plus';
export default {
name: 'HelloWorld',
props: {
msg: String
},
components: {
ElButton
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
@@ -0,0 +1,29 @@
<template>
多文件上传
</template>
<script>
export default {
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
+29
View File
@@ -0,0 +1,29 @@
<template>
图片上传
</template>
<script>
export default {
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
+29
View File
@@ -0,0 +1,29 @@
<template>
文件秒传
</template>
<script>
export default {
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
@@ -0,0 +1,106 @@
<template>
<div>
<input ref="fileInput" type="file" @change="handleFileSelect" style="display: none;" />
<el-button id="browse_button" type="primary" @click="browseFile">Select File</el-button>
<el-button id="danger" type="success" @click="uploadFile" :disabled="!selectedFile">Upload</el-button>
<el-dialog title="Uploading" v-model="uploadDialogVisible">
<el-progress :percentage="uploadProgress"></el-progress>
<div v-if="uploadStatus === 'error'" style="color: red; margin-top: 10px;">
{{ uploadMessage }}
</div>
<div v-else-if="uploadStatus === 'success'" style="color: green; margin-top: 10px;">
{{ uploadMessage }}
</div>
</el-dialog>
<br>
<br>
<el-tag type="warning">You can only upload pictures or zips.</el-tag>
<div v-if="selectedFile" style="margin-top: 10px;">
Selected file: {{ selectedFile.name }}
</div>
</div>
</template>
<script>
export default {
name: 'SingleFileUpload',
data() {
return {
selectedFile: null,
uploadDialogVisible: false,
uploadProgress: 0,
uploadStatus: '', // 'success', 'error', ''
uploadMessage: ''
}
},
methods: {
browseFile() {
this.$refs.fileInput.click();
},
handleFileSelect(event) {
const file = event.target.files[0];
if (file) {
// 验证文件类型
const allowedTypes = ['image/jpeg', 'image/png', 'image/gif', 'application/zip'];
if (allowedTypes.includes(file.type)) {
this.selectedFile = file;
this.uploadMessage = '';
} else {
this.selectedFile = null;
this.uploadMessage = 'Please select a valid file (image or zip).';
}
}
},
async uploadFile() {
if (!this.selectedFile) return;
this.uploadDialogVisible = true;
this.uploadProgress = 0;
this.uploadStatus = '';
this.uploadMessage = '';
try {
// 模拟上传过程
await this.simulateUpload();
this.uploadStatus = 'success';
this.uploadMessage = 'File uploaded successfully!';
} catch (error) {
this.uploadStatus = 'error';
this.uploadMessage = 'Upload failed: ' + error.message;
}
},
simulateUpload() {
return new Promise((resolve) => {
const interval = setInterval(() => {
this.uploadProgress += 10;
if (this.uploadProgress >= 100) {
clearInterval(interval);
// 模拟上传成功
resolve();
}
}, 200);
});
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
@@ -0,0 +1,29 @@
<template>
断点续传
</template>
<script>
export default {
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
+7
View File
@@ -0,0 +1,7 @@
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
createApp(App).use(router).use(ElementPlus).mount('#app')
+52
View File
@@ -0,0 +1,52 @@
import { createRouter, createWebHistory } from 'vue-router'
import BigFileUpload from '@/components/BigFileUpload.vue'
import MultiFileUpload from '@/components/MultiFileUpload.vue'
import PictureUpload from '@/components/PictureUpload.vue'
import QuickUpload from '@/components/QuickUpload.vue'
import SingleFileUpload from '@/components/SingleFileUpload.vue'
import StopFileUpload from '@/components/StopFileUpload.vue'
const routes = [
{
path: '/',
name: 'SingleFileUpload',
component: SingleFileUpload
},
{
path: '/big-file-upload',
name: 'BigFileUpload',
component: BigFileUpload
},
{
path: '/multi-file-upload',
name: 'MultiFileUpload',
component: MultiFileUpload
},
{
path: '/picture-upload',
name: 'PictureUpload',
component: PictureUpload
},
{
path: '/quick-upload',
name: 'QuickUpload',
component: QuickUpload
},
{
path: '/single-file-upload',
name: 'SingleFileUpload',
component: SingleFileUpload
},
{
path: '/stop-file-upload',
name: 'StopFileUpload',
component: StopFileUpload
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
export default router
+4
View File
@@ -0,0 +1,4 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})