Skip to content

Commit

Permalink
init version
Browse files Browse the repository at this point in the history
  • Loading branch information
jianw4 committed May 22, 2018
1 parent 15508fe commit ef52778
Show file tree
Hide file tree
Showing 31 changed files with 99 additions and 64 deletions.
5 changes: 5 additions & 0 deletions UserManage/admin.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
from django.contrib import admin
from UserManage.models import *


# Register your models here.

class UserAdmin(admin.ModelAdmin):
list_display = ('username', 'password', 'email',)
list_filter = ('username',)

class CommentAdmin(admin.ModelAdmin):
list_display = ('user', 'video', 'content', 'time')
list_filter = ('content',)


admin.site.register(User, UserAdmin)
admin.site.register(Comment, CommentAdmin)
4 changes: 2 additions & 2 deletions UserManage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def login_required(func):
"""要求登录的装饰器"""
def _deco(request, *args, **kwargs):
if not request.session.get('username'):
return redirect('/login/')
return HttpResponse(json.dumps({"error":"没有登录"}))
return func(request, *args, **kwargs)
return _deco

Expand Down Expand Up @@ -52,7 +52,7 @@ def logout(request):
if request.session.get('username'):
del request.session['username']
del request.session['admin']
return redirect('/login/')
return redirect('/index/')

def register(request):
if request.method == "POST":
Expand Down
Binary file modified db.sqlite3
Binary file not shown.
6 changes: 3 additions & 3 deletions static/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@

.btn {
padding: 7px 14px;
border-radius: 2px
border-radius: 15px
}

.btn-doc {
Expand All @@ -249,12 +249,12 @@
transition: all .2s ease-in-out
}

.btn-default:hover {
/* .btn-default:hover {
border: 1px solid #303030;
background: #303030;
color: #fff
}

*/
.btn-default:focus {
outline: 0
}
Expand Down
Binary file added static/img/1-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/1-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/1-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/1-4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/1-5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/1-6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/1-7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/1-8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/11-10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/11-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/11-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/11-4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/11-5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/11-6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/11-7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/11-8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/11-9.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/check3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed static/img/gogo2.png
Binary file not shown.
6 changes: 3 additions & 3 deletions story/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
# Create your views here.

def detail(request, s_id):
username = request.session['username']
username = request.session.get('username', None)
story = Story.objects.get(id=s_id)
story.num_views= story.num_views+1
story.save()
return render(request, "story_detail.html", {'story': story, 'username':username})

def top5(request):
username = request.session['username']
username = request.session.get('username', None)
story = Story.objects.all().order_by('-num_views')[0:5]
data_s = serializers.serialize("json", story)
return HttpResponse(data_s)

def list(request):
username = request.session['username']
username = request.session.get('username', None)
storys= Story.objects.all()
paginator = Paginator(storys, 10) # Show 25 contacts per page

Expand Down
71 changes: 48 additions & 23 deletions templates/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Laravel-简洁、优雅的PHP开发框架(PHP Web Framework)。- Laravel中文网(Laravel中国社区)</title>
<meta name="description" content="Laravel是一套简洁、优雅的PHP Web开发框架(PHP Web Framework) -- Laravel中文网">
<meta name="keywords" content="Laravel中文社区,php框架,laravel中文网,php framework,restful routing,laravel,laravel php">
<title></title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="HandheldFriendly" content="True">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="shortcut icon" href="/assets/icons/favicon.ico">
Expand Down Expand Up @@ -70,10 +70,11 @@




{% comment %}
<div id="video1" style="width:700px;height:500px;display:inline-block;float:left" class=""><img
src="/static/img/gogo2.png"/></div>;
src="/static/img/gogo2.png"/></div>;{% endcomment %}

<iframe src="{{ video.url_path }}" width="700px" height="500px" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>



Expand All @@ -84,7 +85,7 @@ <h2>{{ video.e_name }}</h2>
<ul>
{% for video in videoList %}
<li data-id="15869">
<a href="{{ video.url_path }}"><i class=""><em class="icon-full"></em></i><em class="icon-video"></em>{{ video.filename }}</a>
<a href="/video/detail/{{ video.store_path }}"><i class=""><em class="icon-full"></em></i>{{ video.filename }}</a>
</li>
{% endfor %}

Expand All @@ -98,7 +99,6 @@ <h2>{{ video.e_name }}</h2>
<div class="operator">
<div class="op chapter"><em class="icon-menu"></em>章节</div>
<div class="op notes"><em class="icon-note"></em>笔记</div>
<div class="op question"><em class="icon-addques"></em>提问</div>

</div>

Expand Down Expand Up @@ -312,7 +312,7 @@ <h2>{{ video.e_name }}</h2>
</section>


<div class="moco-modal-layer fixed" style="z-index: 900; visibility: visible; left: 441px; top: 500px; opacity: 1;">
<div class="moco-modal-layer fixed" style="z-index: 900; visibility: visible; left: 441px; top: 400px; opacity: 1;">
<div class="moco-modal-title">
<div class="moco-modal-draggable"><span>笔记</span><a href="javascript:void(0)"
class="moco-icon-close moco-modal-close js-modal-close"></a>
Expand All @@ -328,9 +328,7 @@ <h2>{{ video.e_name }}</h2>
</div>
<div class="publish-note-btns input-btm clearfix">
<div class="verify-code clearfix"></div>
<div title="截图" class="js-shot-video screen-btn" data-type="note">
<span>截图</span>
</div>

<input type="button" title="发表" value="保存" id="js-note-submit" class="moco-btn moco-btn-green r">
<!-- <label for="js-isshare" class="label-checked r"><input type="checkbox" checked="checked" id="js-isshare" class="checked" /> 公开</label> -->
</div>
Expand Down Expand Up @@ -390,26 +388,35 @@ <h2>{{ video.e_name }}</h2>
});


var i = 0
var i = 0
$(".notes").click(function () {


$(".moco-modal-layer").toggle();


if (i == 0)
{

$(".notes").css("background-color", "red")
$(".notes").css("background-color", "red");
$(".moco-modal-layer").show();
i++
}
else
{
$(".notes").css("background-color", "#363C40")
$(".notes").css("background-color", "#363C40");
$(".moco-modal-layer").hide();
i=0
}

});

$("#js-note-submit").click(function () {
$.post({

})

});

$("#js-pl-submit").click(function () {
console.log($("#js-pl-textarea").val())
$.ajax({
Expand Down Expand Up @@ -438,8 +445,18 @@ <h2>{{ video.e_name }}</h2>
" </div>\n" +
" </li>")
}
else if (data.error){
alert(data.error)
}


},
error: function(jqXHR, textStatus, errorThrown){


//alert("请先登录");
}

}
});
}
);
Expand All @@ -463,14 +480,22 @@ <h2>{{ video.e_name }}</h2>
function playVedio( vfile){

var flashvars={
f:vfile,
c:0,
b:1,
h:4
//https://www.bilibili.com/video/av23726399/
//<iframe src="//player.bilibili.com/player.html?aid=23726399&cid=39649870&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
// f:vfile,
// c:0,
// b:1,
// h:4

f:"http://ws.acgvideo.com/7/44/preview_39649870-1-6.mp4",
loaded:'loadedHandler'

};
var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
CKobject.embedSWF('/static/ckplayer/ckplayer/ckplayer.swf','video1','ckplayer_a1','100%','100%',flashvars,params);

//var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
// CKobject.embedSWF('/static/ckplayer/ckplayer/ckplayer.swf','video1','ckplayer_a1','100%','100%',flashvars,params);
var video=['http://ws.acgvideo.com/7/44/preview_39649870-1-6.mp4->video/mp4'];
CKobject.embed('/static/ckplayer/ckplayer/ckplayer.swf','video1','ckplayer_a1','100%','100%',false,flashvars,video);

}

