diff --git a/constant/UrlConstant.js b/constant/UrlConstant.js index 6a725af..bd59b9e 100644 --- a/constant/UrlConstant.js +++ b/constant/UrlConstant.js @@ -64,6 +64,9 @@ const listInspectionTasks = baseUrl + "app/inspectionTask.listInspectionTasks"; //巡检任务详情 const listInspectionTaskDetails = baseUrl + 'app/inspectionTaskDetail.listInspectionTaskDetails'; +//巡检 +const updateInspectionTaskDetail = baseUrl + 'app/inspectionTaskDetail.updateInspectionTaskDetail' + module.exports = { baseUrl: baseUrl, @@ -96,5 +99,6 @@ module.exports = { listAdvertPhoto: listAdvertPhoto, saveOwnerRepair:saveOwnerRepair, listInspectionTasks:listInspectionTasks, - listInspectionTaskDetails:listInspectionTaskDetails + listInspectionTaskDetails:listInspectionTaskDetails, + updateInspectionTaskDetail:updateInspectionTaskDetail }; \ No newline at end of file diff --git a/factory/Base64Factory.js b/factory/Base64Factory.js index c7852b5..bd6211c 100644 --- a/factory/Base64Factory.js +++ b/factory/Base64Factory.js @@ -4,43 +4,92 @@ * add by wuxw 2020-01-01 美丽的夏都西宁 */ class Base64Factory { - constructor() {} + constructor() {} - static urlTobase64(url) { - return new Promise((resolve, reject) => { - uni.request({ - url: url, - method:'GET', - responseType: 'arraybuffer', - success: ress => { - let base64 = wx.arrayBufferToBase64(ress.data); //把arraybuffer转成base64 - base64 = 'data:image/jpeg;base64,' + base64 //不加上这串字符,在页面无法显示的哦 - console.log(base64); - resolve(base64); - }, - fail: function (e) { - console.log(e); - reject(e); - } - }); - /* wx.getFileSystemManager().readFile({ - filePath: url, - //选择图片返回的相对路径 - encoding: 'base64', - //编码格式 - success: res => { - //成功的回调 - //console.log('data:image/png;base64,' + res.data); - let base64 = 'data:image/png;base64,' + res.data; - resolve(base64); - }, - fail: function (e) { - console.log(e); - reject(e); - } - }); */ - }); - } + static getLocalFilePath(path) { + if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf( + '_downloads') === 0) { + return path + } + if (path.indexOf('file://') === 0) { + return path + } + if (path.indexOf('/storage/emulated/0/') === 0) { + return path + } + if (path.indexOf('/') === 0) { + var localFilePath = plus.io.convertAbsoluteFileSystem(path) + if (localFilePath !== path) { + return localFilePath + } else { + path = path.substr(1) + } + } + return '_www/' + path + } + + static urlTobase64(url) { + //url = Base64Factory.getLocalFilePath(url); + + return new Promise((resolve, reject) => { + console.log('url', url); + // #ifdef H5 + let imgData; + let reader = new FileReader(); + getImageBlob(url, function(blob) { + reader.readAsDataURL(blob); + }); + reader.onload = function(e) { + imgData = e.target.result; + resolve(imgData); + }; + + function getImageBlob(_url, cb) { + let xhr = new XMLHttpRequest(); + xhr.open("get", _url, true); + xhr.responseType = "blob"; + xhr.onload = function() { + if (this.status == 200) { + if (cb) cb(this.response); + } + }; + xhr.send(); + } + // #endif + // #ifdef APP-PLUS + let _imageBase64List = ''; + plus.io.resolveLocalFileSystemURL(url, + function(entry) { + // 可通过entry对象操作test.html文件 + entry.file(function(file) { + var fileReader = new plus.io.FileReader(); + fileReader.readAsDataURL(file); + fileReader.onloadend = function(evt) { + _imageBase64List = _imageBase64List.concat(evt.target.result); + resolve(_imageBase64List); + } + }) + }); + // #endif + + // #ifdef MP-WEIXIN + wx.getFileSystemManager().readFile({ + filePath: url, //选择图片返回的相对路径 + encoding: 'base64', //编码格式 + success: res => { //成功的回调 + //console.log('data:image/png;base64,' + res.data); + let base64 = 'data:image/png;base64,' + res.data; + resolve(base64); + }, + fail: function(e) { + console.log(e); + reject(e); + } + }) + // #endif + }); + + } } diff --git a/pages.json b/pages.json index 83bb80a..98761cb 100644 --- a/pages.json +++ b/pages.json @@ -150,7 +150,13 @@ ,{ "path" : "pages/excuteInspection/excuteInspection", "style" : { - "navigationBarTitleText": "执行巡检" + "navigationBarTitleText": "巡检过程" + } + } + ,{ + "path" : "pages/excuteOneInspection/excuteOneInspection", + "style" : { + "navigationBarTitleText": "执行巡检" } },{ "path" : "pages/purchaseRequest/purchaseRequest", diff --git a/pages/excuteInspection/excuteInspection.vue b/pages/excuteInspection/excuteInspection.vue index f14efb1..1c85333 100644 --- a/pages/excuteInspection/excuteInspection.vue +++ b/pages/excuteInspection/excuteInspection.vue @@ -8,12 +8,29 @@ {{item.inspectionName}} - + + + + + + + + + + + + + + + + + @@ -27,7 +44,9 @@ communityId:'', userId:'', userName:'', - taskDetails:[] + taskDetails:[], + viewImage:false, + viewImageSrc:'' } }, @@ -38,6 +57,9 @@ let _userInfo = this.java110Context.getUserInfo(); this.userName = _userInfo.userName; this.userId = _userInfo.userId; + + }, + onShow() { this._queryTaskDetail(); }, methods: { @@ -51,8 +73,7 @@ data: { communityId: _that.communityId, page: 1, - row: 100, - taskId: _that.taskId + row: 100 }, success: function(res) { // TODO 判断 @@ -60,13 +81,35 @@ // res.data.inspectionTaskDetails.forEach(function(item, index) { // item.timeStr = item.planInsTime.replace(/:\d{1,2}$/, ' '); // }); - _that.taskDetails = res.data.inspectionTaskDetails; + let _inspectionTaskDetails = res.data.inspectionTaskDetails; + _inspectionTaskDetails.forEach(function(_item){ + if(_item.state == '20200407'){ + _item.photos.forEach(function(_photoTmp) { + _photoTmp.url = _that.java110Constant.url.hcBaseUrl + _photoTmp.url; + }); + } + + }) + _that.taskDetails = _inspectionTaskDetails; } }); }, ScrollSteps() { this.scroll= this.scroll == 9 ? 0 : this.scroll + 1 + }, + _excuteInspection:function(_item){ + console.log('巡检点',_item); + uni.navigateTo({ + url:'/pages/excuteOneInspection/excuteOneInspection?taskDetailId='+_item.taskDetailId+"&taskId="+_item.taskId+"&inspectionId="+_item.inspectionId+"&inspectionName="+_item.inspectionName + }); + }, + preview: function(_src) { + this.viewImage = true; + this.viewImageSrc = _src; + }, + closeViewImage: function() { + this.viewImage = false; } } } diff --git a/pages/excuteOneInspection/excuteOneInspection.vue b/pages/excuteOneInspection/excuteOneInspection.vue new file mode 100644 index 0000000..1dd4b23 --- /dev/null +++ b/pages/excuteOneInspection/excuteOneInspection.vue @@ -0,0 +1,219 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue index ce6434a..5e99ede 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -27,7 +27,8 @@ - 小区文化 + + 小区文化 @@ -54,6 +55,9 @@ + + java110团队提供技术支持,交流群827669685 + @@ -347,4 +351,15 @@ .notice-startTime { margin-left: 16upx; } + + .bock-icon{ + height: 34upx; + width: 14upx; + line-height: 100upx; + background-color: #00AA00; + } + + .tec-height{ + height: 120upx; + } diff --git a/pages/inspection/inspection.vue b/pages/inspection/inspection.vue index b507ca0..0590384 100644 --- a/pages/inspection/inspection.vue +++ b/pages/inspection/inspection.vue @@ -70,7 +70,7 @@ page: 1, row: 10, planUserId: _that.userId, - state: '20200405' + }, success: function(res) { // TODO 判断