index.vue
3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<template>
<div class="contaienr">
<cliaims v-if="type == 'claims'"></cliaims>
<van-empty image="error" v-if="showError" description="链接缺少type参数" />
</div>
</template>
<script>
import { upload } from '@/api'
import cliaims from './components/claims.vue'
export default {
components: {
cliaims
},
data() {
return {
fileList: [],
uploadList: [],
fileURL: {},
loadingFinish: false,
type: '',
showError:false
}
},
created() {
this.getQuery()
},
mounted() {},
methods: {
getQuery() {
const { type } = window.vm.$route.query
this.type = type
this.showError = type?false:true
},
// 获取当前点击的位置
toClickUpoload() {},
beforeRead(e) {},
checkRead(file) {
if (file.size > 1024) {
this.showLoading()
return true
}
return true
},
afterRread(file, e) {
this.uploadImage(file)
},
beforeDelete(file, e) {
this.currentDelImg = file.url
this.deleteFile()
},
// 上传图片
uploadImage(file) {
const imgFile = file.content
//三种写法
// 1.substring字符串截取 2.split方法截取 比如:let temp = file.name.split('.');temp = temp[temp.length-1]
// 3.[].pop()
let fileName = file.file.name
let index = fileName.lastIndexOf('.')
fileName = fileName.substring(index + 1, fileName.length)
const base64 = fileName + '@' + imgFile.split(',')[1]
let para = {
file: base64,
fileType: 'image'
}
this.hideLoading()
// this.showLoading()
// upload.uploadImageApi(para).then(res => {
// if (res.code == 0) {
// this.uploadFile(res.data)
// } else {
// this.showToast(res.message)
// }
// })
},
// 上传附件
uploadFile(url) {},
// 删除附件
deleteFile() {}
}
}
</script>
<style lang="scss" scoped>
// .flex_ccc {
// display: flex;
// flex-direction: column;
// align-items: center;
// justify-content: center;
// }
// .flex_scb {
// display: flex;
// align-items: center;
// }
// .contaienr {
// padding: 10px 16px;
// .upload_box_wrapper {
// width: 100%;
// min-height: 156px;
// padding-bottom: 16px;
// background: #ffffff;
// box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
// border-radius: 4px;
// margin-bottom: 10px;
// .title {
// box-sizing: border-box;
// padding: 16px 10px;
// font-size: 16px;
// color: #333333;
// font-weight: 600;
// .require {
// font-size: 16px;
// color: #fe4b00;
// font-weight: 500;
// }
// }
// .main_pannel {
// box-sizing: border-box;
// padding: 0 10px;
// display: flex;
// flex-wrap: wrap;
// .box_wrap {
// width: 102px;
// height: 102px;
// background: #f5f6fa;
// > p {
// font-size: 16px;
// color: #999999;
// font-weight: 400;
// margin-top: 10px;
// }
// }
// .deleteWrap {
// position: absolute;
// left: 0;
// top: 0;
// height: 20px;
// width: 20px;
// z-index: 999;
// > img {
// height: 20px;
// width: 20px;
// }
// }
// }
// .main_pannel /deep/ .van-uploader__preview-delete {
// left: 0;
// width: 20px;
// height: 20px;
// border-radius: 50%;
// display: flex;
// align-items: center;
// justify-content: center;
// background: #3975c6;
// background-image: url('https://img01.glsx.com.cn/weapp/resource/equity-h5-new/mini/deleteIcon.png');
// background-size: 20px 20px;
// > i {
// display: none;
// }
// }
// }
// }
</style>