-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #504 from shinubi1/master
- Loading branch information
Showing
23 changed files
with
449 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//app.js | ||
App({ | ||
onLaunch: function () { | ||
// 展示本地存储能力 | ||
var logs = wx.getStorageSync('logs') || [] | ||
logs.unshift(Date.now()) | ||
wx.setStorageSync('logs', logs) | ||
|
||
// 登录 | ||
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 | ||
|
||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 | ||
// 所以此处加入 callback 以防止这种情况 | ||
if (this.userInfoReadyCallback) { | ||
this.userInfoReadyCallback(res) | ||
} | ||
} | ||
}) | ||
} | ||
} | ||
}) | ||
}, | ||
globalData: { | ||
userInfo: null | ||
} | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"pages":[ | ||
"pages/index/index", | ||
"pages/logs/logs", | ||
"pages/my/my" | ||
], | ||
"window":{ | ||
"backgroundTextStyle":"light", | ||
"navigationBarBackgroundColor": "#fff", | ||
"navigationBarTitleText": "佛系GO旅游", | ||
"navigationBarTextStyle":"black" | ||
}, | ||
"tabBar":{ | ||
"color":"black", | ||
"selectedColor":"green", | ||
"backgroundColor":"white", | ||
"list":[ | ||
{ | ||
"pagePath": "pages/index/index", | ||
"text": "首页", | ||
"iconPath":"images/icon_API.png", | ||
"selectedIconPath":"images/icon_API_HL.png" | ||
}, | ||
{ | ||
"pagePath": "pages/logs/logs", | ||
"text": "推荐行程", | ||
"iconPath": "images/1.png", | ||
"selectedIconPath": "images/2.png" | ||
}, | ||
{ | ||
"pagePath": "pages/my/my", | ||
"text": "设置", | ||
"iconPath": "images/捕获.png", | ||
"selectedIconPath": "images/捕获.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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/**app.wxss**/ | ||
@import "style/weui.wxss"; | ||
.container { | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 200rpx 0; | ||
box-sizing: border-box; | ||
} |
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.
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
//index.js | ||
//获取应用实例 | ||
const app = getApp() | ||
|
||
Page({ | ||
data: { | ||
"welcome": "Hello WeChat Mini Program", | ||
motto: 'Hello World', | ||
userInfo: {}, | ||
hasUserInfo: false, | ||
canIUse: wx.canIUse('button.open-type.getUserInfo') | ||
}, | ||
//事件处理函数 | ||
bindViewTap: function() { | ||
wx.navigateTo({ | ||
url: '../logs/logs' | ||
}) | ||
}, | ||
onLoad: function () { | ||
if (app.globalData.userInfo) { | ||
this.setData({ | ||
userInfo: app.globalData.userInfo, | ||
hasUserInfo: true | ||
}) | ||
} else if (this.data.canIUse){ | ||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 | ||
// 所以此处加入 callback 以防止这种情况 | ||
app.userInfoReadyCallback = res => { | ||
this.setData({ | ||
userInfo: res.userInfo, | ||
hasUserInfo: true | ||
}) | ||
} | ||
} else { | ||
// 在没有 open-type=getUserInfo 版本的兼容处理 | ||
wx.getUserInfo({ | ||
success: res => { | ||
app.globalData.userInfo = res.userInfo | ||
this.setData({ | ||
userInfo: res.userInfo, | ||
hasUserInfo: true | ||
}) | ||
} | ||
}) | ||
} | ||
}, | ||
getUserInfo: function(e) { | ||
console.log(e) | ||
app.globalData.userInfo = e.detail.userInfo | ||
this.setData({ | ||
userInfo: e.detail.userInfo, | ||
hasUserInfo: true | ||
}) | ||
}, | ||
onShareAppMessage: function () { | ||
|
||
return { | ||
|
||
title: '自定义分享标题', | ||
|
||
desc: '自定义分享描述', | ||
|
||
path: '/page/index?id=123' | ||
|
||
} | ||
|
||
}, | ||
data: { | ||
imgUrls: [ | ||
'http://img4.imgtn.bdimg.com/it/u=466214409,2328384175&fm=200&gp=0.jpg', | ||
'http://y1.ifengimg.com/news_spider/dci_2013/11/7bc7ded4426fb46714838ed9ae27d43e.jpg', | ||
'http://img2.imgtn.bdimg.com/it/u=1723817164,953308204&fm=26&gp=0.jpg' | ||
], | ||
indicatorDots: true, | ||
autoplay: true, | ||
interval: 3000, | ||
duration: 500, | ||
height :0 | ||
} | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"usingComponents": {} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!--index.wxml--> | ||
<swiper indicator-dots="{{indicatorDots}}" | ||
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> | ||
<block wx:for="{{imgUrls}}" wx:key="unique"> | ||
<swiper-item> | ||
<image src="{{item}}" class="slide-image"/> | ||
</swiper-item> | ||
</block> | ||
</swiper> | ||
<view class="btn-area"> | ||
<navigator url="/pages/logs/logs" open-type='switchTab'>国外游</navigator> | ||
<navigator url="/pages/logs/logs" open-type='switchTab'>国内游</navigator> | ||
<navigator url="/pages/logs/logs" open-type='switchTab'>周边游</navigator> | ||
</view> |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/**index.wxss**/ | ||
.userinfo { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.userinfo-avatar { | ||
width: 128rpx; | ||
height: 128rpx; | ||
margin: 20rpx; | ||
border-radius: 50%; | ||
} | ||
|
||
.userinfo-nickname { | ||
color: #aaa; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//logs.js | ||
const util = require('../../utils/util.js') | ||
|
||
Page({ | ||
data: { | ||
logs: [] | ||
}, | ||
onLoad: function () { | ||
this.setData({ | ||
logs: (wx.getStorageSync('logs') || []).map(log => { | ||
return util.formatTime(new Date(log)) | ||
}) | ||
}) | ||
}, | ||
openConfirm: function () { | ||
|
||
wx.showModal({ | ||
|
||
title: '请输入内容', | ||
|
||
content: getval, | ||
|
||
confirmText: "主操作", | ||
|
||
cancelText: "辅助操作", | ||
|
||
success: function (res) { | ||
|
||
console.log(res); | ||
|
||
if (res.confirm) { | ||
|
||
console.log('用户点击主操作') | ||
|
||
} else { | ||
|
||
console.log('用户点击辅助操作') | ||
|
||
} | ||
|
||
} | ||
|
||
}); | ||
|
||
} | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"usingComponents": {} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!--logs.wxml--> | ||
<view class="page"> | ||
<view class='mask' style='display:{{flag}}'> | ||
<view class="inputbox" catchtouchmove='prevent'> | ||
<view style="text-align:center" class='inputtitle'>请输入您现有的金额</view> | ||
<input class="getinput" placeholder='请输入内容' bindinput='getinput'></input> | ||
<button class='firstbtn' catchtap='mask'>取消</button> | ||
<button catchtap='add'>确认</button> | ||
</view> | ||
</view> | ||
<view class='cl'></view> | ||
<view class='text'> | ||
<text >{{text}}</text> | ||
</view> | ||
</view> |
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/**logs.wxss**/ | ||
.userinfo { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.userinfo-avatar { | ||
width: 128rpx; | ||
height: 128rpx; | ||
margin: 20rpx; | ||
border-radius: 50%; | ||
} | ||
|
||
.userinfo-nickname { | ||
color: lightseagreen; | ||
} | ||
|
||
.usermotto { | ||
margin-top: 200px; | ||
} | ||
|
||
.cl{ | ||
clear: both; | ||
} | ||
button{ | ||
overflow: visible; | ||
} | ||
.mini-btn{ | ||
|
||
margin:20px 0 0 20px; | ||
|
||
} | ||
.text{ | ||
margin: 0 0 0 20px; | ||
} | ||
|
||
.mask{ | ||
position: fixed; | ||
top:0; | ||
left:0; | ||
width:100%; | ||
height:100%; | ||
background-color:rgba(0,0,0,0.5); | ||
} | ||
.inputbox{ | ||
width: 80%; | ||
position: fixed; | ||
left: 50%; | ||
margin-left: -40%; | ||
top: 25%; | ||
background-color: #ffffff; | ||
z-index: 1000; | ||
} | ||
.inputtitle{ | ||
background-color: crimson; | ||
color: #ffffff; | ||
font-size: 14px; | ||
height: 30px; | ||
line-height: 30px; | ||
} | ||
.getinput{ | ||
border: 1px solid #ccc; | ||
font-size: 14px; | ||
height: 30px; | ||
line-height: 30px; | ||
width:90%; | ||
margin: 10px auto; | ||
border-radius: 4px; | ||
} | ||
.inputbox button{ | ||
position: static; | ||
border-radius: 0; | ||
width:49%; | ||
float: left; | ||
font-size: 14px; | ||
margin-left: 5px; | ||
background-color: crimson; | ||
color: #ffffff; | ||
} | ||
.inputbox .firstbtn{ | ||
margin-left: 0; | ||
} |
Oops, something went wrong.