';
h += "";
if (c.showitem) {
h += "";
}
if (c.showpages) {
h += "";
}
if (c.changesize) {
h += "";
}
if (c.showfl) {
h += "";
}
if (c.showpn) {
h += '';
}
var links = [];
if (c.pagecount <= c.buttons) {
for (var i = 1; i <= c.pagecount; i++) {
var _h = '';
links.push(_h);
}
} else {
if (c.curpage > ((c.buttons + 1) / 2)) {
if (c.curpage <= (c.pagecount - (c.buttons + 1) / 2)) {
for (var i = 1; i <= c.buttons; i++) {
var page = c.curpage - Math.floor((c.buttons + 1) / 2) + i;
var _h = '';
links.push(_h);
}
} else {
for (var i = 1; i <= c.buttons; i++) {
var page = c.pagecount - c.buttons + i;
var _h = '';
links.push(_h);
}
}
if (c.buttons > 1) {
var page = 0;
if (c.curpage <= c.buttons + (c.buttons + 1) / 2) {
page = Math.floor((c.buttons + 1) / 2);
} else {
page = c.curpage - c.buttons;
}
links.unshift('');
}
} else {
for (var i = 1; i <= c.buttons; i++) {
var _h = '';
links.push(_h);
}
}
if (c.curpage + c.buttons / 2 < c.pagecount && c.buttons > 1) {
var page = 0;
if (c.curpage + c.buttons > c.pagecount - c.buttons / 2) {
page = c.pagecount - Math.floor(c.buttons / 2);
} else {
page = c.curpage + c.buttons;
}
links.push('');
}
}
$.each(links, function (b, a, m) {
h += a;
});
if (c.showpn) {
h += '';
}
if (c.showfl) {
h += "";
}
if (c.showgo) {
h += '';
}
h += "
";
var r = $(h);
if (self.IsFunction(c.getdata)) {
r.find("a[data-type]").not('.aspNetDisabled').off('click').on('click', function () {
var t = $(this).data('type');
var d = {
pagesize: 10,
curpage: 1
};
switch (t) {
case 'first':
d.curpage = 1;
break;
case 'last':
d.curpage = c.pagecount;
break;
case 'pre':
d.curpage = c.curpage - 1;
break;
case 'next':
d.curpage = c.curpage + 1;
break;
case 'curlink':
case 'link':
d.curpage = $(this).data('value');
break;
default:
return;
}
c.getdata(d);
});
r.find("input:text[data-type]").not('.aspNetDisabled').off('change').on('change', function () {
var t = $(this).data('type');
var d = {
pagesize: 10,
curpage: 1
};
switch (t) {
case 'go':
d.curpage = $(this).val();
if (isNaN(d.curpage))
return;
break;
default:
return;
}
c.getdata(d);
});
}
return r;
},
Load1: function (mint) {
var self = this;
mint = parseInt(mint);
mint = isNaN(mint) ? 2000 : mint;
return self.openLoading({
src: '/pub/images/loading/app_img.jpg',
text: '正在加载内容',
mintime: mint
});
},
Load2: function (mint) {
var self = this;
mint = parseInt(mint);
mint = isNaN(mint) ? 1000 : mint;
return self.openLoading2({
mintime: mint
});
},
Load3: function (callback, mint) {
var self = this;
mint = parseInt(mint);
mint = isNaN(mint) ? 2000 : mint;
return self.openLoading({
src: '/pub/images/loading/app_img.jpg',
text: '正在加载内容',
mintime: mint,
success: callback
});
},
Load4: function (callback, mint) {
var self = this;
mint = parseInt(mint);
mint = isNaN(mint) ? 1000 : mint;
return self.openLoading2({
mintime: mint,
success: callback
});
},
ChkSingle: function (sel) {
$(sel).click(function (ev) {
if ($(this).prop('checked')) {
$(sel).prop('checked', false);
$(this).prop('checked', true);
}
var oEvent = ev || event;
oEvent.stopPropagation();
})
},
GetDate: function (type, getend) {
var now = new Date(); //当前日期
var nowDayOfWeek = now.getDay(); //今天本周的第几天
var nowDay = now.getDate(); //当前日
var nowMonth = now.getMonth(); //当前月
var nowYear = now.getFullYear(); //当前年
switch (type) {
case 'week':
if (getend)
return [new Date(nowYear, nowMonth, nowDay - nowDayOfWeek), new Date(nowYear, nowMonth, nowDay + 6 - nowDayOfWeek)];
return [new Date(nowYear, nowMonth, nowDay - nowDayOfWeek), now];
case 'month':
if (getend)
return [new Date(nowYear, nowMonth, 1), new Date(nowYear, nowMonth + 1, 0)];
return [new Date(nowYear, nowMonth, 1), now];
case 'jidu':
var bm = (nowMonth / 3) * 3;
if (getend)
return [new Date(nowYear, bm, 1), new Date(nowYear, bm + 3, 0)];
return [new Date(nowYear, bm, 1), now];
case 'year':
if (getend)
return [new Date(nowYear, 0, 1), new Date(nowYear + 1, 0, 0)];
return [new Date(nowYear, 0, 1), now];
}
return null;
},
GetTeaError: function (errortype, errortitle, errormsg, users) {
var title = errortitle ? errortitle : "发生错误";
var content = errormsg ? errormsg : "很抱歉,此页面无法访问,请联系管理员";
var dotcssname = "errortype" + (errortype ? errortype : "1");
var h = "";
h += "
";
h += "
";
h += "
" + content + "
";
if (errortype == 1) {
h += "
";
h += "
下列人员有权限
";
if (users && users.length > 0) {
h += "
";
$.each(users, function (de) {
h += "- " + de.Key + "
- " + de.Value + "
";
});
h += "
";
}
else {
h += "
管理员还没有配置
";
}
}
h += "
";
return h;
},
keepaction: function () {
setInterval(function () {
$.ajax({ url: '/teacher/ajax.ashx' });
}, 1000 * 60 * 5);
},
loadplayjs: false,
//插入多个视频 openVideo(sel:选择器,url:[视频地址数组],width:宽度,height:高度,h5first:是否优先使用H5 video播放器)
insertVideo: function (cfg) {
var self = this;
var defcfg = { sel: "", url: [], width: 600, height: 400, h5first: true };
var _c = $.extend({}, defcfg, cfg);
if (typeof CKobject === 'undefined') {
if (!self.loadplayjs) {
self.loadplayjs = true;
this.loadJs("/pub/ckplayer/ckplayer.js");
}
setTimeout(function () { self.insertVideo(cfg); }, 500);
return;
}
for (var i = _c.url.length - 1; i >= 0; i--) {
$(_c.sel).prepend("