Browse Source

done

release/0.0.1
wyz 3 years ago
parent
commit
af19584a32
30 changed files with 1063 additions and 231 deletions
  1. +48
    -7
      README.md
  2. +1
    -1
      src/main/java/com/wyz/demo/config/BasicConfig.java
  3. +6
    -0
      src/main/java/com/wyz/demo/config/MapperConfig.java
  4. +51
    -0
      src/main/java/com/wyz/demo/controller/OrderController.java
  5. +17
    -0
      src/main/java/com/wyz/demo/dao/OrderRepository.java
  6. +18
    -11
      src/main/java/com/wyz/demo/dao/UserRepository.java
  7. +7
    -11
      src/main/java/com/wyz/demo/dto/OrderDTO.java
  8. +10
    -10
      src/main/java/com/wyz/demo/po/OrderPO.java
  9. +21
    -0
      src/main/java/com/wyz/demo/service/OrderService.java
  10. +72
    -0
      src/main/java/com/wyz/demo/service/impl/OrderServiceImpl.java
  11. +2
    -2
      src/main/java/com/wyz/demo/service/impl/UserServiceImpl.java
  12. +18
    -0
      src/main/java/com/wyz/demo/vo/OrderVO.java
  13. +0
    -0
      src/main/resources/000application.properties
  14. +10
    -0
      src/main/resources/application.yml
  15. +35
    -0
      src/main/resources/mapper/OrderMapper.xml
  16. +8
    -5
      src/main/resources/mapper/UserMapper.xml
  17. +1
    -0
      src/main/resources/mybatis-config.xml
  18. +46
    -4
      src/main/resources/static/BookInfo.html
  19. +49
    -4
      src/main/resources/static/Cart.html
  20. +49
    -6
      src/main/resources/static/FriendLink.html
  21. +22
    -72
      src/main/resources/static/Index.html
  22. +44
    -9
      src/main/resources/static/Login.html
  23. +207
    -0
      src/main/resources/static/NewOrder.html
  24. +151
    -56
      src/main/resources/static/Order.html
  25. +46
    -4
      src/main/resources/static/OrderInfo.html
  26. +42
    -9
      src/main/resources/static/Register.html
  27. +57
    -9
      src/main/resources/static/UserInfo.html
  28. +0
    -2
      src/main/resources/static/jquery.js
  29. +24
    -8
      table.sql

+ 48
- 7
README.md View File

@ -1,10 +1,19 @@
# 快递代取系统
## 版权
用的是一个大佬放在github上的前端代码,但是我现在找不到是哪个了
如果侵权的话,请联系我:)
## 介绍
前后端分离
后端使用springboot
提供json的api给前端
- 前后端分离
- 前端用jquery的ajax发送请求
- 后端使用springboot
提供json的api给前端
## 软件架构
@ -12,13 +21,13 @@
## 安装教程
1. xxxx
2. xxxx
3. xxxx
1. 先在mysql中跑一下table.sql文件,创建表
2. 改一下src/main/resources/mybatis-config.xml(改一下db,还有密码)
3. 用idea打开直接运行Application即可
## 使用说明
1. xxxx
1. 随便点就行
2. xxxx
3. xxxx
@ -181,3 +190,35 @@ ajax那边不管data的数据有没有加上JSON.stringify()都不行
把dataType删了就行
## mybatis一级缓存的禁用
因为mybatis有一级缓存,作同一个查询时,会复用上次的结果
自己通过cmd操作mysql(修改表中的数据),不会使缓存失效
只有通过mybatis修改数据,才会使一级缓存失效
所以怎么禁用一级缓存呢?
==配置文件==
```yaml
mybatis:
configuration:
cache-enabled: false #禁用二级缓存
local-cache-scope: session #一级缓存指定为session级别
local-cache-scope: statement #一级缓存指定为statement级别, 相当于禁用一级缓存
```
==手动清除==
```java
session.clearCache();
```

+ 1
- 1
src/main/java/com/wyz/demo/config/BasicConfig.java View File

@ -17,7 +17,7 @@ public class BasicConfig {
// 提供SqlSession
@Bean
@Scope("prototype")
// @Scope("prototype")
public SqlSession sqlSession(){
try{
InputStream inputStream = Resources.getResourceAsStream("mybatis-config.xml");

+ 6
- 0
src/main/java/com/wyz/demo/config/MapperConfig.java View File

@ -1,5 +1,6 @@
package com.wyz.demo.config;
import com.wyz.demo.dao.OrderRepository;
import com.wyz.demo.dao.UserRepository;
import com.wyz.demo.service.UserService;
import org.apache.ibatis.session.SqlSession;
@ -17,4 +18,9 @@ public class MapperConfig {
public UserRepository userRepository(){
return sqlSession.getMapper(UserRepository.class);
}
@Bean
public OrderRepository orderRepository(){
return sqlSession.getMapper(OrderRepository.class);
}
}

+ 51
- 0
src/main/java/com/wyz/demo/controller/OrderController.java View File

@ -0,0 +1,51 @@
package com.wyz.demo.controller;
import com.wyz.demo.dto.OrderDTO;
import com.wyz.demo.service.OrderService;
import com.wyz.demo.vo.OrderVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/order")
public class OrderController {
@Autowired
private OrderService orderService;
/**
* 查询订单
*/
@RequestMapping(value = "/getAll", produces = "application/json")
public List<OrderVO> getAll(HttpSession sess){
String username = (String)sess.getAttribute("username");
if(username==null){
log.error("{session中没有用户名:还未登录}");
return null;
}else{
List<OrderVO> orders = orderService.getAll(username);
return orders;
}
}
/**
* 提交订单
*/
@PostMapping(value = "/commit")
public void commit(@RequestBody OrderDTO orderDTO, HttpSession sess){
log.info("新订单为:{}",orderDTO);
orderService.addOrder(orderDTO,sess);
}
}

+ 17
- 0
src/main/java/com/wyz/demo/dao/OrderRepository.java View File

@ -0,0 +1,17 @@
package com.wyz.demo.dao;
import com.wyz.demo.po.OrderPO;
import java.util.List;
public interface OrderRepository {
// 根据用户id查订单
public List<OrderPO> getOrders(int sender_id);
// 提交订单
public void addOrder(OrderPO orderPO);
}

+ 18
- 11
src/main/java/com/wyz/demo/dao/UserRepository.java View File

@ -8,28 +8,35 @@ import java.util.List;
public interface UserRepository {
// 注册用户(添加)
// 添加用户
public void addUser(UserPO user);
/**
* 判断用户名是否存在
* 根据用户名获取用户
* @return
*/
public UserPO selectUserByUsername(String username);
public UserPO getUserByUsername(String username);
// /**
// * 判断密码是否正确
// * @param username fw
// * @Param password e fe
// * @return
// */
// public UserPO checkPassword(String username, String password);
/**
* 根据 username 获取 用户id
* @Param username
* @return id
*/
public int getIdByUsername(String username);
/**
* 根据 用户id 获取 username
* @Param id
* @return username
*/
public String getUsernameById(int id);
// 查找用户: 根据id
public UserPO findUserById(int id);
// // 查找用户: 根据id
// public UserPO findUserById(int id);
}

+ 7
- 11
src/main/java/com/wyz/demo/dto/OrderDTO.java View File

@ -2,18 +2,14 @@ package com.wyz.demo.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class OrderDTO {
public int orderId;
public String description;
public Date datetime;
public String location;
public String comment;
public Date timestamp;
public int senderId;
public int receiverId;
public String status;
public class OrderDTO implements Serializable {
public String description; // 订单描述
public Date when; // 快递要什么时候送到
public String location; // 快递在哪里
public int price; // 价钱
public String comment; // 备注
}

+ 10
- 10
src/main/java/com/wyz/demo/po/OrderPO.java View File

@ -7,16 +7,16 @@ import java.util.Date;
@Data
public class OrderPO {
public int orderId;
public String description;
public Date datetime;
public String location;
public String comment;
public Date timestamp;
public int senderId;
public int receiverId;
public String status;
int id;
String description;
Date when;
String location;
int senderId;
int receiverId;
int price;
String status;
String comment;
Date timestamp;
}

+ 21
- 0
src/main/java/com/wyz/demo/service/OrderService.java View File

@ -0,0 +1,21 @@
package com.wyz.demo.service;
import com.wyz.demo.dto.OrderDTO;
import com.wyz.demo.vo.OrderVO;
import javax.servlet.http.HttpSession;
import java.util.List;
public interface OrderService {
/**
* 获取全部订单
*/
public List<OrderVO> getAll(String username);
/**
* 提交订单
*/
public void addOrder(OrderDTO orderDTO, HttpSession sess);
}

+ 72
- 0
src/main/java/com/wyz/demo/service/impl/OrderServiceImpl.java View File

@ -0,0 +1,72 @@
package com.wyz.demo.service.impl;
import com.wyz.demo.dao.OrderRepository;
import com.wyz.demo.dao.UserRepository;
import com.wyz.demo.dto.OrderDTO;
import com.wyz.demo.po.OrderPO;
import com.wyz.demo.service.OrderService;
import com.wyz.demo.vo.OrderVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Service
public class OrderServiceImpl implements OrderService {
@Autowired
private UserRepository userRepository;
@Autowired
private OrderRepository orderRepository;
/**
* 获取全部订单 - 根据用户名
* @Param username 用户名
*/
@Override
public List<OrderVO> getAll(String username) {
int sender_id = userRepository.getIdByUsername(username);
List<OrderPO> orders = orderRepository.getOrders(sender_id);
List<OrderVO> res = new ArrayList<>();
for (OrderPO orderPO : orders) {
OrderVO orderVO = new OrderVO();
orderVO.setTimestamp(orderPO.getTimestamp());
orderVO.setDescription(orderPO.getDescription());
orderVO.setPrice(orderPO.getPrice());
String receiver = userRepository.getUsernameById(orderPO.getReceiverId());
// log.info("receiver-id:{}",orderPO.getReceiverId());
// log.info("receiver:{}",receiver);
orderVO.setReceiver(receiver);
orderVO.setStatus(orderPO.getStatus());
res.add(orderVO);
}
return res;
}
@Override
public void addOrder(OrderDTO orderDTO, HttpSession sess) {
OrderPO orderPO = new OrderPO();
orderPO.setDescription(orderDTO.getDescription());
orderPO.setWhen(orderDTO.getWhen());
orderPO.setLocation(orderDTO.getLocation());
orderPO.setSenderId(userRepository.getIdByUsername((String)sess.getAttribute("username")));
orderPO.setPrice(orderDTO.getPrice());
orderPO.setComment(orderDTO.getComment());
orderRepository.addOrder(orderPO);
}
}

+ 2
- 2
src/main/java/com/wyz/demo/service/impl/UserServiceImpl.java View File

@ -37,7 +37,7 @@ public class UserServiceImpl implements UserService {
log.info("请求注册的手机号是:{}",userDTO.getPhone());
Message msg = new Message();
UserPO userPO = userRepository.selectUserByUsername(userDTO.getUsername()); //判断用户名是否存在
UserPO userPO = userRepository.getUserByUsername(userDTO.getUsername()); //判断用户名是否存在
if(userPO!=null){
msg.setFlag(-3);
msg.setMsg("该用户名已经注册");
@ -77,7 +77,7 @@ public class UserServiceImpl implements UserService {
log.info("请求登录的密码是:{}",userDTO.getPassword());
Message msg = new Message();
UserPO userPO = userRepository.selectUserByUsername(userDTO.getUsername()); //判断用户名是否存在
UserPO userPO = userRepository.getUserByUsername(userDTO.getUsername()); //判断用户名是否存在
if(userPO == null){
msg.setFlag(-1);

+ 18
- 0
src/main/java/com/wyz/demo/vo/OrderVO.java View File

@ -0,0 +1,18 @@
package com.wyz.demo.vo;
import lombok.Data;
import java.util.Date;
@Data
public class OrderVO {
Date timestamp;
String description;
int price;
String receiver;
String status;
}

src/main/resources/application.properties → src/main/resources/000application.properties View File


+ 10
- 0
src/main/resources/application.yml View File

@ -0,0 +1,10 @@
mybatis:
configuration:
cache-enabled: false #禁用二级缓存
# local-cache-scope: session #一级缓存指定为session级别
local-cache-scope: statement #一级缓存指定为statement级别, 相当于禁用一级缓存
server:
port: 8081

+ 35
- 0
src/main/resources/mapper/OrderMapper.xml View File

@ -0,0 +1,35 @@
<?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">
<!-- 实现哪个Dao -->
<mapper namespace="com.wyz.demo.dao.OrderRepository">
<resultMap id="OrderMap" type="com.wyz.demo.po.OrderPO">
<id property="id" column="id" />
<result property="senderId" column="sender_id"/>
<result property="receiverId" column="receiver_id"/>
</resultMap>
<insert id="addOrder">
insert into `order`
(`description`,`when`,`location`,`sender_id`,`receiver_id`,
`price`,`status`,`comment`,`timestamp`)
values
(#{description},#{when},#{location},#{senderId},null,
#{price},"待接单",#{comment},now())
</insert>
<select id="getOrders" resultMap="OrderMap" parameterType="int">
select * from `order` where sender_id = #{sender_id}
</select>
<!-- <select id="getIdByUsername" resultType="int" parameterType="java.lang.String">-->
<!-- select id from user where username = #{username}-->
<!-- </select>-->
</mapper>

+ 8
- 5
src/main/resources/mapper/UserMapper.xml View File

@ -10,15 +10,18 @@
insert into user (username,password,phone) values (#{username},#{password}, #{phone})
</insert>
<select id="findUserById" resultType="com.wyz.demo.po.UserPO" parameterType="int">
select * from user where id = #{id}
<select id="getUserByUsername" resultType="com.wyz.demo.po.UserPO" parameterType="java.lang.String">
select * from user where username = #{username}
</select>
<select id="getIdByUsername" resultType="int" parameterType="java.lang.String">
select id from user where username = #{username}
</select>
<select id="selectUserByUsername" resultType="com.wyz.demo.po.UserPO" parameterType="java.lang.String">
select * from user where username = #{username}
<select id="getUsernameById" resultType="java.lang.String" parameterType="int">
select username from `user` where id = #{id}
</select>
</mapper>

+ 1
- 0
src/main/resources/mybatis-config.xml View File

@ -40,6 +40,7 @@
放在resources目录下 -->
<mappers>
<mapper resource="mapper/UserMapper.xml"/>
<mapper resource="mapper/OrderMapper.xml"/>
</mappers>
</configuration>

+ 46
- 4
src/main/resources/static/BookInfo.html View File

@ -19,7 +19,46 @@
}
</style>
</head>
<body>
<script>
$(function () {
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
success: function (data) {
if(data["flag"] < 0){
// 还没登录
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#logout").show();
}
},
error: function () {
console.log("error");
}
});
// 点了注销会发生什么
$("#logout").click(function () {
$("#logout").hide();
$("#register").show();
$("#login").show();
$.ajax({
url:"/user/logout",
success: function (data) {
console.log("log out success")
},
error: function () {
console.log("error");
}
});
});
})
</script>
<!-- Static navbar -->
<div class="navbar navbar-default navbar-static-top" role="navigation">
@ -28,20 +67,23 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">这什么东西</span>
</button>
<a class="navbar-brand" href="Index.html">图书商城</a>
<a class="navbar-brand" href="Index.html">快递代取系统</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a href="Login.html">登录</a></li>
<li><a href="Register.html">注册</a></li>
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
<li><a id="register" href="Register.html" style="display: none">注册</a></li>
<li><a id="logout" href="#" style="display: none">注销</a></li>
<li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a></li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>

+ 49
- 4
src/main/resources/static/Cart.html View File

@ -23,7 +23,49 @@
}
</style>
</head>
<body>
<script>
$(function () {
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
success: function (data) {
if(data["flag"] < 0){
// 还没登录
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#logout").show();
}
},
error: function () {
console.log("error");
}
});
// 点了注销会发生什么
$("#logout").click(function () {
$("#logout").hide();
$("#register").show();
$("#login").show();
$.ajax({
url:"/user/logout",
success: function (data) {
console.log("log out success")
},
error: function () {
console.log("error");
}
});
});
})
</script>
<!-- Static navbar -->
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
@ -31,20 +73,23 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">这什么东西</span>
</button>
<a class="navbar-brand" href="Index.html">图书商城</a>
<a class="navbar-brand" href="Index.html">快递代取系统</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a href="Login.html">登录</a></li>
<li><a href="Register.html">注册</a></li>
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
<li><a id="register" href="Register.html" style="display: none">注册</a></li>
<li><a id="logout" href="#" style="display: none">注销</a></li>
<li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a></li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>

+ 49
- 6
src/main/resources/static/FriendLink.html View File

@ -60,14 +60,54 @@
</script>
<script>
$(function(){
$('#myTabs a').click(function (e) {
$('#myTabs a').click(function () {
$(this).tab('show')
});
})
</script>
</head>
<body>
<script>
$(function () {
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
success: function (data) {
if(data["flag"] < 0){
// 还没登录
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#logout").show();
}
},
error: function () {
console.log("error");
}
});
// 点了注销会发生什么
$("#logout").click(function () {
$("#logout").hide();
$("#register").show();
$("#login").show();
$.ajax({
url:"/user/logout",
success: function (data) {
console.log("log out success")
},
error: function () {
console.log("error");
}
});
});
})
</script>
<!-- Static navbar -->
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
@ -75,20 +115,23 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">这什么东西</span>
</button>
<a class="navbar-brand" href="Index.html">图书商城</a>
<a class="navbar-brand" href="Index.html">快递代取系统</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a href="Login.html">登录</a></li>
<li><a href="Register.html">注册</a></li>
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
<li><a id="register" href="Register.html" style="display: none">注册</a></li>
<li><a id="logout" href="#" style="display: none">注销</a></li>
<li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a></li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>

+ 22
- 72
src/main/resources/static/Index.html View File

@ -42,12 +42,11 @@
success: function (data) {
if(data["flag"] < 0){
// 还没登录
$("#logout").hide();
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#register").hide();
$("#login").hide();
$("#logout").show();
}
},
error: function () {
@ -81,19 +80,20 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">这什么东西</span>
</button>
<a class="navbar-brand" href="Index.html">图书商城</a>
<a class="navbar-brand" href="Index.html">快递代取系统</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a id="login" href="Login.html">登录</a></li>
<li><a id="register" href="Register.html">注册</a></li>
<li><a id="logout" href="#">注销</a></li>
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
<li><a id="register" href="Register.html" style="display: none">注册</a></li>
<li><a id="logout" href="#" style="display: none">注销</a></li>
<li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a>
@ -109,7 +109,7 @@
<div class="container">
<div class="jumbotron">
<h1>图书商城</h1>
<h1>快递代取系统</h1>
<p>...</p>
<p><a class="btn btn-primary btn-lg" href="#" role="button">了解更多</a></p>
</div>
@ -125,81 +125,30 @@
</ul>
<!-- 订单详情页 -->
<div class="row">
<div class="col-sm-4 col-md-3">
<div class="thumbnail">
<a href="BookInfo.html">
<img style="width: 100%; height: 200px; display: block;" alt="100%x200"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNDggMjAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIG1lZXQiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIj48ZGVmcyAvPjxyZWN0IGZpbGw9IiNlZWVlZWUiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIiAvPjxnPjx0ZXh0IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7IGZvbnQtc2l6ZTogMjJweDsgZm9udC13ZWlnaHQ6IGJvbGQ7IGRvbWluYW50LWJhc2VsaW5lOiBjZW50cmFsOyBmaWxsOiAjYWFhYWFhOyIgeD0iMTMxLjE2IiB5PSIxMDAiPjM0OHgyMDA8L3RleHQ+PC9nPjwvc3ZnPg=="
data-src="holder.js/100%x200" data-holder-rendered="true">
</a>
<div class="caption center">
<h3>书名</h3>
<p><span>价格:</span><span>100.00</span></p>
<p><a class="btn btn-primary btn-block" role="button" href="BookInfo.html">查看详情</a></p>
</div>
</div>
</div>
<!-- 订单详情页, 包含了所有用户待接单, 供人选择 -->
<div id="all-order" class="row">
<div class="col-sm-4 col-md-3">
<div class="thumbnail">
<a href="BookInfo.html">
<img style="width: 100%; height: 200px; display: block;" alt="100%x200"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNDggMjAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIG1lZXQiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIj48ZGVmcyAvPjxyZWN0IGZpbGw9IiNlZWVlZWUiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIiAvPjxnPjx0ZXh0IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7IGZvbnQtc2l6ZTogMjJweDsgZm9udC13ZWlnaHQ6IGJvbGQ7IGRvbWluYW50LWJhc2VsaW5lOiBjZW50cmFsOyBmaWxsOiAjYWFhYWFhOyIgeD0iMTMxLjE2IiB5PSIxMDAiPjM0OHgyMDA8L3RleHQ+PC9nPjwvc3ZnPg=="
data-src="holder.js/100%x200" data-holder-rendered="true">
</a>
<div class="caption center">
<h3>书名</h3>
<p><span>价格:</span><span>100.00</span></p>
<p><a class="btn btn-primary btn-block" role="button" href="#">查看详情</a></p>
</div>
</div>
</div>
<div class="col-sm-4 col-md-3">
<div class="thumbnail">
<a href="BookInfo.html">
<img style="width: 100%; height: 200px; display: block;" alt="100%x200"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNDggMjAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIG1lZXQiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIj48ZGVmcyAvPjxyZWN0IGZpbGw9IiNlZWVlZWUiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIiAvPjxnPjx0ZXh0IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7IGZvbnQtc2l6ZTogMjJweDsgZm9udC13ZWlnaHQ6IGJvbGQ7IGRvbWluYW50LWJhc2VsaW5lOiBjZW50cmFsOyBmaWxsOiAjYWFhYWFhOyIgeD0iMTMxLjE2IiB5PSIxMDAiPjM0OHgyMDA8L3RleHQ+PC9nPjwvc3ZnPg=="
data-src="holder.js/100%x200" data-holder-rendered="true">
</a>
<div class="caption center">
<h3>书名</h3>
<p><span>价格:</span><span>100.00</span></p>
<p><a class="btn btn-primary btn-block" role="button" href="#">查看详情</a></p>
</div>
</div>
</div>
<div class="col-sm-4 col-md-3">
<div class="thumbnail">
<a href="BookInfo.html">
<img style="width: 100%; height: 200px; display: block;" alt="100%x200"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNDggMjAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIG1lZXQiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIj48ZGVmcyAvPjxyZWN0IGZpbGw9IiNlZWVlZWUiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIiAvPjxnPjx0ZXh0IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7IGZvbnQtc2l6ZTogMjJweDsgZm9udC13ZWlnaHQ6IGJvbGQ7IGRvbWluYW50LWJhc2VsaW5lOiBjZW50cmFsOyBmaWxsOiAjYWFhYWFhOyIgeD0iMTMxLjE2IiB5PSIxMDAiPjM0OHgyMDA8L3RleHQ+PC9nPjwvc3ZnPg=="
data-src="holder.js/100%x200" data-holder-rendered="true">
</a>
<div class="caption center">
<h3>书名</h3>
<p><span>价格:</span><span>100.00</span></p>
<p><a class="btn btn-primary btn-block" role="button" href="#">查看详情</a></p>
</div>
</div>
</div>
<div class="col-sm-4 col-md-3">
<div class="thumbnail">
<a href="BookInfo.html">
<a href="OrderInfo.html">
<img style="width: 100%; height: 200px; display: block;" alt="100%x200"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNDggMjAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIG1lZXQiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIj48ZGVmcyAvPjxyZWN0IGZpbGw9IiNlZWVlZWUiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIiAvPjxnPjx0ZXh0IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7IGZvbnQtc2l6ZTogMjJweDsgZm9udC13ZWlnaHQ6IGJvbGQ7IGRvbWluYW50LWJhc2VsaW5lOiBjZW50cmFsOyBmaWxsOiAjYWFhYWFhOyIgeD0iMTMxLjE2IiB5PSIxMDAiPjM0OHgyMDA8L3RleHQ+PC9nPjwvc3ZnPg=="
data-src="holder.js/100%x200" data-holder-rendered="true">
</a>
<div class="caption center">
<h3>书名</h3>
<p><span>价格:</span><span>100.00</span></p>
<p><a class="btn btn-primary btn-block" role="button" href="#">查看详情</a></p>
<p>
<span>价格:</span>
<span>100.00</span>
</p>
<p><a class="btn btn-primary btn-block" role="button" href="OrderInfo.html">查看详情</a></p>
</div>
</div>
</div>
<div class="col-sm-4 col-md-3">
<div class="thumbnail">
<a href="BookInfo.html">
<a href="OrderInfo.html">
<img style="width: 100%; height: 200px; display: block;" alt="100%x200"
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzNDggMjAwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIG1lZXQiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIj48ZGVmcyAvPjxyZWN0IGZpbGw9IiNlZWVlZWUiIHdpZHRoPSIzNDgiIGhlaWdodD0iMjAwIiAvPjxnPjx0ZXh0IHN0eWxlPSJmb250LWZhbWlseTogQXJpYWwsIEhlbHZldGljYSwgT3BlbiBTYW5zLCBzYW5zLXNlcmlmLCBtb25vc3BhY2U7IGZvbnQtc2l6ZTogMjJweDsgZm9udC13ZWlnaHQ6IGJvbGQ7IGRvbWluYW50LWJhc2VsaW5lOiBjZW50cmFsOyBmaWxsOiAjYWFhYWFhOyIgeD0iMTMxLjE2IiB5PSIxMDAiPjM0OHgyMDA8L3RleHQ+PC9nPjwvc3ZnPg=="
data-src="holder.js/100%x200" data-holder-rendered="true">
@ -207,10 +156,11 @@
<div class="caption center">
<h3>书名</h3>
<p><span>价格:</span><span>100.00</span></p>
<p><a class="btn btn-primary btn-block" role="button" href="#">查看详情</a></p>
<p><a class="btn btn-primary btn-block" role="button" href="OrderInfo.html">查看详情</a></p>
</div>
</div>
</div>
</div>
<!-- 分页 -->

+ 44
- 9
src/main/resources/static/Login.html View File

@ -43,7 +43,6 @@
type: "POST",
async: false,
success: function(data){
if(data["flag"] < 0){
$("#common").children().first().text(data["msg"]);
$("#common").show();
@ -57,10 +56,43 @@
alert("登录错误!!!请联系开发者wyz解决问题")
}
});
})
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
success: function (data) {
if(data["flag"] < 0){
// 还没登录
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#logout").show();
}
},
error: function () {
console.log("error");
}
});
// 点了注销会发生什么
$("#logout").click(function () {
$("#logout").hide();
$("#register").show();
$("#login").show();
$.ajax({
url:"/user/logout",
success: function (data) {
console.log("log out success")
},
error: function () {
console.log("error");
}
});
});
})
});
@ -76,20 +108,23 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">这什么东西</span>
</button>
<a class="navbar-brand" href="Index.html">图书商城</a>
<a class="navbar-brand" href="Index.html">快递代取系统</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a href="Login.html">登录</a></li>
<li><a href="Register.html">注册</a></li>
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
<li><a id="register" href="Register.html" style="display: none">注册</a></li>
<li><a id="logout" href="#" style="display: none">注销</a></li>
<li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a></li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
@ -101,19 +136,19 @@
<div class="col-sm-12">
<h1 class="text-center" style="margin-bottom: 30px">用户登录</h1>
</div>
<div class="col-sm-6">
<form class="form-horizontal caption" action="http://www.baidu.com" onsubmit="return false;"> <!-- 表单 form -->
<!-- 用户名 -->
<div class="form-group">
<label for="username" class="col-sm-3 control-label">用户名</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="username" placeholder="用户名"> <!-- username-->
</div>
</div>
<!-- 密码 -->
</div>
<div class="form-group">
<label for="password" class="col-sm-3 control-label">密码</label>
<div class="col-sm-8">
@ -154,7 +189,7 @@
<div class="col-sm-6">
<div class="caption">
<h3>免责声明</h3>
<p>放心, 我们会负责的</p>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
</div>

