api
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">生日</view>
|
||||
<view class="value">{{ userInfo.member_birthday }}</view>
|
||||
<view class="value">{{ userInfo.member_birthday | dateFormat }}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">手机号</view>
|
||||
@@ -21,7 +21,7 @@
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">等级</view>
|
||||
<view class="value">{{ userInfo.member_exppoints }}</view>
|
||||
<view class="value">{{ userInfo.level }}</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="title">积分数</view>
|
||||
@@ -34,6 +34,7 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import common from '@/static/js/common.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -46,6 +47,11 @@ export default {
|
||||
onNavigationBarButtonTap() {
|
||||
this.toEditPage();
|
||||
},
|
||||
filters: {
|
||||
dateFormat(value) {
|
||||
return common.timestampToDate({ timestamp: value });
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getUserInfo() {
|
||||
this.$u.api.getMemberInfo().then(res => {
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
<view class="code">
|
||||
<view class="title">验证码</view>
|
||||
<input type="text" v-model="oldCode" placeholder="请输入验证码" />
|
||||
<view class="get-code">获取验证码</view>
|
||||
<u-verification-code :seconds="seconds" @end="end" @start="start" ref="uOldCode" @change="oldCodeChange" unique-key="old" change-text="x秒"></u-verification-code>
|
||||
<view class="get-code" @click="getCode(0)">{{ btnText[0] }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="new-phone">
|
||||
@@ -20,8 +21,10 @@
|
||||
<view class="code">
|
||||
<view class="title">验证码</view>
|
||||
<input type="text" v-model="newCode" placeholder="请输入验证码" />
|
||||
<view class="get-code">获取验证码</view>
|
||||
<u-verification-code :seconds="seconds" @end="end" @start="start" ref="uNewCode" @change="newCodeChange" unique-key="new" change-text="x秒"></u-verification-code>
|
||||
<view class="get-code" @click="getCode(1)">{{ btnText[1] }}</view>
|
||||
</view>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="tips">注意:修改手机号需要原手机号获取验证码,无原手机验证码,请联系后台</view>
|
||||
@@ -35,13 +38,80 @@ export default {
|
||||
oldNumber: '',
|
||||
oldCode: '',
|
||||
newNumber: '',
|
||||
newCode: ''
|
||||
newCode: '',
|
||||
btnText: ['获取验证码', '获取验证码'],
|
||||
seconds: 60, // 获取验证码间隔时间
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
verifyValue() {
|
||||
if (this.$u.test.mobile(this.oldNumber)) this.$u.toast('请填写正确的原手机号');
|
||||
if (this.$u.test.mobile(this.newNumber)) this.$u.toast('请填写正确的新手机号');
|
||||
verifyValue(type) {
|
||||
const phone = type == 0 ? this.oldNumber : this.newNumber;
|
||||
return this.$u.test.mobile(phone);
|
||||
},
|
||||
// @param Number type 0: 原手机号 1: 新手机号
|
||||
getSmsCode (type) {
|
||||
if(!this.verifyValue(type)) {
|
||||
let tips = type == 0 ? '请填写正确的原手机号' : '请填写正确的新手机号';
|
||||
this.$u.toast(tips);
|
||||
return false;
|
||||
}
|
||||
if(this.seconds > 0) {
|
||||
this.$u.toast('倒计时结束后再发送');
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '正在获取验证码'
|
||||
})
|
||||
this.$u.api.sendSmsCode({
|
||||
member_mobile: type == 0 ? this.oldNumber: this.newNumber,
|
||||
smslog_type: 4 // 类型[1:注册,2:登录,3:找回密码,4:绑定手机]
|
||||
}).then(res => {
|
||||
uni.hideLoading();
|
||||
if(res.errCode == 0) {
|
||||
|
||||
} else {
|
||||
this.$u.toast(res.message);
|
||||
}
|
||||
})
|
||||
},
|
||||
oldCodeChange(text) {
|
||||
this.$set(this.btnText, 0, text);
|
||||
},
|
||||
newCodeChange(text) {
|
||||
this.$set(this.btnText, 1, text);
|
||||
},
|
||||
getCode(type) {
|
||||
const refs = type == 0 ? this.$refs.uOldCode : this.$refs.uNewCode;
|
||||
if(refs.canGetCode) {
|
||||
// 模拟向后端请求验证码
|
||||
uni.showLoading({
|
||||
title: '正在获取验证码'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
// 这里此提示会被this.start()方法中的提示覆盖
|
||||
this.$u.toast('验证码已发送');
|
||||
// 通知验证码组件内部开始倒计时
|
||||
refs.start();
|
||||
}, 2000);
|
||||
} else {
|
||||
this.$u.toast('倒计时结束后再发送');
|
||||
}
|
||||
},
|
||||
changeMemberPhone() {
|
||||
this.$u.api.changeMemberPhone({
|
||||
old_mobile: this.oldNumber,
|
||||
old_code: this.oldCode,
|
||||
new_mobile: this.newNumber,
|
||||
new_code: this.newCode,
|
||||
}).then(res => {
|
||||
|
||||
})
|
||||
},
|
||||
end() {
|
||||
this.$u.toast('倒计时结束');
|
||||
},
|
||||
start() {
|
||||
this.$u.toast('倒计时开始');
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -64,15 +134,17 @@ export default {
|
||||
color: rgba(51,51,51,1);
|
||||
}
|
||||
.input {
|
||||
flex: 1;
|
||||
width: 340rpx;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.get-code {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: rgba(153,153,153,1);
|
||||
position: relative;
|
||||
padding: 0 25rpx;
|
||||
margin-left: 20rpx;
|
||||
text-align: center;
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<myText ref="telText" tel="11" style="width:750rem;height:100vh" @onTel="onTel" @click="myTextClick"></myText>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user