|
|
@ -29,6 +29,18 @@ |
|
|
|
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon> |
|
|
|
</view> |
|
|
|
</u-form-item> |
|
|
|
<view class="image"> |
|
|
|
<view class="image-list" v-if='imgList.length>0'> |
|
|
|
<view class="image-item" v-for="(item,index) in imgList" :key="index"> |
|
|
|
<image :src="item" mode=""></image> |
|
|
|
<u-icon name="close-circle-fill" color="red" class="close" size="36" @click="delImage(index)"> |
|
|
|
</u-icon> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="image-item image-item1" @click="chooseImage" v-if='imgList.length<3'> |
|
|
|
<image src="../../static/images/photo.png" mode=""></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</u-form> |
|
|
|
<view class="footer"> |
|
|
|
<view class="btns"> |
|
|
@ -46,23 +58,26 @@ |
|
|
|
import * as deviceApi from "@/api/device.js" |
|
|
|
import * as moldApi from "@/api/mold.js" |
|
|
|
import * as dictApi from "@/api/dict.js" |
|
|
|
import * as uploadApi from "@/api/upload.js" |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
loading: false, |
|
|
|
type: "", |
|
|
|
appDeviceMoldType:[], |
|
|
|
appDeviceMoldType: [], |
|
|
|
form: { |
|
|
|
describes: "", |
|
|
|
deviceNumber: '', |
|
|
|
deviceName: '', |
|
|
|
factoryAreaName: '', |
|
|
|
factoryAreaNumber: '', |
|
|
|
receiverType:'' |
|
|
|
receiverType: '' |
|
|
|
}, |
|
|
|
singleColumnShow: false, |
|
|
|
singleColumnDefaultValue: [], |
|
|
|
singleColumnList: [], |
|
|
|
imgList: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
@ -181,12 +196,39 @@ |
|
|
|
this.$emit('singleColumn', this.field, this.form[this.field]) |
|
|
|
this.$forceUpdate() |
|
|
|
}, |
|
|
|
|
|
|
|
chooseImage() { |
|
|
|
uni.chooseImage({ |
|
|
|
count: 1, // 默认9 |
|
|
|
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有 |
|
|
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 |
|
|
|
success: (res) => { |
|
|
|
let filePath = res.tempFilePaths[0] |
|
|
|
this.$modal.loading() |
|
|
|
uploadApi.uploadFile({ |
|
|
|
filePath: filePath, |
|
|
|
name: 'file', |
|
|
|
formData: { |
|
|
|
'user': 'test' |
|
|
|
}, |
|
|
|
}).then(ret => { |
|
|
|
this.$modal.closeLoading() |
|
|
|
this.imgList.push(ret.data) |
|
|
|
console.log(ret) |
|
|
|
}).catch((err) => { |
|
|
|
this.$modal.closeLoading() |
|
|
|
}); |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 删除图片 |
|
|
|
delImage(index) { |
|
|
|
this.imgList.splice(index, 1) |
|
|
|
} |
|
|
|
}, |
|
|
|
async onLoad(option) { |
|
|
|
if (option.type) this.type = option.type; |
|
|
|
this.appDeviceMoldType = await dictApi.getDict('app_device_mold_type') |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
@ -239,7 +281,8 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.select { |
|
|
|
|
|
|
|
.select { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
height: 72rpx; |
|
|
@ -258,6 +301,7 @@ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.footer { |
|
|
|
position: fixed; |
|
|
|
bottom: 0px; |
|
|
@ -302,4 +346,51 @@ |
|
|
|
text-align: center; |
|
|
|
font-size: 28rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.image { |
|
|
|
padding: 0px 30rpx; |
|
|
|
padding-bottom: 30rpx; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
|
|
|
|
flex-wrap: wrap; |
|
|
|
|
|
|
|
.image-list { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
flex-wrap: wrap; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.image-item { |
|
|
|
width: 210rpx; |
|
|
|
height: 210rpx; |
|
|
|
margin-right: 20rpx; |
|
|
|
position: relative; |
|
|
|
border: 1px solid rgba(230, 230, 230, 0.5); |
|
|
|
margin-bottom: 20rpx; |
|
|
|
border-radius: 20rpx; |
|
|
|
overflow: hidden; |
|
|
|
|
|
|
|
image { |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
|
|
|
|
.close { |
|
|
|
position: absolute; |
|
|
|
right: 0px; |
|
|
|
top: 0px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.image-item1 { |
|
|
|
border: none; |
|
|
|
margin-right: 0px; |
|
|
|
|
|
|
|
image { |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |