查询个人信息

master
zxy19971014 6 years ago
parent 4c8b9f506a
commit a003b437ce

@ -1,7 +1,11 @@
{
"pages": [
<<<<<<< Updated upstream
"denglu/denglu",
=======
>>>>>>> Stashed changes
"wode/wode",
"gerenxinxi/gerenxinxi",
"shuji/shuji",

@ -2,7 +2,7 @@ Page({
shujichzhao: function (e) {
var that = this
wx.request({
url: 'http://localhost:9527/zxbook/find1',
url: 'http://localhost:9528/zxbook/find1',
data: {
'search': e.detail.value.search,
},

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

@ -1,4 +1,4 @@
// 获取全局应用程序实例对象
const app = getApp();
@ -60,7 +60,7 @@ Page({
},
//以下为自定义点击事件
})

@ -1,4 +1,5 @@
<image class="wx-image_TCMtbw" mode="scaleToFill" src="//o3bnyc.creatby.com/diazo/images/image-placeholder.svg" style="background-size: 100% 100%; background-position: 0% 0%; background-repeat: no-repeat; background-image: url(http://o3bnyc.creatby.com/diazo/images/image-placeholder.svg);"/>
<text class="c-block wx-text_3ayXhS" > 姓名:</text>
<text class="c-block wx-text_cEEG0A" > 学号:</text>
<text class="c-block wx-text_lkXRAs" > 密码:</text>
<text class="c-block wx-text_3ayXhS" > 姓名:</text>
<input class="inputText" maxlength="15" name="userid"value="{{userid}}" />
<text class="c-block wx-text_cEEG0A" > 学号:${userpassword}</text>
<text class="c-block wx-text_lkXRAs" > 密码:${username}</text>

@ -13,7 +13,7 @@
"compileType": "miniprogram",
"libVersion": "2.4.0",
"appid": "wxb280d1925541c356",
"projectname": "33",
"projectname": "34",
"debugOptions": {
"hidedInDevtools": []
},

@ -22,6 +22,25 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
<version>${weixin.java.miniapp.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.44</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<!-- mysql数据库驱动类 -->
<dependency>
<groupId>mysql</groupId>

@ -1,57 +1,61 @@
package controller;
import java.io.IOException;
import java.io.Writer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import service.LoginService;
import domain.UserPO;
@Controller
public class LoginController {
@Autowired@Qualifier("LoginServiceImpl")
private LoginService loginService;
@RequestMapping("/login")
public void login(int userid, int userpassword,
HttpServletRequest request, HttpServletResponse response) throws IOException {
UserPO userPO=this.loginService.FindByUserid(userid);
response.setContentType("text/html;charset=utf-8");
/* 设置响应头允许ajax跨域访问 */
response.setHeader("Access-Control-Allow-Origin", "*");
/* 星号表示所有的异域请求都可以接受, */
response.setHeader("Access-Control-Allow-Methods", "GET,POST");
System.out.println(userid);
if(userPO!=null)
if(userpassword==userPO.getUserpassword())
{
System.out.println("密码正确");
Writer out = response.getWriter();
out.write("111");
out.flush();
}
else{
System.out.println("密码错误");
Writer out = response.getWriter();
out.write("100");
out.flush();
}
else{
System.out.println("不存在用户名");
Writer out = response.getWriter();
out.write("001");
out.flush();
}
}
}
package controller;
import java.io.IOException;
import java.io.Writer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.google.gson.Gson;
import service.LoginService;
import domain.UserPO;
@Controller
public class LoginController {
@Autowired@Qualifier("LoginServiceImpl")
private LoginService loginService;
@RequestMapping("/login")
public void login(int userid, int userpassword,
HttpServletRequest request, HttpServletResponse response) throws IOException {
UserPO userPO=this.loginService.FindByUserid(userid);
response.setContentType("text/html;charset=utf-8");
/* 设置响应头允许ajax跨域访问 */
response.setHeader("Access-Control-Allow-Origin", "*");
/* 星号表示所有的异域请求都可以接受, */
response.setHeader("Access-Control-Allow-Methods", "GET,POST");
System.out.println(userid);
if(userPO!=null)
if(userpassword==userPO.getUserpassword())
{
System.out.println("密码正确");
String ss = new Gson().toJson(userPO);
Writer out = response.getWriter();
out.write(ss);
out.flush();
}
else{
System.out.println("密码错误");
Writer out = response.getWriter();
out.write("100");
out.flush();
}
else{
System.out.println("不存在用户名");
Writer out = response.getWriter();
out.write("001");
out.flush();
}
}
}

@ -1,12 +1,12 @@
package mapperDAO;
import org.springframework.stereotype.Repository;
import domain.UserPO;
@Repository("UserDAO")
public interface UserDAO {
public UserPO FindByUserid(int userid);
}
package mapperDAO;
import org.springframework.stereotype.Repository;
import domain.UserPO;
@Repository("UserDAO")
public interface UserDAO {
public UserPO FindByUserid(int userid);
}

@ -1,9 +1,9 @@
package service;
import domain.UserPO;
public interface LoginService{
public UserPO FindByUserid(int userid);
}
package service;
import domain.UserPO;
public interface LoginService{
public UserPO FindByUserid(int userid);
}

@ -1,23 +1,23 @@
package serviceimpl;
import mapperDAO.UserDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import domain.UserPO;
import service.LoginService;
@Component("LoginServiceImpl")
public class LoginServiceImpl implements LoginService{
@Autowired@Qualifier("UserDAO")
private UserDAO userDAO;
public UserPO FindByUserid(int userid){
return this.userDAO.FindByUserid(userid);
}
}
package serviceimpl;
import mapperDAO.UserDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import domain.UserPO;
import service.LoginService;
@Component("LoginServiceImpl")
public class LoginServiceImpl implements LoginService{
@Autowired@Qualifier("UserDAO")
private UserDAO userDAO;
public UserPO FindByUserid(int userid){
return this.userDAO.FindByUserid(userid);
}
}

@ -17,7 +17,18 @@
driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/zx"
userId="root"
password="zjh19990323">
password="zxy19971014"
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.44</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>19990323">
</jdbcConnection>
<javaTypeResolver>

@ -13,7 +13,7 @@
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="username" value="root" />
<property name="password" value="zjh19990323" />
<property name="password" value="zxy19971014" />
<property name="url"
value="jdbc:mysql://127.0.0.1:3306/zx?useUnicode=true&amp;characterEncoding=utf8" />
</bean>

@ -17,7 +17,18 @@
driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/zx"
userId="root"
password="zjh19990323">
password="zxy19971014"
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.44</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>19990323">
</jdbcConnection>
<javaTypeResolver>

@ -13,7 +13,7 @@
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="username" value="root" />
<property name="password" value="zjh19990323" />
<property name="password" value="zxy19971014" />
<property name="url"
value="jdbc:mysql://127.0.0.1:3306/zx?useUnicode=true&amp;characterEncoding=utf8" />
</bean>

Loading…
Cancel
Save