Commit 20abc632 by LiuJunYi

上传

parent 276a8da8
......@@ -15,8 +15,8 @@ Page({
data: {
nickname: {},
detail: {},
phone: '',
formPhone: '',
date: '',
remark: '',
loading: false,
......@@ -279,5 +279,88 @@ Page({
}, 800)
}
})
},
/**
* 保存手机号
*/
savePhone() {
//发送请求保存手机号
const phone = this.data.formPhone
api.getPhoneNumber({
phone: phone
}).then(res => {
if (!res.code) {
// 将刚拿到的手机号码放到全局数据中,否则phone数据只会是当前页面数据
if (app.globalData.userInfo) {
app.globalData.userInfo.phone = res.data.phone
}
this.setData({
phone: res.data.phone,
visible: false
})
if (res.is_relation) {
$Toast({
content: '温馨提示:手机号授权成功,系统已自动关联您在其他平台购买的美行者VIP会员',
type: 'success'
});
} else {
$Toast({
content: '手机号授权成功',
type: 'success'
});
}
//在拉去一遍用户信息
this.getUserInfo();
} else {
this.setData({
'errMsg': true,
'errMessage': '*' + res.msg
})
}
})
},
//获取用户信息
// 获取个人资料
getUserInfo: function () {
api.me.info().then(res => {
if (!res.code) {
console.log(res.data);
app.globalData.userInfo = res.data
// 渲染数据
this.setData({
user: res.data,
})
}
})
},
/**
* 关闭手机号填写弹窗
*/
alertClose() {
this.setData({
visible: false
});
},
/**
* 打开手机号填写弹窗
*/
openAlert() {
this.setData({
visible: true
})
},
handlePhone: function (event) {
this.setData({
formPhone: event.detail.detail.value
})
},
})
\ No newline at end of file
......@@ -7,6 +7,8 @@
"i-cell-group": "/iview/cell-group/index",
"i-cell": "/iview/cell/index",
"i-button": "/iview/button/index",
"i-toast": "/iview/toast/index"
"i-toast": "/iview/toast/index",
"i-modal": "/iview/modal/index",
"i-input": "/iview/input/index"
}
}
\ No newline at end of file
......@@ -32,7 +32,7 @@
</i-cell>
<i-cell title="手机号" i-class="cell-class">
<block wx:if="{{phone.length == 0}}">
<button slot="footer" bindgetphonenumber="handlePhoneAuth" type="info" open-type="getPhoneNumber" class="btn-auth-phone">授权手机号</button>
<button slot="footer" bindtap='openAlert' type="info" class="btn-auth-phone">填写手机号</button>
</block>
<block wx:else>
<text slot="footer">{{phone}}</text>
......@@ -56,4 +56,11 @@
</i-row>
</view>
<!-- 手机号授权框 -->
<i-modal title="填写手机号" visible="{{ visible }}" bind:ok="savePhone" bind:cancel="alertClose">
<i-input error="{{ errMsg }}" value="{{ value }}" type="number" bindchange='handlePhone' title="手机号" placeholder="请输入手机号" />
<view class="color-red">{{ errMessage }}</view>
</i-modal>
<!-- 弹窗 -->
<i-toast id="toast" />
\ No newline at end of file
......@@ -123,3 +123,11 @@ page {
border-bottom: 1rpx solid #e9e9e9;
margin-left: 30rpx;
}
.color-red{
color: #ed3f14;
text-align: left;
padding-top:20rpx;
padding-left: 60rpx;
}
\ No newline at end of file
......@@ -37,7 +37,7 @@
"list": []
},
"miniprogram": {
"current": 11,
"current": 14,
"list": [
{
"id": 0,
......@@ -125,10 +125,10 @@
"scene": "1047"
},
{
"id": -1,
"id": 14,
"name": "预约下次",
"pathName": "pages/detail/appoint/index",
"query": "id=173"
"query": "id=298"
}
]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment