cr 6 years ago
commit
83966a5ecb
44 changed files with 1741 additions and 0 deletions
  1. 12 0
      README.md
  2. 31 0
      cloudfunctions/login/index.js
  3. 14 0
      cloudfunctions/login/package.json
  4. 15 0
      miniprogram/app.js
  5. 17 0
      miniprogram/app.json
  6. 3 0
      miniprogram/app.wxss
  7. 120 0
      miniprogram/ec-canvas/ec-canvas.js
  8. 4 0
      miniprogram/ec-canvas/ec-canvas.json
  9. 4 0
      miniprogram/ec-canvas/ec-canvas.wxml
  10. 4 0
      miniprogram/ec-canvas/ec-canvas.wxss
  11. 22 0
      miniprogram/ec-canvas/echarts.js
  12. 97 0
      miniprogram/ec-canvas/wx-canvas.js
  13. BIN
      miniprogram/images/down.png
  14. BIN
      miniprogram/images/logo.png
  15. BIN
      miniprogram/images/up.png
  16. 66 0
      miniprogram/pages/bind/bind.js
  17. 1 0
      miniprogram/pages/bind/bind.json
  18. 28 0
      miniprogram/pages/bind/bind.wxml
  19. 40 0
      miniprogram/pages/bind/bind.wxss
  20. 66 0
      miniprogram/pages/details/details.js
  21. 1 0
      miniprogram/pages/details/details.json
  22. 68 0
      miniprogram/pages/details/details.wxml
  23. 17 0
      miniprogram/pages/details/details.wxss
  24. 107 0
      miniprogram/pages/index/index.js
  25. 5 0
      miniprogram/pages/index/index.json
  26. 120 0
      miniprogram/pages/index/index.wxml
  27. 156 0
      miniprogram/pages/index/index.wxss
  28. 118 0
      miniprogram/pages/index/source-chart-opt.js
  29. 144 0
      miniprogram/pages/index/today-chart-opt.js
  30. 66 0
      miniprogram/pages/self/self.js
  31. 1 0
      miniprogram/pages/self/self.json
  32. 23 0
      miniprogram/pages/self/self.wxml
  33. 46 0
      miniprogram/pages/self/self.wxss
  34. 75 0
      miniprogram/pages/setting/setting.js
  35. 1 0
      miniprogram/pages/setting/setting.json
  36. 8 0
      miniprogram/pages/setting/setting.wxml
  37. 12 0
      miniprogram/pages/setting/setting.wxss
  38. 66 0
      miniprogram/pages/time-filter/time-filter.js
  39. 1 0
      miniprogram/pages/time-filter/time-filter.json
  40. 31 0
      miniprogram/pages/time-filter/time-filter.wxml
  41. 56 0
      miniprogram/pages/time-filter/time-filter.wxss
  42. 22 0
      miniprogram/style/components/black.wxss
  43. 12 0
      miniprogram/style/style.wxss
  44. 41 0
      project.config.json

+ 12 - 0
README.md

@@ -0,0 +1,12 @@
1
+# 云开发 quickstart
2
+
3
+这是云开发的快速启动指引,其中演示了如何上手使用云开发的三大基础能力:
4
+
5
+- 数据库:一个既可在小程序前端操作,也能在云函数中读写的 JSON 文档型数据库
6
+- 文件存储:在小程序前端直接上传/下载云端文件,在云开发控制台可视化管理
7
+- 云函数:在云端运行的代码,微信私有协议天然鉴权,开发者只需编写业务逻辑代码
8
+
9
+## 参考文档
10
+
11
+- [云开发文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)
12
+

+ 31 - 0
cloudfunctions/login/index.js

@@ -0,0 +1,31 @@
1
+// 云函数模板
2
+// 部署:在 cloud-functions/login 文件夹右击选择 “上传并部署”
3
+
4
+const cloud = require('wx-server-sdk')
5
+
6
+// 初始化 cloud
7
+cloud.init()
8
+
9
+/**
10
+ * 这个示例将经自动鉴权过的小程序用户 openid 返回给小程序端
11
+ * 
12
+ * event 参数包含小程序端调用传入的 data
13
+ * 
14
+ */
15
+exports.main = (event, context) => {
16
+  console.log(event)
17
+  console.log(context)
18
+
19
+  // 可执行其他自定义逻辑
20
+  // console.log 的内容可以在云开发云函数调用日志查看
21
+
22
+  // 获取 WX Context (微信调用上下文),包括 OPENID、APPID、及 UNIONID(需满足 UNIONID 获取条件)
23
+  const wxContext = cloud.getWXContext()
24
+
25
+  return {
26
+    event,
27
+    openid: wxContext.OPENID,
28
+    appid: wxContext.APPID,
29
+    unionid: wxContext.UNIONID,
30
+  }
31
+}

+ 14 - 0
cloudfunctions/login/package.json

@@ -0,0 +1,14 @@
1
+{
2
+  "name": "login",
3
+  "version": "1.0.0",
4
+  "description": "",
5
+  "main": "index.js",
6
+  "scripts": {
7
+    "test": "echo \"Error: no test specified\" && exit 1"
8
+  },
9
+  "author": "",
10
+  "license": "ISC",
11
+  "dependencies": {
12
+    "wx-server-sdk": "latest"
13
+  }
14
+}

+ 15 - 0
miniprogram/app.js

@@ -0,0 +1,15 @@
1
+//app.js
2
+App({
3
+  onLaunch: function () {
4
+    
5
+    if (!wx.cloud) {
6
+      console.error('请使用 2.2.3 或以上的基础库以使用云能力')
7
+    } else {
8
+      wx.cloud.init({
9
+        traceUser: true,
10
+      })
11
+    }
12
+
13
+    this.globalData = {}
14
+  }
15
+})

+ 17 - 0
miniprogram/app.json

@@ -0,0 +1,17 @@
1
+{
2
+  "pages": [
3
+    "pages/index/index",
4
+    "pages/setting/setting",
5
+    "pages/self/self",
6
+    "pages/bind/bind",
7
+    "pages/details/details",
8
+    "pages/time-filter/time-filter"
9
+  ],
10
+  "window": {
11
+    "backgroundColor": "#F6F6F6",
12
+    "backgroundTextStyle": "light",
13
+    "navigationBarBackgroundColor": "#ffffff",
14
+    "navigationBarTitleText": "view-app",
15
+    "navigationBarTextStyle": "black"
16
+  }
17
+}

+ 3 - 0
miniprogram/app.wxss

@@ -0,0 +1,3 @@
1
+/**app.wxss**/
2
+@import "/style/style.wxss";
3
+@import "/style/components/black.wxss";

+ 120 - 0
miniprogram/ec-canvas/ec-canvas.js

