Commits

ouxuedong  committed c7de904

流程样式修改

  • Participants
  • Parent commits 4201187

Comments (0)

Files changed (6)

File src/resetsqlitedb.py

 from main import db
 db.drop_all()
 db.create_all()
-

File src/templates/_macros.html

                     <img src="{{ url_for('static',filename='img/'+coupon.pic_img) }}" width="333" height="222" />
                 </a>
                 <div class="caption">
-                    <a href="{{ url_for('coupon', couponid = coupon.key()) }}">{{ coupon.title }}</a></div>
+                    <a href="{{ url_for('coupon', couponid = coupon.key()) }}">{{ coupon.title }}</a>
+                </div>
                 <div class="label"> {{ coupon.discount }}% <br />
                 <span>off</span></div>
             </li>
                 {% for coupon in coupons %}
                     <li>
                         <div class="leftside fl"> 
-                              <a href="">
-                                      <img src="{{ url_for('static',
-                                      filename='img/' + coupon.pic_img) }}" width="285" height="126"  alt="img">
+                              <a href="{{ url_for('coupon', couponid = coupon.key()) }}">
+                              <img src="{{ url_for('static', filename='img/' + coupon.pic_img) }}" width="285" height="126"  alt="img">
                               </a>
                               <div class="label"> {{ coupon.discount }}% <br />
                               <span>off</span></div>
                                 <div class="rigsec fr">
 
 
-
                                     <input type="button" onclick="popup_show()"  value='下载优惠券'/>
                                     <div class="sample_popup" id="popup" style="visibility: hidden; display: none;">
                                         <div class="menu_form_header" id="popup_drag">
                                         </div>
                                     </div>
 
-
-                                    <!--a class="greenbtn" id="promo_129725" onclick="popup_show();" title="本券支持短信下载" rel="nofollow"><span>下载优惠券</span></a--> 
-
                                 </div>
                             </div>
                         </div>

File src/templates/coupon.html

             <ul class="socialicon2 fl reset ovfl-hidden">
             <li>
             </ul>
-            <div class="rigsec fr" style="margin-top:25px;"> <a href="{{ url_for('downcoupon', couponid=coupon.key(), phonenum='13430399770')}}" class="greenbtn"><span>下载优惠券</span></a> </div>
-            <div class="clr"></div>
-<br />
-<div class="ovfl-hidden">
+
+
+
+
+                                <div class="rigsec fr">
+                                    <input type="button" onclick="popup_show()"  value='下载优惠券'/>
+                                    <div class="sample_popup" id="popup" style="visibility: hidden; display: none;">
+                                        <div class="menu_form_header" id="popup_drag">
+                                            <img class="menu_form_exit"   id="popup_exit" />
+                                               请输入您的电话号码:
+                                        </div>
+                                        <div class="menu_form_body">
+                                            <form method="post" action="{{ url_for('downcoupon') }}">
+                                            <table>
+                                                <tr>
+                                                  我的电话号码:
+                                                  <td>
+                                                  <input id="phonenum" name="phonenum" class="field" type="text" onfocus="select();" />
+                                                  <input id="couponid" name="couponid" class="field" type="hidden" value="{{ coupon.key() }}"/>
+                                                  </td>
+                                                </tr>
+                                                <tr>
+                                                  <th> </th>
+                                                  <td><input class="btn" type="submit" value="发送" /></td>
+                                                </tr>
+                                            </table>
+                                            </form>
+                                        </div>
+                                    </div>
+                                </div>
+
+        <div class="clr"></div>
+        <br />
+        <div class="ovfl-hidden">
             <strong>优惠详情:<br>
                 {{ coupon.desc }}
                 <br/>
             </strong>
             </div>
 
-<br>
-<br>
-<br>
-<br>
--
-  <div class="rigsec fr" style="margin-top:25px;"> <a href="{{ url_for('downcoupon', couponid=coupon.key(), phonenum='13430399770')}}" class="greenbtn"><span>下载优惠券</span></a> </div>
-  <div class="clr"></div> 
-  <nav class="pagination ovfl-hidden">
+        <br>
+        <br>
+        <br>
+        <br>
+        -
+
+                                <div class="rigsec fr">
+                                    <input type="button" onclick="popup_show()"  value='下载优惠券'/>
+                                    <div class="sample_popup" id="popup" style="visibility: hidden; display: none;">
+                                        <div class="menu_form_header" id="popup_drag">
+                                            <img class="menu_form_exit"   id="popup_exit" />
+                                               请输入您的电话号码:
+                                        </div>
+                                        <div class="menu_form_body">
+                                            <form method="post" action="{{ url_for('downcoupon') }}">
+                                            <table>
+                                                <tr>
+                                                  我的电话号码:
+                                                  <td>
+                                                  <input id="phonenum" name="phonenum" class="field" type="text" onfocus="select();" />
+                                                  <input id="couponid" name="couponid" class="field" type="hidden" value="{{ coupon.key() }}"/>
+                                                  </td>
+                                                </tr>
+                                                <tr>
+                                                  <th> </th>
+                                                  <td><input class="btn" type="submit" value="发送" /></td>
+                                                </tr>
+                                            </table>
+                                            </form>
+                                        </div>
+                                    </div>
+                                </div>
+
+    <div class="clr"></div> 
+    <nav class="pagination ovfl-hidden">
         </nav>          
           </div>
       

File src/templates/index.html

 {% extends "layout.html" %}
+{% from '_macros.html' import all_coupon_list %}
 
