|
|
|
|
/**
|
|
|
|
|
* Created by cxt on 2017/4/18.
|
|
|
|
|
*/
|
|
|
|
|
//---------------侧边固定提示功能---------------//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// window.onscroll=function(){
|
|
|
|
|
// var sl=-Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
|
|
|
|
|
// document.getElementById('nHeader').style.left=sl+'px';
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//= require jquery_ujs
|
|
|
|
|
$(function(){
|
|
|
|
|
//下拉框
|
|
|
|
|
$("[select-for]").append("<i class='fa fa-sort-desc lesson_img color-grey-8'></i>");
|
|
|
|
|
$("[select-for]").hover(function(){
|
|
|
|
|
$(this).find(".down-select").show();
|
|
|
|
|
},function(){
|
|
|
|
|
$(this).find(".down-select").hide();
|
|
|
|
|
});
|
|
|
|
|
$("[select-for] .down-select").on("click", "p", function(){
|
|
|
|
|
//alert($(this).attr("data-shixun-value"));
|
|
|
|
|
if($(this).attr("id") == "diy_script"){
|
|
|
|
|
return; // 实训新建-选择自定义脚本diy
|
|
|
|
|
}
|
|
|
|
|
$(this).parents(".down-select").siblings("input[type=hidden]").attr("value",$(this).attr("data-shixun-value"));
|
|
|
|
|
|
|
|
|
|
$(this).parents(".down-select").siblings("input[type=text]").val($(this).html().trim());
|
|
|
|
|
$(this).parents(".down-select").hide();
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 产生随机数
|
|
|
|
|
function getRandom(min, max){
|
|
|
|
|
var r = Math.random() * (max - min);
|
|
|
|
|
var re = Math.round(r + min);
|
|
|
|
|
re = Math.max(Math.min(re, max), min);
|
|
|
|
|
|
|
|
|
|
return re;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 邮箱验证
|
|
|
|
|
//功能:根据用户输入的Email跳转到相应的电子邮箱首页
|
|
|
|
|
function gotoEmail($mail) {
|
|
|
|
|
$t = $mail;
|
|
|
|
|
$t = $t.toLowerCase();
|
|
|
|
|
if ($t == '163.com') {
|
|
|
|
|
return 'mail.163.com';
|
|
|
|
|
} else if ($t == 'vip.163.com') {
|
|
|
|
|
return 'vip.163.com';
|
|
|
|
|
} else if ($t == '126.com') {
|
|
|
|
|
return 'mail.126.com';
|
|
|
|
|
} else if ($t == 'qq.com' || $t == 'vip.qq.com' || $t == 'foxmail.com') {
|
|
|
|
|
return 'mail.qq.com';
|
|
|
|
|
} else if ($t == 'gmail.com') {
|
|
|
|
|
return 'mail.google.com';
|
|
|
|
|
} else if ($t == 'sohu.com') {
|
|
|
|
|
return 'mail.sohu.com';
|
|
|
|
|
} else if ($t == 'tom.com') {
|
|
|
|
|
return 'mail.tom.com';
|
|
|
|
|
} else if ($t == 'vip.sina.com') {
|
|
|
|
|
return 'vip.sina.com';
|
|
|
|
|
} else if ($t == 'sina.com.cn' || $t == 'sina.com') {
|
|
|
|
|
return 'mail.sina.com.cn';
|
|
|
|
|
} else if ($t == 'tom.com') {
|
|
|
|
|
return 'mail.tom.com';
|
|
|
|
|
} else if ($t == 'yahoo.com.cn' || $t == 'yahoo.cn') {
|
|
|
|
|
return 'mail.cn.yahoo.com';
|
|
|
|
|
} else if ($t == 'tom.com') {
|
|
|
|
|
return 'mail.tom.com';
|
|
|
|
|
} else if ($t == 'yeah.net') {
|
|
|
|
|
return 'www.yeah.net';
|
|
|
|
|
} else if ($t == '21cn.com') {
|
|
|
|
|
return 'mail.21cn.com';
|
|
|
|
|
} else if ($t == 'hotmail.com') {
|
|
|
|
|
return 'www.hotmail.com';
|
|
|
|
|
} else if ($t == 'sogou.com') {
|
|
|
|
|
return 'mail.sogou.com';
|
|
|
|
|
} else if ($t == '188.com') {
|
|
|
|
|
return 'www.188.com';
|
|
|
|
|
} else if ($t == '139.com') {
|
|
|
|
|
return 'mail.10086.cn';
|
|
|
|
|
} else if ($t == '189.cn') {
|
|
|
|
|
return 'webmail15.189.cn/webmail';
|
|
|
|
|
} else if ($t == 'wo.com.cn') {
|
|
|
|
|
return 'mail.wo.com.cn/smsmail';
|
|
|
|
|
} else if ($t == '139.com') {
|
|
|
|
|
return 'mail.10086.cn';
|
|
|
|
|
} else if ($t == 'educoder.net'){
|
|
|
|
|
return 'qiye.aliyun.com'
|
|
|
|
|
} else {
|
|
|
|
|
return 'qiye.aliyun.com';
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//------------------弹框相关--------------------//
|
|
|
|
|
function hideModal(el) {
|
|
|
|
|
if($("#popupAll").length > 0){
|
|
|
|
|
$("#popupAll").remove();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
var modal;
|
|
|
|
|
if (el) {
|
|
|
|
|
modal = $(el).parents('.ui-dialog-content');
|
|
|
|
|
} else {
|
|
|
|
|
modal = $('#ajax-modal');
|
|
|
|
|
}
|
|
|
|
|
modal.dialog("close");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 公共弹框样式
|
|
|
|
|
// 建议左右栏的:Width:460,Height:190
|
|
|
|
|
// 建议宽屏对应值:Width:760,Height:500
|
|
|
|
|
function pop_box_new(value, Width, Height){
|
|
|
|
|
if($("#popupAll").length > 0){
|
|
|
|
|
$("#popupAll").remove();
|
|
|
|
|
}
|
|
|
|
|
w = ($(window).width() - Width)/2;
|
|
|
|
|
h = ($(window).height() - Height)/2;
|
|
|
|
|
var html="<div class=\"popupAll none\" id='popupAll'><div class=\"pr\"><div id=\"popupWrap\"></div></div></div>";
|
|
|
|
|
$(document.body).append(html);
|
|
|
|
|
$("#popupWrap").html(value);
|
|
|
|
|
$('#popupWrap').css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed","z-index":"99999","background-color":"#fff","border-radius":"10px"});
|
|
|
|
|
$("#popupWrap").parent().parent().show();
|
|
|
|
|
$('#popupWrap').find("a[class*='pop_close']").click(function(){
|
|
|
|
|
$("#popupAll").hide();
|
|
|
|
|
});
|
|
|
|
|
// w = ($(window).width() - Width)/2;
|
|
|
|
|
// h = ($(window).height() - Height)/2;
|
|
|
|
|
// $("#ajax-modal").html(value);
|
|
|
|
|
// showModal('ajax-modal', Width + 'px');
|
|
|
|
|
// $('#ajax-modal').siblings().remove();
|
|
|
|
|
// $('#ajax-modal').parent().css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed"});
|
|
|
|
|
// $('#ajax-modal').parent().removeClass("resourceUploadPopup popbox_polls popbox");
|
|
|
|
|
// $('#ajax-modal').css({"padding":"0","overflow":"hidden"});
|
|
|
|
|
// $('#ajax-modal').parent().attr("id","popupWrap");
|
|
|
|
|
|
|
|
|
|
//拖拽
|
|
|
|
|
function Drag(id) {
|
|
|
|
|
this.div = document.getElementById(id);
|
|
|
|
|
if (this.div) {
|
|
|
|
|
this.div.style.cursor = "move";
|
|
|
|
|
this.div.style.position = "fixed";
|
|
|
|
|
}
|
|
|
|
|
this.disX = 0;
|
|
|
|
|
this.disY = 0;
|
|
|
|
|
var _this = this;
|
|
|
|
|
this.div.onmousedown = function (evt) {
|
|
|
|
|
_this.getDistance(evt);
|
|
|
|
|
document.onmousemove = function (evt) {
|
|
|
|
|
_this.setPosition(evt);
|
|
|
|
|
};
|
|
|
|
|
_this.div.onmouseup = function () {
|
|
|
|
|
_this.clearEvent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Drag.prototype.getDistance = function (evt) {
|
|
|
|
|
var oEvent = evt || event;
|
|
|
|
|
this.disX = oEvent.clientX - this.div.offsetLeft;
|
|
|
|
|
this.disY = oEvent.clientY - this.div.offsetTop;
|
|
|
|
|
};
|
|
|
|
|
Drag.prototype.setPosition = function (evt) {
|
|
|
|
|
var oEvent = evt || event;
|
|
|
|
|
var l = oEvent.clientX - this.disX;
|
|
|
|
|
var t = oEvent.clientY - this.disY;
|
|
|
|
|
if (l <= 0) {
|
|
|
|
|
l = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (l >= document.documentElement.clientWidth - this.div.offsetWidth) {
|
|
|
|
|
l = document.documentElement.clientWidth - this.div.offsetWidth;
|
|
|
|
|
}
|
|
|
|
|
if (t <= 0) {
|
|
|
|
|
t = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (t >= document.documentElement.clientHeight - this.div.offsetHeight) {
|
|
|
|
|
t = document.documentElement.clientHeight - this.div.offsetHeight;
|
|
|
|
|
}
|
|
|
|
|
this.div.style.left = l + "px";
|
|
|
|
|
this.div.style.top = t + "px";
|
|
|
|
|
};
|
|
|
|
|
Drag.prototype.clearEvent = function () {
|
|
|
|
|
this.div.onmouseup = null;
|
|
|
|
|
document.onmousemove = null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
new Drag("popupWrap");
|
|
|
|
|
|
|
|
|
|
$("#popupWrap input, #popupWrap textarea, #popupWrap ul, #popupWrap a").mousedown(function(event){
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
new Drag("popupWrap");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 两个按钮 点击确认跳转, 提示信息有两行
|
|
|
|
|
function op_confirm_box(url, str){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:578px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3> <a href="javascript:void(0)" id="closeIcon" style="top: -48px;right: -20px;z-index: 100000;"><i class="iconfont icon-shanchudiao"></i></a></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
|
|
|
|
|
'<a href="'+ url +'" class="task-btn task-btn-orange fr" onclick="hideModal();">确定</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 578, 205);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function reward(url){
|
|
|
|
|
//var base64 = new Base64();
|
|
|
|
|
//url = base64.encode(url);
|
|
|
|
|
var html="<p><input type='text' placeholder='请输入奖励的金币数量' class='task-form-100' name='score' id='reward_input' style='box-sizing: border-box;margin: 0px auto;'/></p>";
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:350px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">奖励设置</h3> <a href="javascript:void(0)" id="closeIcon" style="top: -48px;right: -20px;z-index: 100000;"><i class="iconfont icon-shanchudiao"></i></a></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16" titile="请输入奖励的金币数量">' + html + '</p></div><div class="mt10 mb20 clearfix">' +
|
|
|
|
|
'<span class="color-orange fl none" id="reward_notice" style="margin-left: 15px;"><i class="fa fa-exclamation-circle mr5" ></i>奖励金币不能为空</span>' +
|
|
|
|
|
'<a href="javascript:void(0);" class="task-btn task-btn-orange fr mr15" onclick="reward_submit('+ "'"+ url + "'" +')">保存</a>'+
|
|
|
|
|
'<a href="javascript:void(0);" onclick="hideModal();" class="task-btn fr mr10">取消</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 350, 160);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提示框:只有一个按钮,点击关闭弹框
|
|
|
|
|
//<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
|
|
|
|
function notice_sure_box(str){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix">提示</div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-OK clearfix">'+
|
|
|
|
|
'<a href="javascript:void(0);" class="task-btn task-btn-orange" onclick="hideModal();">知道啦</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 480, 160);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 长提示框:只有一个确定按钮,点击关闭弹框
|
|
|
|
|
//<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
|
|
|
|
function long_notice_box(str){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:575px;"><div class="task-popup-title clearfix">提示</div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-sure clearfix">'+
|
|
|
|
|
'<a href="javascript:void(0);" class="task-btn task-btn-orange" onclick="hideModal();">确定</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 575, 160);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 长提示框:只有一个“知道啦”按钮,点击关闭弹框
|
|
|
|
|
//<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
|
|
|
|
function yes_notice_box(str){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:575px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-OK clearfix">'+
|
|
|
|
|
'<a href="javascript:void(0);" class="task-btn task-btn-orange" onclick="hideModal();">知道啦</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 575, 200);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提示框:只有一个知道啦按钮,点击打开新窗口
|
|
|
|
|
//<a href="'+ url +'" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
|
|
|
|
function sure_box_redirect(url, str){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-OK clearfix">'+
|
|
|
|
|
'<a href="'+ url +'" class="task-btn task-btn-orange" onclick="hideModal();" target="_blank">知道啦</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 480, 160);
|
|
|
|
|
}
|
|
|
|
|
function sure_box_redirect_btn(url, str,btnstr){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-OK clearfix">'+
|
|
|
|
|
'<a href="'+ url +'" class="task-btn task-btn-orange" onclick="hideModal();" target="_blank">'+btnstr+'</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 480, 160);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sure_box_redirect_btn2(url, str, btnstr){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:500px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3> <a href="javascript:void(0)" id="closeIcon" style="top: -48px;right: -20px;z-index: 100000;"><i class="iconfont icon-shanchudiao"></i></a></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-submit clearfix" style="width: 150px"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
|
|
|
|
|
'<a href="'+ url +'" class="task-btn task-btn-orange fr" target="_blank" onclick="hideModal();">'+btnstr+'</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 578, 205);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//提示框:只有一个知道啦按钮,点击打开新窗口
|
|
|
|
|
//<a href="'+ url +'" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
|
|
|
|
function sure_box_redirect_without_newtab(url, str){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-OK clearfix">'+
|
|
|
|
|
'<a href="'+ url +'" class="task-btn task-btn-orange" onclick="hideModal();" >知道啦</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 480, 160);
|
|
|
|
|
}
|
|
|
|
|
//按钮内容自定义
|
|
|
|
|
function sure_box_redirect_without_newtab_btn(url, str,btnstr){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-OK clearfix">'+
|
|
|
|
|
'<a href="'+ url +'" class="task-btn task-btn-orange" onclick="hideModal();" >'+btnstr+'</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 480, 160);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提示框:只有一个确定按钮,点击跳转
|
|
|
|
|
//<a href="'+ url +'" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
|
|
|
|
function notice_box_redirect(url, str){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-sure clearfix">'+
|
|
|
|
|
'<a href="'+ url +'" class="task-btn task-btn-orange" onclick="hideModal();">确定</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 480, 160);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提示框:只有一个确定按钮,点击跳转(局部刷新)
|
|
|
|
|
//<a href="'+ url +'" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
|
|
|
|
function notice_box_redirect_remote(url, str){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16">' + str + '</p></div><div class="task-popup-sure clearfix">'+
|
|
|
|
|
'<a href="'+ url +'" class="task-btn task-btn-orange" data-remote="true">确定</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 480, 160);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//重新登录
|
|
|
|
|
function re_entry(url){
|
|
|
|
|
var htmlvalue = '<div class="task-popup" style="width:480px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey3">提示</h3><a href="'+ url +'" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
|
|
|
|
|
'<div class="task-popup-content"><p class="task-popup-text-center font-16 mt10 mb10"><i class="fa fa-exclamation-circle color-orange04 mr10"></i>您的会话已退出,请重新登录^_^</p></div><div class="task-popup-right-sure clearfix">'+
|
|
|
|
|
'<a href="'+ url +'" class="task-btn task-btn-orange" data-remote="true">重新登录</a></div></div>';
|
|
|
|
|
pop_box_new(htmlvalue, 480, 160);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function reward_submit(url){
|
|
|
|
|
// var base64 = new Base64();
|
|
|
|
|
//url = base64.decode(url);
|
|
|
|
|
var score=$("input[name='score']").val();
|
|
|
|
|
console.log(score);
|
|
|
|
|
if($("input[name='score']").val() == ""){
|
|
|
|
|
$("#reward_notice").show();
|
|
|
|
|
}else{
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: url,
|
|
|
|
|
dataType: 'script',
|
|
|
|
|
data:{score: score}
|
|
|
|
|
});
|
|
|
|
|
hideModal();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 警告/提示弹框点击“x”关闭
|
|
|
|
|
$(function(){
|
|
|
|
|
$("button.task-close").live('click', function(){
|
|
|
|
|
$("button.task-close").parent().hide();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(function($){
|
|
|
|
|
$.fn.drag = function(options){
|
|
|
|
|
var x, drag = this, isMove = false, defaults = {
|
|
|
|
|
};
|
|
|
|
|
var options = $.extend(defaults, options);
|
|
|
|
|
//添加背景,文字,滑块
|
|
|
|
|
var html = '<div class="drag_bg"></div>'+
|
|
|
|
|
'<div class="drag_text" onselectstart="return false;" unselectable="on">拖动滑块验证</div>'+
|
|
|
|
|
'<div class="handler handler_bg"></div>';
|
|
|
|
|
this.append(html);
|
|
|
|
|
|
|
|
|
|
var handler = drag.find('.handler');
|
|
|
|
|
var drag_bg = drag.find('.drag_bg');
|
|
|
|
|
var text = drag.find('.drag_text');
|
|
|
|
|
var maxWidth = text.width() - handler.width(); //能滑动的最大间距
|
|
|
|
|
//鼠标按下时候的x轴的位置
|
|
|
|
|
handler.mousedown(function(e){
|
|
|
|
|
isMove = true;
|
|
|
|
|
x = e.pageX - parseInt(handler.css('left'), 10);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//鼠标指针在上下文移动时,移动距离大于0小于最大间距,滑块x轴位置等于鼠标移动距离
|
|
|
|
|
$(document).mousemove(function(e){
|
|
|
|
|
var _x = e.pageX - x;
|
|
|
|
|
var handler_offset = handler.offset();
|
|
|
|
|
var lastX = e.clientX -x;
|
|
|
|
|
lastX = Math.max(0,Math.min(maxWidth,lastX));
|
|
|
|
|
if(isMove){
|
|
|
|
|
if(_x > 0 && _x <= maxWidth){
|
|
|
|
|
handler.css({'left': lastX});
|
|
|
|
|
drag_bg.css({'width': lastX});
|
|
|
|
|
}
|
|
|
|
|
else if(lastX > maxWidth - 5 && lastX < maxWidth + 5 ){ //鼠标指针移动距离达到最大时清空事件
|
|
|
|
|
dragOk();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
handler.mouseup(function(e){
|
|
|
|
|
isMove = false;
|
|
|
|
|
var _x = e.pageX - x;
|
|
|
|
|
if(_x < maxWidth){ //鼠标松开时,如果没有达到最大距离位置,滑块就返回初始位置
|
|
|
|
|
handler.css({'left': 0});
|
|
|
|
|
drag_bg.css({'width': 0});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//清空事件
|
|
|
|
|
function dragOk(){
|
|
|
|
|
var kuaiwidth=drag.width() - handler.width();
|
|
|
|
|
handler.removeClass('handler_bg').addClass('handler_ok_bg');
|
|
|
|
|
handler.css({'left':kuaiwidth+'px'})
|
|
|
|
|
text.css({'width':kuaiwidth+'px'});
|
|
|
|
|
text.text('验证通过');
|
|
|
|
|
drag.css({'color': '#fff'});
|
|
|
|
|
drag_bg.css({'width':kuaiwidth+'px'})
|
|
|
|
|
handler.unbind('mousedown');
|
|
|
|
|
$(document).unbind('mousemove');
|
|
|
|
|
$(document).unbind('mouseup');
|
|
|
|
|
$("#user_verification_notice").html("");
|
|
|
|
|
$('#user_verification_notice').parent().hide();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
})(jQuery);
|
|
|
|
|
|
|
|
|
|
//初始化省份
|
|
|
|
|
function showprovince(id){
|
|
|
|
|
var arrary=["北京","上海","广东","江苏","浙江","重庆","安徽","福建","甘肃","广西","贵州","海南","河北","黑龙江","河南","湖北","湖南","江西","吉林","辽宁","内蒙古","宁夏","青海","山东","山西","陕西","四川","天津","新疆","西藏","云南","香港特别行政区","澳门特别行政区","台湾","海外"];
|
|
|
|
|
var html="<option value=\"0\">请选择所在省份</option>"
|
|
|
|
|
for(var i=0;i<arrary.length;i++){
|
|
|
|
|
var item=arrary[i];
|
|
|
|
|
html+="<option value=\""+item+"\">"+item+"</option>";
|
|
|
|
|
}
|
|
|
|
|
$("#"+id).html(html);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//省市下拉框
|
|
|
|
|
function showcity(province, cityField) {
|
|
|
|
|
switch (province) {
|
|
|
|
|
case "北京" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"东城", "西城", "朝阳", "丰台", "石景山", "海淀", "门头沟",
|
|
|
|
|
"房山", "通州", "顺义", "昌平", "大兴", "平谷", "怀柔", "密云", "延庆");
|
|
|
|
|
break;
|
|
|
|
|
case "上海" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"崇明", "黄浦", "卢湾", "徐汇", "长宁", "静安", "普陀", "闸北", "虹口", "杨浦", "闵行",
|
|
|
|
|
"宝山", "嘉定", "浦东", "金山", "松江", "青浦", "南汇", "奉贤");
|
|
|
|
|
break;
|
|
|
|
|
case "广东" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"广州", "深圳", "珠海", "东莞", "中山", "佛山", "惠州", "河源", "潮州", "江门", "揭阳", "茂名",
|
|
|
|
|
"梅州", "清远", "汕头", "汕尾", "韶关", "顺德", "阳江", "云浮", "湛江", "肇庆");
|
|
|
|
|
break;
|
|
|
|
|
case "江苏" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"南京", "常熟", "常州", "海门", "淮安", "江都", "江阴", "昆山", "连云港", "南通",
|
|
|
|
|
"启东", "沭阳", "宿迁", "苏州", "太仓", "泰州", "同里", "无锡", "徐州", "盐城",
|
|
|
|
|
"扬州", "宜兴", "仪征", "张家港", "镇江", "周庄");
|
|
|
|
|
break;
|
|
|
|
|
case "重庆" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"万州", "涪陵", "渝中", "大渡口", "江北", "沙坪坝", "九龙坡", "南岸", "北碚", "万盛",
|
|
|
|
|
"双挢", "渝北", "巴南", "黔江", "长寿", "綦江", "潼南", "铜梁", "大足", "荣昌", "壁山",
|
|
|
|
|
"梁平", "城口", "丰都", "垫江", "武隆", "忠县", "开县", "云阳", "奉节", "巫山", "巫溪",
|
|
|
|
|
"石柱", "秀山", "酉阳", "彭水", "江津", "合川", "永川", "南川");
|
|
|
|
|
break;
|
|
|
|
|
case "安徽" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"合肥", "安庆", "蚌埠", "亳州", "巢湖", "滁州", "阜阳", "贵池", "淮北", "淮化", "淮南",
|
|
|
|
|
"黄山", "九华山", "六安", "马鞍山", "宿州", "铜陵", "屯溪", "芜湖", "宣城");
|
|
|
|
|
break;
|
|
|
|
|
case "福建" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"福州", "厦门", "泉州", "漳州", "龙岩", "南平", "宁德", "莆田", "三明");
|
|
|
|
|
break;
|
|
|
|
|
case "甘肃" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"兰州", "白银", "定西", "敦煌", "甘南", "金昌", "酒泉", "临夏", "平凉", "天水",
|
|
|
|
|
"武都", "武威", "西峰", "张掖");
|
|
|
|
|
break;
|
|
|
|
|
case "广西" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"南宁", "百色", "北海", "桂林", "防城港", "贵港", "河池", "贺州", "柳州", "钦州", "梧州", "玉林");
|
|
|
|
|
break;
|
|
|
|
|
case "贵州" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"贵阳", "安顺", "毕节", "都匀", "凯里", "六盘水", "铜仁", "兴义", "玉屏", "遵义");
|
|
|
|
|
break;
|
|
|
|
|
case "海南" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"海口", "儋县", "陵水", "琼海", "三亚", "通什", "万宁");
|
|
|
|
|
break;
|
|
|
|
|
case "河北" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"石家庄", "保定", "北戴河", "沧州", "承德", "丰润", "邯郸", "衡水", "廊坊", "南戴河", "秦皇岛",
|
|
|
|
|
"唐山", "新城", "邢台", "张家口");
|
|
|
|
|
break;
|
|
|
|
|
case "黑龙江" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"哈尔滨", "北安", "大庆", "大兴安岭", "鹤岗", "黑河", "佳木斯", "鸡西", "牡丹江", "齐齐哈尔",
|
|
|
|
|
"七台河", "双鸭山", "绥化", "伊春");
|
|
|
|
|
break;
|
|
|
|
|
case "河南" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"郑州", "安阳", "鹤壁", "潢川", "焦作", "济源", "开封", "漯河", "洛阳", "南阳", "平顶山",
|
|
|
|
|
"濮阳", "三门峡", "商丘", "新乡", "信阳", "许昌", "周口", "驻马店");
|
|
|
|
|
break;
|
|
|
|
|
case "香港" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"香港", "九龙", "新界");
|
|
|
|
|
break;
|
|
|
|
|
case "湖北" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"武汉", "恩施", "鄂州", "黄冈", "黄石", "荆门", "荆州", "潜江", "十堰", "随州", "武穴",
|
|
|
|
|
"仙桃", "咸宁", "襄阳", "襄樊", "孝感", "宜昌");
|
|
|
|
|
break;
|
|
|
|
|
case "湖南" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"长沙", "常德", "郴州", "衡阳", "怀化", "吉首", "娄底", "邵阳", "湘潭", "益阳", "岳阳",
|
|
|
|
|
"永州", "张家界", "株洲");
|
|
|
|
|
break;
|
|
|
|
|
case "江西" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"南昌", "抚州", "赣州", "吉安", "景德镇", "井冈山", "九江", "庐山", "萍乡",
|
|
|
|
|
"上饶", "新余", "宜春", "鹰潭");
|
|
|
|
|
break;
|
|
|
|
|
case "吉林" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"长春", "吉林", "白城", "白山", "珲春", "辽源", "梅河", "四平", "松原", "通化", "延吉");
|
|
|
|
|
break;
|
|
|
|
|
case "辽宁" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"沈阳", "鞍山", "本溪", "朝阳", "大连", "丹东", "抚顺", "阜新", "葫芦岛", "锦州",
|
|
|
|
|
"辽阳", "盘锦", "铁岭", "营口");
|
|
|
|
|
break;
|
|
|
|
|
case "澳门" :
|
|
|
|
|
var cityOptions = new Array("澳门");
|
|
|
|
|
break;
|
|
|
|
|
case "内蒙古" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"呼和浩特", "阿拉善盟", "包头", "赤峰", "东胜", "海拉尔", "集宁", "临河", "通辽", "乌海",
|
|
|
|
|
"乌兰浩特", "锡林浩特");
|
|
|
|
|
break;
|
|
|
|
|
case "宁夏" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"银川", "固源", "石嘴山", "吴忠");
|
|
|
|
|
break;
|
|
|
|
|
case "青海" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"西宁", "德令哈", "格尔木", "共和", "海东", "海晏", "玛沁", "同仁", "玉树");
|
|
|
|
|
break;
|
|
|
|
|
case "山东" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"济南", "滨州", "兖州", "德州", "东营", "菏泽", "济宁", "莱芜", "聊城", "临沂",
|
|
|
|
|
"蓬莱", "青岛", "曲阜", "日照", "泰安", "潍坊", "威海", "烟台", "枣庄", "淄博");
|
|
|
|
|
break;
|
|
|
|
|
case "山西" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"太原", "长治", "大同", "候马", "晋城", "离石", "临汾", "宁武", "朔州", "忻州",
|
|
|
|
|
"阳泉", "榆次", "运城");
|
|
|
|
|
break;
|
|
|
|
|
case "陕西" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"西安", "安康", "宝鸡", "汉中", "渭南", "商州", "绥德", "铜川", "咸阳", "延安", "榆林");
|
|
|
|
|
break;
|
|
|
|
|
case "四川" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"成都", "巴中", "达川", "德阳", "都江堰", "峨眉山", "涪陵", "广安", "广元", "九寨沟",
|
|
|
|
|
"康定", "乐山", "泸州", "马尔康", "绵阳", "眉山", "南充", "内江", "攀枝花", "遂宁",
|
|
|
|
|
"汶川", "西昌", "雅安", "宜宾", "自贡", "资阳");
|
|
|
|
|
break;
|
|
|
|
|
case "台湾" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"台北", "基隆", "台南", "台中", "高雄", "屏东", "南投", "云林", "新竹", "彰化", "苗栗",
|
|
|
|
|
"嘉义", "花莲", "桃园", "宜兰", "台东", "金门", "马祖", "澎湖");
|
|
|
|
|
break;
|
|
|
|
|
case "天津" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"天津", "和平", "东丽", "河东", "西青", "河西", "津南", "南开", "北辰", "河北", "武清", "红挢",
|
|
|
|
|
"塘沽", "汉沽", "大港", "宁河", "静海", "宝坻", "蓟县");
|
|
|
|
|
break;
|
|
|
|
|
case "新疆" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"乌鲁木齐", "阿克苏", "阿勒泰", "阿图什", "博乐", "昌吉", "东山", "哈密", "和田", "喀什",
|
|
|
|
|
"克拉玛依", "库车", "库尔勒", "奎屯", "石河子", "塔城", "吐鲁番", "伊宁");
|
|
|
|
|
break;
|
|
|
|
|
case "西藏" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"拉萨", "阿里", "昌都", "林芝", "那曲", "日喀则", "山南");
|
|
|
|
|
break;
|
|
|
|
|
case "云南" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"昆明", "大理", "保山", "楚雄", "大理", "东川", "个旧", "景洪", "开远", "临沧", "丽江",
|
|
|
|
|
"六库", "潞西", "曲靖", "思茅", "文山", "西双版纳", "玉溪", "中甸", "昭通");
|
|
|
|
|
break;
|
|
|
|
|
case "浙江" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"杭州", "安吉", "慈溪", "定海", "奉化", "海盐", "黄岩", "湖州", "嘉兴", "金华", "临安",
|
|
|
|
|
"临海", "丽水", "宁波", "瓯海", "平湖", "千岛湖", "衢州", "江山", "瑞安", "绍兴", "嵊州",
|
|
|
|
|
"台州", "温岭", "温州", "余姚", "舟山");
|
|
|
|
|
break;
|
|
|
|
|
case "海外" :
|
|
|
|
|
var cityOptions = new Array(
|
|
|
|
|
"美国", "日本", "英国", "法国", "德国", "其他");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
var cityOptions = new Array("请选择所在城市");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cityField.options.length = 0;
|
|
|
|
|
for (var i = 0; i < cityOptions.length; i++) {
|
|
|
|
|
cityField.options[i] = new Option(cityOptions[i], cityOptions[i]);
|
|
|
|
|
/*
|
|
|
|
|
if (cityField.options[i].value==city)
|
|
|
|
|
{
|
|
|
|
|
//alert("here put City ok!");
|
|
|
|
|
document.oblogform["city"].selectedIndex = i;
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function throttle(method, context, e) {
|
|
|
|
|
clearTimeout(method.tId);
|
|
|
|
|
method.tId = setTimeout(function () {
|
|
|
|
|
method.call(context, e);
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function change_course_name(){
|
|
|
|
|
if($("#new_syllabus_id").val() != '0') {
|
|
|
|
|
$("#new_course_name").val($("#new_syllabus_id").find("option:selected").text());
|
|
|
|
|
$("#new_course_name").focus();
|
|
|
|
|
$("#new_course_syllabus_notice").hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function change_edit_course_name(){
|
|
|
|
|
var str = $("#course_real_name").val();
|
|
|
|
|
if($("#edit_syllabus_id").val() != '0') {
|
|
|
|
|
$("#edit_course_name").val($("#edit_syllabus_id").find("option:selected").text() + str);
|
|
|
|
|
$("#edit_course_syllabus_notice").hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证班级名称
|
|
|
|
|
function regex_course_name(str)
|
|
|
|
|
{
|
|
|
|
|
var name = $.trim($("#"+str+"_course_name").val());
|
|
|
|
|
var syl_title = "";
|
|
|
|
|
syl_title = $("#"+str+"_course_list").val().trim();
|
|
|
|
|
if(name.length < 2)
|
|
|
|
|
{
|
|
|
|
|
$("#"+str+"_course_name_notice").html('<i class="fa fa-exclamation-circle mr5" ></i>班级名称不能为空且至少有两个字符');
|
|
|
|
|
$("#"+str+"_course_name_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if(name.indexOf(syl_title) != 0){
|
|
|
|
|
$("#"+str+"_course_name_notice").html('<i class="fa fa-exclamation-circle mr5" ></i>请参照正确示例规范,应该以课程名称开头命名');
|
|
|
|
|
$("#"+str+"_course_name_notice").show();
|
|
|
|
|
$("#"+str+"_course_name").focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#"+str+"_course_name_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//验证班级学时
|
|
|
|
|
function regex_course_class_period(str)
|
|
|
|
|
{
|
|
|
|
|
var class_period = $.trim($("#"+str+"_class_period").val());
|
|
|
|
|
var regex = /^\d*$/;
|
|
|
|
|
if(class_period.length == 0)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (regex.test(class_period)) {
|
|
|
|
|
if(parseInt(class_period) > 0)
|
|
|
|
|
{
|
|
|
|
|
$("#"+str+"_course_class_period_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#"+str+"_course_class_period_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#"+str+"_course_class_period_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 验证学分
|
|
|
|
|
function regex_course_credit(str){
|
|
|
|
|
var credit = $.trim($("#"+str+"_course_credit").val());
|
|
|
|
|
var regex1 = /^\d*$/;
|
|
|
|
|
var regex2 = /^\d+[.]*\d$/;
|
|
|
|
|
if(credit.length == 0)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (regex1.test(credit) || regex2.test(credit)) {
|
|
|
|
|
$("#"+str+"_course_credit_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
} else{
|
|
|
|
|
$("#"+str+"_course_credit_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if(parseInt(credit) > 0)
|
|
|
|
|
// {
|
|
|
|
|
// $("#"+str+"_course_credit_notice").hide();
|
|
|
|
|
// return true;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// $("#"+str+"_course_credit_notice").show();
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// $("#"+str+"_course_credit_notice").show();
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
//验证课程大纲
|
|
|
|
|
function regex_syllabus_option(str) {
|
|
|
|
|
if(document.getElementById(str + "_course_list")) {
|
|
|
|
|
var obj = document.getElementById(str + "_course_list");
|
|
|
|
|
if($("#"+str+"_course_list").val().trim() == ""){
|
|
|
|
|
$("#"+str+"_course_syllabus_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
} else{
|
|
|
|
|
$("#"+str+"_course_syllabus_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$("#"+str+"_course_syllabus_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function regex_end_date(str) {
|
|
|
|
|
var end_date = $.trim($("#"+str+"_course_end_date").val());
|
|
|
|
|
if(end_date != ""){
|
|
|
|
|
end_date = new Date(end_date);
|
|
|
|
|
end_date = formate_date(end_date);
|
|
|
|
|
var curr_date = new Date();
|
|
|
|
|
curr_date = formate_date(curr_date);
|
|
|
|
|
if(curr_date >= end_date){
|
|
|
|
|
$("#"+str+"_course_end_date_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
} else{
|
|
|
|
|
$("#"+str+"_course_end_date_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$("#"+str+"_course_end_date_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提交新建课程
|
|
|
|
|
function submit_new_course()
|
|
|
|
|
{
|
|
|
|
|
var submit = false;
|
|
|
|
|
if(regex_syllabus_option('new')&®ex_course_name('new'))
|
|
|
|
|
{
|
|
|
|
|
submit = true;
|
|
|
|
|
if($.trim($("#new_class_period").val()) != ""){
|
|
|
|
|
submit = submit && regex_course_class_period('new');
|
|
|
|
|
}
|
|
|
|
|
if($.trim($("#new_course_credit").val()) != ""){
|
|
|
|
|
submit = submit && regex_course_credit('new');
|
|
|
|
|
}
|
|
|
|
|
if($.trim($("#new_course_end_date").val()) != ""){
|
|
|
|
|
submit = submit && regex_end_date('new')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(submit){
|
|
|
|
|
$("#new_course").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function submit_edit_course(id)
|
|
|
|
|
{
|
|
|
|
|
var submit = false;
|
|
|
|
|
if(regex_syllabus_option('edit')&®ex_course_name('edit'))
|
|
|
|
|
{
|
|
|
|
|
submit = true;
|
|
|
|
|
if($.trim($("#edit_class_period").val()) != ""){
|
|
|
|
|
submit = submit && regex_course_class_period('edit');
|
|
|
|
|
}
|
|
|
|
|
if($.trim($("#edit_course_credit").val()) != ""){
|
|
|
|
|
submit = submit && regex_course_credit('edit');
|
|
|
|
|
}
|
|
|
|
|
/*if($.trim($("#edit_course_end_date").val()) != ""){
|
|
|
|
|
submit = submit && regex_end_date('edit')
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
if(submit){
|
|
|
|
|
$("#edit_course_"+id).submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function submit_update_course_module(){
|
|
|
|
|
var check = true;
|
|
|
|
|
var scroll = true;
|
|
|
|
|
for(var i=0; i< $("input.input_name").length; i++){
|
|
|
|
|
var obj = $($("input.input_name")[i]);
|
|
|
|
|
if(obj.val().trim() == ""){
|
|
|
|
|
$(obj).addClass("bor-red");
|
|
|
|
|
check = false;
|
|
|
|
|
if(scroll){
|
|
|
|
|
$(document).scrollTop(parseInt(obj.offset().top)-150);
|
|
|
|
|
scroll=false;//已经定位后、后续报错部分就不用定位了
|
|
|
|
|
}
|
|
|
|
|
} else{
|
|
|
|
|
$(obj).removeClass("bor-red");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(check){
|
|
|
|
|
$("#update_course_module").submit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function formate_date(date){
|
|
|
|
|
var str = "";
|
|
|
|
|
var year = date.getFullYear();
|
|
|
|
|
var month = date.getMonth() + 1;
|
|
|
|
|
var day = date.getDate();
|
|
|
|
|
if(month < 10) {
|
|
|
|
|
month = '0' + month;
|
|
|
|
|
}
|
|
|
|
|
if(day < 10) {
|
|
|
|
|
day = '0' + day;
|
|
|
|
|
}
|
|
|
|
|
str = year + '-' + month + '-' + day;
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//textarea自适应高度 纯js写的 有浏览器判断
|
|
|
|
|
/**
|
|
|
|
|
* 文本框根据输入内容自适应高度
|
|
|
|
|
* @param {HTMLElement} 输入框元素
|
|
|
|
|
* @param {Number} 设置光标与输入框保持的距离(默认0)
|
|
|
|
|
* @param {Number} 设置最大高度(可选)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
var autoTextarea = function (elem, extra, maxHeight) {
|
|
|
|
|
extra = extra || 0;
|
|
|
|
|
var isFirefox = !!document.getBoxObjectFor || 'mozInnerScreenX' in window,
|
|
|
|
|
isOpera = !!window.opera && !!window.opera.toString().indexOf('Opera'),
|
|
|
|
|
addEvent = function (type, callback) {
|
|
|
|
|
elem.addEventListener ?
|
|
|
|
|
elem.addEventListener(type, callback, false) :
|
|
|
|
|
elem.attachEvent('on' + type, callback);
|
|
|
|
|
},
|
|
|
|
|
getStyle = elem.currentStyle ? function (name) {
|
|
|
|
|
var val = elem.currentStyle[name];
|
|
|
|
|
|
|
|
|
|
if (name === 'height' && val.search(/px/i) !== 1) {
|
|
|
|
|
var rect = elem.getBoundingClientRect();
|
|
|
|
|
return rect.bottom - rect.top -
|
|
|
|
|
parseFloat(getStyle('paddingTop')) -
|
|
|
|
|
parseFloat(getStyle('paddingBottom')) + 'px';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
} : function (name) {
|
|
|
|
|
return getComputedStyle(elem, null)[name];
|
|
|
|
|
},
|
|
|
|
|
minHeight = parseFloat(getStyle('height'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elem.style.resize = 'none';
|
|
|
|
|
|
|
|
|
|
var change = function () {
|
|
|
|
|
var scrollTop, height,
|
|
|
|
|
padding = 0,
|
|
|
|
|
style = elem.style;
|
|
|
|
|
|
|
|
|
|
if (elem._length === elem.value.length) return;
|
|
|
|
|
elem._length = elem.value.length;
|
|
|
|
|
|
|
|
|
|
if (!isFirefox && !isOpera) {
|
|
|
|
|
padding = parseInt(getStyle('paddingTop')) + parseInt(getStyle('paddingBottom'));
|
|
|
|
|
};
|
|
|
|
|
scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
|
|
|
|
|
|
|
|
|
|
elem.style.height = minHeight + 'px';
|
|
|
|
|
if (elem.scrollHeight > minHeight) {
|
|
|
|
|
if (maxHeight && elem.scrollHeight > maxHeight) {
|
|
|
|
|
height = maxHeight - padding;
|
|
|
|
|
style.overflowY = 'auto';
|
|
|
|
|
} else {
|
|
|
|
|
height = elem.scrollHeight - padding + 10;
|
|
|
|
|
style.overflowY = 'hidden';
|
|
|
|
|
};
|
|
|
|
|
style.height = height + extra + 'px';
|
|
|
|
|
scrollTop += parseInt(style.height) - elem.currHeight;
|
|
|
|
|
//document.body.scrollTop = scrollTop;
|
|
|
|
|
//document.documentElement.scrollTop = scrollTop;
|
|
|
|
|
elem.currHeight = parseInt(style.height);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
addEvent('propertychange', change);
|
|
|
|
|
addEvent('input', change);
|
|
|
|
|
addEvent('focus', change);
|
|
|
|
|
change();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var autoTextarea2 = function (elem,elem2, extra, maxHeight) {
|
|
|
|
|
extra = extra || 0;
|
|
|
|
|
var isFirefox = !!document.getBoxObjectFor || 'mozInnerScreenX' in window,
|
|
|
|
|
isOpera = !!window.opera && !!window.opera.toString().indexOf('Opera'),
|
|
|
|
|
addEvent = function (element, type, callback) {
|
|
|
|
|
element.addEventListener ?
|
|
|
|
|
element.addEventListener(type, callback, false) :
|
|
|
|
|
element.attachEvent('on' + type, callback);
|
|
|
|
|
},
|
|
|
|
|
getFirstStyle = elem.currentStyle ? function (name) {
|
|
|
|
|
var val = elem.currentStyle[name];
|
|
|
|
|
|
|
|
|
|
if (name === 'height' && val.search(/px/i) !== 1) {
|
|
|
|
|
var rect = elem.getBoundingClientRect();
|
|
|
|
|
return rect.bottom - rect.top -
|
|
|
|
|
parseFloat(getFirstStyle('paddingTop')) -
|
|
|
|
|
parseFloat(getFirstStyle('paddingBottom')) + 'px';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
} : function (name) {
|
|
|
|
|
return getComputedStyle(elem, null)[name];
|
|
|
|
|
},
|
|
|
|
|
minHeight = parseFloat(getFirstStyle('height'));
|
|
|
|
|
|
|
|
|
|
elem.style.resize = 'none';
|
|
|
|
|
elem2.style.resize = 'none';
|
|
|
|
|
var change = function () {
|
|
|
|
|
var scrollTop, height,
|
|
|
|
|
padding = 0,
|
|
|
|
|
style = elem.style,
|
|
|
|
|
style2 = elem2.style;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (elem._length === elem.value.length) return;
|
|
|
|
|
elem._length = elem.value.length;
|
|
|
|
|
elem2._length = elem._length;
|
|
|
|
|
if (!isFirefox && !isOpera) {
|
|
|
|
|
padding = parseInt(getFirstStyle('paddingTop')) + parseInt(getFirstStyle('paddingBottom'));
|
|
|
|
|
};
|
|
|
|
|
scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
|
|
|
|
|
|
|
|
|
|
elem.style.height = minHeight + 'px';
|
|
|
|
|
elem2.style.height = minHeight + 'px';
|
|
|
|
|
if (elem.scrollHeight > minHeight) {
|
|
|
|
|
if (maxHeight && elem.scrollHeight > maxHeight) {
|
|
|
|
|
height = maxHeight - padding;
|
|
|
|
|
style.overflowY = 'auto';
|
|
|
|
|
style2.overflowY = 'auto';
|
|
|
|
|
} else {
|
|
|
|
|
height = elem.scrollHeight - padding;
|
|
|
|
|
};
|
|
|
|
|
style.height = height + extra + 'px';
|
|
|
|
|
style2.height = height + extra + 'px';
|
|
|
|
|
scrollTop += parseInt(style.height) - elem.currHeight;
|
|
|
|
|
document.body.scrollTop = scrollTop;
|
|
|
|
|
document.documentElement.scrollTop = scrollTop;
|
|
|
|
|
elem.currHeight = parseInt(style.height);
|
|
|
|
|
};
|
|
|
|
|
if (elem2.scrollHeight > minHeight) {
|
|
|
|
|
if (maxHeight && elem2.scrollHeight > maxHeight) {
|
|
|
|
|
height = maxHeight - padding;
|
|
|
|
|
style.overflowY = 'auto';
|
|
|
|
|
style2.overflowY = 'auto';
|
|
|
|
|
} else {
|
|
|
|
|
height = elem2.scrollHeight - padding;
|
|
|
|
|
};
|
|
|
|
|
style.height = height + extra + 'px';
|
|
|
|
|
style2.height = height + extra + 'px';
|
|
|
|
|
scrollTop += parseInt(style2.height) - elem2.currHeight;
|
|
|
|
|
document.body.scrollTop = scrollTop;
|
|
|
|
|
document.documentElement.scrollTop = scrollTop;
|
|
|
|
|
elem2.currHeight = parseInt(style2.height);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
addEvent(elem, 'propertychange', change);
|
|
|
|
|
addEvent(elem, 'input', change);
|
|
|
|
|
addEvent(elem, 'focus', change);
|
|
|
|
|
addEvent(elem2, 'propertychange', change);
|
|
|
|
|
addEvent(elem2, 'input', change);
|
|
|
|
|
addEvent(elem2, 'focus', change);
|
|
|
|
|
change();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function formate_time(time){
|
|
|
|
|
var str = "";
|
|
|
|
|
var year = time.getFullYear();
|
|
|
|
|
var month = time.getMonth() + 1;
|
|
|
|
|
var day = time.getDate();
|
|
|
|
|
var hour = time.getHours();
|
|
|
|
|
var min = time.getMinutes();
|
|
|
|
|
if(month < 10) {
|
|
|
|
|
month = '0' + month;
|
|
|
|
|
}
|
|
|
|
|
if(day < 10) {
|
|
|
|
|
day = '0' + day;
|
|
|
|
|
}
|
|
|
|
|
if(hour < 10) {
|
|
|
|
|
hour = '0' + hour;
|
|
|
|
|
}
|
|
|
|
|
if(min < 10) {
|
|
|
|
|
min = '0' + min;
|
|
|
|
|
}
|
|
|
|
|
str = year + '-' + month + '-' + day + ' ' + hour + ':' + min;
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function formate_time_s(time){
|
|
|
|
|
var str = "";
|
|
|
|
|
var year = time.getFullYear();
|
|
|
|
|
var month = time.getMonth() + 1;
|
|
|
|
|
var day = time.getDate();
|
|
|
|
|
var hour = time.getHours();
|
|
|
|
|
var min = time.getMinutes();
|
|
|
|
|
var sec = time.getSeconds();
|
|
|
|
|
if(month < 10) {
|
|
|
|
|
month = '0' + month;
|
|
|
|
|
}
|
|
|
|
|
if(day < 10) {
|
|
|
|
|
day = '0' + day;
|
|
|
|
|
}
|
|
|
|
|
if(hour < 10) {
|
|
|
|
|
hour = '0' + hour;
|
|
|
|
|
}
|
|
|
|
|
if(min < 10) {
|
|
|
|
|
min = '0' + min;
|
|
|
|
|
}
|
|
|
|
|
if(sec < 10) {
|
|
|
|
|
sec = '0' + sec;
|
|
|
|
|
}
|
|
|
|
|
str = year + '-' + month + '-' + day + ' ' + hour + ':' + min + ":" + sec;
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function submit_send_res_to_course(){
|
|
|
|
|
if($("input[name='course_ids[]']:checked").length >= 1){
|
|
|
|
|
$("#search_course_notice_h").html("").hide();
|
|
|
|
|
$("#course_list_form").submit();
|
|
|
|
|
hideModal();
|
|
|
|
|
}else{
|
|
|
|
|
$("#search_course_notice_h").html("请先选择一个班级").show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function regex_major()
|
|
|
|
|
{
|
|
|
|
|
if($("#shixun_major").val() == "0")
|
|
|
|
|
{
|
|
|
|
|
$("#shixun_major_notice").show();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$("#shixun_major_notice").hide();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function checkLesson(item){
|
|
|
|
|
if($("#shixun_major").val() == "0") {
|
|
|
|
|
$("#shixun_major_course_notice").html("请先选择适用专业").show();
|
|
|
|
|
} else{
|
|
|
|
|
var showul=$(item).find("ul").attr("showul");
|
|
|
|
|
if(showul=="0"){
|
|
|
|
|
$(item).find("ul").show();
|
|
|
|
|
$(item).find("ul").attr("showul","1");
|
|
|
|
|
if($(item).find("ul input").length>5){
|
|
|
|
|
$(item).find("ul").css("overflow-y","scroll");
|
|
|
|
|
}
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
}else{
|
|
|
|
|
$(item).find("ul").hide();
|
|
|
|
|
$(item).find("ul").attr("showul","0");
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function shixun_link(shixun){
|
|
|
|
|
window.open('/shixuns/' + shixun);
|
|
|
|
|
}
|
|
|
|
|
function subject_link(id){
|
|
|
|
|
window.open('/paths/' + id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function editor_focus(id){
|
|
|
|
|
// window.location.href = "#mao"+id;
|
|
|
|
|
// var top=$(document).scrollTop();
|
|
|
|
|
// $(document).scrollTop(parseInt(top)-70);
|
|
|
|
|
$('html, body').animate({
|
|
|
|
|
scrollTop: parseInt($("#mao"+id).offset().top)-70
|
|
|
|
|
}, 1000);
|
|
|
|
|
$("textarea[nhname='new_message_textarea_"+id+"']").focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var d_lastSearchCondition = '';
|
|
|
|
|
function search_course_list(e){
|
|
|
|
|
var str = $(e.target).val().trim();
|
|
|
|
|
if (str == d_lastSearchCondition && str != '') {//如果输入框没有改变或者输入框为空就返回
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
d_lastSearchCondition = str;
|
|
|
|
|
$(".course_list_ul").empty();
|
|
|
|
|
search_course_ajax(str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function search_course_ajax(str){
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: '/courses/search_course_list',
|
|
|
|
|
data: {search: str},
|
|
|
|
|
type: 'post',
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if(data.courses.length > 0){
|
|
|
|
|
$(".course_list_ul").empty();
|
|
|
|
|
for(var i=0; i<data.courses.length; i++){
|
|
|
|
|
$(".course_list_ul").append("<li><p data-val='"+data.courses[i][0]+"' id='course_list_"+data.courses[i][1]+"'>" + data.courses[i][0] + "</p></li>");
|
|
|
|
|
}
|
|
|
|
|
$(".course_list_ul").show();
|
|
|
|
|
if($(".course_list_ul").find("li").length>5){
|
|
|
|
|
$(".course_list_ul").css("overflow-y","scroll");
|
|
|
|
|
} else{
|
|
|
|
|
$(".course_list_ul").css("overflow-y","hidden");
|
|
|
|
|
}
|
|
|
|
|
} else{
|
|
|
|
|
$(".course_list_ul").hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Base64() {
|
|
|
|
|
|
|
|
|
|
// private property
|
|
|
|
|
_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
|
|
|
|
|
|
|
|
// public method for encoding
|
|
|
|
|
this.encode = function (input) {
|
|
|
|
|
var output = "";
|
|
|
|
|
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
|
|
|
var i = 0;
|
|
|
|
|
input = _utf8_encode(input);
|
|
|
|
|
while (i < input.length) {
|
|
|
|
|
chr1 = input.charCodeAt(i++);
|
|
|
|
|
chr2 = input.charCodeAt(i++);
|
|
|
|
|
chr3 = input.charCodeAt(i++);
|
|
|
|
|
enc1 = chr1 >> 2;
|
|
|
|
|
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
|
|
|
|
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
|
|
|
|
enc4 = chr3 & 63;
|
|
|
|
|
if (isNaN(chr2)) {
|
|
|
|
|
enc3 = enc4 = 64;
|
|
|
|
|
} else if (isNaN(chr3)) {
|
|
|
|
|
enc4 = 64;
|
|
|
|
|
}
|
|
|
|
|
output = output +
|
|
|
|
|
_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
|
|
|
|
|
_keyStr.charAt(enc3) + _keyStr.charAt(enc4);
|
|
|
|
|
}
|
|
|
|
|
return output;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// public method for decoding
|
|
|
|
|
this.decode = function (input) {
|
|
|
|
|
var output = "";
|
|
|
|
|
var chr1, chr2, chr3;
|
|
|
|
|
var enc1, enc2, enc3, enc4;
|
|
|
|
|
var i = 0;
|
|
|
|
|
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
|
|
|
|
while (i < input.length) {
|
|
|
|
|
enc1 = _keyStr.indexOf(input.charAt(i++));
|
|
|
|
|
enc2 = _keyStr.indexOf(input.charAt(i++));
|
|
|
|
|
enc3 = _keyStr.indexOf(input.charAt(i++));
|
|
|
|
|
enc4 = _keyStr.indexOf(input.charAt(i++));
|
|
|
|
|
chr1 = (enc1 << 2) | (enc2 >> 4);
|
|
|
|
|
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
|
|
|
|
chr3 = ((enc3 & 3) << 6) | enc4;
|
|
|
|
|
output = output + String.fromCharCode(chr1);
|
|
|
|
|
if (enc3 != 64) {
|
|
|
|
|
output = output + String.fromCharCode(chr2);
|
|
|
|
|
}
|
|
|
|
|
if (enc4 != 64) {
|
|
|
|
|
output = output + String.fromCharCode(chr3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
output = _utf8_decode(output);
|
|
|
|
|
return output;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// private method for UTF-8 encoding
|
|
|
|
|
_utf8_encode = function (string) {
|
|
|
|
|
string = string.replace(/\r\n/g,"\n");
|
|
|
|
|
var utftext = "";
|
|
|
|
|
for (var n = 0; n < string.length; n++) {
|
|
|
|
|
var c = string.charCodeAt(n);
|
|
|
|
|
if (c < 128) {
|
|
|
|
|
utftext += String.fromCharCode(c);
|
|
|
|
|
} else if((c > 127) && (c < 2048)) {
|
|
|
|
|
utftext += String.fromCharCode((c >> 6) | 192);
|
|
|
|
|
utftext += String.fromCharCode((c & 63) | 128);
|
|
|
|
|
} else {
|
|
|
|
|
utftext += String.fromCharCode((c >> 12) | 224);
|
|
|
|
|
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
|
|
|
|
utftext += String.fromCharCode((c & 63) | 128);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return utftext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// private method for UTF-8 decoding
|
|
|
|
|
_utf8_decode = function (utftext) {
|
|
|
|
|
var string = "";
|
|
|
|
|
var i = 0;
|
|
|
|
|
var c = c1 = c2 = 0;
|
|
|
|
|
while ( i < utftext.length ) {
|
|
|
|
|
c = utftext.charCodeAt(i);
|
|
|
|
|
if (c < 128) {
|
|
|
|
|
string += String.fromCharCode(c);
|
|
|
|
|
i++;
|
|
|
|
|
} else if((c > 191) && (c < 224)) {
|
|
|
|
|
c2 = utftext.charCodeAt(i+1);
|
|
|
|
|
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
|
|
|
|
i += 2;
|
|
|
|
|
} else {
|
|
|
|
|
c2 = utftext.charCodeAt(i+1);
|
|
|
|
|
c3 = utftext.charCodeAt(i+2);
|
|
|
|
|
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
|
|
|
|
i += 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return string;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//for(i=0;i<$("i").length;i++){
|
|
|
|
|
// var $TipContent = $("i").eq(i).attr("title");
|
|
|
|
|
// $("i").eq(i).attr("title","").attr("data-tip-down",$TipContent);
|
|
|
|
|
//}
|
|
|
|
|
//console.log($("i").length);
|
|
|
|
|
//判断是手机端还是电脑端
|
|
|
|
|
function IsPC() {
|
|
|
|
|
var userAgentInfo = navigator.userAgent;
|
|
|
|
|
var Agents = ["Android", "iPhone",
|
|
|
|
|
"SymbianOS", "Windows Phone",
|
|
|
|
|
"iPad", "iPod"];
|
|
|
|
|
var flag = true;
|
|
|
|
|
for (var v = 0; v < Agents.length; v++) {
|
|
|
|
|
if (userAgentInfo.indexOf(Agents[v]) > 0) {
|
|
|
|
|
flag = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var wait = 60;
|
|
|
|
|
|
|
|
|
|
function time(btn){
|
|
|
|
|
if (wait==0) {
|
|
|
|
|
$(btn).addClass("btn_orange_bg");
|
|
|
|
|
btn.removeAttribute("disabled");
|
|
|
|
|
btn.innerHTML = "获取验证码";
|
|
|
|
|
wait = 60;
|
|
|
|
|
return;
|
|
|
|
|
}else{
|
|
|
|
|
$(btn).removeClass("btn_orange_bg");
|
|
|
|
|
btn.setAttribute("disabled", "disabled");
|
|
|
|
|
btn.innerHTML = wait + "s后重试";
|
|
|
|
|
wait--;
|
|
|
|
|
}
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
time(btn);
|
|
|
|
|
},1000);
|
|
|
|
|
}
|