gpt-4o-mini-2024-07-18· OpenAI WildChat-4.8M (AI2)
根据下面 [code] 忘记密码功能:…
- User
根据下面```标记的功能描述,编写一个html网页,利用bootstrap进行样式美化。
功能描述:
忘记密码功能: 支持用户通过多种渠道找回个人密码。用户可以选择使用手机号码、电子邮箱或钉钉账号进行密码重置。具体流程包括:用户输入注册时使用的手机号码或邮箱地址,系统发送验证码以验证身份;用户在输入正确验证码后,可以设置新的密码;对于钉钉找回密码,系统将通过钉钉应用发送密码重置链接,用户点击后可直接进入重设密码页面。此功能确保用户在忘记密码时能够方便快捷地恢复账户访问权限。 - Assistant
下面是一个实现了您所描述的“忘记密码”功能的HTML网页示例,使用Bootstrap进行样式美化。确保在使用此代码时,您已包含Bootstrap CSS和JS文件的引用。
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>忘记密码</title> <!-- 引入Bootstrap CSS --> <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"> <style> body { background-color: #f8f9fa; } .container { max-width: 500px; margin-top: 100px; padding: 20px; background-color: white; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } .btn-custom { background-color: #007bff; color: white; } </style> </head> <body> <div class="container"> <h2 class="text-center">忘记密码</h2> <p class="text-center">请选择找回密码的方式</p> <form> <div class="form-group"> <label for="inputOption">找回方式</label> <select class="form-control" id="inputOption" required> <option value="" disabled selected>请选择</option> <option value="phone">手机号码</option> <option value="email">电子邮箱</option> <option value="dingtalk">钉钉账号</option> </select> </div> <div class="form-group"> <label for="inputContact">请输入您的手机号码或邮箱地址</label> <input type="text" class="form-control" id="inputContact" placeholder="手机号码或邮箱地址" required> </div> <div class="form-group" id="verificationCodeDiv" style="display: none;"> <label for="inputVerificationCode">输入验证码</label> <input type="text" class="form-control" id="inputVerificationCode" placeholder="验证码" required> <small class="form-text text-muted">验证码已发送至您的手机或邮箱。</small> </div> <button type="button" class="btn btn-custom btn-block" id="sendVerificationButton">发送验证码</button> <div class="form-group" id="newPasswordDiv" style="display: none;"> <label for="inputNewPassword">设置新密码</label> <input type="password" class="form-control" id="inputNewPassword" placeholder="新密码" required> </div> <button type="submit" class="btn btn-custom btn-block" id="resetPasswordButton" style="display: none;">重置密码</button> </form> </div> <!-- 引入jQuery和Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.bundle.min.js"></script> <script> $(document).ready(function(){ $('#inputOption').change(function(){ $('#verificationCodeDiv').hide(); $('#newPasswordDiv').hide(); $('#resetPasswordButton').hide(); if ($(this).val() === 'phone' || $(this).val() === 'email') { $('#verificationCodeDiv').show(); $('#sendVerificationButton').show(); } else if ($(this).val() === 'dingtalk') { // 假设直接进入重置密码的页面 alert('钉钉找回密码链接已发送到您的钉钉,请查收。'); } }); $('#sendVerificationButton').click(function(){ $('#newPasswordDiv').show(); $('#resetPasswordButton').show(); }); }); </script> </body> </html>代码说明:
-
HTML结构:
- 使用了Bootstrap的布局和表单组件,使得网页美观且易于使用。
- 提供了选择找回密码方式(手机号码、电子邮箱、钉钉账号)的下拉菜单。
- 根据用户选择,动态显示输入验证码和设置新密码的字段。
-
样式:
- 通过自定义CSS样式设置了背景颜色和容器样式(如阴影和边角圆度)。
-
JavaScript:
- 使用jQuery来处理用户输入和动态显示不同输入字段。
- 当用户选择钉钉账号时,给出提示消息。
您可以根据实际需求进一步调整和扩展此代码。
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.