diff --git a/cloudfunctions-aliyun/chart-member-list/index.js b/cloudfunctions-aliyun/chart-member-list/index.js new file mode 100644 index 0000000000000000000000000000000000000000..47fcf91854f49f626e602280d82351af7a69fbd8 --- /dev/null +++ b/cloudfunctions-aliyun/chart-member-list/index.js @@ -0,0 +1,24 @@ +// 我在做这个文件,群昵称: 躺希腊额阿毛 QQ:786997741 +// TODO 条件 body_statu.status > 0 +'use strict'; +const db = uniCloud.database() +exports.main = async (event, context) => { + const collection = db.collection('member_list') + const $ = db.command.aggregate + const res = await collection.aggregate().group({ + _id: { + month: { + $month: "$body_status.time" + }, + day: { + $dayOfMonth: "$body_status.time" + }, + year: { + $year: "$body_status.time" + }, + status: "$body_status.status" + }, + count: $.sum(1) + }).end(); + return res +}; diff --git a/common/util.js b/common/util.js index b6db6d42f3db394be953d5aa5f6877c2261a5958..a126024a68b78375dc60c59f53f6e993a615ffca 100644 --- a/common/util.js +++ b/common/util.js @@ -66,8 +66,20 @@ var dateUtils = { } }; +function formatDate(year, month, day) { + return year + '-' + getTwo(month) + '-' + getTwo(day) +} + +function getTwo(num) { + if (Number(num) < 10) { + return '0' + num; + } else { + return num + } +} module.exports = { formatTime: formatTime, formatLocation: formatLocation, - dateUtils: dateUtils + dateUtils: dateUtils, + formatDate: formatDate } diff --git a/package.json b/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8ba5c0efd8d24bc82d59ae08fe76c2762908c35b --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "xinguan2020-alien-registration", + "version": "1.0.0", + "description": "新型冠状病毒疫情期间针对外来人员的登记系统", + "main": "main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://gitee.com/catpeter/xinguan2020-alien-registration.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "lodash": "^4.17.15", + "moment": "^2.24.0" + } +} diff --git a/pages.json b/pages.json index 45ab2e8008e8a2c28b9bf8e82aa257756efdbdf4..633e81c4cdaee5e32f8c5d7d3b08a62f43731e73 100644 --- a/pages.json +++ b/pages.json @@ -1,61 +1,66 @@ { - "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages - { - "path": "pages/tabbar/member", - "style": {} - }, { - "path": "pages/tabbar/add", - "style": {} - }, { - "path": "pages/tabbar/search", - "style": {} - }, { - "path": "pages/tabbar/my", - "style": {} - }, { - "path": "pages/login/login", - "style": {} - }, { - "path": "pages/add-member/add-member", - "style": {} - }, { - "path": "pages/member-detail/member-detail", - "style": {} - } - ], - "globalStyle": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "外来人员登记系统", - "navigationBarBackgroundColor": "#F8F8F8", - "backgroundColor": "#F8F8F8" - }, - "tabBar": { - "color": "#7A7E83", - "selectedColor": "#007AFF", - "borderStyle": "black", - "backgroundColor": "#F8F8F8", - "list": [{ - "pagePath": "pages/tabbar/member", - "iconPath": "static/tab_list.png", - "selectedIconPath": "static/tab_list_hl.png", - "text": "列表" - }, - { - "pagePath": "pages/tabbar/add", - "iconPath": "static/tab_add.png", - "selectedIconPath": "static/tab_add_hl.png", - "text": "新增" - }, { - "pagePath": "pages/tabbar/search", - "iconPath": "static/tab_search.png", - "selectedIconPath": "static/tab_search_hl.png", - "text": "搜索" - }, { - "pagePath": "pages/tabbar/my", - "iconPath": "static/tab_my.png", - "selectedIconPath": "static/tab_my_hl.png", - "text": "我的" - } - ] - } + "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { + "path": "pages/tabbar/member", + "style": {} + }, { + "path": "pages/tabbar/add", + "style": {} + }, { + "path": "pages/tabbar/search", + "style": {} + }, { + "path": "pages/tabbar/my", + "style": {} + }, { + "path": "pages/login/login", + "style": {} + }, { + "path": "pages/add-member/add-member", + "style": {} + }, + { + "path": "pages/member-detail/member-detail", + "style": {} + }, + { + "path": "pages/chart/chart", + "style": {} + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "外来人员登记系统", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#007AFF", + "borderStyle": "black", + "backgroundColor": "#F8F8F8", + "list": [{ + "pagePath": "pages/tabbar/member", + "iconPath": "static/tab_list.png", + "selectedIconPath": "static/tab_list_hl.png", + "text": "列表" + }, + { + "pagePath": "pages/tabbar/add", + "iconPath": "static/tab_add.png", + "selectedIconPath": "static/tab_add_hl.png", + "text": "新增" + }, { + "pagePath": "pages/tabbar/search", + "iconPath": "static/tab_search.png", + "selectedIconPath": "static/tab_search_hl.png", + "text": "搜索" + }, { + "pagePath": "pages/tabbar/my", + "iconPath": "static/tab_my.png", + "selectedIconPath": "static/tab_my_hl.png", + "text": "我的" + } + ] + } } diff --git a/pages/chart/chart.vue b/pages/chart/chart.vue index 81298c2be28885e119ba40e383da6e75fa56fe38..16d49ac035a7eaaa124d27d1a4cbe22fb9db86b3 100644 --- a/pages/chart/chart.vue +++ b/pages/chart/chart.vue @@ -1,3 +1,4 @@ +// 我在做这个文件,群昵称: 躺希腊额阿毛 QQ:786997741