From 7a7c69695d23b9dd38b56569d06402fa933bfc6a Mon Sep 17 00:00:00 2001
From: maguohua <1264889788@qq.com>
Date: Thu, 25 May 2017 21:54:42 +0800
Subject: [PATCH] add chart
---
README.md | 17 +--
package.json | 1 +
src/api/getData.js | 34 +++++-
src/components/line1.vue | 201 ------------------------------------
src/components/tendency.vue | 137 ++++++++++++++++++++++++
src/page/addGoods.vue | 20 ++--
src/page/home.vue | 71 +++++++++++--
7 files changed, 248 insertions(+), 233 deletions(-)
delete mode 100644 src/components/line1.vue
create mode 100644 src/components/tendency.vue
diff --git a/README.md b/README.md
index 2848d02..ef2bd63 100644
--- a/README.md
+++ b/README.md
@@ -1,26 +1,23 @@
# project
-此项目是后台项目[node-elm](https://github.com/bailicangdu/node-elm) 的数据管理系统。配合前台项目[vue2-elm](https://github.com/bailicangdu/vue2-elm)组成一个 后台系统 + 数据管理 + 前台展示 的完整流程。
+此项目是后台项目[node-elm](https://github.com/bailicangdu/node-elm) 的数据管理系统。
# 说明
+> vue + element-ui 构建的后台管理系统
+
> 如果对您对此项目有兴趣,可以点 "Star" 支持一下 谢谢! ^_^
> 或者您可以 "follow" 一下,我会不断开源更多的有趣的项目
> 开发环境 macOS 10.12.4 nodejs 6.10.0
-## 项目推荐:
-
-vue + vuex 大型单页面开发:[vue2-elm](https://github.com/bailicangdu/vue2-elm)
-
-vue + vuex 入门项目:[vue2-happyfri](https://github.com/bailicangdu/vue2-happyfri)
+> 如有问题请直接在 Issues 中提,或者您发现问题并有非常好的解决方案,欢迎 PR 👍
-react + redux 完整项目和个人总结:[react-pxq](https://github.com/bailicangdu/react-pxq)
+> 传送门:[前端项目地址](https://github.com/bailicangdu/vue2-elm) 、 [后台系统地址](https://github.com/bailicangdu/node-elm) 、 [原生APP项目地址](https://github.com/bailicangdu/RN-elm)
-nodejs + mongodb 构筑电商后台系统:[node-elm](https://github.com/bailicangdu/node-elm)
## 技术栈
@@ -62,10 +59,6 @@ npm run dev
# 项目截图
-## 登陆
-
-![](https://github.com/bailicangdu/vue2-manage/blob/master/screenshots/manage_login.png)
-
## 添加商店
![](https://github.com/bailicangdu/vue2-manage/blob/master/screenshots/addshop.png)
diff --git a/package.json b/package.json
index 36a4335..850f523 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,7 @@
"dependencies": {
"echarts": "^3.5.4",
"element-ui": "^1.2.9",
+ "time-formater": "^1.0.1",
"vue": "^2.2.6",
"vue-router": "^2.3.1",
"vuex": "^2.3.1"
diff --git a/src/api/getData.js b/src/api/getData.js
index 4dcf0bb..0f0f09f 100644
--- a/src/api/getData.js
+++ b/src/api/getData.js
@@ -12,6 +12,38 @@ const login = data => fetch('/admin/login', data, 'POST');
const signout = () => fetch('/admin/singout');
+/**
+ * api请求量
+ */
+
+const apiCount = date => fetch('/statis/api/' + date + '/count');
+
+/**
+ * 所有api请求量
+ */
+
+const apiAllCount = () => fetch('/statis/api/all/count');
+
+
+/**
+ * 所有api请求信息
+ */
+
+const apiAllRecord = () => fetch('/statis/api/all');
+
+/**
+ * 用户注册量求量
+ */
+
+const userCount = date => fetch('/statis/user/' + date + '/count');
+
+/**
+ * 某一天订单数量
+ */
+
+const orderCount = date => fetch('/statis/order/' + date + '/count');
+
+
/**
* 超级管理员列表
*/
@@ -176,5 +208,5 @@ const getUserInfo = user_id => fetch('/v1/user/' + user_id);
const getAddressById = address_id => fetch('/v1/addresse/' + address_id);
-export {login, signout, adminList, adminCount, cityGuess, addShop, searchplace, getCategory, addCategory, addFood, foodCategory ,getResturants, getResturantDetail, getResturantsCount, updateResturant, deleteResturant, getFoods, getFoodsCount, getMenu, updateFood, getMenuById, deleteFood, getUserList, getUserCount, getOrderList, getOrderCount, getUserInfo, getAddressById}
+export {login, signout, apiCount, apiAllCount, apiAllRecord, userCount, orderCount, adminList, adminCount, cityGuess, addShop, searchplace, getCategory, addCategory, addFood, foodCategory ,getResturants, getResturantDetail, getResturantsCount, updateResturant, deleteResturant, getFoods, getFoodsCount, getMenu, updateFood, getMenuById, deleteFood, getUserList, getUserCount, getOrderList, getOrderCount, getUserInfo, getAddressById}
diff --git a/src/components/line1.vue b/src/components/line1.vue
deleted file mode 100644
index 55950e3..0000000
--- a/src/components/line1.vue
+++ /dev/null
@@ -1,201 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/components/tendency.vue b/src/components/tendency.vue
new file mode 100644
index 0000000..a9695bf
--- /dev/null
+++ b/src/components/tendency.vue
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
diff --git a/src/page/addGoods.vue b/src/page/addGoods.vue
index 0dd9408..75573d7 100644
--- a/src/page/addGoods.vue
+++ b/src/page/addGoods.vue
@@ -143,7 +143,7 @@
return {
baseUrl,
baseImgPath,
- restaurant_id: null,
+ restaurant_id: 1,
categoryForm: {
categoryList: [],
categorySelect: '',
@@ -189,19 +189,19 @@
}
}
},
- beforeRouteEnter (to, from, next) {
- if (to.query.restaurant_id) {
- next()
- }else{
- alert('请先选择店铺');
- next('/shopList');
- }
- },
components: {
headTop,
},
created(){
- this.restaurant_id = this.$route.query.restaurant_id;
+ if (this.$route.query.restaurant_id) {
+ this.restaurant_id = this.$route.query.restaurant_id;
+ }else{
+ this.restaurant_id = Math.ceil(Math.random()*10);
+ this.$message({
+ type: 'error',
+ message: '请至商家列表页选择一个商铺'
+ });
+ }
this.initData();
},
computed: {
diff --git a/src/page/home.vue b/src/page/home.vue
index f758de0..c0a2421 100644
--- a/src/page/home.vue
+++ b/src/page/home.vue
@@ -4,26 +4,77 @@
- 1,621 浏览量
- 13,087 API请求量
- 833 新增用户
+ {{apiCount}} API请求量
+ {{userCount}} 新注册用户
+ {{orderCount}} 新增订单
-
+
@@ -31,6 +82,7 @@
@import '../style/mixin';
.data_section{
padding: 20px;
+ margin-bottom: 40px;
.section_title{
text-align: center;
font-size: 30px;
@@ -39,6 +91,7 @@
.data_list{
text-align: center;
font-size: 14px;
+ color: #666;
.data_num{
color: #333;
font-size: 26px;
--
GitLab