79 lines
2.2 KiB
HTML
79 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
{% load staticfiles %}
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>讲师信息</title>
|
|
<style>
|
|
.container {
|
|
width: 960px;
|
|
margin: 0 auto;
|
|
}
|
|
.basic {
|
|
width: 60%;
|
|
float: left;
|
|
}
|
|
.potrait {
|
|
width: 40%;
|
|
float: left;
|
|
}
|
|
hr {
|
|
clear: both;
|
|
}
|
|
.button {
|
|
display: inline-block;
|
|
width: 80px;
|
|
height: 30px;
|
|
background-color: red;
|
|
color: white;
|
|
font: 16px/30px Arial;
|
|
text-decoration: none;
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- 页面的显示逻辑 -->
|
|
{% for x in teachers_list %}
|
|
<div class="container">
|
|
<div class="basic">
|
|
<h1>{{ x.name }}老师</h1>
|
|
<p><strong>讲师简介</strong></p>
|
|
<p>{{ x.intro }}</p>
|
|
<p><strong>教学理念</strong></p>
|
|
<p>{{ x.motto }}</p>
|
|
<a href="/good/{{ x.no }}" class="button">好评({{ x.gcount }})</a>
|
|
<a href="/bad/{{ x.no }}" class="button">差评({{ x.bcount }})</a>
|
|
</div>
|
|
<div class="potrait">
|
|
{% if x.photo %}
|
|
<img src="{% static x.photo %}">
|
|
{% endif %}
|
|
</div>
|
|
<hr>
|
|
</div>
|
|
{% endfor %}
|
|
<script src="{% static 'js/jquery.min.js' %}"></script>
|
|
<script>
|
|
$(function() {
|
|
$('.basic .button').on('click', function(evt) {
|
|
evt.preventDefault();
|
|
var $a = $(evt.target);
|
|
var url = $a.attr('href');
|
|
$.ajax({
|
|
'url': url,
|
|
'type': 'get',
|
|
'data': {},
|
|
'dataType': 'json',
|
|
'success': function(json) {
|
|
if (json.code == 200) {
|
|
$a.text(json.result);
|
|
}
|
|
},
|
|
'error': function() {}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |