-
登陆注册界面
2016-03-10 20:14:43两套登陆注册界面 -
登陆注册界面实现
2016-08-03 19:27:15登陆注册界面实现 -
[100daysUI系列]登陆注册界面.zip
2020-12-28 10:18:58[100daysUI系列]登陆注册界面 PSD、按钮、注册界面、登陆、表单 -
登陆注册界面2.0
2019-11-17 17:08:40登陆注册界面2.0 升级功能 为实现注册验证功能,在注册界面中结尾添加代码: loListener1.nameFieldR = namelnput; loListener1.pwdFieldR = Pass; 在监听器中定义两个字符串rname、rpwd` /* (public) *...登陆注册界面2.0
升级功能
为实现注册验证功能,在注册界面中结尾添加代码:
loListener1.nameFieldR = namelnput; loListener1.pwdFieldR = Pass;
在监听器中定义两个字符串rname、rpwd`
/* (public) */ JTextField nameFieldR; /* (public) */ JPasswordField pwdFieldR; String rname; String rpwd;
然后先设定监听器为两个界面的同一后台:
loginui2.loListener1 = this;
在点击完成注册后把输入的数据赋值给两个字符串:
rname = nameFieldR.getText(); rpwd = pwdFieldR.getText()
最后在监听器中加入判断语句,当登陆界面中输入正确,则输出登陆成功;否则输出请重试。
if (nameText.equals(rname) && pwdText.equals(rpwd)) { System.out.println("登录成功!!!"); System.out.println("账户:" + nameText); System.out.println("密码:" + pwdText); } else { System.out.println("请重试!!!"); }
效果展示:
-
ios登陆 注册 界面 数据库
2014-03-26 16:32:36ios sqlite3 数据库 里面包含登陆 注册界面 -
基于HTML5+css+JS的精美登陆注册界面
2020-01-18 06:10:18基于HTML5+css+JS的精美登陆注册界面 基于HTML5+css+JS的精美登陆注册界面 基于HTML5+css+JS的精美登陆注册界面 基于HTML5+css+JS的精美登陆注册界面 -
基于python的Tkinter编写登陆注册界面
2020-09-21 06:43:16主要为大家详细介绍了基于python的Tkinter编写登陆注册界面,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 -
QQ登陆注册界面模板经典模板
2015-06-24 16:57:04QQ登陆注册界面模板经典模板 -
Axure RP 低仿钉钉登陆注册界面.zip
2020-07-16 23:59:34Axure RP 低仿钉钉登陆注册界面 还没开始学习就被扔下了一个结课作业,害 上传csdn保存一下 -
python实现登录注册界面_基于python的Tkinter编写登陆注册界面
2020-12-23 12:33:05tkinter创建登陆注册界面,供大家参考,具体内容如下import tkinter as tkfrom tkinter import messagebox#设置窗口居中def window_info():ws = window.winfo_screenwidth()hs = window.winfo_screenheight()x = (ws...tkinter创建登陆注册界面,供大家参考,具体内容如下
import tkinter as tk
from tkinter import messagebox
#设置窗口居中
def window_info():
ws = window.winfo_screenwidth()
hs = window.winfo_screenheight()
x = (ws / 2) - 200
y = (hs / 2) - 200
print("%d,%d" % (ws, hs))
return x,y
#设置登陆窗口属性
window = tk.Tk()
window.title('欢迎使用停车场收费系统')
a,b=window_info()
window.geometry("450x300+%d+%d"%(a,b))
#登陆界面的信息
tk.Label(window,text="停车场收费系统",font=("宋体",32)).place(x=80,y=50)
tk.Label(window,text="账号:").place(x=120,y=150)
tk.Label(window,text="密码:").place(x=120,y=190)
#显示输入框
var_usr_name = tk.StringVar()
#显示默认账号
var_usr_name.set('1400370101')
entry_usr_name=tk.Entry(window,textvariable=var_usr_name)
entry_usr_name.place(x=190,y=150)
var_usr_pwd = tk.StringVar()
#设置输入密码后显示*号
entry_usr_pwd = tk.Entry(window,textvariable=var_usr_pwd,show='*')
entry_usr_pwd.place(x=190,y=190)
#登陆函数
def usr_login():
#获取输入的账号密码
usr_name = var_usr_name.get()
usr_pwd = var_usr_pwd.get()
#获取存储的账户信息,此处使用的是数据库,调用数据库查询函数,也可以使用其他方式,如文件等
dicts = SQL.load('login')
print(dicts)
bool = False
for row in dicts:
print(row.get("name"))
if usr_name == row["name"]:
bool = True
pwd = row["password"]
print(row)
if bool == True:
if usr_pwd == pwd:
tk.messagebox.showinfo(title='Welcome', message='How are you?' +usr_name)
mainwindow()
else:
tk.messagebox.showerror(message='对不起,输入错误,请重试!')
else:
is_sign_up = tk.messagebox.askyesno('Welcome', '您还没有注册,是否现在注册呢?')
if is_sign_up:
usr_sign_up()
#注册账号
def usr_sign_up():
def sign_to_Pyhon():
np = new_pwd.get()
npc = new_pwd_confirm.get()
nn = new_name.get()
dicts = SQL.load('login')
print(dicts)
bool = False
for row in dicts:
if nn == row["name"]:
bool = True
print(row)
if np!=npc:
tk.messagebox.showerror('对不起','两次密码输入不一致!')
elif bool:
tk.messagebox.showerror(('对不起','此账号已经存在!'))
else:
try:
SQL.insert_login(str(nn),str(np))
tk.messagebox.showinfo('Welcome','您已经注册成功!')
except:
tk.messagebox.showerror(('注册失败!'))
window_sign_up.destroy()
#创建top窗口作为注册窗口
window_sign_up = tk.Toplevel(window)
window_sign_up.geometry('350x200')
window_sign_up.title('注册')
new_name = tk.StringVar()
new_name.set('1400370115')
tk.Label(window_sign_up,text='账号:').place(x=80,y=10)
entry_new_name = tk.Entry(window_sign_up,textvariable=new_name)
entry_new_name.place(x=150,y=10)
new_pwd = tk.StringVar()
tk.Label(window_sign_up, text='密码:').place(x=80, y=50)
entry_usr_pwd = tk.Entry(window_sign_up,textvariable=new_pwd,show='*')
entry_usr_pwd.place(x=150, y=50)
new_pwd_confirm = tk.StringVar()
tk.Label(window_sign_up,text='再次输入:').place(x=80,y=90)
entry_usr_pwd_again = tk.Entry(window_sign_up,textvariable=new_pwd_confirm,show='*')
entry_usr_pwd_again.place(x=150, y=90)
btn_again_sign_up = tk.Button(window_sign_up,text='注册',command=sign_to_Pyhon)
btn_again_sign_up.place(x=160,y=130)
#登陆和注册按钮
btn_login = tk.Button(window,text="登陆",command=usr_login)
btn_login.place(x=170,y=230)
btn_sign_up = tk.Button(window,text="注册",command=usr_sign_up)
btn_sign_up.place(x=270,y=230)
window.mainloop()
这是我写的登陆注册界面,使用tkinter,可以实现简单的登陆和注册账号,使用的主要是Label,Entry和Button组件。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持萬仟网。
希望与广大网友互动??
点此进行留言吧!
-
html+JavaScript登陆注册界面
2018-09-18 19:13:37最近刚刚学习了一些关于JavaScript的知识,便在之前... 做了一些简单的修改,本身还存在着很多的缺陷,希望大家多多指正。 ... [登陆界面2在线预览]:https://pengxiang1998.github.io/login/index/denglu.html [注...最近刚刚学习了一些关于JavaScript的知识,便在之前学习的html前端的基础上
做了一些简单的修改,本身还存在着很多的缺陷,希望大家多多指正。
githu下载地址:https://github.com/pengxiang1998/login
[登陆界面2在线预览]:https://pengxiang1998.github.io/login/index/denglu.html
[注册界面在线预览]:https://pengxiang1998.github.io/login/index/zhuce.html<title>登录</title>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function val(){
var name=window.document.getElementById("user").value;
var password=window.document.getElementById("password").value;//获取值
if (name == ""||password ==""){
window.alert("用户名或密码不能为空!");
return false;
}
if(name!="12345678"||password!="12345678"){//判断用户名密码登录
window.alert("用户名或密码错误!");
return false;
}
return true;
}
</script>
<style type="text/css">
a{text-decoration:none}
</style>
</head>
<body >
<table border=0 ><tr><th width=2000 height=150 border=1 bgcolor='ccffff'><center><table><th><img src="images/30.jpg" width='100' height='100'></th>
<th><font size='7' color='ff7517'>图书用户管理系统</th></table></center></th><tr>
<table style="background-image:url(images/.jpg);background-size: 100%; opacity: 1; filter: alpha(opacity = 30)"><th >
<table border=0><tr><th width=1500 height=600 border=1><img src="images/4.jpg" height='400' width=400></th><th>
<form action="form.html" method="post" οnsubmit="return val()" target="_blank">
<table border=0 bgcolor=F0F0F0>
<tr><th width=12 height=45></th><th colspan=3 width=82 height=45 align='left'>账户登录</th></tr>
<tr><th width=12 height=20></th><th width=20 height=20><img src="images/7.png" ></th><th width=50 height=20>
<input type="text" style="height:40px" placeholder="手机号/会员号/邮箱地址" size=40 id="user"></th><th width=12 height=20></th></tr>
<tr><th colspan=4 width=94 height=20></th></tr>
<tr><th width=12 height=20></th><th width=20 height=20><img src="images/8.png" ></th><th width=50 height=20>
<input type="password" style="height:40px" placeholder="?" id="password" size=40></th><th width=12 height=20></th></tr>
<tr><th colspan=4 width=94 height=20></th></tr>
<tr><th width=12 height=20></th>
<th colspan=2 width=70 height=20 bgcolor=FF5809><input type="submit"
style="background-color:FF5809;height:40px;width:140px;font-size:20px;color:white;border:none"
value="登录" ></th>
<th width=12 height=20></th></tr>
<tr><th colspan=4 width=94 height=20></th></tr>
<tr><th width=12 height=20></th><th width=70 height=20 colspan=2><img src="images/9.png" ></th><th width=12 height=20></th></form></tr>
<tr><th colspan=4 width=94 height=6></th></tr>
<tr><th width=12 height=40><th colspan=2><table width=310 border=0><tr><th width=35 height=20 align='left'><font size=2>忘记密码</font></th>
<th width=35 height=20 align='right'><font size=2><a href="zhuce.html" target="_blank">免费注册</a></font></th></tr></table></th><th></th></tr>
<tr><th colspan=4 width=94 height=6></th></tr>
</table></th><th width='700'></th></tr></table></th><tr><th bgcolor='f9fa9b' height=120><p>?联系邮箱:1234@qq.com</p><p>联系地址:枣庄学院</p><p>?联系电话:178****6451</p></th></table>
</body><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>注册</title>
<meta http-equiv='content-type' content='text/html;charset=utf-8'/>
<script type='text/javascript' src='jquery-1.7.2.js'></script>
<script type='text/javascript'>
var code ; //在全局定义验证码
function createCode(){
code = "";
var codeLength = 4;//验证码的长度
var checkCode = document.getElementById("code");
var random = new Array(0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R',
'S','T','U','V','W','X','Y','Z');//随机数
for(var i = 0; i < codeLength; i++) {//循环操作
var index = Math.floor(Math.random()*36);//取得随机数的索引(0~35)
code += random[index];//根据索引取得随机数加到code上
}
checkCode.value = code;//把code值赋给验证码
}
//校验验证码
function validate(){
var password=document.getElementById("password").value;
if (password.length<8){
alert("密码至少为8位!");}
var inputCode = document.getElementById("input").value.toUpperCase(); //取得输入的验证码并转化为大写
if(inputCode.length <= 0) { //若输入的验证码长度为0
alert("请输入验证码!"); //则弹出请输入验证码
}else if(inputCode != code ) { //若输入的验证码与产生的验证码不一致时
alert("验证码输入错误!@_@"); //则弹出验证码输入错误
createCode();//刷新验证码
document.getElementById("input").value = "";//清空文本框
}else { //输入正确时
alert("合格!^-^");
}
}
</script>
<style type='text/css'>
#code{
font-family:Arial,宋体;
font-style:italic;
color:blue;
size:12px;
border:0;
padding:2px 3px;
letter-spacing:8px;
font-weight:bolder;
}
</style>
</head><body οnlοad='createCode()'>
<table border=0><tr><th width=200 height=30></th><th ><img src="images/3.jpg"></th></tr></table>
<table border=0><tr><th width=700 height=400></th><th>
<form >
<table border=0 height=400 >
<tr><th height=65><font size='4'>用 户 名</th><th><input type="text" style="height:40px" placeholder="请输入用户名" size=40 name="username"></th></tr>
<tr><th height=65><font size='4'>密 码</th><th><input type="password" style="height:40px" placeholder="密码长度为6~18字符" size=40 id="password"></th></tr>
<tr><th height=65><font size='4'>确认密码</th><th><input type="password" style="height:40px" placeholder="请重新输入密码" size=40 id="password1"></th></tr>
<tr><th height=65><font size='4'>联系方式</th><th><input type="text" style="height:40px" placeholder="+86" size=40 name="username"></th></tr>
<tr><div><th><font size='4'>验 证 码</th><th>
<input type = "text" id = "input" style="height:40px;width:220px"/>
<input type="button" id="code" οnclick="createCode()" style="height:40px;width:80px" title='点击更换验证码' />
<!--<input type = "button" style="height:40px" value = "验证" onclick = "validate()"/> -->
</th>
</div> </tr>
<tr><th colspan=2 height=65><input type="checkbox"><font size='2' color='red' required/>我已阅读并同意相关条例</font></input></th></tr>
<tr><th colspan=2 height=65><input type='submit' style="background-color:red;height:55px;width:160px;font-size:25px;color:white;border:none" value='注册'id='l' onclick = "validate()" ></th></tr>
</table>
</form></th></tr></table>
<table><tr><th bgcolor='f9f8ed' height=200 width=2000><p>?联系邮箱:123456@qq.com</p><p>联系地址:枣庄学院</p><p>?联系电话:178****6451</p></th></tr></table></body>
</body>
</html> -
基于HTML5+css+JS的精美登陆注册界面.zip
2020-01-11 16:06:50基于HTML5+css+JS的精美登陆注册界面.zip -
防登陆注册界面
2015-12-23 16:57:09登陆注册java -
微信小程序登陆注册界面前后端完整代码展示
2020-01-14 19:09:58微信小程序登陆注册界面前后端代码展示 一首先是前端页面效果图 二 登陆限制 登陆没设置太多限制,都输入正确就登陆成功,失败就显示下图 三 注册限制 注册主要现在三点 1 用户名不能重复,否则显示下图效果 2 ...微信小程序登陆注册界面前后端代码展示
一首先是前端页面效果图
二 登陆限制
登陆没设置太多限制,都输入正确就登陆成功,失败就显示下图
三 注册限制
注册主要现在三点
1 用户名不能重复,否则显示下图效果
2 前后密码必须一致,否则显示下图效果
3 任意位置不能为空,否则显示下图效果
同时满足上面三点则注册成功跳转到登陆界面(其他验证方法可自行选择添加,方式相同)四 登陆部分完整代码
1 微信前端代码```java wxml部分 <view id="total"> <image src="img/111.png"></image> <form bindsubmit="create_login"> <view id="t1"> <text>账号</text><input type="text" name="username" id="use" placeholder="输入您的账号" value="{{username}}"></input> </view> <view id="t2"> <text>密码</text><input type="password" name="password" id="pass1" placeholder="输入您密码" value="{{password}}"></input> </view> <view id="t3"> <text>手机号后四位</text><input type="password" name="phone" id="pass2" placeholder="输入您的手机尾号" value="{{phone}}"></input> </view> <button bindtap="goto_index" id="btn1" form-type="submit"><text>登陆</text></button> </form> <button bindtap="goto_zhuce" id="btn2"><text>注册</text></button> <button bindtap="goto_update" id="btn3"><text>忘记密码</text></button> </view>
wxss
#total{ width:100%; height:1300rpx; background-color: rgb(245,245,245); } image{ width:150rpx; height:150rpx; position: relative; left:300rpx; top:100rpx; } #t1{ width:100%; height:125rpx; background-color: white; position: relative; top:200rpx; } #t2{ width:100%; height:125rpx; background-color: white; position: relative; top:210rpx; } #t3{ width:100%; height:125rpx; background-color: white; position: relative; top:220rpx; } #t1 text{ position: relative; left:40rpx; top:40rpx; color: rgb(143, 143, 143); } #use{ width:400rpx; height:80rpx; margin-left: 200rpx; position: relative; bottom: 25rpx; } #t2 text{ position: relative; left:40rpx; top:40rpx; color: rgb(143, 143, 143); } #pass1{ width:400rpx; height:80rpx; margin-left: 200rpx; position: relative; bottom: 25rpx; } #t3 text{ position: relative; left:40rpx; top:40rpx; color: rgb(143, 143, 143); } #pass2{ width:400rpx; height:80rpx; margin-left: 320rpx; position: relative; bottom: 25rpx; } #btn1{ position: relative; top:350rpx; background-color:rgb(51, 204, 170); width:600rpx; border-radius: 50rpx; } #btn1 text{ color:white; font-size: 39rpx; } #btn2{ position: relative; top:370rpx; right:230rpx; background-color: rgb(245, 245, 245); } #btn2::after{ border: none; } #btn2 text{ color:black; font-size: 39rpx; } #btn3{ position: relative; top:261rpx; left:200rpx; width:250rpx; background-color: rgb(245, 245, 245); } #btn3::after{ border: none; } #btn3 text{ color:black; font-size: 39rpx; }
js
``
data: { }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options) wx.getUserInfo({ success: this.setUserInfo.bind(this) }) this.setData({ }) }, setUserInfo: function (res) { this.setData({ user: res.userInfo }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, create_login: function (e) { console.log(e.detail.value) wx.request({ url: "http://localhost:8080/WEB18/denglu?username=" + e.detail.value["username"] + "&" + "password=" + e.detail.value["password"] + "&phone=" + e.detail.value["phone"], //url地址为后端代码的位置需修改 data: e.detail.value, success: this.getResult.bind(this) }) }, getResult: function (res) { console.log(res.data); if(res.data == "true"){ wx.showToast({ title: "登录成功", duration: 2000 }) wx.switchTab({ url: '../index/index', }) setTimeout(function () { wx.navigateBack({ delta: 2 }) }, 1000) } if(res.data == "false"){ wx.showToast({ title: "账号或密码不对", icon: 'none', duration: 3000 }) setTimeout(function () { wx.navigateBack({ delta: 2 }) }, 1000) } }, goto_index:function(res){ }, goto_zhuce: function (res) { wx.navigateTo({ url: '../zhuce/zhuce', }) } })
2 登陆java后端代码
package com.qianfeng.loginregister; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.gson.Gson; /** * Servlet implementation class login */ public class DengLu extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setContentType("text/json;charset=UTF-8"); Connection cn = null; PreparedStatement ps = null; ResultSet rs = null; String username = request.getParameter("username"); String password = request.getParameter("password"); String phone = request.getParameter("phone"); Gson gson = new Gson(); try { Class.forName("com.mysql.jdbc.Driver"); cn = DriverManager.getConnection("jdbc:mysql://localhost:3306/books","root","971110"); ps = cn.prepareStatement("select * from mima where username=? and password=?and phone=?"); ps.setString(1, username); ps.setString(2, password); ps.setString(3, phone); rs = ps.executeQuery(); if(rs.next()) { System.out.println("登陆成功!"); String json = gson.toJson("true"); response.getWriter().write(json); }else { System.out.println("账号或密码不正确!"); String json = gson.toJson("false"); response.getWriter().write(json); } } catch (Exception e) { e.printStackTrace(); }finally { try { if(rs!=null) rs.close(); } catch (SQLException e) { e.printStackTrace(); } try { if(ps!=null) ps.close(); } catch (SQLException e) { e.printStackTrace(); } try { if(cn!=null) cn.close(); } catch (SQLException e) { e.printStackTrace(); } } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
五 注册部分完整代码
1 微信部分代码
wxml
<view id="total"> <form bindsubmit="create_zhuce"> <view id="t1"> <text>账号</text><input type="text" name="username" id="use" placeholder="注册您的账号" value="{{username}}"></input> </view> <view id="t2"> <text>密码</text><input type="password" name="password1" id="pass1" placeholder="注册您密码" value="{{password1}}"></input> </view> <view id="t3"> <text>确认密码</text><input type="password" name="password2" id="pass2" placeholder="确认您密码" value="{{password2}}"></input> </view> <view id="t4"> <text>手机号后四位</text><input type="password" name="phone" id="pass3" placeholder="输入您的手机尾号" value="{{phone}}"></input> </view> <button id="btn1" form-type="submit"><text>注册</text></button> </form> </view>
wxss
#total{ width:100%; height:1300rpx; background-color: rgb(245,245,245); } #t1{ width:100%; height:125rpx; background-color: white; position: relative; top:70rpx; } #t2{ width:100%; height:125rpx; background-color: white; position: relative; top:80rpx; } #t3{ width:100%; height:125rpx; background-color: white; position: relative; top:90rpx; } #t4{ width:100%; height:125rpx; background-color: white; position: relative; top:100rpx; } #t1 text{ position: relative; left:40rpx; top:40rpx; color: rgb(143, 143, 143); } #use{ width:400rpx; height:80rpx; margin-left: 200rpx; position: relative; bottom: 25rpx; } #t2 text{ position: relative; left:40rpx; top:40rpx; color: rgb(143, 143, 143); } #pass1{ width:400rpx; height:80rpx; margin-left: 200rpx; position: relative; bottom: 25rpx; } #t3 text{ position: relative; left:40rpx; top:40rpx; color: rgb(143, 143, 143); } #pass2{ width:400rpx; height:80rpx; margin-left: 320rpx; position: relative; bottom: 25rpx; } #t4 text{ position: relative; left:40rpx; top:40rpx; color: rgb(143, 143, 143); } #pass3{ width:400rpx; height:80rpx; margin-left: 320rpx; position: relative; bottom: 25rpx; } #btn1{ position: relative; top:350rpx; background-color:rgb(51, 204, 170); width:600rpx; border-radius: 50rpx; } #btn1 text{ color:white; font-size: 39rpx; }
js
// pages/zhuce/zhuce.js Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ /*onLoad: function (options) { console.log(options) wx.getUserInfo({ success: this.setUserInfo.bind(this) }) this.setData({ }) }, setUserInfo: function (res) { this.setData({ user: res.userInfo }) },*/ /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, create_zhuce: function (e) { console.log(e.detail.value) wx.request({ url: "http://localhost:8080/WEB18/registerdemo?username=" + e.detail.value["username"] + "&password1=" + e.detail.value["password1"] + "&password2=" + e.detail.value["password2"] +"&phone=" + e.detail.value["phone"], data: e.detail.value, success: this.getResult.bind(this) }) }, getResult: function (res) { console.log(res.data); if (res.data == "true") { wx.showToast({ title: "注册成功", duration: 2000 }) wx.switchTab({ url: '../login/login', }) setTimeout(function () { wx.navigateBack({ delta: 2 }) }, 2000) } if (res.data == "-1") { wx.showToast({ title: "用户名已存在", icon: 'none', duration: 2000 }) setTimeout(function () { wx.navigateBack({ delta: 2 }) }, 2000) } if (res.data == "1") { wx.showToast({ title: "注册信息不为空", icon: 'none', duration: 2000 }) setTimeout(function () { wx.navigateBack({ delta: 2 }) }, 2000) } if ((res.data == "false") || (res.data == "0")) { wx.showToast({ title: "前后密码不一致", icon: 'none', duration: 3000 }) setTimeout(function () { wx.navigateBack({ delta: 2 }) }, 2000) } }, })
2 后端java完成代码
package com.qianfeng.loginregister; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.gson.Gson; import com.qianfeng.loginregister.RegisterDemo; /** * Servlet implementation class login */ public class RegisterDemo extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setContentType("text/json;charset=UTF-8"); Connection cn = null; PreparedStatement ps = null; Gson gson = new Gson(); String username = request.getParameter("username"); try { if(!cha(username)) { String password1 = request.getParameter("password1"); String password2 = request.getParameter("password2"); if(password1.equals(password2)) { String phone = request.getParameter("phone"); if((!username.equals("")) && (!password1.equals("")) && (!phone.equals(""))) { Class.forName("com.mysql.jdbc.Driver"); cn = DriverManager.getConnection("jdbc:mysql://localhost:3306/books","root","971110"); ps = cn.prepareStatement("insert into mima values (?,?,?)"); }else { System.out.println("注册信息不能为空!"); response.getWriter().write(gson.toJson(1)); } ps.setString(1, username); ps.setString(2, password1); ps.setString(3, phone); int num = ps.executeUpdate(); if(num > 0) { System.out.println("注册成功!"); String json = gson.toJson("true"); response.getWriter().write(json); }else { System.out.println("注册失败!"); String json = gson.toJson("false"); response.getWriter().write(json); } }else { System.out.println("两次密码不一致,请重新输入!"); response.getWriter().write(gson.toJson(0)); } }else { System.out.println("用户名重复,请重新输入!"); response.getWriter().write(gson.toJson(-1)); } } catch (Exception e) { e.printStackTrace(); }finally { try { if(ps!=null) ps.close(); } catch (Exception e) { e.printStackTrace(); } try { if(cn!=null) cn.close(); } catch (Exception e) { e.printStackTrace(); } } } public static Connection method() throws Exception { Class.forName("com.mysql.jdbc.Driver"); Connection cn = DriverManager.getConnection("jdbc:mysql://localhost:3306/books","root","971110"); return cn; } public static boolean cha(String username) throws Exception { boolean flag; Connection cn = method(); PreparedStatement ps = cn.prepareStatement("select * from mima where username = ?"); ps.setString(1, username); ResultSet rs = ps.executeQuery(); if(rs.next()) { flag = true; }else { flag = false; } rs.close(); ps.close(); return flag; } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
六 纯博主自己原创,肯定有很多不足,希望各位大牛批评指正
-
登陆注册界面的设计 MFC
2020-09-27 02:31:47用MFC编界面 介绍 介绍了登陆和注册等按钮的方法 -
简易登陆注册界面
2017-07-14 09:49:45关于MFC的简易的注册登录界面编写项目代码,自己更改一下账户密码储存路径即可。 -
基于python的注册登录界面_基于python的Tkinter编写登陆注册界面
2021-02-05 09:37:46tkinter创建登陆注册界面,供大家参考,具体内容如下import tkinter as tkfrom tkinter import messagebox#设置窗口居中def window_info():ws = window.winfo_screenwidth()hs = window.winfo_screenheight()x = (ws... -
用python和tkinter编写登陆界面_基于python的Tkinter编写登陆注册界面
2020-12-10 11:48:20tkinter创建登陆注册界面,供大家参考,具体内容如下import tkinter as tkfrom tkinter import messagebox#设置窗口居中def window_info():ws = window.winfo_screenwidth()hs = window.winfo_screenheight()x = (ws...