Expand Down Expand Up @@ -499,7 +524,7 @@ <h2>{{ video.e_name }}</h2>
$(document).ready(function(){
vfile = '/static/'+$('#vfile').text();
console.log('dddddddddddddd'+vfile);
playVedio(vfile );
//playVedio(vfile );
}
)

Expand Down
20 changes: 8 additions & 12 deletions templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ <h2 class="hide"></h2><img
data-target="#main-menu"><span class="sr-only">Toggle navigation</span> </span></div>{% endcomment %}
<li class="collapse navbar-collapse" id="main-menu">
<ul class="menu">
<li role="presentation" style="font-weight: bold;float:left"><a href="{% url 'index_user' username %}" id="ai-logopl-alink" title="首页">首页</a></li>
<li role="presentation" style="font-weight: bold;float:left"><a href="" id="ai-logopl-alink"title="学习视频"
<li role="presentation" style="font-weight: bold;float:left"><a href="{% url 'index' %}" id="ai-logopl-alink" title="首页">首页</a></li>
<li role="presentation" style="font-weight: bold;float:left"><a href="{% url 'index' %}" id="ai-logopl-alink"title="学习视频"
target="_blank"
onclick="">学习视频
</a></li>
Expand All @@ -38,19 +38,15 @@ <h2 class="hide"></h2><img
<li role="presentation" style="font-weight: bold"><a href="" id="ai-logopl-alink" title="" target="_blank"
onclick="">
</a></li>
{% if username %}
{% ifnotequal username None %}
<div class="personal">
<li >
<a href="javascript:void(0)" class="reg-btn-a" id="reg-link-a" style="font-weight: bold">{{ username }}</a>
</li>
<div class="userdetail">
<dl>
<dt><img width="80" height="80" src=""/></dt>
<dd>
<h2>{{ user.nick_name }}</h2>
<p>{{ user.username }}</p>
<p>{{ user.id }}</p>
</dd>
<dt><img width="80" height="80" src="/static/img/check3.png"/></dt>

</dl>
<div class="btn">
<a class="personcenter fl" href="{% url 'users:userinfo' %}">进入个人中心</a>
Expand All @@ -69,13 +65,13 @@ <h2>{{ user.nick_name }}</h2>
<li style="float:right">
<a href="/register/" class="reg-btn-a" id="reg-link-a" style="font-weight: bold;">注册</a>
</li>
{% endif %}
{% endifnotequal %}

<li role="presentation" style="font-weight: bold;float:right"><a href="" id="ai-logopl-alink" title="我们"
<li role="presentation" style="font-weight: bold;float:right"><a href="javascript:void(0)" id="ai-logopl-alink" title="我们"
target="_blank"
onclick="">
我们</a></li>
<li role="presentation" style="font-weight: bold;float:right"><a href="" id="ai-logopl-alink" title="问答社区" target="_blank"
<li role="presentation" style="font-weight: bold;float:right"><a href="javascript:void(0)" id="ai-logopl-alink" title="问答社区" target="_blank"
onclick="">问答社区</a>
</li>

Expand Down
25 changes: 18 additions & 7 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Laravel-简洁、优雅的PHP开发框架(PHP Web Framework)。- Laravel中文网(Laravel中国社区)</title>
<meta name="description" content="Laravel是一套简洁、优雅的PHP Web开发框架(PHP Web Framework) -- Laravel中文网">
<meta name="keywords" content="Laravel中文社区,php框架,laravel中文网,php framework,restful routing,laravel,laravel php">
<title>Child English</title>
<meta name="description" content="Child English 专注于儿童英语教育的网站">
<meta name="keywords" content="Child English 专注于儿童英语教育的网站">
<meta name="HandheldFriendly" content="True">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="shortcut icon" href="/assets/icons/favicon.ico">
Expand Down Expand Up @@ -85,9 +85,9 @@
<aside class="col-md-4 sidebar">
<div class="widget"><h4 class="title">社区</h4>
<div class="content community"><p>QQ群:462694081</p>
<p><a href="http://wenda.golaravel.com/" title="Laravel中文网问答社区" target="_blank"
<p><a href="javascript:void(0)" title="" target="_blank"
onclick="_hmt.push(['_trackEvent', 'big-button', 'click', '问答社区'])"><i
class="fa fa-comments"></i> 问答社区</a></p></div>
class="fa fa-comments"></i>问答社区</a></p></div>
</div>


