美文网首页Django-mxonline实战
强力Django第六章7-8用户注册

强力Django第六章7-8用户注册

作者: L_luky | 来源:发表于2018-04-26 17:11 被阅读0次

    1配置修改
    1.1在templates下创建register.html(其中的CSS和JS路径已修改好了)

    <!DOCTYPE html>
    <html>
    {% load staticfiles %}
    <head>
        <meta charset="UTF-8">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
        <title>慕学在线注册</title>
        <link rel="stylesheet" type="text/css" href="{% static 'css/reset.css' %}">
        <link rel="stylesheet" type="text/css" href="{% static 'css/login.css' %}">
    
    </head>
    <body>
    <div class="loginbox dialogbox">
        <h1>账号登录</h1>
        <div class="close jsCloseDialog"><img src="../images/dig_close.png"/></div>
        <div class="cont">
            <form id="jsLoginForm" autocomplete="off">
                <div class="box">
                    <span class="word3">用户名</span>
                    <input type="text" name="account_l" id="account_l" placeholder="手机号/邮箱" />
                </div>
                <div class="box">
                    <span class="word2">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</span>
                    <input type="password" name="password_l" id="password_l" placeholder="请输入您的密码"/>
                </div>
                <div class="error btns login-form-tips" id="jsLoginTips"></div> <!--登录错误提示-->
                <div class="btns">
                    <span><input type="checkbox" id="jsAutoLogin" />&nbsp;自动登录</span>
                    <span class="forget btn fr">忘记密码</span>
                </div>
                <div class="button">
                    <input type="button" value="登录" id="jsLoginBtn" />
                </div>
                <div class="btns">
                    <span class="fr">没有账号?<span class="regist btn">立即注册</span></span>
                </div>
            </form>
        </div>
    </div>
    <div class="dialog" id="jsDialog">
        <!--提示弹出框-->
        <div class="successbox dialogbox" id="jsSuccessTips">
            <h1>成功提交</h1>
            <div class="close jsCloseDialog"><img src="../images/dig_close.png"/></div>
            <div class="cont">
                <h2>您的需求提交成功!</h2>
                <p></p>
            </div>
        </div>
        <div  class="noactivebox dialogbox" id="jsUnactiveForm" >
            <h1>邮件验证提示</h1>
            <div class="close jsCloseDialog"><img src="../images/dig_close.png"/></div>
            <div class="center">
                <img src="../images/send.png"/>
                <p>我们已经向您的邮箱<span class="green" id="jsEmailToActive">12@13.com</span>发送了邮件,<br/>为保证您的账号安全,请及时验证邮箱</p>
                <p class="a"><a class="btn" id="jsGoToEmail" target="_blank" href="http://mail.qq.com">去邮箱验证</a></p>
                <p class="zy_success upmove"></p>
                <p style="display: none;" class="sendE2">没收到,您可以查看您的垃圾邮件和被过滤邮件,也可以再次发送验证邮件(<span class="c5c">60s</span>)</p>
                <p class="sendE">没收到,您可以查看您的垃圾邮件和被过滤邮件,<br/>也可以<span class="c5c green" id="jsSenEmailAgin" style="cursor: pointer;">再次发送验证邮件</span></p>
            </div>
        </div>
    </div>
    
    <div class="bg" id="dialogBg"></div>
    <header>
        <div class="c-box fff-box">
            <div class="wp header-box">
                <p class="fl hd-tips">慕学在线,在线学习平台!</p>
                <ul class="fr hd-bar">
                    <li>服务电话:<span>4001008031</span></li>
                    <li><a href="/login/">[登录]</a></li>
                    <li class="active"><a href="/register/">[注册]</a></li>
                </ul>
            </div>
        </div>
    </header>
    <section>
        <div class="c-box bg-box">
            <div class="login-box clearfix">
                <div class="hd-login clearfix">
                    <a class="index-logo" href="/"></a>
                    <h1>用户注册</h1>
                    <a class="index-font" href="{% url 'index' %}">回到首页</a>
                </div>
                <div class="fl slide">
                    <div class="imgslide">
                        <ul class="imgs">
    
                            <li><a href=""><img width="483" height="472" src="../images/57a801860001c34b12000460.jpg" /></a></li>
    
                            <li><a href=""><img width="483" height="472" src="../images/57a801860001c34b12000460.jpg" /></a></li>
    
                            <li><a href=""><img width="483" height="472" src="../images/57a801860001c34b12000460.jpg" /></a></li>
    
                        </ul>
                    </div>
                    <div class="unslider-arrow prev"></div>
                    <div class="unslider-arrow next"></div>
                </div>
                <div class="fl form-box">
                    <div class="tab">
    {#                    <h2 class="active">手机注册</h2>#}
                        <h2>邮箱注册</h2>
                    </div>
    {#                <div class="tab-form">#}
    {#                    <form id="mobile_register_form" autocomplete="off">#}
    {#                        <input type='hidden' name='csrfmiddlewaretoken' value='gTZljXgnpvxn0fKZ1XkWrM1PrCGSjiCZ' />#}
    {#                        <div class="form-group marb20">#}
    {#                            <label>手&nbsp;机&nbsp;号</label>#}
    {#                            <input id="jsRegMobile" name="account" type="text" placeholder="请输入您的手机号码" />#}
    {#                        </div>-->#}
    {#                        <div class="form-group marb20" id="jsRefreshCode">#}
    {#                            <label>验&nbsp;证&nbsp;码</label>#}
    {#                            <input autocomplete="off" class="form-control-captcha mobile-register-captcha" id="mobile-register-captcha_1" name="captcha_m_1" placeholder="请输入验证码" type="text" /> <input class="form-control-captcha mobile-register-captcha" id="mobile-register-captcha_0" name="captcha_m_0" placeholder="请输入验证码" type="hidden" value="29953bacf7005e8469388b449d97d00d523c1706" /> &nbsp;<img src="/captcha/image/29953bacf7005e8469388b449d97d00d523c1706/" alt="captcha" class="captcha" />#}
    {#                        </div>#}
    {#                        <div class="clearfix">#}
    {#                            <div class="form-group marb8 verify-code">#}
    {#                                <label>短信验证码</label>#}
    {#                                <input id="jsPhoneRegCaptcha" name="mobile_code" type="text" placeholder="输入手机验证码" />#}
    {#                            </div>#}
    {#                            <input class="verify-code-btn sendcode" id="jsSendCode" value="发送验证码">#}
    {#                        </div>#}
    {#                        <div class="form-group marb8">#}
    {#                            <label>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</label>#}
    {#                            <input id="jsPhoneRegPwd" name="password_m" type="password" placeholder="请输入6-20位非中文字符密码" />#}
    {#                        </div>#}
    {#                        <div class="error btns" id="jsMobileTips"></div>#}
    {#                        <div class="auto-box marb8">#}
    {##}
    {#                        </div>#}
    {#                        <input class="btn btn-green" id="jsMobileRegBtn" type="button" value="注册并登录" />#}
    {#                    </form>#}
    {#                    {% csrf_token %}#}
    {#                </div>#}
                    <div class="tab-form">
                        <form id="email_register_form"  autocomplete="off">
                            <input type='hidden' name='csrfmiddlewaretoken' value='gTZljXgnpvxn0fKZ1XkWrM1PrCGSjiCZ' />
                            <div class="form-group marb20">
                                <label>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱</label>
                                <input  type="text" id="id_email" name="email"  placeholder="请输入您的邮箱地址" />
                            </div>
                            <div class="form-group marb8">
                                <label>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</label>
                                <input type="password" id="id_password" name="password"  placeholder="请输入6-20位非中文字符密码" />
                            </div>
                            <div class="form-group marb8 captcha1">
                                <label>验&nbsp;证&nbsp;码</label>
                            </div>
                            <div class="error btns" id="jsEmailTips"></div>
                            <div class="auto-box marb8">
                            </div>
                            <input class="btn btn-green" id="jsEmailRegBtn" type="button" value="注册并登录" />
                        {% csrf_token %}
                        </form>
                    </div>
                    <p class="form-p">已有账号?<a href="login.html">[立即登录]</a></p>
                </div>
            </div>
        </div>
    </section>
    
    <input id="isLogin" type="hidden" value="False"/>
    <script src="{% static 'js/jquery.min.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/unslider.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/validateDialog.js' %}"  type="text/javascript"></script>
    <script src="{% static 'js/login.js' %}"  type="text/javascript"></script>
    </body>
    </html>
    

    1.2 修改index.html 的注册部分,设置首页中的注册页面跳转

                           <a style="color:white" class="fr registerbtn" href="{% url 'resgister' %}">注册</a>
    

    1.3修改views.py 增加新视图ResgisterView

    class ResgisterView(View):
        def get(self, request):
            return render(request, "register.html", {})
    

    1.4修改urls.py

    from django.conf.urls import url
    # from django.contrib import admin
    from django.views.generic import TemplateView
    import xadmin
    
    from users.views import LoginView, ResgisterView
    
    urlpatterns = [
        url(r'^xadmin/', xadmin.site.urls),
        url('^$', TemplateView.as_view(template_name="index.html"), name="index"),
        url('^login/$', LoginView.as_view(), name="login"),
        url('^register/$', ResgisterView.as_view(), name="resgister"),
    ]
    

    重启服务,点击首页右上角注册,进出注册页面


    image.png

    2.增加验证码功能

    2.1 查看第三方模块的安装文档
    https://github.com/mbi/django-simple-captcha

    2.2 安装django-simple-captcha 版本号0.4.6

    pip install django-simple-captcha==0.4.6
    

    2.3 修改setting.py的INSTALLED_APPS部分

    INSTALLED_APPS = (
        'django.contrib.admin',
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.messages',
        'django.contrib.staticfiles',
        'users',
        'courses',
        'organization',
        'operation',
        'xadmin',
        'crispy_forms',
        'captcha',
    
    )
    

    2.4 修改urls.py

    from django.conf.urls import url, include
    # from django.contrib import admin
    from django.views.generic import TemplateView
    import xadmin
    
    from users.views import LoginView, ResgisterView
    
    urlpatterns = [
        url(r'^xadmin/', xadmin.site.urls),
        url('^$', TemplateView.as_view(template_name="index.html"), name="index"),
        url('^login/$', LoginView.as_view(), name="login"),
        url('^register/$', ResgisterView.as_view(), name="resgister"),
        url(r'^captcha/', include('captcha.urls')),
    ]
    

    2.5 pycharm 启动Run manage.py task,然后先后执行下面的命令

    makemigrations
    
    migrate
    

    执行成功后会在数据库生成表captcha_captchastore

    2.6 增加forms验证,更新forms.py,新增类 RegisterForm

    # _*_ encoding:utf-8 _*_
    __author__ = 'luky'
    __date__ = '2018/4/23 10:44'
    
    from django import forms
    from captcha.fields import CaptchaField
    
    
    class LoginForm(forms.Form):
        username = forms.CharField(required=True)
        password = forms.CharField(required=True, min_length=5) #设置必填,最小长度5,不符合不去查数据库。
    
    
    class RegisterForm(forms.Form):
        enmail = forms.EmailField(required=True)
        password = forms.CharField(required=True, min_length=5)
        captcha = CaptchaField(error_messages={"invalid":u"验证码错误"})
    

    2.7更新views.py 加入form/post

    # _*_ encoding:utf-8 _*_
    __author__ = 'luky'
    __date__ = '2018/4/12 15:46'
    
    from django.shortcuts import render
    from django.contrib.auth import authenticate, login
    
    #1自定义登陆的字段,用户名或者email都行
    from django.contrib.auth.backends import ModelBackend
    from django.db.models import Q
    
    from django.views.generic.base import View
    # 密码明文加密函数
    from django.contrib.auth.hashers import make_password
    
    # Create your views here.
    from .models import UserProfile
    from.forms import LoginForm, RegisterForm
    
    
    class CustomBackend(ModelBackend):
        def authenticate(self, username=None, password=None, **kwargs):
            try:
                user = UserProfile.objects.get(Q(username=username)|Q(email=username))
                if user.check_password(password):
                    return user
            except Exception as e:
                return None
    
    
    class ResgisterView(View):
        def get(self, request):
            register_form = RegisterForm()
            return render(request, "register.html", {'register_form':register_form})
    
        def post(self, request):
            register_form = RegisterForm(request.POST)
            if register_form.is_valid():
                user_name = request.POST.get("username", "")
                pass_word = request.POST.get("password", "")
                user_profile = UserProfile()
                user_profile.username = user_name
                user_profile.email = user_name
                user_profile.password = make_password(pass_word)
                user_profile.save()
    
    
    
    class LoginView(View):
        def get(self, request):
            return render(request, "login.html", {})
    
        def post(self, request):
            # 增加form组件对用户提交的表单进行预处理,验证参数是否正确
            login_form = LoginForm(request.POST)
            if login_form.is_valid():
                user_name = request.POST.get("username", "")
                pass_word = request.POST.get("password", "")
                user = authenticate(username=user_name, password=pass_word)
                if user is not None:
                    login(request, user)
                    return render(request, "index.html")
                else:
                    # 2{"msg":"用户名密码输入错误!"}定义数据库查询后验证的报错输。在login.html代码中加入
                    return render(request, "login.html", {"msg": "用户名密码输入错误!"})
            else:
                #3{"login_form":login_form}定义form验证报错输。在login.html代码中加入
                return render(request, "login.html", {"login_form":login_form})
    
    

    2.8 更新 register.html, 在后半段加入 {{ register_form.captcha }}和method="post" action="{% url 'resgister' %}"部分

    <!DOCTYPE html>
    <html>
    {% load staticfiles %}
    <head>
        <meta charset="UTF-8">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
        <title>慕学在线注册</title>
        <link rel="stylesheet" type="text/css" href="{% static 'css/reset.css' %}">
        <link rel="stylesheet" type="text/css" href="{% static 'css/login.css' %}">
    
    </head>
    <body>
    <div class="loginbox dialogbox">
        <h1>账号登录</h1>
        <div class="close jsCloseDialog"><img src="../images/dig_close.png"/></div>
        <div class="cont">
            <form id="jsLoginForm" autocomplete="off">
                <div class="box">
                    <span class="word3">用户名</span>
                    <input type="text" name="account_l" id="account_l" placeholder="手机号/邮箱" />
                </div>
                <div class="box">
                    <span class="word2">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</span>
                    <input type="password" name="password_l" id="password_l" placeholder="请输入您的密码"/>
                </div>
                <div class="error btns login-form-tips" id="jsLoginTips"></div> <!--登录错误提示-->
                <div class="btns">
                    <span><input type="checkbox" id="jsAutoLogin" />&nbsp;自动登录</span>
                    <span class="forget btn fr">忘记密码</span>
                </div>
                <div class="button">
                    <input type="button" value="登录" id="jsLoginBtn" />
                </div>
                <div class="btns">
                    <span class="fr">没有账号?<span class="regist btn">立即注册</span></span>
                </div>
            </form>
        </div>
    </div>
    <div class="dialog" id="jsDialog">
        <!--提示弹出框-->
        <div class="successbox dialogbox" id="jsSuccessTips">
            <h1>成功提交</h1>
            <div class="close jsCloseDialog"><img src="../images/dig_close.png"/></div>
            <div class="cont">
                <h2>您的需求提交成功!</h2>
                <p></p>
            </div>
        </div>
        <div  class="noactivebox dialogbox" id="jsUnactiveForm" >
            <h1>邮件验证提示</h1>
            <div class="close jsCloseDialog"><img src="../images/dig_close.png"/></div>
            <div class="center">
                <img src="../images/send.png"/>
                <p>我们已经向您的邮箱<span class="green" id="jsEmailToActive">12@13.com</span>发送了邮件,<br/>为保证您的账号安全,请及时验证邮箱</p>
                <p class="a"><a class="btn" id="jsGoToEmail" target="_blank" href="http://mail.qq.com">去邮箱验证</a></p>
                <p class="zy_success upmove"></p>
                <p style="display: none;" class="sendE2">没收到,您可以查看您的垃圾邮件和被过滤邮件,也可以再次发送验证邮件(<span class="c5c">60s</span>)</p>
                <p class="sendE">没收到,您可以查看您的垃圾邮件和被过滤邮件,<br/>也可以<span class="c5c green" id="jsSenEmailAgin" style="cursor: pointer;">再次发送验证邮件</span></p>
            </div>
        </div>
    </div>
    
    <div class="bg" id="dialogBg"></div>
    <header>
        <div class="c-box fff-box">
            <div class="wp header-box">
                <p class="fl hd-tips">慕学在线,在线学习平台!</p>
                <ul class="fr hd-bar">
                    <li>服务电话:<span>4001008031</span></li>
                    <li><a href="/login/">[登录]</a></li>
                    <li class="active"><a href="/register/">[注册]</a></li>
                </ul>
            </div>
        </div>
    </header>
    <section>
        <div class="c-box bg-box">
            <div class="login-box clearfix">
                <div class="hd-login clearfix">
                    <a class="index-logo" href="/"></a>
                    <h1>用户注册</h1>
                    <a class="index-font" href="{% url 'index' %}">回到首页</a>
                </div>
                <div class="fl slide">
                    <div class="imgslide">
                        <ul class="imgs">
    
                            <li><a href=""><img width="483" height="472" src="../images/57a801860001c34b12000460.jpg" /></a></li>
    
                            <li><a href=""><img width="483" height="472" src="../images/57a801860001c34b12000460.jpg" /></a></li>
    
                            <li><a href=""><img width="483" height="472" src="../images/57a801860001c34b12000460.jpg" /></a></li>
    
                        </ul>
                    </div>
                    <div class="unslider-arrow prev"></div>
                    <div class="unslider-arrow next"></div>
                </div>
                <div class="fl form-box">
                    <div class="tab">
    {#                    <h2 class="active">手机注册</h2>#}
                        <h2>邮箱注册</h2>
                    </div>
    {#                <div class="tab-form">#}
    {#                    <form id="mobile_register_form" autocomplete="off">#}
    {#                        <input type='hidden' name='csrfmiddlewaretoken' value='gTZljXgnpvxn0fKZ1XkWrM1PrCGSjiCZ' />#}
    {#                        <div class="form-group marb20">#}
    {#                            <label>手&nbsp;机&nbsp;号</label>#}
    {#                            <input id="jsRegMobile" name="account" type="text" placeholder="请输入您的手机号码" />#}
    {#                        </div>-->#}
    {#                        <div class="form-group marb20" id="jsRefreshCode">#}
    {#                            <label>验&nbsp;证&nbsp;码</label>#}
    {#                            <input autocomplete="off" class="form-control-captcha mobile-register-captcha" id="mobile-register-captcha_1" name="captcha_m_1" placeholder="请输入验证码" type="text" /> <input class="form-control-captcha mobile-register-captcha" id="mobile-register-captcha_0" name="captcha_m_0" placeholder="请输入验证码" type="hidden" value="29953bacf7005e8469388b449d97d00d523c1706" /> &nbsp;<img src="/captcha/image/29953bacf7005e8469388b449d97d00d523c1706/" alt="captcha" class="captcha" />#}
    {#                        </div>#}
    {#                        <div class="clearfix">#}
    {#                            <div class="form-group marb8 verify-code">#}
    {#                                <label>短信验证码</label>#}
    {#                                <input id="jsPhoneRegCaptcha" name="mobile_code" type="text" placeholder="输入手机验证码" />#}
    {#                            </div>#}
    {#                            <input class="verify-code-btn sendcode" id="jsSendCode" value="发送验证码">#}
    {#                        </div>#}
    {#                        <div class="form-group marb8">#}
    {#                            <label>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</label>#}
    {#                            <input id="jsPhoneRegPwd" name="password_m" type="password" placeholder="请输入6-20位非中文字符密码" />#}
    {#                        </div>#}
    {#                        <div class="error btns" id="jsMobileTips"></div>#}
    {#                        <div class="auto-box marb8">#}
    {##}
    {#                        </div>#}
    {#                        <input class="btn btn-green" id="jsMobileRegBtn" type="button" value="注册并登录" />#}
    {#                    </form>#}
    {#                    {% csrf_token %}#}
    {#                </div>#}
                    <div class="tab-form">
                        <form id="email_register_form" method="post" action="{% url 'resgister' %}" autocomplete="off">
                            <input type='hidden' name='csrfmiddlewaretoken' value='gTZljXgnpvxn0fKZ1XkWrM1PrCGSjiCZ' />
                            <div class="form-group marb20">
                                <label>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱</label>
                                <input  type="text" id="id_email" name="email"  placeholder="请输入您的邮箱地址" />
                            </div>
                            <div class="form-group marb8">
                                <label>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</label>
                                <input type="password" id="id_password" name="password"  placeholder="请输入6-20位非中文字符密码" />
                            </div>
                            <div class="form-group marb8 captcha1">
                                <label>验&nbsp;证&nbsp;码</label>
                                {{ register_form.captcha }}
                            </div>
                            <div class="error btns" id="jsEmailTips"></div>
                            <div class="auto-box marb8">
                            </div>
                            <input class="btn btn-green" id="jsEmailRegBtn" type="submit" value="注册并登录" />
                        {% csrf_token %}
                        </form>
                    </div>
                    <p class="form-p">已有账号?<a href="login.html">[立即登录]</a></p>
                </div>
            </div>
        </div>
    </section>
    
    <input id="isLogin" type="hidden" value="False"/>
    <script src="{% static 'js/jquery.min.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/unslider.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/validateDialog.js' %}"  type="text/javascript"></script>
    <script src="{% static 'js/login.js' %}"  type="text/javascript"></script>
    </body>
    </html>
    

    配上此时完整的index.html

    <!DOCTYPE html>
    <html>
    
    <head>
        <meta charset="UTF-8">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
        <title>课程机构列表 - 慕学在线网</title>
        <link rel="stylesheet" type="text/css" href="/static/css/reset.css">
        <link rel="stylesheet" type="text/css" href="/static/css/animate.css">
        <link rel="stylesheet" type="text/css" href="/static/css/style.css">
    
        <script src="/static/js/jquery.min.js" type="text/javascript"></script>
        <script src="/static/js/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
    
    </head>
    <body>
    <section class="headerwrap ">
        <header>
            <div  class=" header">
                {% if request.user.is_authenticated %}
                    <div class="top">
                        <div class="wp">
                            <div class="fl"><p>服务电话:<b>888888</b></p></div>
                            <!--登陆后跳转-->
                            <div class="personal">
                                <dl class="user fr">
                                    <dd>luky<img class="down fr" src="/static/images/top_down.png"/></dd>
                                    <dt><img width="20" height="20" src="/static/media/image/2016/12/default_big_14.png"/></dt>
                                </dl>
                                <div class="userdetail">
                                    <dl>
                                        <dt><img width="80" height="80" src="/static/media/image/2016/12/default_big_14.png"/></dt>
                                        <dd>
                                            <h2>django</h2>
                                            <p>bobby</p>
                                        </dd>
                                    </dl>
                                    <div class="btn">
                                        <a class="personcenter fl" href="usercenter-info.html">进入个人中心</a>
                                        <a class="fr" href="/logout/">退出</a>
                                    </div>
                                </div>
                            </div>
    
    
                    </div>
                </div>
                    {% else %}
                    <div class="top">
                    <div class="wp">
                        <div class="fl">
                            <p>服务电话:<b>888888</b></p>
                        </div>
                            <a style="color:white" class="fr registerbtn" href="{% url 'resgister' %}">注册</a>
                            <a style="color:white" class="fr loginbtn" href="{% url 'login' %}">登录</a>
                    </div>
                 </div>
                {% endif %}
    
                <div class="middle">
                    <div class="wp">
                        <a href="index.html"><img class="fl" src="/static/images/logo.jpg"/></a>
                        <div class="searchbox fr">
                            <div class="selectContainer fl">
                                <span class="selectOption" id="jsSelectOption" data-value="course">
                                    公开课
                                </span>
                                <ul class="selectMenu" id="jsSelectMenu">
                                    <li data-value="course">公开课</li>
                                    <li data-value="org">课程机构</li>
                                    <li data-value="teacher">授课老师</li>
                                </ul>
                            </div>
                            <input id="search_keywords" class="fl" type="text" value="" placeholder="请输入搜索内容"/>
                            <img class="search_btn fr" id="jsSearchBtn" src="/static/images/search_btn.png"/>
                        </div>
                    </div>
                </div>
    
    
                <nav>
                    <div class="nav">
                        <div class="wp">
                            <ul>
                                <li class="active" ><a href="index.html">首页</a></li>
                                <li >
                                    <a href="course-list.html">
                                        公开课<img class="hot" src="/static/images/nav_hot.png">
                                    </a>
                                </li>
                                <li >
                                    <a href="teachers-list.html">授课教师</a>
                                </li>
                                <li ><a href="org-list.html">授课机构</a></li>
                            </ul>
                        </div>
                    </div>
                </nav>
    
                </div>
        </header>
    </section>
    <!--crumbs start-->
    
    
    
        <div class="banner">
                <div class="wp">
                    <div class="fl">
                        <div class="imgslide">
                            <ul class="imgs">
    
                                <li>
                                        <a href="http://www.imooc.com">
                                            <img width="1200" height="478" src="/static/media/banner/2016/11/57a801860001c34b12000460.jpg" />
                                        </a>
                                    </li>
    
                                <li>
                                        <a href="http://www.projectsedu.com">
                                            <img width="1200" height="478" src="/static/media/banner/2016/11/57aa86a0000145c512000460.jpg" />
                                        </a>
                                    </li>
    
                                <li>
                                        <a href="http://www.projectsedu.com">
                                            <img width="1200" height="478" src="/static/media/banner/2016/11/57a801860001c34b12000460_z4Vb8zl.jpg" />
                                        </a>
                                    </li>
    
                                <li>
                                        <a href="http://www.projectsedu.com">
                                            <img width="1200" height="478" src="/static/media/banner/2016/11/57aa86a0000145c512000460_nMwvoQD.jpg" />
                                        </a>
                                    </li>
    
                                <li>
                                        <a href="http://www.projectsedu.com">
                                            <img width="1200" height="478" src="/static/media/banner/2016/11/57aa86a0000145c512000460_GXIBATC.jpg" />
                                        </a>
                                    </li>
    
    
                            </ul>
                        </div>
                        <div class="unslider-arrow prev"></div>
                        <div class="unslider-arrow next"></div>
                    </div>
    
                    </div>
    
    
                </div>
    <!--banner end-->
    <!--feature start-->
        <section>
            <div class="wp">
                <ul class="feature">
                    <li class="feature1">
                        <img class="pic" src="/static/images/feature1.png"/>
                        <p class="center">专业权威</p>
                    </li>
                    <li class="feature2">
                        <img class="pic" src="/static/images/feature2.png"/>
                        <p class="center">课程最新</p>
                    </li>
                    <li class="feature3">
                        <img class="pic" src="/static/images/feature3.png"/>
                        <p class="center">名师授课</p>
                    </li>
                    <li class="feature4">
                        <img class="pic" src="/static/images/feature4.png"/>
                        <p class="center">数据真实</p>
                    </li>
                </ul>
            </div>
        </section>
    <!--feature end-->
    <!--module1 start-->
        <section>
            <div class="module">
                <div class="wp">
                    <h1>公开课程</h1>
                    <div class="module1 eachmod">
                        <div class="module1_1 left">
                            <img width="228" height="614" src="/static/images/module1_1.jpg"/>
                            <p class="fisrt_word">名师授课<br/>专业权威</p>
                            <a class="more" href="course-list.html">查看更多课程 ></a>
                        </div>
                        <div class="right group_list">
                            <div class="module1_2 box">
                                <div class="imgslide2">
                                    <ul class="imgs">
    
                                        <li>
                                            <a href="course-detail.html">
                                                <img width="470" height="300" src="/static/media/courses/2016/12/python文件处理.jpg" />
                                            </a>
                                        </li>
    
                                        <li>
                                            <a href="course-detail.html">
                                                <img width="470" height="300" src="/static/media/courses/2016/12/python面向对象.jpg" />
                                            </a>
                                        </li>
    
                                    </ul>
                                </div>
                                <div class="unslider-arrow2 prev"></div>
                                <div class="unslider-arrow2 next"></div>
                            </div>
    
                                <div class="module1_3 box">
                                    <a href="course-detail.html">
                                        <img width="233" height="190" src="/static/media/courses/2016/11/mysql.jpg"/>
                                    </a>
                                    <div class="des">
                                        <a href="course-detail.html">
                                            <h2 title="django入门">django入门</h2>
                                        </a>
                                        <span class="fl">难度:<i class="key">初级</i></span>
                                        <span class="fr">学习人数:3</span>
                                    </div>
                                    <div class="bottom">
                                        <span class="fl" title="慕课网">慕课网</span>
                                        <span class="star fr">0</span>
                                    </div>
                                </div>
    
                                <div class="module1_4 box">
                                    <a href="course-detail.html">
                                        <img width="233" height="190" src="/static/media/courses/2016/11/57035ff200014b8a06000338-240-135.jpg"/>
                                    </a>
                                    <div class="des">
                                        <a href="course-detail.html">
                                            <h2 title="java入门">java入门</h2>
                                        </a>
                                        <span class="fl">难度:<i class="key">中级</i></span>
                                        <span class="fr">学习人数:0</span>
                                    </div>
                                    <div class="bottom">
                                        <span class="fl" title="北京大学">北京大学</span>
                                        <span class="star fr">0</span>
                                    </div>
                                </div>
    
                                <div class="module1_5 box">
                                    <a href="course-detail.html">
                                        <img width="233" height="190" src="/static/media/courses/2016/11/540e57300001d6d906000338-240-135.jpg"/>
                                    </a>
                                    <div class="des">
                                        <a href="course-detail.html">
                                            <h2 title="python入门">python入门</h2>
                                        </a>
                                        <span class="fl">难度:<i class="key">中级</i></span>
                                        <span class="fr">学习人数:0</span>
                                    </div>
                                    <div class="bottom">
                                        <span class="fl" title="南京大学">南京大学</span>
                                        <span class="star fr">0</span>
                                    </div>
                                </div>
    
                                <div class="module1_6 box">
                                    <a href="course-detail.html">
                                        <img width="233" height="190" src="/static/media/courses/2016/11/57035ff200014b8a06000338-240-135_dHfj8Nq.jpg"/>
                                    </a>
                                    <div class="des">
                                        <a href="course-detail.html">
                                            <h2 title="java入门2">java入门2</h2>
                                        </a>
                                        <span class="fl">难度:<i class="key">高级</i></span>
                                        <span class="fr">学习人数:0</span>
                                    </div>
                                    <div class="bottom">
                                        <span class="fl" title="慕课网2">慕课网2</span>
                                        <span class="star fr">0</span>
                                    </div>
                                </div>
    
                                <div class="module1_7 box">
                                    <a href="course-detail.html">
                                        <img width="233" height="190" src="/static/media/courses/2016/11/57035ff200014b8a06000338-240-135_0nFiBSI.jpg"/>
                                    </a>
                                    <div class="des">
                                        <a href="course-detail.html">
                                            <h2 title="java入门3">java入门3</h2>
                                        </a>
                                        <span class="fl">难度:<i class="key">初级</i></span>
                                        <span class="fr">学习人数:1</span>
                                    </div>
                                    <div class="bottom">
                                        <span class="fl" title="慕课网3">慕课网3</span>
                                        <span class="star fr">0</span>
                                    </div>
                                </div>
    
                                <div class="module1_8 box">
                                    <a href="course-detail.html">
                                        <img width="233" height="190" src="/static/media/courses/2016/11/540e57300001d6d906000338-240-135_MSIqfvw.jpg"/>
                                    </a>
                                    <div class="des">
                                        <a href="course-detail.html">
                                            <h2 title="python入门2">python入门2</h2>
                                        </a>
                                        <span class="fl">难度:<i class="key">中级</i></span>
                                        <span class="fr">学习人数:0</span>
                                    </div>
                                    <div class="bottom">
                                        <span class="fl" title="慕课网666">慕课网666</span>
                                        <span class="star fr">0</span>
                                    </div>
                                </div>
    
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <section>
            <div class="module greybg">
                <div class="wp">
                    <h1>课程机构</h1>
                    <div class="module3 eachmod">
                        <div class="module3_1 left">
                            <img width="228" height="463" src="/static/images/module3_1.jpg"/>
                            <p class="fisrt_word">名校来袭<br/>权威认证</p>
                            <a class="more" href="org-list.html">查看更多机构 ></a>
                        </div>
                        <div class="right">
                            <ul>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/11/imooc.png"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="慕课网">慕课网</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/11/bjdx.jpg"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="北京大学">北京大学</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/11/qhdx-logo.png"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="清华大学">清华大学</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/11/njdx.jpg"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="南京大学">南京大学</span></p>
                                        </a>
                                    </li>
    
                                    <li class="five">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/11/imooc_klgAUn5.png"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="慕课网2">慕课网2</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/11/imooc_Gn1sRjp.png"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="慕课网3">慕课网3</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/11/imooc_Y2Tonsq.png"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="慕课网3">慕课网3</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/11/imooc_OO2ykYP.png"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="慕课网4">慕课网4</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/11/imooc_V0TJOyb.png"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="慕课网5">慕课网5</span></p>
                                        </a>
                                    </li>
    
                                    <li class="five">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/11/imooc_qEaMov1.png"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="慕课网666">慕课网666</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/12/bjdx.jpg"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="慕学网">慕学网</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/12/imooc_Gn1sRjp.png"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="python培训机构">python培训机构</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/12/bjdx_cCpdUw8.jpg"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="vuejs培训">vuejs培训</span></p>
                                        </a>
                                    </li>
    
                                    <li class="">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/12/imooc_klgAUn5.png"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="nodejs培训">nodejs培训</span></p>
                                        </a>
                                    </li>
    
                                    <li class="five">
                                        <a href="org-detail-homepage.html">
                                            <div class="company">
                                                <img width="184" height="100" src="/static/media/org/2016/12/bjdx_bcd0m07.jpg"/>
                                                <div class="score">
                                                    <div class="circle">
                                                        <h2>全国知名</h2>
                                                    </div>
                                                </div>
                                            </div>
                                            <p><span class="key" title="慕学在线">慕学在线</span></p>
                                        </a>
                                    </li>
    
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    
    <footer>
            <div class="footer">
                <div class="wp">
                    <ul class="cont">
                        <li class="logo"><a href=""><img src="/static/images/footlogo.png"/></a></li>
                        <li class="code"><img src="/static/images/code.jpg"/><p class="center">扫描关注微信</p></li>
                        <li class="third"><img class="fl" src="/static/images/tell.png"/><p class="tell">8888888</p><p class="time">周一至周日 9:00-18:00</p></li>
                    </ul>
    
                </div>
                <p class="line"></p>
                <div class="wp clear">
                    <span class="fl">? 2016 www.projectsedu.com 慕学在线-在线学习交流平台 保留所有权利</span>
                    <span class="fr">copyright ? 2018 ICP备案证书号:蜀ICP备xxxxx号-1</span>
                </div>
            </div>
        </footer>
    
    <section>
        <ul class="sidebar">
            <li class="qq">
                <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=2023525077&site=qq&menu=yes"></a>
            </li>
            <li class="totop"></li>
        </ul>
    </section>
    <script src="/static/js/selectUi.js" type='text/javascript'></script>
    <script src="/static/js/deco-common.js" type='text/javascript'></script>
    <script type="text/javascript" src="/static/js/plugins/laydate/laydate.js"></script>
    <script src="/static/js/plugins/layer/layer.js"></script>
    <script src="/static/js/plugins/queryCity/js/public.js" type="text/javascript"></script>
    <script src="/static/js/unslider.js" type="text/javascript"></script>
    <script src="/static/js/plugins/jquery.scrollLoading.js"  type="text/javascript"></script>
    <script src="/static/js/deco-common.js"  type="text/javascript"></script>
    
        <script type="text/javascript" src="/static/js/index.js"></script>
    
    </body>
    </html>
    

    具体调试和展现详情见视频


    image.png

    相关文章

      网友评论

        本文标题:强力Django第六章7-8用户注册

        本文链接:https://www.haomeiwen.com/subject/czaelftx.html