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
1 parent
cfa99c5
commit e3d6c66
Showing
10 changed files
with
92 additions
and
279 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,5 +1,4 @@ | ||
/**app.wxss**/ | ||
@import'weui.wxss'; | ||
.container { | ||
height: 100%; | ||
display: flex; | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,12 +1,54 @@ | ||
//index.js | ||
//获取应用实例 | ||
const app = getApp() | ||
|
||
Page({ | ||
open: function () { | ||
wx.showActionSheet({ | ||
itemList: ['A', 'B', 'C'], | ||
success: function (res) { | ||
if (!res.cancel) { | ||
console.log(res.tapIndex) | ||
} | ||
data: { | ||
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 | ||
}) | ||
} | ||
}); | ||
}) |
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,34 +1,18 @@ | ||
<view class="page"> | ||
<view class="page__hd"> | ||
<view class="page__title">HELLO</view> | ||
<view class="page__desc">welcome to one sheep</view> | ||
</view> | ||
<view class="page__bd"> | ||
<view class="weui-btn-area"> | ||
<button type="default" bindtap="open">HELLO</button> | ||
</view> | ||
</view> | ||
<view class="page__hd"> | ||
<view class="page__title">Button</view> | ||
<view class="page__desc">按钮,WeUI采用小程序原生的按钮为主体,加入一些间距的样式。</view> | ||
<view class="page__desc">欢迎使用小程序</view> | ||
</view> | ||
<view class="page__bd page__bd_spacing"> | ||
<button class="weui-btn" type="primary">我的文件 </button> | ||
|
||
|
||
<button class="weui-btn" type="default">我的收藏 </button> | ||
|
||
<button class="weui-btn" type="primary">登录</button> | ||
|
||
|
||
<button class="weui-btn" type="warn">设置 </button> | ||
<button class="weui-btn" type="warn"> 退出</button> | ||
|
||
|
||
<view class="button-sp-area"> | ||
<button class="weui-btn" type="primary" plain="true">进入</button> | ||
|
||
|
||
|
||
<button class="weui-btn" type="primary" plain="true">设置</button> | ||
|
||
<button class="weui-btn mini-btn" type="warn" size="mini">退出</button> | ||
</view> | ||
</view> | ||
</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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
page{ | ||
background-color: #FFFFFF; | ||
} | ||
@import'weui.wxss'; | ||
.button-sp-area{ | ||
margin: 0 auto; | ||
padding-top: 15px; | ||
|
Oops, something went wrong.