-{% from '_macros.html' import coupon_list, user_list %}
+
+{% block header -%}
+
+    <div class="headtop">
+    <div class="clr"></div>
+    <nav class="fl">
+    <ul class="topnav">
+        <li><a href="" ><span>使用介绍</span></a></li>
+        <li class="last" style="padding-right:0px;">
+        <span class="dropdownbg2">
+        <form class='city_form' action="{{ request.url }}" method='post'>
+        <table>
+            <select name='cityid' class="select" onchange="submit();">
+
+            {% if messages %}
+            <p id='flash'>
+                <!-- TODO: How to display multiple messages. -->
+                {% for category, msg in messages %}
+                <span class="{{ category }}">{{ msg }}</span>
+                {% endfor %}
+            </p>
+            {% endif %}
+
+                <option value="all">选择城市</option>
+
+                {% if cityid == '广州' %}                
+                    <option value="广州" selected="true">广州</option>
+                {% else %}
+                    <option value="广州">广州</option>
+                {% endif %}
+
+                {% if cityid == '深圳' %}                
+                    <option value="深圳" selected="true">深圳</option>
+                {% else %}
+                    <option value="深圳">深圳</option>
+                {% endif %}
+
+                {% if cityid == '香港' %}                
+                    <option value="香港" selected="true">香港</option>
+                {% else %}
+                     <option value="香港">香港</option>
+                {% endif %}
+ 
+            </select>
+        </table>
+        </form>
+        </span>
+    </li>
+    </ul>
+    <div class="clr"></div>
+    </nav>
+    </div> 
+
+{%- endblock %}
+
 
 {% block body -%}
-<h2>今日推荐</h2>
-{{ coupon_list(upcoming_coupons) }}
-<a href="{{ url_for('coupons') }}">查看更多内容 View More>></a>
+    {{ all_coupon_list(coupons) }}
 {%- endblock %}

File src/templates/layout.html

     {% block css -%}
     <link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
     <link rel="stylesheet" href="{{ url_for('static', filename='css/basic.css') }}">
+    <link rel="stylesheet" href="{{ url_for('static', filename='css/phonebox.css') }}">
     {%- endblock %}
 
     <!-- More ideas for your <head> here: h5bp.com/docs/#head-Tips -->
     {% block js_top -%}
     <script src="{{ url_for('static', filename='js/libs/modernizr-2.0.min.js') }}"></script>
     <script src="{{ url_for('static', filename='js/libs/respond.min.js') }}"></script>
-
+    <script src="{{ url_for('static', filename='js/libs/phonebox.js') }}"></script>
     {%- endblock %}
 
 </head>
         </div>
         <header>
             {% block header -%}
-
-            <div class="headtop">
-            <!--table border="0" cellspacing="0" cellpadding="0" align="left">
-                  <td>
-                      <ul class="socialicon fl reset">
-                        <li><a href="mailto:?subject=&amp;body=http://localhost:8080/" class="email"></a></li>
-                        <li><a href="http://www.facebook.com" class="fb" target="_blank"></a></li>
-                        <li><a href="http://twitter.com/" class="twitter" target="_blank"></a></li>
-                      </ul>
-                      <ul class="afterlogin fr reset">
-                      <li>
-                      <div class="loginsec">
-                           <div><a href="javascript:void(0);" onclick="javascript:setconfirm();">登 录</a> &nbsp;&nbsp;|&nbsp;&nbsp; 
-                      <a href="javascript:void(0);" onclick="javascript:setconfirm();">注 册</a></div>
-                      </li>
-                      </ul>
-                 </td>
-              </table-->
-
-
-            <div class="clr"></div>
-            <nav class="fl">
-            <ul class="topnav">
-                 
-                <li><a href="" ><span>使用介绍</span></a></li>
-                <li class="last" style="padding-right:0px;">
-                <span class="dropdownbg2">
-                <form class='city_form' action="{{ request.url }}" method='post'>
-                <table>
-                    <select name='cityid' class="select" onchange="submit();">
-                        <option value="all">选择城市</option>
-                        <option value="gz">广州</option>
-                        <option value="sz">深圳</option>
-                        <option value="xg">香港</option>
-                    </select>
-                </table>
-                </form>
-
-                </span>
-            </li>
-            </ul>
-            <div class="clr"></div>
-            </nav>
-
-            </div> 
-
             {%- endblock %}
         </header>
         <hr/>

File src/vacancy.py

     if request.method == 'POST':
         cityid = request.form['cityid']
     if cityid == 'all' or cityid == '':
-        upcoming_coupons = Coupon.get_upcoming_coupons(4, '')
-    else:
-        upcoming_coupons = Coupon.get_upcoming_coupons(4, cityid)
-    return render_template('index.html',upcoming_coupons=upcoming_coupons)
-
-
-@app.route('/coupons', methods=['POST', 'GET'])
-def coupons():
-    cityid = ''
-    if request.method == 'POST':
-        cityid = request.form['cityid']
-    if cityid == 'all' or cityid == '':
         coupons = Coupon.get_all_coupons('')
     else:
         coupons = Coupon.get_all_coupons(cityid)
-    return render_template('coupons.html',coupons=coupons)
+    return render_template('index.html', coupons=coupons, cityid=cityid)
 
 
 @app.route('/explore')
             return redirect(url_for('coupon', couponid=coupon.id))
         else:
             g.errmsgs['misc'] = 'Title or start required.'
-    return render_template('create_coupon.html', title=title, start=start,
-                           place=place, price=price)
+    return render_template('create_coupon.html', title=title, start=start, place=place, price=price)
 
 
 @app.route('/settings', methods=['GET', 'POST'])