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

main
Wkang921 3 years ago
parent 1976506b55
commit 1760270bb9

@ -12,15 +12,64 @@ Page({
isCxHq:false, isCxHq:false,
bdsjhVisible:false, bdsjhVisible:false,
avatar:"", avatar:"",
countdown:60,
userInfo:{ userInfo:{
avatar:"", avatar:"",
nick:"", nick:"",
isChatVip:false,//是否会员 isChatVip:false,//是否会员
phone:'', phone:'123',
hasPhone:false 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(){ doBdsjh(){
console.log('绑定手机号') console.log('绑定手机号')
@ -30,7 +79,30 @@ Page({
this.setData({bdsjhVisible:false}) this.setData({bdsjhVisible:false})
}, },
doEXecSjh(){ doEXecSjh(){
this.setData({bdsjhVisible:false}) 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(){ go2Grzl(){
wx.navigateTo({ wx.navigateTo({
@ -91,7 +163,10 @@ Page({
getUserInfo(){ getUserInfo(){
req.getRequest('/api/user/curt',{}).then((res)=>{ req.getRequest('/api/user/curt',{}).then((res)=>{
if(res.data.code==200){ 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); console.log(this.userInfo);
}).catch((err)=>{ }).catch((err)=>{

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

@ -18,6 +18,14 @@ Page({
wx.navigateBack({ changed: true }); wx.navigateBack({ changed: true });
}, },
doExecYjfk(e){ 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 let form = e.detail.value
req.postRequest('/api/v1/opinion',form).then((res)=>{ req.postRequest('/api/v1/opinion',form).then((res)=>{
console.log(res) console.log(res)

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

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

@ -21,6 +21,13 @@
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "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) { patchRequest(url, data, header = this._header) {
return this.requestAll(url, data, header, 'PATCH') return this.requestAll(url, data, header, 'PATCH')

Loading…
Cancel
Save