{% extends 'basic.html' %}
{% block title %}个人中心{% endblock %}
{% block head %}
<link rel="stylesheet" type="text/css" href="../static/css/20.css">
<link rel="stylesheet" type="text/css" href="../static/css/200.css">
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<script src="../static/js/39.js"></script>
<style type="text/css">
a{
color: #000000;
}
</style>
{% endblock %}
<body background="../static/timg.jpg" style="background-attachment: fixed;background-size: 100% 100%" >
{% block userbase %}
<div style="width:50rem; margin:0 auto">
<ul class="list-group list-group-flush">
<h2 style="margin: 0%;align:center">{{ user.username }}</h2>
</ul>
<li role="presentation"><a href="{{ url_for('usercenter',user_id=user.id,tag=1) }}">Question</a> </li>
<li role="presentation"><a href="{{ url_for('usercenter',user_id=user.id,tag=2) }}">Comment</a> </li>
<li role="presentation"><a href="{{ url_for('usercenter',user_id=user.id,tag=3) }}">Info</a> </li>
</ul>
</div>
{% block main %}{% endblock %}
{% endblock %}
</body>
{% extends 'userbase.html' %}
{% block title %}PERSONAL{% endblock %}
{% block main %}
<div class="touming">
<div class="card" style="width:50rem; margin:0 auto">
<ul class="list-group list-group-flush">
<h3 style="margin:0" align="center">ANSWER</h3>
{% for foo in user.questions %}
<li class="list-group-item">
<span class="icon" aria-hidden="true"></span>
<br>
<h3> <a href="{{ url_for('detail',question_id=foo.id) }}">{{ foo.title }}</a></h3>
<p>{{ foo.detail }}</p>
<span class="badge"style="float:right">{{ foo.creat_time}}</span>
<a href="{{ url_for('usercenter',user_id=foo.author.id) }}">{{ foo.author.username}}</a>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
{% extends 'userbase.html' %}
{% block title %}PERSONAL{% endblock %}
{% block main %}
<div class="card touming" style="width:50rem; margin:0 auto">
<ul class="list-group list-group-flush">
<h3 style="margin:0" align="center">COMMENT</h3>
{% for foo in user.comments %}
<li class="list-group-item">
<span class="icon" aria-hidden="true"></span>
<br>
<h3> <a href="{{ url_for('detail',question_id=foo.id) }}">{{ foo.title }}</a></h3>
<p>{{ foo.detail }}</p>
<span class="badge"style="float:right">{{ foo.creat_time}}</span>
<a href="#">{{ foo.author.username}}</a>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
{% extends 'userbase.html' %}
{% block title %}PERSONAL{% endblock %}
{% block main %}
<body class="abc">
<div class="card touming" style="width:50rem; margin:0 auto">
<h3 style="margin:0" align="center" color="blue">{{ username }}MESSAGE</h3>
<ul class="list-group list-group-flush">
<li class="list-group-item">
<span class="icon" aria-hidden="true">
Username:{{ user.username }}<br>
id:{{ user.id }}<br>
nickname:{{ user.nickname }}<br>
Comperhantion:{{ user.questions|length }}
</span>
</li>
</ul>
</div>
</body>
{% endblock %}
@app.route('/usercenter/<user_id>/<tag>')
@loginFrist
def usercenter(user_id,tag):
user=User.query.filter(User.id==user_id).first()
context={
# 'username':user.username,
# 'question':user.questions,
# 'comments':user.comment
'user':user
}
if tag == '1':
return render_template('usercenter1.html',**context)
elif tag == '2':
return render_template('usercenter2.html', **context)
else :
return render_template('usercenter3.html', **context)