@@ -0,0 +1,120 @@
1
+import WxCanvas from './wx-canvas';
2
+import * as echarts from './echarts';
3
+
4
+let ctx;
5
+
6
+Component({
7
+  properties: {
8
+    canvasId: {
9
+      type: String,
10
+      value: 'ec-canvas'
11
+    },
12
+
13
+    ec: {
14
+      type: Object
15
+    }
16
+  },
17
+
18
+  data: {
19
+
20
+  },
21
+
22
+  ready: function () {
23
+    if (!this.data.ec) {
24
+      console.warn('组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" '
25
+        + 'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>');
26
+      return;
27
+    }
28
+
29
+    if (!this.data.ec.lazyLoad) {
30
+      this.init();
31
+    }
32
+  },
33
+
34
+  methods: {
35
+    init: function (callback) {
36
+      const version = wx.version.version.split('.').map(n => parseInt(n, 10));
37
+      const isValid = version[0] > 1 || (version[0] === 1 && version[1] > 9)
38
+        || (version[0] === 1 && version[1] === 9 && version[2] >= 91);
39
+      if (!isValid) {
40
+        console.error('微信基础库版本过低,需大于等于 1.9.91。'
41
+          + '参见:https://github.com/ecomfe/echarts-for-weixin'
42
+          + '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82');
43
+        return;
44
+      }
45
+
46
+      ctx = wx.createCanvasContext(this.data.canvasId, this);
47
+
48
+      const canvas = new WxCanvas(ctx, this.data.canvasId);
49
+
50
+      echarts.setCanvasCreator(() => {
51
+        return canvas;
52
+      });
53
+
54
+      var query = wx.createSelectorQuery().in(this);
55
+      query.select('.ec-canvas').boundingClientRect(res => {
56
+        if (typeof callback === 'function') {
57
+          this.chart = callback(canvas, res.width, res.height);
58
+        }
59
+        else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
60
+          this.chart = this.data.ec.onInit(canvas, res.width, res.height);
61
+        }
62
+        else {
63
+          this.triggerEvent('init', {
64
+            canvas: canvas,
65
+            width: res.width,
66
+            height: res.height
67
+          });
68
+        }
69
+      }).exec();
70
+    },
71
+
72
+    canvasToTempFilePath(opt) {
73
+      if (!opt.canvasId) {
74
+        opt.canvasId = this.data.canvasId;
75
+      }
76
+
77
+      ctx.draw(true, () => {
78
+        wx.canvasToTempFilePath(opt, this);
79
+      });
80
+    },
81
+
82
+    touchStart(e) {
83
+      if (this.chart && e.touches.length > 0) {
84
+        var touch = e.touches[0];
85
+        this.chart._zr.handler.dispatch('mousedown', {
86
+          zrX: touch.x,
87
+          zrY: touch.y
88
+        });
89
+        this.chart._zr.handler.dispatch('mousemove', {
90
+          zrX: touch.x,
91
+          zrY: touch.y
92
+        });
93
+      }
94
+    },
95
+
96
+    touchMove(e) {
97
+      if (this.chart && e.touches.length > 0) {
98
+        var touch = e.touches[0];
99
+        this.chart._zr.handler.dispatch('mousemove', {
100
+          zrX: touch.x,
101
+          zrY: touch.y
102
+        });
103
+      }
104
+    },
105
+
106
+    touchEnd(e) {
107
+      if (this.chart) {
108
+        const touch = e.changedTouches ? e.changedTouches[0] : {};
109
+        this.chart._zr.handler.dispatch('mouseup', {
110
+          zrX: touch.x,
111
+          zrY: touch.y
112
+        });
113
+        this.chart._zr.handler.dispatch('click', {
114
+          zrX: touch.x,
115
+          zrY: touch.y
116
+        });
117
+      }
118
+    }
119
+  }
120
+});

+ 4 - 0
miniprogram/ec-canvas/ec-canvas.json

@@ -0,0 +1,4 @@
1
+{
2
+  "component": true,
3
+  "usingComponents": {}
4
+}

+ 4 - 0
miniprogram/ec-canvas/ec-canvas.wxml

@@ -0,0 +1,4 @@
1
+<canvas class="ec-canvas" canvas-id="{{ canvasId }}"
2
+bindinit="init"
3
+bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}">
4
+</canvas>

+ 4 - 0
miniprogram/ec-canvas/ec-canvas.wxss

@@ -0,0 +1,4 @@
1
+.ec-canvas {
2
+  width: 100%;
3
+  height: 100%;
4
+}

File diff suppressed because it is too large
+ 22 - 0
miniprogram/ec-canvas/echarts.js


+ 97 - 0
miniprogram/ec-canvas/wx-canvas.js

@@ -0,0 +1,97 @@
1
+export default class WxCanvas {
2
+  constructor(ctx, canvasId) {
3
+    this.ctx = ctx;
4
+    this.canvasId = canvasId;
5
+    this.chart = null;
6
+
7
+    // this._initCanvas(zrender, ctx);
8
+    this._initStyle(ctx);
9
+    this._initEvent();
10
+  }
11
+
12
+  getContext(contextType) {
13
+    if (contextType === '2d') {
14
+      return this.ctx;
15
+    }
16
+  }
17
+
18
+  // canvasToTempFilePath(opt) {
19
+  //   if (!opt.canvasId) {
20
+  //     opt.canvasId = this.canvasId;
21
+  //   }
22
+
23
+  //   return wx.canvasToTempFilePath(opt, this);
24
+  // }
25
+
26
+  setChart(chart) {
27
+    this.chart = chart;
28
+  }
29
+
30
+  attachEvent () {
31
+    // noop
32
+  }
33
+
34
+  detachEvent() {
35
+    // noop
36
+  }
37
+
38
+  _initCanvas(zrender, ctx) {
39
+    zrender.util.getContext = function () {
40
+      return ctx;
41
+    };
42
+
43
+    zrender.util.$override('measureText', function (text, font) {
44
+      ctx.font = font || '12px sans-serif';
45
+      return ctx.measureText(text);
46
+    });
47
+  }
48
+
49
+  _initStyle(ctx) {
50
+    var styles = ['fillStyle', 'strokeStyle', 'globalAlpha', 
51
+      'textAlign', 'textBaseAlign', 'shadow', 'lineWidth',
52
+      'lineCap', 'lineJoin', 'lineDash', 'miterLimit', 'fontSize'];
53
+
54
+    styles.forEach(style => {
55
+      Object.defineProperty(ctx, style, {
56
+        set: value => {
57
+          if (style !== 'fillStyle' && style !== 'strokeStyle' 
58
+            || value !== 'none' && value !== null
59
+          ) {
60
+            ctx['set' + style.charAt(0).toUpperCase() + style.slice(1)](value);
61
+          }
62
+        }
63
+      });
64
+    });
65
+
66
+    ctx.createRadialGradient = () => {
67
+      return ctx.createCircularGradient(arguments);
68
+    };
69
+  }
70
+
71
+  _initEvent() {
72
+    this.event = {};
73
+    const eventNames = [{
74
+      wxName: 'touchStart',
75
+      ecName: 'mousedown'
76
+    }, {
77
+      wxName: 'touchMove',
78
+      ecName: 'mousemove'
79
+    }, {
80
+      wxName: 'touchEnd',
81
+      ecName: 'mouseup'
82
+    }, {
83
+      wxName: 'touchEnd',
84
+      ecName: 'click'
85
+    }];
86
+
87
+    eventNames.forEach(name => {
88
+      this.event[name.wxName] = e => {
89
+        const touch = e.touches[0];
90
+        this.chart._zr.handler.dispatch(name.ecName, {
91
+          zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
92
+          zrY: name.wxName === 'tap' ? touch.clientY : touch.y
93
+        });
94
+      };
95
+    });
96
+  }
97
+}