Expand Down Expand Up @@ -245,23 +245,34 @@
$(document).ready(function(){

$.get("/story/top5/",function(data_s,status){
alert("Data: " + data_s + "\nStatus: " + status);
// alert("Data: " + data_s + "\nStatus: " + status);
data = JSON.parse(data_s)
$('#top1').text(data[0].fields["name"])
$('#top2').text(data[1].fields["name"])
$('#top3').text(data[2].fields["name"])
$('#top4').text(data[3].fields["name"])
$('#top5').text(data[4].fields["name"])
$('#top1').attr('href', "/story/detail/"+data[0].pk )
$('#top2').attr('href', "/story/detail/"+data[1].pk )
$('#top3').attr('href', "/story/detail/"+data[2].pk )
$('#top4').attr('href', "/story/detail/"+data[3].pk )
$('#top5').attr('href', "/story/detail/"+data[4].pk )

});

$.get("/video/top5/",function(data_v,status){
alert("Data: " + data_v + "\nStatus: " + status);
//alert("Data: " + data_v + "\nStatus: " + status);
data = JSON.parse(data_v)
$('#v_top1').text(data[0].fields["filename"])
$('#v_top2').text(data[1].fields["filename"])
$('#v_top3').text(data[2].fields["filename"])
$('#v_top4').text(data[3].fields["filename"])
$('#v_top5').text(data[4].fields["filename"])
$('#v_top1').attr('href', "/video/detail/"+data[0].fields["store_path"] )
$('#v_top2').attr('href', "/video/detail/"+data[1].fields["store_path"] )
$('#v_top3').attr('href', "/video/detail/"+data[2].fields["store_path"] )
$('#v_top4').attr('href', "/video/detail/"+data[3].fields["store_path"] )
$('#v_top5').attr('href', "/video/detail/"+data[4].fields["store_path"] )
});
});

Expand Down
9 changes: 2 additions & 7 deletions templates/story_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,8 @@
</div>

<div class="pagecontent" style="float:right;margin:6px 0px 0 0px;">
<span class="pg">
<b>1</b>
<a href="/kj_yy_p2.html">2</a> <a href="/kj_yy_p3.html">3</a> <a href="/kj_yy_p4.html">4</a> <span class="pge">...</span>
<a href="/kj_yy_p11.html">11</a>
</span>
<span class="pgnext"><a href="/kj_yy_p2.html">下一页</a></span>
<span class="total">共488集</span>


</div>
</div>
</body>
Expand Down
6 changes: 3 additions & 3 deletions templates/user_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ <h1>个人信息</h1><span style="margin-left:30px">{{ status }}</span>
<i class="error-tips"></i>
</li>
<li>手&nbsp;&nbsp;机&nbsp;&nbsp;号:
<input type="text" name="mobile" id="mobile" placeholder="请输入你的手机号码" value="{{ user.mobile }}" maxlength="10">
<input type="text" name="mobile" id="mobile" placeholder="请输入你的手机号码" value="{{ user.mobile }}" maxlength="12">
</li>
<li>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱:
<input class="borderno" type="text" name="email" readonly="readonly" value="{{ user.email }}"/>
<span class="green changeemai_btn">[修改]</span>
<input class="text" type="text" name="email" value="{{ user.email }}"/>

</li>
<li class="button heibtn">
<input type="submit" id="jsEditUserBtn" value="保存">
Expand Down
2 changes: 1 addition & 1 deletion video/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
urlpatterns = [

url(r'list/$', views.list),
url(r'detail/(\d-\d).flv$', views.detail),
url(r'detail/(\d+-\d+).flv$', views.detail),
url(r'episode/(?P<slug>\d+)$', views.episode),
url(r'top5/$', views.top5),

Expand Down
Loading

0 comments on commit ef52778

Please sign in to comment.