From ab1c0f2c0b290a14a54e9a08e9906932e3569599 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 31 Jan 2021 21:35:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=90=E6=82=A3=E8=B7=9F=E8=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 4 +- pages/troublefollow/detail.js | 84 +++++++++++++++ pages/troublefollow/detail.json | 3 + pages/troublefollow/detail.wxml | 48 +++++++++ pages/troublefollow/detail.wxss | 1 + pages/troublefollow/handle.js | 180 ++++++++++++++++++++++++++++++++ pages/troublefollow/handle.json | 3 + pages/troublefollow/handle.wxml | 49 +++++++++ pages/troublefollow/handle.wxss | 4 + pages/troublefollow/index.js | 164 ++++++++++++++++++++++++++--- pages/troublefollow/index.json | 4 +- pages/troublefollow/index.wxml | 69 +++++++++++- pages/troublefollow/index.wxss | 15 ++- utils/util.js | 12 ++- wxs/subutil.wxs | 11 ++ 15 files changed, 632 insertions(+), 19 deletions(-) create mode 100644 pages/troublefollow/detail.js create mode 100644 pages/troublefollow/detail.json create mode 100644 pages/troublefollow/detail.wxml create mode 100644 pages/troublefollow/detail.wxss create mode 100644 pages/troublefollow/handle.js create mode 100644 pages/troublefollow/handle.json create mode 100644 pages/troublefollow/handle.wxml create mode 100644 pages/troublefollow/handle.wxss create mode 100644 wxs/subutil.wxs diff --git a/app.json b/app.json index cb6b4b9..6f72462 100644 --- a/app.json +++ b/app.json @@ -86,7 +86,9 @@ "pages/inspect/handle", "pages/train/access", "pages/dickey/treeselect", - "pages/troublefollow/index" + "pages/troublefollow/index", + "pages/troublefollow/handle", + "pages/troublefollow/detail" ], "window": { "backgroundTextStyle": "light", diff --git a/pages/troublefollow/detail.js b/pages/troublefollow/detail.js new file mode 100644 index 0000000..e1c2f61 --- /dev/null +++ b/pages/troublefollow/detail.js @@ -0,0 +1,84 @@ +// pages/inspect/detail.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + wx.request({ + url: getApp().globalData.serverUrl + 'api/troublefollowtask?a=detail&id=' + options.id, + header: { + 'content-type': 'application/json', // + 'Cookie': getApp().globalData.sessionId, + }, + method: 'GET', + success: res => { + if (res.statusCode === 200) { + this.setData(res.data) + } + } + }) + }, + previewImage: function (e) { + var current = e.target.dataset.src + wx.previewImage({ + current: current, + urls: [current] + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/troublefollow/detail.json b/pages/troublefollow/detail.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/troublefollow/detail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/troublefollow/detail.wxml b/pages/troublefollow/detail.wxml new file mode 100644 index 0000000..3c0fd2f --- /dev/null +++ b/pages/troublefollow/detail.wxml @@ -0,0 +1,48 @@ +隐患跟踪任务信息 + + + 隐患编号 + + {{trouble__yhnum}} + + + + 网格级别 + {{gridlevel__dickeyname}} + + + 任务开启 + {{taskadd}} + + + 任务关闭 + {{taskexpire}} + + + + 跟踪备注 + + {{tasknote}} + + + + + 任务状态 + + 已执行 + 未执行 + + + + 执行时间 + {{taskdo}} + + + + 跟踪描述 + + {{desc}} + + + + diff --git a/pages/troublefollow/detail.wxss b/pages/troublefollow/detail.wxss new file mode 100644 index 0000000..7df1b17 --- /dev/null +++ b/pages/troublefollow/detail.wxss @@ -0,0 +1 @@ +/* pages/troublefollow/detail.wxss */ \ No newline at end of file diff --git a/pages/troublefollow/handle.js b/pages/troublefollow/handle.js new file mode 100644 index 0000000..ac0637a --- /dev/null +++ b/pages/troublefollow/handle.js @@ -0,0 +1,180 @@ +// pages/inspect/detail.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + desc:'', + img:'' + }, + binddescInput: function (e) { + this.data.desc = e.detail.value + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.data.id=options.id; + wx.request({ + url: getApp().globalData.serverUrl + 'api/troublefollowtask?a=detail&id=' + options.id, + header: { + 'content-type': 'application/json', // + 'Cookie': getApp().globalData.sessionId, + }, + method: 'GET', + success: res => { + if (res.statusCode === 200) { + // if (res.data.img) { + // res.data.img = getApp().globalData.serverUrl + res.data.img + // } + this.setData(res.data) + } + } + }) + }, + previewImage: function (e) { + var current = e.target.dataset.src + wx.previewImage({ + current: current, + urls: [current] + }) + }, + deleteImage: function (e) { + var that = this; + //var index = e.currentTarget.dataset.index; //获取当前长按图片下标 + wx.showModal({ + title: '系统提醒', + content: '确定要删除此图片吗?', + success: function (res) { + if (res.confirm) { + that.data.img2 = null + } else if (res.cancel) { + return false + } + that.setData({ + img2: that.data.img2 + }); + } + }) + }, + chooseImage: function (e) { + var that = this + wx.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], + sourceType: ['album', 'camera'], + success: function (res) { + wx.showLoading({ + title: '上传图片..', + mask: true + }) + wx.uploadFile({ + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': getApp().globalData.sessionId, + }, + url: getApp().globalData.serverUrl + 'upfile', + filePath: res.tempFilePaths[0], + name: 'upfile', + success(res) { + wx.hideLoading() + var obj = JSON.parse(res.data); + that.data.img2 = getApp().globalData.serverUrl + obj['filepath'] + that.setData({ + img2: that.data.img2 + }) + + }, + complete: function (res) { + wx.hideLoading() + } + }) + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + submit: function () { + var that = this + if(that.data.desc){ + let data = { + id:that.data.id, + desc: that.data.desc, + } + // if (that.data.img2 && that.data.img2.indexOf(getApp().globalData.serverUrl) != -1) { + // data.img2 = data.img2.replace(getApp().globalData.serverUrl, '') + // } + wx.showLoading({ + title: '提交中', + }) + wx.request({ + url: getApp().globalData.serverUrl + 'api/troublefollowtask/?a=handle', + header: { + 'content-type': 'application/json', // 默认值 + 'Cookie': getApp().globalData.sessionId, + }, + method: 'POST', + data: data, + success: res => { + wx.navigateBack({ + + }) + wx.hideLoading(); + } + }); + }else{ + wx.showToast({ + title: '未填写跟踪描述', + icon:'none' + }) + } + + }, +}) \ No newline at end of file diff --git a/pages/troublefollow/handle.json b/pages/troublefollow/handle.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/troublefollow/handle.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/troublefollow/handle.wxml b/pages/troublefollow/handle.wxml new file mode 100644 index 0000000..d3b6a44 --- /dev/null +++ b/pages/troublefollow/handle.wxml @@ -0,0 +1,49 @@ +隐患跟踪任务信息 + + + + + 隐患编号 + + {{trouble__yhnum}} + + + + 网格级别 + {{gridlevel__dickeyname}} + + + 任务开启 + {{taskadd}} + + + 任务关闭 + {{taskexpire}} + + + + 跟踪备注 + + {{tasknote}} + + + + +跟踪描述 + + + +