+ 207
- 0
src/main/resources/static/NewOrder.html View File

@ -0,0 +1,207 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<link rel="stylesheet" href="bootstrap-3.3.4/dist/css/bootstrap.min.css"/>
<link rel="stylesheet" href="Flat-UI-master/dist/css/flat-ui.min.css"/>
<script src="bootstrap-3.3.4/dist/js/jquery-1.11.3.min.js"></script>
<script src="bootstrap-3.3.4/dist/js/bootstrap.min.js"></script>
<script src="Flat-UI-master/dist/js/flat-ui.min.js"></script>
<title>注册</title>
<style>
.row{
margin-left: 20px;
margin-right: 20px;;
}
</style>
</head>
<body>
<script>
function k(){
return false;
}
$(function(){
$("button").click(function () {
$.ajax({
url:"/order/commit",
// data: JSON.stringify({
// description: $("input#description").val(),
// when: $("input#when").val(),
// location: $("input#location").val(),
// price: $("input#price").val(),
// comment: $("input#comment").val()
// }),
data: JSON.stringify(
$("form").serialize()
),
contentType: "application/json; charset=utf-8",
type: "POST",
async: false,
success: function(){
// 跳到我的订单
location.assign("Order.html");
},
error: function () {
alert("提交错误!!!请联系开发者wyz解决问题")
}
});
})
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
success: function (data) {
if(data["flag"] < 0){
// 还没登录
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#logout").show();
}
},
error: function () {
console.log("error");
}
});
// 点了注销会发生什么
$("#logout").click(function () {
$("#logout").hide();
$("#register").show();
$("#login").show();
$.ajax({
url:"/user/logout",
success: function (data) {
console.log("log out success")
},
error: function () {
console.log("error");
}
});
});
});
</script>
<!-- Static navbar -->
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">这什么东西</span>
</button>
<a class="navbar-brand" href="Index.html">快递代取系统</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
<li><a id="register" href="Register.html" style="display: none">注册</a></li>
<li><a id="logout" href="#" style="display: none">注销</a></li>
<li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<!--content-->
<div class="container">
<div class="row thumbnail">
<div class="col-sm-12">
<h1 class="text-center" style="margin-bottom: 30px">发起新订单</h1>
</div>
<div class="col-sm-12">
<form class="form-horizontal caption" action="https://www.baidu.com" method="post" onsubmit="return k();">
<div class="form-group">
<label for="description" class="col-sm-3 control-label">订单描述</label>
<div class="col-sm-6">
<input type="text" name="description" class="form-control" id="description" placeholder="这是一个不错的订单">
</div>
</div>
<div class="form-group">
<label for="when" class="col-sm-3 control-label">什么时候送到?</label>
<div class="col-sm-6">
<input type="datetime-local" name="when" class="form-control" id="when" value="2011-08-19T13:45:00">
</div>
</div>
<div class="form-group">
<label for="location" class="col-sm-3 control-label">送到哪里?</label>
<div class="col-sm-6">
<input type="text" name="location" class="form-control" id="location" placeholder="第八宿舍">
</div>
</div>
<div class="form-group">
<label for="price" class="col-sm-3 control-label">价格</label>
<div class="col-sm-6">
<input type="number" name="price" class="form-control" id="price" placeholder="1块钱">
</div>
</div>
<div class="form-group">
<label for="comment" class="col-sm-3 control-label">备注</label>
<div class="col-sm-6">
<input type="text" name="comment" class="form-control" id="comment" placeholder="贵重物品">
</div>
</div>
<!-- 提示信息: 用户不存在or密码错误 -->
<div class="form-group">
<div class="col-sm-offset-3 col-sm-8">
<p id="common" style="font-size: 10px; display: none;">&nbsp;&nbsp;&nbsp;<b>msg</b></p>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-4">
<button type="submit" class="btn btn-success btn-block">提交</button>
</div>
</div>
</form>
</div>
<!-- <div class="col-sm-6">-->
<!-- <div class="caption">-->
<!-- <h3>免责声明</h3>-->
<!-- <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>-->
<!-- </div>-->
<!-- </div>-->
</div>
</div>
<!--footer-->
<div class="navbar navbar-default navbar-static-bottom">
<p style="text-align: center">版权声明区</p>
</div>
</body>
</html>

