From 089bf5d2378b3c4a61d795b2a92bede2c193b771 Mon Sep 17 00:00:00 2001
From: admin <344137771@qq.com>
Date: Tue, 06 Jan 2026 11:22:58 +0800
Subject: [PATCH] 1
---
src/components/prod-select/index.vue | 71 +++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/src/components/prod-select/index.vue b/src/components/prod-select/index.vue
new file mode 100644
index 0000000..2c201ff
--- /dev/null
+++ b/src/components/prod-select/index.vue
@@ -0,0 +1,71 @@
+<template>
+ <div>
+ <el-upload
+ class="pic-uploader-component"
+ :action="$http.adornUrl('/admin/file/upload/element')"
+ :headers="{Authorization: $cookie.get('Authorization')}"
+ :show-file-list="false"
+ :on-success="handleUploadSuccess"
+ :before-upload="beforeAvatarUpload">
+ <img v-if="value" :src="resourcesUrl + value" class="pic">
+ <i v-else class="el-icon-plus pic-uploader-icon"></i>
+ </el-upload>
+ </div>
+</template>
+
+<script>
+ export default {
+ data () {
+ return {
+ resourcesUrl: process.env.VUE_APP_RESOURCES_URL
+ }
+ },
+ props: {
+ value: {
+ default: '',
+ type: String
+ }
+ },
+ methods: {
+ // 图片上传
+ handleUploadSuccess (response, file, fileList) {
+ this.$emit('input', file.response)
+ },
+ // 限制图片上传大小
+ beforeAvatarUpload (file) {
+ const isLt2M = file.size / 1024 / 1024 < 2
+ if (!isLt2M) {
+ this.$message.error('上传头像图片大小不能超过 2MB!')
+ }
+ return isLt2M
+ }
+ }
+ }
+</script>
+
+<style lang="scss" scoped>
+ .pic-uploader-component .el-upload {
+ border: 1px dashed #d9d9d9;
+ border-radius: 6px;
+ cursor: pointer;
+ position: relative;
+ overflow: hidden;
+ .pic-uploader-icon {
+ font-size: 28px;
+ color: #8c939d;
+ width: 178px;
+ height: 178px;
+ line-height: 178px;
+ text-align: center;
+ }
+ .pic {
+ width: 178px;
+ height: 178px;
+ display: block;
+ }
+ }
+ .pic-uploader-component .el-upload:hover {
+ border-color: #409EFF;
+ }
+
+</style>
--
Gitblit v1.9.3