|
|
<template>
|
|
|
<view style="background-color: white;padding: 24rpx;">
|
|
|
<u--form labelPosition="left" :model="model1" :rules="rules" ref="uForm">
|
|
|
<u-form-item labelWidth="200rpx" label="原手机号" prop="userInfo.mobile" borderBottom ref="item1">
|
|
|
<u--input v-model="model1.userInfo.mobile" border="none"></u--input>
|
|
|
</u-form-item>
|
|
|
<u-form-item labelWidth="200rpx" label="新手机号" prop="userInfo.mobile" borderBottom ref="item1">
|
|
|
<u--input v-model="model1.userInfo.newmobile" border="none"></u--input>
|
|
|
</u-form-item>
|
|
|
<u-form-item labelWidth="200rpx" label="验证码" prop="userInfo.mobile" borderBottom ref="item1">
|
|
|
<view class="" style="display: flex; align-items: center; justify-content: space-between;">
|
|
|
<u--input v-model="model1.userInfo.code" placeholder="" style="width: 70vw;"></u--input>
|
|
|
<u-button text="获取验证码" @click="code" style="width: 20vw;">></u-button>
|
|
|
<view class="codestyle">
|
|
|
<view class="bar mot">
|
|
|
<view class="barleft">
|
|
|
原手机号
|
|
|
</view>
|
|
|
<view class="barright">
|
|
|
<input type="number" disabled v-model="model1.userInfo.mobile">
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="bar mot bot">
|
|
|
<view class="barleft">
|
|
|
新手机号
|
|
|
</view>
|
|
|
<view class="barright">
|
|
|
<input type="number" v-model="model1.userInfo.newmobile" placeholder="请输入新手机号"
|
|
|
placeholder-style="font-size: 28rpx; font-weight: 400;">
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="bar">
|
|
|
<view class="barleft">
|
|
|
验证码
|
|
|
</view>
|
|
|
<view class="barright codeinput">
|
|
|
<input type="text" v-model="model1.userInfo.code" placeholder="请输入验证码"
|
|
|
placeholder-style="font-size: 28rpx; font-weight: 400;">
|
|
|
<view class="scode" @click="code" v-if="iscode">
|
|
|
获取验证码
|
|
|
</view>
|
|
|
<view class="scode" @click="code" v-else>
|
|
|
{{newcode}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="barbtn">
|
|
|
保存
|
|
|
</view>
|
|
|
<!-- <view style="background-color: white;padding: 24rpx;">
|
|
|
<u--form labelPosition="left" :model="model1" :rules="rules" ref="uForm">
|
|
|
<u-form-item labelWidth="200rpx" label="原手机号" prop="userInfo.mobile" borderBottom ref="item1">
|
|
|
<u--input v-model="model1.userInfo.mobile" border="none"></u--input>
|
|
|
</u-form-item>
|
|
|
<u-form-item labelWidth="200rpx" label="新手机号" prop="userInfo.mobile" borderBottom ref="item1">
|
|
|
<u--input v-model="model1.userInfo.newmobile" border="none"></u--input>
|
|
|
</u-form-item>
|
|
|
<u-form-item labelWidth="200rpx" label="验证码" prop="userInfo.mobile" borderBottom ref="item1">
|
|
|
<view class="" style="display: flex; align-items: center; justify-content: space-between;">
|
|
|
<u--input v-model="model1.userInfo.code" placeholder="" style="width: 70vw;"></u--input>
|
|
|
<u-button text="获取验证码" @click="code" style="width: 20vw;">></u-button>
|
|
|
</view>
|
|
|
|
|
|
</u-form-item>
|
|
|
</u--form>
|
|
|
|
|
|
<view class="" style="margin-top: 60rpx;">
|
|
|
<u-button text="保存" type="primary" @click="submit"></u-button>
|
|
|
</u-form-item>
|
|
|
</u--form>
|
|
|
<view class="" style="margin-top: 60rpx;">
|
|
|
<u-button text="保存" type="primary" @click="submit"></u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
-->
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
...
|
...
|
@@ -34,6 +73,9 @@ |
|
|
}
|
|
|
},
|
|
|
tips: '获取验证码',
|
|
|
interval: "",
|
|
|
newcode: 60,
|
|
|
iscode: true,
|
|
|
rules: {
|
|
|
'userInfo.mobile': [{
|
|
|
type: 'string',
|
...
|
...
|
@@ -56,6 +98,9 @@ |
|
|
},
|
|
|
}
|
|
|
},
|
|
|
onUnload() {
|
|
|
clearInterval(this.interval)
|
|
|
},
|
|
|
methods: {
|
|
|
submit() {
|
|
|
let p = {
|
...
|
...
|
@@ -74,11 +119,16 @@ |
|
|
})
|
|
|
}, 1500)
|
|
|
}
|
|
|
|
|
|
|
|
|
})
|
|
|
},
|
|
|
code() {
|
|
|
if (!this.model1.userInfo.newmobile) {
|
|
|
uni.showToast({
|
|
|
title: "请输入手机号",
|
|
|
icon: "none"
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
uni.showLoading({
|
|
|
title: '正在获取验证码'
|
|
|
})
|
...
|
...
|
@@ -87,38 +137,23 @@ |
|
|
event: 'changemobile'
|
|
|
}).then(res => {
|
|
|
console.log(res);
|
|
|
if (res.code == 1) {
|
|
|
this.iscode = false
|
|
|
this.interval = setInterval(() => {
|
|
|
this.newcode--
|
|
|
if (this.newcode == 0) {
|
|
|
this.iscode = true
|
|
|
clearInterval(this.interval)
|
|
|
}
|
|
|
}, 1000)
|
|
|
}
|
|
|
uni.hideLoading()
|
|
|
uni.showToast({
|
|
|
title: res.msg
|
|
|
})
|
|
|
|
|
|
})
|
|
|
},
|
|
|
codeChange(text) {
|
|
|
this.tips = text;
|
|
|
},
|
|
|
getCode() {
|
|
|
if (this.$refs.uCode.canGetCode) {
|
|
|
// 模拟向后端请求验证码
|
|
|
uni.showLoading({
|
|
|
title: '正在获取验证码'
|
|
|
})
|
|
|
uni.$u.http.post('/api/sms/send', {
|
|
|
mobile: this.model1.userInfo.newmobile,
|
|
|
event: 'changemobile'
|
|
|
}).then(res => {
|
|
|
console.log(res);
|
|
|
})
|
|
|
// setTimeout(() => {
|
|
|
// uni.hideLoading();
|
|
|
// // 这里此提示会被this.start()方法中的提示覆盖
|
|
|
// uni.$u.toast('验证码已发送');
|
|
|
// // 通知验证码组件内部开始倒计时
|
|
|
// this.$refs.uCode.start();
|
|
|
// }, 2000);
|
|
|
} else {
|
|
|
uni.$u.toast('倒计时结束后再发送');
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
this.model1.userInfo.mobile = option.mobile
|
...
|
...
|
@@ -131,6 +166,84 @@ |
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
<style lang="scss">
|
|
|
.page {
|
|
|
background-color: #F5F7FA;
|
|
|
}
|
|
|
|
|
|
.codestyle {
|
|
|
.bar {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
padding: 48rpx 24rpx;
|
|
|
box-sizing: border-box;
|
|
|
background-color: #ffffff;
|
|
|
|
|
|
.barleft {
|
|
|
width: 188rpx;
|
|
|
color: #0d1013e6;
|
|
|
font-size: 28rpx;
|
|
|
font-weight: 400;
|
|
|
font-family: "PingFang SC";
|
|
|
text-align: left;
|
|
|
}
|
|
|
|
|
|
.barright {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
color: #0d1013e6;
|
|
|
font-size: 28rpx;
|
|
|
font-weight: 500;
|
|
|
position: relative;
|
|
|
right: 0;
|
|
|
|
|
|
.scode {
|
|
|
position: absolute;
|
|
|
right: 32rpx;
|
|
|
top: -8rpx;
|
|
|
z-index: 99;
|
|
|
width: 144rpx;
|
|
|
height: 56rpx;
|
|
|
line-height: 56rpx;
|
|
|
color: #3375d8ff;
|
|
|
font-size: 24rpx;
|
|
|
font-weight: 500;
|
|
|
font-family: "PingFang SC";
|
|
|
text-align: center;
|
|
|
border-radius: 8rpx;
|
|
|
opacity: 1;
|
|
|
background: #ecf2feff;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.codeinput {
|
|
|
input {
|
|
|
width: 460rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.bot {
|
|
|
border-bottom: 1px solid #F5F7FA;
|
|
|
}
|
|
|
|
|
|
.mot {
|
|
|
margin-top: 16rpx;
|
|
|
}
|
|
|
|
|
|
.barbtn {
|
|
|
color: #ffffffff;
|
|
|
font-size: 32rpx;
|
|
|
font-weight: 500;
|
|
|
font-family: "PingFang SC";
|
|
|
text-align: center;
|
|
|
width: 702rpx;
|
|
|
height: 88rpx;
|
|
|
line-height: 88rpx;
|
|
|
border-radius: 16rpx;
|
|
|
opacity: 1;
|
|
|
background: #3375d8ff;
|
|
|
margin: 40rpx auto 0 auto;
|
|
|
}
|
|
|
}
|
|
|
</style> |
|
|
\ No newline at end of file |
...
|
...
|
|