const { ipcRenderer } = require('electron'); class Login { constructor() { this.renderImg(); this.enterRoom(); } renderImg() { var type = null; for (var i = 1; i <= 10; i++) { if (i == 3 || i == 4 || i == 5) { type = "gif" } else { type = "jpg" } $(".modal-body").append(` `) } $(".modal-body img").click(function () { $(this).addClass("active").siblings().removeClass("active"); $(".login img").attr({ src: $(this).attr("src") }); $('#myModal').modal('hide') }) } enterRoom() { $(".enter").click(function () { var username = $(".username").val(); var userroom = $(".userroom").val(); if (username.length == 0) { new $.zui.Messager('用户名必填', { icon: 'bell' }).show(); return; } if (userroom.length == 0) { new $.zui.Messager('房间号必填', { icon: 'bell' }).show(); return; } var userInfo = { user_img: $(".login img").attr("src"), user_name: username, user_room: userroom } localStorage.setItem("userInfo", JSON.stringify(userInfo)) ipcRenderer.send('GoToIndex', 1) }) } } new Login();