BIN
miniprogram/images/down.png


BIN
miniprogram/images/logo.png


BIN
miniprogram/images/up.png


+ 66 - 0
miniprogram/pages/bind/bind.js

@@ -0,0 +1,66 @@
1
+// miniprogram/pages/bind/bind.js
2
+Page({
3
+
4
+  /**
5
+   * 页面的初始数据
6
+   */
7
+  data: {
8
+
9
+  },
10
+
11
+  /**
12
+   * 生命周期函数--监听页面加载
13
+   */
14
+  onLoad: function (options) {
15
+
16
+  },
17
+
18
+  /**
19
+   * 生命周期函数--监听页面初次渲染完成
20
+   */
21
+  onReady: function () {
22
+
23
+  },
24
+
25
+  /**
26
+   * 生命周期函数--监听页面显示
27
+   */
28
+  onShow: function () {
29
+
30
+  },
31
+
32
+  /**
33
+   * 生命周期函数--监听页面隐藏
34
+   */
35
+  onHide: function () {
36
+
37
+  },
38
+
39
+  /**
40
+   * 生命周期函数--监听页面卸载
41
+   */
42
+  onUnload: function () {
43
+
44
+  },
45
+
46
+  /**
47
+   * 页面相关事件处理函数--监听用户下拉动作
48
+   */
49
+  onPullDownRefresh: function () {
50
+
51
+  },
52
+
53
+  /**
54
+   * 页面上拉触底事件的处理函数
55
+   */
56
+  onReachBottom: function () {
57
+
58
+  },
59
+
60
+  /**
61
+   * 用户点击右上角分享
62
+   */
63
+  onShareAppMessage: function () {
64
+
65
+  }
66
+})

+ 1 - 0
miniprogram/pages/bind/bind.json

@@ -0,0 +1 @@
1
+{}

+ 28 - 0
miniprogram/pages/bind/bind.wxml

@@ -0,0 +1,28 @@
1
+<view class="black-head">
2
+  <text class="tit">绑定账号</text>
3
+</view>
4
+
5
+<view class="black-body diy-time">
6
+
7
+  <view class="time-item block">
8
+    <label for="phone">
9
+      手机号:
10
+    </label>
11
+    <input class="ele" id="phone" type="number"></input>
12
+  </view>
13
+
14
+  <view class="time-item block">
15
+    <label for="code">
16
+      验证码:
17
+    </label>
18
+    <view class="code-box">
19
+    <input class="ele code-ele" id="code" type="number"></input>
20
+
21
+    <button class="get-code" disabled>获 取</button>
22
+    </view>
23
+  </view>
24
+
25
+  <button class="on-ok">确定</button>
26
+</view>
27
+
28
+<view class="remarks">没有找到您的手机号,请联系您的客服为您添加账号后再绑定。</view>

+ 40 - 0
miniprogram/pages/bind/bind.wxss

@@ -0,0 +1,40 @@
1
+@import "/pages/time-filter/time-filter.wxss";
2
+
3
+.remarks {
4
+  padding-top: 40rpx;
5
+  font-size: 26rpx;
6
+  color: #999;
7
+  line-height: 1.4;
8
+}
9
+.block{
10
+  flex-direction:column;
11
+  align-items: flex-start;
12
+}
13
+.block label{
14
+  padding-bottom: 10rpx;
15
+}
16
+.block .ele,.block label{
17
+  width: 100%;
18
+}
19
+
20
+.block .code-ele{
21
+  width: calc(100% - 210rpx);
22
+}
23
+.get-code{
24
+  width: 200rpx;
25
+  box-sizing: border-box;
26
+  padding: 20rpx;
27
+  background: #e72120;
28
+  border: none;
29
+  height: 88rpx;
30
+  border-radius: 3px;
31
+  color: #fff;
32
+  font-size: 30rpx;
33
+  line-height: inherit;
34
+  margin-left: 10rpx;
35
+}
36
+.code-box{
37
+  width: 100%;
38
+  display: flex;
39
+  justify-content: space-between;
40
+}

+ 66 - 0
miniprogram/pages/details/details.js

@@ -0,0 +1,66 @@
1
+// miniprogram/pages/details/details.js
2
+Page({
3
+
4
+  /**
5
+   * 页面的初始数据
6
+   */
7
+  data: {
8
+
9
+  },
10
+
11
+  /**
12
+   * 生命周期函数--监听页面加载
13
+   */
14
+  onLoad: function (options) {
15
+
16
+  },
17
+
18
+  /**
19
+   * 生命周期函数--监听页面初次渲染完成
20
+   */
21
+  onReady: function () {
22
+
23
+  },
24
+
25
+  /**
26
+   * 生命周期函数--监听页面显示
27
+   */
28
+  onShow: function () {
29
+
30
+  },
31
+
32
+  /**
33
+   * 生命周期函数--监听页面隐藏
34
+   */
35
+  onHide: function () {
36
+
37
+  },
38
+
39
+  /**
40
+   * 生命周期函数--监听页面卸载
41
+   */
42
+  onUnload: function () {
43
+
44
+  },
45
+
46
+  /**
47
+   * 页面相关事件处理函数--监听用户下拉动作
48
+   */
49
+  onPullDownRefresh: function () {
50
+
51
+  },
52
+
53
+  /**
54
+   * 页面上拉触底事件的处理函数
55
+   */
56
+  onReachBottom: function () {
57
+
58
+  },
59
+
60
+  /**
61
+   * 用户点击右上角分享
62
+   */
63
+  onShareAppMessage: function () {
64
+
65
+  }
66
+})

+ 1 - 0
miniprogram/pages/details/details.json

@@ -0,0 +1 @@
1
+{}

+ 68 - 0
miniprogram/pages/details/details.wxml

