From 663dbe4ddca1fa409e6acbc1f77d924c161b0c39 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 09 六月 2025 17:04:50 +0800
Subject: [PATCH] 提交一把订单
---
company/src/components/common/upload.vue | 138 +++++++++++++++++++++++++--------------------
1 files changed, 76 insertions(+), 62 deletions(-)
diff --git a/company/src/components/common/upload.vue b/company/src/components/common/upload.vue
index 22d22f9..a0fcf08 100644
--- a/company/src/components/common/upload.vue
+++ b/company/src/components/common/upload.vue
@@ -17,74 +17,89 @@
</template>
<script>
- import axios from 'axios';
- export default {
- props: {
- width: {
- type: String,
- default: '90px'
- },
- height: {
- type: String,
- default: '90px'
- },
- list: {
- type: Array,
- default: []
- },
- accept: {
- type: String,
- default: ''
- },
- folder: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload'
- }
- },
-
- methods: {
- fileType(url) {
- if (url.indexOf('.mp4') !== -1) {
- return 'video'
- } else {
- return 'img'
- }
- },
- getFile(e) {
- if (e.target && e.target.files.length > 0) {
- this.$emit('loading')
- const formdate = new FormData()
- formdate.append('file', e.target.files[0])
- formdate.append('folder', this.folder)
- axios.post(this.uploadImgUrl, formdate)
- .then(res => {
- this.$emit('success', res.data.data)
- })
- .catch(e => {
- this.$message.error(e)
- })
- .finally(() => {
- this.$refs.file.value = null
- })
- }
- },
- deleItem(index) {
- this.$emit('dele', index)
- }
- }
+import axios from 'axios'
+export default {
+ props: {
+ width: {
+ type: String,
+ default: '90px'
+ },
+ height: {
+ type: String,
+ default: '90px'
+ },
+ list: {
+ type: Array,
+ default: []
+ },
+ accept: {
+ type: String,
+ default: ''
+ },
+ folder: {
+ type: String,
+ default: ''
}
+ },
+ data () {
+ return {
+ uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload'
+ }
+ },
+
+ methods: {
+ fileType (url) {
+ if (url.indexOf('.mp4') !== -1) {
+ return 'video'
+ } else {
+ return 'img'
+ }
+ },
+ getFile (e) {
+ if (e.target && e.target.files.length > 0) {
+ const loading = this.$loading({
+ lock: true,
+ text: '涓婁紶涓紝璇风瓑寰�',
+ spinner: 'el-icon-loading',
+ background: 'rgba(0, 0, 0, 0.7)'
+ });
+ this.$emit('loading')
+ const formdate = new FormData()
+ formdate.append('file', e.target.files[0])
+ formdate.append('folder', this.folder)
+ axios.post(this.uploadImgUrl, formdate)
+ .then(res => {
+ this.$emit('success', res.data.data)
+ })
+ .catch(e => {
+ this.$message.error(e)
+ })
+ .finally(() => {
+ loading.close();
+ this.$refs.file.value = null
+ })
+ }
+ },
+ deleItem (index) {
+ this.$emit('dele', index)
+ }
+ }
+}
</script>
<style lang="scss" scoped>
.file {
/*width: 100%;*/
/*height: 90px;*/
- margin: 10px 0;
+ padding: 10px;
+ box-sizing: border-box;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ position: relative;
+ margin-bottom: 10px;
+ /* margin-right: 20px; */
+ /* margin: 10px 0;*/
input {
opacity: 0;
}
@@ -138,4 +153,3 @@
}
}
</style>
-
--
Gitblit v1.9.3