1f3f2378
起风了
我的第一次
|
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
|
<template>
<view class="main">
<view class="tp">
<view class="item" @click="scwj">
<image src="../static/wj.png" mode=""></image>
<view style="margin-top: 10rpx;">上传文件</view>
</view>
</view>
<view class="ws">
<view class="ws_item" v-for="(item,index) in wjlist" :key="index">
<view style=" width:80%;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;">{{item.name}}</view>
<image @click="delscwj(index)" class="i2" src="../static/sc.png" mode=""></image>
</view>
</view>
</view>
</template>
<script>
import BASE_URL from "@/common/config.js"
export default {
data() {
return {
BASE_URL,
wjlist: [],
fileContent: null,
task: null
}
},
watch: {
wjlist: {
deep: true,
handler() {
console.log('wjlist')
console.log(this.wjlist)
this.$emit('onchangfileJsonfile',this.wjlist);
}
},
},
methods: {
uploadImg(url) {
return new Promise((r, e) => {
uni.uploadFile({
url: this.BASE_URL + "/common/upload",
filePath: url,
name: "file",
success: (d) => r(d)
})
})
},
scwj() {
console.log("上传文件");
var that = this
uni.chooseMessageFile({
success: (res) => {
console.log("上传文件", res);
that.addfile(res.tempFiles)
}
})
},
async addfile(e) {
console.log(e)
for (let i = 0; i < e.length; i++) {
var res = await this.uploadImg(e[i].path)
console.log(res)
res = JSON.parse(res.data)
this.wjlist.push({
name: res.newFileName,
fileId: res.newFileName,
url: this.BASE_URL + res.fileName
})
}
},
delscwj(index) {
this.wjlist.splice(index, 1)
}
}
}
</script>
<style scoped lang="scss">
.main {
width: 100%;
padding: 0rpx !important;
background-color: #fff !important;
margin-top: 20rpx;
.tp {
display: flex;
justify-content: space-between;
width: 100%;
.item {
padding: 20rpx;
border: 1px dotted #D1D6E6;
border-radius: 10rpx;
width: 42%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #9EA5BB;
font-size: 20rpx;
image {
width: 40rpx;
height: 40rpx;
}
}
}
.ws {
margin-top: 30rpx;
.ws_item {
background-color: #F9FAFF;
border: 1px solid #EAEDF5;
border-radius: 10rpx;
display: flex;
justify-content: space-between;
align-items: center;
padding: 15rpx;
margin-bottom: 15rpx;
font-size: 25rpx;
.i2 {
// position: absolute;
height: 30rpx;
width: 30rpx;
// top: -5rpx;
// left: 90%;
}
}
}
}
</style>
|