@@ -0,0 +1,68 @@
1
+<view class="black-head">
2
+  <text class="tit">今日流量详情统计</text>
3
+</view>
4
+
5
+<view class="black-body details-list">
6
+
7
+  <view class="item">
8
+    <text class="details-key">浏览量</text>
9
+    <text class="details-val">95</text>
10
+  </view>
11
+  
12
+  <view class="item">
13
+    <text class="details-key">访客数</text>
14
+    <text class="details-val">95</text>
15
+  </view>
16
+  
17
+  <view class="item">
18
+    <text class="details-key">跳出率</text>
19
+    <text class="details-val">95</text>
20
+  </view>
21
+  
22
+  <view class="item">
23
+    <text class="details-key">平均访问时长</text>
24
+    <text class="details-val">95</text>
25
+  </view>
26
+  
27
+  <view class="item">
28
+    <text class="details-key">平均访问页面数</text>
29
+    <text class="details-val">95</text>
30
+  </view>
31
+
32
+</view>
33
+
34
+<view class="black-body data-list">
35
+
36
+  <view class="data-item">
37
+    <text class="tit">新访客数</text>
38
+    <view class="info">
39
+      <view class="num">
40
+        <!-- 最多4位数 -->
41
+        9999
42
+      </view>
43
+      <view class="trend">
44
+        <image mode="widthFix" src="/images/up.png"></image>
45
+        <view class="text">
46
+          100% 今日
47
+        </view>
48
+      </view>
49
+    </view>
50
+  </view>
51
+
52
+  <view class="data-item">
53
+    <text class="tit">老访客数</text>
54
+    <view class="info">
55
+      <view class="num">
56
+        <!-- 最多4位数 -->
57
+        32
58
+      </view>
59
+      <view class="trend">
60
+        <image mode="widthFix" src="/images/down.png"></image>
61
+        <view class="text">
62
+          3% 今日
63
+        </view>
64
+      </view>
65
+    </view>
66
+  </view>
67
+
68
+</view>

+ 17 - 0
miniprogram/pages/details/details.wxss

@@ -0,0 +1,17 @@
1
+@import "/pages/index/index.wxss";
2
+
3
+.details-list {
4
+  padding: 20rpx 0;
5
+}
6
+
7
+.details-list  .item {
8
+  font-size: 28rpx;
9
+  display: flex;
10
+  justify-content: space-between;
11
+  align-self: center;
12
+  padding: 20rpx 0;
13
+}
14
+
15
+.details-list  .details-key {
16
+  color: #999;
17
+}

+ 107 - 0
miniprogram/pages/index/index.js

@@ -0,0 +1,107 @@
1
+import * as echarts from '../../ec-canvas/echarts';
2
+import {
3
+  getToDayChartOpt
4
+} from './today-chart-opt.js';
5
+import {
6
+  getSourceChartOpt
7
+} from './source-chart-opt.js';
8
+
9
+//模拟toDay数据
10
+let toDayAata = {
11
+  dayTime: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24],
12
+  visitorNum: [17, 6, 12, 7, 9, 12, 19, 8, 14, 15, 17, 8, 18],
13
+  clickNum: [7, 19, 5, 15, 6, 11, 17, 14, 12, 16, 9, 11, 14]
14
+}
15
+
16
+Page({
17
+  data: {
18
+    //今日浏览统计chart type
19
+    toDayChartType: 'line', //line | bar
20
+    //今日浏览统计 chart
21
+    todayEc: {
22
+      lazyLoad: true,
23
+      isLoaded: false
24
+    },
25
+    //访客来源 chart
26
+    sourceEc: {
27
+      lazyLoad: true,
28
+      isLoaded: false
29
+    }
30
+  },
31
+
32
+  //今日浏览统计 chart切换
33
+  switchToDayChartType: function() {
34
+    if (this.data.toDayChartType === 'line') {
35
+      this.setData({
36
+        toDayChartType: 'bar',
37
+      })
38
+    } else {
39
+      this.setData({
40
+        toDayChartType: 'line',
41
+      })
42
+    }
43
+
44
+    if (this.toDayChart) {
45
+      this.toDayChart.setOption(getToDayChartOpt(toDayAata,this.data.toDayChartType))
46
+    }
47
+  },
48
+
49
+  //init 今日浏览统计 chart
50
+  initToDayChart: function() {
51
+    this.toDayComponent.init((canvas, width, height) => {
52
+      // 获取组件的 canvas、width、height 后的回调函数
53
+      // 在这里初始化图表
54
+      const chart = echarts.init(canvas, null, {
55
+        width: width,
56
+        height: height
57
+      });
58
+      chart.setOption(getToDayChartOpt(toDayAata, this.data.toDayChartType));
59
+
60
+      // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
61
+      this.toDayChart = chart;
62
+
63
+      this.setData({
64
+        isLoaded: true,
65
+        isDisposed: false
66
+      });
67
+
68
+      // 注意这里一定要返回 chart 实例,否则会影响事件处理等
69
+      return chart;
70
+    });
71
+  },
72
+
73
+  //init 访客来源 chart
74
+  initSourceChart: function () {
75
+    this.sourceComponent.init((canvas, width, height) => {
76
+      // 获取组件的 canvas、width、height 后的回调函数
77
+      // 在这里初始化图表
78
+      const chart = echarts.init(canvas, null, {
79
+        width: width,
80
+        height: height
81
+      });
82
+      chart.setOption(getSourceChartOpt([100,500,450]));
83
+
84
+      // 将图表实例绑定到 this 上,可以在其他成员函数(如 dispose)中访问
85
+      this.sourceDayChart = chart;
86
+
87
+      this.setData({
88
+        isLoaded: true,
89
+        isDisposed: false
90
+      });
91
+
92
+      // 注意这里一定要返回 chart 实例,否则会影响事件处理等
93
+      return chart;
94
+    });
95
+  },
96
+
97
+  onReady() {
98
+    this.toDayComponent = this.selectComponent('#today-chart');
99
+    this.sourceComponent = this.selectComponent('#source-chart');
100
+    
101
+    //模拟异步
102
+    setTimeout(()=>{
103
+      this.initToDayChart();
104
+      this.initSourceChart();
105
+    },300)
106
+  }
107
+});

+ 5 - 0
miniprogram/pages/index/index.json

@@ -0,0 +1,5 @@
1
+{
2
+  "usingComponents": {
3
+    "ec-canvas": "../../ec-canvas/ec-canvas"
4
+  }
5
+}

+ 120 - 0
miniprogram/pages/index/index.wxml

@@ -0,0 +1,120 @@
1
+<!-- 今日浏览量 -->
2
+<view class="black-head">
3
+  <text class="tit">今日浏览统计</text>
4
+  <view class="oper">
5
+    <navigator class="link" url="/pages/time-filter/time-filter">查询时间</navigator>
6
+  </view>
7
+</view>
8
+
9
+<view class="black-body data-list">
10
+
11
+  <view class="data-item">
12
+    <text class="tit">询盘书</text>
13
+    <view class="info">
14
+      <view class="num">
15
+        <!-- 最多4位数 -->
16
+        9999
17
+      </view>
18
+      <view class="trend">
19
+        <image mode="widthFix" src="/images/up.png"></image>
20
+        <view class="text">
21
+          100% 今日
22
+        </view>
23
+      </view>
24
+    </view>
25
+  </view>
26
+
27
+  <view class="data-item">
28
+    <text class="tit">询盘率</text>
29
+    <view class="info">
30
+      <view class="num">
31
+        <!-- 最多4位数 -->
32
+        32
33
+      </view>
34
+      <view class="trend">
35
+        <image mode="widthFix" src="/images/down.png"></image>
36
+        <view class="text">
37
+          3% 今日
38
+        </view>
39
+      </view>
40
+    </view>
41
+  </view>
42
+
43
+  <view class="data-item">
44
+    <text class="tit">询盘率</text>
45
+    <view class="info">
46
+      <view class="num">
47
+        <!-- 最多4位数 -->
48
+        32
49
+      </view>
50
+      <view class="trend">
51
+        <image mode="widthFix" src="/images/up.png"></image>
52
+        <view class="text">
53
+          3% 今日
54
+        </view>
55
+      </view>
56
+    </view>
57
+  </view>
58
+
59
+</view>
60
+
61
+<!-- 折线图 -->
62
+<view class="today-chart">
63
+  <text class="switch link" bindtap="switchToDayChartType"> {{toDayChartType==='line'?'切换柱状图':'切换折线图'}}</text>
64
+  <ec-canvas id="today-chart" canvas-id="today-chart" ec="{{ todayEc }}"></ec-canvas>
65
+</view>
66
+
67
+
68
+
69
+
70
+<!--访客来源 -->
71
+<view class="black-head">
72
+  <text class="tit">访客来源</text>
73
+</view>
74
+
75
+<view class="black-body source-chart">
76
+
77
+  <ec-canvas id="source-chart" canvas-id="source-chart" ec="{{ sourceEc }}"></ec-canvas>
78
+
79
+  <!-- <view class="source-info">
80
+    <view class="tit">搜狗访客</view>
81
+    <view class="des">
82
+      <view class="des-num">2222</view>
83
+      <view class="percentage">访客比例:
84
+        <text class="num">50%</text>
85
+      </view>
86
+    </view>
87
+  </view> -->
88
+
89
+</view>
90
+
91
+
92
+
93
+<!-- 访客页面 -->
94
+<view class="black-head">
95
+  <text class="tit">访客页面</text>
96
+</view>
97
+
98
+<view class="black-body visit-pages">
99
+
100
+  <view class="item">
101
+    <view class="head">
102
+      <text class="pv">PV:16</text>
103
+      <text class="date">今天</text>
104
+    </view>
105
+    <view class="info">
106
+      北京网站建设,北京微信开发,营销型网站建设北京微 信开发,营销型网站建设
107
+    </view>
108
+  </view>
109
+
110
+  <view class="item">
111
+    <view class="head">
112
+      <text class="pv">PV:16</text>
113
+      <text class="date">今天</text>
114
+    </view>
115
+    <view class="info">
116
+      北京网站建设,北京微信开发,营销型网站建设北京微 信开发,营销型网站建设
117
+    </view>
118
+  </view>
119
+
120
+</view>

+ 156 - 0
miniprogram/pages/index/index.wxss

@@ -0,0 +1,156 @@
1
+.data-list {
2
+  display: flex;
3
+  justify-content: space-between;
4
+  flex-wrap: wrap;
5
+}
6
+
7
+.data-list .data-item {
8
+  width: calc((100% - 20rpx) / 2);
9
+  border: 1rpx solid rgba(224, 224, 224, 0.5);
10
+  background-color: #fff;
11
+  min-height: 160rpx;
12
+  overflow: hidden;
13
+  box-sizing: border-box;
14
+  padding: 20rpx 26rpx;
15
+  margin-bottom: 20rpx;
16
+  display: flex;
17
+  flex-direction: column;
18
+  justify-content: space-between;
19
+}
20
+
21
+.data-list .tit {
22
+  padding-bottom: 14rpx;
23
+}
24
+
25
+.data-list .info {
26
+  display: flex;
27
+  justify-content: space-between;
28
+  align-items: center;
29
+}
30
+
31
+.data-list .num {
32
+  font-size: 40rpx;
33
+  font-weight: bold;
34
+  line-height: 1;
35
+  max-width: 50%;
36
+  word-break: break-all;
37
+}
38
+
39
+.data-list .trend {
40
+  font-size: 24rpx;
41
+  color: #999;
42
+  display: flex;
43
+  justify-content: right;
44
+  align-items: center;
45
+}
46
+
47
+.data-list .trend image {
48
+  width: 26rpx;
49
+  margin-right: 5rpx;
50
+  display: inline-block;
51
+}
52
+
53
+.data-list .trend .text {
54
+  display: inline-block;
55
+}
56
+
57
+/* 访客数 点击数 echart */
58
+
59
+.today-chart {
60
+  position: relative;
61
+  margin-bottom: 60rpx;
62
+}
63
+
64
+.today-chart .switch {
65
+  font-size: 28rpx;
66
+  position: absolute;
67
+  top: 0;
68
+  right: 0;
69
+  z-index: 5;
70
+}
71
+
72
+ec-canvas {
73
+  display: block;
74
+  width: 100%;
75
+  height: 500rpx;
76
+}
77
+
78
+/* 访客来源 */
79
+.source-chart{
80
+  margin-bottom: 30rpx;
81
+}
82
+.source-chart .source-info {
83
+  background-color: #fff;
84
+  width: 440rpx;
85
+  min-height: 140rpx;
86
+  padding: 20rpx;
87
+  box-sizing: border-box;
88
+  margin: 20rpx auto 100rpx;
89
+}
90
+
91
+.source-chart .tit {
92
+  font-size: 26rpx;
93
+  color: #666;
94
+}
95
+
96
+.source-chart .des {
97
+  display: flex;
98
+  justify-content: space-between;
99
+  align-self: center;
100
+  line-height: 48rpx;
101
+  padding-top: 20rpx;
102
+}
103
+
104
+.source-chart .des .des-num {
105
+  /* @include dan(45%); */
106
+  font-size: 48rpx;
107
+  font-weight: bold;
108
+  align-self: flex-end;
109
+  max-width: 55%;
110
+  word-break: break-all;
111
+}
112
+
113
+.source-chart .des .percentage {
114
+  /* @include dan(55%); */
115
+  font-size: 24rpx;
116
+  align-self: flex-end;
117
+  width: 45%;
118
+  text-align: right;
119
+}
120
+.source-chart .des .num{
121
+    color: #29cc24;
122
+}
123
+
124
+/* 访客页面 */
125
+
126
+.visit-pages .item {
127
+  background-color: #fff;
128
+  padding: 30rpx;
129
+  box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.09);
130
+}
131
+
132
+.visit-pages .item~.item {
133
+  margin-top: 30rpx;
134
+}
135
+
136
+.visit-pages .head {
137
+  display: flex;
138
+  justify-content: space-between;
139
+  padding-bottom: 10rpx;
140
+}
141
+
142
+.visit-pages   .pv {
143
+  font-size: 30rpx;
144
+  color: #e72120;
145
+  font-weight: bold;
146
+}
147
+
148
+.visit-pages  .date {
149
+  font-size: 24rpx;
150
+  color: #999;
151
+}
152
+
153
+.visit-pages .info {
154
+  font-size: 26rpx;
155
+  line-height: 40rpx;
156
+}

+ 118 - 0
miniprogram/pages/index/source-chart-opt.js

