}, | }, | ||||
{ | { | ||||
text: "消息", | text: "消息", | ||||
pagePath: "/pages/releaseModule/index", | |||||
pagePath: "/pages/msgModule/index", | |||||
iconPath: "/images/tabbar/msg-bar.png", | iconPath: "/images/tabbar/msg-bar.png", | ||||
selectedIconPath: "/images/tabbar/msg-bar.png", | selectedIconPath: "/images/tabbar/msg-bar.png", | ||||
}, | }, |
Page({ | Page({ | ||||
data: { | data: { | ||||
motto: 'Hello World', | |||||
userInfo: {}, | |||||
hasUserInfo: false, | |||||
canIUse: wx.canIUse('button.open-type.getUserInfo'), | |||||
canIUseGetUserProfile: false, | |||||
canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName'), // 如需尝试获取用户信息可改为false | |||||
currentIndex: 0 | currentIndex: 0 | ||||
}, | }, | ||||
// 事件处理函数 | |||||
bindViewTap() { | |||||
wx.navigateTo({ | |||||
url: '../logs/logs' | |||||
}) | |||||
}, | |||||
onLoad() { | onLoad() { | ||||
if (wx.getUserProfile) { | |||||
this.setData({ | |||||
canIUseGetUserProfile: true | |||||
}) | |||||
} | |||||
}, | |||||
getUserProfile(e) { | |||||
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 | |||||
wx.getUserProfile({ | |||||
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 | |||||
success: (res) => { | |||||
console.log(res) | |||||
this.setData({ | |||||
userInfo: res.userInfo, | |||||
hasUserInfo: true | |||||
}) | |||||
} | |||||
}) | |||||
}, | }, | ||||
getUserInfo(e) { | |||||
// 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息 | |||||
console.log(e) | |||||
this.setData({ | |||||
userInfo: e.detail.userInfo, | |||||
hasUserInfo: true | |||||
}) | |||||
} | |||||
}) | }) |
/**index.wxss**/ | /**index.wxss**/ | ||||
.userinfo { | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
color: #aaa; | |||||
.home-page { | |||||
background: #f5f9ff; | |||||
padding: 20rpx; | |||||
min-height: 100%; | |||||
padding-bottom: 120rpx; | |||||
font-size: 26rpx; | |||||
} | } | ||||
.userinfo-avatar { | |||||
overflow: hidden; | |||||
width: 128rpx; | |||||
height: 128rpx; | |||||
margin: 20rpx; | |||||
border-radius: 50%; | |||||
} | |||||
.usermotto { | |||||
margin-top: 200px; | |||||
.search-view { | |||||
height: 230rpx; | |||||
background: #32aecd; | |||||
border-radius: 15rpx; | |||||
box-sizing: border-box; | |||||
padding:20rpx; | |||||
} | } |
<!--pages/msgPage/msgPage.wxml--> | <!--pages/msgPage/msgPage.wxml--> | ||||
<text>pages/msgPage/msgPage.wxml</text> | |||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> | |||||
<view class="home-page"> | |||||
<!-- 顶部 --> | |||||
<view class="neirong">消息</view> | |||||
<view>到底</view> | |||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> | |||||
</view> | |||||
/* pages/msgPage/msgPage.wxss */ | |||||
/* pages/msgPage/msgPage.wxss */ | |||||
.home-page { | |||||
background: #f5f9ff; | |||||
padding: 20rpx; | |||||
min-height: 100%; | |||||
padding-bottom: 120rpx; | |||||
} | |||||
.neirong{ | |||||
height: 1500rpx; | |||||
} |
<!--pages/myPage/myPage.wxml--> | <!--pages/myPage/myPage.wxml--> | ||||
<text>pages/myPage/myPage.wxml</text> | |||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> | |||||
<view class="home-page"> | |||||
<!-- 顶部 --> | |||||
<view class="neirong">我的</view> | |||||
<view>到底</view> | |||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> | |||||
</view> |
/* pages/myPage/myPage.wxss */ | |||||
/* pages/myPage/myPage.wxss */ | |||||
.home-page { | |||||
background: #f5f9ff; | |||||
padding: 20rpx; | |||||
min-height: 100%; | |||||
padding-bottom: 120rpx; | |||||
} | |||||
.neirong{ | |||||
height: 1500rpx; | |||||
} |
<!--pages/release/release.wxml--> | <!--pages/release/release.wxml--> | ||||
<text>pages/release/release.wxml</text> | |||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> | |||||
<view class="home-page"> | |||||
<!-- 顶部 --> | |||||
<view class="neirong">发布需求</view> | |||||
<view>到底</view> | |||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> | |||||
</view> | |||||
/* pages/release/release.wxss */ | |||||
/* pages/release/release.wxss */ | |||||
.home-page { | |||||
background: #f5f9ff; | |||||
padding: 20rpx; | |||||
min-height: 100%; | |||||
padding-bottom: 120rpx; | |||||
} | |||||
.neirong{ | |||||
height: 1500rpx; | |||||
} |