util.toast('请输入账号'); return; } if(account_password == '') { util.toast('请输入密码'); return; } util.doAjax(`https://sav2025.cc/login/username.html`, { channel_code: 'pc', username: account_name, password: account_password, }, function(res) { if(res.status == 'y') { util.toast('登录成功', function() { localStorage.setItem('account_name', account_name); localStorage.setItem('account_password', account_password); window.location.reload(); }); } else { util.toast(res.error); } }); }); $(".account-close").click(function(){ layer.close(index); }); // // 注册 // $('.register').click(function() { // util.doAjax(`https://sav2025.cc/login/username.html`, { // username: $('#reg_username').val(), // password: $('#reg_password').val(), // password_confirm: $('#reg_password_confirm').val() // }, function(res) { // if(res.status == 'y') { // util.toast('注册成功', function() { // layer.close(index); // }); // } else { // util.toast(res.error); // } // }); // }); } }); } }; let movieState = { collect:function(movieId,e){ // 禁止冒泡 e.stopPropagation(); // 阻止默认行为 e.preventDefault(); util.doAjax(`https://sav2025.cc/user/doCollectMovie.html`, { movie_id: movieId }, function (res) { if (res.status == 'y') { if( res.data ){ util.toast('收藏成功'); }else{ util.toast('取消收藏'); } } else { util.toast(res.error); } }); } } $(document).ready(function () { mainState.init(); $("#searchInput").keydown(function(e) { if (e.keyCode === 13) { e.preventDefault(); // 阻止表单默认提交 mainState.doSearch() } }); });