@@ -0,0 +1,118 @@
1
+
2
+/**
3
+ * 获取访客来源chart'opt
4
+ * 
5
+ * data:number[]    [百度,360,搜狗]
6
+ * 
7
+ */
8
+
9
+export let getSourceChartOpt =function(dataArr){
10
+  return {
11
+    tooltip: {
12
+      trigger: 'item',
13
+      formatter: "{a} {b}: {c} ({d}%)"
14
+    },
15
+    legend: {
16
+      data: [
17
+        {
18
+          name: '百度',
19
+          icon: 'rect',
20
+          itemStyle: {
21
+            color: 'red'
22
+          }
23
+        },
24
+        {
25
+          name: '360',
26
+          icon: 'rect'
27
+        },
28
+        {
29
+          name: '搜狗',
30
+          icon: 'rect'
31
+        }
32
+      ],
33
+      textStyle: {
34
+        fontSize: 14
35
+      },
36
+      left: 0,
37
+      top: 0,
38
+      itemGap: 30,
39
+      itemWidth: 20,
40
+      itemHeight: 6
41
+    },
42
+    series: [
43
+      {
44
+        name: '访问来源',
45
+        type: 'pie',
46
+        radius: ['50%', '70%'],
47
+        avoidLabelOverlap: false,
48
+        legendHoverLink: false,
49
+        label: {
50
+          normal: {
51
+            show: false,
52
+            formatter: '{c}',
53
+            position: 'center'
54
+          },
55
+          emphasis: {
56
+            show: true,
57
+            textStyle: {
58
+              fontSize: '24',
59
+              fontWeight: 'bold'
60
+            }
61
+          }
62
+        },
63
+        labelLine: {
64
+          normal: {
65
+            show: false
66
+          }
67
+        },
68
+        data: [
69
+          {
70
+            value: dataArr[0],
71
+            name: '百度',
72
+            itemStyle: {
73
+              color: {
74
+                type: 'linear',
75
+                colorStops: [{
76
+                  offset: 0, color: '#B84592' // 0% 处的颜色
77
+                }, {
78
+                  offset: 1, color: '#FF4F81' // 100% 处的颜色
79
+                }],
80
+                globalCoord: false // 缺省为 false
81
+              }
82
+            }
83
+          },
84
+          {
85
+            value: dataArr[1],
86
+            name: '360',
87
+            itemStyle: {
88
+              color: {
89
+                type: 'linear',
90
+                colorStops: [{
91
+                  offset: 0, color: '#9AFFC2' // 0% 处的颜色
92
+                }, {
93
+                  offset: 1, color: '#7F7BFF' // 100% 处的颜色
94
+                }],
95
+                globalCoord: false // 缺省为 false
96
+              }
97
+            }
98
+          },
99
+          {
100
+            value: dataArr[2],
101
+            name: '搜狗',
102
+            itemStyle: {
103
+              color: {
104
+                type: 'linear',
105
+                colorStops: [{
106
+                  offset: 0, color: '#7FA5FF' // 0% 处的颜色
107
+                }, {
108
+                  offset: 1, color: '#855EFF' // 100% 处的颜色
109
+                }],
110
+                globalCoord: false // 缺省为 false
111
+              }
112
+            }
113
+          },
114
+        ]
115
+      }
116
+    ]
117
+  };
118
+} 

+ 144 - 0
miniprogram/pages/index/today-chart-opt.js

@@ -0,0 +1,144 @@
1
+//mock
2
+// {
3
+//   dayTime: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24],
4
+//   visitorNum: [17, 6, 12, 7, 9, 12, 19, 8, 14, 15, 17, 8, 18],
5
+//   clickNum: [7, 19, 5, 15, 6, 11, 17, 14, 12, 16, 9, 11, 14]
6
+// }
7
+
8
+
9
+/**
10
+ * 获取 toDay chart opt
11
+ * 
12
+ * data:{
13
+ *    dayTime:number[]     日期
14
+ *    visitorNum:number[]  访客数
15
+ *    clickNum:number[]    点击数
16
+ * }
17
+ * 
18
+ * type:string    显示方式   line | bar
19
+ */
20
+export let getToDayChartOpt = function(data, type) {
21
+  return {
22
+    legend: {
23
+      data: [{
24
+          name: '访客数',
25
+          icon: 'rect'
26
+        },
27
+        {
28
+          name: '点击数',
29
+          icon: 'rect'
30
+        }
31
+      ],
32
+      textStyle: {
33
+        fontSize: 14
34
+      },
35
+      left: 0,
36
+      top: 0,
37
+      itemGap: 30,
38
+      itemWidth: 20,
39
+      itemHeight: 6
40
+    },
41
+    grid: {
42
+      left: '0',
43
+      right: '0',
44
+      bottom: '0',
45
+      containLabel: true
46
+    },
47
+    tooltip: {
48
+      trigger: 'axis',
49
+      axisPointer: {
50
+        type: 'line',
51
+        lineStyle: {
52
+          color: 'rgba(0, 0, 0, 0.4)',
53
+          // width:30,
54
+          // shadowColor:'rgba(0, 0, 0, 0.5)',
55
+          // shadowBlur:1
56
+        }
57
+      }
58
+    },
59
+    xAxis: {
60
+      type: 'category',
61
+      data: data.dayTime,
62
+      boundaryGap: false, //从0开始
63
+      axisLine: { //坐标线
64
+        show: false
65
+      }, //刻度线
66
+      axisTick: {
67
+        show: false
68
+      }, //文字
69
+      axisLabel: {
70
+        color: '#666'
71
+      }
72
+    },
73
+    yAxis: {
74
+      show: false
75
+    },
76
+    series: [{
77
+        name: '访客数',
78
+        data: data.visitorNum,
79
+        type: type || 'line',
80
+        itemStyle: {
81
+          color: '#028DFF', //颜色
82
+        },
83
+        lineStyle: {
84
+          width: 2
85
+        },
86
+        showSymbol: false, //是否显示转折符号
87
+        // smooth:true,    //平滑显示
88
+        areaStyle: { //区域样式
89
+          opacity: '0.3',
90
+          color: {
91
+            type: 'linear',
92
+            x: 0,
93
+            y: 0,
94
+            x2: 0,
95
+            y2: 1,
96
+            colorStops: [{
97
+                offset: 0,
98
+                color: '#028DFF' // 0% 处的颜色
99
+              },
100
+              {
101
+                offset: 1,
102
+                color: 'rgba(255,255,255,1)' // 100% 处的颜色
103
+              }
104
+            ],
105
+            globalCoord: false // 缺省为 false
106
+          }
107
+        }
108
+      },
109
+      {
110
+        name: '点击数',
111
+        data: data.clickNum,
112
+        type: type,
113
+        itemStyle: {
114
+          color: '#E72120', //颜色
115
+        },
116
+        lineStyle: {
117
+          width: 2
118
+        },
119
+        showSymbol: false, //是否显示转折符号
120
+        // smooth:true,    //平滑显示
121
+        areaStyle: { //区域样式
122
+          opacity: '0.3',
123
+          color: {
124
+            type: 'linear',
125
+            x: 0,
126
+            y: 0,
127
+            x2: 0,
128
+            y2: 1,
129
+            colorStops: [{
130
+                offset: 0,
131
+                color: '#E72120' // 0% 处的颜色
132
+              },
133
+              {
134
+                offset: 1,
135
+                color: 'rgba(255,255,255,1)' // 100% 处的颜色
136
+              }
137
+            ],
138
+            globalCoord: false // 缺省为 false
139
+          }
140
+        }
141
+      }
142
+    ]
143
+  }
144
+};

