jQuery.extend({ baseUrl: "//xhwebapitest.xhkjedu.com/", showImageUrl: "//xhwebstatictest.xhkjedu.com/", //毫秒时间转换为yyyy-MM-dd msToDateString: function (ms) { let date = new Date(ms); let year = date.getFullYear(); let month = date.getMonth() + 1; let day = date.getDate(); if (month < 10) { month = "0" + month; } if (day < 10) { day = "0" + day; } return year + "-" + month + "-" + day; }, // 秒时间转换为yyyy-MM-dd HH:mm:ss dateFormat: function(unixtimestamp) { unixtimestamp = new Date(unixtimestamp * 1000); let year = 1900 + unixtimestamp.getYear(); let month = "0" + (unixtimestamp.getMonth() + 1); let date = "0" + unixtimestamp.getDate(); let hour = "0" + unixtimestamp.getHours(); let minute = "0" + unixtimestamp.getMinutes(); let second = "0" + unixtimestamp.getSeconds(); return ( year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length) + " " + hour.substring(hour.length - 2, hour.length) + ":" + minute.substring(minute.length - 2, minute.length) + ":" + second.substring(second.length - 2, second.length) ); }, // 读取url参数 getQueryletiable: function(letiable) { let query = window.location.search.substring(1); query = decodeURI(query); let lets = query.split("&"); for (let i = 0; i < lets.length; i++) { let pair = lets[i].split("="); if (pair[0] === letiable) { return pair[1]; } } return false; }, userInfo: JSON.parse(localStorage.getItem("xhWebAdminUser")) || {}, isLogin: function () { let xhWebAdminUser = JSON.parse(localStorage.getItem("xhWebAdminUser")); return xhWebAdminUser ? true : false; } });