这次是个完整的易居,可实现登录、注册、拦截、图片轮播等功能
结构、代码如下
代码如下
Collect.java
package com.yiju.bean;
/**
* 收藏类
*/
public class Collect {
private int collId; //收藏记录的唯一标识ID
private int userId; //用户ID
private int houseId; //用户收藏的房源ID
private int isDelete; //是否删除 0-未删除 1-已删除
private long createTime; //创建时间
private long updateTime; //更新时间
public int getCollId() {
return collId;
}
public void setCollId(int collId) {
this.collId = collId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getHouseId() {
return houseId;
}
public void setHouseId(int houseId) {
this.houseId = houseId;
}
public int getIsDelete() {
return isDelete;
}
public void setIsDelete(int isDelete) {
this.isDelete = isDelete;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "Collect{" +
"collId=" + collId +
", userId=" + userId +
", houseId=" + houseId +
", isDelete=" + isDelete +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
House.java
package com.yiju.bean;
import java.math.BigDecimal;
/**
* 房屋表
*/
public class House {
private int houseId; //房源表唯一标识ID
private int userId; //发布此房源的用户ID
private int houseType; //房源类型 0:新房 1:旧房 2:租房
private String houseTitle; //房源帖子标题
private String houseHeadimg; //房源帖子头像
private String housePlanimg1; //房屋户型平面图1 外键
private String housePlanimg2; //房屋户型平面图2 外键
private String houseImg1; //房源室内图1
private String houseImg2; //房源室内图2
private String houseImg3; //房源室内图3
private String houseImg4; //房源室内图4
private String houseImg5; //房源室内图5
private String houseImg6; //房源室内图6
private BigDecimal housePrice; //房源预计售价
private String priceUnit; //售价单位 元/每月 元/每套 元/每年
private String houseAddress; //房源地址
private int isDelete; //0:未删除 1:已删除
private long createTime; //创建时间
private long updateTime; //更新时间
public int getHouseId() {
return houseId;
}
public void setHouseId(int houseId) {
this.houseId = houseId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getHouseType() {
return houseType;
}
public void setHouseType(int houseType) {
this.houseType = houseType;
}
public String getHouseTitle() {
return houseTitle;
}
public void setHouseTitle(String houseTitle) {
this.houseTitle = houseTitle;
}
public String getHouseHeadimg() {
return houseHeadimg;
}
public void setHouseHeadimg(String houseHeadimg) {
this.houseHeadimg = houseHeadimg;
}
public String getHousePlanimg1() {
return housePlanimg1;
}
public void setHousePlanimg1(String housePlanimg1) {
this.housePlanimg1 = housePlanimg1;
}
public String getHousePlanimg2() {
return housePlanimg2;
}
public void setHousePlanimg2(String housePlanimg2) {
this.housePlanimg2 = housePlanimg2;
}
public String getHouseImg1() {
return houseImg1;
}
public void setHouseImg1(String houseImg1) {
this.houseImg1 = houseImg1;
}
public String getHouseImg2() {
return houseImg2;
}
public void setHouseImg2(String houseImg2) {
this.houseImg2 = houseImg2;
}
public String getHouseImg3() {
return houseImg3;
}
public void setHouseImg3(String houseImg3) {
this.houseImg3 = houseImg3;
}
public String getHouseImg4() {
return houseImg4;
}
public void setHouseImg4(String houseImg4) {
this.houseImg4 = houseImg4;
}
public String getHouseImg5() {
return houseImg5;
}
public void setHouseImg5(String houseImg5) {
this.houseImg5 = houseImg5;
}
public String getHouseImg6() {
return houseImg6;
}
public void setHouseImg6(String houseImg6) {
this.houseImg6 = houseImg6;
}
public BigDecimal getHousePrice() {
return housePrice;
}
public void setHousePrice(BigDecimal housePrice) {
this.housePrice = housePrice;
}
public String getPriceUnit() {
return priceUnit;
}
public void setPriceUnit(String priceUnit) {
this.priceUnit = priceUnit;
}
public String getHouseAddress() {
return houseAddress;
}
public void setHouseAddress(String houseAddress) {
this.houseAddress = houseAddress;
}
public int getIsDelete() {
return isDelete;
}
public void setIsDelete(int isDelete) {
this.isDelete = isDelete;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "House{" +
"houseId=" + houseId +
", userId=" + userId +
", houseType=" + houseType +
", houseTitle='" + houseTitle + '\'' +
", houseHeadimg='" + houseHeadimg + '\'' +
", housePlanimg1='" + housePlanimg1 + '\'' +
", housePlanimg2='" + housePlanimg2 + '\'' +
", houseImg1='" + houseImg1 + '\'' +
", houseImg2='" + houseImg2 + '\'' +
", houseImg3='" + houseImg3 + '\'' +
", houseImg4='" + houseImg4 + '\'' +
", houseImg5='" + houseImg5 + '\'' +
", houseImg6='" + houseImg6 + '\'' +
", housePrice=" + housePrice +
", priceUnit='" + priceUnit + '\'' +
", houseAddress='" + houseAddress + '\'' +
", isDelete=" + isDelete +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
HouseInfo.java
package com.yiju.bean;
/**
* 房屋信息表
*/
public class HouseInfo {
private int infoId; //房源详细信息表唯一标识ID
private int houseId; //对应房源表唯一ID
private String houseNature; //房源性质:商品房 住宅房
private String houseModel; //普通式住宅 公寓式住宅 别墅 独栋
private int houseYear; //房源建造时间
private String houseValid; //房源期限: 70年、100年、永久
private String houseLayout; //房源户型:几室几厅几卫
private String houseArea; //房源面积
private String houseTurn; //朝向
private int houseFloor; //楼层
private int floorAll; //总楼层
private String houseDecorate; //装饰类型:精装 简装
private String houseLift; //是否有电梯: 0无 1有
private long createTime; //创建时间
private long updateTime; //更新时间
public int getInfoId() {
return infoId;
}
public void setInfoId(int infoId) {
this.infoId = infoId;
}
public int getHouseId() {
return houseId;
}
public void setHouseId(int houseId) {
this.houseId = houseId;
}
public String getHouseNature() {
return houseNature;
}
public void setHouseNature(String houseNature) {
this.houseNature = houseNature;
}
public String getHouseModel() {
return houseModel;
}
public void setHouseModel(String houseModel) {
this.houseModel = houseModel;
}
public int getHouseYear() {
return houseYear;
}
public void setHouseYear(int houseYear) {
this.houseYear = houseYear;
}
public String getHouseValid() {
return houseValid;
}
public void setHouseValid(String houseValid) {
this.houseValid = houseValid;
}
public String getHouseLayout() {
return houseLayout;
}
public void setHouseLayout(String houseLayout) {
this.houseLayout = houseLayout;
}
public String getHouseArea() {
return houseArea;
}
public void setHouseArea(String houseArea) {
this.houseArea = houseArea;
}
public String getHouseTurn() {
return houseTurn;
}
public void setHouseTurn(String houseTurn) {
this.houseTurn = houseTurn;
}
public int getHouseFloor() {
return houseFloor;
}
public void setHouseFloor(int houseFloor) {
this.houseFloor = houseFloor;
}
public int getFloorAll() {
return floorAll;
}
public void setFloorAll(int floorAll) {
this.floorAll = floorAll;
}
public String getHouseDecorate() {
return houseDecorate;
}
public void setHouseDecorate(String houseDecorate) {
this.houseDecorate = houseDecorate;
}
public String getHouseLift() {
return houseLift;
}
public void setHouseLift(String houseLift) {
this.houseLift = houseLift;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "HouseInfo{" +
"infoId=" + infoId +
", houseId=" + houseId +
", houseNature='" + houseNature + '\'' +
", houseModel='" + houseModel + '\'' +
", houseYear=" + houseYear +
", houseValid='" + houseValid + '\'' +
", houseLayout='" + houseLayout + '\'' +
", houseArea='" + houseArea + '\'' +
", houseTurn='" + houseTurn + '\'' +
", houseFloor=" + houseFloor +
", floorAll=" + floorAll +
", houseDecorate='" + houseDecorate + '\'' +
", houseLift='" + houseLift + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
HouseInter.java
package com.yiju.bean;
/**
* 出租房屋内饰表
*/
public class HouseInter {
private int interId; //内饰表ID
private int houseId; //对应房源id
private int bed; //床:0无 1有
private int washing; //洗衣机:0无 1有
private int air; //空调: 0无 1有
private int balcony; //阳台:0无 1有
private int ice; //冰箱:0无 1有
private int toilet; //卫生间:0无 1有
private int kitchen; //厨房:0无 1有
private int tv; //电视:0无 1有
private int heater; //热水器:0无 1有
private int wardrobe; //衣柜:0无 1有
private int heating; //暖气:0无 1有
private int internet; //宽带:0无 1有
private int sofa; //沙发:0无 1有
private long createTime; //创建时间
private long updateTime; //更新时间
public int getInterId() {
return interId;
}
public void setInterId(int interId) {
this.interId = interId;
}
public int getHouseId() {
return houseId;
}
public void setHouseId(int houseId) {
this.houseId = houseId;
}
public int getBed() {
return bed;
}
public void setBed(int bed) {
this.bed = bed;
}
public int getWashing() {
return washing;
}
public void setWashing(int washing) {
this.washing = washing;
}
public int getAir() {
return air;
}
public void setAir(int air) {
this.air = air;
}
public int getBalcony() {
return balcony;
}
public void setBalcony(int balcony) {
this.balcony = balcony;
}
public int getIce() {
return ice;
}
public void setIce(int ice) {
this.ice = ice;
}
public int getToilet() {
return toilet;
}
public void setToilet(int toilet) {
this.toilet = toilet;
}
public int getKitchen() {
return kitchen;
}
public void setKitchen(int kitchen) {
this.kitchen = kitchen;
}
public int getTv() {
return tv;
}
public void setTv(int tv) {
this.tv = tv;
}
public int getHeater() {
return heater;
}
public void setHeater(int heater) {
this.heater = heater;
}
public int getWardrobe() {
return wardrobe;
}
public void setWardrobe(int wardrobe) {
this.wardrobe = wardrobe;
}
public int getHeating() {
return heating;
}
public void setHeating(int heating) {
this.heating = heating;
}
public int getInternet() {
return internet;
}
public void setInternet(int internet) {
this.internet = internet;
}
public int getSofa() {
return sofa;
}
public void setSofa(int sofa) {
this.sofa = sofa;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "HouseInter{" +
"interId=" + interId +
", houseId=" + houseId +
", bed=" + bed +
", washing=" + washing +
", air=" + air +
", balcony=" + balcony +
", ice=" + ice +
", toilet=" + toilet +
", kitchen=" + kitchen +
", tv=" + tv +
", heater=" + heater +
", wardrobe=" + wardrobe +
", heating=" + heating +
", internet=" + internet +
", sofa=" + sofa +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
UserAuth.java
package com.yiju.bean;
/**
* 用户认证实体类
*/
public class UserAuth {
private int authId; //认证id
private int userId; //用户id
private String userName; //用户姓名
private int userGender; //性别
private String userCard; //身份证号码
private String userCardAddress; //身份证住址
private String userLiveAddress; //住址
private String userCarding; //证件照
private String userPropertyimg; //房产证照片
private int authStatus;//认证状态
private int isDelete; //是否已删除 0-未删除 1-已删除
private long createTime; //创建时间
private long updateTime; //更新时间
public int getAuthId() {
return authId;
}
public void setAuthId(int authId) {
this.authId = authId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public int getUserGender() {
return userGender;
}
public void setUserGender(int userGender) {
this.userGender = userGender;
}
public String getUserCard() {
return userCard;
}
public void setUserCard(String userCard) {
this.userCard = userCard;
}
public String getUserCardAddress() {
return userCardAddress;
}
public void setUserCardAddress(String userCardAddress) {
this.userCardAddress = userCardAddress;
}
public String getUserLiveAddress() {
return userLiveAddress;
}
public void setUserLiveAddress(String userLiveAddress) {
this.userLiveAddress = userLiveAddress;
}
public String getUserCarding() {
return userCarding;
}
public void setUserCarding(String userCarding) {
this.userCarding = userCarding;
}
public String getUserPropertyimg() {
return userPropertyimg;
}
public void setUserPropertyimg(String userPropertyimg) {
this.userPropertyimg = userPropertyimg;
}
public int getAuthStatus() {
return authStatus;
}
public void setAuthStatus(int authStatus) {
this.authStatus = authStatus;
}
public int getIsDelete() {
return isDelete;
}
public void setIsDelete(int isDelete) {
this.isDelete = isDelete;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "UserAuth{" +
"authId=" + authId +
", userId=" + userId +
", userName='" + userName + '\'' +
", userGender=" + userGender +
", userCard='" + userCard + '\'' +
", userCardAddress='" + userCardAddress + '\'' +
", userLiveAddress='" + userLiveAddress + '\'' +
", userCarding='" + userCarding + '\'' +
", userPropertyimg='" + userPropertyimg + '\'' +
", authStatus=" + authStatus +
", isDelete=" + isDelete +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
UserInfo.java
package com.yiju.bean;
public class UserInfo {
public UserInfo() {
}
public UserInfo(int userId, String nickname, String truename, int gender, String city, long createTime) {
this.userId = userId;
this.nickname = nickname;
this.truename = truename;
this.gender = gender;
this.city = city;
this.createTime = createTime;
}
private int userId; //用户id
private String phone; //用户手机号,用于登录
private String password; //密码
private String email; //邮箱
private String nickname; //昵称
private String truename; //真实姓名
private int gender; //性别 0:男 1:女
private String province; //省份
private String city; //城市
private int isDelete; //是否删除 0:未删除 1:已删除
private long createTime; //创建时间
private long updateTime; //更新时间
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getTruename() {
return truename;
}
public void setTruename(String truename) {
this.truename = truename;
}
public int getGender() {
return gender;
}
public void setGender(int gender) {
this.gender = gender;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public int getIsDelete() {
return isDelete;
}
public void setIsDelete(int isDelete) {
this.isDelete = isDelete;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "UserInfo{" +
"userId=" + userId +
", phone='" + phone + '\'' +
", password='" + password + '\'' +
", email='" + email + '\'' +
", nickname='" + nickname + '\'' +
", truename='" + truename + '\'' +
", gender=" + gender +
", province='" + province + '\'' +
", city='" + city + '\'' +
", isDelete=" + isDelete +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
HouseViewController.java
package com.yiju.controller;
import com.github.pagehelper.PageInfo;
import com.yiju.bean.House;
import com.yiju.bean.HouseInfo;
import com.yiju.bean.HouseInter;
import com.yiju.pojo.HouseView;
import com.yiju.service.IHouseViewService;
import com.yiju.util.YijuUtil;
import net.sf.json.JSONObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Controller
@RequestMapping("house")
public class HouseViewController {
@Autowired
private IHouseViewService houseViewService;
//显示新|旧|租 房推荐的4条数据
@RequestMapping("findFourHouse.do")
public ModelAndView findFourHouse(){
ModelAndView mv=new ModelAndView();
List<HouseView> newHouses = houseViewService.findFourHouseByType(0);
List<HouseView> oldHouses = houseViewService.findFourHouseByType(1);
List<HouseView> rentHouses = houseViewService.findFourHouseByType(2);
mv.addObject("newHouses",newHouses);
mv.addObject("oldHouses",oldHouses);
mv.addObject("rentHouses",rentHouses);
mv.setViewName("../main");
return mv;
}
//点击图片 h3 跳转房屋详情页面
@RequestMapping("findHouseById")
public ModelAndView findHouseById(int houseId){
ModelAndView mv=new ModelAndView();
HouseView house= houseViewService.findHouseByHouseId(houseId);
mv.addObject("houseInfo",house);
mv.setViewName("details");
return mv;
}
@RequestMapping("findHouse.do")
public ModelAndView findHouse(@RequestParam(defaultValue = "1") int currentPage, int houseType ){
ModelAndView mv=new ModelAndView();
// 房子的所有数据
List<HouseView> houses = houseViewService.findHouseByType(currentPage,houseType);
//推荐房源数据
List<HouseView> fh = houseViewService.findFourHouseByType(houseType);
//把houses放到分页中
PageInfo<HouseView> pageInfo=new PageInfo<>(houses);
mv.addObject("pageInfo",pageInfo);
mv.addObject("fh",fh);
mv.addObject("houseType",houseType);
mv.setViewName("houses");
return mv;
}
@RequestMapping("toHousePost2.do")
public ModelAndView toHousePost2(@Param(value = "houseTitle") String houseTitle,
@Param(value = "houseAddress") String houseAddress,
@Param(value = "housePrice") BigDecimal housePrice,
@Param(value = "priceUnit") String priceUnit,
@Param(value = "houseHeadimg") MultipartFile houseHeadimg,
@Param(value = "housePlanimg1") MultipartFile housePlanimg1,
@Param(value = "housePlanimg2") MultipartFile housePlanimg2,
@Param(value = "houseImg1") MultipartFile houseImg1,
@Param(value = "houseImg2") MultipartFile houseImg2,
@Param(value = "houseImg3") MultipartFile houseImg3,
@Param(value = "houseImg4") MultipartFile houseImg4,
@Param(value = "houseImg5") MultipartFile houseImg5,
@Param(value = "houseImg6") MultipartFile houseImg6,
HttpSession session
) throws IOException {
House house=new House();
house.setHouseTitle(houseTitle);
house.setHouseAddress(houseAddress);
house.setHousePrice(housePrice);
house.setPriceUnit(priceUnit);
house.setUserId(10007);
Map<String, byte[]> images=new HashMap<>();
if ( houseHeadimg.getSize()!=0){
String picName= YijuUtil.getPicName();
house.setHouseHeadimg(picName);
images.put(picName,houseHeadimg.getBytes());
}
if (housePlanimg1.getSize()!=0){
String picName= YijuUtil.getPicName();
house.setHouseHeadimg(picName);
images.put(picName,housePlanimg1.getBytes());
}
if (housePlanimg2.getSize()!=0){
String picName= YijuUtil.getPicName();
house.setHouseHeadimg(picName);
images.put(picName,housePlanimg2.getBytes());
}
if (houseImg1.getSize()!=0){
String picName= YijuUtil.getPicName();
house.setHouseHeadimg(picName);
images.put(picName,houseImg1.getBytes());
}
if (houseImg2.getSize()!=0){
String picName= YijuUtil.getPicName();
house.setHouseHeadimg(picName);
images.put(picName,houseImg2.getBytes());
}
if (houseImg3.getSize()!=0){
String picName= YijuUtil.getPicName();
house.setHouseHeadimg(picName);
images.put(picName,houseImg3.getBytes());
}
if (houseImg4.getSize()!=0){
String picName= YijuUtil.getPicName();
house.setHouseHeadimg(picName);
images.put(picName,houseImg4.getBytes());
}
if (houseImg5.getSize()!=0){
String picName= YijuUtil.getPicName();
house.setHouseHeadimg(picName);
images.put(picName,houseImg5.getBytes());
}
if (houseImg6.getSize()!=0){
String picName= YijuUtil.getPicName();
house.setHouseHeadimg(picName);
images.put(picName,houseImg6.getBytes());
}
session.setAttribute("house",house);
session.setAttribute("images",images);
// Set<String> keys=images.keySet();
// for (String key:keys){
// MultipartFile file=images.get(key);
// YijuUtil.upload(file.getBytes(),key);
// }
// houseViewService.postHouse(house);
ModelAndView mv=new ModelAndView();
mv.setViewName("housePost2");
return mv;
}
@RequestMapping("responsePost2.do")
@ResponseBody
public String responsePost2(HouseInfo houseInfo,HttpSession session){
// houseInfo.setHouseId(10001);
// houseViewService.postHouseInfo(houseInfo);
session.setAttribute("houseInfo",houseInfo);
return new JSONObject().toString();
}
@RequestMapping("responsePost3.do")
@ResponseBody
public String responsePost3(HouseInter houseInter,HttpSession session){
// houseInter.setHouseId(10013);
// houseViewService.postHouseInter(houseInter);
session.setAttribute("houseInter",houseInter);
return new JSONObject().toString();
}
@RequestMapping("doHousePost.do")
public String doHousePost(HttpSession session) throws IOException {
House house= (House) session.getAttribute("house");
Map<String,byte[]> images= (Map<String, byte[]>) session.getAttribute("images");
HouseInfo houseInfo= (HouseInfo) session.getAttribute("houseInfo");
HouseInter houseInter= (HouseInter) session.getAttribute("houseInter");
houseViewService.postHouse(house);
Set<String> keys=images.keySet();
for (String key:keys){
byte[] bytes=images.get(key);
//MultipartFile file=images.get(key);
YijuUtil.upload(bytes,key);
}
houseInfo.setHouseId(house.getHouseId());
houseViewService.postHouseInfo(houseInfo);
houseInter.setHouseId(house.getHouseId());
houseViewService.postHouseInter(houseInter);
return "redirect:findHouseById.do?houseId="+house.getHouseId();
}
}
UserController.java
package com.yiju.controller;
import com.yiju.bean.Collect;
import com.yiju.bean.UserAuth;
import com.yiju.bean.UserInfo;
import com.yiju.pojo.CollectView;
import com.yiju.service.IUserService;
import net.sf.json.JSONObject;
import org.apache.ibatis.annotations.Param;
import org.omg.PortableInterceptor.USER_EXCEPTION;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping("user")
public class UserController {
@Autowired
private IUserService userService;
@RequestMapping("login2.do")
@ResponseBody
public String login2(@Param(value = "phone") String phone,
@Param(value = "password") String password,
HttpSession session) {
JSONObject jsonObject = new JSONObject();
UserInfo user = userService.findByPhone(phone);
if (user == null) {
jsonObject.put("result", "0");
} else if (!password.equals(user.getPassword())) {
jsonObject.put("result", "1");
} else {
session.setAttribute("user",user);
jsonObject.put("result", "2");
}
return jsonObject.toString();
}
@RequestMapping("singup.do")
@ResponseBody
public String singup(@Param(value = "phone") String phone,
@Param(value = "password") String password) {
//1.看一下该手机有没有注册
//2.已经有了 就提示该用户已经注册,跳转到登入页面
//3.没有 就注册
JSONObject jsonObject = new JSONObject();
UserInfo user = userService.findByPhone(phone);
if (user == null) {
userService.add(phone, password);
jsonObject.put("result", "0");
} else {
jsonObject.put("result", "1");
}
return jsonObject.toString();
}
@RequestMapping("saveEdit.do")
@ResponseBody
public String saveEdit(UserInfo userInfo,HttpSession session ) {
JSONObject jsonObject = new JSONObject();
UserInfo userInfo1= (UserInfo) session.getAttribute("user");
userInfo1.setTruename(userInfo.getTruename());
userInfo1.setNickname(userInfo.getNickname());
userInfo1.setGender(userInfo.getGender());
userInfo1.setCity(userInfo.getCity());
userService.updateUserInfo(userInfo1);
session.setAttribute("user",userInfo1);
return jsonObject.toString();
}
@RequestMapping("login.do")
@ResponseBody
public String login(@Param(value = "username") String username,
@Param(value = "password") String password) {
if ("123".equals(username) && "123".equals(password)) {
return "success";
}
return "failure";
}
@RequestMapping("login1.do")
@ResponseBody
public String login1(@Param(value = "username") String username,
@Param(value = "password") String password) {
JSONObject jsonObject = new JSONObject();
if ("123".equals(username) && "123".equals(password)) {
jsonObject.put("result", "1");
//{result:1,result:2}
} else {
jsonObject.put("result", "2");
}
return jsonObject.toString();
}
@RequestMapping("verify.do")
public ModelAndView verify(HttpSession session) {
UserInfo user= (UserInfo) session.getAttribute("user");
UserAuth userAuth = userService.findUserAuth(user.getUserId());
session.setAttribute("userAuth",userAuth);
ModelAndView modelAndView=new ModelAndView();
modelAndView.setViewName("verify");
return modelAndView;
}
@RequestMapping("saveAuth.do")
@ResponseBody
public String saveAuth(HttpSession session,UserAuth userAuth ){
UserInfo user= (UserInfo) session.getAttribute("user");
userAuth.setUserName(user.getTruename());
userAuth.setUserGender(user.getGender());
userAuth.setUserId(user.getUserId());
userAuth.setCreateTime(new Date().getTime());
userAuth.setUpdateTime(new Date().getTime());
userService.postUserAuth(userAuth);
return new JSONObject().toString();
}
@RequestMapping("deleteAuth.do")
public ModelAndView deleteAuth(HttpSession session ){
UserInfo user= (UserInfo) session.getAttribute("user");
userService.deleteById(user.getUserId());
ModelAndView modelAndView=new ModelAndView();
modelAndView.setViewName("personal");
return modelAndView;
}
@RequestMapping("upps.do")
@ResponseBody
public String upps(HttpSession session,String oldpassword,String password ){
UserInfo user= (UserInfo) session.getAttribute("user");
JSONObject jsonObject = new JSONObject();
if(!user.getPassword().equals(oldpassword)){
jsonObject.put("result",1);
}else {
user.setPassword(password);
userService.updatePS(user);
session.setAttribute("user",user);
jsonObject.put("result",2);
}
return jsonObject.toString();
}
@RequestMapping("favorite.do")
public ModelAndView favorite(HttpSession session){
UserInfo user= (UserInfo) session.getAttribute("user");
ModelAndView modelAndView=new ModelAndView();
List<CollectView> collcets = userService.getCollectViewByUser(user.getUserId());
modelAndView.addObject("collcets",collcets);
modelAndView.setViewName("favorite");
return modelAndView;
}
@RequestMapping("addToCollect.do")
@ResponseBody
public String addToCollect(HttpSession session,int houseId){
UserInfo user= (UserInfo) session.getAttribute("user");
JSONObject jsonObject = new JSONObject();
Collect c = userService.findByHouseType(user.getUserId(), houseId);
if(c!=null){
jsonObject.put("result","0");
}else {
Collect collect=new Collect();
collect.setUserId(user.getUserId());
collect.setHouseId(houseId);
collect.setUpdateTime(new Date().getTime());
collect.setCreateTime(new Date().getTime());
userService.addCollect(collect);
jsonObject.put("result","1");
}
return jsonObject.toString();
}
}
IHouseViewDao.java
package com.yiju.dao;
import com.yiju.bean.House;
import com.yiju.bean.HouseInfo;
import com.yiju.bean.HouseInter;
import com.yiju.pojo.HouseView;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IHouseViewDao {
List<HouseView> findFourHouseByType(@Param("houseType") int houseType);//显示4个房源类型
HouseView findHouseByHouseById(int houseId);//房源表唯一标识ID
List<HouseView> findHouseByType(@Param("houseType")int houseType);//显示全部房源类型
void postHouse(House house);
void postHouseInfo(HouseInfo houseInfo);
void postHouseInter(HouseInter houseInter);
}
IUserDao.java
package com.yiju.dao;
import com.yiju.bean.Collect;
import com.yiju.bean.UserAuth;
import com.yiju.bean.UserInfo;
import com.yiju.pojo.CollectView;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IUserDao {
UserInfo findUserByPhone(String phone);
void singup(@Param("phone") String phone, @Param("password") String password);
void updateUserInfo(UserInfo userInfo);
UserAuth findUserAuthByUserId(int userId);
void postUserAuthor(UserAuth userAuth);
void deleteById(int userId);
void updatePS(UserInfo userInfo);
List<CollectView> getCollectViewByUser(int userId);
void addCollect(Collect collect);
Collect findByHouseType(@Param("userId") int userId , @Param("houseId") int houseId);
}
CollectView.java
package com.yiju.pojo;
public class CollectView {
private int collId;
private int userId;
private int houseId;
private int idDelete;
private long createTime;
private long updateTime;
private String houseTitle;
private String houseHeadimg;
private String houseAddress;
public int getCollId() {
return collId;
}
public void setCollId(int collId) {
this.collId = collId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getHouseId() {
return houseId;
}
public void setHouseId(int houseId) {
this.houseId = houseId;
}
public int getIdDelete() {
return idDelete;
}
public void setIdDelete(int idDelete) {
this.idDelete = idDelete;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(long updateTime) {
this.updateTime = updateTime;
}
public String getHouseTitle() {
return houseTitle;
}
public void setHouseTitle(String houseTitle) {
this.houseTitle = houseTitle;
}
public String getHouseHeadimg() {
return houseHeadimg;
}
public void setHouseHeadimg(String houseHeadimg) {
this.houseHeadimg = houseHeadimg;
}
public String getHouseAddress() {
return houseAddress;
}
public void setHouseAddress(String houseAddress) {
this.houseAddress = houseAddress;
}
@Override
public String toString() {
return "CollectView{" +
"collId=" + collId +
", userId=" + userId +
", houseId=" + houseId +
", idDelete=" + idDelete +
", createTime=" + createTime +
", updateTime=" + updateTime +
", houseTitle='" + houseTitle + '\'' +
", houseHeadimg='" + houseHeadimg + '\'' +
", houseAddress='" + houseAddress + '\'' +
'}';
}
}
HouseView.java
package com.yiju.pojo;
import java.math.BigDecimal;
public class HouseView {
private int houseId; //房源ID
private String trueName; //发布人
private String houseTitle; //房源标题
private String houseHeadimg; //房源帖子头像
private BigDecimal housePrice; //房屋价格
private String priceUnit; //售价单位:元/每月 元/套 元/年
private int houseFloor; //楼层
private int floorAll; //全部楼层
private String houseAddress; //房源地址
private String houseLayout; //几室几厅几卫
private String houseDecorate; //精装,简装
private String houseArea; //房间面积
private long createTime; //创建时间
private String houseTurn; //房屋朝向
private String houseNature; //房屋性质
private String houseModel; //房屋类型
private String houseYear; //建造年份
private String houseValid; //有效期
private int houseLift; //是否有电梯
private String housePlanimg1;
private String housePlanimg2;
private String houseImg1; //房源室内图1
private String houseImg2; //房源室内图2
private String houseImg3; //房源室内图3
private String houseImg4; //房源室内图4
private String houseImg5; //房源室内图5
private String houseImg6; //房源室内图6
private String date; //获取年月日
private int bed; //床:0无 1有
private int washing; //洗衣机:0无 1有
private int air; //空调: 0无 1有
private int balcony; //阳台:0无 1有
private int ice; //冰箱:0无 1有
private int toilet; //卫生间:0无 1有
private int kitchen; //厨房:0无 1有
private int tv; //电视:0无 1有
private int heater; //热水器:0无 1有
private int wardrobe; //衣柜:0无 1有
private int heating; //暖气:0无 1有
private int internet; //宽带:0无 1有
private int sofa; //沙发:0无 1有
private int houseType;
public int getHouseType() {
return houseType;
}
public void setHouseType(int houseType) {
this.houseType = houseType;
}
public int getHouseId() {
return houseId;
}
public void setHouseId(int houseId) {
this.houseId = houseId;
}
public String getTrueName() {
return trueName;
}
public void setTrueName(String trueName) {
this.trueName = trueName;
}
public String getHouseTitle() {
return houseTitle;
}
public void setHouseTitle(String houseTitle) {
this.houseTitle = houseTitle;
}
public String getHouseHeadimg() {
return houseHeadimg;
}
public void setHouseHeadimg(String houseHeadimg) {
this.houseHeadimg = houseHeadimg;
}
public BigDecimal getHousePrice() {
return housePrice;
}
public void setHousePrice(BigDecimal housePrice) {
this.housePrice = housePrice;
}
public String getPriceUnit() {
return priceUnit;
}
public void setPriceUnit(String priceUnit) {
this.priceUnit = priceUnit;
}
public int getHouseFloor() {
return houseFloor;
}
public void setHouseFloor(int houseFloor) {
this.houseFloor = houseFloor;
}
public int getFloorAll() {
return floorAll;
}
public void setFloorAll(int floorAll) {
this.floorAll = floorAll;
}
public String getHouseAddress() {
return houseAddress;
}
public void setHouseAddress(String houseAddress) {
this.houseAddress = houseAddress;
}
public String getHouseLayout() {
return houseLayout;
}
public void setHouseLayout(String houseLayout) {
this.houseLayout = houseLayout;
}
public String getHouseDecorate() {
return houseDecorate;
}
public void setHouseDecorate(String houseDecorate) {
this.houseDecorate = houseDecorate;
}
public String getHouseArea() {
return houseArea;
}
public void setHouseArea(String houseArea) {
this.houseArea = houseArea;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public String getHouseTurn() {
return houseTurn;
}
public void setHouseTurn(String houseTurn) {
this.houseTurn = houseTurn;
}
public String getHouseNature() {
return houseNature;
}
public void setHouseNature(String houseNature) {
this.houseNature = houseNature;
}
public String getHouseModel() {
return houseModel;
}
public void setHouseModel(String houseModel) {
this.houseModel = houseModel;
}
public String getHouseYear() {
return houseYear;
}
public void setHouseYear(String houseYear) {
this.houseYear = houseYear;
}
public String getHouseValid() {
return houseValid;
}
public void setHouseValid(String houseValid) {
this.houseValid = houseValid;
}
public int getHouseLift() {
return houseLift;
}
public void setHouseLift(int houseLift) {
this.houseLift = houseLift;
}
public String getHousePlanimg1() {
return housePlanimg1;
}
public void setHousePlanimg1(String housePlanimg1) {
this.housePlanimg1 = housePlanimg1;
}
public String getHousePlanimg2() {
return housePlanimg2;
}
public void setHousePlanimg2(String housePlanimg2) {
this.housePlanimg2 = housePlanimg2;
}
public String getHouseImg1() {
return houseImg1;
}
public void setHouseImg1(String houseImg1) {
this.houseImg1 = houseImg1;
}
public String getHouseImg2() {
return houseImg2;
}
public void setHouseImg2(String houseImg2) {
this.houseImg2 = houseImg2;
}
public String getHouseImg3() {
return houseImg3;
}
public void setHouseImg3(String houseImg3) {
this.houseImg3 = houseImg3;
}
public String getHouseImg4() {
return houseImg4;
}
public void setHouseImg4(String houseImg4) {
this.houseImg4 = houseImg4;
}
public String getHouseImg5() {
return houseImg5;
}
public void setHouseImg5(String houseImg5) {
this.houseImg5 = houseImg5;
}
public String getHouseImg6() {
return houseImg6;
}
public void setHouseImg6(String houseImg6) {
this.houseImg6 = houseImg6;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public int getBed() {
return bed;
}
public void setBed(int bed) {
this.bed = bed;
}
public int getWashing() {
return washing;
}
public void setWashing(int washing) {
this.washing = washing;
}
public int getAir() {
return air;
}
public void setAir(int air) {
this.air = air;
}
public int getBalcony() {
return balcony;
}
public void setBalcony(int balcony) {
this.balcony = balcony;
}
public int getIce() {
return ice;
}
public void setIce(int ice) {
this.ice = ice;
}
public int getToilet() {
return toilet;
}
public void setToilet(int toilet) {
this.toilet = toilet;
}
public int getKitchen() {
return kitchen;
}
public void setKitchen(int kitchen) {
this.kitchen = kitchen;
}
public int getTv() {
return tv;
}
public void setTv(int tv) {
this.tv = tv;
}
public int getHeater() {
return heater;
}
public void setHeater(int heater) {
this.heater = heater;
}
public int getWardrobe() {
return wardrobe;
}
public void setWardrobe(int wardrobe) {
this.wardrobe = wardrobe;
}
public int getHeating() {
return heating;
}
public void setHeating(int heating) {
this.heating = heating;
}
public int getInternet() {
return internet;
}
public void setInternet(int internet) {
this.internet = internet;
}
public int getSofa() {
return sofa;
}
public void setSofa(int sofa) {
this.sofa = sofa;
}
@Override
public String toString() {
return "HouseView{" +
"houseId=" + houseId +
", trueName='" + trueName + '\'' +
", houseTitle='" + houseTitle + '\'' +
", houseHeadimg='" + houseHeadimg + '\'' +
", housePrice=" + housePrice +
", priceUnit='" + priceUnit + '\'' +
", houseFloor=" + houseFloor +
", floorAll=" + floorAll +
", houseAddress='" + houseAddress + '\'' +
", houseLayout='" + houseLayout + '\'' +
", houseDecorate='" + houseDecorate + '\'' +
", houseArea='" + houseArea + '\'' +
", createTime=" + createTime +
", houseTurn='" + houseTurn + '\'' +
", houseNature='" + houseNature + '\'' +
", houseModel='" + houseModel + '\'' +
", houseYear='" + houseYear + '\'' +
", houseValid='" + houseValid + '\'' +
", houseLift=" + houseLift +
", housePlanimg1='" + housePlanimg1 + '\'' +
", housePlanimg2='" + housePlanimg2 + '\'' +
", houseImg1='" + houseImg1 + '\'' +
", houseImg2='" + houseImg2 + '\'' +
", houseImg3='" + houseImg3 + '\'' +
", houseImg4='" + houseImg4 + '\'' +
", houseImg5='" + houseImg5 + '\'' +
", houseImg6='" + houseImg6 + '\'' +
", date='" + date + '\'' +
", bed=" + bed +
", washing=" + washing +
", air=" + air +
", balcony=" + balcony +
", ice=" + ice +
", toilet=" + toilet +
", kitchen=" + kitchen +
", tv=" + tv +
", heater=" + heater +
", wardrobe=" + wardrobe +
", heating=" + heating +
", internet=" + internet +
", sofa=" + sofa +
", houseType=" + houseType +
'}';
}
}
HouseViewService.java
package com.yiju.service.iml;
import com.github.pagehelper.PageHelper;
import com.yiju.bean.House;
import com.yiju.bean.HouseInfo;
import com.yiju.bean.HouseInter;
import com.yiju.dao.IHouseViewDao;
import com.yiju.pojo.HouseView;
import com.yiju.service.IHouseViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class HouseViewService implements IHouseViewService {
@Autowired
private IHouseViewDao houseViewDao;
@Override
public List<HouseView> findFourHouseByType(int houseType) {
return houseViewDao.findFourHouseByType(houseType);
}
@Override
public HouseView findHouseByHouseId(int houseId) {
return houseViewDao.findHouseByHouseById(houseId);
}
@Override
public List<HouseView> findHouseByType(int currentPage,int houseType) {
PageHelper.startPage(currentPage,5);
return houseViewDao.findHouseByType(houseType);
}
@Override
public void postHouse(House house) {
houseViewDao.postHouse(house);
}
@Override
public void postHouseInfo(HouseInfo houseInfo) {
houseViewDao.postHouseInfo(houseInfo);
}
@Override
public void postHouseInter(HouseInter houseInter) {
houseViewDao.postHouseInter(houseInter);
}
}
UserServiceImpl.java
package com.yiju.service.iml;
import com.yiju.bean.Collect;
import com.yiju.bean.UserAuth;
import com.yiju.bean.UserInfo;
import com.yiju.dao.IUserDao;
import com.yiju.pojo.CollectView;
import com.yiju.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserServiceImpl implements IUserService {
@Autowired
private IUserDao userDao;
@Override
public UserInfo findByPhone(String phone) {
return userDao.findUserByPhone(phone);
}
@Override
public void add(String phone, String password) {
userDao.singup(phone,password);
}
@Override
public void updateUserInfo(UserInfo userInfo) {
userDao.updateUserInfo(userInfo);
}
@Override
public UserAuth findUserAuth(int userId) {
return userDao.findUserAuthByUserId(userId);
}
@Override
public void postUserAuth(UserAuth userAuth) {
userDao.postUserAuthor(userAuth);
}
@Override
public void deleteById(int userId) {
userDao.deleteById(userId);
}
@Override
public void updatePS(UserInfo userInfo) {
userDao.updatePS(userInfo);
}
@Override
public List<CollectView> getCollectViewByUser(int userId) {
return userDao.getCollectViewByUser(userId);
}
@Override
public void addCollect(Collect collect) {
userDao.addCollect(collect);
}
@Override
public Collect findByHouseType(int userId, int houseId) {
return userDao.findByHouseType(userId,houseId);
}
}
IHouseViewService.java
package com.yiju.service;
import com.yiju.bean.House;
import com.yiju.bean.HouseInfo;
import com.yiju.bean.HouseInter;
import com.yiju.pojo.HouseView;
import java.util.List;
public interface IHouseViewService {
List<HouseView> findFourHouseByType(int houseType);
HouseView findHouseByHouseId(int houseId);
List<HouseView> findHouseByType(int currentPage,int houseType);
void postHouse(House house);
void postHouseInfo(HouseInfo houseInfo);
void postHouseInter(HouseInter houseInter);
}
IUserService.java
package com.yiju.service;
import com.yiju.bean.Collect;
import com.yiju.bean.UserAuth;
import com.yiju.bean.UserInfo;
import com.yiju.pojo.CollectView;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IUserService {
UserInfo findByPhone(String phone);
void add(String phone,String password);
void updateUserInfo(UserInfo userInfo);
UserAuth findUserAuth(int userId);
void postUserAuth(UserAuth userAuth);
void deleteById(int userId);
void updatePS(UserInfo userInfo);
List<CollectView> getCollectViewByUser(int userId);
void addCollect(Collect collect);
Collect findByHouseType(int userId, int houseId);
}
YijuUtil.java
package com.yiju.util;
import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone;
import com.qiniu.http.Response;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.UploadManager;
import com.qiniu.util.Auth;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;
public class YijuUtil {
//public static void main(String[] args) {
// Str
// String picName =getPicName();
// System.out.println(picName);
//}
public static String getPicName(){
SimpleDateFormat sf=new SimpleDateFormat("yyyyMMdd");
String picName=sf.format(new Date())+ UUID.randomUUID().toString();
return picName;
}
//String local 本地上传的图片,String upload 上传之后的名字
public static void upload(byte[] file, String upload) {
//七牛云的密钥
final String AK="QdXlw1XwbogpCm7zXFby6bINFMktIwR3DqyCk56a";
final String SK="KFYDGo8kgDRMI5JflSJ0H5PueV8KzjVI_1eKcUJ4";
// final String AK="V86-ao-ntbpWZrtv7QF4YQ-8CM6sA_TSx1qB8Gyc";
// final String SK="4C2-dUzRqQJ7-LEKR7ON4ey5GKVZw83QyGf4gWQE";
//七牛云的存储空间
final String BUCKET="wms001";
//final String BUCKET="hualili1021";
Configuration cfg=new Configuration(Zone.zone1()) ;
UploadManager uploadManager=new UploadManager(cfg);
Auth auth= Auth.create(AK,SK);
String uptake = auth.uploadToken(BUCKET);
try {
Response response = uploadManager.put(file, upload, uptake);
System.out.println(response);
} catch (QiniuException e) {
e.printStackTrace();
}
}
}
HouseMapper.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yiju.dao.IHouseViewDao">
<select id="findFourHouseByType" parameterType="int" resultType="com.yiju.pojo.HouseView">
select * from tb_house a,tb_house_info b where a.house_id=b.house_id and a.is_delete=0
and a.house_type=#{houseType} order by rand()limit 4
</select>
<select id="findHouseByHouseById" parameterType="int" resultType="com.yiju.pojo.HouseView">
select * from tb_house a,tb_house_info b where a.house_id=b.house_id and a.is_delete=0
and a.house_id=#{houseId}
</select>
<select id="findHouseByType" parameterType="int" resultType="com.yiju.pojo.HouseView">
select * from tb_house a,tb_house_info b where a.house_id=b.house_id and a.is_delete=0
and a.house_type=#{houseType}
</select>
<insert id="postHouse" parameterType="com.yiju.bean.House" useGeneratedKeys="true" keyProperty="houseId">
insert into tb_house (user_id, house_type, house_title, house_headimg, house_planimg1, house_planimg2,house_img1, house_img2, house_img3, house_img4, house_img5, house_img6, house_price, price_unit,house_address, is_delete, create_time, update_time)
values (#{userId}, #{houseType}, #{houseTitle}, #{houseHeadimg}, #{housePlanimg1}, #{housePlanimg2},#{houseImg1}, #{houseImg2}, #{houseImg3}, #{houseImg4}, #{houseImg5}, #{houseImg6}, #{housePrice}, #{priceUnit},#{houseAddress}, #{isDelete}, #{createTime}, #{updateTime});
</insert>
<insert id="postHouseInfo" parameterType="com.yiju.bean.HouseInfo" useGeneratedKeys="true" keyProperty="infoId">
insert into tb_house_info(house_id, house_nature, house_model, house_year, house_valid, house_layout,house_area, house_turn, house_floor, floor_all, house_decorate, house_lift, create_time, update_time)
values (#{houseId}, #{houseNature}, #{houseModel}, #{houseYear}, #{houseValid}, #{houseLayout}, #{houseArea},#{houseTurn}, #{houseFloor}, #{floorAll}, #{houseDecorate}, #{houseLift}, #{createTime}, #{updateTime})
</insert>
<insert id="postHouseInter" parameterType="com.yiju.bean.HouseInter" useGeneratedKeys="true" keyProperty="interId">
insert into tb_house_inter(house_id, bed, washing, air, balcony, ice, toilet, kitchen, tv, heater, wardrobe,heating, internet, sofa, create_time, update_time)
values (#{houseId}, #{bed}, #{washing}, #{air}, #{balcony}, #{ice}, #{toilet}, #{kitchen}, #{tv}, #{heater},#{wardrobe}, #{heating}, #{internet}, #{sofa}, #{createTime}, #{updateTime})
</insert>
</mapper>
UserInfoMapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yiju.dao.IUserDao">
<select id="findUserByPhone" parameterType="String" resultType="com.yiju.bean.UserInfo">
select * from tb_user where phone=#{phone}
</select>
<insert id="singup" parameterType="String">
insert into tb_user(phone,password) values (#{phone},#{password})
</insert>
<update id="updateUserInfo" parameterType="com.yiju.bean.UserInfo">
update tb_user set truename=#{truename},nickname=#{nickname},gender=#{gender},city=#{city}
where user_id=#{userId}
</update>
<select id="findUserAuthByUserId" parameterType="int" resultType="com.yiju.bean.UserAuth">
select * from tb_user_auth where user_id=#{user_id}
</select>
<insert id="postUserAuthor" parameterType="com.yiju.bean.UserAuth">
insert into tb_user_auth(user_id,user_name,user_gender,user_card,user_card_address,user_live_address,create_time,update_time)
value(#{userId},#{userName},#{userGender},#{userCard},#{userCardAddress},#{userLiveAddress},
#{createTime},#{updateTime})
</insert>
<delete id="deleteById" parameterType="int">
delete from tb_user_auth where user_id=#{userId}
</delete>
<update id="updatePS" parameterType="com.yiju.bean.UserInfo" >
update tb_user set password=#{password}
where user_id=#{userId}
</update>
<select id="getCollectViewByUser" parameterType="int" resultType="com.yiju.pojo.CollectView">
select * from tb_collect a,tb_house b where a.house_id=b.house_id and a.user_id=#{userId}
</select>
<insert id=" addCollect" parameterType="com.yiju.bean.Collect">
insert into tb_collect (user_id,house_id, create_time ,update_time)
values (#{userId},#{houseId},#{createTime},#{updateTime})
</insert>
<select id="findByHouseType" resultType="com.yiju.bean.Collect" parameterType="int">
select * from tb_collect where user_id=#{userId} and house_id=#{#houseId}
</select>
</mapper>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
<!-- 1.配置数据库相关参数properties的属性:${url} -->
<context:property-placeholder location="classpath:db.properties"/>
<!-- 2.配置数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driver}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="maxPoolSize" value="30"/>
<property name="minPoolSize" value="2"/>
</bean>
<!-- 3.配置SqlSessionFactory对象 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 注入数据库连接池 -->
<property name="dataSource" ref="dataSource"/>
<!-- 扫描bean包 使用别名 -->
<property name="typeAliasesPackage" value="com.yiju.bean"></property>
<!--配置加载映射文件 UserInfoMapper.xml-->
<property name="mapperLocations" value="classpath:mapper/*.xml"/>
<!--加载分页插件-->
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageInterceptor">
<property name="properties">
<props>
<prop key="helperDialect">mysql</prop>
<prop key="reasonable">true</prop>
</props>
</property>
</bean>
</array>
</property>
<property name="configuration">
<bean class="org.apache.ibatis.session.Configuration">
<!--可以加入驼峰命名法其他mybatis的配置也就是mybatis.cfg.xml的相关配置都会转移到这里-->
<property name="mapUnderscoreToCamelCase" value="true"/>
</bean>
</property>
</bean>
<!-- 自动生成dao,mapper-->
<!-- 4.配置扫描Dao接口包,动态实现Dao接口,注入到spring容器中 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 给出需要扫描Dao接口包 -->
<property name="basePackage" value="com.yiju.dao"/>
<!-- 注入sqlSessionFactory -->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
<!--自动扫描-->
<context:component-scan base-package="com.yiju"/>
<!-- 配置事务-->
<!-- 5.配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 6.开启事务注解-->
<tx:annotation-driven></tx:annotation-driven>
</beans>
db.properties
#以下内容根据自己来配置
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/yiju?useSSL=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=123456
log4j.properties
# Global logging configuration
log4j.rootLogger=DEBUG, stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
spring-mvc.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
<!-- 1.注解扫描位置-->
<context:component-scan base-package="com.yiju.controller" />
<!-- 2.配置映射处理和适配器-->
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/>
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"/>
<!-- 3.视图的解析器-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/pages/" />
<property name="suffix" value=".jsp" />
</bean>
<!-- 4.配置文件上传配置 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 配置文件上传编码 -->
<property name="defaultEncoding" value="utf-8"/>
<!-- 配置文件上传大小 -->
<property name="maxUploadSize" value="10485760"/>
</bean>
</beans>
pages里的文件代码
basefoot.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>页脚</title>
<link type="text/css" href="../css/css.css" rel="stylesheet" />
</head>
<body>
<!--这是页脚-->
<div class="xinren">
<div class="width1190">
<table>
<tr>
<td>
<dl style="background:url(../images/icon1.jpg) left center no-repeat;">
<dt>承诺</dt>
<dd>真实可信100%真房源<br />链家承诺,假一赔百</dd>
</dl>
</td>
<td>
<dl style="background:url(../images/icon2.jpg) left center no-repeat;">
<dt>权威</dt>
<dd>独家房源 覆盖全城<br />房源信息最权威覆盖最广</dd>
</dl>
</td>
<td>
<dl style="background:url(../images/icon3.jpg) left center no-repeat;">
<dt>信赖</dt>
<dd>万名置业顾问 专业服务<br />百万家庭的信赖之选</dd>
</dl>
</td>
<td>
<dl style="background:url(../images/icon4.jpg) left center no-repeat;">
<dt>安全</dt>
<dd>安心承诺 保驾护航<br />多重风险防范机制 无后顾之忧</dd>
</dl>
</td>
</tr>
</table>
<div class="clears"></div>
</div><!--width1190/-->
</div><!--xinren/-->
<div class="footer">
<div class="width1190">
<!-- FIXME 这里把各个连接更换-->
<div class="fl"><a href="/main.jsp" target="_blank"><strong>易居平台</strong></a><a href="#">关于我们</a><a href="#">联系我们</a><a href="#" target="_blank">个人中心</a></div>
<div class="fr">
<dl>
<!-- FIXME 这里把图片更换-->
<dt><img src="../images/erweima.png" width="76" height="76" /></dt>
<dd>微信扫一扫<br />房价点评,精彩发布</dd>
</dl>
<dl>
<dt><img src="../images/erweima.png" width="76" height="76" /></dt>
<dd>微信扫一扫<br />房价点评,精彩发布</dd>
</dl>
<div class="clears"></div>
</div>
<div class="clears"></div>
</div><!--width1190/-->
</div><!--footer/-->
<div class="copy">Copyright@ 2019 易居住房交易平台 鄂ICP备19009914号-1 技术支持:<a target="_blank" href="#">中软国际</a> </div>
</body>
</html>
basehead.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>页头</title>
<!-- 下面是几个导入的包-->
<link type="text/css" href="../css/css.css" rel="stylesheet" />
<script type="text/javascript" src="../js/js.js"></script>
</head>
<body>
<!--头部最上方的框-->
<div class="header">
<div class="width1190">
<div class="fl" style="font-size: 14px">您好,欢迎来到<a href="../main.jsp">易居住房信息平台!</a></div>
<div class="fr">
<a href="${pageContext.request.contextPath}/pages/login.jsp" style="font-size: 14px" target="_blank"><strong>登录</strong></a> |
<a href="${pageContext.request.contextPath}/pages/signup.jsp" style="font-size: 14px" target="_blank"><strong>注册</strong></a>
<a style="font-size: 14px">欢迎使用</a> |
<a href="${pageContext.request.contextPath}/pages/personal.jsp" style="font-size: 14px" target="_blank"><strong>个人中心</strong></a> |
<a href="#" style="font-size: 14px"><strong>退出</strong></a> |
<a href="javascript:;" onclick="" style="font-size: 14px">加入收藏</a> |
<a href="javascript:;" onclick="" style="font-size: 14px">设为首页</a>
</div>
<div class="clears"></div>
</div><!--width1190/-->
</div>
<!--头部最上方的框-->
</body>
</html>
details.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>房源详情页</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Author" contect="http://www.webqin.net">
<link rel="shortcut icon" href="../images/favicon.ico" />
<scrip src="../js/jquery-2.1.1.min.js"></scrip>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/js.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="${pageContext.request.contextPath}/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="../index.jsp">首页</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=0¤tPage=1">新房</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=1¤tPage=1">二手房</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=2¤tPage=1">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<div class="content">
<div class="width1190">
<p style="font-size: 16px">当前位置:<a href="../index.jsp">首页</a> >> <a href="/house/todetails.do?house_id=${houseInfo.houseId}">房源详情</a></p>
</div>
</div>
<%--显示房屋详情--%>
<div class="content">
<div class="width1190" style="width:1000px;">
<div class="proImg fl">
<img src="http://image.cxhit.com/${houseInfo.houseHeadimg}" />
</div><!--proImg/-->
<div style="width:535px;margin:30px 0;float: right;">
<h3 class="proTitle">${houseInfo.houseTitle} </h3>
<div class="proText1">
<table width="90%" align="left" cellspacing="5" cellpadding="5" style="font-size: 130%">
<tr>
<td>房屋编号:<a name="house_id">${houseInfo.houseId}</a></td>
<td>房屋性质:${houseInfo.houseNature}</td>
</tr>
<tr>
<td>装 修:${houseInfo.houseDecorate}</td>
<td>售 价:${houseInfo.housePrice}${houseInfo.priceUnit}</td>
</tr>
<tr>
<td>面 积:${houseInfo.houseArea}㎡</td>
<td>户 型:${houseInfo.houseLayout}</td>
</tr>
<tr>
<td>朝 向:${houseInfo.houseTurn}</td>
<td>配套电梯:
<c:choose>
<c:when test="${houseInfo.houseLift == 1}" >有</c:when>
<c:when test="${houseInfo.houseLift == 0}" >无</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
</tr>
<tr>
<td>房屋类型:${houseInfo.houseModel}</td>
<td>楼 层:${houseInfo.houseFloor}层/${houseInfo.floorAll}层</td>
</tr>
<tr>
<td>建造年份:${houseInfo.houseYear}</td>
<td>居住期限:${houseInfo.houseValid} </td>
</tr>
<tr>
<td colspan="2">所在小区:${houseInfo.houseAddress}</td>
</tr>
<%--<tr><td colspan="2"> </td></tr>--%>
</table>
</div>
<div class="xun-car">
<input class="pricebutton" type="button" value="¥${houseInfo.housePrice}${houseInfo.priceUnit}">
<input class="collectbutton" type="button" value="关注房源">
<%--<a href="javascript:;" class="xwjg">¥<strong>${houseInfo.house_price}</strong>${houseInfo.price_unit}</a>--%>
<%--<a href="/user/follow.do?house_id=${houseInfo.house_id}" class="projrgwc">关注房源</a>--%>
</div>
</div><!--proText/-->
<div class="clears"></div>
</div><!--width1190/-->
<%--下面是房源详情页--%>
<div class="proBox" style="width:1000px;margin:10px auto;">
<div class="proEq">
<ul class="fl">
<li class="proEqCur">房源图片</li>
<li>小区介绍</li>
<li>用户评价</li>
</ul>
<div class="clears"></div>
</div><!--proEq/-->
<div class="proList">
<h2 class="title"><a style="color:#F1323B"> </a>房源平面图</h2>
<br>
<c:if test="${!empty houseInfo.housePlanimg1}">
<img src="http://image.cxhit.com/${houseInfo.housePlanimg1}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.housePlanimg2}">
<img src="http://image.cxhit.com/${houseInfo.housePlanimg2}" style="width: 286px;height: 188px"/>
</c:if>
<h2 class="title"><a style="color:#F1323B"> </a>房源内饰图</h2>
<br>
<c:if test="${!empty houseInfo.houseImg1}">
<img src="http://image.cxhit.com/${houseInfo.houseImg1}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.houseImg2}">
<img src="http://image.cxhit.com/${houseInfo.houseImg2}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.houseImg3}">
<img src="http://image.cxhit.com/${houseInfo.houseImg3}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.houseImg4}">
<img src="http://image.cxhit.com/${houseInfo.houseImg4}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.houseImg5}">
<img src="http://image.cxhit.com/${houseInfo.houseImg5}" style="width: 286px;height: 188px"/>
</c:if>
<c:if test="${!empty houseInfo.houseImg6}">
<img src="http://image.cxhit.com/${houseInfo.houseImg6}" style="width: 286px;height: 188px"/>
</c:if>
</div><!--proList/-->
<div class="proList">
暂无信息...
</div>
<div class="proList">
暂无评论……
</div>
<!--proList/-->
</div><!--proBox/-->
</div><!--content/-->
<%--引入页脚--%>
<iframe src="../pages/basefoot.jsp"frameborder="0" scrolling="no" height="263px" width="100%"></iframe>
</body>
<script type="text/javascript">
$(".collectbutton").on("click",function () {
var houseId=$("a[name=house_id]").text();
alert(houseId);
$.ajax({
url:"${pageContext.request.contextPath}/user/addToCollect.do",
type:"post",
dataType:"json",
data:{
houseId:houseId
},
success:function (data) {
if(data.result==0){
alert("添加失败,你已经收藏该房源!!!!!!!");
}
if(data.result==1){
alert("添加成功,收藏该房源!!!!");
}
}
})
})
</script>
</html>
favorite.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
Created by IntelliJ IDEA.
User: 36353
Date: 2019-07-05
Time: 15:14
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>我的收藏夹</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="../css/styleCollect.css" />
</head>
<body>
<%--加入头部--%>
<jsp:include page="../pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<hr width="1190px">
<br>
<div class="content">
<div class="width1080">
<%--左侧导航栏--%>
<div class="vip-left">
<div class="vipNav">
<h3 class="vipTitle">账户中心</h3>
<dl>
<dt class="vipIcon3">账户设置</dt>
<dd>
<a href="#">我的资料</a>
<a href="#">实名认证</a>
<a href="#">账户密码设置</a>
</dd>
<dt class="vipIcon1">我的易居</dt>
<dd>
<a href="#" class="vipNavCur">我的收藏房源</a>
</dd>
</dl>
</div><!--vipNav/-->
</div><!--vip-left/-->
<%--右侧详情栏--%>
<div class="vip-right">
<h3 class="vipright-title">我的收藏</h3>
<div class="AGrid-row tool-package">
<c:forEach var="collcetView" items="${collcets}">
<div class="col-sm-6 ">
<div class="tile center-layer">
<div class="layer-figure">
<a href="/house/todetails.do?house_id=${collcetView.houseId}"><img src="http://image.cxhit.com/${collcetView.houseHeadimg}"></a>
</div>
<h2 class="dev-list"> <a href="/house/todetails.do?houseId=${collcetView.houseId}">${collcetView.houseTitle}</a></h2>
<div class="layer-text">
<p class="dev-text">${collcetView.houseAddress}</p>
<div class="layer-btn">
<a href="/user/removeColl.do?coll_id=${collcetView.collId}">
<p>移出收藏</p>
</a>
</div>
</div>
</div>
</div>
</c:forEach>
</div>
</div><!--vip-right/-->
<div class="clearfix"></div>
</div><!--width1190/-->
</div><!--content/-->
<!--End 个人信息填写栏-->
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
</body>
</html>
housePost1.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>发布房源信息</title>
<!-- 下面是几个导入的包-->
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchReset.css" rel="stylesheet"/>
<link rel="stylesheet" href="../css/houseSend.css"/>
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="${pageContext.request.contextPath}/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="index.jsp">首页</a></li>
<li><a href="#">新房</a></li>
<li><a href="#">二手房</a></li>
<li><a href="#">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<%--信息填写栏--%>
<div class="width1190">
<br/>
<h4 style="font-size:16px; text-align:center; font-weight:bold;">房源基本信息填写</h4>
<br/>
<!--中心-->
<div class="content">
<div class="register-box">
<div class="wrap">
<div class="register-box-con2">
<form action="${pageContext.request.contextPath}/house/toHousePost2.do" method="post" enctype="multipart/form-data">
<!--房源标题-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源标题</label>
<div class="register-box-con2-box-right">
<input type="text" name="houseTitle" class="login-box-cen-form-input w358"
placeholder="请输入您的房源帖子标题" id="reg_info_company"/>
<!-- <label id="reg_info_company_text" class="err err-top40">请输入与工商营业执照一致的公司名称,不超过20个字</label>-->
</div>
</div>
<!--房源地址-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源地址</label>
<div class="register-box-con2-box-right">
<input type="text" name="houseAddress" class="login-box-cen-form-input w358"
placeholder="请输入您的房源详细地址" id="reg_info_www"/>
<!-- <label class="err err-top40" id="reg_info_www_text">请输入正确的网址</label>-->
</div>
</div>
<!--预期售价-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>期望售价</label>
<div class="register-box-con2-box-right">
<input type="text" name="housePrice" class="login-box-cen-form-input w180"
placeholder="请输入期望售价" id="reg_info_address"/>
<!-- <label class="err err-top40" id="reg_info_address_text">公司所在地址,不超过40个字</label>-->
<div id="parent">
<select name="price_unit">
<option>元/套</option>
<option>元/月</option>
<option>元/年</option>
</select>
</div>
</div>
</div>
<!--FIXME 房源头像图-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian"></em>房源头像图</label>
<div class="register-box-con2-box-right">
<label class="register-box-con2-box-upload">
<input type="file" name="houseHeadimg" id="headimg"/>
<div class="register-box-con2-box-upload-ti">
<em id="headimg_w">点击上传</em>
<img id="headimg_base64" style="display:none;"/>
</div>
</label>
<label class="err err-top160" id="headimgText">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--FIXME 房源平面图-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left">
<em class="bitian">
</em>房源平面图</label>
<div class="register-box-con2-box-right">
<!--第一张图片-->
<label class="register-box-con2-box-upload1">
<input type="file" name="housePlanimg1" id="planimg1"/>
<div class="register-box-con2-box-upload-ti1">
<em id="planimg1_w">上传</em>
<img id="planimg1_base64" style="display:none;"/></div>
</label>
<!--第二张图片-->
<label class="register-box-con2-box-upload1" style=" margin-left: 10px;">
<input type="file" name="housePlanimg2" id="planimg2"/>
<div class="register-box-con2-box-upload-ti1">
<em id="planimg2_w">上传</em>
<img id="planimg2_base64" style="display:none;"/></div>
</label>
<label class="err err-top160" id="planimg1Text">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--FIXME 房源室内图-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left">
<em class="bitian"></em>房源室内图
</label>
<div class="register-box-con2-box-right">
<!--第一张图片-->
<label class="register-box-con2-box-upload2">
<input type="file" name="houseImg1" id="inter1"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter1_w">上传</em><img
id="inter1_base64" style="display:none;"/></div>
</label>
<!--第二章图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg2" id="inter2"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter2_w">上传</em><img
id="inter2_base64" style="display:none;"/></div>
</label>
<!--第三张图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg3" id="inter3"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter3_w">上传</em><img
id="inter3_base64" style="display:none;"/></div>
</label>
<label class="err err-top160" id="inter2_text">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--第二行图片-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian"></em></label>
<div class="register-box-con2-box-right">
<!--第四张图片-->
<label class="register-box-con2-box-upload2">
<input type="file" name="houseImg4" id="inter4"/>
<div class="register-box-con2-box-upload-ti2"><em id="inter4_w">上传</em><img
id="inter4_base64" style="display:none;"/></div>
</label>
<!--第五张图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg5" id="inter5"/>
<div class="register-box-con2-box-upload-ti2">
<em id="inter5_w">上传</em>
<img id="inter5_base64" style="display:none;"/>
</div>
</label>
<!--第六章图片-->
<label class="register-box-con2-box-upload2" style=" margin-left: 10px;">
<input type="file" name="houseImg6" id="inter6"/>
<div class="register-box-con2-box-upload-ti2">
<em id="inter6_w">上传</em>
<img id="inter6_base64" style="display:none;"/></div>
</label>
<label class="err err-top160" id="inter3_text">支持图片格式JPG/PNG,图片大小不超过2M</label>
</div>
</div>
<!--End 房源室内图-->
<div class="register-box-con2-box clearfix mar-bottom20 mar-top50">
<label class="register-box-con2-box-left"></label>
<div class="register-box-con2-box-right">
<input type="submit" value="下一步" class="login-box-cen-form-button" style="width: 360px"
id="reg_info_submit"/>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<br/><br/>
</div>
<script type="text/javascript" src="../js/jqueryhouse.min.js"></script>
<script type="text/javascript" src="../js/tbdValidate.js"></script>
<script type="text/javascript" src="../js/upload.js"></script>
<script src="../js/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
//图片预览路径
function getObjectURL(file) {
var url = null;
if (window.createObjectURL != undefined) { // basic
url = window.createObjectURL(file);
} else if (window.URL != undefined) { // mozilla(firefox)
url = window.URL.createObjectURL(file);
} else if (window.webkitURL != undefined) { // webkit or chrome
url = window.webkitURL.createObjectURL(file);
}
return url;
}
</script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
<br>
</body>
</html>
housePost2.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>发布房源信息</title>
<!-- 下面是几个导入的包-->
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchReset.css" rel="stylesheet"/>
<link rel="stylesheet" href="../css/houseSend.css"/>
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="${pageContext.request.contextPath}/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="index.jsp">首页</a></li>
<li><a href="#">新房</a></li>
<li><a href="#">二手房</a></li>
<li><a href="#">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<%--信息填写栏--%>
<div class="width1190">
<br/>
<h4 style="font-size:16px; text-align:center; font-weight:bold;">房源详细信息填写</h4>
<br/>
<!--中心-->
<div class="content">
<div class="register-box">
<div class="wrap">
<div class="register-box-con2">
<!--房源性质-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源性质</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseNature"
placeholder="如:商品房、住宅房等" id="house_natuer"/>
</div>
</div>
<!--房源类型-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源类型</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseModel"
placeholder="如:普通住宅、公寓式住宅、别墅等" id="house_model"/>
</div>
</div>
<!--房源建造年-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源建造年</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseYear"
placeholder="如:2008、2019等" id="house_year"/>
</div>
</div>
<!--房源期限-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源期限</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseValid"
placeholder="如:70年、80年、永久等" id="house_valid"/>
</div>
</div>
<!--房源户型-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源户型</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseLayout"
placeholder="如:2厅4室2卫等" id="house_layout"/>
</div>
</div>
<!--房源面积-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源面积</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseArea"
placeholder="如:100、85等。单位:m²" id="house_narea"/>
</div>
</div>
<!--房源朝向-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源朝向</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseTurn"
placeholder="如:南北、西南等" id="house_turn"/>
</div>
</div>
<!--房源楼层-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>房源楼层</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseFloor"
placeholder="如:6、8、9等" id="house_floor"/>
</div>
</div>
<!--总楼层-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>总楼层</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="floorAll"
placeholder="如:7、13、16等" id="floor_all"/>
</div>
</div>
<!--装修类型-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>装修类型</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseDecorate"
placeholder="如:精装修、简装修等" id="house_decorate"/>
</div>
</div>
<!--是否有电梯-->
<div class="register-box-con2-box clearfix mar-bottom20">
<label class="register-box-con2-box-left"><em class="bitian">* </em>是否有电梯</label>
<div class="register-box-con2-box-right">
<input type="text" class="login-box-cen-form-input w358" name="houseLift"
placeholder="如:是、否等" id="house_lift"/>
</div>
</div>
<div class="register-box-con2-box clearfix mar-bottom20 mar-top50" align="center">
<label class="register-box-con2-box-left"></label>
<div class="register-box-con2-box-right" align="center">
<input type="button" value="下一步" class="login-box-cen-form-button w180" id="next_submit"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="../js/jqueryhouse.min.js"></script>
<script type="text/javascript" src="../js/tbdValidate.js"></script>
<script type="text/javascript" src="../js/upload.js"></script>
<script src="../js/jquery-2.1.1.min.js"></script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
</body>
<script type="text/javascript">
$(function () {
$("#next_submit").on("click",function () {
var houseNature = $("input[name=houseNature]").val();
var houseModel = $("input[name=houseModel]").val();
var houseYear = $("input[name=houseYear]").val();
var houseValid = $("input[name=houseValid]").val();
var houseLayout = $("input[name=houseLayout]").val();
var houseArea = $("input[name=houseArea]").val();
var houseTurn = $("input[name=houseTurn]").val();
var houseFloor = $("input[name=houseFloor]").val();
var floorAll = $("input[name=floorAll]").val();
var houseDecorate = $("input[name=houseDecorate]").val();
var houseLift;
if ($("input[name=houseLift]").val() == "是") {
houseLift = 1;
} else {
houseLift = 0;
}
//校验信息
if (houseNature == "") {
alert("请输入房源性质!");
return;
}
else if (houseModel == "") {
alert("请输入房源类型!");
return;
}
else if (houseYear == "") {
alert("请输入建造时间!");
return;
}
else if (houseValid == "") {
alert("请输入房源期限!");
return;
}
else if (houseLayout == "") {
alert("请输入房源户型!");
return;
}
else if (houseArea == "") {
alert("请输入房源面积!");
return;
}
else if (houseTurn == "") {
alert("请输入朝向!");
return;
}
else if (houseFloor == "") {
alert("请输入楼层!");
return;
}
else if (floorAll == "") {
alert("请输入预售价格!");
return;
}
else if (houseDecorate == "") {
alert("请输入装饰类型!");
return;
} else if (houseLift == "") {
alert("请说明有无电梯!");
return;
}else{
$.ajax({
url:"${pageContext.request.contextPath}/house/responsePost2.do",
type:"post",
dataType:"json",
data:{
houseNature:houseNature,
houseModel:houseModel,
houseYear:houseYear,
houseLayout:houseLayout,
houseArea:houseArea,
houseFloor:houseFloor,
floorAll:floorAll,
houseDecorate:houseDecorate,
houseLift:houseLift
},
success:function () {
window.location.href="${pageContext.request.contextPath}/pages/housePost3.jsp"
}
});
}
});
})
</script>
</html>
housePost3.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>发布房源信息</title>
<!--下面是几个导入的包-->
<link rel="stylesheet" href="../css/houseCheckStyle.css"/>
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchReset.css" rel="stylesheet"/>
<link rel="stylesheet" href="../css/houseSend.css"/>
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="${pageContext.request.contextPath}/pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="index.jsp">首页</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=0¤tPage=1">新房</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=1¤tPage=1">二手房</a></li>
<li><a href="${pageContext.request.contextPath}/house/searchHouseViewByType.do?houseType=2¤tPage=1">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="${pageContext.request.contextPath}/pages/housePost1.jsp">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<%--信息填写栏--%>
<div class="width1190" align="center">
<br/>
<h4 style="font-size:16px; text-align:center; font-weight:bold;">房源内饰信息填写</h4>
<br/>
<div align="center">
<table align="cenetr">
<tr>
<td>
<ul class="tg-list">
<li class="tg-list-item">
<h4>床</h4>
<input class="tgl tgl-flip" id="bed" type="checkbox" onclick="bedClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="bed"></label>
</li>
<li class="tg-list-item">
<h4>洗衣机</h4>
<input class="tgl tgl-flip" id="washing" type="checkbox" onclick="washingClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="washing"></label>
</li>
<li class="tg-list-item">
<h4>空调</h4>
<input class="tgl tgl-flip" id="air" type="checkbox" onclick="airClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="air"></label>
</li>
<li class="tg-list-item">
<h4>阳台</h4>
<input class="tgl tgl-flip" id="balcony" type="checkbox" onclick="balconyClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="balcony"></label>
</li>
<li class="tg-list-item">
<h4>冰箱</h4>
<input class="tgl tgl-flip" id="ice" type="checkbox" onclick="iceClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="ice"></label>
</li>
<li class="tg-list-item">
<h4>卫生间</h4>
<input class="tgl tgl-flip" id="toilet" type="checkbox" onclick="toiletClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="toilet"></label>
</li>
<li class="tg-list-item">
<h4>厨房</h4>
<input class="tgl tgl-flip" id="kitchen" type="checkbox" onclick="kitchenClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="kitchen"></label>
</li>
</ul>
</td>
</tr>
<tr align="center">
<td style="align-content: center">
<ul class="tg-list">
<li class="tg-list-item">
<h4>电视</h4>
<input class="tgl tgl-flip" id="tv" type="checkbox" onclick="tvClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="tv"></label>
</li>
<li class="tg-list-item">
<h4>热水器</h4>
<input class="tgl tgl-flip" id="heater" type="checkbox" onclick="heaterClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="heater"></label>
</li>
<li class="tg-list-item">
<h4>衣柜</h4>
<input class="tgl tgl-flip" id="wardrobe" type="checkbox" onclick="wardrobeClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="wardrobe"></label>
</li>
<li class="tg-list-item">
<h4>暖气</h4>
<input class="tgl tgl-flip" id="heating" type="checkbox" onclick="heatingClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="heating"></label>
</li>
<li class="tg-list-item">
<h4>宽带</h4>
<input class="tgl tgl-flip" id="internet" type="checkbox" onclick="internetClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="internet"></label>
</li>
<li class="tg-list-item">
<h4>沙发</h4>
<input class="tgl tgl-flip" id="sofa" type="checkbox" name="sofa" onclick="sofaClick()"/>
<label class="tgl-btn" data-tg-off="无" data-tg-on="有" for="sofa" id="sofal"></label>
</li>
</ul>
</td>
</tr>
</table>
</div>
<%--下一步按钮--%>
<div align="cneter">
<div align="center">
<div class="register-box-con2-box clearfix mar-bottom20 mar-top50" align="center">
<label class="register-box-con2-box-left" style="width: 500px"></label>
<div class="register-box-con2-box-right" align="center">
<input type="submit" value="提交" class="login-box-cen-form-button w180" id="next_submit"
align="center"/>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="../js/jqueryhouse.min.js"></script>
<script type="text/javascript" src="../js/tbdValidate.js"></script>
<script type="text/javascript" src="../js/upload.js"></script>
<script src="../js/jquery-2.1.1.min.js"></script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
</body>
<script type="text/javascript">
var bed = 0;
var washing = 0;
var air = 0;
var balcony = 0;
var ice = 0;
var toilet = 0;
var kitchen = 0;
var tv = 0;
var heater = 0;
var wardrobe = 0;
var heating = 0;
var internet = 0;
var sofa = 0;
function bedClick() {
if (bed == 0) bed = 1;
else bed = 0;
}
function washingClick() {
if (washing == 0) washing = 1;
else washing = 0;
}
function airClick() {
if (air == 0) air = 1;
else air = 0;
}
function balconyClick() {
if (balcony == 0) balcony = 1;
else balcony = 0;
}
function iceClick() {
if (ice == 0) ice = 1;
else ice = 0;
}
function toiletClick() {
if (toilet == 0) toilet = 1;
else toilet = 0;
}
function kitchenClick() {
if (kitchen == 0) kitchen = 1;
else kitchen = 0;
}
function tvClick() {
if (tv == 0) tv = 1;
else tv = 0;
}
function heaterClick() {
if (heater == 0) heater = 1;
else heater = 0;
}
function wardrobeClick() {
if (wardrobe == 0) wardrobe = 1;
else wardrobe = 0;
}
function heatingClick() {
if (heating == 0) heating = 1;
else heating = 0;
}
function internetClick() {
if (internet == 0) internet = 1;
else internet = 0;
}
function sofaClick() {
if (sofa == 0) sofa = 1;
else sofa = 0;
}
$(function () {
$("#next_submit").on("click",function () {
$.ajax({
url:"${pageContext.request.contextPath}/house/responsePost3.do",
type:"post",
dataType:"json",
data:{
bed:bed,
washing:washing,
air:air,
balcony:balcony,
ice:ice,
toilet:toilet,
kitchen:kitchen,
tv:tv,
heater:heater,
wardrobe:wardrobe,
heating:heating,
internet:internet,
sofa:sofa
},
success:function () {
window.location.href="${pageContext.request.contextPath}/house/doHousePost.do"
}
})
})
})
</script>
</html>
houses.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ page import="java.util.List" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %><%--
Created by IntelliJ IDEA.
User: 36353
Date: 2019-07-04
Time: 22:54
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
<title>新房房源列表</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<%--导航栏的JS--%>
<script type="text/javascript" src="../js/js.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
<%--搜索框的css--%>
<link type="text/css" href="../css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="../css/searchReset.css" rel="stylesheet"/>
<script type="text/javascript" src="js/jquery2.min.js"></script>
</head>
<body>
<!--头部最上方的框-->
<jsp:include page="../pages/basehead.jsp"></jsp:include>
<!--头部最上方的框-->
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59"/></a>
</h1>
</td>
<td align="center">
<div class="phones"><strong>000-0000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏-->
<!--导航栏-->
<div class="list-nav">
<div class="width1190">
<ul class="nav">
<li><a href="#">首页</a></li>
<li><a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=0¤tPage=0">新房</a></li>
<li><a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=1¤tPage=0">二手房</a></li>
<li><a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=2¤tPage=0">租房</a></li>
<li class="zhiding"><a href="#">指定购房</a></li>
<li><a href="#">发布房源</a></li>
<li><a href="#">公告中心</a></li>
<li><a href="#">关于我们</a></li>
<div class="clears"></div>
</ul><!--nav-->
<div class="clears"></div>
</div><!--width1190-->
</div><!--list-nav-->
<!--导航栏End-->
<!--Logo栏和手机号栏-->
<hr width="1280px">
<%--<div class="content">--%>
<div class="width1190">
<p style="font-size: 16px">当前位置:<a href="../index.jsp">首页</a> >> <a
href="#">新房房源</a></p>
</div>
<%--</div>--%>
<%--房源列表--%>
<div class="content">
<div class="width1190">
<form action="" method="get" class="pro-search">
<div class="paixu">
<strong>排序:</strong>
<a href="javascript:;" class="pai-cur">默认</a>
<a href="javascript:;">价格 ∨</a>
<a href="javascript:;">最新 ∨</a>
</div>
</form><!--pro-search/-->
</div><!--width1190/-->
<div class="width1190">
<div class="pro-left">
<%--房屋信息分页显示--%>
<c:forEach var="house" items="${pageInfo.list}">
<dl>
<dt><a href="${pageContext.request.contextPath}/house/findHouseById.do?houseId=${house.houseId}">
<img src="http://image.cxhit.com/${house.houseHeadimg}" style="width:286px;height:188px"
width="286" height="188"/></a></dt>
<dd>
<h3><a href="${pageContext.request.contextPath}/house/findHouseById.do?houseId=${house.houseId}">${house.houseTitle}</a></h3>
<div class="pro-wei">
<img src="../images/weizhi.png" width="12" height="16" style="width:12px;height:16px"/>
<strong class="red">${house.houseAddress}</strong>
</div>
<div class="pro-fang">${house.houseLayout} ${house.houseArea}平 ${house.houseTurn} ${house.houseFloor}层/${house.floorAll}层</div>
<div class="pra-fa">发布人:${house.trueName}先生 发布时间:${house.date}</div>
</dd>
<div class="price">¥ <strong>${house.housePrice}</strong><span
class="font12">${house.priceUnit}</span></div>
<div class="clears"></div>
</dl>
</c:forEach>
<%--分页按钮--%>
<div class="pull-right">
<ul class="pagination">
<li>
<a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=${pageInfo.list.get(0).houseType}¤tPage=${pageInfo.firstPage}"
aria-label="Previous">首页</a></li>
<li>
<a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=${pageInfo.list.get(0).houseType}¤tPage=${pageInfo.pageNum - 1}">上一页</a>
</li>
<c:forEach begin="1" end="${pageInfo.pages}" var="pageNum">
<li>
<a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=${pageInfo.list.get(0).houseType}¤tPage=${pageNum}">${pageNum}</a>
</li>
</c:forEach>
<li>
<a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=${pageInfo.list.get(0).houseType}¤tPage=${pageInfo.pageNum + 1}">下一页</a>
</li>
<li>
<a href="${pageContext.request.contextPath}/house/findHouse.do?houseType=${pageInfo.list.get(0).houseType}¤tPage=${pageInfo.lastPage}"
aria-label="Next">尾页</a></li>
</ul>
</div><!--底部分页栏-->
</div><!--pro-left/-->
<div class="pro-right">
<h2 class="right-title">推荐房源</h2>
<div class="right-pro">
<c:forEach var="randomHouse" items="${fh}">
<dl>
<dt>
<a href="#"><img
src="http://image.cxhit.com/${randomHouse.houseHeadimg}"
style="width: 135px; height: 88px"/></a></dt>
<dd>
<h3>
<a href="#">${randomHouse.houseTitle}</a>
</h3>
<div class="pro-fang">${randomHouse.houseLayout} ${randomHouse.houseArea}平
朝${randomHouse.houseTurn}</div>
<div class="right-price">${randomHouse.housePrice}${randomHouse.priceUnit}</div>
</dd>
</dl>
</c:forEach>
</div><!--right-pro/-->
</div><!--pro-right/-->
<div class="clears"></div>
</div><!--width1190/-->
</div><!--content/-->
<%--显示页脚--%>
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
</body>
</html>
login.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>欢迎登录 — 易居住房交易平台</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet" />
<%--<link type="text/css" href="css/buttonStyle.css" rel="stylesheet" />--%>
<%--导入JS文件--%>
<script src="../js/jquery-2.1.1.min.js"></script>
<script src="../js/wer.js"></script>
<%--<script src="js/signup.js"></script>--%>
</head>
<body>
<%--加入头部--%>
<jsp:include page="basehead.jsp"></jsp:include>
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-0000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏-->
<hr width="1280px">
<!--注册-->
<div class="content">
<div class="width1190">
<div class="reg-logo">
<form method="post" action="" class="zcform">
<table align="center" cellpadding="100px" cellspacing="10px">
<tr>
<td align="right">
<label class="one" for="phone">手机号码:</label>
</td>
<td colspan="2">
<input id="phone" name="phone" type="text" class="required" value placeholder="请输入您的手机号" />
</td>
</tr>
<tr><td><br></td></tr>
<tr>
<td>
<label class="one" for="password">登录密码:</label>
</td>
<td colspan="2">
<input id="password" name="password" type="password" class="{required:true,rangelength:[8,20],}" value placeholder="请输入登录密码" />
</td>
</tr>
<tr><td><br></td></tr>
<tr>
<td>
<label class="one" for="verifyCode">验证码:</label>
</td>
<td>
<input id="verifyCode" name="verifyCode" type="text" class="required" value placeholder="请输入验证码" />
</td>
<td>
<div id="v_container" style="width: 180px;height: 45px;"></div>
<%--<a> </a><button type="button" class="sendVerifyCode" id="btn" name="btn" style="width: 180px;height: 45px">点击获取验证码</button><a> </a>--%>
</td>
</tr>
<tr><td><br></td></tr>
<tr>
<td colspan="3">
<input class="submit" type="button" value="立即登录"/>
<%--<input class="sub-btn" type="button" value="立即注册"/>--%>
</td>
</tr>
</table>
</form>
<div class="reg-logo-right">
<h3>如果您没有账号,请</h3>
<%--FIXME 这里跳转至【注册页面】--%>
<a href="${pageContext.request.contextPath}/pages/signup.jsp" class="logo-a" target="_self">立即注册</a>
<br>
<h3>忘记密码? 请</h3>
<%--FIXME 这里跳转至【找回密码页面】--%>
<a href="#" class="logo-a" target="_self">找回密码</a>
</div><!--reg-logo-right/-->
<div class="clears"></div>
</div><!--reg-logo/-->
</div><!--width1190/-->
</div><!--content/-->
<%--加入页脚--%>
<jsp:include page="basefoot.jsp"></jsp:include>
</body>
<script type="text/javascript">
//验证码
var verifyCode=new GVerify("v_container")
$(function () {
$(".submit").on("click",function () {
var phone=$("input[name=phone]").val();
var password=$("input[name=password]").val();
var code=$("input[name=verifyCode]").val();
if(phone==""){
alert("请输入手机号码!");
return;
}
if(password==""){
alert("密码不能为空!");
return;
}
if(code==""){
alert("验证码不能为空");
return;
}
//输入得验证码得值 不等于 创建的随机值时
if(!verifyCode.validate(code) ){
alert("验证码错误");
return;
}else {
$.ajax({
url:"${pageContext.request.contextPath}/user/login2.do",
type:"post",
dataType:"json",
data:{
phone:phone,
password:password
},
success:function (data) {
if(data.result=="0"){
alert("该用户还没有注册");
}else if(data.result=="1"){
alert("密码错误");
}else {
window.location.href="${pageContext.request.contextPath}/index.jsp"
}
}
})
}
})
})
</script>
</html>
personal.jsp
<%@ page import="com.yiju.bean.UserInfo" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
Created by IntelliJ IDEA.
User: 36353
Date: 2019-07-04
Time: 14:22
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>个人中心</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet" />
<%--<link rel="stylesheet" type="text/css" href="../css/city-select.css">--%>
</head>
<body>
<%--加入头部--%>
<jsp:include page="../pages/basehead.jsp"></jsp:include>
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<hr width="1190px">
<br>
<%--个人信息--%>
<div class="content">
<div class="width1080">
<%--左侧导航栏--%>
<div class="vip-left">
<div class="vipNav">
<h3 class="vipTitle">账户中心</h3>
<dl>
<dt class="vipIcon3">账户设置</dt>
<dd>
<a href="${pageContext.request.contextPath}/pages/personal.jsp" class="vipNavCur">我的资料</a>
<a href="${pageContext.request.contextPath}/user/verify.do">实名认证</a>
<a href="${pageContext.request.contextPath}/pages/psdsetting.jsp">账户密码设置</a>
</dd>
<dt class="vipIcon1">我的易居</dt>
<dd>
<a href="${pageContext.request.contextPath}/user/favorite.do">我的收藏房源</a>
</dd>
</dl>
</div><!--vipNav/-->
</div><!--vip-left/-->
<%--右侧详情栏--%>
<div class="vip-right">
<h3 class="vipright-title">我的资料</h3>
<table class="grinfo">
<tbody>
<% UserInfo userInfo= (UserInfo) request.getSession().getAttribute("user");%>
<tr>
<th ><span class="red">*</span>手机号码:</th>
<td width="600px">
<input class="inp inw" type="text" id="phone" value="<%=userInfo.getPhone()%>" maxlength="14" disabled="disabled">
</td>
</tr>
<tr>
<th><span class="red">*</span>姓 名:</th>
<td>
<input class="inp inw" type="text" id="name" value="<%=userInfo.getTruename()%>" maxlength="14" disabled="disabled">
</td>
</tr>
<tr>
<th><span class="red">*</span>昵 称:</th>
<td>
<input class="inp inw" type="text" id="title" value="<%=userInfo.getNickname()%>" maxlength="14" disabled="disabled">
</td>
</tr>
<tr>
<th height="40px"><span class="red">*</span>性 别:</th>
<td height="40px">
<input type="radio" value="0" id="rbSex1" name="sex"
<%if (userInfo.getGender()==0) out.print("checked");%>
onClick='javascript:return false'>
<label for="rbSex1">男 </label>
<input type="radio" value="1" id="rbSex2" name="sex"
<%if (userInfo.getGender()==0) out.print("checked");%>
onClick='javascript:return false'>
<label for="rbSex2">女</label>
<span id="Sex_Tip"></span>
</td>
</tr>
<tr>
<th><span class="red">*</span>城 市:</th>
<td>
<input class="inp inw" type="text" id="city" value="<%=userInfo.getCity()%>" maxlength="14" disabled="disabled">
</td>
</tr>
<tr>
<th> </th>
<td colspan="2">
<label class="butt" id="butt">
<input type="submit" class="member_mod_buttom" onclick="window.location.href='personalEdit.jsp'" value="编辑资料" />
</label>
</td>
</tr>
</tbody>
</table>
</div><!--vip-right/-->
<div class="clearfix"></div>
</div><!--width1190/-->
</div><!--content/-->
<!--End 个人信息填写栏-->
<div>
<br>
<br>
<br>
<br>
</div>
<script src="../js/city/jquery1.8.1.js" type="text/javascript"></script>
<%--<script type="text/javascript" src="../js/city/citydata.min.js"></script>--%>
<%--<script type="text/javascript" src="../js/city/citySelect-1.0.3.js"></script>--%>
<script type="text/javascript">
</script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
</body>
</html>
personalEdit.jsp
<%@ page import="com.yiju.bean.UserInfo" %><%--
Created by IntelliJ IDEA.
User: 36353
Date: 2019-07-04
Time: 14:22
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>个人中心</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
<%--<link rel="stylesheet" type="text/css" href="../css/city-select.css">--%>
<script src="../js/jquery-2.1.1.min.js"></script>
</head>
<body>
<%--加入头部--%>
<jsp:include page="../pages/basehead.jsp"></jsp:include>
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59"/></a>
</h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏-->
<hr width="1190px">
<br>
<%--个人信息--%>
<!--个人信息-->
<div class="content">
<div class="width1080">
<%--左侧导航栏--%>
<div class="vip-left">
<div class="vipNav">
<h3 class="vipTitle">账户中心</h3>
<dl>
<dt class="vipIcon3">账户设置</dt>
<dd>
<a href="${pageContext.request.contextPath}/pages/personal.jsp" class="vipNavCur">我的资料</a>
<a href="${pageContext.request.contextPath}/user/verify.do">实名认证</a>
<a href="${pageContext.request.contextPath}/pages/psdsetting.jsp">账户密码设置</a>
</dd>
<dt class="vipIcon1">我的易居</dt>
<dd>
<a href="/user/favorite.do">我的收藏房源</a>
</dd>
</dl>
</div><!--vipNav/-->
</div><!--vip-left/-->
<div class="vip-right">
<h3 class="vipright-title">编辑资料</h3>
<table class="grinfo">
<tbody>
<% UserInfo userInfos = (UserInfo) request.getSession().getAttribute("user"); %>
<tr>
<th><span class="red">*</span>手机号码:</th>
<td width="600px">
<input class="inp inw" type="text" id="phone" value="<%=userInfos.getPhone()%>" maxlength="14"
disabled="disabled">
</td>
</tr>
<tr>
<th><span class="red">*</span>真实姓名:</th>
<td>
<input class="inp inw" type="text" id="name" name="truename"
value="<% if(userInfos.getTruename()!=null) out.print(userInfos.getTruename()); %>"
maxlength="14">
</td>
</tr>
<tr>
<th><span class="red">*</span>昵 称:</th>
<td>
<input class="inp inw" type="text" id="title" name="nickname"
value="<% if(userInfos.getNickname()!=null) out.print(userInfos.getNickname());%>"
maxlength="14">
</td>
</tr>
<tr>
<th height="40px"><span class="red">*</span>性 别:</th>
<td height="40px">
<input type="radio" value="0" id="rbSex1"
name="sex" <%if(userInfos.getGender()==0) out.print("checked");%>>
<label for="rbSex1">男 </label>
<input type="radio" value="1" id="rbSex2"
name="sex" <%if(userInfos.getGender()==1) out.print("checked");%>>
<label for="rbSex2">女</label>
<span id="Sex_Tip"></span>
</td>
</tr>
<tr>
<th><span class="red">*</span>城 市:</th>
<td>
<input class="inp inw" type="text" name="city" id="city"
value="<% if(userInfos.getCity()!=null) out.print(userInfos.getCity());%>">
</td>
</tr>
<tr>
<th> </th>
<td colspan="2">
<label class="butt" id="butt">
<input type="button" class="member_mod_buttom" id="member_mod_buttom"
name="member_mod_buttom" value="保存修改"/>
<a> </a>
<input type="button" class="member_mod_buttom2"
onclick="window.location.href='personal.jsp'" name="" value="取消修改"/>
</label>
</td>
</tr>
</tbody>
</table>
</div><!--vip-right/-->
<div class="clearfix"></div>
</div><!--width1190/-->
</div><!--content/-->
<!--End 个人信息填写栏>-->
<div>
<br>
<br>
<br>
<br>
</div>
<script src="../js/city/jquery1.8.1.js" type="text/javascript"></script>
<%--<script type="text/javascript" src="../js/city/citydata.min.js"></script>--%>
<%--<script type="text/javascript" src="../js/city/citySelect-1.0.3.js"></script>--%>
<script type="text/javascript">
$(function () {
$(".member_mod_buttom").on("click",function () {
var truename=$("input[name=truename]").val();
var nickname=$("input[name=nickname]").val();
var gender;
if($("#rbSex1").is(":checked")){
gender=0;
}
if($("#rbSex2").is(":checked")){
gender=1;
}
var city=$("input[name=city]").val();
// alert(truename+"----"+nickname+"---"+gender+"----"+city);
if (truename==""){
alert("请输入姓名!");
return;
}
if(nickname==""){
alert("请输入昵称!");
return;
}
if (city==""){
alert("请输入城市!");
return;
}
$.ajax({
url:"${pageContext.request.contextPath}/user/saveEdit.do",
aync:true,
type:"post",
dataType:"json",
data:{
truename:truename,
nickname:nickname,
gender:gender,
city:city
},
success:function (data) {
window.location.href="personal.jsp";
}
});
});
})
</script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
</body>
</html>
psdsetting.jsp
<%--
Created by IntelliJ IDEA.
User: 36353
Date: 2019-07-05
Time: 15:12
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>账号密码设置中心</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet" />
<%--导入JS文件--%>
<script src="../js/jquery-2.1.1.min.js"></script>
</head>
<body>
<%--加入头部--%>
<jsp:include page="../pages/basehead.jsp"></jsp:include>
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<hr width="1190px">
<br>
<div class="content">
<div class="width1080">
<%--左侧导航栏--%>
<div class="vip-left">
<div class="vipNav">
<h3 class="vipTitle">账户中心</h3>
<dl>
<dt class="vipIcon3">账户设置</dt>
<dd>
<a href="/user/personal.do">我的资料</a>
<a href="/user/verify.do">实名认证</a>
<a href="/user/psdSet.do" class="vipNavCur">账户密码设置</a>
</dd>
<dt class="vipIcon1">我的易居</dt>
<dd>
<a href="/user/favorite.do">我的收藏房源</a>
</dd>
</dl>
</div><!--vipNav/-->
</div><!--vip-left/-->
<%--右侧详情栏--%>
<div class="vip-right">
<h3 class="vipright-title">我的认证</h3>
<br>
<table class="grinfo">
<tbody>
<tr>
<th ><span class="red">*</span>原 密 码:</th>
<td width="600px">
<input class="inp inw" type="password" name="oldpassword" id="oldpassword" value="" placeholder="请输入原密码!">
</td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<th><span class="red">*</span>新 密 码:</th>
<td>
<input class="inp inw" type="password" name="password" id="password" value="" placeholder="请输入新密码!">
</td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<th><span class="red">*</span>确认新密码:</th>
<td>
<input class="inp inw" type="password" name="password2" id="password2" value="" placeholder="请再次输入新密码!">
</td>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<th> </th>
<td colspan="2">
<label class="butt" id="butt">
<input type="submit" class="member_mod_buttom" onclick="" value="确认修改" />
</label>
</td>
</tr>
</tbody>
</table>
</div><!--vip-right/-->
<div class="clearfix"></div>
</div><!--width1190/-->
</div><!--content/-->
<!--End 个人信息填写栏-->
<div>
<br>
<br>
</div>
<script type="text/javascript">
$(function(){
//点击登录按钮
$(".member_mod_buttom").on("click", function(){
//获取几个基本信息
var oldpassword = $("input[name=oldpassword]").val();
var password=$("input[name=password]").val();
var password2=$("input[name=password2]").val();
//校验信息
if(oldpassword==""){
alert("请输入原密码!");
return;
}
if(password==""){
alert("请输入新密码!");
return;
}
if(password2 == ""){
alert("请输入确认密码!");
return;
}
if(password!=password2 ){
alert("2次输入的密码不一样,请重新输入!");
return;
}
$.ajax({
url: "${pageContext.request.contextPath}/user/upps.do",
// async : true,
type: "post",
dataType: "json",
data:{oldpassword:oldpassword,
password:password,
},
success: function (data) {
window.location.href="personal.jsp";
}
})
});
})
</script>
<!--这是页脚-->
<jsp:include page="../pages/basefoot.jsp"></jsp:include>
</body>
</html>
signup.jsp
<%--
Created by IntelliJ IDEA.
User: 36353
Date: 2019-07-03
Time: 16:38
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>欢迎注册 — 易居住房交易平台</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet" />
<link type="text/css" href="../css/buttonStyle.css" rel="stylesheet" />
<%--导入JS文件--%>
<script src="../js/jquery-2.1.1.min.js"></script>
<%--<script src="js/signup.js"></script>--%>
</head>
<body>
<%--加入头部--%>
<jsp:include page="../pages/basehead.jsp"></jsp:include>
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-0000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏-->
<!--Logo栏和手机号栏-->
<hr width="1280px">
<!--注册-->
<div class="content">
<div class="width1190">
<div class="reg-logo">
<form method="post" action="" class="zcform">
<table align="center" cellpadding="100px" cellspacing="10px">
<tr>
<td align="right">
<label class="one" for="phone">手机号码:</label>
</td>
<td colspan="2">
<input id="phone" name="phone" type="text" class="required" value placeholder="该手机号将用来登录和找回密码" />
</td>
</tr>
<tr><td><br></td></tr>
<tr>
<td>
<label class="one" for="password">登录密码:</label>
</td>
<td colspan="2">
<input id="password" name="password" type="password" class="{required:true,rangelength:[8,20],}" value placeholder="请输入密码" />
</td>
</tr>
<tr><td><br></td></tr>
<tr>
<td>
<label class="one" for="password2">确认密码:</label>
</td>
<td colspan="2">
<input id="password2" name="password2" type="password" class="{required:true,equalTo:'#password'}" value placeholder="请再次输入密码" />
</td>
</tr>
<tr><td><br></td></tr>
<tr><td><br></td></tr>
<tr>
<td colspan="3" align="center">
注册即同意<a href="#">《用户使用协议》</a>&<a href="#">《隐私权条款》</a>
</td>
</tr>
<tr><td><br></td></tr>
<tr>
<td colspan="3">
<input class="submit" type="button" value="立即注册"/>
<%--<input class="sub-btn" type="button" value="立即注册"/>--%>
</td>
</tr>
</table>
</form>
<div class="reg-logo-right">
<h3>如果您已有账号,请</h3>
<%--FIXME 这里修改为【登录页面】--%>
<a href="${pageContext.request.contextPath}/pages/login.jsp" class="logo-a" target="_self">立即登录</a>
</div><!--reg-logo-right/-->
<div class="clears"></div>
</div><!--reg-logo/-->
</div><!--width1190/-->
</div><!--content/-->
<jsp:include page="basefoot.jsp"></jsp:include>
</body>
<script type="text/javascript">
$(function () {
$(".submit").on("click",function () {
var phone=$("input[name=phone]").val();
var password=$("input[name=password]").val();
var password2=$("input[name=password2]").val();
if(phone==""){
alert("请输入手机号码");
return;
}
if(password==""){
alert("密码不能为空");
return;
}
if(password2==""){
alert("确认密码不能为空");
return;
}
if(password!=password2){
alert("2次密码输入不一样,请重新输入!");
return;
}else {
$.ajax({
url:"${pageContext.request.contextPath}/user/singup.do",
type:"post",
async:true,
dataType:"json",
data:{
phone:phone,
password:password
},
success:function (data) {
if(data.result=="0"){
alert("注册成功");
window.location.href="login.jsp";
}else if(data.result=="1"){
alert("该用户已经注册,请直接登入");
window.location.href="login.jsp";
}
}
})
}
});
})
</script>
</html>
verify.jsp
<%@ page import="com.yiju.bean.UserAuth" %><%--
Created by IntelliJ IDEA.
User: 36353
Date: 2019-07-05
Time: 15:11
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>实名认证</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet"/>
</head>
<body>
<%--加入头部--%>
<jsp:include page="basehead.jsp"></jsp:include>
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59"/></a>
</h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<hr width="1190px">
<br>
<div class="content">
<div class="width1080">
<%--左侧导航栏--%>
<div class="vip-left">
<div class="vipNav">
<h3 class="vipTitle">账户中心</h3>
<dl>
<dt class="vipIcon3">账户设置</dt>
<dd>
<a href="${pageContext.request.contextPath}/pages/personal.jsp" >我的资料</a>
<a href="${pageContext.request.contextPath}/user/verify.do" class="vipNavCur">实名认证</a>
<a href="${pageContext.request.contextPath}/pages/psdsetting.jsp">账户密码设置</a>
</dd>
<dt class="vipIcon1">我的易居</dt>
<dd>
<a href="/user/favorite.do">我的收藏房源</a>
</dd>
</dl>
</div><!--vipNav/-->
</div><!--vip-left/-->
<%--右侧详情栏--%>
<div class="vip-right">
<h3 class="vipright-title">我的认证</h3>
<%UserAuth userAuth = (UserAuth) request.getSession().getAttribute("userAuth"); %>
<% if (userAuth == null) {%>
<br>
<br>
<br>
<br>
<br>
<p align="center" style="font-size: 17px;color: #FF0000">您尚未提交实名认证!</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div align="center">
<label class="butt" id="butt">
<input type="button" class="member_mod_buttom" onclick="window.location.href='${pageContext.request.contextPath}/pages/verifyApply.jsp'" value="立即申请"/>
</label>
</div>
<%}%>
<% if (userAuth != null && userAuth.getAuthStatus() == 0) {%>
<br>
<br>
<br>
<br>
<br>
<p align="center" style="font-size: 17px;color: #1550ff">您提交的认证申请审核中!</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<%}%>
<% if (userAuth != null && userAuth.getAuthStatus() == 1) {%>
<br>
<br>
<br>
<br>
<br>
<p align="center" style="font-size: 17px;color: #FF0000">您的认证申请已被拒绝,请核实信息!</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div align="center">
<label class="butt" id="butt3">
<input type="button" class="member_mod_buttom" onclick="window.location.href='/user/verifyApply.do'"
value="立即申请"/>
</label>
</div>
<%}%>
<% if (userAuth != null && userAuth.getAuthStatus() == 2) {%>
<br>
<br>
<br>
<br>
<br>
<p align="center" style="font-size: 17px;color: #0aff35">您已经实名认证成功!</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div align="center">
<label class="butt" id="butt2">
<input type="button" class="member_mod_buttom2" onclick="deleteById()" value="删除认证"/>
</label>
</div>
<%}%>
</div><!--vip-right/-->
<div class="clearfix"></div>
</div><!--width1190/-->
</div><!--content/-->
<!--End 个人信息填写栏-->
<div class="width1190">
<br>
<br>
<br>
<br>
<br>
<br>
</div>
<jsp:include page="basefoot.jsp"></jsp:include>
</body>
<script type="text/javascript">
function deleteById() {
window.location.href="${pageContext.request.contextPath}/user/deleteAuth.do";
}
</script>
</html>
verifyApply.jsp
<%@ page import="com.yiju.bean.UserAuth" %>
<%@ page import="com.yiju.bean.UserInfo" %><%--
Created by IntelliJ IDEA.
User: 36353
Date: 2019-07-05
Time: 15:11
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>实名认证</title>
<%--导入CSS文件--%>
<link type="text/css" href="../css/css.css" rel="stylesheet" />
<%--<script src="../js/jquery-2.1.1.min.js"></script>--%>
</head>
<body>
<%--加入头部--%>
<jsp:include page="../pages/basehead.jsp"></jsp:include>
<!--Logo栏和手机号栏-->
<div class="logo-phone">
<div class="width1190">
<table align="center" width="100%">
<tr>
<td>
<h1 class="logo"><a href="../index.jsp"><img src="../images/logo.png" width="163" height="59" /></a></h1>
</td>
<td align="center">
<div class="phones"><strong>000-00000000</strong></div>
<div class="clears"></div>
</td>
</tr>
</table>
</div><!--width1190/-->
</div><!--logo-phone/-->
<!--Logo栏和手机号栏 END-->
<hr width="1190px">
<br>
<div class="content">
<div class="width1080">
<%--左侧导航栏--%>
<div class="vip-left">
<div class="vipNav">
<h3 class="vipTitle">账户中心</h3>
<dl>
<dt class="vipIcon3">账户设置</dt>
<dd>
<a href="${pageContext.request.contextPath}/pages/personal.jsp" >我的资料</a>
<a href="${pageContext.request.contextPath}/user/verify.do" class="vipNavCur">实名认证</a>
<a href="${pageContext.request.contextPath}/pages/psdsetting.jsp">账户密码设置</a>
</dd>
<dt class="vipIcon1">我的易居</dt>
<dd>
<a href="#">我的收藏房源</a>
</dd>
</dl>
</div><!--vipNav/-->
</div><!--vip-left/-->
<%--右侧详情栏--%>
<div class="vip-right">
<h3 class="vipright-title">我的认证</h3>
<% UserInfo userInfo= (UserInfo) request.getSession().getAttribute("user"); %>
<table class="grinfo">
<tbody>
<tr>
<th ><span class="red">*</span>真 实 姓 名:</th>
<td width="600px">
<input class="inp inw" type="text" id="name" value="<%=userInfo.getTruename()%>" name="truename" maxlength="14" disabled="disabled">
</td>
</tr>
<tr>
<th height="40px"><span class="red">*</span>性 别:</th>
<td height="40px">
<input type="radio" value="0" id="rbSex1" name="sex" <%if(userInfo.getGender()==0) out.print("checked");%> disabled="disabled">
<label for="rbSex1">男 </label>
<input type="radio" value="1" id="rbSex2" name="sex" <%if(userInfo.getGender()==1) out.print("checked");%> disabled="disabled">
<label for="rbSex2">女</label>
<span id="Sex_Tip"></span>
</td>
</tr>
<tr>
<th><span class="red">*</span>身份证号码:</th>
<td>
<input class="inp inw" type="text" id="card" value="" name="card" maxlength="14">
</td>
</tr>
<tr>
<th><span class="red">*</span>身份证地址:</th>
<td>
<input class="inp inw" type="text" id="address" value="" name="cardaddress" maxlength="14">
</td>
</tr>
<tr>
<th><span class="red">*</span>现居住住址:</th>
<td>
<input class="inp inw" type="text" id="nowaddress" value="" name="liveaddress" maxlength="14">
</td>
</tr>
<tr>
<th> </th>
<td colspan="2">
<label class="butt" id="butt">
<input type="button" class="member_mod_buttom" onclick="" value="申请认证" />
</label>
</td>
</tr>
</tbody>
</table>
</div><!--vip-right/-->
<div class="clearfix"></div>
</div><!--width1190/-->
</div><!--content/-->
<script src="../js/city/jquery1.8.1.js" type="text/javascript"></script>
<!--End 个人信息填写栏-->
<div class="width1190">
<br>
<br>
<br>
<br>
</div>
<jsp:include page="basefoot.jsp"></jsp:include>
</body>
<script type="text/javascript">
$ (function () {
$(".member_mod_buttom").on("click",function () {
var card=$("input[name=card]").val();
var cardaddress=$("input[name=cardaddress]").val();
var liveaddress=$("input[name=liveaddress]").val();
if(card==""){
alert("请输入身份证号码");
return;
}
if(cardaddress==""){
alert("请输入身份证地址");
return;
}
if(liveaddress==""){
alert("请输入现在居住地");
}
$.ajax({
url:"${pageContext.request.contextPath}/user/saveAuth.do",
type:"post",
dataType:"json",
data:{
userCard:card,
userCardAddress:cardaddress,
userLiveAddress:liveaddress
},
success:function () {
window.location.href="personal.jsp";//相对路径
}
});
});
})
</script>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<!-- 配置加载类路径的配置文件 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext.xml</param-value>
</context-param>
<!-- 配置监听器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<!-- 解决中文乱码过滤器 -->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 前端控制器(加载classpath:spring-mvc.xml 服务器启动创建servlet) -->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<!-- 配置初始化参数,创建完DispatcherServlet对象,加载springmvc.xml配置文件 -->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<!-- 服务器启动的时候,让DispatcherServlet对象创建 -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
index.jsp
<%–
Created by IntelliJ IDEA.
User: 19668
Date: 2019/10/17
Time: 14:35
To change this template use File | Settings | File Templates.
–%>
<%@ page contentType=“text/html;charset=UTF-8” language=“java” %>
main.jsp
<%@ taglib prefix=“c” uri=“http://java.sun.com/jsp/jstl/core” %>
<%@ page contentType=“text/html;charset=UTF-8” language=“java” %>
<!-- 下面是几个导入的包-->
<link type="text/css" href="css/css.css" rel="stylesheet"/>
<link type="text/css" href="css/searchInputStyle.css" rel="stylesheet"/>
<link type="text/css" href="css/searchReset.css" rel="stylesheet"/>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery2.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<!-- 上面是几个导入的包-->
<%--轮播图的CSS--%>
<style>
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
#adv {
/*margin:110px auto;*/
width: 1190px;
position: relative;
}
#adv li {
display: none;
}
#adv .show {
display: block;
}
#next, #prev {
position: absolute;
top: 45%;
cursor: pointer;
transition: all .5s;
opacity: .7;
}
#next:hover, #prev:hover {
transform: scale(1.1);
opacity: 1;
}
#prev {
left: 10px;
height: 15%;
}
#next {
right: 10px;
height: 15%;
}
</style>
<%–展示主页推荐栏–%>
❤新房推荐更多>>
-
${nh.houseTitle}
${nh.houseLayout} | ${nh.houseArea} | ${nh.houseDecorate}
<div class="clears"></div>
</div><!--index-fang-list/-->
<%----%>
<%--旧房推荐--%>
<h2 class="title"><a style="color:#F1323B">❤</a>二手房推荐 <a
href="${pageContext.request.contextPath}/house/findHouse.do?houseType=1¤tPage=0">更多>></a></h2>
<div class="index-fang-list">
<c:forEach items="${oldHouses}" var="oh">
<dl>
<dt><a href="${pageContext.request.contextPath}/house/findHouseById.do?houseId=${oh.houseId}"><img src="http://image.cxhit.com/${oh.houseHeadimg}" width="286"
height="188"/></a></dt>
<dd>
<h3><a href="${pageContext.request.contextPath}/house/findHouseById.do?houseId=${oh.houseId}">${oh.houseTitle}</a></h3>
<div class="hui">${oh.houseLayout} | ${oh.houseArea} | ${oh.houseDecorate}</div>
</dd>
</dl>
</c:forEach>
<div class="clears"></div>
</div><!--index-fang-list/-->
<%--【二手房推荐】--%>
<h2 class="title"><a style="color:#F1323B">❤</a>租房推荐 <a
href="${pageContext.request.contextPath}/house/findHouse.do?houseType=2¤tPage=0">更多>></a></h2>
<div class="index-ershou">
<%--左侧栏--%>
<div class="in-er-left">
<a href="#"><img src="images/fangt1.jpg" width="380" height="285"/></a>
<div class="in-er-left-text"><strong class="fl">闵行南方发的撒的发的司法</strong><strong
class="fr alignRight">¥2841</strong></div>
</div><!--in-er-left/-->
<%--右侧栏--%>
<div class="in-er-right">
<c:forEach items="${rentHouses}" var="rh">
<dl>
<dt><a href="${pageContext.request.contextPath}/house/findHouseById.do?houseId=${rh.houseId}"><img
src="http://image.cxhit.com/${rh.houseHeadimg}"
style="width: 150px; height: 115px;" width="150" height="115"/></a></dt>
<dd>
<h3>
<a href="${pageContext.request.contextPath}/house/findHouseById.do?houseId=${rh.houseId}">${rh.houseTitle}</a>
</h3>
<br>
<div class="in-er-right-text">
${rh.houseAddress}
</div>
<div class="price">¥<strong>${rh.housePrice}${rh.priceUnit}</strong></div>
</dd>
<div class="clears"></div>
</dl>
</c:forEach>
<div class="clears"></div>
</div><!--in-er-right/-->
<div class="clears"></div>
</div><!--index-ershou/-->
<%--【二手房推荐END】--%>
</div><!--width1190/-->
<jsp:include page=“pages/basefoot.jsp”></jsp:include>
```