Skip to content

Commit

Permalink
Merge pull request #263 from hzuzkt/master
Browse files Browse the repository at this point in the history
#2 #88 第二次实验代码
  • Loading branch information
zengsn authored Nov 6, 2017
2 parents 25f4585 + 372f4c8 commit c2b3f33
Show file tree
Hide file tree
Showing 22 changed files with 349 additions and 160 deletions.
36 changes: 8 additions & 28 deletions 1514080901135/app.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
{
"pages": [
"pages":[
"pages/index/index",
"pages/logs/logs",
"pages/comp/view",
"pages/comp/scroll",
"pages/comp/form",
"pages/example/button/button",
"pages/demo/scrollView",
"pages/form/form"
"pages/logs/logs"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#000000",
"navigationBarTitleText": "我的小程序",
"navigationBarTextStyle": "white"
},
"tabBar": {
"color": "#000000",
"selectedColor": "#009444",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页"
},
{
"pagePath": "pages/logs/logs",
"text": ""
}
]
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle":"black"
}
}
}
3 changes: 0 additions & 3 deletions 1514080901135/app.wxss
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/**app.wxss**/
@import 'style/weui.wxss';

/* . 表示 类 class */
.container {
height: 100%;
display: flex;
Expand Down
Binary file added 1514080901135/pages/images/1.jpg
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 1514080901135/pages/images/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 1514080901135/pages/images/2.jpg
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 1514080901135/pages/images/3.jpg
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 1514080901135/pages/images/4.jpg
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 1514080901135/pages/images/dog.jpg
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 1514080901135/pages/images/dog2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 2 additions & 74 deletions 1514080901135/pages/index/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,79 +4,7 @@ const app = getApp()

Page({
data: {
motto: 'Hello HZU',
userInfo: {},
hasUserInfo: false,
textColor: 'red',
textClass: 'description',
showScroll: true,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
//事件处理函数
bindViewTap: function() {
console.dir('bindViewTap')
wx.navigateTo({
url: '../logs/logs'
})
},
changeColor: function() {
//console.log('changeColor')
var me = this;
if (me.data.textClass == 'description') {
this.setData({
textClass: 'blue'
})
} else {
this.setData({
textClass: 'description'
})
}
//this.data.textColor = 'blue'
},
naviToView: function() {
wx.navigateTo({
url: "../comp/view"
})
},
naviToScrollView: function () {
wx.navigateTo({
url: "../comp/scroll"
})
},
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
})
}

})
53 changes: 24 additions & 29 deletions 1514080901135/pages/index/index.wxml
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
<view class="page">
<view class="page__hd">
</view>
<view class="page__bd">
<view class="weui-cells__title">组件示例</view>
<view class="weui-cells weui-cells_after-title">
<navigator url="/pages/comp/view?" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="../example/images/a.png" style="margin-right: 5px;vertical-align: middle;width:20px; height: 20px;"></image>
</view>
<view class="weui-cell__bd">view示例</view>
<view class="weui-cell__ft weui-cell__ft_in-access">打开</view>
</navigator>
<navigator wx:if="{{showScroll}}" url="/pages/demo/scrollView" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="{{icon}}" style="margin-right: 5px;vertical-align: middle;width:20px; height: 20px;"></image>
</view>
<view class="weui-cell__bd">scroll-view示例</view>
<view class="weui-cell__ft weui-cell__ft_in-access">说明文字</view>
</navigator>
<navigator url="/pages/form/form" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__hd">
<image src="{{icon}}" style="margin-right: 5px;vertical-align: middle;width:20px; height: 20px;"></image>
</view>
<view class="weui-cell__bd">form示例</view>
<view class="weui-cell__ft weui-cell__ft_in-access">说明文字</view>
</navigator>
</view>
</view>
<view class="row">

<view class="row0">
<image src="../images/dog2.png" style="height:80px;width:80px;" id="dogimage" />
</view>
<view class="row1">
<image src="../images/1.png" style="height:40px;width:40px;" id="image" />
<view id="sign_in"> sign in</view>
</view>

<view class="row2">
<view id="accounttext">account</view>
<input id="account"/>
</view>

<view class="row3">
<view id="passwordtext">password</view>
<input id="passwd"/>
</view>

<view class="row4">
<button id="confirmbutton"> Go</button>
</view>

</view>
100 changes: 74 additions & 26 deletions 1514080901135/pages/index/index.wxss
Original file line number Diff line number Diff line change
@@ -1,31 +1,79 @@
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
.row{
display:flex;
flex-direction:column;
align-items: center;
margin-top:130px;
}
.row0{

.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
height:90px;
width:90px;
background-color:#00ccff;
border-radius: 120px;
margin-bottom:50px;
}

.userinfo-nickname {
color: blue;
#dogimage{
margin-top:1px;
margin-left:1px;
border-radius: 70px;
}

.usermotto {
margin-top: 20px;
color: #009A89;
text-decoration: underline;
font-weight: bold;
}
.description {
color: red;
font-size: 18px;
}
.blue {
color: blue;
.row1{
height:40px;
width:250px;
background-color: greenyellow;
}
#image{
float:left;
}
#sign_in{
line-height: 40px;
margin-left:110px;

}
.row2{
height:40px;
width:250px;
background-color: #cccccc;
border-radius: 7px;
margin-top:3px;
}
#accounttext{
float:left;
margin-top:4px;
}
#account{
border:1px solid #003333;
margin-top:4px;
width:161px;
margin-left:85px;
border-radius: 3px;
}
.row3{
height:40px;
width:250px;
background-color: #cccccc;
border-radius: 7px;
margin-top:3px;
}
#passwordtext{
float:left;
margin-top:4px;
}
#passwd{
border:1px solid #003333;
margin-top:4px;
width:146px;
margin-left:100px;
border-radius: 3px;
}
.row4{
height:40px;
width:250px;
margin-top:20px;
}
#confirmbutton{
height:35px;
width:80px;
line-height:35px;
float:right;
}
15 changes: 15 additions & 0 deletions 1514080901135/pages/page1/page1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//index.js
//获取应用实例
const app = getApp()

Page({
data: {
background:[
'../images/1.jpg',
'../images/2.jpg',
'../images/3.jpg',
'../images/4.jpg'
]
}

})
12 changes: 12 additions & 0 deletions 1514080901135/pages/page1/page1.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<view class="container">


<swiper indicator-dots="true" autoplay="true" interval="1000">
<view wx:for="{{background}}" wx-item="item">
<swiper-item>
<image src="{{item}}" />
</swiper-item>
</view>
</swiper>

</view>
8 changes: 8 additions & 0 deletions 1514080901135/pages/page1/page1.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.container{
height:100%;
width:100%;

display:flex;
align-items:center;
margin-top:120px;
}
55 changes: 55 additions & 0 deletions 1514080901135/pages/page2/page2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//index.js
//获取应用实例
const app = getApp()

Page({

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
})
}
})
Loading

0 comments on commit c2b3f33

Please sign in to comment.