|
|
@@ -14,8 +14,8 @@
|
|
|
<view class="time">2021-04-21</view>
|
|
|
</view>
|
|
|
</view> -->
|
|
|
- <view class="img" v-for="(item,index) in dataList" :key="index" @tap="viewImage" :data-url="dataList[index]">
|
|
|
- <image :src="item.url" @longpress="cancel(item)"></image>
|
|
|
+ <view class="img" v-for="(item,index) in dataList" :key="index" @tap="viewImage" :data-url="dataList[index]" @longpress="cancel(item)">
|
|
|
+ <image :src="item.url" ></image>
|
|
|
<!-- <image class="close-img" src="@/static/images/close32.png" mode="" @tap.stop="delImg" :data-index="index"></image> -->
|
|
|
<view class="text">
|
|
|
<view class="title">体检报告</view>
|
|
|
@@ -31,7 +31,7 @@
|
|
|
<script>
|
|
|
|
|
|
import {
|
|
|
- addAttachment,
|
|
|
+ addAttachment,addUrl,
|
|
|
getAttachment,deleteAttachment
|
|
|
} from '@/api/companyUser.js'
|
|
|
export default {
|
|
|
@@ -47,7 +47,8 @@
|
|
|
checked: 1,
|
|
|
dataList:[],
|
|
|
imgList:[],
|
|
|
- photos:[]
|
|
|
+ photos:[],
|
|
|
+ list:[]
|
|
|
};
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
@@ -55,7 +56,7 @@
|
|
|
if(option.id){
|
|
|
this.parentId=option.id
|
|
|
uni.setNavigationBarTitle({
|
|
|
- title: option.title
|
|
|
+ title: option.fileName
|
|
|
});
|
|
|
this.getAttachment()
|
|
|
}
|
|
|
@@ -81,6 +82,7 @@
|
|
|
res => {
|
|
|
if (res.code == 200) {
|
|
|
this.dataList = res.data.list
|
|
|
+ this.list=res.data.list.map(item=>item.url)
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
@@ -144,7 +146,7 @@
|
|
|
chooseImageFunction: function(type) {
|
|
|
var that = this;
|
|
|
uni.chooseImage({
|
|
|
- count:1, // 默认9
|
|
|
+ count:10, // 默认9
|
|
|
sourceType: [type],
|
|
|
success: (res) => {
|
|
|
console.log(res,'res')
|
|
|
@@ -156,29 +158,26 @@
|
|
|
'user': 'test' // 上传附带参数
|
|
|
},
|
|
|
success: (uploadFileRes) => {
|
|
|
- // 根据接口具体返回格式 赋值具体对应url
|
|
|
- this.url=JSON.parse(uploadFileRes.data).url
|
|
|
- this.addAttachment()
|
|
|
- // if (this.imgList.length != 0) {
|
|
|
- // this.imgList = this.imgList.concat(res.tempFilePaths)
|
|
|
- // } else {
|
|
|
- // this.imgList = res.tempFilePaths
|
|
|
- // }
|
|
|
- // this.photos = this.photos.concat(JSON.parse(uploadFileRes.data).url)
|
|
|
-
|
|
|
+ console.log(uploadFileRes.data,'data')
|
|
|
+ if (this.imgList.length != 0) {
|
|
|
+ this.imgList = this.imgList.concat(res.tempFilePaths)
|
|
|
+ } else {
|
|
|
+ this.imgList = res.tempFilePaths
|
|
|
+ }
|
|
|
+ this.photos=this.photos.concat(JSON.parse(uploadFileRes.data).url)
|
|
|
+ this.addAttachment()
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
addAttachment(){
|
|
|
var data={
|
|
|
type:1,
|
|
|
- url:this.url,
|
|
|
+ urlList:this.photos,
|
|
|
parentId:this.parentId
|
|
|
}
|
|
|
- addAttachment(data).then(
|
|
|
+ addUrl(data).then(
|
|
|
res => {
|
|
|
if (res.code == 200) {
|
|
|
uni.showToast({
|
|
|
@@ -200,9 +199,11 @@
|
|
|
|
|
|
// 查看图片
|
|
|
viewImage(e) {
|
|
|
+ var data=e.currentTarget.dataset.url
|
|
|
+ // console.log(data.url,'url')
|
|
|
uni.previewImage({
|
|
|
- urls: this.imgList,
|
|
|
- current: e.currentTarget.dataset.url
|
|
|
+ urls: this.list,
|
|
|
+ current: data.url
|
|
|
});
|
|
|
},
|
|
|
// 删除上传的图片
|
|
|
@@ -275,6 +276,7 @@ margin-bottom:20rpx ;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
+
|
|
|
.close-img{
|
|
|
width: 32upx;
|
|
|
height: 32upx;
|