Python大作業


一、系統概要說明

  1. 父模板統一布局:

(1) 頭部導航條

(2) 中間主顯示區域布局

(3) 底部導航條

  1. 注冊、登錄、注銷功能
  2. 發布、列表顯示
  3. 詳情頁
  4. 評論、列表顯示
  5. 個人中心
  6. 搜索、條件組合搜索
  7. 文章分類與顯示
  8. 點贊、收藏
  9. 修改密碼、頭像、上傳頭像
  10. 推薦文章

二、網站結構設計

  1. 頂部導航條:

(4) 未登錄時:首頁、發布、搜索、登錄、注冊功能(Ps:此時點擊發布,自動跳轉到登錄頁面)

(5) 登錄后:發布、設置、個人信息、注銷功能

  1. 中間主顯示區域布局:

(1) 用戶的發布、點贊、評論總覽

(2) 發布詳情

(3) 文章分類與顯示

  1. 底部導航條

三、模塊詳細設計

  1. 發布模塊
  2. 個人中心模塊

(1) 個人信息

 

{% extends 'yonghufather.html' %}

{% block yonghubody %}
    <h3 class="text-center">個人信息</h3>
    <ul class="list-unstyled nav1">
        <li style="background-color: #ffdedf">用戶:{{ username }}</li>
        <li style="background-color: #8bb3ff">編號:{{ userid }}</li>
        <li style="background-color: #feffac">昵稱:{{ nickname }}</li>
        <li style="background-color: #b0ffbe">頭像:
            {% if  img is none%}
                <img src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3298685419,1477967578&fm=27&gp=0.jpg"
                 style="width: 100px">
            {% else %}
                <img src="/static/{{ img }}"
                 style="width: 100px">
            {% endif %}


            <form action="{{ url_for('uploadLogo',user_id=userid) }}"method="post" enctype="multipart/form-data">
                <input type="file" name="logo" required>
                <button type="submit">上傳頭像</button>
            </form>
        </li>

        <li style="background-color: #ffb664">文章:{{ fabus|length }}篇</li>
        <li style="background-color: #ffacde">評論:{{ comments|length }}條</li>
        <li style="background-color: #b89dff">收藏文章:{{ shoucang|length }}篇</li>
    </ul>

{% endblock %}

 

 

 

(2) 發布信息

 

 1 {% extends 'yonghufather.html' %}
 2 
 3 {% block yonghubody %}
 4 
 5     <div>
 6         <h3 class="text-center">全部發布信息({{ fabus|length }})</h3>
 7         <ul class="list-unstyled">
 8             {% for foo in fabus %}
 9                 <li class="list-group-item">
10                     <a href="{{ url_for('yonghu',username_id=foo.author_id,tag=1) }}"><span
11                             class="glyphicon glyphicon-bell"></span>{{ foo.author.username }}</a>
12                     <span class="badge">{{ foo.creat_time }}</span>
13                     <span class="badge pull-right">{{ foo.leixing }}</span>
14                     <h4 class="text-center"><a href="{{ url_for('fabuview',fabu_id=foo.id) }}">{{ foo.title }}</a>
15                     </h4>
16 
17                     <br>
18                     <p>{{ foo.detail }}</p>
19                 </li>
20             {% endfor %}
21         </ul>
22         <br>
23         <br>
24         <br>
25     </div>
26 
27 {% endblock %}

 

 

(3) 評論信息

 

 1 {% extends 'yonghufather.html' %}
 2 
 3 {% block yonghubody %}
 4 
 5     <div>
 6         <h3 class="text-center">全部評論信息({{ comments|length }})</h3>
 7         <ul class="list-unstyled">
 8             {% for foo in comments %}
 9                 <li class="list-group-item">
10                     <a href="{{ url_for('yonghu',username_id=foo.author_id,tag=1) }}"><span
11                             class="glyphicon glyphicon-bell"></span>{{ foo.author.username }}</a>
12                     <span class="badge pull-right">{{ foo.creat_time }}</span>
13                     <p>{{ foo.detail }}</p>
14                     <br>
15                 </li>
16             {% endfor %}
17         </ul>
18         <br>
19         <br>
20         <br>
21     </div>
22 
23 {% endblock %}

 

 

(4) 收藏文章

 

 1 {% extends 'yonghufather.html' %}
 2 
 3 {% block yonghubody %}
 4 
 5     <div>
 6         <h3>收藏文章({{ shoucang|length }})</h3>
 7         <hr>
 8         <table class="table table-bordered">
 9             <thead>
10             <tr>
11                 <th>文章</th>
12                 <th>作者</th>
13             </tr>
14             </thead>
15             <tbody>
16             {% for foo in shoucang %}
17                 <tr>
18                     <td><a href="{{ url_for('fabuview',fabu_id=foo.fabu.id) }}">{{ foo.fabu.title }}</a>&nbsp&nbsp&nbsp<em>瀏覽:{{ foo.fabu.yuedu }}&nbsp&nbsp&nbsp評論:{{ foo.fabu.comments |length }}&nbsp&nbsp&nbsp點贊:{{ foo.fabu.dianzangs |length }}</em></td>
19                     <td><a href="{{ url_for('yonghu',username_id=foo.author.id,tag=1) }}">{{ foo.author.username }}</a></td>
20                 </tr>
21             {% endfor %}
22             </tbody>
23         </table>
24         <br>
25         <br>
26         <br>
27     </div>
28 
29 {% endblock %}

 

 

 

四、數據庫設計

  1. 用戶表:

儲存用戶的賬號與密碼,密碼在數據庫中隱藏,只有管理員身份才能查看。注冊成功時,賬號與密碼就會被錄入數據庫中;登錄要依據數據庫中的用戶表。

  2.發布內容表

表中的信息包括標題、詳情和文章類型。

  3.點贊表

錄入的是用戶的點贊情況,主要是統計點贊數量。

  4.評論表

錄入的是用戶的評論情況。

  5.收藏表

錄入的是用戶的收藏情況,主要是統計收藏數量

五、系統實現的關鍵算法與數據結構

  1. 高級搜索

可通過某些關鍵詞對發布的內容進行搜索,包含這些關鍵詞的內容都被篩選出來,不包含的內容不顯示在首頁。

  1. 包含限制條件的登錄、注冊功能

限制條件主要是用在對用戶名、密碼的限制,包括用戶名的組成元素,密碼的組成元素。

六、成品展示

  1. 首頁布局

  1. 注冊頁面

  1. 登錄頁面

  1. 發布頁面

  1. 個人信息頁面

  1. 發布信息頁面

  1. 評論信息頁面

  1. 收藏文章頁面


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM