修改登录界面

master
Allen 6 years ago
parent b9642a387c
commit a0dc9c2f4f

@ -1,52 +1,52 @@
Page({ Page({
formSubmit: function (e) { formSubmit: function (e) {
wx.request({ wx.request({
url: 'http://localhost:9527/zxlogin/login', url: 'http://localhost:9527/zxlogin/login',
data: { data: {
'userid': e.detail.value.userid, 'userid': e.detail.value.userid,
'userpassword': e.detail.value.userpassword, 'userpassword': e.detail.value.userpassword,
}, },
header: { header: {
"Content-Type": "application/x-www-form-urlencoded" "Content-Type": "application/x-www-form-urlencoded"
}, },
methods: { methods: {
method: "POST", method: "POST",
}, },
success: function (res) { success: function (res) {
console.log(res.data); console.log(res.data);
if (res.data == "111") { if (res.data == "111") {
wx.showModal({ wx.showModal({
title: '登录消息', title: '登录消息',
content: '密码正确', content: '登录成功',
confirmColor: "rgba(253, 153, 65, 1)", confirmColor: "rgba(253, 153, 65, 1)",
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
wx.switchTab({ wx.switchTab({
url: '../shouye/shouye', url: '../shouye/shouye',
}) })
} }
} }
}) })
} }
else if (res.data == "100") { else if (res.data == "100") {
wx.showModal({ wx.showModal({
title: '登录消息', title: '登录消息',
content: '密码错误', content: '密码错误',
confirmColor: "rgba(253, 153, 65, 1)" confirmColor: "rgba(253, 153, 65, 1)"
}) })
} }
else if (res.data == "001") { else if (res.data == "001") {
wx.showModal({ wx.showModal({
title: '登录消息', title: '登录消息',
content: '用户名不存在', content: '用户名不存在',
confirmColor: "rgba(253, 153, 65, 1)" confirmColor: "rgba(253, 153, 65, 1)"
}) })
} }
}, },
fail: function (res) { fail: function (res) {
console.log("失败"); console.log("失败");
} }
}) })
} }
}) })

@ -1,6 +1,3 @@
{ {
"component": true,
"usingComponents": {} "usingComponents": {}
} }

@ -1,15 +1,29 @@
<form bindsubmit="formSubmit" > <form bindsubmit="formSubmit" >
<view class="flex-row" style="display: flex;"> <view class="container">
<text class="text1" >学号</text> <view class="login-icon">
<input class="inputnumber" maxlength="15" name="userid" placeholder=" 请输入您的学号" type="number" value="{{idTxt}}"/> <image class="login-img" src="../images/123.jpg"></image>
</view> </view>
<view class="flex-row" style="display: flex;"> <view class="login-from">
<text class="password" >密码</text></view>
<view class="flex-row" style="display: flex;"> <!--账号-->
<input class="inputpassword" password="true" name="userpassword" placeholder=" 默认身份证号后六位" type="number"value="{{passwordTxt}}"/> <view class="inputView">
</view> <label class="loginLab">账号</label>
<button class="button1" formType="submit" > <input class="inputText" placeholder="请输入账号" bindinput="phoneInput" maxlength="15" name="userid"value="{{idTxt}}" />
登 录</button>
</view>
<view class="line"></view>
<!--密码-->
<view class="inputView">
<label class="loginLab">密码</label>
<input class="inputText" name="userpassword" password="true" value="{{passwordTxt}}" placeholder="默认密码身份证后六位" bindinput="passwordInput" />
</view>
<!--按钮-->
<view class="loginBtnView">
<button class="loginBtn" size="{{primarySize}}" loading="{{loading}}" plain="{{plain}}" disabled="{{disabled}}" bindtap="login" formType="submit">登录</button>
</view>
</view>
</view>
</form> </form>

@ -1,59 +1,74 @@
/* denglu/denglu.wxss */ page{
page { height: 100%;
background-image: url("http://qty83k.creatby.com/materials/143410/origin/21bbf9caec3fddab4b8304359e2b41bb_origin.jpg"); background-size: 375px 678px; }
background-repeat: no-repeat;
} .container {
.button1{ height: 100%;
width: 60%;
margin-top: 0rpx;
background-color:rgba(253, 153, 65, 0.67);
color: white;
border-radius: 98rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: column;
align-items: center; padding: 0;
justify-content: center; box-sizing: border-box;
margin-top: 140px; background-color: #f2f2f2
} }
.inputnumber{
width:50%; /*登录图片*/
background-color: transparent; .login-icon{
height:1.6rem; flex: none;
font-size: 18px; }
margin-left: 15px; .login-img{
margin-top: 100px; width: 750rpx;
display: inline; }
border-width: 2px;
border-color: rgb(255, 255, 255);
border-style: solid;
color: #ffffff;
}
.inputpassword{
width:50%;
background-color: transparent;
height:1.6rem;
font-size: 18px;
margin-left: 108px;
margin-top: -30px;
border-width: 2px;
border-color: rgb(255, 255, 255);
border-style: solid;
color: #ffffff;
}
.text1{
width: 50px;
font-size: 23px;
color: #ffffff;
margin-left: 43px;
margin-top:100px;
}
.password{width: 50px;
font-size: 23px;
color: #ffffff;
margin-left: 43px;
margin-top:50px;
} /*表单内容*/
.login-from {
margin-top: 20px;
flex: auto;
height:100%;
}
.inputView {
background-color: #fff;
line-height: 44px;
}
/*输入框*/
.nameImage, .keyImage {
margin-left: 42px;
width: 14px;
height: 14px
}
.loginLab {
margin: 15px 15px 15px 10px;
color: #545454;
font-size: 14px
}
.inputText {
flex: block;
float: right;
text-align: right;
margin-right: 22px;
margin-top: 11px;
color: #cccccc;
font-size: 14px
}
.line {
width: 100%;
height: 1px;
background-color: #cccccc;
margin-top: 1px;
}
/*按钮*/
.loginBtnView {
width: 100%;
height: auto;
background-color: rgb(253,253,65);
margin-top: 0px;
margin-bottom: 0px;
padding-bottom: 0px;
}
.loginBtn {
width: 80%;
margin-top: 35px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

@ -20,17 +20,17 @@ public class LoginController {
@Autowired@Qualifier("LoginServiceImpl") @Autowired@Qualifier("LoginServiceImpl")
private LoginService loginService; private LoginService loginService;
@RequestMapping("/login") @RequestMapping("/login")
public void login(int userid, int userpassword, public void login(int s_id, int s_password,
HttpServletRequest request, HttpServletResponse response) throws IOException { HttpServletRequest request, HttpServletResponse response) throws IOException {
UserPO userPO=this.loginService.FindByUserid(userid); UserPO userPO=this.loginService.FindByUserid(s_id);
response.setContentType("text/html;charset=utf-8"); response.setContentType("text/html;charset=utf-8");
/* 设置响应头允许ajax跨域访问 */ /* 设置响应头允许ajax跨域访问 */
response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Origin", "*");
/* 星号表示所有的异域请求都可以接受, */ /* 星号表示所有的异域请求都可以接受, */
response.setHeader("Access-Control-Allow-Methods", "GET,POST"); response.setHeader("Access-Control-Allow-Methods", "GET,POST");
System.out.println(userid); System.out.println(s_id);
if(userPO!=null) if(userPO!=null)
if(userpassword==userPO.getUserpassword()) if(s_password==userPO.getUserpassword())
{ {
System.out.println("密码正确"); System.out.println("密码正确");
Writer out = response.getWriter(); Writer out = response.getWriter();

@ -3,7 +3,7 @@ package domain;
import java.io.Serializable; import java.io.Serializable;
public class UserPO implements Serializable{ public class UserPO implements Serializable{
private int userid; private int s_id;
private int userpassword; private int userpassword;
private String username; private String username;
public int getUserid() { public int getUserid() {

@ -6,7 +6,7 @@ import domain.UserPO;
@Repository("UserDAO") @Repository("UserDAO")
public interface UserDAO { public interface UserDAO {
public UserPO FindByUserid(int userid); public UserPO FindByUserid(int s_id);
} }

@ -4,5 +4,5 @@ import domain.UserPO;
public interface LoginService{ public interface LoginService{
public UserPO FindByUserid(int userid); public UserPO FindByUserid(int s_id);
} }

@ -15,8 +15,8 @@ public class LoginServiceImpl implements LoginService{
private UserDAO userDAO; private UserDAO userDAO;
public UserPO FindByUserid(int userid){ public UserPO FindByUserid(int s_id){
return this.userDAO.FindByUserid(userid); return this.userDAO.FindByUserid(s_id);
} }
} }

Loading…
Cancel
Save