Skip to content

Commit

Permalink
hzuapps#6 hzuapps#54 第六次实验代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Buruiwen committed Jan 21, 2018
1 parent 457d25e commit 22296c3
Show file tree
Hide file tree
Showing 199 changed files with 3,497 additions and 470 deletions.
84 changes: 53 additions & 31 deletions 1509081602501/app.js
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",

}
})
});
69 changes: 35 additions & 34 deletions 1509081602501/app.json
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"
}]
}
}
105 changes: 97 additions & 8 deletions 1509081602501/app.wxss
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;
}
Binary file added 1509081602501/asset/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/21.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/23.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/25.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/26.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/27.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/28.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/29.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1509081602501/asset/31.png
Binary file added 1509081602501/asset/32.png
Binary file added 1509081602501/asset/33.png
Binary file added 1509081602501/asset/34.png
Binary file added 1509081602501/asset/35.png
Binary file added 1509081602501/asset/36.png
Binary file added 1509081602501/asset/37.png
Binary file added 1509081602501/asset/38.png
Binary file added 1509081602501/asset/4.png
Binary file added 1509081602501/asset/5.png
Binary file added 1509081602501/asset/6.png
Binary file added 1509081602501/asset/7.png
Binary file added 1509081602501/asset/8.png
Binary file added 1509081602501/asset/9.png
Binary file added 1509081602501/asset/99.png
Binary file added 1509081602501/asset/Thumbs.db
Binary file not shown.
Empty file.
Loading

0 comments on commit 22296c3

Please sign in to comment.