Commit 08160e08 by shj

用户登录功能完成,拦截器完成,未登录时无法使用其他功能

parent c929ff56
CREATE TABLE budgetmanagementsystem.conference
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '名称(会议内容)',
price double COMMENT '会议标准费用',
comment text,
experts int(11) COMMENT '需要专家人数',
people int(11) DEFAULT '0' COMMENT '参会人数'
);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (1, '项目启动会', 200, null, 3, 0);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (2, '中期', 200, null, 3, 0);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (3, '预验收', 200, null, 3, 0);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (4, '验收', 200, null, 2, 0);
INSERT INTO budgetmanagementsystem.conference (id, name, price, comment, experts, people) VALUES (5, '学术会议', 5000, null, 0, 0);
CREATE TABLE budgetmanagementsystem.consultation
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '专家信息(职称等)',
price double COMMENT '咨询费',
comment text
);
INSERT INTO budgetmanagementsystem.consultation (id, name, price, comment) VALUES (1, '专家', 1000, null);
CREATE TABLE budgetmanagementsystem.equipment
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '型号规格',
price double,
type varchar(50) COMMENT '子类别',
img varchar(100) COMMENT '图片url',
comment text COMMENT '备注'
);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (32, 'UltraLAB Alpha720(425256-SB28TD)', 275000, null, null, null);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (33, '戴尔Precision T5820(Xeon W-2123/64GB/512GB+4TB/P2000)', 23700, null, null, null);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (34, '联想ThinkStation P318(酷睿i7-7700/16GB/1TB/GTX1080)', 14900, null, null, null);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (35, 'HP Z8 G4(Z3Z16AV-SC001)', 40000, null, null, null);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (36, 'Wiseteam CP265 C33128-SAEK12', 149900, null, null, null);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (37, '苹果Mac Pro(ME253CH/A)', 21900, null, null, null);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (38, 'UltraLAB H490(14664-M5TCX)', 47000, null, null, null);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (39, 'UltraLAB EX620(23496-M528TC)', 140000, null, null, null);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (40, '戴尔Precision T5820(p5820t-w2102nlcn01)', 11300, null, null, null);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (41, 'UltraLAB P490(14664-MAX)', 60000, null, null, null);
INSERT INTO budgetmanagementsystem.equipment (id, name, price, type, img, comment) VALUES (42, '戴尔Precision T7820(P7820T-31045NLCN01)', 15900, null, null, null);
CREATE TABLE budgetmanagementsystem.internationalcommunication
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100),
price double,
comment text
);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment) VALUES (1, '澳大利亚', 39000, null);
INSERT INTO budgetmanagementsystem.internationalcommunication (id, name, price, comment) VALUES (2, '北卡莱罗纳', 21000, null);
CREATE TABLE budgetmanagementsystem.labour
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '名目(本硕博专)',
price double COMMENT '单价(人月)',
priority int(11) COMMENT '优先级',
comment text
);
INSERT INTO budgetmanagementsystem.labour (id, name, price, priority, comment) VALUES (1, '博士生', 2000, 2, null);
INSERT INTO budgetmanagementsystem.labour (id, name, price, priority, comment) VALUES (2, '硕士生', 1000, 3, null);
INSERT INTO budgetmanagementsystem.labour (id, name, price, priority, comment) VALUES (3, '专职', 11536, 1, null);
CREATE TABLE budgetmanagementsystem.material
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '名称/规格',
price double COMMENT '单价',
type varchar(50) COMMENT '类型',
img varchar(100) COMMENT '图片链接',
comment text COMMENT '备注'
);
INSERT INTO budgetmanagementsystem.material (id, name, price, type, img, comment) VALUES (1, '硬盘', 2000, null, null, null);
INSERT INTO budgetmanagementsystem.material (id, name, price, type, img, comment) VALUES (2, '加密移动硬盘', 3000, null, null, null);
INSERT INTO budgetmanagementsystem.material (id, name, price, type, img, comment) VALUES (10, 'new', 0, null, null, null);
CREATE TABLE budgetmanagementsystem.power
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100),
price double,
comment text
);
CREATE TABLE budgetmanagementsystem.property
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '名称名目',
price double,
comment text
);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (1, '著作权', 2000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (2, '知识产权', 5000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (3, '广西省电子地图数据', 10000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (4, '广西省货车 UGC 数据', 10000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (5, '广西省物流 UGC 数据', 10000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (6, '论文发表费', 4000, null);
INSERT INTO budgetmanagementsystem.property (id, name, price, comment) VALUES (7, '广西省交通流量视频数据', 10000, null);
CREATE TABLE budgetmanagementsystem.ruleEquipment
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
min_val int(11) DEFAULT '0',
max_val int(11) DEFAULT '100000'
);
CREATE TABLE budgetmanagementsystem.testandprocess
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name varchar(100) COMMENT '名称、内容',
price double COMMENT '单价',
comment text COMMENT '备注'
);
INSERT INTO budgetmanagementsystem.testandprocess (id, name, price, comment) VALUES (1, '测试化验加工费', 150000, null);
CREATE TABLE budgetmanagementsystem.travel
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
dest varchar(50) COMMENT '目的地',
price double COMMENT '往返价格',
food double COMMENT '伙食标准',
traffic double COMMENT '交通标准',
accommodation double COMMENT '住宿标准',
comment text COMMENT '备注'
);
INSERT INTO budgetmanagementsystem.travel (id, dest, price, food, traffic, accommodation, comment) VALUES (1, '上海', 2000, 100, 80, 500, null);
INSERT INTO budgetmanagementsystem.travel (id, dest, price, food, traffic, accommodation, comment) VALUES (2, '南宁', 2000, 100, 80, 350, null);
INSERT INTO budgetmanagementsystem.travel (id, dest, price, food, traffic, accommodation, comment) VALUES (3, '桂林', 2000, 100, 80, 350, null);
INSERT INTO budgetmanagementsystem.travel (id, dest, price, food, traffic, accommodation, comment) VALUES (4, '北海', 2000, 100, 80, 350, null);
CREATE TABLE budgetmanagementsystem.workstation
(
id int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
spec varchar(100) COMMENT '型号规格',
price double COMMENT '单价(万)',
img varchar(100) COMMENT '图片url'
);
CREATE UNIQUE INDEX workstation_spec_uindex ON budgetmanagementsystem.workstation (spec);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (35, '戴尔Precision T5820(Xeon W-2123/64GB/512GB+4TB/P2000)', 23700, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (36, 'UltraLAB P490(14664-MAX)', 60000, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (37, 'HP Z4 G4(1JP11AV-SC001)', 17000, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (38, 'Wiseteam CP265 C33128-SAEK12', 149900, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (39, '凌炫Pt8040(E221T-ECEP6)', 499900, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (40, '联想ThinkStation P520c(Xeon W-2123/16GB/256GB+1TB/P2000)', 14400, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (41, '戴尔Precision T7920塔式系列(P7920T-S4110NLCN01)', 24300, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (42, 'UltraLAB Alpha720(425256-SB28TD)', 275000, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (43, 'UltraLAB H490(14664-M5TCX)', 47000, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (44, 'UltraLAB EX620(23496-M528TC)', 140000, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (45, '戴尔Precision 7530系列(Promo-M7530I78750-Online1)', 18600, null);
INSERT INTO budgetmanagementsystem.workstation (id, spec, price, img) VALUES (46, '戴尔Precision 5530系列(Promo-M5530I58300-Online1)', 9999, null);
\ No newline at end of file
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
userid,int(11),int,,YES,0,用户id
filename,varchar(50),varchar,50,YES,,预算文件名称
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
name,varchar(100),varchar,100,YES,,名称(会议内容)
price,double,double,,YES,,会议标准费用
comment,text,text,65535,YES,,""
experts,int(11),int,,YES,,需要专家人数
people,int(11),int,,YES,0,参会人数
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
name,varchar(100),varchar,100,YES,,专家信息(职称等)
price,double,double,,YES,,咨询费
comment,text,text,65535,YES,,""
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
name,varchar(100),varchar,100,YES,,型号规格
price,double,double,,YES,,""
type,varchar(50),varchar,50,YES,,子类别
img,varchar(100),varchar,100,YES,,图片url
comment,text,text,65535,YES,,备注
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
name,varchar(100),varchar,100,YES,,""
price,double,double,,YES,,""
comment,text,text,65535,YES,,""
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
name,varchar(100),varchar,100,YES,,名目(本硕博专)
price,double,double,,YES,,单价(人月)
priority,int(11),int,,YES,,优先级
comment,text,text,65535,YES,,""
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
name,varchar(100),varchar,100,YES,,名称/规格
price,double,double,,YES,,单价
type,varchar(50),varchar,50,YES,,类型
img,varchar(100),varchar,100,YES,,图片链接
comment,text,text,65535,YES,,备注
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
name,varchar(100),varchar,100,YES,,""
price,double,double,,YES,,""
comment,text,text,65535,YES,,""
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
name,varchar(100),varchar,100,YES,,名称名目
price,double,double,,YES,,""
comment,text,text,65535,YES,,""
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
name,varchar(100),varchar,100,YES,,名称、内容
price,double,double,,YES,,单价
comment,text,text,65535,YES,,备注
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
dest,varchar(50),varchar,50,YES,,目的地
price,double,double,,YES,,往返价格
food,double,double,,YES,,伙食标准
traffic,double,double,,YES,,交通标准
accommodation,double,double,,YES,,住宿标准
comment,text,text,65535,YES,,备注
列名,数据类型,字段类型,长度,是否为空,默认值,备注
id,int(11),int,,NO,,""
username,varchar(50),varchar,50,YES,username,用户名
password,varchar(20),varchar,20,YES,password,密码
package beans;
public class User {
private Integer id;
private String name;
private String password;
public User(String name, String password) {
this.name = name;
this.password = password;
}
public User() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
package dao;
import beans.User;
public interface IUserDao {
User selectUserByName(String name);
}
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="dao.IUserDao">
<select id="selectUserByName" resultType="beans.User">
select * from user where name=#{name}
</select>
</mapper>
\ No newline at end of file
......@@ -408,6 +408,7 @@ public class BudgetHandler {
items.remove(property);
items.put(property,nums);
}
afterUpdate(budget);
serializeBudget(budget, getFilePath(sessionID));
}
......@@ -619,11 +620,20 @@ public class BudgetHandler {
items.remove(travel);
items.put(travel, pair);
}
afterUpdate(budget);
serializeBudget(budget, getFilePath(sessionID));
}
/**
* 预算修改的善后工作
* @param budget
*/
private void afterUpdate(Budget budget){
budget.setIndirects(budget.computeIndirect());
}
/**
* 从Cookies中获取sessionID
*
* @param cookies
......
......@@ -43,7 +43,7 @@ public class DetailHandler {
obj.put("nums",indirects.get(indirect));
list.add(obj);
}
object.put("indirects",list);
object.put("data",list);
writer.write(object.toJSONString());
} catch (IOException e) {
e.printStackTrace();
......@@ -65,6 +65,7 @@ public class DetailHandler {
double req_sofar=0.0,sum_sofar=0.0,req,sum;
//设备费
JSONObject sub=new JSONObject();
req=budget.getRequirement().getEquip();
sum=detailService.sumEquipment(budget.getEquipments());
......@@ -74,6 +75,7 @@ public class DetailHandler {
object.put("equipment",sub);
req_sofar+=req;sum_sofar+=sum;
//差旅费
sub=new JSONObject();
req=budget.getRequirement().getTravel();
sum=detailService.sumTravel(budget.getTravels());
......@@ -83,6 +85,7 @@ public class DetailHandler {
object.put("travel",sub);
req_sofar+=req;sum_sofar+=sum;
//劳务费
sub=new JSONObject();
req=budget.getRequirement().getLabour();
sum=detailService.sumLabour(budget.getLabour());
......@@ -92,6 +95,16 @@ public class DetailHandler {
object.put("labour",sub);
req_sofar+=req;sum_sofar+=sum;
//产权费
sub=new JSONObject();
req=budget.getRequirement().getProperty();
sum=detailService.sumProperty(budget.getProperties());
sub.put("req",req);
sub.put("sum",sum);
sub.put("diff",req-sum);
object.put("property",sub);
req_sofar+=req;sum_sofar+=sum;
object.put("req",req_sofar);
object.put("sum",sum_sofar);
object.put("diff",req_sofar-sum_sofar);
......@@ -179,7 +192,7 @@ public class DetailHandler {
obj.put("nums",powers.get(item));
list.add(obj);
}
object.put("powers",list);
object.put("data",list);
writer.write(JSON.toJSONString(object));
} catch (IOException e) {
e.printStackTrace();
......
package handlers;
import beans.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import service.IUserService;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
public class LoginHandler {
@RequestMapping("/LoginPage")
public String login(HttpServletRequest request, HttpServletResponse response){
return "login.jsp";
}
@Autowired
private IUserService userService;
@RequestMapping("/Login")
public void loginAction(User user,HttpServletRequest request, HttpServletResponse response){
if(userService.checkUser(user))
{
response.addCookie(new Cookie("userid",user.getId().toString()));
response.addCookie(new Cookie("username",user.getName()));
}
else {
;
}
}
}
package interceptors;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LoginInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
System.out.println("preHandle");
if(!checkCookie(request.getCookies(),"userid"))
{
request.getRequestDispatcher("/LoginPage").forward(request,response);
return false;
}
return true;
}
private boolean checkCookie(Cookie[] cookies, String name) {
for (Cookie cookie : cookies) {
if(cookie.getName().equals(name))
return true;
}
return false;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
System.out.println("postHandle");
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
System.out.println("afterCompletion");
}
}
package service;
import beans.Equipment;
import beans.Labour;
import beans.Pair;
import beans.Travel;
import beans.*;
import java.util.Map;
......@@ -14,4 +11,6 @@ public interface IDetailService {
double sumTravel(Map<Travel, Pair> travels);
double sumLabour(Map<Labour, Integer> labour);
double sumProperty(Map<Property, Integer> properties);
}
package service;
import beans.User;
public interface IUserService {
boolean checkUser(User user);
}
package service.impl;
import beans.Equipment;
import beans.Labour;
import beans.Pair;
import beans.Travel;
import beans.*;
import org.springframework.stereotype.Service;
import service.IDetailService;
......@@ -37,4 +34,13 @@ public class DetailService implements IDetailService {
}
return sum;
}
@Override
public double sumProperty(Map<Property, Integer> properties) {
double sum=0.0;
for (Property item : properties.keySet()) {
sum+=(item.getPrice()*properties.get(item));
}
return sum;
}
}
package service.impl;
import beans.User;
import dao.IUserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import service.IUserService;
@Service
public class UserService implements IUserService {
@Autowired
private IUserDao userDao;
@Override
public boolean checkUser(User user) {
User exist=userDao.selectUserByName(user.getName());
if(exist==null) return false;
user.setId(exist.getId());
return true;
}
}
......@@ -16,6 +16,13 @@
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="handlers"/>
<mvc:annotation-driven/>
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/Login*"/>
<bean class="interceptors.LoginInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
<mvc:resources mapping="/resources/**" location="/resources/"/>
<mvc:resources mapping="/data/**" location="/data/"/>
<mvc:resources mapping="/files/**" location="/files/"/>
......
......@@ -67,9 +67,9 @@
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
</jsp-config>
<welcome-file-list>
<!--<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
</welcome-file-list>-->
</web-app>
\ No newline at end of file
......@@ -67,16 +67,6 @@
<form class="form-horizontal" method="post" action="${pageContext.request.contextPath}/Budget/Generate">
<%--<fieldset>--%>
<%-- <div class="form-group">
<label class="control-label col-sm-4">预算类型</label>
<div class="col-sm-4">
<select name="budget-type" class="form-control">
<option>专项</option>
<option>自筹</option>
</select>
</div>
</div>--%>
<div class="form-group">
<label class="control-label col-sm-4">总预算(万元)</label>
......
<%--
Created by IntelliJ IDEA.
User: Song
Date: 2019/4/14
Time: 15:57
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>登录/注册</title>
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- 可选的 Bootstrap 主题文件(一般不用引入) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css"
integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
</head>
<body>
<div id="login">
<form>
<div class="form-group">
<label for="userName">用户名</label>
<input type="text" class="form-control" id="userName" placeholder="Name" v-model="user.name">
</div>
<div class="form-group">
<label for="password">密码</label>
<input type="password" class="form-control" id="password" placeholder="Password" v-model="user.password">
</div>
<button type="button" class="btn btn-default" @click="login()">登录</button>
<button type="button" class="btn btn-default" @click="register()">注册</button>
</form>
</div>
<script>
var loginVue=new Vue({
el:"#login",
data:{
user:{name:"",password:""}
},
methods:{
login:function () {
console.log(this.user.name);
console.log(this.user.password);
this.$http.post("${pageContext.request.contextPath}/Login",
{
name:this.user.name,
password:this.user.password
},
{emulateJSON: true}
).then(function (value) {
location.reload();
});
},
register:function () {
console.log(this.user.name);
console.log(this.user.password);
}
}
});
</script>
</body>
</html>
<%--
Created by IntelliJ IDEA.
User: Song
Date: 2019/4/14
Time: 16:33
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>登录/注册</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- 可选的 Bootstrap 主题文件(一般不用引入) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css"
integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style type="text/css">
body {
padding-top: 70px;
}
</style>
<script src="https://cdn.staticfile.org/angular.js/1.6.3/angular.min.js"></script>
</head>
<body>
<%--<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="${pageContext.request.contextPath}/">预算辅助管理系统</a>
</div>
<div>
<ul class="nav navbar-nav">
<li><a href="${pageContext.request.contextPath}/">创建预算</a></li>
<li><a href="${pageContext.request.contextPath}/Budget/Detail">修改预算</a></li>
<li><a href="${pageContext.request.contextPath}/Rule/">修改规则</a></li>
<li><a href="${pageContext.request.contextPath}/Budget/Download">导出最新预算</a></li>
<li class="active"><a href="#">测试</a></li>
</ul>
</div>
</div>
</nav>--%>
<form>
<div class="form-group">
<label for="userName">用户名</label>
<input type="text" class="form-control" id="userName" placeholder="Name">
</div>
<div class="form-group">
<label for="password">密码</label>
<input type="password" class="form-control" id="password" placeholder="Password">
</div>
<div class="form-group">
<label for="password">密码</label>
<input type="" class="form-control" id="password" placeholder="Password">
</div>
<button type="submit" class="btn btn-default">登录</button>
</form>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment