Commit c642c031 by 陈超

T

parent 7495b9e2
......@@ -72,243 +72,24 @@
</script>
<script type="text/javascript">
var aTwotit=document.getElementsByClassName('two-tit');
for (var i=0;i<aTwotit.length;i++){
aTwotit[i].onclick=function () {
var me=$(this);
me.nextUntil("dt").toggle();
me.children('.onedown').toggle();
}
}
if("{$course_event['user_asb']['share_url']}"){
var share_url = "{$course_event['user_asb']['share_url']}";
}else{
var share_url = "{$share_url}";
}
var login_fun = function () {
var mhm_id = '{$this_mhm_id}';
if (mhm_id) {
window.location.href = "{:U('basic/Passport/login')}" + '?' + 'this_mhm_id' +
'=' + mhm_id;
} else {
window.location.href = "{:U('basic/Passport/login')}";
}
}
function payCourseHour() {
if (uid <= 0) {
ui.confirm('请先登录', {
yes: login_fun()
});
return false;
}
}
//window.location.href = "{:U('basic/Passport/login')}";
// function payCourseHour() {
// if (uid <= 0) {
// ui.confirm('请先登录', {
// yes: login_fun()
// });
// return false;
// }
// }
//解锁课时提示
$(".learn_note").click(function(){
ui.error('请先购买课程');
});
$(".learn_note2").click(function(){
ui.error('请先学习上一课时');
});
//点击助力弹出框
$('.friends-help').click(function(){
$('.addclas').toggleClass('active')
})
//第三方分享
$(".iconposition").click(function () {
clipboard('.iconposition', share_url);
});
//更多显示隐藏
$(".back_left .right_box .icon-gengduo1").click(function () {
if ($(this).siblings(".share_box").is(":hidden")) {
$(this).siblings(".share_box").show();
} else {
$(this).siblings(".share_box").hide();
}
})
$(".class_directory dt").click(function () {
if ($(this).siblings("dd").css("display") == "none") {
$(this).siblings("dd").show();
$(this).siblings(".lock_section").show()
} else {
$(this).siblings("dd").hide();
$(this).siblings(".lock_section").hide()
}
})
var uid = '{$uid}';
var mid = '{$uid}';
var albumId = '{$vid}';
var arr = ['他妈的', '你妈的', '傻×', '衮蛋', '你妹儿'];
//显示/隐藏 问题、笔记、点评输入框
$('.title a,.js-ipt-cancel').click(function () {
if (MID <= 0) {
ui.confirm('请先登录', {
yes: login_fun()
});
return false;
}
var types = $(this).attr('type');
$('#' + types + '-comments').toggle();
});
//点击评论取消按钮
$('.js-ipt-cancel').live('click', function () {
var cancel_id = $(this).siblings('button.js-ipt-submit').attr('sub_id');
var cancel_type = $(this).siblings('button.js-ipt-submit').attr('type');
$("#" + cancel_type + '_' + cancel_id).prev().find('.js-qa-tr-num').show();
$("#" + cancel_type + '_' + cancel_id).prev().find('.qa-tr-up').hide();
$("#" + cancel_type + '_' + cancel_id).hide();
//背景样式
$("#" + cancel_type + '_' + cancel_id).prev().find(".qa-total-reply.qa-icon").css("background-position",
"-25px -83px");
$("#" + cancel_type + '_' + cancel_id).prev().find(".js-qa-tr-num").css("display", "inline");
});
//点击收起评论
$('.qa-total-reply span.qa-tr-up').live('click', function () {
var cancel_id = $(this).attr('cancel_id');
var ctype = $(this).attr('type');
$("#" + ctype + "_" + cancel_id).hide();
$(this).css("display", "none");
$(this).siblings(".qa-total-reply .qa-icon").css("background-position", "-25px -83px");
$(this).siblings(".js-qa-tr-num").css("display", "inline");
});
//显示评论
$('.qa-total-reply .js-qa-tr-num').live('click', function () {
if (uid <= 0) {
ui.confirm('请先登录', {
yes: function () {
var mhm_id = '{$this_mhm_id}';
if (mhm_id) {
window.location.href = "{:U('basic/Passport/login')}" + '?' + 'this_mhm_id' +
'=' + mhm_id;
} else {
window.location.href = "{:U('basic/Passport/login')}";
}
}
});
return false;
}
$(this).css("display", "none"); //隐藏js-qa-tr-num
$(this).siblings(".qa-icon").css("background-position", "-25px -107px"); //显示js-qa-tr-num同级的qa-icon hover事件
$(this).siblings(".qa-tr-up").css({
"display": "inline",
"color": "#333333"
}); //显示js-qa-tr-num同级的qa-tr-up
var show_id = $(this).attr('show_id');
var stype = $(this).attr('type');
eval('var kztype=' + stype + '_kztype'); //数据分类 1:课程;2:套餐;
eval('var kzid=' + stype + '_kzid'); //课程或者套餐ID
eval('var type=' + stype + '_type'); //分类类型 1:提问,2:点评,3:笔记
// eval('var limit='+stype+'_limit'); //查询条数
eval('var page=' + stype + '_page'); //当前分页
$("#" + stype + "_" + show_id).show();
$.post("{:U('widget/Resource/getListForId')}", {
id: show_id,
type: type,
limit: 6
}, function (txt) {
showComment(txt.data, stype, show_id, txt.nowPage, txt.count);
}, 'json'); //post
});
//显示更多
$('.qa-reply-more .loadMore').live('click', function () {
var id = $(this).attr('more_id');
var moreType = $(this).attr('type');
var page = $(this).attr('page');
eval('var moreTypes=' + moreType + '_type'); //分类类型 1:提问,2:点评,3:笔记
eval('var limit=' + moreType + '_limit'); //查询条数
$.post("{:U('widget/Resource/getListForId')}", {
id: id,
type: moreTypes,
limit: limit,
p: page
}, function (txt) {
showComment(txt.data, moreType, id, txt.nowPage, txt.count);
}, 'json');
});
//@回复
$('.qst_reply').live('click', function () {
var atype = $(this).attr('type');
var reply_id = $(this).attr('reply_uid');
var id = $(this).attr('reply_id');
var name = $(this).parents('.qa-reply-item-foot').siblings('.username').find('a').text();
$('#' + atype + 'f_' + id).val('回复@' + name + ':');
$(this).parents('.qa-reply-c').siblings('.qa-reply-ibox').find('.reply_uid').val(reply_id);
//$('#'+atype+'_'+reply_id).val(reply_uid).attr('checktxt','回复@'+name);
});
//点评前判断
$('.js-reply-ipt-default').live('click', function () {
if (uid <= 0) {
ui.confirm('请先登录', {
yes: function () {
var mhm_id = '{$this_mhm_id}';
if (mhm_id) {
window.location.href = "{:U('basic/Passport/login')}" + '?' + 'this_mhm_id' +
'=' + mhm_id;
} else {
window.location.href = "{:U('basic/Passport/login')}";
}
}
});
return false;
}
});
//处理显示评论
function showComment(data, type, id, nowPage, count) {
var html = '';
$.each(data, function (i, k) {
html += '<div class="qa-reply-item">';
html += '<a class="qa-reply-item-author" href="' + k.user_src +
'" title="&#12288;"><img width="26" height="26" src="' + k.userface + '"></a>';
html += '<div class="qa-reply-item-inner">';
html += '<p class="username"> <a href="' + k.user_src + '" class="qa-reply-nick">' + k.username +
'</a> : </p>';
if (k.reply_user != '') {
html += '<p class="q-reply-item-c">回复@<span class="user-reply">' + k.reply_user + '</span>:' +
k.content + ' </p>';
} else {
html += '<p class="q-reply-item-c">' + k.content + ' </p>';
}
html +=
'<div class="qa-reply-item-foot clearfix"> <span class="reply-item-index r">#</span> <span>' +
k.strtime +
'</span> <span class="qa-reply-item-reply js-reply-item-reply qst_reply" reply_uid="' + k.uid +
'" type="' + type + '" reply_id="' + k.parent_id + '"><i class="qa-icon"></i>回复</span> </div>';
html += '</div>';
html += '</div>';
});
html += '<div class="qa-reply-more"><a page="' + (parseInt(nowPage) + 1) + '" class="loadMore" type="' + type +
'" more_id="' + id + '" href="javascript:;">击显示更多</a></div>';
if (nowPage <= 1) {
$("#" + type + "_" + id).find('.qa-reply-c').html('');
}
$("#" + type + "_" + id).find('.qa-reply-c').append(html);
$("#" + type + "_" + id).show();
if (count <= $("#" + type + "_" + id).find('.qa-reply-item').size()) {
$("#" + type + "_" + id).find('div.qa-reply-more').hide();
}
}
//导航选择卡
$(".choose").click(function () {
$(this).addClass("on").siblings().removeClass("on");
var index = $(this).index();
$(".videoInfo").hide().eq(index).show();
});
// $(".learn_note").click(function(){
// ui.error('请先购买课程');
// });
// $(".learn_note2").click(function(){
// ui.error('请先学习上一课时');
// });
//购买操作
$('#charge_video,.charge_video3').click(function () {
......@@ -400,75 +181,7 @@
return false;
}
}, 'json');
});
// 点击好友助力判断是否登录
function shijian1(){
if (uid <= 0) {
ui.confirm('请先登录', {
yes: function () {
var mhm_id = '{$this_mhm_id}';
if (mhm_id) {
window.location.href = "{:U('basic/Passport/login')}" + '?' + 'this_mhm_id' +
'=' + mhm_id;
} else {
window.location.href = "{:U('basic/Passport/login')}";
}
}
});
return false;
}
}
function shijian2(){
console.log('HHH')
}
function setFollow(uid, follow) {
if (mid <= 0) {
ui.confirm('请先登录', {
yes: function () {
window.location.href = "{:U('basic/Passport/login')}";
}
});
return false;
}
action = follow ? 'doFollowMhm' : 'unFollow';
$.post(U('basic/Follow/' + action), {
fid: uid
}, function (data) {
if (data.status) {
ui.success('操作成功');
setTimeout('window.location.reload()', 1000);
} else {
ui.error(data.info);
}
}, 'json');
}
//关注讲师
function followyou(cate, uid, id) {
if (mid <= 0) {
ui.confirm('请先登录', {
yes: function () {
window.location.href = "{:U('basic/Passport/login')}";
}
});
return false;
}
$.ajax({
type: "POST",
url: "{:U('classroom/Public/followyou')}",
data: "fid=" + uid + "&tid=" + id,
dataType: "json",
success: function (data) {
if (data.status == '0') {
ui.error(data.info);
return;
} else {
setTimeout('window.location.reload()', 1000);
}
}
});
}
})
//收藏课程
function collectVideo(cate, vid, type) {
......@@ -503,162 +216,18 @@
});
}
/*拼团弹出层*/
function assemble(vip,type,rtype){
$("#transparent").show();
$(".asblist-dl").show();
$(".assemble-Cancel").show();
}
function removeAssemble(){
$("#transparent").hide();
$(".asblist-dl").hide();
$(".assemble-Cancel").hide();
}
$(function(){
// 检查砍价
if("{$sponsor}" !== "0"){
$(".mask, .get-mon-box").show();
}
});
// 砍价
function showBargainList(){
if(MID<=0){
login_fun();
return false;
}
$(".mask, .get-mon-box").show();
}
$(".mask").on('click', function(){
if("{$sponsor}" === "0" || $(".kan-box-help").css('display') == 'flex'){
$(".mask, .get-mon-box").hide();
}
});
//邀请砍价
$(".sharebargain").click(function () {
var share_url = "{$bgnurl}";
clipboard('.sharebargain', share_url);
});
// 分享方法
var clipboard = function (e, url) {
var clipboard = new Clipboard(e, {
text: function () {
return url;
}
});
if (clipboard.text() != undefined && clipboard.text() != "") {
ui.success('已复制链接,请打开QQ或微信发送给好友');
$('.addclas').removeClass('active')
} else {
ui.error("复制失败,请手动复制");
layer.open({
title: [
'长按复制链接',
'background-color: #00cccd; color:#fff;'
],
content: "<textarea id='textcopy' autofocus readonly='readonly' onfocus='this.select()' style='width:100%;' type='text'>"+share_url+"</textarea>",
btn:false
});
setTimeout(()=>{
document.querySelector("#textcopy").onfocus()
},200)
}
}
// 为他砍价
$(".bargaining").click(function () {
if(MID<=0){
$(".mask, .get-mon-box").hide();
reg_login();
return false;
}
var vid = "<?php echo $_GET['id']; ?>",
sponsor = "{$sponsor}";
$.ajax({
type : 'POST',
url : "{:U('course/Video/bargaining')}",
data : {vid:vid,sponsor:sponsor, vtype:1},
dataType : "json",
success : function(data){
if (data.status == 9) {
return false;
} else if(data.status == 0) {
ui.error(data.info);
return false;
} else if(data.status == 1) {
$(".bargain").css('display', 'none');
$(".get-mon-help").css('display', 'none');
$(".kan-box-help").css('display', 'flex');
$(".kan-box-help-name em").text(data.info);
setTimeout(function(){
window.location.href = data.url;
}, 1500);
return false;
}
},
});
});
// 领取优惠券
$(".coupons .disc").click(function(){
if(MID == 0){
ui.confirm('请先登录', {
yes: function () {
var mhm_id='{$this_mhm_id}';
if(mhm_id){
window.location.href = "{:U('basic/Passport/login')}"+'?'+'this_mhm_id'+'='+mhm_id;
}else{
window.location.href = "{:U('basic/Passport/login')}";
}
}
});
return false;
}
var coupon_id = $(this).data('coupon-code');
$.post(U('classroom/CardReceipt/saveUSerCoupon'),{coupon_id:coupon_id},function(data){
if(data.status){
ui.success(data.info,{
end:function(){
window.location.reload();
}
});
}else{
ui.error(data.info);
}
},'json');
})
/*$(function(){
var swiper = new Swiper('.friends-picss .swiper-container',{
noSwiping : false
});
})*/
var swiper = new Swiper('.friends-picss .swiper-container',{
noSwiping : false,
noSwipingSelector: '.swiper-slide',
preventInteractionOnTransition : false
});
</script>
<script type="text/javascript" src="__THEME__/js/lazyload.js"></script>
<!-- <script type="text/javascript" src="__THEME__/js/lazyload.js"></script>
<if condition="$is_wx">
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script>
var jsconfig = JSON.parse('{$jsconfig}');
wx.config(jsconfig);
var desc = "{$seo['_keywords']}",
share_url = "{$share_url}",
img_url = "{:getCover($data['cover'] ,640 , 340 )}";
var link = window.location.href;
// 暂时注释,忘记当时为何写这段代码了
// if (link.indexOf('code') == -1 && share_url.indexOf("code") != -1) { // code 是url中自定义参数
// window.location.href = share_url;
// }
wx.ready(function () {
var wxData = {
link: share_url,
......@@ -672,6 +241,6 @@
wx.onMenuShareQZone(wxData);
});
</script>
</if>
</if> -->
<!--footer-->
<include file="__THEME__/public_footer_w3g" />
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment