forked from hzuapps/web-wechat-2017
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
199 changed files
with
3,497 additions
and
470 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,61 @@ | ||
//app.js | ||
App({ | ||
onLaunch: function () { | ||
// 展示本地存储能力 | ||
var logs = wx.getStorageSync('logs') || [] | ||
logs.unshift(Date.now()) | ||
wx.setStorageSync('logs', logs) | ||
import {log, promiseHandle} from 'utils/util'; | ||
import locales from './utils/locales' | ||
import T from './utils/wxapp-i18n' | ||
|
||
// 登录 | ||
wx.login({ | ||
success: res => { | ||
// 发送 res.code 到后台换取 openId, sessionKey, unionId | ||
} | ||
}) | ||
// 获取用户信息 | ||
wx.getSetting({ | ||
success: res => { | ||
if (res.authSetting['scope.userInfo']) { | ||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | ||
wx.getUserInfo({ | ||
success: res => { | ||
// 可以将 res 发送给后台解码出 unionId | ||
this.globalData.userInfo = res.userInfo | ||
T.registerLocale(locales) | ||
T.setLocale('zh-Hans') | ||
wx.T = T | ||
|
||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 | ||
// 所以此处加入 callback 以防止这种情况 | ||
if (this.userInfoReadyCallback) { | ||
this.userInfoReadyCallback(res) | ||
} | ||
} | ||
}) | ||
App({ | ||
onLaunch() { | ||
this.clearStorageAfterUpdated() | ||
}, | ||
clearStorageAfterUpdated() { | ||
wx.getStorage({ | ||
key: 'version', | ||
success: (res) => { | ||
if (res.data !== this.globalData.version) { | ||
wx.clearStorage() | ||
this.setVersion() | ||
} | ||
} | ||
}, | ||
fail: (res) => { | ||
this.setVersion() | ||
}, | ||
}) | ||
}, | ||
setVersion() { | ||
wx.setStorage({ | ||
key: 'version', | ||
data: this.globalData.version, | ||
}) | ||
}, | ||
|
||
getUserInfo(cb) { | ||
if (typeof cb !== "function") return; | ||
let that = this; | ||
if (that.globalData.userInfo) { | ||
cb(that.globalData.userInfo); | ||
} else { | ||
promiseHandle(wx.login).then(() => promiseHandle(wx.getUserInfo)).then(res => { | ||
that.globalData.userInfo = res.userInfo; | ||
cb(that.globalData.userInfo); | ||
}).catch(err => { | ||
log(err); | ||
}); | ||
} | ||
}, | ||
|
||
globalData: { | ||
userInfo: null | ||
}, | ||
|
||
//自定义配置 | ||
settings: { | ||
debug: true, //是否调试模式 | ||
moreLink: 'http://github.com/oopsguy', | ||
version: "1.1.0", | ||
env: "prod", | ||
|
||
} | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,40 @@ | ||
{ | ||
"pages":[ | ||
"pages/search/search", | ||
"pages/logs/logs", | ||
"pages/index/index" | ||
"pages/index/index", | ||
"pages/setting/setting", | ||
"pages/shijian/shijian", | ||
"pages/detail/detail", | ||
"pages/more/more" | ||
|
||
], | ||
"window":{ | ||
"backgroundTextStyle":"light", | ||
"navigationBarBackgroundColor": "#fff", | ||
"navigationBarTitleText": "WeChat", | ||
"navigationBarTextStyle":"black", | ||
"tabBar": { | ||
"color": "#a9b7b7", | ||
"selectedColor": "#11cd6e", | ||
"borderStyle": "white", | ||
"list": [ | ||
{ | ||
"pagePath": "pages/index/index", | ||
"iconPath": "image/tabbar/4.png", | ||
"selectedIconPath": "image/tabbar/4-hl.png", | ||
"text": "首页" | ||
}, | ||
{ | ||
"selectedIconPath": "image/add.png", | ||
"iconPath": "image/add.png", | ||
"pagePath": "pages/logs/logs", | ||
"text": "日志" | ||
}, | ||
{ | ||
"pagePath": "pages/search/search", | ||
"iconPath": "image/tabbar/5.png", | ||
"selectedIconPath": "image/tabbar/5-hl.png", | ||
"text": "搜索" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
"navigationBarBackgroundColor": "#E14848", | ||
"navigationBarTitleText": "小天气", | ||
"navigationBarTextStyle":"white" | ||
}, | ||
"tabBar": { | ||
"color": "#a9b7b7", | ||
"selectedColor": "#11cd6e", | ||
"borderStyle": "black", | ||
"list": [ | ||
{ | ||
"pagePath": "pages/index/index", | ||
"iconPath": "images/weather.png", | ||
"selectedIconPath": "images/weather.png", | ||
"text": "天气" | ||
}, | ||
{ | ||
"pagePath": "pages/shijian/shijian", | ||
"iconPath": "images/fav-round.png", | ||
"selectedIconPath": "images/fav-round.png", | ||
"text": "提醒" | ||
}, | ||
{ | ||
"pagePath": "pages/setting/setting", | ||
"text": "选择", | ||
"iconPath": "images/setting.png", | ||
"selectedIconPath": "images/setting.png" | ||
}] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,99 @@ | ||
/**app.wxss**/ | ||
page { | ||
font-family: 'microsoft yahei ui'; | ||
font-size: 28rpx; | ||
background-color: #1D1D26; | ||
color: #FFF; | ||
} | ||
|
||
/*float action*/ | ||
.float-container { | ||
position: fixed; | ||
bottom: 40rpx; | ||
right: 40rpx; | ||
overflow: hidden; | ||
} | ||
.float-action { | ||
width: 100rpx; | ||
height: 100rpx; | ||
border-radius: 50%; | ||
box-shadow: 2px 2px 10px rgba(0, 0, 0, .5); | ||
background: #E14848; | ||
z-index: 100; | ||
text-align: center; | ||
opacity: .5; | ||
margin-left: 40rpx; | ||
float: right; | ||
} | ||
.float-action:active { | ||
opacity: 1 | ||
} | ||
.float-action image { | ||
width: 60rpx; | ||
height: 60rpx; | ||
margin-top: 20rpx; | ||
} | ||
|
||
.bg-normal { | ||
background: #46BC62 !important; | ||
} | ||
.bg-warning { | ||
background: #ECAA5B !important; | ||
} | ||
.bg-danger { | ||
background: #E14848 !important; | ||
} | ||
|
||
.color-primary { | ||
color: #46BC62 !important; | ||
} | ||
.color-warning { | ||
color: #ECAA5B !important; | ||
} | ||
.color-danger { | ||
color: #E14848 !important; | ||
} | ||
|
||
.border-normal { | ||
border: 2rpx solid #46BC62 !important; | ||
} | ||
.border-warning { | ||
border: 2rpx solid #ECAA5B !important; | ||
} | ||
.border-danger { | ||
border: 2rpx solid #E14848 !important; | ||
} | ||
|
||
.text-center { | ||
text-align: center !important; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
@import 'zan-ui/index.wxss'; | ||
|
||
.container { | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 200rpx 0; | ||
background: #F9F9F9; | ||
overflow: hidden; | ||
min-height: 100vh; | ||
box-sizing: border-box; | ||
} | ||
} | ||
.container::before { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
content: ' '; | ||
width: 100%; | ||
height: 1rpx; | ||
background-color: #e2e2e2; | ||
z-index: 5; | ||
} | ||
.doc-title { | ||
font-size: 25px; | ||
line-height: 25px; | ||
color: #666; | ||
padding: 15px 0; | ||
margin: 20px 15px; | ||
border-bottom: 1rpx solid #e5e5e5; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Empty file.
Oops, something went wrong.