+ 151
- 56
src/main/resources/static/Order.html View File

@ -8,7 +8,8 @@
<script src="bootstrap-3.3.4/dist/js/jquery-1.11.3.min.js"></script>
<script src="bootstrap-3.3.4/dist/js/bootstrap.min.js"></script>
<script src="Flat-UI-master/dist/js/flat-ui.min.js"></script>
<title></title>
<title>订单</title>
<style>
.row{
margin-left: 20px;
@ -30,6 +31,7 @@
cursor: pointer;
}
</style>
<script>
function myClick(n){
location.href = "OrderInfo.html";
@ -38,12 +40,119 @@
alert("btn");
return false;
}
$(function(){
})
</script>
</head>
<body>
<script>
$(function () {
var orders;
// 发一个请求获取全部订单
// 后面可以改成每次拿10个
$.ajax({
url:"/order/getAll",
success: function (data) {
for (var order of data){
var node = document.createElement("div");
node.setAttribute("class","col-sm-12 list-group-item");
// 发布时间
var timestamp = document.createElement("div");
timestamp.setAttribute("class","col-sm-3 line-center");
timestamp.innerText = order.timestamp.substring(0,19).replace("T"," ");
node.append(timestamp)
// 描述
var description = document.createElement("div");
description.setAttribute("class","col-sm-3 line-center");
description.innerText = order.description;
node.append(description)
// 订单价格
var price = document.createElement("div");
price.setAttribute("class","col-sm-1 line-center");
price.innerText = order.price;
node.append(price)
// 接单人
var receiver = document.createElement("div");
receiver.setAttribute("class","col-sm-2 line-center");
receiver.innerText = order.receiver;
node.append(receiver)
// 订单状态
var status = document.createElement("div");
status.setAttribute("class","col-sm-1 line-center");
status.innerText = order.status;
node.append(status)
// 【操作】
var delete_op = document.createElement("button");
delete_op.setAttribute("class","btn btn-danger");
delete_op.innerText = "删除订单";
var commit_op = document.createElement("button");
commit_op.setAttribute("class","btn btn-success");
commit_op.innerText = "提交订单";
var ops = document.createElement("div");
ops.setAttribute("class","col-sm-2 line-center");
ops.append(delete_op);
ops.append(commit_op);
node.append(ops)
$("div.list-group").append(node);
}
},
error: function () {
// alert("获取订单失败,请联系开发者wyz");
}
});
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
success: function (data) {
if(data["flag"] < 0){
// 还没登录
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#logout").show();
}
},
error: function () {
console.log("error");
}
});
// 点了注销会发生什么
$("#logout").click(function () {
$("#logout").hide();
$("#register").show();
$("#login").show();
$.ajax({
url:"/user/logout",
success: function (data) {
console.log("log out success")
},
error: function () {
console.log("error");
}
});
});
})
</script>
<!-- Static navbar -->
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
@ -51,89 +160,75 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">这什么东西</span>
</button>
<a class="navbar-brand" href="Index.html">图书商城</a>
<a class="navbar-brand" href="Index.html">快递代取系统</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a href="Login.html">登录</a></li>
<li><a href="Register.html">注册</a></li>
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
<li><a id="register" href="Register.html" style="display: none">注册</a></li>
<li><a id="logout" href="#" style="display: none">注销</a></li>
<li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a></li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<!--content-->
<div class="container">
<div class="row thumbnail center">
<div class="col-sm-12">
<h1 class="text-center" style="margin-bottom: 30px">我的订单</h1>
</div>
<div class="col-sm-12 thumbnail">
<div class="col-sm-3 line-center">订单编号</div>
<div class="col-sm-2 line-center">订单状态</div>
<div class="col-sm-2 line-center">商品数量 </div>
<div class="col-sm-2 line-center">订单总价</div>
<div class="col-sm-3 line-center">操作</div>
<div class="col-sm-3 line-center">发布时间</div>
<div class="col-sm-3 line-center">描述</div>
<div class="col-sm-1 line-center">价格</div>
<div class="col-sm-2 line-center">接单人</div>
<div class="col-sm-1 line-center">状态</div>
<div class="col-sm-2 line-center">操作</div>
</div>
<!-- important -->
<div class="list-group">
<!-- <div class="col-sm-12 list-group-item" >-->
<!-- <div class="col-sm-3 line-center" onclick="myClick(1)">ahiudsfhjk-23423-23asd-12</div>-->
<!-- <div class="col-sm-3 line-center">未付款</div>-->
<!-- <div class="col-sm-1 line-center">12</div>-->
<!-- <div class="col-sm-2 line-center">big guy</div>-->
<!-- <div class="col-sm-1 line-center">none</div>-->
<!-- <div class="col-sm-2 line-center">-->
<!-- <button class="btn btn-danger">删除订单</button>-->
<!-- <button class="btn btn-success">提交订单</button>-->
<!-- </div>-->
<!-- </div>-->
</div>
<div>
<div class="col-sm-12 list-group-item" >
<div class="col-sm-3 line-center" onclick="myClick(1)">ahiudsfhjk-23423-23asd-12</div>
<div class="col-sm-2 line-center">未付款</div>
<div class="col-sm-2 line-center">12 </div>
<div class="col-sm-2 line-center">1231.00元</div>
<div class="col-sm-3 line-center">
<button class="btn btn-danger">删除订单</button>
<button class="btn btn-success">提交订单</button>
</div>
</div>
<div class="col-sm-12 list-group-item" >
<div class="col-sm-3 line-center" onclick="myClick(2)">ahiudsfhjk-23423-23asd-12</div>
<div class="col-sm-2 line-center">未付款</div>
<div class="col-sm-2 line-center">12 </div>
<div class="col-sm-2 line-center">1231.00元</div>
<div class="col-sm-3 line-center">
<button class="btn btn-danger">删除订单</button>
<button class="btn btn-success">提交订单</button>
</div>
</div>
<div class="col-sm-12 list-group-item" >
<div class="col-sm-3 line-center" onclick="myClick(3)">ahiudsfhjk-23423-23asd-12</div>
<div class="col-sm-2 line-center">未付款</div>
<div class="col-sm-2 line-center">12 </div>
<div class="col-sm-2 line-center">1231.00元</div>
<div class="col-sm-3 line-center">
<button class="btn btn-danger">删除订单</button>
<button class="btn btn-success">提交订单</button>
</div>
</div>
<div class="col-sm-12 list-group-item" >
<div class="col-sm-3 line-center" onclick="myClick(4)">ahiudsfhjk-23423-23asd-12</div>
<div class="col-sm-2 line-center">未付款</div>
<div class="col-sm-2 line-center">12 </div>
<div class="col-sm-2 line-center">1231.00元</div>
<div class="col-sm-3 line-center">
<button class="btn btn-danger">删除订单</button>
<button class="btn btn-success">提交订单</button>
</div>
<p style="text-align: center">点击显示更多</p>
</div>
</div>
</div>
</div>
<!--footer-->
<div class="navbar navbar-default navbar-static-bottom">
版权声明区
<p style="text-align: center">版权声明区</p>
</div>
</body>
</html>

