目录
1、项目创建
建立maven项目
2、配置pom.xml文件
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.web</groupId>
<artifactId>ZHPT</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>org.wso2.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.1.wso2v1</version>
</dependency>
<!-- 中文简拼 -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.0</version>
</dependency>
<!--websocket -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!--fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
<!-- ftp依赖包 -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>com.microsoft</groupId>
<artifactId>sqljdbc4</artifactId>
<version>3.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/sqljdbc4-3.0.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.web.StartApp</mainClass>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>lib</directory>
<targetPath>BOOT-INF/lib</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
<resource>
<directory>src/main/webapp</directory>
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
</build>
</project>
3、配置数据库
spring:
datasource:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://127.0.0.1;databaseName=ZHPT
username: sa
password:
4、创建登录页面
<body
style="background: url(../../files/image/login/bg.png);height: 100%; width: 100%; background-size: cover; overflow-y: hidden;">
<div id="title" style="position: absolute;margin-top: 6%;margin-left: 10%;">
<label style="font-size: 50px;font-weight: bold;font-family: 仿宋;color:white;">智慧校园管理平台</label>
<label style="font-size: 45px;font-weight: bold;font-family: 仿宋;color:white;"></label>
</div>
<div id="login" style="height: 400px;width: 300px;position: absolute;right: 15%;top: 20%;
-webkit-box-shadow: 1px 0px 15px #696969;border-radius:10px;
background: rgba(255, 255, 255, 0.45) none repeat scroll 0 0 !important;padding: 25px 20px 20px 20px;">
<div style="width: 100%;text-align: center;margin-bottom: 20px;">
<label style="font-size: 28px;">欢迎登录</label>
</div>
<hr/>
<div style="width: 100%;padding: 30px 10px 15px 10px;">
<input id="username" type="text" placeholder="请输入账号" style="height: 40px;width: 90%;border: 0px;font-size: 18px;border-radius:5px;padding-left: 10px;"/>
<br/><br/>
<input id="pwd" type="password" placeholder="请输入密码" style="height: 40px;width: 90%;border: 0px;font-size: 18px;border-radius:5px;padding-left: 10px;"/>
<br/><br/>
<input type="checkbox" style="height: 17px;width: 17px;vertical-align:middle;"/><label style="">记住密码</label>
<br/><br/>
<div onclick="login()" style="width: 93%;height:40px; border-radius:5px;background-color: #9400D3;text-align: center;padding-top: 5px;margin-bottom: 20px;">
<label style="font-size: 25px;color: white;">登 录</label>
</div>
<a href="#" style="text-decoration:none;">找回密码</a>
<label>丨还没有注册账号?</label>
<a href="#" style="text-decoration:none;" onclick="register()">立即注册</a>
<br/><br/>
<a href="#" onclick="touch()" style="text-decoration:none;margin-right: 20px; color: white;font-size: 15px;">关于我们</a>
<a href="#" style="text-decoration:none;margin-right: 20px;color: white;font-size: 15px;" onclick="join()">加入我们</a>
<a href="#" style="text-decoration:none;color: white;font-size: 15px;" onclick="touch()">联系我们</a>
</div>
</div>
<div id="bottom" style="position: absolute;bottom: 0px;width: 98%;text-align: center;display: none;">
</div>
</body>
5、启动程序
访问登录页,项目搭建完成。