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
<!-- ******************* 文件上传 ******************* -->
<template>
<view class="file-box">
<view class="u-flex" @click="selectUpload">
<view class="txt u-flex-1">{{item.fieldsTitle}}</view>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
<view class="pics u-flex u-flex-wrap">
<u-image class="pic" v-for="(item,index) in imgList" width="170rpx" height="170" :src="item.path"></u-image>
<!-- <u-image class="pic" v-for="item in 6" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image> -->
</view>
<u-popup v-model="maskShow" mode="center" width="500">
<view class="upload-box u-p-30">
<view class="title">请选择图片</view>
<view class="u-flex u-row-between">
<view class="upload-item u-text-center" @click="uploadFile('photo')">
<u-image class="pic" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image>
相册
</view>
<view class="upload-item u-text-center" @click="uploadFile">
<u-image class="pic" width="170rpx" height="170" src="'https://cdn.uviewui.com/uview/example/fade.jpg"></u-image>
拍摄
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import objMixin from './objMixin'
import baseFile from '@/components/upload/index';
export default {
name: 'XhFiles',
components: {},
mixins: [objMixin,baseFile],
props: {},
filters:{},
data() {
return {
maskShow:false
}
},
computed: {
settings() {
return this.item.settings || []
}
},
watch: {},
mounted() {},
methods: {
selectUpload(){
// 弹窗展示
this.maskShow = true
},
async uploadFile(type){
const self = this
if(type&&type==='photo'){
// 直接打开相册
let config = {
options:{
sourceType:['album'],//['album', 'camera']
}
}
await this.chooseImage('qiniu',config)
self.setValue()
return
}
// 使用拍照工具拍摄
},
setValue() {
const dataValue = []
this.imgList.map(item=>{
dataValue.push(item.key)
})
this.valueChange(dataValue)
}
}
}
</script>
<style lang="scss" scoped>
.pic{
margin-right: 15rpx;
margin-bottom: 15rpx;
&:nth-child(3n){
margin-right: 0;
}
}
// .list {
// display: flex;
// .txt {
// color: #666;
// padding: 10rpx;
// &.active {
// background-color: red;
// color: #fff;
// }
// }
// }
</style>