|
|
|
|
@ -6,8 +6,8 @@ |
|
|
|
|
</view> |
|
|
|
|
<view class="bottom_box"> |
|
|
|
|
<button class="btn" @click="addForm">填写报名单(其他渠道已购买)</button> |
|
|
|
|
<button class="btn" v-if="!hasUserInfo &&canIUseGetUserProfile" @click="getUserProfile">定制</button> |
|
|
|
|
<button v-else-if="!hasPhone" class="btn" @getphonenumber="getphonenumber">定制</button> |
|
|
|
|
<button class="btn" v-if="!hasUserInfo && canIUseGetUserProfile" @click="getUserProfile">定制</button> |
|
|
|
|
<button v-else-if="!hasPhone" class="btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">定制</button> |
|
|
|
|
<button v-else class="btn" @click="clickCustom">定制</button> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
@ -42,7 +42,8 @@ |
|
|
|
|
methods: { |
|
|
|
|
// 点击定制 |
|
|
|
|
clickCustom() { |
|
|
|
|
console.log('点击定制') |
|
|
|
|
console.log('点击定制'); |
|
|
|
|
// this.doSave(); |
|
|
|
|
}, |
|
|
|
|
// 填写表单 |
|
|
|
|
addForm() { |
|
|
|
|
@ -56,7 +57,6 @@ |
|
|
|
|
}, |
|
|
|
|
//用户信息 |
|
|
|
|
getUserProfile() { |
|
|
|
|
console.log('getuserinfo') |
|
|
|
|
uni.getUserProfile({ |
|
|
|
|
lang: 'zh_CN', |
|
|
|
|
desc: '获取微信用户的昵称和头像', |
|
|
|
|
@ -85,6 +85,30 @@ |
|
|
|
|
this.phone = res.data.data; |
|
|
|
|
this.hasPhone = true; |
|
|
|
|
uni.setStorageSync('phone', res.data.data); |
|
|
|
|
this.doSave(); |
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: res.data.msg, |
|
|
|
|
icon: 'none' |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
//存储用户信息 |
|
|
|
|
doSave() { |
|
|
|
|
uni.request({ |
|
|
|
|
url: getApp().globalData.baseUrl + '/weChatUser/save', |
|
|
|
|
method: 'POST', |
|
|
|
|
data: { |
|
|
|
|
openId: getApp().globalData.openId, |
|
|
|
|
username: this.userInfo.nickName, |
|
|
|
|
phone: this.phone, |
|
|
|
|
avatar: this.userInfo.avatarUrl |
|
|
|
|
}, |
|
|
|
|
success: (res) => { |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
uni.setStorageSync('userInfo', JSON.stringify(res.data.data)); |
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: res.data.msg, |
|
|
|
|
@ -94,7 +118,6 @@ |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|