Browse Source

合并冲突

master
fanp 6 years ago
parent
commit
d96e8d64cf
  1. 2
      pages/home/index.js
  2. 2
      pages/topics/index.js
  3. 21
      pages/user/index.js
  4. 4
      pages/user/index.wxml
  5. 7
      pages/user/index.wxss
  6. 6
      utils/http.js

2
pages/home/index.js

@ -28,6 +28,8 @@ Page({
currPage: 1,
})
this.fetchHomeList()
this.fetchHomeBanner()
this.fetchHomeHot()
wx.vibrateShort({
success () {
console.log('震动')

2
pages/topics/index.js

@ -25,7 +25,7 @@ Page({
*/
onLoad: function () {
if (!store.hasPhone()) {
if (store.hasPhone()) {
console.log('已经绑定手机号码')
} else {
console.log('未绑定手机号码')

21
pages/user/index.js

@ -24,7 +24,7 @@ Page({
userInfo:{
type:Object,
value:{}
},
}
},
@ -37,10 +37,20 @@ Page({
onShow: function () {
console.log('啦啦啦')
this.getUserInfo()
if (store.hasPhone()) {
console.log('已经绑定手机号码')
this.getUserInfo()
} else {
console.log('未绑定手机号码')
wx.redirectTo({
url: '/pages/register/index',
})
}
},
isAuthUserInfo () {
let that = this
wx.showLoading()
console.log('未授权')
return new Promise(resolve => {
wx.getSetting({
success (res) {
@ -97,10 +107,9 @@ Page({
userModel.getUserInfo(res => {
let nickName = res.result.nickName
let avatarUrl = res.result.avatarUrl
if (nickName && avatarUrl){
console.log('已授权')
console.log(res.result)
let userInfo = res.result
this.setData({
userInfo: res.result,
avatarUrl: res.result.avatarUrl,
@ -110,7 +119,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('未授权')
@ -137,10 +146,6 @@ Page({
wx.navigateTo({
url: `/pages/user/${type}/index?userIcon=${this.data.userInfo.avatarUrl}&userName=${this.data.userInfo.nickName}&userPhone=${this.data.userInfo.phone || ''}&company=${this.data.userInfo.company || ''}&position=${this.data.userInfo.position || ''}`,
})
} else {
wx.navigateTo({
url: `/pages/user/${type}/index`,
})
}
}
})

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;
}

6
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,
@ -55,7 +55,7 @@ class HTTP {
} else {
console.log('数据请求失败')
wx.showToast({
title: res.data.message,
title: res.data.message || '服务器错误,请稍后重试',
icon: 'none'
})
}
@ -70,7 +70,7 @@ class HTTP {
},
fail: function (res) {
wx.showToast({
title: '网络连接错误,请求失败!',
title: '网络连接错误,请求稍后重试!',
icon: 'none'
})
params.fail && params.fail(res)

Loading…
Cancel
Save