From 6396b79ac5d70f32d0b415e04611895cf6308905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=87=E5=B3=B0?= Date: Fri, 16 Jan 2026 20:49:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=B7=AE=E4=B8=8D=E5=A4=9A?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E8=A6=81=E5=90=8E=E7=AB=AF=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/routers/api_Files.go | 16 +- .../ops_vue_js/src/components/useDropzone.vue | 422 ++++++++++++++---- frontent/ops_vue_js/src/i18n/en.json | 54 ++- frontent/ops_vue_js/src/i18n/zh-CN.json | 46 ++ .../src/views/purchase/addorder.vue | 104 +++-- .../ops_vue_js/src/views/settings/account.vue | 1 + frontent/ops_vue_js/src/views/test.vue | 5 +- 7 files changed, 519 insertions(+), 129 deletions(-) diff --git a/backend/routers/api_Files.go b/backend/routers/api_Files.go index 8e98dfd..9292bc9 100644 --- a/backend/routers/api_Files.go +++ b/backend/routers/api_Files.go @@ -6,9 +6,23 @@ import ( "github.com/gin-gonic/gin" ) +func file_save() { + +} + func ApiFiles(r *gin.RouterGroup) { r.POST("/upload", func(ctx *gin.Context) { - fmt.Print(ctx.FormFile("file")) + + cookie := ctx.PostForm("cookie") + file, _ := ctx.FormFile("file") + //通过cookie获取用户信息 + _, err := AuthenticationAuthorityFromCookie(cookie) + if err == nil { + + } + + fmt.Println(file.Filename) + fmt.Println(cookie) ReturnJson(ctx, "apiOK", nil) }) r.GET("/upload", func(ctx *gin.Context) { diff --git a/frontent/ops_vue_js/src/components/useDropzone.vue b/frontent/ops_vue_js/src/components/useDropzone.vue index 1ff83c9..9b7dc6c 100644 --- a/frontent/ops_vue_js/src/components/useDropzone.vue +++ b/frontent/ops_vue_js/src/components/useDropzone.vue @@ -1,133 +1,379 @@ - - \ No newline at end of file + +.thumbnail-container { + display: flex; + flex-wrap: wrap; + gap: 15px; + justify-content: center; + padding: 20px; + background-color: white; + border-radius: 15px; + box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); +} + +/* 缩略图样式 */ +.thumbnail { + width: var(--thumbnail-size); + height: var(--thumbnail-size); + border-radius: var(--border-radius); + object-fit: cover; + border: 2px solid #e9ecef; + transition: all 0.3s ease; +} + +.thumbnail:hover { + transform: scale(1.05); + border-color: #6c757d; +} + +/* 缩略图包装器 */ +.thumbnail-wrapper { + position: relative; + width: var(--thumbnail-size); + height: var(--thumbnail-size); + margin-bottom: 10px; +} + +/* 移除按钮 */ +.remove-btn { + position: absolute; + top: -12px; + right: -12px; + width: 24px; + height: 24px; + border-radius: 50%; + background-color: #dc3545; + color: white; + border: none; + display: flex; + align-items: center; + justify-content: center; + font-size: 12px; + cursor: pointer; + transition: all 0.2s ease; + z-index: 10; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); +} + +.remove-btn:hover { + background-color: #bb2d3b; + transform: scale(1.1); +} + +/* 文件名称 */ +.file-name { + font-size: 12px; + text-align: center; + max-width: 100px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: #495057; +} + +/* 上传区域 */ +.upload-area { + border: 2px dashed #dee2e6; + border-radius: 15px; + padding: 30px; + text-align: center; + background-color: #f8f9fa; + cursor: pointer; + transition: all 0.3s ease; + margin-bottom: 20px; +} + +.upload-area:hover { + border-color: #6c757d; + background-color: #e9ecef; +} + +.upload-icon { + font-size: 48px; + color: #6c757d; + margin-bottom: 10px; +} + +.preview-title { + color: #343a40; + border-bottom: 2px solid #e9ecef; + padding-bottom: 10px; + margin-bottom: 20px; +} + +.empty-state { + text-align: center; + padding: 40px 20px; + color: #6c757d; +} + +.empty-state i { + font-size: 48px; + margin-bottom: 15px; + color: #adb5bd; +} + +.counter-badge { + position: absolute; + top: -5px; + right: -5px; + background-color: #0d6efd; + color: white; + border-radius: 50%; + width: 20px; + height: 20px; + font-size: 12px; + display: flex; + align-items: center; + justify-content: center; +} + +.thumbnail-actions { + display: flex; + justify-content: space-between; + margin-top: 20px; +} + +.file-input { + display: none; +} + diff --git a/frontent/ops_vue_js/src/i18n/en.json b/frontent/ops_vue_js/src/i18n/en.json index e155d4a..2ffddc3 100644 --- a/frontent/ops_vue_js/src/i18n/en.json +++ b/frontent/ops_vue_js/src/i18n/en.json @@ -20,6 +20,20 @@ "loding": "Loading...", "add": "Add new option: " }, + "dropzone": { + "upload_drop_or_click": "Drag and drop files here or click to upload", + "upload_browser_not_supported": "Your browser does not support drag-and-drop file upload", + "upload_file_too_big": "File is too large", + "upload_max_file_size": "Maximum file size: ", + "upload_invalid_file_type": "File type not supported", + "upload_server_error": "Server responded with an error", + "upload_cancel": "Cancel upload", + "upload_canceled": "Upload canceled", + "upload_cancel_confirmation": "Are you sure you want to cancel the upload?", + "upload_remove_file": "Remove file", + "upload_max_files": "You can upload up to ", + "upload_max_files_unit": " files" + }, "cropper": { "select_image": "Select Image", "select_File": "Select File", @@ -46,6 +60,38 @@ "add_part": "Add Order", "exp_report": "Export Report" }, + "purchase_addorder": { + "add_order": "Add Order", + "order_info": "Order Information", + "title": "Title", + "input_title": "Enter order title", + "remarks": "Remarks", + "remarks_text": "Enter text notes", + "purchase_channel": "Purchase Channel", + "link": "Link", + "style_remarks": "Style Remarks", + "add_style": "Add Style", + "cost": "Cost", + "type": "Type", + "quantity": "Quantity", + "fee": "Fee", + "total_price": "Total Price", + "currency": "Currency", + "operation": "Operation", + "remove": "Remove", + "fee_type": "Fee type", + "input_quantity": "Quantity", + "input_fee": "Fee", + "select_currency": "Select currency", + "add": "Add", + "other_status": "Other Status", + "update_time": "Update Time", + "tracking_number": "Tracking Number", + "input_tracking_number": "Enter tracking number", + "order_status": "Order Status", + "modify_order_status": "Modify Order Status", + "submit": "Submit" + }, "schedule": { "my_schedule": "My Schedule", "add_event": "Add Event", @@ -155,11 +201,11 @@ "source_code": "Source Code", "copy": "Copyright © 2025 Operations. All rights reserved." }, - "cost_type":{ - "unit_price":"Unit Price", - "freight":"Freight" + "cost_type": { + "unit_price": "Unit Price", + "freight": "Freight" }, - "order_status": { + "order_status": { "pending_order": "Pending Order", "order_placed": "Order Placed", "in_transit": "In Transit", diff --git a/frontent/ops_vue_js/src/i18n/zh-CN.json b/frontent/ops_vue_js/src/i18n/zh-CN.json index 1e6ffbc..e4c499f 100644 --- a/frontent/ops_vue_js/src/i18n/zh-CN.json +++ b/frontent/ops_vue_js/src/i18n/zh-CN.json @@ -20,6 +20,20 @@ "loding": "正在加载...", "add": "添加新选项: " }, + "dropzone": { + "upload_drop_or_click": "拖放文件到这里或点击上传", + "upload_browser_not_supported": "您的浏览器不支持拖放文件上传", + "upload_file_too_big": "文件太大", + "upload_max_file_size": "最大文件大小: ", + "upload_invalid_file_type": "不支持此文件类型", + "upload_server_error": "服务器响应错误", + "upload_cancel": "取消上传", + "upload_canceled": "上传已取消", + "upload_cancel_confirmation": "确定要取消上传吗?", + "upload_remove_file": "移除文件", + "upload_max_files": "您最多只能上传", + "upload_max_files_unit": "个文件" + }, "cropper": { "select_image": "选择图片", "select_File": "选择文件", @@ -46,6 +60,38 @@ "add_part": "添加订单", "exp_report": "生成报告" }, + "purchase_addorder": { + "add_order": "添加订单", + "order_info": "订单信息", + "title": "标题", + "input_title": "输入订单标题", + "remarks": "备注", + "remarks_text": "输入文字备注", + "purchase_channel": "采购途径", + "link": "链接", + "style_remarks": "样式备注", + "add_style": "添加样式", + "cost": "成本", + "type": "类型", + "quantity": "数量", + "fee": "费用", + "total_price": "总价", + "currency": "货币", + "operation": "操作", + "remove": "移除", + "fee_type": "费用类型", + "input_quantity": "数量", + "input_fee": "费用", + "select_currency": "选择货币类型", + "add": "添加", + "other_status": "其他状态", + "update_time": "更新时间", + "tracking_number": "快递单号", + "input_tracking_number": "输入快递单号", + "order_status": "订单状态", + "modify_order_status": "修改订单状态", + "submit": "提交" + }, "schedule": { "my_schedule": "我的日程", "add_event": "添加事件", diff --git a/frontent/ops_vue_js/src/views/purchase/addorder.vue b/frontent/ops_vue_js/src/views/purchase/addorder.vue index 668840f..cc402c4 100644 --- a/frontent/ops_vue_js/src/views/purchase/addorder.vue +++ b/frontent/ops_vue_js/src/views/purchase/addorder.vue @@ -5,6 +5,14 @@ import { useI18n } from "vue-i18n"; import tagadder from "@/components/tagadder.vue"; import dateTimePicker from "@/components/dateTimePicker.vue"; +import useDropzone from "@/components/useDropzone.vue"; + +import { useUserStore } from "@/stores/user"; +const userStore = useUserStore(); + +import { useRouter } from "vue-router"; +const router = useRouter(); + import TomSelect from "tom-select"; import "tom-select/dist/css/tom-select.css"; @@ -81,6 +89,10 @@ function add_cost() { onMounted(() => { functionupdataTitle(); //sele_init(); + if (!userStore.isLoggedIn) { + router.push("/login"); + } + }); // 监听语言变化,更新标题 watch(locale, () => { @@ -95,7 +107,7 @@ watch(locale, () => {
-

添加订单

+

{{ t("purchase_addorder.add_order") }}

@@ -106,37 +118,47 @@ watch(locale, () => {
-

订单信息

+

+ {{ t("purchase_addorder.order_info") }} +

- +
{{ t("purchase_addorder.remarks") }} + 0/100 +
-

采购途径

+

+ {{ t("purchase_addorder.purchase_channel") }} +

- + { value="" />
- + - +
- + { > - - - - - - + + + + + + @@ -183,7 +213,7 @@ watch(locale, () => { class="btn btn-outline-danger" @click="del_cost(key)" > - Del + {{ t("purchase_addorder.remove") }} @@ -201,11 +231,10 @@ watch(locale, () => {
- 类型 + {{ t("purchase_addorder.fee_type") }}
- 数量 + {{ t("purchase_addorder.input_quantity") }} { />
- 费用 + {{ t("purchase_addorder.input_fee") }} { />
- 货币 + {{ t("purchase_addorder.select_currency") }}
- 操作 + {{ t("purchase_addorder.operation") }}
@@ -269,30 +297,37 @@ watch(locale, () => {
-

其他状态

+

+ {{ t("purchase_addorder.other_status") }} +

- +
- +
- 订单状态 + {{ t("purchase_addorder.order_status") }}
类型数量费用总价货币操作{{ t("purchase_addorder.type") }}{{ t("purchase_addorder.quantity") }}{{ t("purchase_addorder.fee") }}{{ t("purchase_addorder.total_price") }}{{ t("purchase_addorder.currency") }} + {{ t("purchase_addorder.operation") }} +