python学习

This commit is contained in:
2019-07-22 18:07:14 +08:00
parent 0ba940441f
commit 5ee5b5035c
6 changed files with 199 additions and 86 deletions

View File

@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
from flask import Blueprint,request,redirect
from common.libs.Helper import ops_render,iPagination
from common.libs.UrlManager import UrlManager
from common.models.User import User
from common.models.log.AppAccessLog import AppAccessLog
route_account = Blueprint( 'account_page',__name__ )
from application import app,db
@route_account.route( "/index" )
@@ -31,7 +33,20 @@ def index():
@route_account.route( "/info" )
def info():
return ops_render( "account/info.html" )
resp_data = {}
req = request.args
uid = int(req.get('id', 0))
reback_url = UrlManager.buildUrl("/account/index")
if uid < 1:
return redirect(reback_url)
info = User.query.filter_by(uid=uid).first()
if not info:
return redirect(reback_url)
resp_data['info'] = info
return ops_render("account/info.html", resp_data)
@route_account.route( "/set" )
def set():

View File

@@ -1,22 +1,12 @@
{% extends "common/layout_main.html" %}
{% block content %}
<div class="row border-bottom">
<div class="col-lg-12">
<div class="tab_title">
<ul class="nav nav-pills">
<li class="current">
<a href="{{ buildUrl('/account/index') }}">账户列表</a>
</li>
</ul>
</div>
</div>
</div>
{% include "common/tab_account.html" %}
<div class="row m-t">
<div class="col-lg-12">
<div class="row">
<div class="col-lg-12">
<div class="m-b-md">
<a class="btn btn-outline btn-primary pull-right" href="{{ buildUrl('/account/set') }}">
<a class="btn btn-outline btn-primary pull-right" href="{{ buildUrl('/account/set') }}?id={{ info.uid }}">
<i class="fa fa-pencil"></i>编辑
</a>
<h2>账户信息</h2>
@@ -28,9 +18,9 @@
<img class="img-circle circle-border" src="{{ buildStaticUrl('/images/common/avatar.png') }}" width="100px" height="100px">
</div>
<div class="col-lg-10">
<p class="m-t">姓名:gfddf</p>
<p>手机:dfgdd</p>
<p>邮箱:dfgdg</p>
<p class="m-t">姓名:{{ info.nickname }}</p>
<p>手机:{{ info.mobile }}</p>
<p>邮箱:{{ info.email }}</p>
</div>
</div>
<div class="row m-t">
@@ -56,7 +46,17 @@
</tr>
</thead>
<tbody>
<tr><td colspan="2">暂无数据</td></tr>
{% if access_list %}
{% for item in access_list %}
<tr>
<td>{{ item.created_time }}</td>
<td>{{ item.target_url }}</td>
<td></td>
</tr>
{% endfor %}
{% else %}
<tr><td colspan="2">暂无数据~~</td></tr>
{% endif %}
</tbody>
</table>
</div>

View File

@@ -0,0 +1,11 @@
<div class="row border-bottom">
<div class="col-lg-12">
<div class="tab_title">
<ul class="nav nav-pills">
<li class="current">
<a href="{{ buildUrl('/account/index') }}">账户列表</a>
</li>
</ul>
</div>
</div>
</div>