基类模板抽取

  • 个人中心页面和新闻详情页一样,顶部和底部内容类似,可以继承之前抽取的 base.html,抽取完成之后 user.html 内容如下:
{% extends "news/base.html" %}

{% block titleBlock %}
用户中心
{% endblock %}

{% block contentBlock %}
<div class="user_menu_con fl">
    <div class="user_center_pic">
        <img src={% if data.user_info.avatar_url %}
            {{ data.user_info.avatar_url }}
        {% else %}
            "../../static/news/images/user_pic.png"
        {% endif %} alt="用户图片">
    </div>
    <div class="user_center_name">{{ data.user_info.nick_name }}</div>

    <ul class="option_list">
        <li class="active"><a href="../../static/news/html/user_base_info.html" target="main_frame">基本资料</a></li>
        <li><a href="../../static/news/html/user_pic_info.html" target="main_frame">头像设置</a></li>
        <li><a href="../../static/news/html/user_follow.html" target="main_frame">我的关注</a></li>
        <li><a href="../../static/news/html/user_pass_info.html" target="main_frame">密码修改</a></li>
        <li><a href="../../static/news/html/user_collection.html" target="main_frame">我的收藏</a></li>
        <li><a href="../../static/news/html/user_news_release.html" target="main_frame">新闻发布</a></li>
        <li><a href="../../static/news/html/user_news_list.html" target="main_frame">新闻列表</a></li>
    </ul>
</div>

<div class="user_con fr">
    <iframe src="../../static/news/html/user_base_info.html" frameborder="0" name="main_frame" class="main_frame" id="main_frame"></iframe>
</div>
{% endblock %}

{% block rankBlock %}
{#重写rankBlock,内部什么什么都不填#}
{% endblock %}