diff --git a/public/static/admin/js/common.js b/public/static/admin/js/common.js
index 35afe27f..df4b7e01 100644
--- a/public/static/admin/js/common.js
+++ b/public/static/admin/js/common.js
@@ -15,6 +15,24 @@ layui.use(['jquery', 'form', 'element', 'layer', 'dropdown'], function () {
$.ajaxSetup({
beforeSend: function (xhr) {
xhr.setRequestHeader('X-Csrf-Token', $token.attr('content'));
+ },
+ statusCode: {
+ 400: function (xhr) {
+ var res = JSON.parse(xhr.responseText);
+ layer.msg(res.msg, {icon: 2, anim: 6});
+ },
+ 401: function () {
+ layer.msg('操作之前请先登录', {icon: 2, anim: 6});
+ },
+ 403: function () {
+ layer.msg('操作受限', {icon: 2, anim: 6});
+ },
+ 404: function () {
+ layer.msg('资源不存在', {icon: 2, anim: 6});
+ },
+ 500: function () {
+ layer.msg('服务器内部错误', {icon: 2, anim: 6});
+ }
}
});
@@ -92,10 +110,6 @@ layui.use(['jquery', 'form', 'element', 'layer', 'dropdown'], function () {
data: {priority: priority},
success: function (res) {
layer.msg(res.msg, {icon: 1});
- },
- error: function (xhr) {
- var json = JSON.parse(xhr.responseText);
- layer.msg(json.msg, {icon: 2});
}
});
});
@@ -116,10 +130,6 @@ layui.use(['jquery', 'form', 'element', 'layer', 'dropdown'], function () {
} else {
window.location.reload();
}
- },
- error: function (xhr) {
- var json = JSON.parse(xhr.responseText);
- layer.msg(json.msg, {icon: 2});
}
});
});
diff --git a/public/static/web/css/common.css b/public/static/web/css/common.css
index 7b42dcc1..2f542ed2 100644
--- a/public/static/web/css/common.css
+++ b/public/static/web/css/common.css
@@ -45,6 +45,7 @@
}
.breadcrumb {
+ position: relative;
margin-bottom: 20px;
}
@@ -419,6 +420,12 @@ body {
margin-right: 20px;
}
+.breadcrumb .share {
+ position: absolute;
+ top: 2px;
+ right: -5px;
+}
+
.course-meta .cover {
float: left;
margin-right: 10px;
@@ -498,7 +505,7 @@ body {
}
.course-details {
- font-size: 12px;
+ line-height: 1.8em;
color: #666;
}
@@ -709,6 +716,10 @@ body {
font-style: normal;
}
+.sidebar-card .layui-card-header {
+ text-align: center;
+}
+
.sidebar-order .order {
margin-bottom: 10px;
}
@@ -792,19 +803,6 @@ body {
margin-right: 10px;
}
-.sidebar-chapter {
- padding: 20px 15px;
-}
-
-.sidebar-chapter .layui-field-title {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-.sidebar-chapter .layui-field-title legend {
- text-align: center;
-}
-
.sidebar-chapter-list {
height: 405px;
overflow-y: auto;
@@ -822,7 +820,6 @@ body {
.sidebar-lesson-list .lesson-title {
line-height: 30px;
- font-size: 12px;
}
.lesson-title .active {
@@ -838,24 +835,10 @@ body {
}
.read-info {
- min-height: 454px;
+ min-height: 428px;
margin-bottom: 0;
}
-.chapter-action {
- height: 32px;
- line-height: 32px;
- margin-bottom: 0;
-}
-
-.chapter-action .share {
- float: left;
-}
-
-.chapter-action .danmu-form {
- float: right;
-}
-
.share .layui-icon {
margin-right: 5px;
cursor: pointer;
@@ -878,35 +861,46 @@ body {
color: #666;
}
-.danmu-form .icon-danmu-set {
- margin-right: 5px;
-}
-
-.danmu-form .layui-input {
- width: 500px;
- height: 32px;
- display: inline;
- line-height: 32px;
- font-size: 12px;
-}
-
.player-wrap {
position: relative;
width: 760px;
height: 428px;
+ margin-bottom: 0;
}
-.chat-wrap {
- padding: 10px 20px 20px 20px;
- background-color: white;
+.danmu-form {
+ position: relative;
+ left: 180px;
+ bottom: 38px;
+ width: 420px;
+ display: none;
}
-.vip-icon {
- color: orange;
+.danmu-form .icon-danmu-set {
+ margin-right: 5px;
+ color: white;
+}
+
+.danmu-form .layui-input {
+ width: 380px;
+ height: 28px;
+ display: inline;
+ line-height: 28px;
+ font-size: 12px;
+ color: white;
+ background-color: rgba(255, 255, 255, 0.1);
+}
+
+.chat-wrap .layui-card-header {
+ text-align: center;
+}
+
+.chat-wrap .layui-card-body {
+ padding-bottom: 20px;
}
.chat-msg-list {
- height: 380px;
+ height: 354px;
margin-bottom: 10px;
overflow-y: auto;
}
@@ -929,37 +923,21 @@ body {
color: orange;
}
+.chat .icon-vip {
+ color: orange;
+}
+
.chat .content {
color: #666;
}
-.chat-login-tips {
- border-top: 1px solid #f2f2f2;
- padding-top: 10px;
- text-align: center;
- font-size: 12px;
- color: #999;
-}
-
.chat-msg-form .layui-input {
height: 32px;
+ line-height: 32px;
font-size: 12px;
color: #666;
}
-.live-stats {
- height: 420px;
- color: #666;
-}
-
-.live-stats .stats {
- margin-bottom: 15px;
-}
-
-.live-stats .count {
- margin-right: 10px;
-}
-
.vip-header {
font-size: 18px;
text-align: center;
@@ -1213,7 +1191,7 @@ body {
border-radius: 100px;
}
-.user-profile .vip-icon {
+.user-profile .icon-vip {
color: orange;
}
diff --git a/public/static/web/js/live.im.js b/public/static/web/js/chapter.live.im.js
similarity index 97%
rename from public/static/web/js/live.im.js
rename to public/static/web/js/chapter.live.im.js
index 57bd40b4..5555799c 100644
--- a/public/static/web/js/live.im.js
+++ b/public/static/web/js/chapter.live.im.js
@@ -66,7 +66,7 @@ layui.use(['jquery', 'form', 'helper'], function () {
function showNewMessage(res) {
var html = '
';
if (res.user.vip === 1) {
- html += '
';
+ html += '
';
}
html += '
' + res.user.name + ':';
html += '
' + res.content + '';
diff --git a/public/static/web/js/live.player.js b/public/static/web/js/chapter.live.player.js
similarity index 100%
rename from public/static/web/js/live.player.js
rename to public/static/web/js/chapter.live.player.js
diff --git a/public/static/web/js/read.js b/public/static/web/js/chapter.read.js
similarity index 100%
rename from public/static/web/js/read.js
rename to public/static/web/js/chapter.read.js
diff --git a/public/static/web/js/vod.player.js b/public/static/web/js/chapter.vod.player.js
similarity index 90%
rename from public/static/web/js/vod.player.js
rename to public/static/web/js/chapter.vod.player.js
index 96b6c075..d8766fd2 100644
--- a/public/static/web/js/vod.player.js
+++ b/public/static/web/js/chapter.vod.player.js
@@ -56,10 +56,34 @@ layui.use(['jquery', 'form', 'layer', 'helper'], function () {
player.currentTime(position);
}
+ $('.icon-danmu-set').on('click', function () {
+ layer.open({
+ type: 1,
+ title: '弹幕设置',
+ area: '600px',
+ shadeClose: true,
+ content: $('#my-danmu-set')
+ });
+ });
+
+ var dt = null;
+
+ /**
+ * 控制弹幕表单的可见性
+ */
+ $('#player').hover(function () {
+ clearTimeout(dt);
+ $('.danmu-form').show();
+ }, function () {
+ dt = setTimeout(function () {
+ $('.danmu-form').hide();
+ }, 2500);
+ });
+
$('#danmu').danmu({
left: 20,
top: 20,
- width: 750,
+ width: 760,
height: 380
});
@@ -101,10 +125,6 @@ layui.use(['jquery', 'form', 'layer', 'helper'], function () {
isnew: 1
});
$danmuText.val('');
- },
- error: function (xhr) {
- var res = JSON.parse(xhr.responseText);
- layer.msg(res.msg, {icon: 2});
}
});
return false;
diff --git a/public/static/web/js/common.js b/public/static/web/js/common.js
index 63f6b2cb..6ec73ea3 100644
--- a/public/static/web/js/common.js
+++ b/public/static/web/js/common.js
@@ -16,6 +16,24 @@ layui.use(['jquery', 'form', 'element', 'layer', 'helper'], function () {
$.ajaxSetup({
beforeSend: function (xhr) {
xhr.setRequestHeader('X-Csrf-Token', $token.attr('content'));
+ },
+ statusCode: {
+ 400: function (xhr) {
+ var res = JSON.parse(xhr.responseText);
+ layer.msg(res.msg, {icon: 2, anim: 6});
+ },
+ 401: function () {
+ layer.msg('操作之前请先登录', {icon: 2, anim: 6});
+ },
+ 403: function () {
+ layer.msg('操作受限', {icon: 2, anim: 6});
+ },
+ 404: function () {
+ layer.msg('资源不存在', {icon: 2, anim: 6});
+ },
+ 500: function () {
+ layer.msg('服务器内部错误', {icon: 2, anim: 6});
+ }
}
});
@@ -74,10 +92,6 @@ layui.use(['jquery', 'form', 'element', 'layer', 'helper'], function () {
} else {
window.location.reload();
}
- },
- error: function (xhr) {
- var json = JSON.parse(xhr.responseText);
- layer.msg(json.msg, {icon: 2});
}
});
});
diff --git a/public/static/web/js/chapter.action.js b/public/static/web/js/course.share.js
similarity index 54%
rename from public/static/web/js/chapter.action.js
rename to public/static/web/js/course.share.js
index 19d0b73d..5a99cc27 100644
--- a/public/static/web/js/chapter.action.js
+++ b/public/static/web/js/course.share.js
@@ -1,8 +1,7 @@
-layui.use(['jquery', 'layer', 'helper'], function () {
+layui.use(['jquery', 'layer'], function () {
var $ = layui.jquery;
var layer = layui.layer;
- var helper = layui.helper;
var myShare = {
title: $('input[name="share.title"]').val(),
@@ -11,16 +10,28 @@ layui.use(['jquery', 'layer', 'helper'], function () {
qrcode: $('input[name="share.qrcode"]').val()
};
+ $('.icon-heart').on('click', function () {
+ var $this = $(this);
+ $.ajax({
+ type: 'POST',
+ url: $this.parent().data('url'),
+ success: function () {
+ if ($this.hasClass('active')) {
+ $this.removeClass('active');
+ } else {
+ $this.addClass('active');
+ }
+ }
+ });
+ });
+
$('.icon-praise').on('click', function () {
var $this = $(this);
var $likeCount = $this.next();
var likeCount = parseInt($likeCount.text());
$.ajax({
type: 'POST',
- url: $this.data('url'),
- beforeSend: function () {
- return helper.checkLogin();
- },
+ url: $this.parent().data('url'),
success: function () {
if ($this.hasClass('active')) {
$this.removeClass('active');
@@ -31,10 +42,6 @@ layui.use(['jquery', 'layer', 'helper'], function () {
$likeCount.text(likeCount + 1);
likeCount += 1;
}
- },
- error: function (xhr) {
- var res = JSON.parse(xhr.responseText);
- layer.msg(res.msg, {icon: 2});
}
});
});
@@ -52,22 +59,28 @@ layui.use(['jquery', 'layer', 'helper'], function () {
$('.icon-qq').on('click', function () {
var title = '推荐一门好课:' + myShare.title + ',快来和我一起学习吧!';
- Share.qq(title, myShare.url, myShare.pic);
+ qqShare(title, myShare.url, myShare.pic);
});
$('.icon-weibo').on('click', function () {
var title = '推荐一门好课:' + myShare.title + ',快来和我一起学习吧!';
- Share.weibo(title, myShare.url, myShare.pic);
+ weiboShare(title, myShare.url, myShare.pic);
});
- $('.icon-danmu-set').on('click', function () {
- layer.open({
- type: 1,
- title: '弹幕设置',
- area: '600px',
- shadeClose: true,
- content: $('#my-danmu-set')
- });
- });
+ function qqShare(title, url, pic) {
+ var shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?';
+ shareUrl += 'title=' + encodeURIComponent(title || document.title);
+ shareUrl += '&url=' + encodeURIComponent(url || document.location);
+ shareUrl += '&pics=' + pic;
+ window.open(shareUrl, '_blank');
+ }
+
+ function weiboShare(title, url, pic) {
+ var shareUrl = 'http://v.t.sina.com.cn/share/share.php?';
+ shareUrl += 'title=' + encodeURIComponent(title || document.title);
+ shareUrl += '&url=' + encodeURIComponent(url || document.location);
+ shareUrl += '&pic=' + encodeURIComponent(pic || '');
+ window.open(shareUrl, '_blank');
+ }
});
\ No newline at end of file
diff --git a/public/static/web/js/course.show.js b/public/static/web/js/course.show.js
index d27c4469..ab0e5b20 100644
--- a/public/static/web/js/course.show.js
+++ b/public/static/web/js/course.show.js
@@ -4,13 +4,6 @@ layui.use(['jquery', 'layer', 'helper'], function () {
var layer = layui.layer;
var helper = layui.helper;
- var myShare = {
- title: $('input[name="share.title"]').val(),
- pic: $('input[name="share.cover"]').val(),
- url: $('input[name="share.url"]').val(),
- qrcode: $('input[name="share.qrcode"]').val()
- };
-
$('.rating-btn').on('click', function () {
var url = $(this).data('url');
layer.open({
@@ -21,59 +14,13 @@ layui.use(['jquery', 'layer', 'helper'], function () {
});
});
- $('.icon-heart').on('click', function () {
- var $this = $(this);
- $.ajax({
- type: 'POST',
- url: $this.parent().data('url'),
- beforeSend: function () {
- return helper.checkLogin();
- },
- success: function () {
- if ($this.hasClass('active')) {
- $this.removeClass('active');
- } else {
- $this.addClass('active');
- }
- },
- error: function (xhr) {
- var res = JSON.parse(xhr.responseText);
- layer.msg(res.msg, {icon: 2});
- }
- });
- });
-
- $('.icon-wechat').on('click', function () {
- var content = '

';
- layer.open({
- type: 1,
- title: false,
- closeBtn: 0,
- shadeClose: true,
- content: content
- });
- });
-
- $('.icon-qq').on('click', function () {
- var title = '推荐一门好课:' + myShare.title + ',快来和我一起学习吧!';
- Share.qq(title, myShare.url, myShare.pic);
- });
-
- $('.icon-weibo').on('click', function () {
- var title = '推荐一门好课:' + myShare.title + ',快来和我一起学习吧!';
- Share.weibo(title, myShare.url, myShare.pic);
- });
-
$('body').on('click', '.icon-praise', function () {
var $this = $(this);
var $likeCount = $this.next();
var likeCount = parseInt($likeCount.text());
$.ajax({
type: 'POST',
- url: $this.data('url'),
- beforeSend: function () {
- return helper.checkLogin();
- },
+ url: $this.parent().data('url'),
success: function () {
if ($this.hasClass('active')) {
$this.removeClass('active');
@@ -84,10 +31,6 @@ layui.use(['jquery', 'layer', 'helper'], function () {
$likeCount.text(likeCount + 1);
likeCount += 1;
}
- },
- error: function (xhr) {
- var res = JSON.parse(xhr.responseText);
- layer.msg(res.msg, {icon: 2});
}
});
});
diff --git a/public/static/web/js/im.find.js b/public/static/web/js/im.find.js
index 7ae3284d..ad209d4e 100644
--- a/public/static/web/js/im.find.js
+++ b/public/static/web/js/im.find.js
@@ -34,10 +34,6 @@ layui.use(['jquery', 'form', 'layer', 'layim', 'helper'], function () {
success: function (res) {
layer.msg(res.msg, {icon: 1});
layer.close(index);
- },
- error: function (xhr) {
- var res = JSON.parse(xhr.responseText);
- layer.msg(res.msg, {icon: 2});
}
});
}
@@ -63,10 +59,6 @@ layui.use(['jquery', 'form', 'layer', 'layim', 'helper'], function () {
success: function (res) {
layer.msg(res.msg, {icon: 1});
layer.close(index);
- },
- error: function (xhr) {
- var res = JSON.parse(xhr.responseText);
- layer.msg(res.msg, {icon: 2});
}
});
}
diff --git a/public/static/web/js/share.js b/public/static/web/js/share.js
deleted file mode 100644
index 86466c9d..00000000
--- a/public/static/web/js/share.js
+++ /dev/null
@@ -1,17 +0,0 @@
-var Share = {};
-
-Share.qq = function (title, url, pic) {
- var shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?';
- shareUrl += 'title=' + encodeURIComponent(title || document.title);
- shareUrl += '&url=' + encodeURIComponent(url || document.location);
- shareUrl += '&pics=' + pic;
- window.open(shareUrl, '_blank');
-};
-
-Share.weibo = function (title, url, pic) {
- var shareUrl = 'http://v.t.sina.com.cn/share/share.php?';
- shareUrl += 'title=' + encodeURIComponent(title || document.title);
- shareUrl += '&url=' + encodeURIComponent(url || document.location);
- shareUrl += '&pic=' + encodeURIComponent(pic || '');
- window.open(shareUrl, '_blank');
-};
\ No newline at end of file