123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>修改登录手机号-创业帮</title>
- <meta name="keywords" content="修改登录手机号-创业帮">
- <meta name="description" content="修改登录手机号-创业帮">
- <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <meta content="telephone=no" name="format-detection">
- <meta content="email=no" name="format-detection">
- <meta name="apple-mobile-web-app-title" content="修改登录手机号-创业帮">
- <meta http-equiv="Cache-Control" content="no-siteapp">
- <link rel="stylesheet" href="./static/css/main.css">
- </head>
- <body class="nopb bgcf7f7f7">
- <div id="app">
- <van-nav-bar class="bgcf7f7f7 user_rank_explan_title user_title_normal" left-arrow @click-left="goback" v-if="toptitleisshow">
- <template #left> <img src="./static/images/left.png" alt=""></template>
- </van-nav-bar>
- <div class="regist-box-input pt8 pb32 pl32 pr32">
- <div class="f24 c333 b pb32">修改登录手机号</div>
- <div class="f12 c666 mb6">原手机号</div>
- <van-field class="mb12" v-model="oldphone" disabled @input="checkValue"></van-field>
- <div class="f12 c666 mb6">新手机号</div>
- <van-field class="mb12" v-model="changephone.Mobile" @input="checkValue" placeholder="请输入新手机号"></van-field>
- <div class="f12 c666 mb6">验证码</div>
- <van-field class="user-phone mb12" center clearable placeholder="请输入验证码" v-model="changephone.MobileCode" @input="checkValue">
- <template #button>
- <van-button class="fl" plain color="#FF502A" @click="getmobilecode" v-if="codeisclick">获取验证码</van-button>
- <van-button class="fl" plain color="#FF502A" disabled v-else>{{countdown}}s</van-button>
- </template>
- </van-field>
- <div class="pt16" v-cloak>
- <van-button type="primary" block color="#FF502A" :disabled="canSubmit ? false : true" @click="changephonefn">完成</van-button>
- </div>
- </div>
- </div>
- <script src="./static/js/klm-vv.min.js"></script>
- <script src="./static/js/klm-axios-config.js"></script>
- <script>
- // 通过 CDN 引入时不会自动注册 Lazyload 组件
- // 可以通过下面的方式手动注册
- Vue.use(vant.Lazyload);
-
- // 在 #app 标签下渲染一个按钮组件
- let app = new Vue({
- el: '#app',
- data() {
- return {
- toptitleisshow:false,
- oldphone: '',
- changephone:{
- Id:'',
- Mobile:'',
- MobileCode:''
- },
- canSubmit: false,
- codeisclick:true,
- countdown:60,
- };
- },
- async created() {
- this.toptitleisshow = toptitleisshow;
- this.changephone.Id = PublicLib.getCookieInfo('userId');
- const res = await getRequest('/api/v1/users/personalinfo',JSON.stringify({Id:this.changephone.Id}));
- this.oldphone = res.data.Mobile;
- },
- methods: {
- checkValue(){
- this.canSubmit = (this.oldphone !== '' && this.changephone.Mobile !== '' && this.changephone.MobileCode !== '') ? true : false;
- },
- //- 获取验证码
- async getmobilecode(){
- if(this.oldphone === this.changephone.Mobile) return tips('修改手机号码相同,请重新输入');
- if(verification(this.changephone.Mobile)) return ;
- this.codeisclick = false;
- setTimeout(()=>{
- this.codeisclick = true;
- },60000);
- const timer = setInterval(()=>{
- this.countdown--;
- if(this.countdown === 0) {
- this.countdown = 60;
- clearInterval(timer)
- }
- },1000);
- const res = await postRequest('/api/v1/mobilecodecheck/sendsms',JSON.stringify({Mobile:this.changephone.Mobile}));
- if(res.status !== '1') return tips(res.info);
- tips('验证码发送成功,请注意查收!');
- },
- //- 修改手机号码
- changephonefn:undebounce(async function(){
- if(this.oldphone === this.changephone.Mobile) return tips('修改手机号码相同,请重新输入');
- if(verification(this.changephone.Mobile)) return ;
- const res = await postRequest('/api/v1/users/modifymobile',JSON.stringify(this.changephone));
- if(res.status !== '1') return tips(res.info);
- tips('手机号码修改成功')
- setTimeout(()=>{
- this.goback();
- },2000);
- }),
- goback(){
- PublicLib.GoBack({Level:2});
- }
- }
- });
- </script>
- </body>
- </html>
|