|
|
|
@ -7,11 +7,36 @@ var taJian = {
@@ -7,11 +7,36 @@ var taJian = {
|
|
|
|
|
domain: 'https://tajian.tv', |
|
|
|
|
apis: { |
|
|
|
|
addVideos: '/frontapi/addfav', //添加视频
|
|
|
|
|
register: '/frontapi/register', //注册
|
|
|
|
|
login: '/frontapi/login' //登入
|
|
|
|
|
register: '/frontapi/createuser', //注册
|
|
|
|
|
login: '/frontapi/loginuser' //登入
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
var publicAjax = function(apiUrl, method, datas, callback, fail) { |
|
|
|
|
let self = this; |
|
|
|
|
|
|
|
|
|
let Options = { |
|
|
|
|
url: apiUrl, |
|
|
|
|
method: method, |
|
|
|
|
data: datas, |
|
|
|
|
dataType: 'json' |
|
|
|
|
}; |
|
|
|
|
if (self.debug) { |
|
|
|
|
Options.crossDomain = true; |
|
|
|
|
Options.xhrFields = { |
|
|
|
|
withCredentials: true |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$.ajax(Options).done(function(data) { |
|
|
|
|
callback(data); |
|
|
|
|
}).fail(function (jqXHR, textStatus, errorThrown) { |
|
|
|
|
|
|
|
|
|
fail(jqXHR, textStatus, errorThrown); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//多用户支持
|
|
|
|
|
if (typeof(current_user_id) != 'undefined' && current_user_id) { |
|
|
|
|
for (var apiKey in taJian.apis) { |
|
|
|
@ -79,7 +104,6 @@ if ($('.search_mob_JS').get(0)) {
@@ -79,7 +104,6 @@ if ($('.search_mob_JS').get(0)) {
|
|
|
|
|
|
|
|
|
|
// 搜索相关
|
|
|
|
|
$('#search_form .jsbtn').click(function (e) { |
|
|
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
if (!$('#search_form .input_sf_JS').val()) { |
|
|
|
|
|
|
|
|
@ -114,7 +138,6 @@ if ($('#add_video_form').get(0)) {
@@ -114,7 +138,6 @@ if ($('#add_video_form').get(0)) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let apiUrl = taJian.debug ? taJian.domain + taJian.apis.addVideos : taJian.apis.addVideos; |
|
|
|
|
// console.log(apiUrl);
|
|
|
|
|
publicAjax(apiUrl, 'POST', datas, function (data) { |
|
|
|
|
bt.prop('disabled', false); |
|
|
|
|
btText.text('提交'); |
|
|
|
@ -128,9 +151,8 @@ if ($('#add_video_form').get(0)) {
@@ -128,9 +151,8 @@ if ($('#add_video_form').get(0)) {
|
|
|
|
|
}, function (jqXHR, textStatus, errorThrown) { |
|
|
|
|
bt.prop('disabled', false); |
|
|
|
|
btText.text('提交'); |
|
|
|
|
btLoading.removeClass('elementNone'); |
|
|
|
|
console.log(jqXHR); |
|
|
|
|
|
|
|
|
|
btLoading.addClass('elementNone'); |
|
|
|
|
alert('网络请求失败,请重试。'); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -161,32 +183,7 @@ if ($('.g_form_js').get(0)) {
@@ -161,32 +183,7 @@ if ($('.g_form_js').get(0)) {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function publicAjax(apiUrl, method, datas, callback, fail) { |
|
|
|
|
let self = this; |
|
|
|
|
|
|
|
|
|
let Options = { |
|
|
|
|
url: apiUrl, |
|
|
|
|
method: method, |
|
|
|
|
data: datas, |
|
|
|
|
dataType: 'json' |
|
|
|
|
}; |
|
|
|
|
if (self.debug) { |
|
|
|
|
Options.crossDomain = true; |
|
|
|
|
Options.xhrFields = { |
|
|
|
|
withCredentials: true |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$.ajax(Options).done(function (data) { |
|
|
|
|
callback(data); |
|
|
|
|
}).fail(function (jqXHR, textStatus, errorThrown) { |
|
|
|
|
|
|
|
|
|
fail(jqXHR, textStatus, errorThrown); |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 注册
|
|
|
|
|
// 注册/登录等页面展示客服微信二维码切换按钮
|
|
|
|
|
if ($('.bt_kf_JS').get(0)) { |
|
|
|
|
var kf_hide_text = $('.bt_kf_JS').attr('data-hide'), |
|
|
|
|
kf_text = $('.bt_kf_JS').text(); |
|
|
|
@ -200,11 +197,109 @@ if ($('.bt_kf_JS').get(0)) {
@@ -200,11 +197,109 @@ if ($('.bt_kf_JS').get(0)) {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var win_width = $(window).width(); |
|
|
|
|
if (win_width > 768 && $('.tajian_index').get(0)) { |
|
|
|
|
$('.bt_kf_JS').click().addClass('hide'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 注册
|
|
|
|
|
if ($('#register_form').get(0)) { |
|
|
|
|
$('#register_form .jsbtn').click(function(e) { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
|
|
var friends_code = $('input[name=friendscode]').val(), |
|
|
|
|
cellphone = $('input[name=username]').val(), |
|
|
|
|
smscode = $('input[name=smscode]').val(); |
|
|
|
|
|
|
|
|
|
if (!friends_code || !cellphone || !smscode) { |
|
|
|
|
alert('请填写完整再注册!'); |
|
|
|
|
return false; |
|
|
|
|
}else if (!friends_code) { |
|
|
|
|
alert('请填写邀请码:朋友的手机尾号 6 位(或加客服微信索要)!'); |
|
|
|
|
return false; |
|
|
|
|
}else if (!cellphone) { |
|
|
|
|
alert('请填写手机号码!'); |
|
|
|
|
return false; |
|
|
|
|
}else if (!smscode) { |
|
|
|
|
alert('请填写你手机收到的短信验证码!'); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var bt = $(this), btLoading = bt.children('.bt_class_JS'), btText = bt.children('.bt_text_JS'); |
|
|
|
|
btLoading.removeClass('elementNone'); |
|
|
|
|
bt.prop('disabled', true); |
|
|
|
|
btText.text('提交中...'); |
|
|
|
|
|
|
|
|
|
var datas = { |
|
|
|
|
'friendscode': friends_code, |
|
|
|
|
'username': cellphone, |
|
|
|
|
'smscode': smscode |
|
|
|
|
}; |
|
|
|
|
publicAjax(taJian.apis.register, 'POST', datas, function (data) { |
|
|
|
|
btLoading.addClass('elementNone'); |
|
|
|
|
if (data.code == 1) { |
|
|
|
|
btText.text('完成'); |
|
|
|
|
alert(data.msg); |
|
|
|
|
} else { |
|
|
|
|
btText.text('注册'); |
|
|
|
|
bt.prop('disabled', false); |
|
|
|
|
alert(data.err); |
|
|
|
|
} |
|
|
|
|
}, function (jqXHR, textStatus, errorThrown) { |
|
|
|
|
bt.prop('disabled', false); |
|
|
|
|
btText.text('注册'); |
|
|
|
|
btLoading.addClass('elementNone'); |
|
|
|
|
alert('网络请求失败,请重试。'); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 登录
|
|
|
|
|
if ($('#login_form').get(0)) { |
|
|
|
|
$('#login_form .jsbtn').click(function(e) { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
|
|
var cellphone = $('input[name=username]').val(), |
|
|
|
|
smscode = $('input[name=smscode]').val(); |
|
|
|
|
|
|
|
|
|
if (!cellphone || !smscode) { |
|
|
|
|
alert('请填写完整再登录!'); |
|
|
|
|
return false; |
|
|
|
|
}else if (!cellphone) { |
|
|
|
|
alert('请填写手机号码!'); |
|
|
|
|
return false; |
|
|
|
|
}else if (!smscode) { |
|
|
|
|
alert('请填写你手机收到的短信验证码!'); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var bt = $(this), btLoading = bt.children('.bt_class_JS'), btText = bt.children('.bt_text_JS'); |
|
|
|
|
btLoading.removeClass('elementNone'); |
|
|
|
|
bt.prop('disabled', true); |
|
|
|
|
btText.text('提交中...'); |
|
|
|
|
|
|
|
|
|
var datas = { |
|
|
|
|
'username': cellphone, |
|
|
|
|
'smscode': smscode |
|
|
|
|
}; |
|
|
|
|
publicAjax(taJian.apis.login, 'POST', datas, function (data) { |
|
|
|
|
btLoading.addClass('elementNone'); |
|
|
|
|
if (data.code == 1) { |
|
|
|
|
btText.text('完成'); |
|
|
|
|
alert(data.msg); |
|
|
|
|
} else { |
|
|
|
|
btText.text('登录'); |
|
|
|
|
bt.prop('disabled', false); |
|
|
|
|
alert(data.err); |
|
|
|
|
} |
|
|
|
|
}, function (jqXHR, textStatus, errorThrown) { |
|
|
|
|
bt.prop('disabled', false); |
|
|
|
|
btText.text('登录'); |
|
|
|
|
btLoading.addClass('elementNone'); |
|
|
|
|
alert('网络请求失败,请重试。'); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
})(); |
|
|
|
|