├── app.js ├── app.json ├── app.wxss ├── image ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png └── 7.jpg ├── pages ├── action │ ├── action.js │ ├── action.wxml │ ├── action.wxss │ └── cart.png ├── denglu │ ├── denglu.js │ ├── denglu.wxml │ └── denglu.wxss ├── dingdan │ ├── index.js │ ├── index.wxml │ └── index.wxss ├── fanshi │ ├── fanshi.js │ ├── fanshi.wxml │ └── fanshi.wxss ├── index │ ├── index.js │ ├── index.wxml │ └── index.wxss ├── logs │ ├── logs.js │ ├── logs.json │ ├── logs.wxml │ └── logs.wxss └── my │ ├── index.js │ ├── index.wxml │ └── index.wxss └── utils └── util.js /app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | onLaunch: function () { 4 | //调用API从本地缓存中获取数据 5 | var logs = wx.getStorageSync('logs') || [] 6 | logs.unshift(Date.now()) 7 | wx.setStorageSync('logs', logs) 8 | }, 9 | getUserInfo:function(cb){ 10 | var that = this 11 | if(this.globalData.userInfo){ 12 | typeof cb == "function" && cb(this.globalData.userInfo) 13 | }else{ 14 | //调用登录接口 15 | wx.login({ 16 | success: function () { 17 | wx.getUserInfo({ 18 | success: function (res) { 19 | that.globalData.userInfo = res.userInfo 20 | typeof cb == "function" && cb(that.globalData.userInfo) 21 | } 22 | }) 23 | } 24 | }) 25 | } 26 | }, 27 | globalData:{ 28 | userInfo:null 29 | } 30 | }) 31 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages":[ 3 | "pages/index/index", 4 | "pages/dingdan/index", 5 | "pages/my/index", 6 | "pages/action/action", 7 | "pages/denglu/denglu", 8 | "pages/fanshi/fanshi", 9 | "pages/logs/logs" 10 | ], 11 | "window":{ 12 | "backgroundTextStyle": "light", 13 | "navigationBarTextStyle": "black", 14 | "navigationBarTitleText": "必胜客宅急送", 15 | "navigationBarBackgroundColor": "yellow", 16 | "backgroundColor": "#F2F2F2", 17 | "enablePullDownRefresh": true 18 | }, 19 | "tabBar": { 20 | "color": "#666666", 21 | "selectedColor": "yellow", 22 | "borderStyle": "white", 23 | "backgroundColor":"#ffffff", 24 | "list": [{ 25 | "pagePath": "pages/index/index", 26 | "iconPath": "image/1.png", 27 | "selectedIconPath": "image/2.png", 28 | "text": "首页" 29 | },{ 30 | "pagePath": "pages/dingdan/index", 31 | "iconPath": "image/3.png", 32 | "selectedIconPath": "image/4.png", 33 | "text": "订单" 34 | },{ 35 | "pagePath": "pages/my/index", 36 | "iconPath": "image/5.png", 37 | "selectedIconPath": "image/6.png", 38 | "text": "我的" 39 | }] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | .container { 3 | font-family: Helvetica Neue,helvetica,Arial,sanserif; 4 | display: flex; 5 | flex-direction: column; 6 | justify-content: space-between; 7 | box-sizing: border-box; 8 | } 9 | page{ 10 | background-color: #f2f2f2; 11 | } 12 | .flex{ 13 | display: flex; 14 | } 15 | .flex_auto{ 16 | flex:1 17 | } 18 | .item_middle .title ,.item_left .title{ 19 | font-size: 16px; 20 | color: #333; 21 | } 22 | .item_middle .sub_title ,.item_left .sub_title,.item_middle .actor{ 23 | font-size: 14px; 24 | color: #666; 25 | margin:2px 0px; 26 | } 27 | -------------------------------------------------------------------------------- /image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ernest96317/BSK/5aab39d0b236e31e2a571e72c917c0de2b78a45c/image/1.png -------------------------------------------------------------------------------- /image/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ernest96317/BSK/5aab39d0b236e31e2a571e72c917c0de2b78a45c/image/2.png -------------------------------------------------------------------------------- /image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ernest96317/BSK/5aab39d0b236e31e2a571e72c917c0de2b78a45c/image/3.png -------------------------------------------------------------------------------- /image/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ernest96317/BSK/5aab39d0b236e31e2a571e72c917c0de2b78a45c/image/4.png -------------------------------------------------------------------------------- /image/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ernest96317/BSK/5aab39d0b236e31e2a571e72c917c0de2b78a45c/image/5.png -------------------------------------------------------------------------------- /image/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ernest96317/BSK/5aab39d0b236e31e2a571e72c917c0de2b78a45c/image/6.png -------------------------------------------------------------------------------- /image/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ernest96317/BSK/5aab39d0b236e31e2a571e72c917c0de2b78a45c/image/7.jpg -------------------------------------------------------------------------------- /pages/action/action.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | 3 | Page({ 4 | data: {}, 5 | 6 | //事件处理函数 7 | 8 | onLoad: function () { 9 | var that = this; 10 | wx.request({ 11 | url: 'https://www.easy-mock.com/mock/59082eb57a878d73716e5b73/aa/list', 12 | method: 'get', 13 | data: {}, 14 | header: { 15 | 'Accept': 'application/json' 16 | }, 17 | success: function(res) { 18 | console.log(res.data.items); 19 | that.setData({ 20 | items: res.data.items 21 | }); 22 | } 23 | }) 24 | }, 25 | 26 | }) 27 | -------------------------------------------------------------------------------- /pages/action/action.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{item.sub_name}} 10 | ¥{{item.sub_price}} 11 | {{item.sub_desc}} 12 | 13 | 14 | 15 | + 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
32 |
33 | -------------------------------------------------------------------------------- /pages/action/action.wxss: -------------------------------------------------------------------------------- 1 | .item{ 2 | border-bottom:5rpx solid #fff; 3 | } 4 | .pi-category image { 5 | width: 160rpx; 6 | height: 160rpx; 7 | border-radius: 50%; 8 | } 9 | .item_middle{ 10 | display: flex; 11 | align-items: center; 12 | justify-content: center; 13 | margin-left: 15rpx; 14 | } 15 | .item_right{ 16 | display: flex; 17 | align-items: center; 18 | justify-content: center; 19 | 20 | } 21 | .action{ 22 | margin-right: 40rpx; 23 | font-weight: bold; 24 | padding: 9rpx 15rpx; 25 | font-size: 30px; 26 | border-radius: 50%; 27 | background-color: #fff; 28 | z-index: 1; 29 | } 30 | 31 | .cart { 32 | display: -webkit-flex; 33 | position: absolute; 34 | left: 0; 35 | /*bottom: 0;*/ 36 | width: 100%; 37 | height: 100rpx; 38 | background: #fff; 39 | } 40 | .cart .data { 41 | -webkit-flex: 1; 42 | /*border-top: 1rpx solid #e7e7e7;*/ 43 | } 44 | .cart .data .icon { 45 | position: absolute; 46 | left: 40rpx; 47 | top: -20rpx; 48 | width: 100rpx; 49 | height: 100rpx; 50 | background: #feb70f; 51 | border-radius: 50%; 52 | } 53 | .cart .data .icon image { 54 | position: absolute; 55 | left: 15rpx; 56 | top: 15rpx; 57 | width: 70rpx; 58 | height: 70rpx; 59 | } 60 | .cart .data .icon .count { 61 | position: absolute; 62 | left: 70rpx; 63 | top: -10rpx; 64 | font-size: 30rpx; 65 | line-height: 40rpx; 66 | padding: 0 12rpx; 67 | color: #fff; 68 | background: #f45044; 69 | border-radius: 20rpx; 70 | } 71 | .cart .data .total { 72 | color: #f45044; 73 | font-size: 36rpx; 74 | line-height: 100rpx; 75 | padding-left: 160rpx; 76 | } 77 | .cart button { 78 | margin-top: 10rpx; 79 | margin-right: 20rpx; 80 | width: 200rpx; 81 | height: 100%; 82 | font-size: 36rpx; 83 | } 84 | -------------------------------------------------------------------------------- /pages/action/cart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ernest96317/BSK/5aab39d0b236e31e2a571e72c917c0de2b78a45c/pages/action/cart.png -------------------------------------------------------------------------------- /pages/denglu/denglu.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | //获取应用实例 3 | // var app = getApp() 4 | Page({ 5 | data: { 6 | items:[] 7 | }, 8 | //事件处理函数 9 | 10 | onLoad: function () { 11 | var that = this; 12 | wx.request({ 13 | url: 'https://www.easy-mock.com/mock/59082eb57a878d73716e5b73/aa/list', 14 | method: 'get', 15 | data: {}, 16 | header: { 17 | 'Accept': 'application/json' 18 | }, 19 | success: function(res) { 20 | console.log(res.data.items); 21 | // console.log(item); 22 | that.setData({ 23 | items: res.data.items 24 | }); 25 | } 26 | }) 27 | } 28 | }) 29 | -------------------------------------------------------------------------------- /pages/denglu/denglu.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 温馨提示:未注册必胜客帐号,登录时自动注册,且代表您已同意《用户注册协议》 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /pages/denglu/denglu.wxss: -------------------------------------------------------------------------------- 1 | .ipt button { 2 | width: 250rpx; 3 | position: absolute; 4 | color: #fff; 5 | background-color: blue; 6 | top: 0; 7 | right: 0; 8 | z-index: 5; 9 | display: block; 10 | } 11 | .ipt .input{ 12 | background-color: #fff; 13 | height: 2.4rem; 14 | text-align: left; 15 | border-bottom: 1px solid yellow; 16 | } 17 | .title { 18 | font-size: 30rpx; 19 | margin: 30rpx ; 20 | } 21 | .title em{ 22 | color: blue; 23 | } 24 | .btn button{ 25 | color: #fff; 26 | background-color: yellow; 27 | margin: 0 30rpx; 28 | letter-spacing: 20rpx; 29 | font-weight: ; 30 | } 31 | -------------------------------------------------------------------------------- /pages/dingdan/index.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | //获取应用实例 3 | // var app = getApp() 4 | Page({ 5 | data: { 6 | items:[] 7 | }, 8 | //事件处理函数 9 | 10 | onLoad: function () { 11 | var that = this; 12 | wx.request({ 13 | url: 'https://www.easy-mock.com/mock/59082eb57a878d73716e5b73/aa/list', 14 | method: 'get', 15 | data: {}, 16 | header: { 17 | 'Accept': 'application/json' 18 | }, 19 | success: function(res) { 20 | console.log(res.data.items); 21 | // console.log(item); 22 | that.setData({ 23 | items: res.data.items 24 | }); 25 | } 26 | }) 27 | } 28 | }) 29 | -------------------------------------------------------------------------------- /pages/dingdan/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 您还没有登录,请登录后查看订单 5 | 6 | 7 | -------------------------------------------------------------------------------- /pages/dingdan/index.wxss: -------------------------------------------------------------------------------- 1 | .box{ 2 | display: flex; 3 | height: 100%; 4 | width: 100%; 5 | 6 | } 7 | image{ 8 | width: 400rpx; 9 | height: 400rpx; 10 | margin: 100rpx auto 0; 11 | border-radius: 50%; 12 | } 13 | .desc{ 14 | text-align: center; 15 | margin-top: 40rpx; 16 | } 17 | button{ 18 | width:180rpx; 19 | height:100rpx; 20 | margin-top: 40rpx; 21 | background-color: yellow; 22 | font-size: 40rpx; 23 | font-weight: bold; 24 | color: #fff; 25 | letter-spacing: 15rpx; 26 | } 27 | -------------------------------------------------------------------------------- /pages/fanshi/fanshi.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | 3 | Page({ 4 | data: {}, 5 | 6 | //事件处理函数 7 | 8 | onLoad: function () { 9 | var that = this; 10 | wx.request({ 11 | url: 'https://www.easy-mock.com/mock/591997909aba4141cf22f85d/fanshi/list', 12 | method: 'get', 13 | data: {}, 14 | header: { 15 | 'Accept': 'application/json' 16 | }, 17 | success: function(res) { 18 | console.log(res.data.items); 19 | that.setData({ 20 | items: res.data.items 21 | }); 22 | } 23 | }) 24 | }, 25 | 26 | }) 27 | -------------------------------------------------------------------------------- /pages/fanshi/fanshi.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{item.sub_name}} 10 | ¥{{item.sub_price}} 11 | {{item.sub_desc}} 12 | 13 | 14 | 15 | + 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
32 |
33 | -------------------------------------------------------------------------------- /pages/fanshi/fanshi.wxss: -------------------------------------------------------------------------------- 1 | .item{ 2 | border-bottom:5rpx solid #fff; 3 | } 4 | .pi-category image { 5 | width: 160rpx; 6 | height: 160rpx; 7 | border-radius: 50%; 8 | } 9 | .item_middle{ 10 | display: flex; 11 | align-items: center; 12 | justify-content: center; 13 | margin-left: 15rpx; 14 | } 15 | .item_right{ 16 | display: flex; 17 | align-items: center; 18 | justify-content: center; 19 | 20 | } 21 | .action{ 22 | margin-right: 40rpx; 23 | font-weight: bold; 24 | padding: 9rpx 15rpx; 25 | font-size: 30px; 26 | border-radius: 50%; 27 | background-color: #fff; 28 | z-index: 1; 29 | } 30 | 31 | .cart { 32 | display: -webkit-flex; 33 | position: absolute; 34 | left: 0; 35 | /*bottom: 0;*/ 36 | width: 100%; 37 | height: 100rpx; 38 | background: #fff; 39 | } 40 | .cart .data { 41 | -webkit-flex: 1; 42 | /*border-top: 1rpx solid #e7e7e7;*/ 43 | } 44 | .cart .data .icon { 45 | position: absolute; 46 | left: 40rpx; 47 | top: -20rpx; 48 | width: 100rpx; 49 | height: 100rpx; 50 | background: #feb70f; 51 | border-radius: 50%; 52 | } 53 | .cart .data .icon image { 54 | position: absolute; 55 | left: 15rpx; 56 | top: 15rpx; 57 | width: 70rpx; 58 | height: 70rpx; 59 | } 60 | .cart .data .icon .count { 61 | position: absolute; 62 | left: 70rpx; 63 | top: -10rpx; 64 | font-size: 30rpx; 65 | line-height: 40rpx; 66 | padding: 0 12rpx; 67 | color: #fff; 68 | background: #f45044; 69 | border-radius: 20rpx; 70 | } 71 | .cart .data .total { 72 | color: #f45044; 73 | font-size: 36rpx; 74 | line-height: 100rpx; 75 | padding-left: 160rpx; 76 | } 77 | .cart button { 78 | margin-top: 10rpx; 79 | margin-right: 20rpx; 80 | width: 200rpx; 81 | height: 100%; 82 | font-size: 36rpx; 83 | } 84 | -------------------------------------------------------------------------------- /pages/index/index.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | 3 | Page({ 4 | data: { 5 | items:[], 6 | banners: [ 7 | { 8 | id: 1, 9 | img: 'https://img.4008123123.com/resource/BannerP/Banner_1_2017_04_12_15_21_14.jpg', 10 | }, 11 | { 12 | id: 2, 13 | img: 'https://img.4008123123.com/resource/BannerP/Banner_1_2017_04_12_15_40_55.jpg', 14 | }, 15 | { 16 | id: 3, 17 | img: 'https://img.4008123123.com/resource/BannerP/Banner_1_2017_04_12_15_43_38.jpg', 18 | }, 19 | { 20 | id: 4, 21 | img: 'https://img.4008123123.com/resource/BannerP/Banner_1_2017_04_12_15_46_28.jpg', 22 | } 23 | ] 24 | }, 25 | 26 | //事件处理函数 27 | 28 | onLoad: function () { 29 | var that = this; 30 | wx.request({ 31 | url: 'https://www.easy-mock.com/mock/59082eb57a878d73716e5b73/aa/list', 32 | method: 'get', 33 | data: {}, 34 | header: { 35 | 'Accept': 'application/json' 36 | }, 37 | success: function(res) { 38 | console.log(res.data.items); 39 | that.setData({ 40 | items: res.data.items 41 | }); 42 | } 43 | }) 44 | }, 45 | 46 | }) 47 | -------------------------------------------------------------------------------- /pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | 15 | 16 | 披萨 17 | 18 | 19 | 20 | 饭食 21 | 22 | 23 | 24 | 意面 25 | 26 | 27 | 28 | 米线 29 | 30 | 31 | 32 | 小吃 33 | 34 | 35 | 36 | 饮料 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 沙拉和鲜蔬 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | {{item.sub_name}} 59 | ¥{{item.sub_price}} 60 | {{item.sub_desc}} 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 更多正在加载中… 74 | 75 | 76 | -------------------------------------------------------------------------------- /pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | #wrap { 2 | width: 100%; 3 | height: 100%; 4 | background-color: #f2f2f2; 5 | } 6 | .banner image { 7 | width: 100%; 8 | height: 100%; 9 | } 10 | .icon { 11 | float: left; 12 | display: -webkit-flex; 13 | flex-direction: column; 14 | flex-wrap: wrap; 15 | width: 25%; 16 | text-align: center; 17 | margin: 10rpx 0; 18 | } 19 | .icons .icon navigator{ 20 | color: #000; 21 | font-size: 24rpx; 22 | font-weight: bold; 23 | line-height: 3; 24 | border-radius: 50%; 25 | background: #fff; 26 | } 27 | .main{ 28 | margin-top: 200rpx; 29 | border-top: 15rpx solid #fff; 30 | } 31 | .item{ 32 | border-bottom:5rpx solid #fff; 33 | } 34 | .pi-category image { 35 | width: 160rpx; 36 | height: 160rpx; 37 | border-radius: 50%; 38 | } 39 | .item_middle{ 40 | display: flex; 41 | align-items: center; 42 | justify-content: center; 43 | margin-left: 20rpx; 44 | word-wrap: break-word; 45 | word-break: normal; 46 | } 47 | 48 | .item_middle .price{ 49 | color:red; 50 | } 51 | .item_right{ 52 | display: flex; 53 | align-items: center; 54 | justify-content: center; 55 | } 56 | .action{ 57 | margin-right: 20rpx; 58 | font-weight: bold; 59 | padding: 4rpx 12rpx; 60 | font-size: 20px; 61 | 62 | /*background-color: yellow;*/ 63 | z-index: 1; 64 | } 65 | .loading { 66 | font-size: 32rpx; 67 | text-align: center; 68 | line-height: 2; 69 | margin-bottom: 20rpx; 70 | } 71 | -------------------------------------------------------------------------------- /pages/logs/logs.js: -------------------------------------------------------------------------------- 1 | //logs.js 2 | var util = require('../../utils/util.js') 3 | Page({ 4 | data: { 5 | logs: [] 6 | }, 7 | onLoad: function () { 8 | this.setData({ 9 | logs: (wx.getStorageSync('logs') || []).map(function (log) { 10 | return util.formatTime(new Date(log)) 11 | }) 12 | }) 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /pages/logs/logs.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "查看启动日志" 3 | } -------------------------------------------------------------------------------- /pages/logs/logs.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{index + 1}}. {{log}} 5 | 6 | 7 | -------------------------------------------------------------------------------- /pages/logs/logs.wxss: -------------------------------------------------------------------------------- 1 | .log-list { 2 | display: flex; 3 | flex-direction: column; 4 | padding: 40rpx; 5 | } 6 | .log-item { 7 | margin: 10rpx; 8 | } 9 | -------------------------------------------------------------------------------- /pages/my/index.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | //获取应用实例 3 | var app = getApp() 4 | Page({ 5 | data: { 6 | motto: 'Hello World', 7 | userInfo: {} 8 | }, 9 | //事件处理函数 10 | bindViewTap: function() { 11 | wx.navigateTo({ 12 | url: '../logs/logs' 13 | }) 14 | }, 15 | onLoad: function () { 16 | console.log('onLoad') 17 | var that = this 18 | //调用应用实例的方法获取全局数据 19 | app.getUserInfo(function(userInfo){ 20 | //更新数据 21 | that.setData({ 22 | userInfo:userInfo 23 | }) 24 | }) 25 | } 26 | }) 27 | -------------------------------------------------------------------------------- /pages/my/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 登录 5 | 6 | 7 | 我的评价 8 | 我的好友 9 | 我的收藏 10 | 我的地址 11 | 12 | 13 | 我的钱包余额:¥0 14 | 15 | 16 | 邀请有奖 17 | 商家入驻 18 | 19 | 20 | 帮助与反馈 21 | 在线客服9:00 - 23:00 22 | 23 | 24 | -------------------------------------------------------------------------------- /pages/my/index.wxss: -------------------------------------------------------------------------------- 1 | .header { 2 | background: #feb70f; 3 | padding: 30rpx; 4 | } 5 | .header .avatar { 6 | display: block; 7 | margin: 0 auto; 8 | width: 160rpx; 9 | height: 160rpx; 10 | border-radius: 50%; 11 | border: 2px solid #fee767; 12 | } 13 | .header .nickname { 14 | color: #000; 15 | font-size: 22px; 16 | line-height: 2.4; 17 | text-align: center; 18 | letter-spacing:10rpx; 19 | } 20 | 21 | .section { 22 | padding: 0; 23 | color: #2e2e2e; 24 | font-size: 30rpx; 25 | } 26 | .section .line { 27 | margin-left: 30rpx; 28 | padding-right: 30rpx; 29 | line-height: 3; 30 | border-bottom: 1px solid #efefef; 31 | } 32 | .section .line:last-child { 33 | border-bottom: none; 34 | } 35 | .section .line:before { 36 | content: '>'; 37 | float: right; 38 | color: #aaa; 39 | margin-left: 20rpx; 40 | } 41 | .section .line .tl { 42 | float: right; 43 | color: #aaa; 44 | } 45 | -------------------------------------------------------------------------------- /utils/util.js: -------------------------------------------------------------------------------- 1 | function formatTime(date) { 2 | var year = date.getFullYear() 3 | var month = date.getMonth() + 1 4 | var day = date.getDate() 5 | 6 | var hour = date.getHours() 7 | var minute = date.getMinutes() 8 | var second = date.getSeconds() 9 | 10 | 11 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') 12 | } 13 | 14 | function formatNumber(n) { 15 | n = n.toString() 16 | return n[1] ? n : '0' + n 17 | } 18 | 19 | module.exports = { 20 | formatTime: formatTime 21 | } 22 | --------------------------------------------------------------------------------