+ 46
- 4
src/main/resources/static/OrderInfo.html View File

@ -57,7 +57,46 @@
})
</script>
</head>
<body>
<script>
$(function () {
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
success: function (data) {
if(data["flag"] < 0){
// 还没登录
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#logout").show();
}
},
error: function () {
console.log("error");
}
});
// 点了注销会发生什么
$("#logout").click(function () {
$("#logout").hide();
$("#register").show();
$("#login").show();
$.ajax({
url:"/user/logout",
success: function (data) {
console.log("log out success")
},
error: function () {
console.log("error");
}
});
});
})
</script>
<!-- Static navbar -->
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
@ -65,20 +104,23 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">这什么东西</span>
</button>
<a class="navbar-brand" href="Index.html">图书商城</a>
<a class="navbar-brand" href="Index.html">快递代取系统</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a href="Login.html">登录</a></li>
<li><a href="Register.html">注册</a></li>
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
<li><a id="register" href="Register.html" style="display: none">注册</a></li>
<li><a id="logout" href="#" style="display: none">注销</a></li>
<li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a></li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>

+ 42
- 9
src/main/resources/static/Register.html View File

@ -24,13 +24,11 @@
<script>
function k(){
return false;
}
$(function(){
$("button").click(function () {
$.ajax({
url:"/user/register",
data: JSON.stringify({
@ -56,6 +54,40 @@
}
});
})
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
success: function (data) {
if(data["flag"] < 0){
// 还没登录
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#logout").show();
}
},
error: function () {
console.log("error");
}
});
// 点了注销会发生什么
$("#logout").click(function () {
$("#logout").hide();
$("#register").show();
$("#login").show();
$.ajax({
url:"/user/logout",
success: function (data) {
console.log("log out success")
},
error: function () {
console.log("error");
}
});
});
});
</script>
@ -69,20 +101,23 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">这什么东西</span>
</button>
<a class="navbar-brand" href="Index.html">图书商城</a>
<a class="navbar-brand" href="Index.html">快递代取系统</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="UserInfo.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a href="Login.html">登录</a></li>
<li><a href="Register.html">注册</a></li>
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
<li><a id="register" href="Register.html" style="display: none">注册</a></li>
<li><a id="logout" href="#" style="display: none">注销</a></li>
<li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a></li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
@ -93,9 +128,8 @@
<div class="col-sm-12">
<h1 class="text-center" style="margin-bottom: 30px">用户注册</h1>
</div>
<div class="col-sm-6">
<!-- 表单开始 -->
<div class="col-sm-6">
<form class="form-horizontal caption" action="https://www.baidu.com" method="post" onsubmit="return k();">
<div class="form-group">
@ -179,7 +213,6 @@
</div>
</div>
</div>
</div>

