首頁列表顯示所有問答,完成問答詳情頁佈局。

  1. 首頁列表顯示所有問答:
    1. 將數據庫查詢結果傳遞到前端頁面 Question.query.all()
    2. 前端頁面循環顯示整個列表。
    3. 問答排序
  2. 完成問答詳情頁佈局:
    1. 包含問答的所有信息
    2. 評論區
    3. 以往評論列表顯示區。
  3. 在首頁點擊問答標題,連接到相應詳情頁。

首頁HTMLjavascript

{% extends 'base.html' %}
{% block title %}首頁{% endblock %}
{% block head %}
    {#    <script src="{{ url_for('static',filename='js/base.js') }}" type="text/javascript"></script>#}
    <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/index.css') }}">
{% endblock %}
{% block main %}
    <div class="content">
        <div class="img">
            <img src="{{ url_for('static',filename='images/cake1.jpg') }}"></a>
            <div class="desc"><a href="http://www.lecake.com/shop/goods-105601.html">天秤花園蛋糕 </a></div>
        </div>
        <div class="img">
            <img src="{{ url_for('static',filename='images/cake2.jpg') }}"></a>
            <div class="desc"><a href="http://www.lecake.com/shop/goods-105595.html">實慄派核桃慄蓉蛋糕 </a></div>
        </div>
        <div class="img">
            <img src="{{ url_for('static',filename='images/cake3.jpg') }}"></a>
            <div class="desc"><a href="http://www.lecake.com/shop/goods-105652.html">魔法引力蛋糕</a></div>
        </div>
        <div class="img">
            <img src="{{ url_for('static',filename='images/cake4.jpg') }}"></a>
            <div class="desc"><a href="http://www.lecake.com/shop/goods-100801.html">雪域牛乳芝士蛋糕</a></div>
        </div>
    </div>

    {#    <p>{{ user }}context</p>#}
    <div class="juli">
        {#<ul>
        <a class="author">{{ author}}</a>
        <a class="create_time">{{ create_time }}</a><br>
        <h3 class="title">{{ title}}</h3>
        <a class="detail">{{ detail}}</a>
    </ul>#}
    <ul>
        {% for foo in questions %}
            <li>
                <img id="tubiao" src="{{ url_for('static',filename='images/pl.jpg') }}">
                <a href="#">{{ foo.author.Username }}</a>
                <a class="creat_time" href="#">{{ foo.creat_time }}</a>
                <p class="title" href="#" onclick="window.location.replace({{ url_for('detailpage')}})">{{ foo.title }}</p>
{#                <p class="title" href="{{ url_for('detailpage')}}">{{ foo.title }}</p>#}
                <p class="abstract">{{ foo.detail }}</p>
            </li>
        {% endfor %}</ul>
    </div>
     {% endblock %}
{% extends 'base.html' %}
{% block title %}詳情頁{% endblock %}
{% block head %}
    {#    <script src="{{ url_for('static',filename='js/base.js') }}" type="text/javascript"></script>#}
    <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/detailpage.css') }}">
{% endblock %}
{% block main %}
    <div align="center">
        <div class="xianshi">
                    <h2>如何卓有成效地過一天</h2>
                    <p>yangmi</p>
                    <p>2017-12-5</p>
                   <p>detail</p>
            <br></div>
        <div class="ping">
            <div class="pinglun"><label for="comment">評論</label><br></div>
            <textarea id="comment" rows="12" name="commentdetail"></textarea></div>
        <input type="submit" class="fasong" value="發送評論">
    </div>
{% endblock %}

主頁顯示問答:css

相關文章
相關標籤/搜索