| New file |
| | |
| | | <!-- filepath: /d:/work/drone-web-manage/src/views/license/upload.vue --> |
| | | <template> |
| | | <basic-container> |
| | | <el-upload |
| | | class="upload-demo" |
| | | drag |
| | | :http-request="customUpload" |
| | | :show-file-list="false" |
| | | accept=".lic" |
| | | > |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
| | | <div class="el-upload__tip">仅支持扩展名:lic</div> |
| | | </el-upload> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { uploadLicense } from '@/api/license/uploadLicense'; |
| | | |
| | | export default { |
| | | methods: { |
| | | async customUpload({ file }) { |
| | | try { |
| | | const response = await uploadLicense(file); |
| | | if (response.data.success) { |
| | | this.$message.success('文件上传成功'); |
| | | } else { |
| | | this.$message.error(response.data.message || '文件上传失败'); |
| | | } |
| | | } catch (error) { |
| | | console.error('上传失败:', error); |
| | | this.$message.error('文件上传失败'); |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .upload-demo { |
| | | width: 100%; |
| | | border: 2px dashed #d9d9d9; |
| | | border-radius: 6px; |
| | | background-color: #fafafa; |
| | | text-align: center; |
| | | padding: 40px 20px; |
| | | } |
| | | .el-upload__text { |
| | | font-size: 16px; |
| | | color: #606266; |
| | | } |
| | | .el-upload__tip { |
| | | font-size: 12px; |
| | | color: #909399; |
| | | } |
| | | </style> |