| | |
| | | <view class="fs-27 mt-38 lh-38 font-bold">图片</view> |
| | | <view class="flex wrap mt-27"> |
| | | <view class="relative mr-15" v-for="item in localImageUrls" :key="item"> |
| | | <image v-if="item != 'loading'" src="/static/logo.png" class="w-140 h-140 shrink0 br-8" /> |
| | | <image v-if="item != 'loading'" :src="item" class="w-140 h-140 shrink0 br-8" /> |
| | | <view v-if="item != 'loading'" class="absolute w-140 h-140 bgcolor5 top0 left0 br-8"> |
| | | <view class="absolute" style="top: 50%;left: 50%;transform: translate(-50%,-50%);"> |
| | | <image @tap="viewImage(item)" src="@/static/Appeal/amplify.png" class="w-19 h-19 mr-35" |
| | |
| | | methods: { |
| | | viewImage(item) { |
| | | uni.previewImage({ |
| | | urls: [require('@/static/logo.png')] |
| | | urls: [item] |
| | | }) |
| | | }, |
| | | uploadImg() { |
| | |
| | | sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有 |
| | | sourceType: ['camera'], //x相机拍照 |
| | | success: (chooseImageRes) => { |
| | | this.imgUrls.push('loading') |
| | | this.againCklicFlag = true |
| | | let imgPathList = chooseImageRes.tempFilePaths; |
| | | if (imgPathList.length > 0) { |
| | | uni.uploadFile({ |
| | | url: config.BASE_URL + '/master/oss/pic', |
| | | url: config.imageUrl, |
| | | filePath: imgPathList[0], |
| | | timeout: 1000 * 45, |
| | | name: 'file', |
| | | header: { |
| | | Authorization: uni.getStorageSync('token') |
| | | Authorization: config.uploadToken |
| | | }, |
| | | success: (res) => { |
| | | if (JSON.parse(res.data).code == 200) { |
| | | let imgUrl = JSON.parse(res.data) |
| | | this.imageUrls = this.imageUrls.filter(item => item != |
| | | this.imgUrls = this.imgUrls.filter(item => item != |
| | | 'loading') |
| | | this.$nextTick(() => { |
| | | this.imageUrls.push(imgUrl) |
| | | this.imgUrls.push(imgUrl) |
| | | this.localImageUrls.push(imgPathList[0]) |
| | | }) |
| | | } else { |