| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- var spaceDev = {
- layLoadIndex: {}, // 加载层标记
- tipTimeOutObj: {} // 头部tip关闭定时器对象
- };
- $(function() {
- // 初始化时间
- $("#toolDate").html(getNowFormatDate("simple"));
- //九宫格里面的格子点击事件,切换iframe的路径
- $("#grid li").click(function() {
- menuClick($(this));
- })
- $("#grid li").mouseenter(function() {
- var anim = $(this).attr("anim") || "layui-anim-scale";
- $(this).find(".grid-icon").addClass("layui-anim " + anim);
- })
- $("#grid li").mouseleave(function() {
- var anim = $(this).attr("anim") || "layui-anim-scale";
- $(this).find(".grid-icon").removeClass("layui-anim " + anim);
- })
- $(".logo").click(function() {
- $("#content-iframe").attr("src", "/devService?action=welcome");
- $("#grid li").removeClass("current");
- })
- // 等头像加载完成后添加头像边框
- $("#user-icon").onload = loadIconBorder();
- })
- function menuClick(obj) {
- var menu_url = $(obj).attr("menu_url");
- if (menu_url == undefined || menu_url.length == 0) {
- var msg = $(obj).attr("menu_msg");
- msg = (msg && msg.length != 0) ? msg : "未填写 MSG 属性";
- tip.warning(msg)
- return false;
- }
- $("#content-iframe").attr("src", menu_url);
- $("#grid li").removeClass("current");
- $(obj).addClass("current");
- showLoadLayer();
- }
- function getNowFormatDate(type) {
- var date = new Date();
- var seperator1 = "-";
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- var mydate = new Date();
- var myddy = mydate.getDay(); //获取存储当前日期
- var weekday = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
- var currentdate;
- if (type == "simple") {
- currentdate = month + "月" + strDate + "日 " + weekday[myddy];
- } else {
- currentdate = year + "年" + month + "月" + strDate + "日 " + weekday[myddy];
- }
- return currentdate;
- }
- function loadIconBorder() {
- setTimeout(function() {
- var icon = $("#user-icon");
- var randomNum = iconIndex || Math.floor(Math.random() * 62);
- var b_p = "",
- t = 3,
- l = 21,
- s = 146;
- if (randomNum == 0) {
- b_p = "icon_border_bruin.png";
- t = 0;
- l = 30;
- s = 120;
- } else if (randomNum == 1) {
- b_p = "icon_border_flower.png";
- t = icon.offset().top - 56;
- l = icon.offset().left - 20;
- s = 120;
- } else {
- if (randomNum > 10 && randomNum.toString().startsWith("4")) {
- randomNum = "A" + randomNum.toString().substring(1);
- }
- b_p = "bili_" + randomNum + ".png";
- }
- var icon_border = '<div class="layui-anim layui-anim-fadein" style="width: ' + s + 'px; height: ' + s + 'px;' +
- 'position: absolute; background: url(/dev/images/icon-border/' + b_p + ') no-repeat; ' +
- 'background-size: ' + s + 'px ' + s + 'px; top:' + t + 'px; left: ' + l + 'px"></div>';
- $(".login-message").append(icon_border);
- }, 500)
- }
- function showLoadLayer(msg) {
- msg = msg || '数据加载中,请稍后';
- var layerIndex = layer.msg(msg, {
- time: 0,
- anim: -1,
- isOutAnim: false,
- icon: 16,
- shade: [0.1, '#fff']
- });
- spaceDev.layLoadIndex = layerIndex;
- }
- function hideLoadLayer() {
- layer.close(spaceDev.layLoadIndex);
- }
- function tips(msg, type, time) {
- var tipDiv = $("#tip-div");
- $(tipDiv).removeClass("animated fadeInDownBig");
- $(tipDiv).hide();
- clearTimeout(spaceDev.tipTimeOutObj);
- time = time || 3000;
- msg = msg.replace(new RegExp(/</g, "gm"), ">").replace(new RegExp(/>/g, "gm"), "<");
- $("#sui-msg-div").attr("class", "sui-msg msg-" + type)
- $("#sui-msg-div-con").html(msg);
- $(tipDiv).addClass("animated fadeInDownBig");
- var left = (topWin.innerWidth - $(tipDiv).width()) / 2;
- $(tipDiv).css("left", left + 'px');
- $("#tip-div").show();
- spaceDev.tipTimeOutObj = setTimeout(function() {
- if (!$("#tip-div").is(":hidden")) {
- $(tipDiv).removeClass("animated fadeInDownBig");
- $("#tip-div").fadeOut(300);
- }
- }, time);
- }
- function fullScreen() {
- var el = document.documentElement;
- var rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;
- if (typeof rfs != "undefined" && rfs) {
- rfs.call(el);
- };
- $(".fa-battery-2").show();
- $(".fa-battery").hide();
- }
- function exitScreen() {
- if (document.exitFullscreen) {
- document.exitFullscreen();
- } else if (document.mozCancelFullScreen) {
- document.mozCancelFullScreen();
- } else if (document.webkitCancelFullScreen) {
- document.webkitCancelFullScreen();
- } else if (document.msExitFullscreen) {
- document.msExitFullscreen();
- }
- if (typeof cfs != "undefined" && cfs) {
- cfs.call(el);
- }
- $(".fa-battery-2").hide();
- $(".fa-battery").show();
- }
|