调整绑定手机号、意见反馈

main
Wkang921 3 years ago
parent 1976506b55
commit 1760270bb9

@ -12,15 +12,64 @@ Page({
isCxHq:false,
bdsjhVisible:false,
avatar:"",
countdown:60,
userInfo:{
avatar:"",
nick:"",
isChatVip:false,//是否会员
phone:'',
phone:'123',
hasPhone:false
},
phone:'',
phoneVerificationCode:''
},
// 手机号码校验
getPhone(e){
const phone = e.detail.value;
if (!/^1[3456789]\d{9}$/.test(phone)) {
wx.showToast({
title: '手机号码格式不正确',
icon: 'none'
});
return;
}
},
getVerificationCode(e){
const VerificationCode = e.detail.value;
if (VerificationCode.length !== 6) {
wx.showToast({
title: '验证码格式不正确',
icon: 'none'
});
return;
}
},
getCode(){
console.log(this.data.phone);
if(this.data.countdown === 60 || this.data.countdown === '重新获取'){
req.postRequest('/api/user/send-authentication-code',{phone:this.data.phone}).then((res)=>{
console.log(res);
if (res.data.code !== 200) {
return wx.showToast({
title: res.data.msg,
icon: 'none'
});
}
if (this.data.countdown === '重新获取') {
this.setData({countdown: 60})
}
// 验证码倒计时
this.setData({isCxHq:true})
const timerId = setInterval(()=>{
this.setData({countdown:this.data.countdown-1})
if (this.data.countdown === 0) {
clearTimeout(timerId);
this.setData({countdown:'重新获取'})
}
},1000)
console.log('获取验证码');
})
}
},
doBdsjh(){
console.log('绑定手机号')
@ -30,7 +79,30 @@ Page({
this.setData({bdsjhVisible:false})
},
doEXecSjh(){
req.patchRequest('/api/user/curt',{
phone:this.data.phone,
phoneVerificationCode:this.data.phoneVerificationCode
}).then((res)=>{
console.log(res);
if(res.data.code !== 200){
wx.showToast({
title:res.data.msg,
icon:'none'
})
return
}else {
this.setData({bdsjhVisible:false})
this.getUserInfo()
wx.showToast({
title:'绑定成功',
icon:'none'
})
}
})
this.setData({
phoneVerificationCode:'',
isCxHq:false
})
},
go2Grzl(){
wx.navigateTo({
@ -91,7 +163,10 @@ Page({
getUserInfo(){
req.getRequest('/api/user/curt',{}).then((res)=>{
if(res.data.code==200){
this.setData({userInfo:res.data.data})
this.setData({
userInfo:res.data.data,
phone:res.data.data.phone
})
}
console.log(this.userInfo);
}).catch((err)=>{

@ -24,31 +24,31 @@
</view>
</view><!--功能操作框-->
<view class="mycell" bindtap="ljXzjl" ><!--cell菜单单元格-->
<t-cell hover arrow bindtap="go2Gw">
<!-- <t-cell hover arrow bindtap="go2Gw">
<t-icon slot="left-icon" name="https://xzjl-1257436036.cos.ap-nanjing.myqcloud.com/me/xzjl.png" size="50rpx"/>
<text slot="title" class="mycelltext" >了解星座精灵</text>
</t-cell>
</t-cell> -->
<t-cell hover bindtap="doBdsjh" >
<t-icon slot="left-icon" name="https://xzjl-1257436036.cos.ap-nanjing.myqcloud.com/me/phone.png" size="50rpx"/>
<text slot="title" class="mycelltext" >绑定手机号</text>
<text slot="note" wx:if="{{userInfo.hasPhone}}">{{userInfo.phone}}</text>
</t-cell>
<t-cell hover arrow bindtap="go2Cjwt">
<!-- <t-cell hover arrow bindtap="go2Cjwt">
<t-icon slot="left-icon" name="https://xzjl-1257436036.cos.ap-nanjing.myqcloud.com/me/cjwt.png" size="50rpx"/>
<text slot="title" class="mycelltext" >常见问题</text>
</t-cell>
</t-cell> -->
<t-cell hover arrow bindtap="go2Yjfk">
<t-icon slot="left-icon" name="https://xzjl-1257436036.cos.ap-nanjing.myqcloud.com/me/yjfk.png" size="50rpx"/>
<text slot="title" class="mycelltext" >意见反馈</text>
</t-cell>
<t-cell hover arrow bindtap="go2Yhsyxy">
<!-- <t-cell hover arrow bindtap="go2Yhsyxy">
<t-icon slot="left-icon" name="https://xzjl-1257436036.cos.ap-nanjing.myqcloud.com/me/yhsyxy.png" size="50rpx"/>
<text slot="title" class="mycelltext" >用户使用协议</text>
</t-cell>
<t-cell hover arrow bindtap="go2Ysxy">
</t-cell> -->
<!-- <t-cell hover arrow bindtap="go2Ysxy">
<t-icon slot="left-icon" name="https://xzjl-1257436036.cos.ap-nanjing.myqcloud.com/me/ysxy.png" size="50rpx"/>
<text slot="title" class="mycelltext" >隐私协议</text>
</t-cell>
</t-cell> -->
<t-cell hover>
<t-icon slot="left-icon" name="https://xzjl-1257436036.cos.ap-nanjing.myqcloud.com/me/xcxbb.png" size="50rpx"/>
<text slot="title" class="mycelltext" >小程序版本</text>
@ -71,14 +71,14 @@
<view class="sjhm1">手机号码</view>
<view class="yzm1">验证码</view>
<view class="input-example sjhminput1">
<t-input value="{{userInfo.phone}}" placeholder="请输入手机号" />
<t-input model:value="{{phone}}" bindblur="getPhone" placeholder="请输入手机号" />
</view>
<view class="input-example sjhminput2">
<t-input placeholder="请输入验证码" />
<t-input model:value="{{phoneVerificationCode}}" bindblur="getVerificationCode" placeholder="请输入验证码" />
</view>
<view class="sjhbkx"></view>
<view class="yzmbkx"></view>
<view class="cxhq">{{isCxHq?'重新获取':'立即获取'}}</view>
<view class="cxhq" bindtap="getCode">{{isCxHq?countdown:'立即获取'}}</view>
<view class="qxSjh" bindtap="doCancelSjh">取消</view>
<view class="wcSjh" bindtap="doEXecSjh">完成</view>
</view>

@ -18,6 +18,14 @@ Page({
wx.navigateBack({ changed: true });
},
doExecYjfk(e){
const contactWay = e.detail.value.contactWay;
if (!/^1[3456789]\d{9}$/.test(contactWay)) {
wx.showToast({
title: '手机号码格式不正确',
icon: 'none'
});
return;
}
let form = e.detail.value
req.postRequest('/api/v1/opinion',form).then((res)=>{
console.log(res)

@ -7,13 +7,8 @@
<view class="jyms">建议描述</view>
<view class="lxfs">联系方式</view>
<form bindsubmit="doExecYjfk">
<view class="jymsk"><t-textarea name="content" placeholder="请描述您遇到的问题或建议" /></view>
<form bindsubmit="doExecYjfk" report-submit="true">
<view class="jymsk"><t-textarea name="content" value="{{yj.content}}" placeholder="请描述您遇到的问题或建议"/></view>
<view class="lxfsk"><t-textarea name="contactWay" maxlength="11" value="{{yj.contactWay}}" placeholder="请输入您的联系方式" /></view>
<button class="submit" form-type="submit">提交</button>
<button class="submit" formType="submit">提交</button>
</form>

@ -83,6 +83,7 @@
font-size: 32rpx;
text-align: center;
font-family: SourceHanSansSC-medium;
z-index: 999;
}
.lxfs{
position: absolute;
@ -98,10 +99,10 @@
.jymsk{
position: absolute;
left: 23px;
top: 251px;
width: 330px;
height: 207px;
left: 46rpx;
top: 502rpx;
width: 660rpx;
height: 414rpx;
line-height: 20px;
border-radius: 15px;
background-color: rgba(239, 239, 239, 1);
@ -113,10 +114,10 @@
.lxfsk{
position: absolute;
left: 23px;
top: 532px;
width: 330px;
height: 56px;
left: 46rpx;
top: 1064rpx;
width: 660rpx;
height: 112rpx;
line-height: 20px;
border-radius: 15px;
background-color: rgba(239, 239, 239, 1);

@ -21,6 +21,13 @@
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/home/me/indexx",
"query": "",
"launchMode": "default",
"scene": null
}
]
}

@ -41,7 +41,7 @@ class request {
}
/**
* POST类型的网络请求
* patch类型的网络请求
*/
patchRequest(url, data, header = this._header) {
return this.requestAll(url, data, header, 'PATCH')

Loading…
Cancel
Save