diff --git a/miniprogram/app.js b/miniprogram/app.js index 75af5b0eb8be0018f6ffe7ec8cc58af6bd5efade..a2a2ba1966cf610e90e5aec443b7c73659a83b81 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -11,8 +11,8 @@ App({ // 此处请填入环境 ID, 环境 ID 可打开云控制台查看 // 如不填则使用默认环境(第一个创建的环境) // env: 'release-5b9ba9', - // env: 'test-juk88', - env: 'release-2cwn8', + env: 'test-juk88', + // env: 'release-2cwn8', traceUser: true, }) } diff --git a/miniprogram/app.json b/miniprogram/app.json index 9a5094f3478c4353a03f99827dba5e98f268fb94..84722dd6006b9929dd5c6d10f0a8684e5fcc0a99 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -17,7 +17,8 @@ "pages/report/report", "pages/report/list", "pages/focus/focus", - "pages/member/member" + "pages/member/member", + "pages/audit/audit" ], "window": { "backgroundColor": "#F6F6F6", diff --git a/miniprogram/pages/audit/audit.js b/miniprogram/pages/audit/audit.js new file mode 100644 index 0000000000000000000000000000000000000000..97f1cdb6d49f6167e5a90ffa60c368024eb856bb --- /dev/null +++ b/miniprogram/pages/audit/audit.js @@ -0,0 +1,118 @@ +// miniprogram/pages/audit/audit.js +const db = wx.cloud.database() + +Page({ + + /** + * 页面的初始数据 + */ + data: { + reports: [], + slideButtons: [{ + text: '通过' + }, { + type: 'warn', + text: '驳回', + }] + }, + + audit: function(_id, action) { + db.collection('report').doc(_id).update({ + data: { + review: action + }, + success: res => { + wx.showToast({ + title: '审核成功', + }) + this.getReports() + }, + fail: err => { + console.log(err) + wx.showToast({ + title: '审核失败', + }) + } + }) + }, + + onAuditTap: function(e) { + const _id = e.currentTarget.dataset.id + if (e.detail.index === 0) { + // 通过 + this.audit(_id, 1) + } else { + // 驳回 + this.audit(_id, 2) + } + }, + + getReports() { + db.collection('report').where({ + review: 0 + }).get({ + success: res => { + this.setData({ + reports: res.data + }) + }, + fail: console.log + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + this.getReports() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/audit/audit.json b/miniprogram/pages/audit/audit.json new file mode 100644 index 0000000000000000000000000000000000000000..b223ab964f21fcf3c509e8e0ea4ce00a04ff303b --- /dev/null +++ b/miniprogram/pages/audit/audit.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "mp-cells": "../components/cells/cells", + "mp-cell": "../components/cell/cell", + "mp-slideview": "../components/slideview/slideview" + } +} \ No newline at end of file diff --git a/miniprogram/pages/audit/audit.wxml b/miniprogram/pages/audit/audit.wxml new file mode 100644 index 0000000000000000000000000000000000000000..e4b0095d1793b0b5ec0a3ce5e87ff24aeeb20797 --- /dev/null +++ b/miniprogram/pages/audit/audit.wxml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/miniprogram/pages/audit/audit.wxss b/miniprogram/pages/audit/audit.wxss new file mode 100644 index 0000000000000000000000000000000000000000..ed2be5af30cebf8ec7b773051fa5ef01e2708195 --- /dev/null +++ b/miniprogram/pages/audit/audit.wxss @@ -0,0 +1,4 @@ +/* miniprogram/pages/audit/audit.wxss */ + +@import "../../lib/weui-miniprogram/weui-wxss/dist/style/weui.wxss"; + diff --git a/miniprogram/pages/focus/focus.js b/miniprogram/pages/focus/focus.js index c5cc61cf04da6b9cca020a480437a36e9c721fb1..50e52d5743e1da43e4af511dbb880cca5ff9a108 100644 --- a/miniprogram/pages/focus/focus.js +++ b/miniprogram/pages/focus/focus.js @@ -23,7 +23,8 @@ Page({ car: '汽车', ship: '轮船', other: '其他', - } + }, + isAdmin: false }, showMine: function() { @@ -72,6 +73,9 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { + this.setData({ + isAdmin: ['ogacd5D7Jmu1tiLuUdGfbGVOPNic', 'ogacd5OZFhnml16yxrG8h1iE26iQ'].indexOf(app.globalData.openid) > -1 + }) }, /** diff --git a/miniprogram/pages/focus/focus.wxml b/miniprogram/pages/focus/focus.wxml index 774b7c2b7d99f10153620585ef79eca1ae3d5e4c..d84f4bdfffd3b2f39fb973bc7a0205287265c0bc 100644 --- a/miniprogram/pages/focus/focus.wxml +++ b/miniprogram/pages/focus/focus.wxml @@ -1,15 +1,17 @@ + + + + + + + + - \ No newline at end of file diff --git a/miniprogram/pages/report/list.js b/miniprogram/pages/report/list.js index 8fd2e54163c13d02fd88408f454ed9b30af39fa3..9ef70caeddc1f23054f773a17c50a6bf33401829 100644 --- a/miniprogram/pages/report/list.js +++ b/miniprogram/pages/report/list.js @@ -1,5 +1,6 @@ // miniprogram/pages/report/list.js const db = wx.cloud.database() +const _ = db.command Page({ @@ -16,7 +17,7 @@ Page({ onLoad: function (options) { var roomId = options.roomId var self = this - db.collection('report').where({roomId: roomId}).get({ + db.collection('report').where({review: _.gt(0)}).get({ success: res =>{ let listData = [] for(let i in res.data){ diff --git a/miniprogram/pages/report/list.wxml b/miniprogram/pages/report/list.wxml index ffcec355500ca8fadb21896de6d67d7744b929cb..fe25e307a918115c0c32e0b80f1c38184325b0de 100644 --- a/miniprogram/pages/report/list.wxml +++ b/miniprogram/pages/report/list.wxml @@ -13,14 +13,14 @@ {{item.name}} {{item.phone}} {{item.date}} - {{item.review ? item.review: '审核中'}} + {{item.review ? (item.review === 1 ? '通过' : '驳回') : '审核中'}} {{item.rtype == 'confirm' ? '确诊': '疑似'}} {{item.name}} {{item.phone}} {{item.date}} - {{item.review ? item.review: '审核中'}} + {{item.review ? (item.review === 1 ? '通过' : '驳回') : '审核中'}} \ No newline at end of file diff --git a/miniprogram/pages/report/report.js b/miniprogram/pages/report/report.js index 1424ac8b4b720a07770da3fa3538eab79a80bcbb..d87892741f0ec7c923e0ec03c75609bd587c67f7 100644 --- a/miniprogram/pages/report/report.js +++ b/miniprogram/pages/report/report.js @@ -69,6 +69,7 @@ Page({ }) vals.roomId = this.data.roomId vals.date = getDateStr() + vals.review = 0 db.collection("report").add({ data: vals,