+ 57
- 9
src/main/resources/static/UserInfo.html View File

@ -8,11 +8,13 @@
<script src="bootstrap-3.3.4/dist/js/jquery-1.11.3.min.js"></script>
<script src="bootstrap-3.3.4/dist/js/bootstrap.min.js"></script>
<script src="Flat-UI-master/dist/js/flat-ui.min.js"></script>
<title></title>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.5.0.js"></script>
<title>个人中心</title>
<style>
.row{
margin-left: 20px;
margin-right: 20px;;
margin-right: 20px;
}
.line-center{
line-height:50px;
@ -67,7 +69,46 @@
})
</script>
</head>
<body>
<script>
$(function () {
// 发一个请求给后端, 让后端看看有没有session
$.ajax({
url:"/user/check",
success: function (data) {
if(data["flag"] < 0){
// 还没登录
$("#register").show();
$("#login").show();
}else{
// 已经登录了
$("#logout").show();
}
},
error: function () {
console.log("error");
}
});
// 点了注销会发生什么
$("#logout").click(function () {
$("#logout").hide();
$("#register").show();
$("#login").show();
$.ajax({
url:"/user/logout",
success: function (data) {
console.log("log out success")
},
error: function () {
console.log("error");
}
});
});
})
</script>
<!-- Static navbar -->
<div class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container">
@ -75,25 +116,30 @@
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">这什么东西</span>
</button>
<a class="navbar-brand" href="Index.html">图书商城</a>
<a class="navbar-brand" href="Index.html">快递代取系统</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="Index.html">首页</a></li>
<li><a href="Order.html">我的订单</a></li>
<li><a href="UserInfo.html">个人中心</a></li>
<li><a href="NewOrder.html">发起订单</a></li>
<li><a href="FriendLink.html">友情链接</a></li>
</ul>
<ul class="nav navbar-nav navbar-right hidden-sm">
<li><a href="Login.html">登录</a></li>
<li><a href="Register.html">注册</a></li>
<li><a id="login" href="Login.html" style="display: none;">登录</a></li>
<li><a id="register" href="Register.html" style="display: none">注册</a></li>
<li><a id="logout" href="#" style="display: none">注销</a></li>
<li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a></li>
<a href="Cart.html"><span class="glyphicon glyphicon-shopping-cart">购物车</span></a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<!--content-->
<!-- content -->
<div class="container">
<div class="row thumbnail center col-sm-12">
<div class="col-sm-12">
@ -117,9 +163,11 @@
</div>
</div>
<!--footer-->
<!-- footer -->
<div class="navbar navbar-default navbar-static-bottom">
版权声明区
<p style="text-align: center">版权声明区</p>
</div>
</body>
</html>

+ 0
- 2
src/main/resources/static/jquery.js
File diff suppressed because it is too large
View File


+ 24
- 8
table.sql View File

@ -1,11 +1,27 @@
use DeliveryTakingSystem;
-- use DeliveryTakingSystem;
create table `user`(
id int auto_increment,
username varchar(20),
`password` varchar(20),
`phone` varchar(20),
primary key(id)
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(20) DEFAULT NULL,
`password` varchar(20) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
);
CREATE TABLE `order` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`description` text,
`when` datetime DEFAULT NULL,
`location` text,
`senderId` int(11) DEFAULT NULL,
`receiverId` int(11) DEFAULT NULL,
`price` int(11) DEFAULT NULL,
`status` varchar(20) DEFAULT NULL,
`comment` text,
`timestamp` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_senderId` (`senderId`),
CONSTRAINT `fk_senderId` FOREIGN KEY (`senderId`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Loading…
Cancel
Save