|
@@ -327,7 +327,7 @@
|
|
|
<view style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
|
|
|
<!-- -->
|
|
|
<image :src="loadImgSrc('updateimg.png')" mode=""
|
|
|
- style="width: 200rpx; height: 150rpx; margin: 0 12rpx; " @click="chooseFile()"></image>
|
|
|
+ style="width: 200rpx; height: 150rpx; margin: 0 12rpx; " @click="choose"></image>
|
|
|
<view v-for="(item,index) in fileArr" :key="index" style="position: relative;">
|
|
|
<view style="width: 100rpx; height: 100rpx; margin: 0 12rpx;">
|
|
|
<image
|
|
@@ -548,7 +548,6 @@
|
|
|
'jpeg') {
|
|
|
this.imgList.push(this.fileArr[i].picUrl);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -572,16 +571,24 @@
|
|
|
this.needSupportText = "否";
|
|
|
}
|
|
|
},
|
|
|
- chooseFile() {
|
|
|
- if (this.isEmpty(this.projectObj.id)) {
|
|
|
- this.$modal.msg('请选择工程')
|
|
|
- return;
|
|
|
- }
|
|
|
+ choose() {
|
|
|
+ let _this = this;
|
|
|
+ uni.showActionSheet({
|
|
|
+ title: '上传',
|
|
|
+ itemList: ['图片', '视频'],
|
|
|
+ success: (res) => {
|
|
|
+ if (res.tapIndex == 0) {
|
|
|
+ this.chooseimage()
|
|
|
+ } else {
|
|
|
+ this.choosevideo()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ chooseimage() {
|
|
|
let _this = this;
|
|
|
- uni.chooseMessageFile({
|
|
|
- // sizeType: ['album', 'camera'],
|
|
|
- type: 'all',
|
|
|
- // extension: ['dwg', 'dwt', 'doc', 'docx', 'xls', 'xlsx', 'jpg', 'png', 'jpeg', 'mp4'],
|
|
|
+ uni.chooseImage({
|
|
|
+ sizeType: ['album', 'camera'],
|
|
|
success(resp) {
|
|
|
resp.tempFiles.forEach((item, index) => {
|
|
|
const task = uni.uploadFile({
|
|
@@ -590,53 +597,105 @@
|
|
|
name: 'file',
|
|
|
formData: {},
|
|
|
header: _this.headers,
|
|
|
-
|
|
|
+
|
|
|
success: res => {
|
|
|
// 判断是否json字符串,将其转为json格式
|
|
|
let data = JSON.parse(res.data);
|
|
|
-
|
|
|
if (![200].includes(data.code)) {
|
|
|
_this.$modal.msg(data.msg)
|
|
|
} else {
|
|
|
if (_this.progress === 100) {
|
|
|
-
|
|
|
_this.fileArr.push({
|
|
|
'fileName': item
|
|
|
.name,
|
|
|
'picUrl': data
|
|
|
.data.url,
|
|
|
- })
|
|
|
+ });
|
|
|
+ _this.imgList.push(data.data.url);
|
|
|
_this.$modal.msg('上传成功!')
|
|
|
+ _this.photo = false;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
fail: e => {
|
|
|
_this.$modal.msg('上传失败!')
|
|
|
- //_this.uploadError(index, e);
|
|
|
},
|
|
|
complete: res => {
|
|
|
uni.hideLoading();
|
|
|
_this.uploading = false;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
task.onProgressUpdate(res => {
|
|
|
_this.progress = res.progress;
|
|
|
-
|
|
|
uni.showLoading({
|
|
|
title: '上传中'
|
|
|
})
|
|
|
if (_this.progress != 100) {
|
|
|
_this.loading = false
|
|
|
-
|
|
|
} else {
|
|
|
_this.loading = true
|
|
|
-
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ choosevideo() {
|
|
|
+ let _this = this;
|
|
|
+ uni.chooseVideo({
|
|
|
+ sourceType: ['album', 'camera'],
|
|
|
+ maxDuration: 30,
|
|
|
+ success(resp) {
|
|
|
+ const task = uni.uploadFile({
|
|
|
+ url: _this.$HTTP + `/obs`,
|
|
|
+ filePath: resp.tempFilePath,
|
|
|
+ name: 'file',
|
|
|
+ formData: {},
|
|
|
+ header: _this.headers,
|
|
|
+ success: res => {
|
|
|
+ // 判断是否json字符串,将其转为json格式
|
|
|
+ let data = JSON.parse(res.data);
|
|
|
+ if (![200].includes(res.statusCode)) {
|
|
|
+ this.uploadError(index, data);
|
|
|
+ } else {
|
|
|
+ //上传成功
|
|
|
+ if (_this.progress === 100) {
|
|
|
+ _this.fileArr.push({
|
|
|
+ 'fileName': item
|
|
|
+ .name,
|
|
|
+ 'picUrl': data
|
|
|
+ .data.url,
|
|
|
+ })
|
|
|
+ _this.$modal.msg('上传成功!')
|
|
|
+ _this.photo = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: e => {
|
|
|
+ _this.$modal.msg('上传失败!')
|
|
|
+ this.uploadError(index, e);
|
|
|
+ },
|
|
|
+ complete: res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ _this.uploading = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ task.onProgressUpdate(res => {
|
|
|
+ _this.progress = res.progress;
|
|
|
+ uni.showLoading({
|
|
|
+ title: '上传中'
|
|
|
+ })
|
|
|
+ if (_this.progress != 100) {
|
|
|
+ _this.loading = false
|
|
|
+ } else {
|
|
|
+ _this.loading = true
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
},
|
|
|
})
|
|
|
},
|
|
@@ -779,6 +838,7 @@
|
|
|
return;
|
|
|
}
|
|
|
this.projectObj.enginTime = this.projectTime;
|
|
|
+
|
|
|
this.projectObj.pics = this.fileArr;
|
|
|
|
|
|
uni.showLoading()
|