const URL = "http://221.2.83.254:9001" /* *消息弹框 * @ var message = new $message() * @ message(options,newclass) * @ options Object||string {message:'message',time:2000} || 'message' * @ newclass string class类名 */ function $message() { this.time = 2000; this.timer = null; this.newDiv = null; this.message = ""; this.fn = function (options, newclass) { if (typeof options === 'string') { this.message = options; this.time = 2000; } else if (typeof options === 'object') { this.time = options.time || 2000; this.message = options.message; } else { return } this.newDiv = document.createElement("div") this.newDiv.className = "message" this.newDiv.className += newclass || ""; //自定义样式 可以注释掉行间样式 this.newDiv.style = 'position:absolute;left: 50%;top: 50%;-webkit-transform: translate(-50%, -50%);transform: translate(-50%, -50%);background-color: rgba(0, 0, 0, 0.8);color: #fff;padding: .6rem;font-size: 1rem;border-radius: .4rem;text-align: center;zIndex:2250'; document.body.appendChild(this.newDiv); this.newDiv.innerHTML = this.message; this.closes = function () { console.log(this) this.newDiv.parentNode.removeChild(this.newDiv); clearTimeout(this.timer); this.timer = null; } this.timer = setTimeout(this.closes.bind(this), this.time); } return this.fn.bind(this); } function getUrlParse(str = window.location.search) { const reg = /([^?&=]+)=([^&]+)/g const params = {} str.replace(reg, (_, k, v) => params[k] = v) return params } function getNowDate() { let myDate = new Date; let year = myDate.getFullYear(); //获取当前年 let mon = myDate.getMonth() + 1; //获取当前月 let date = myDate.getDate(); //获取当前日 let hours = myDate.getHours(); //获取当前小时 let minutes = myDate.getMinutes(); //获取当前分钟 let seconds = myDate.getSeconds(); //获取当前秒 let now = year + "年" + mon + "月" + date + "日 " + hours + ":" + minutes return now; }