SPA_RESOLVE_INIT = function ($el, $router) { const html = document.querySelector('html'); const body = document.querySelector('body'); html.className = 'index'; body.className = 'mdui-theme-primary-blue mdui-theme-accent-light-blue index'; mdui.JQ($el).empty(); mdui.JQ($el).append(`
CloudSQL Admin Panel
登陆 注册

用户注册

person
lock
code
`) //验证码刷新逻辑 let captchaImg = document.querySelector('.captcha-row img'); Utils.handleEvent('click', { onElement: captchaImg, withCallback: function () { this.src = `http://admin.cloudsql.1473.cn/v1/captcha?${new Date().getTime()}`; //加入当前时间以避免缓存 } }); /* captchaImg.addEventListener('click', function () { this.src = `http://admin.cloudsql.1473.cn/v1/captcha?${new Date().getTime()}`; //加入当前时间以避免缓存 }, false); */ let submitButton = document.querySelector('.main-button-row button'); Utils.handleEvent('click', { onElement: submitButton, withCallback: function () { let signupUrl = 'http://admin.cloudsql.1473.cn/v1/signup', userId = document.querySelector('input[name=userid]').value, password = document.querySelector('input[name=password]').value, captchaCode = document.querySelector('input[name=captcha]').value, postData = `userId=${userId}&password=${password}&captcha=${captchaCode}`; Utils.ajaxPost(signupUrl, postData, function (response) { if (response.status == 'successed') { mdui.snackbar({ message: response.info }); window.location.hash = response.url; } else { mdui.snackbar({ message: response.info }); } }) } }); }