+ 66 - 0
miniprogram/pages/self/self.js

@@ -0,0 +1,66 @@
1
+// miniprogram/pages/self/self.js
2
+Page({
3
+
4
+  /**
5
+   * 页面的初始数据
6
+   */
7
+  data: {
8
+
9
+  },
10
+
11
+  /**
12
+   * 生命周期函数--监听页面加载
13
+   */
14
+  onLoad: function (options) {
15
+
16
+  },
17
+
18
+  /**
19
+   * 生命周期函数--监听页面初次渲染完成
20
+   */
21
+  onReady: function () {
22
+
23
+  },
24
+
25
+  /**
26
+   * 生命周期函数--监听页面显示
27
+   */
28
+  onShow: function () {
29
+
30
+  },
31
+
32
+  /**
33
+   * 生命周期函数--监听页面隐藏
34
+   */
35
+  onHide: function () {
36
+
37
+  },
38
+
39
+  /**
40
+   * 生命周期函数--监听页面卸载
41
+   */
42
+  onUnload: function () {
43
+
44
+  },
45
+
46
+  /**
47
+   * 页面相关事件处理函数--监听用户下拉动作
48
+   */
49
+  onPullDownRefresh: function () {
50
+
51
+  },
52
+
53
+  /**
54
+   * 页面上拉触底事件的处理函数
55
+   */
56
+  onReachBottom: function () {
57
+
58
+  },
59
+
60
+  /**
61
+   * 用户点击右上角分享
62
+   */
63
+  onShareAppMessage: function () {
64
+
65
+  }
66
+})

+ 1 - 0
miniprogram/pages/self/self.json

@@ -0,0 +1 @@
1
+{}

+ 23 - 0
miniprogram/pages/self/self.wxml

@@ -0,0 +1,23 @@
1
+<view class="self-head">
2
+  <image class="logo" mode="widthFix" src="/images/logo.png"></image>
3
+  <navigator class="link" url="//www.chuangzhikeji.com" target="_balck">www.chuangzhikeji.com</navigator>
4
+</view>
5
+
6
+<view class="info-list">
7
+
8
+  <view class="item">
9
+    <text class="key">项目经理</text>
10
+    <text class="val">杨经理</text>
11
+  </view>
12
+
13
+  <view class="item">
14
+    <text class="key">项目经理</text>
15
+    <text class="val">杨经理</text>
16
+  </view>
17
+
18
+  <view class="item">
19
+    <text class="key">项目经理</text>
20
+    <text class="val">杨经理</text>
21
+  </view>
22
+
23
+</view>

+ 46 - 0
miniprogram/pages/self/self.wxss

@@ -0,0 +1,46 @@
1
+.self-head {
2
+  background-color: #fff;
3
+  padding: 60rpx 30rpx 70rpx;
4
+  text-align: center;
5
+  margin: -30rpx;
6
+  margin-bottom: 0;
7
+}
8
+
9
+.self-head  .logo {
10
+  display: block;
11
+  width: 80rpx;
12
+  max-height: 80rpx;
13
+  margin: 0 auto;
14
+  margin-bottom: 30rpx;
15
+}
16
+
17
+.info-list {
18
+  background-color: #fff;
19
+  margin-left: -30rpx;
20
+  margin-right: -30rpx;
21
+  margin-top: 20rpx;
22
+  padding: 0 30rpx;
23
+}
24
+
25
+.info-list .item {
26
+  display: flex;
27
+  justify-content: space-between;
28
+  align-items: center;
29
+  min-height: 60rpx;
30
+  padding: 20rpx 0;
31
+}
32
+
33
+.info-list .item~.item {
34
+  border-top: 1px solid #e0e0e0;
35
+}
36
+
37
+.info-list .val {
38
+  color: #999;
39
+}
40
+
41
+.info-list .key {
42
+  max-width: 50%;
43
+  flex-shrink: 0;
44
+  margin-right: 10rpx;
45
+  overflow: hidden;
46
+}

+ 75 - 0
miniprogram/pages/setting/setting.js

@@ -0,0 +1,75 @@
1
+// miniprogram/pages/setting/setting.js
2
+Page({
3
+
4
+  /**
5
+   * 页面的初始数据
6
+   */
7
+  data: {
8
+    pickerArr: ['每日推送1', '每日推送2', '每日推送4', '每日推送3'],
9
+    index:0,
10
+    
11
+  },
12
+
13
+  bindPickerChange(e) {
14
+    this.setData({
15
+      index: e.detail.value
16
+    })
17
+  },
18
+
19
+
20
+  /**
21
+   * 生命周期函数--监听页面加载
22
+   */
23
+  onLoad: function (options) {
24
+
25
+  },
26
+
27
+  /**
28
+   * 生命周期函数--监听页面初次渲染完成
29
+   */
30
+  onReady: function () {
31
+
32
+  },
33
+
34
+  /**
35
+   * 生命周期函数--监听页面显示
36
+   */
37
+  onShow: function () {
38
+
39
+  },
40
+
41
+  /**
42
+   * 生命周期函数--监听页面隐藏
43
+   */
44
+  onHide: function () {
45
+
46
+  },
47
+
48
+  /**
49
+   * 生命周期函数--监听页面卸载
50
+   */
51
+  onUnload: function () {
52
+
53
+  },
54
+
55
+  /**
56
+   * 页面相关事件处理函数--监听用户下拉动作
57
+   */
58
+  onPullDownRefresh: function () {
59
+
60
+  },
61
+
62
+  /**
63
+   * 页面上拉触底事件的处理函数
64
+   */
65
+  onReachBottom: function () {
66
+
67
+  },
68
+
69
+  /**
70
+   * 用户点击右上角分享
71
+   */
72
+  onShareAppMessage: function () {
73
+
74
+  }
75
+})

+ 1 - 0
miniprogram/pages/setting/setting.json

@@ -0,0 +1 @@
1
+{}

+ 8 - 0
miniprogram/pages/setting/setting.wxml

@@ -0,0 +1,8 @@
1
+
2
+		<view class="input-tit">流量报告推送</view>
3
+		<view class="pos-r">
4
+			<picker class="ele" value="{{index}}" range="{{pickerArr}}" bindchange="bindPickerChange">
5
+        <view class="picker">当前选择:{{pickerArr[index]}}</view>
6
+      </picker>
7
+			<span class="app-r-icon"></span>
8
+		</view>

+ 12 - 0
miniprogram/pages/setting/setting.wxss

