├── LICENSE ├── README.md ├── pic ├── home.png ├── run.png ├── slide.png └── slideback.png └── weChatRun ├── app.js ├── app.json ├── app.wxss ├── pages ├── animation │ ├── animation.js │ ├── animation.json │ ├── animation.wxml │ └── animation.wxss ├── index.js ├── index.wxml ├── index.wxss ├── logs │ ├── logs.js │ ├── logs.json │ ├── logs.wxml │ └── logs.wxss └── run │ ├── format-location.js │ ├── run.js │ ├── run.json │ ├── run.wxml │ └── run.wxss ├── resources ├── joyrun.png └── redPoint.png └── utils └── util.js /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 王小树 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # weChatApp-Run 2 | 3 | ###介绍 4 | 这是一个微信小程序Demo,主要功能是跑步。 5 | 现在还不够完善依然有很多问题,欢迎大家提出建议和意见。 6 | 大家也可以star收藏起来,以后会进行优化更新,大家一起学习进步。 7 | 8 | ###截图 9 | ![首页](https://github.com/alanwangmodify/weChatApp-Run/blob/master/pic/home.png) 10 | 11 | ![跑步页面](https://github.com/alanwangmodify/weChatApp-Run/blob/master/pic/run.png) 12 | 13 | ![侧滑返回](https://github.com/alanwangmodify/weChatApp-Run/blob/master/pic/slideback.png) 14 | 15 | ![侧滑返回](https://github.com/alanwangmodify/weChatApp-Run/blob/master/pic/slide.png) 16 | -------------------------------------------------------------------------------- /pic/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanwangmodify/weChatApp-Run/6762cfc3342eb399b608da44ec818254f47f92dc/pic/home.png -------------------------------------------------------------------------------- /pic/run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanwangmodify/weChatApp-Run/6762cfc3342eb399b608da44ec818254f47f92dc/pic/run.png -------------------------------------------------------------------------------- /pic/slide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanwangmodify/weChatApp-Run/6762cfc3342eb399b608da44ec818254f47f92dc/pic/slide.png -------------------------------------------------------------------------------- /pic/slideback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alanwangmodify/weChatApp-Run/6762cfc3342eb399b608da44ec818254f47f92dc/pic/slideback.png -------------------------------------------------------------------------------- /weChatRun/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 | }) -------------------------------------------------------------------------------- /weChatRun/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages":[ 3 | "pages/index", 4 | "pages/logs/logs", 5 | "pages/run/run", 6 | "pages/animation/animation" 7 | ], 8 | "window":{ 9 | "backgroundTextStyle":"light", 10 | "navigationBarBackgroundColor": "#fff", 11 | "navigationBarTitleText": "悦跑圈", 12 | "navigationBarTextStyle":"black" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /weChatRun/app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | .container { 3 | height: 100%; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: space-between; 8 | padding: 200rpx 0; 9 | box-sizing: border-box; 10 | } 11 | .showView{ 12 | height: 150rpx; 13 | width: 150rpx; 14 | background-color: orangered; 15 | } 16 | .head{ 17 | margin-top: 40; 18 | padding: 50rpx; 19 | line-height: 1; 20 | } 21 | .body{ 22 | padding-left: 30rpx; 23 | padding-right: 30rpx; 24 | overflow: hidden; 25 | } 26 | .bigTitle{ 27 | font-size: 52rpx; 28 | padding-left: 30rpx; 29 | padding-right: 30rpx; 30 | position: center; 31 | } 32 | .title{ 33 | font-size: 52rpx; 34 | } 35 | .desc{ 36 | margin-top: 10rpx; 37 | color: #888888; 38 | font-size: 28rpx; 39 | padding-left: 30rpx; 40 | padding-right: 30rpx; 41 | } 42 | .icon{ 43 | width: 80rpx; 44 | height: 80rpx; 45 | margin-top: 20; 46 | margin-bottom:10; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /weChatRun/pages/animation/animation.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | onReady: function () { 3 | this.animation = wx.createAnimation() 4 | 5 | }, 6 | rotate: function () { 7 | this.animation.rotate(Math.random() * 720 - 360).step() 8 | this.setData({ animation: this.animation.export() }) 9 | }, 10 | scale: function () { 11 | this.animation.scale(Math.random() * 2).step() 12 | this.setData({ animation: this.animation.export() }) 13 | }, 14 | translate: function () { 15 | this.animation.translate(Math.random() * 100 - 50, Math.random() * 100 - 50).step() 16 | this.setData({ animation: this.animation.export() }) 17 | }, 18 | skew: function () { 19 | this.animation.skew(Math.random() * 90, Math.random() * 90).step() 20 | this.setData({ animation: this.animation.export() }) 21 | }, 22 | rotateAndScale: function () { 23 | this.animation.rotate(Math.random() * 720 - 360) 24 | .scale(Math.random() * 2) 25 | .step() 26 | this.setData({ animation: this.animation.export() }) 27 | }, 28 | rotateThenScale: function () { 29 | this.animation.rotate(Math.random() * 720 - 360).step() 30 | .scale(Math.random() * 2).step() 31 | this.setData({ animation: this.animation.export() }) 32 | }, 33 | all: function () { 34 | this.animation.rotate(Math.random() * 720 - 360) 35 | .scale(Math.random() * 2) 36 | .translate(Math.random() * 100 - 50, Math.random() * 100 - 50) 37 | .skew(Math.random() * 90, Math.random() * 90) 38 | .step() 39 | this.setData({ animation: this.animation.export() }) 40 | }, 41 | allInQueue: function () { 42 | this.animation.rotate(Math.random() * 720 - 360).step() 43 | .scale(Math.random() * 2).step() 44 | .translate(Math.random() * 100 - 50, Math.random() * 100 - 50).step() 45 | .skew(Math.random() * 90, Math.random() * 90).step() 46 | this.setData({ animation: this.animation.export() }) 47 | }, 48 | reset: function () { 49 | this.animation.rotate(0, 0) 50 | .scale(1) 51 | .translate(0, 0) 52 | .skew(0, 0) 53 | .step({ duration: 0 }) 54 | this.setData({ animation: this.animation.export() }) 55 | } 56 | }) 57 | -------------------------------------------------------------------------------- /weChatRun/pages/animation/animation.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "动画" 3 | } 4 | -------------------------------------------------------------------------------- /weChatRun/pages/animation/animation.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |