diff --git a/miniprogram/pages/workReport/workReport.js b/miniprogram/pages/workReport/workReport.js
index 22b1c8c..36888ca 100644
--- a/miniprogram/pages/workReport/workReport.js
+++ b/miniprogram/pages/workReport/workReport.js
@@ -129,10 +129,9 @@ Page({
callback(false);
}
},
- //上传数据
+ //上传文件数据
handleUploadFile(e){
const { file } = e.detail;
- console.log(file,'file');
let _fileList = this.data.fileList;
_fileList.push({
name:file.name,
@@ -144,6 +143,47 @@ Page({
})
},
+ //上传图片数据
+ handleUploadImg(){
+ let _this = this;
+ wx.chooseMedia({
+ count:3,
+ mediaType:['image','video'],
+ sourceType:['album', 'camera'],
+ maxDuration:60, //视频拍摄时长,3s-60s
+ success(res){
+ let _isUpload = false;
+ res.tempFiles.forEach(item => {
+ if(item.size > 10485760){
+ _isUpload = true;
+ }
+ });
+ if(_isUpload){
+ wx.showToast({
+ title:'图片或视频不能大于10MB!',
+ icon:'none',
+ duration:1500
+ })
+ return false;
+ }
+ let _filesArr = res.tempFiles;
+ let _fileList = _this.data.fileList;
+ _filesArr.forEach(item => {
+ let _lastNum = item.tempFilePath.lastIndexOf('/')+1;
+ let _name =item.tempFilePath.substr(_lastNum,item.tempFilePath.length);
+ _fileList.push({
+ name:_name,
+ url:item.tempFilePath,
+ index:_fileList.length
+ })
+ })
+ _this.setData({
+ fileList:_fileList
+ })
+ }
+ })
+ },
+
//预览文件
handlePreView(e){
let _url = e.currentTarget.dataset.url;
@@ -247,15 +287,20 @@ Page({
duration:1500
});
setTimeout(function () {
- _this.setData({
- "searchForm.target":'',
- "searchForm.targetId":'',
- targetOpt:[],
- mainActiveIndex:0,
- activeId:null,
- detailData:null,
- fileList:[]
- })
+ if(_this.data.isRadio){
+ wx.navigateBack();
+ }else{
+ _this.setData({
+ "searchForm.target":'',
+ "searchForm.targetId":'',
+ targetOpt:[],
+ mainActiveIndex:0,
+ activeId:null,
+ detailData:null,
+ fileList:[]
+ })
+ _this.loadTargetData({type:_this.data.searchForm.type});
+ }
},1500)
}else{
wx.showToast({
diff --git a/miniprogram/pages/workReport/workReport.wxml b/miniprogram/pages/workReport/workReport.wxml
index 31c6f19..e14f162 100644
--- a/miniprogram/pages/workReport/workReport.wxml
+++ b/miniprogram/pages/workReport/workReport.wxml
@@ -41,8 +41,15 @@
bind:before-read="handleBeforeUpload"
bind:after-read="handleUploadFile"
>
- 上传附件
+ 上传附件
+ 上传图片
diff --git a/project.config.json b/project.config.json
index 07619d2..ab39d12 100644
--- a/project.config.json
+++ b/project.config.json
@@ -52,5 +52,5 @@
"ignore": [],
"include": []
},
- "appid": "wx34ec155189941298"
+ "appid": "wxe692498cf5fe6b82"
}
\ No newline at end of file