@@ -0,0 +1,12 @@
1
+.input-tit {
2
+  padding-bottom: 20rpx;
3
+}
4
+
5
+.ele {
6
+  width: 100%;
7
+  box-sizing: border-box;
8
+  padding: 20rpx;
9
+  background: white;
10
+  border: 1px solid #e0e0e0;
11
+  height: 88rpx;
12
+}

+ 66 - 0
miniprogram/pages/time-filter/time-filter.js

@@ -0,0 +1,66 @@
1
+// miniprogram/pages/time-filter/time-filter.js
2
+Page({
3
+
4
+  /**
5
+   * 页面的初始数据
6
+   */
7
+  data: {
8
+
9
+  },
10
+
11
+  /**
12
+   * 生命周期函数--监听页面加载
13
+   */
14
+  onLoad: function (options) {
15
+
16
+  },
17
+
18
+  /**
19
+   * 生命周期函数--监听页面初次渲染完成
20
+   */
21
+  onReady: function () {
22
+
23
+  },
24
+
25
+  /**
26
+   * 生命周期函数--监听页面显示
27
+   */
28
+  onShow: function () {
29
+
30
+  },
31
+
32
+  /**
33
+   * 生命周期函数--监听页面隐藏
34
+   */
35
+  onHide: function () {
36
+
37
+  },
38
+
39
+  /**
40
+   * 生命周期函数--监听页面卸载
41
+   */
42
+  onUnload: function () {
43
+
44
+  },
45
+
46
+  /**
47
+   * 页面相关事件处理函数--监听用户下拉动作
48
+   */
49
+  onPullDownRefresh: function () {
50
+
51
+  },
52
+
53
+  /**
54
+   * 页面上拉触底事件的处理函数
55
+   */
56
+  onReachBottom: function () {
57
+
58
+  },
59
+
60
+  /**
61
+   * 用户点击右上角分享
62
+   */
63
+  onShareAppMessage: function () {
64
+
65
+  }
66
+})

+ 1 - 0
miniprogram/pages/time-filter/time-filter.json

@@ -0,0 +1 @@
1
+{}

+ 31 - 0
miniprogram/pages/time-filter/time-filter.wxml

@@ -0,0 +1,31 @@
1
+<view class="quick-time">
2
+  <text class="on">今天</text>
3
+  <text>最近7天</text>
4
+  <text>最近30天</text>
5
+  <text>昨天</text>
6
+  <text>本周</text>
7
+  <text>本月</text>
8
+</view>
9
+
10
+<view class="black-head">
11
+  <text class="tit">自定义</text>
12
+</view>
13
+
14
+<view class="black-body diy-time">
15
+
16
+  <view class="time-item">
17
+    <label for="start">
18
+      开始:
19
+    </label>
20
+    <picker class="ele" mode="date" id="start"></picker>
21
+  </view>
22
+
23
+  <view class="time-item">
24
+    <label for="end">
25
+      结束:
26
+    </label>
27
+    <picker class="ele" mode="date" id="end"></picker>
28
+  </view>
29
+
30
+  <button class="on-ok">确定</button>
31
+</view>

+ 56 - 0
miniprogram/pages/time-filter/time-filter.wxss

@@ -0,0 +1,56 @@
1
+.quick-time {
2
+  display: flex;
3
+  flex-wrap: wrap;
4
+  flex-shrink: 0;
5
+  justify-content: space-between;
6
+  padding-bottom: 50rpx;
7
+}
8
+
9
+.quick-time text {
10
+  width: 200rpx;
11
+  height: 80rpx;
12
+  line-height: 80rpx;
13
+  text-align: center;
14
+  background: rgba(255, 255, 255, 1);
15
+  border: 1px solid rgba(224, 224, 224, 1);
16
+  color: #999;
17
+  font-size: 30rpx;
18
+  margin-bottom: 16rpx;
19
+  transition: all 0.3s ease;
20
+}
21
+
22
+.quick-time text.on {
23
+  color: #e72120;
24
+  background: rgba(231, 33, 32, 0.2);
25
+  border: 1px solid rgba(231, 33, 32, 1);
26
+}
27
+
28
+.diy-time {
29
+  padding-top: 20rpx;
30
+}
31
+
32
+.time-item {
33
+  display: flex;
34
+  justify-content: space-between;
35
+  align-items: center;
36
+  margin-bottom: 30rpx;
37
+}
38
+
39
+.time-item label {
40
+  width: 100rpx;
41
+}
42
+
43
+.time-item .ele {
44
+  width: calc(100% - 100rpx);
45
+  box-sizing: border-box;
46
+  padding: 20rpx;
47
+  background: white;
48
+  border: 1px solid #e0e0e0;
49
+  height: 88rpx;
50
+  border-radius: 3px;
51
+}
52
+.diy-time .on-ok{
53
+  background: #e72120;
54
+  color:#fff;
55
+  border: none;
56
+}

+ 22 - 0
miniprogram/style/components/black.wxss

@@ -0,0 +1,22 @@
1
+
2
+.black {
3
+  margin-top: 30rpx;
4
+}
5
+
6
+.black-head {
7
+  display: flex;
8
+  justify-content: space-between;
9
+  align-items: center;
10
+  padding-bottom: 20rpx;
11
+}
12
+
13
+.black-head .tit {
14
+  font-size:28rpx;
15
+  font-weight: bold;
16
+  border-left: 6rpx solid #e72120;
17
+  padding-left: 14rpx;
18
+}
19
+
20
+.black-head  .oper {
21
+  font-size: 28rpx;
22
+}

+ 12 - 0
miniprogram/style/style.wxss

@@ -0,0 +1,12 @@
1
+
2
+page{
3
+  padding: 30rpx;
4
+  box-sizing: border-box;
5
+  background-color: #f8f8f8;
6
+  font-size: 28rpx;
7
+}
8
+
9
+
10
+.link{
11
+  color: #2679F1;
12
+}

+ 41 - 0
project.config.json

@@ -0,0 +1,41 @@
1
+{
2
+	"miniprogramRoot": "miniprogram/",
3
+	"cloudfunctionRoot": "cloudfunctions/",
4
+	"setting": {
5
+		"urlCheck": true,
6
+		"es6": true,
7
+		"postcss": true,
8
+		"minified": true,
9
+		"newFeature": true
10
+	},
11
+	"appid": "wxcd573b7e3315494b",
12
+	"projectname": "we_view_app",
13
+	"libVersion": "2.2.5",
14
+	"condition": {
15
+		"search": {
16
+			"current": -1,
17
+			"list": []
18
+		},
19
+		"conversation": {
20
+			"current": -1,
21
+			"list": []
22
+		},
23
+		"plugin": {
24
+			"current": -1,
25
+			"list": []
26
+		},
27
+		"game": {
28
+			"list": []
29
+		},
30
+		"miniprogram": {
31
+			"current": 0,
32
+			"list": [
33
+				{
34
+					"id": -1,
35
+					"name": "db guide",
36
+					"pathName": "pages/databaseGuide/databaseGuide"
37
+				}
38
+			]
39
+		}
40
+	}
41
+}