forgot_f.html 6.0 KB
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <script src="../../assets/js/fontsize.js"></script>
    <link rel="stylesheet" href="../../assets/css/weui.min.css">
    <link rel="stylesheet" href="../../assets/css/api.css"/>
    <link rel="stylesheet" href="../../assets/css/login_index.css">
    <link rel="stylesheet" href="../../assets/icon/iconfont.css">
    <style>
        .forgot_box {
            margin: 0.75rem 0.3rem;
        }

        .forgot_input span {
            font-size: 13px;
            color: #424242;
            padding: 0;
        }

        .code_input input {
            text-align: right;
        }

        .code_input span {
            font-size: 13px;
            color: #424242;
            padding: 0;
        }

        .code_input .iconfont {
            color: #ccc;
            font-size: 20px;
        }

        .code_text {
            display: flex;
            align-items: center;
        }

        .code_inputs input {
            width: 1.8rem;
        }

        .code_inputs .span {
            font-size: 13px;
            color: #424242;
            padding: 0;
        }

        .code_inputs input {
            padding-left: 0.2rem;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="forgot_box">
        <div class="login_input code_input"><span>手机号</span><input type="number" placeholder="请输入手机号" v-model="phone">
        </div>
        <div class="login_input code_inputs"><span class="span">验证码</span><input type="text" placeholder="请输入验证码"
                                                                                 v-model="code">
            <span v-if="show" @click="getCode" class="count">获取验证码</span>
            <span v-else class="count">{{count}}秒重新发送</span>
        </div>
        <div class="login_input code_input">
            <span>新密码</span>
            <div class="code_text"><input type="password" placeholder="请输入新密码" v-model="password"><span
                    class="iconfont icon-jianpan"></span></div>
        </div>
        <div class="login_input code_input">
            <span>确认密码</span>
            <div class="code_text"><input type="password" placeholder="请再输入新密码" v-model="rePassword"><span
                    class="iconfont icon-jianpan"></span></div>
        </div>
        <div class="login_btn" @click="keepPass">确认</div>
    </div>
</div>
</body>
</html>

<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
    new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            show: true,
            count: '',
            timer: null,
            phone: '',
            code: '',
            password: '',
            rePassword: ''
        },
        created: function () {
            apiready = function () {

            }
        },
        methods: {
            getCode: function () {
                if (!mobileReg.test(app.phone)) {
                    toastMsg('手机号不正确')
                }
                else {
                    const TIME_COUNT = 60;
                    var post = {
                        tel: app.phone,
                    };
                    var header = {
                        'XX-Device-Type': getDevice()
                    };
                    getRequest('post', '/home/index/sendCode', post, header).then(function (res) {
                        toastMsg(res.data.msg);
                        if (!app.timer) {
                            app.count = TIME_COUNT;
                            app.show = false;
                            app.timer = setInterval(function () {
                                if (app.count > 0 && app.count <= TIME_COUNT) {
                                    app.count--;
                                } else {
                                    app.show = true;
                                    clearInterval(app.timer);
                                    app.timer = null;
                                }
                            }, 1000)
                        }
                    })
                }
            },
            keepPass: function () {
                if (!mobileReg.test(app.phone)) {
                    toastMsg('手机号码不正确')
                } else if (app.code == '') {
                    toastMsg('请输入验证码')
                } else if (app.password == '') {
                    toastMsg('密码不能为空')
                } else if (app.password != app.rePassword) {
                    toastMsg('密码不一致')
                } else {
                    var post = {
                        tel: app.phone,
                        password: app.password,
                        code: app.code
                    };
                    var header = {
                        'XX-Device-Type': getDevice()
                    };
                    getRequest('post', 'home/index/changePassword', post, header).then(function (res) {
                        if (res.data.code == 1) {
                            toastMsg(res.data.msg);
                            api.closeWin();
                        } else {
                            api.closeWin()
                        }
                    })
                }
            }
        }
    })
</script>