Browse Source

调整个人中心的登录样式;添加手机号验证

master
lqq 6 years ago
parent
commit
859d1da0c8
  1. 8
      pages/topics/index.js
  2. 10
      pages/user/index.js
  3. 4
      pages/user/index.wxml
  4. 7
      pages/user/index.wxss
  5. 2
      utils/http.js

8
pages/topics/index.js

@ -25,7 +25,7 @@ Page({
*/
onLoad: function () {
if (!store.hasPhone()) {
if (store.hasPhone()) {
console.log('已经绑定手机号码')
} else {
console.log('未绑定手机号码')
@ -39,7 +39,7 @@ Page({
console.log('啦啦啦')
this.fetchTopicList();
},
fetchTopicList() {
fetchTopicList () {
let page = this.data.currPage
topicModel.getTopicList(page, res => {
console.log('议题列表')
@ -82,10 +82,10 @@ Page({
wx.stopPullDownRefresh()
})
},
onRefreshList() {
onRefreshList () {
this.fetchGoodIdeaList()
},
fetchGoodIdeaList() {
fetchGoodIdeaList () {
let page = this.data.currPage
topicModel.goldenList(page, res => {
console.log('金点子列表')

10
pages/user/index.js

@ -27,7 +27,15 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (store.hasPhone()) {
console.log('已经绑定手机号码')
this.getUserInfo()
} else {
console.log('未绑定手机号码')
wx.redirectTo({
url: '/pages/register/index',
})
}
},
isAuthUserInfo () {
let that = this
@ -105,7 +113,7 @@ Page({
store.saveUserInfo({
nickName: res.result.nickName,
avatarUrl: res.result.avatarUrl,
phone: res.result.phone === null ? '' : res.result.phone
phone: res.result.phone || ''
})
} else {
console.log('未授权')

4
pages/user/index.wxml

@ -9,10 +9,10 @@
</mp-cell>
</mp-cells>
<mp-cells ext-class="page_hd" wx:if="{{isAuth}}">
<mp-cell bindtap="onTapItem" data-type="myInfo">
<mp-cell>
<view class="user_auth_hd">
<!-- <open-data class="user_logo" type="userAvatarUrl"></open-data> -->
<open-data class="user_auth_name" type="userNickName"></open-data>
<!--<open-data class="user_auth_name" type="userNickName"></open-data> -->
<!-- 需要使用 button 来授权登录 -->
<button class="authBtn" size="mini" wx:if="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权登录</button>
<view wx:else>请升级微信版本</view>

7
pages/user/index.wxss

@ -22,8 +22,7 @@
display: flex;
flex-direction: row;
align-items: center;
overflow: hidden;
justify-content: space-between;
justify-content: center;
}
.user_logo {
width: 80px;
@ -66,8 +65,4 @@
overflow: hidden;
}
.authBtn{
margin-right:10px;
margin: 0;
/* width: 100px; */
flex-wrap: nowrap;
}

2
utils/http.js

@ -30,7 +30,7 @@ class HTTP {
'content-type': 'application/json',
}
console.log(header)
console.log(data)
console.log(data || {})
wx.request({
url: url,
data: data,

Loading…
Cancel
Save