init
38
.gitignore
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
10
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Zeppelin 忽略的文件
|
||||
/ZeppelinRemoteNotebooks/
|
7
.idea/encodings.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
14
.idea/misc.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="18" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
124
.idea/uiDesigner.xml
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
BIN
libs/fastjson-1.2.79.jar
Normal file
54
pom.xml
Normal file
@ -0,0 +1,54 @@
|
||||
<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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.landaiqing</groupId>
|
||||
<artifactId>MessageBook2</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>MessageBook2 Maven Webapp</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.18</version>
|
||||
</dependency>
|
||||
|
||||
<!--EL标签-->
|
||||
<dependency>
|
||||
<groupId>taglibs</groupId>
|
||||
<artifactId>standard</artifactId>
|
||||
<version>1.1.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.web</groupId>
|
||||
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>5.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.12.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>MessageBook2</finalName>
|
||||
</build>
|
||||
</project>
|
77
src/main/java/com/landaiqing/entity/AdminUserEntity.java
Normal file
@ -0,0 +1,77 @@
|
||||
package com.landaiqing.entity;
|
||||
|
||||
public class AdminUserEntity {
|
||||
|
||||
/**
|
||||
*CREATE TABLE `admin-user` (
|
||||
* `adminId` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
* `adminUserName` varchar(25) NOT NULL COMMENT '管理员账号',
|
||||
* `adminPassword` varchar(255) DEFAULT NULL COMMENT '管理员密码',
|
||||
* PRIMARY KEY (`adminId`) USING BTREE
|
||||
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
*/
|
||||
|
||||
|
||||
private Integer adminId;
|
||||
private String adminUserName;
|
||||
private String adminPassword;
|
||||
private Integer isValid;
|
||||
|
||||
|
||||
public AdminUserEntity(String adminUserName, String adminPassword) {
|
||||
this.adminUserName = adminUserName;
|
||||
this.adminPassword = adminPassword;
|
||||
}
|
||||
public AdminUserEntity(){
|
||||
|
||||
}
|
||||
|
||||
public Integer getAdminId() {
|
||||
return adminId;
|
||||
}
|
||||
|
||||
public void setAdminId(Integer adminId) {
|
||||
this.adminId = adminId;
|
||||
}
|
||||
|
||||
public String getAdminUserName() {
|
||||
return adminUserName;
|
||||
}
|
||||
|
||||
public void setAdminUserName(String adminUserName) {
|
||||
this.adminUserName = adminUserName;
|
||||
}
|
||||
|
||||
public String getAdminPassword() {
|
||||
return adminPassword;
|
||||
}
|
||||
|
||||
public void setAdminPassword(String adminPassword) {
|
||||
this.adminPassword = adminPassword;
|
||||
}
|
||||
|
||||
public Integer getIsValid() {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
public void setIsValid(Integer isValid) {
|
||||
this.isValid = isValid;
|
||||
}
|
||||
|
||||
public AdminUserEntity(Integer adminId, String adminUserName, String adminPassword, Integer isValid) {
|
||||
this.adminId = adminId;
|
||||
this.adminUserName = adminUserName;
|
||||
this.adminPassword = adminPassword;
|
||||
this.isValid = isValid;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "AdminUserEntity{" +
|
||||
// "adminId=" + adminId +
|
||||
// ", adminUserName='" + adminUserName + '\'' +
|
||||
// ", adminPassword='" + adminPassword + '\'' +
|
||||
// ", isValid=" + isValid +
|
||||
// '}';
|
||||
// }
|
||||
}
|
124
src/main/java/com/landaiqing/entity/UserEntity.java
Normal file
@ -0,0 +1,124 @@
|
||||
package com.landaiqing.entity;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
public class UserEntity {
|
||||
/**
|
||||
* CREATE TABLE `user` (
|
||||
* `userId` int NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
* `nickname` varchar(50) DEFAULT NULL COMMENT '昵称',
|
||||
* `qq` int DEFAULT NULL COMMENT 'QQ',
|
||||
* `email` varchar(255) DEFAULT NULL COMMENT '邮箱',
|
||||
* `content` longtext COMMENT '留言内容',
|
||||
* `datetime` datetime DEFAULT NULL COMMENT '留言日期',
|
||||
* `replyContent` longtext COMMENT '回复内容',
|
||||
* `replyDateTime` datetime DEFAULT NULL COMMENT '回复时间',
|
||||
* PRIMARY KEY (`userId`) USING BTREE
|
||||
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
* */
|
||||
private Integer userId;
|
||||
private String nickName;
|
||||
private String QQ;
|
||||
|
||||
private String email;
|
||||
|
||||
private String content;
|
||||
|
||||
private Date dateTime;
|
||||
|
||||
private String replyContent;
|
||||
|
||||
private Date replyDateTime;
|
||||
|
||||
public UserEntity(){
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
public String getQQ() {
|
||||
return QQ;
|
||||
}
|
||||
|
||||
public void setQQ(String QQ) {
|
||||
this.QQ = QQ;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Date getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public void setDateTime(Date dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public String getReplyContent() {
|
||||
return replyContent;
|
||||
}
|
||||
|
||||
public void setReplyContent(String replyContent) {
|
||||
this.replyContent = replyContent;
|
||||
}
|
||||
|
||||
public Date getReplyDateTime() {
|
||||
return replyDateTime;
|
||||
}
|
||||
|
||||
public void setReplyDateTime(Date replyDateTime) {
|
||||
this.replyDateTime = replyDateTime;
|
||||
}
|
||||
|
||||
public UserEntity(Integer userId, String nickName, String QQ, String email, String content, Date dateTime, String replyContent, Date replyDateTime) {
|
||||
this.userId = userId;
|
||||
this.nickName = nickName;
|
||||
this.QQ = QQ;
|
||||
this.email = email;
|
||||
this.content = content;
|
||||
this.dateTime = dateTime;
|
||||
this.replyContent = replyContent;
|
||||
this.replyDateTime = replyDateTime;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "UserEntity{" +
|
||||
// "userId=" + userId +
|
||||
// ", nickName='" + nickName + '\'' +
|
||||
// ", QQ='" + QQ + '\'' +
|
||||
// ", email='" + email + '\'' +
|
||||
// ", content='" + content + '\'' +
|
||||
// ", dateTime=" + dateTime +
|
||||
// ", replyContent='" + replyContent + '\'' +
|
||||
// ", replyDateTime=" + replyDateTime +
|
||||
// '}';
|
||||
// }
|
||||
}
|
21
src/main/java/com/landaiqing/mapper/adminMapper.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.landaiqing.mapper;
|
||||
|
||||
import com.landaiqing.entity.AdminUserEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface adminMapper {
|
||||
List<AdminUserEntity> login(@Param("adminUserName") String adminUserName,@Param("adminPassword") String adminPassword);
|
||||
|
||||
List<AdminUserEntity> selectAllAdmin();
|
||||
|
||||
int OpenAdmin(@Param("adminId") Integer adminId);
|
||||
int CloseAdmin(@Param("adminId") Integer adminId);
|
||||
AdminUserEntity getAdminByID(@Param("adminId")Integer adminId);
|
||||
|
||||
int updateAdmin(AdminUserEntity adminUserEntity);
|
||||
|
||||
int insertAdmin(AdminUserEntity adminUserEntity);
|
||||
int deleteAdmin(Integer adminId);
|
||||
}
|
17
src/main/java/com/landaiqing/mapper/userMapper.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.landaiqing.mapper;
|
||||
|
||||
import com.landaiqing.entity.UserEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface userMapper {
|
||||
ArrayList<UserEntity> list();
|
||||
|
||||
int insert(UserEntity userEntity);
|
||||
|
||||
int reply(UserEntity userEntity);
|
||||
|
||||
int deleteUser(Integer userId);
|
||||
|
||||
int update(UserEntity userEntity);
|
||||
}
|
69
src/main/java/com/landaiqing/service/AdminUserService.java
Normal file
@ -0,0 +1,69 @@
|
||||
package com.landaiqing.service;
|
||||
|
||||
import com.landaiqing.entity.AdminUserEntity;
|
||||
import com.landaiqing.mapper.adminMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.io.Resources;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
public class AdminUserService {
|
||||
private adminMapper adminMapper;
|
||||
private SqlSession sqlSession;
|
||||
public AdminUserService()throws IOException {
|
||||
// 通过无参构造方法 初始化mybatis 得到flightMapper
|
||||
// mybatis-config.xml 目录位置
|
||||
String resource = "mybatis-config.xml";
|
||||
// 1.解析mybatis-config.xml 得到数据库相关的配置信息
|
||||
InputStream inputStream = Resources.getResourceAsStream(resource);
|
||||
//2.创建得到一个sqlSessionFactory
|
||||
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
//3.获取到sqlSession
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(true);
|
||||
adminMapper = sqlSession.getMapper(adminMapper.class);
|
||||
// sqlSession.close();
|
||||
}
|
||||
public List<AdminUserEntity> login(String adminUserName,String adminPassword){
|
||||
return adminMapper.login(adminUserName,adminPassword);
|
||||
}
|
||||
public List<AdminUserEntity> selectAllAdmin(){
|
||||
return adminMapper.selectAllAdmin();
|
||||
}
|
||||
|
||||
public int OpenAdmin(Integer adminId){
|
||||
int openAdmin = adminMapper.OpenAdmin(adminId);
|
||||
// sqlSession.commit();
|
||||
return openAdmin;
|
||||
}
|
||||
public int CloseAdmin( Integer adminId){
|
||||
int closeAdmin = adminMapper.CloseAdmin(adminId);
|
||||
// sqlSession.commit();
|
||||
return closeAdmin;
|
||||
}
|
||||
public AdminUserEntity getAdminByID(@Param("adminId")Integer adminId){
|
||||
return adminMapper.getAdminByID(adminId);
|
||||
}
|
||||
public int updateAdmin(AdminUserEntity adminUserEntity){
|
||||
int updateAdmin = adminMapper.updateAdmin(adminUserEntity);
|
||||
// sqlSession.commit();
|
||||
return updateAdmin;
|
||||
}
|
||||
public int insertAdmin(AdminUserEntity adminUserEntity){
|
||||
int insertAdmin = adminMapper.insertAdmin(adminUserEntity);
|
||||
// sqlSession.commit();
|
||||
return insertAdmin;
|
||||
}
|
||||
public int deleteAdmin(Integer adminId){
|
||||
int deleteAdmin = adminMapper.deleteAdmin(adminId);
|
||||
// sqlSession.commit();
|
||||
return deleteAdmin;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
59
src/main/java/com/landaiqing/service/UserService.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.landaiqing.service;
|
||||
|
||||
|
||||
import com.landaiqing.entity.UserEntity;
|
||||
import com.landaiqing.mapper.userMapper;
|
||||
import org.apache.ibatis.io.Resources;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class UserService {
|
||||
private SqlSession sqlSession;
|
||||
private userMapper userMapper;
|
||||
|
||||
public UserService() throws IOException{
|
||||
// 通过无参构造方法 初始化mybatis 得到flightMapper
|
||||
// mybatis-config.xml 目录位置
|
||||
String resource = "mybatis-config.xml";
|
||||
// 1.解析mybatis-config.xml 得到数据库相关的配置信息
|
||||
InputStream inputStream = Resources.getResourceAsStream(resource);
|
||||
//2.创建得到一个sqlSessionFactory
|
||||
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
//3.获取到sqlSession
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(true);
|
||||
userMapper = sqlSession.getMapper(userMapper.class);
|
||||
// sqlSession.close();
|
||||
}
|
||||
public ArrayList<UserEntity> list(){
|
||||
return userMapper.list();
|
||||
}
|
||||
|
||||
public int insert(UserEntity userEntity){
|
||||
int insert = userMapper.insert(userEntity);
|
||||
// sqlSession.commit();
|
||||
return insert;
|
||||
}
|
||||
public int reply(UserEntity userEntity){
|
||||
int reply = userMapper.reply(userEntity);
|
||||
// sqlSession.commit();
|
||||
return reply;
|
||||
}
|
||||
public int deleteUser(Integer userId){
|
||||
int deleteUser = userMapper.deleteUser(userId);
|
||||
// sqlSession.commit();
|
||||
return deleteUser;
|
||||
}
|
||||
public int update(UserEntity userEntity){
|
||||
int update = userMapper.update(userEntity);
|
||||
// sqlSession.commit();
|
||||
return update;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
89
src/main/java/com/landaiqing/servlet/AdminLoginServlet.java
Normal file
@ -0,0 +1,89 @@
|
||||
package com.landaiqing.servlet;
|
||||
|
||||
|
||||
|
||||
import com.landaiqing.entity.AdminUserEntity;
|
||||
import com.landaiqing.service.AdminUserService;
|
||||
import com.landaiqing.utils.RandomValidateCode;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理员登录
|
||||
*/
|
||||
@WebServlet("/login")
|
||||
public class AdminLoginServlet extends HttpServlet {
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
{
|
||||
try {
|
||||
adminUserService = new AdminUserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
// 转发login页面
|
||||
req.getRequestDispatcher("login.jsp").forward(req, resp);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
// 点击登录的时候 获取到用户的参数
|
||||
String userName = req.getParameter("username");
|
||||
if (StringUtils.isEmpty(userName)) {
|
||||
//转发到错误页面
|
||||
req.setAttribute("errorMsg", "用户名称不能够是为空!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req, resp);
|
||||
return;
|
||||
}
|
||||
String userPwd = req.getParameter("password");
|
||||
// 参数验证
|
||||
if (StringUtils.isEmpty(userPwd)) {
|
||||
//转发到错误页面
|
||||
req.setAttribute("errorMsg", "userPwd不能够是为空!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req, resp);
|
||||
return;
|
||||
}
|
||||
String userCode = req.getParameter("code"); // 用户输入的图形验证码
|
||||
// 从session中获取图形验证码
|
||||
HttpSession session = req.getSession();
|
||||
String sessionCode = (String) session.getAttribute(RandomValidateCode.RANDOMVALIDATECODE);
|
||||
if (!sessionCode.equalsIgnoreCase(userCode)) {
|
||||
req.setAttribute("errorMsg", "图形验证码不正确,请重新输入!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req, resp);
|
||||
return;
|
||||
}
|
||||
// 在调用业务逻辑层
|
||||
List<AdminUserEntity> adminUserEntity = adminUserService.login(userName, userPwd);
|
||||
if (adminUserEntity == null) {
|
||||
// 用户名称或者密码错误!
|
||||
req.setAttribute("errorMsg", "用户名称或者是密码错误!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req, resp);
|
||||
return;
|
||||
}
|
||||
// 判断用户是否记住密码
|
||||
String rememberPassword = req.getParameter("remember");
|
||||
if ("on".equals(rememberPassword)) {
|
||||
// 如果有记住密码则 将密码保存在cookie中
|
||||
Cookie userNameCookie = new Cookie("userName", userName);
|
||||
Cookie userPwdCookie = new Cookie("userPwd", userPwd);
|
||||
resp.addCookie(userNameCookie);
|
||||
resp.addCookie(userPwdCookie);
|
||||
}
|
||||
// 能够db中查询到对象 登录成功了 将用户数据存放在session中
|
||||
session = req.getSession();
|
||||
session.setAttribute("user", adminUserEntity);
|
||||
// 在转发到首页(重定向到首页)
|
||||
// req.getRequestDispatcher("index.jsp").forward(req, resp);
|
||||
resp.sendRedirect("./System/index.jsp");
|
||||
}
|
||||
}
|
||||
|
37
src/main/java/com/landaiqing/servlet/ListServlet.java
Normal file
@ -0,0 +1,37 @@
|
||||
package com.landaiqing.servlet;
|
||||
|
||||
import com.landaiqing.entity.UserEntity;
|
||||
import com.landaiqing.service.UserService;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@WebServlet("")
|
||||
public class ListServlet extends HttpServlet {
|
||||
private UserService userService;
|
||||
|
||||
{
|
||||
try {
|
||||
userService = new UserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
doPost(req,resp);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
List<UserEntity> userEntities=userService.list();
|
||||
req.setAttribute("list",userEntities);
|
||||
req.getRequestDispatcher("index.jsp").forward(req,resp);
|
||||
}
|
||||
}
|
83
src/main/java/com/landaiqing/servlet/PublishServlet.java
Normal file
@ -0,0 +1,83 @@
|
||||
package com.landaiqing.servlet;
|
||||
|
||||
import com.landaiqing.entity.UserEntity;
|
||||
import com.landaiqing.service.UserService;
|
||||
import com.mysql.cj.util.StringUtils;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
@WebServlet("/publish")
|
||||
public class PublishServlet extends HttpServlet {
|
||||
private UserService userService;
|
||||
|
||||
{
|
||||
try {
|
||||
userService = new UserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
doGet(req,resp);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
try {
|
||||
|
||||
String name = req.getParameter("name");
|
||||
if (StringUtils.isNullOrEmpty(name)){
|
||||
req.setAttribute("errorMsg","name 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String qq = req.getParameter("qq");
|
||||
if (StringUtils.isNullOrEmpty(qq)){
|
||||
req.setAttribute("errorMsg","qq 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String email = req.getParameter("email");
|
||||
if (StringUtils.isNullOrEmpty(email)){
|
||||
req.setAttribute("errorMsg","arriveAirport 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String content = req.getParameter("content");
|
||||
if (StringUtils.isNullOrEmpty(content)){
|
||||
req.setAttribute("errorMsg","content 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
Date time = new java.sql.Date(new Date().getTime());
|
||||
|
||||
UserEntity userEntity=new UserEntity();
|
||||
userEntity.setNickName(name);
|
||||
userEntity.setQQ(qq);
|
||||
userEntity.setEmail(email);
|
||||
userEntity.setContent(content);
|
||||
userEntity.setDateTime((java.sql.Date) time);
|
||||
|
||||
int result = userService.insert(userEntity);
|
||||
if (result<=0){
|
||||
req.setAttribute("errorMsg","插入失败!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
userService.list();
|
||||
resp.sendRedirect("index.jsp");
|
||||
} catch (Exception e) {
|
||||
req.setAttribute("errorMsg","系统异常!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
63
src/main/java/com/landaiqing/servlet/ReplyServlet.java
Normal file
@ -0,0 +1,63 @@
|
||||
package com.landaiqing.servlet;
|
||||
|
||||
import com.landaiqing.entity.UserEntity;
|
||||
import com.landaiqing.service.UserService;
|
||||
import com.mysql.cj.util.StringUtils;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
@WebServlet("/reply")
|
||||
public class ReplyServlet extends HttpServlet {
|
||||
private UserService userService;
|
||||
|
||||
{
|
||||
try {
|
||||
userService = new UserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
try {
|
||||
String userId = req.getParameter("userId");
|
||||
if (StringUtils.isNullOrEmpty(userId)){
|
||||
req.setAttribute("errorMsg","userId 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String replyContent = req.getParameter("replyContent");
|
||||
if (StringUtils.isNullOrEmpty(replyContent)){
|
||||
req.setAttribute("errorMsg","content 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
Date time = new java.sql.Date(new Date().getTime());
|
||||
|
||||
UserEntity userEntity=new UserEntity();
|
||||
userEntity.setUserId(Integer.valueOf(userId));
|
||||
userEntity.setReplyContent(replyContent);
|
||||
userEntity.setReplyDateTime((java.sql.Date) time);
|
||||
|
||||
int result = userService.reply(userEntity);
|
||||
if (result<=0){
|
||||
req.setAttribute("errorMsg","插入失败!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
|
||||
resp.sendRedirect("index.jsp");
|
||||
} catch (Exception e) {
|
||||
req.setAttribute("errorMsg","系统异常!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
39
src/main/java/com/landaiqing/servlet/VerifycodeServlet.java
Normal file
@ -0,0 +1,39 @@
|
||||
package com.landaiqing.servlet;
|
||||
|
||||
import com.landaiqing.utils.RandomValidateCode;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 前台验证码处点击刷新,发送到该servlet的请求,
|
||||
* 该servlet调用生成验证码的工具类返回一个图像验证码
|
||||
*/
|
||||
@WebServlet(name = "VerifycodeServlet", urlPatterns = "/VerifycodeServlet")
|
||||
public class VerifycodeServlet extends HttpServlet {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
response.setContentType("image/jpeg");//设置相应类型,告诉浏览器输出的内容为图片
|
||||
response.setHeader("Pragma", "No-cache");//设置响应头信息,告诉浏览器不要缓存此内容
|
||||
//做浏览器兼容
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expire", 0);
|
||||
RandomValidateCode randomValidateCode = new RandomValidateCode();
|
||||
try {
|
||||
randomValidateCode.getRandcode(request, response);//输出图片方法
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
doGet(request, response);
|
||||
}
|
||||
}
|
68
src/main/java/com/landaiqing/servlet/system/AddAdmin.java
Normal file
@ -0,0 +1,68 @@
|
||||
package com.landaiqing.servlet.system;
|
||||
|
||||
import com.landaiqing.entity.AdminUserEntity;
|
||||
import com.landaiqing.service.AdminUserService;
|
||||
import com.mysql.cj.util.StringUtils;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@WebServlet("/addAdmin")
|
||||
public class AddAdmin extends HttpServlet {
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
{
|
||||
try {
|
||||
adminUserService = new AdminUserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
try {
|
||||
|
||||
String adminUseName = req.getParameter("adminUserName");
|
||||
if (StringUtils.isNullOrEmpty(adminUseName)){
|
||||
req.setAttribute("errorMsg","adminUseName 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String adminPassword = req.getParameter("adminPassword");
|
||||
if (StringUtils.isNullOrEmpty(adminPassword)){
|
||||
req.setAttribute("errorMsg","adminPassword 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String isValid = req.getParameter("isValid");
|
||||
if (StringUtils.isNullOrEmpty(isValid)){
|
||||
req.setAttribute("errorMsg","isValid 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
AdminUserEntity adminUserEntity=new AdminUserEntity();
|
||||
adminUserEntity.setAdminUserName(adminUseName);
|
||||
adminUserEntity.setAdminPassword(adminPassword);
|
||||
adminUserEntity.setIsValid(Integer.valueOf(isValid));
|
||||
|
||||
int result = adminUserService.insertAdmin(adminUserEntity);
|
||||
if (result<=0){
|
||||
req.setAttribute("errorMsg","插入失败!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
resp.sendRedirect("./System/index.jsp");
|
||||
} catch (Exception e) {
|
||||
req.setAttribute("errorMsg","系统异常!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
45
src/main/java/com/landaiqing/servlet/system/AllAdmin.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.landaiqing.servlet.system;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.landaiqing.entity.AdminUserEntity;
|
||||
import com.landaiqing.service.AdminUserService;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
|
||||
@WebServlet("/adminList")
|
||||
public class AllAdmin extends HttpServlet {
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
{
|
||||
try {
|
||||
adminUserService = new AdminUserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
doPost(req,resp);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
List<AdminUserEntity> adminUserEntityList=adminUserService.selectAllAdmin();
|
||||
PrintWriter writer=resp.getWriter();
|
||||
String jsonString = JSONObject.toJSONString(adminUserEntityList);
|
||||
System.out.println(jsonString);
|
||||
writer.println(jsonString);
|
||||
writer.close();
|
||||
// req.setAttribute("allAdmin",adminUserEntityList);
|
||||
// req.getRequestDispatcher("./System/index.jsp").forward(req,resp);
|
||||
|
||||
}
|
||||
}
|
51
src/main/java/com/landaiqing/servlet/system/CloseAdmin.java
Normal file
@ -0,0 +1,51 @@
|
||||
package com.landaiqing.servlet.system;
|
||||
|
||||
import com.landaiqing.service.AdminUserService;
|
||||
import com.mysql.cj.util.StringUtils;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
@WebServlet("/closeAdmin")
|
||||
public class CloseAdmin extends HttpServlet {
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
{
|
||||
try {
|
||||
adminUserService = new AdminUserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
try {
|
||||
String idStr = req.getParameter("id");
|
||||
if (StringUtils.isNullOrEmpty(idStr)){
|
||||
req.setAttribute("errorMsg","id的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
int result = adminUserService.CloseAdmin(Integer.valueOf(idStr));
|
||||
if (result<=0){
|
||||
req.setAttribute("errorMsg","修改失败!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
PrintWriter writer=resp.getWriter();
|
||||
writer.println("修改成功!");
|
||||
writer.close();
|
||||
resp.sendRedirect("");
|
||||
} catch (Exception e) {
|
||||
req.setAttribute("errorMsg","系统异常!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
53
src/main/java/com/landaiqing/servlet/system/DeleteAdmin.java
Normal file
@ -0,0 +1,53 @@
|
||||
package com.landaiqing.servlet.system;
|
||||
|
||||
import com.landaiqing.service.AdminUserService;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@WebServlet("/deleteAdmin")
|
||||
public class DeleteAdmin extends HttpServlet {
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
{
|
||||
try {
|
||||
adminUserService = new AdminUserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
String idStr = req.getParameter("id");
|
||||
if (idStr==null || idStr==""){
|
||||
req.setAttribute("errorMsg","ID的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Integer id = Integer.parseInt(idStr);
|
||||
int result = adminUserService.deleteAdmin(id);
|
||||
if (result > 0) {
|
||||
// req.getRequestDispatcher("showFlight.jsp").forward(req,resp);
|
||||
resp.sendRedirect("./System/index.jsp");
|
||||
|
||||
}else {
|
||||
req.setAttribute("errorMsg","删除失败!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
req.setAttribute("errorMsg","类型转换异常,id 不能转换成Int类型!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
e.printStackTrace();
|
||||
}catch (Exception e){
|
||||
req.setAttribute("errorMsg","系统异常!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
}
|
||||
}
|
||||
}
|
53
src/main/java/com/landaiqing/servlet/system/DeleteUser.java
Normal file
@ -0,0 +1,53 @@
|
||||
package com.landaiqing.servlet.system;
|
||||
|
||||
import com.landaiqing.service.UserService;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@WebServlet("/deleteUser")
|
||||
public class DeleteUser extends HttpServlet {
|
||||
private UserService userService;
|
||||
|
||||
{
|
||||
try {
|
||||
userService = new UserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
String idStr = req.getParameter("id");
|
||||
if (idStr==null || idStr==""){
|
||||
req.setAttribute("errorMsg","ID的值不能为空!!!");
|
||||
req.getRequestDispatcher("./error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Integer id = Integer.parseInt(idStr);
|
||||
int result = userService.deleteUser(id);
|
||||
if (result > 0) {
|
||||
// req.getRequestDispatcher("showFlight.jsp").forward(req,resp);
|
||||
resp.sendRedirect("./System/index.jsp");
|
||||
|
||||
}else {
|
||||
req.setAttribute("errorMsg","删除失败!!!");
|
||||
req.getRequestDispatcher("./error.jsp").forward(req,resp);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
req.setAttribute("errorMsg","类型转换异常,id 不能转换成Int类型!!!");
|
||||
req.getRequestDispatcher("./error.jsp").forward(req,resp);
|
||||
e.printStackTrace();
|
||||
}catch (Exception e){
|
||||
req.setAttribute("errorMsg","系统异常!!!");
|
||||
req.getRequestDispatcher("./error.jsp").forward(req,resp);
|
||||
}
|
||||
}
|
||||
}
|
100
src/main/java/com/landaiqing/servlet/system/GetAdminByID.java
Normal file
@ -0,0 +1,100 @@
|
||||
package com.landaiqing.servlet.system;
|
||||
|
||||
import com.landaiqing.entity.AdminUserEntity;
|
||||
import com.landaiqing.service.AdminUserService;
|
||||
import com.mysql.cj.util.StringUtils;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@WebServlet("/updateAdmin")
|
||||
public class GetAdminByID extends HttpServlet {
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
{
|
||||
try {
|
||||
adminUserService = new AdminUserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
String idStr = req.getParameter("id");
|
||||
if (idStr==null || idStr==""){
|
||||
req.setAttribute("errorMsg","ID的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Integer id = Integer.parseInt(idStr);
|
||||
AdminUserEntity adminUserEntity = adminUserService.getAdminByID(id);
|
||||
if (adminUserEntity==null){
|
||||
req.setAttribute("errorMsg","id不存在!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
req.setAttribute("adminByID",adminUserEntity);
|
||||
req.getRequestDispatcher("./System/adminManage.jsp").forward(req,resp);
|
||||
}catch (Exception e){
|
||||
req.setAttribute("errorMsg","系统异常!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
try {
|
||||
String idStr = req.getParameter("id");
|
||||
if (StringUtils.isNullOrEmpty(idStr)){
|
||||
req.setAttribute("errorMsg","id的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
Integer id = Integer.parseInt(idStr);
|
||||
|
||||
String adminUserName = req.getParameter("adminUserName");
|
||||
if (StringUtils.isNullOrEmpty(adminUserName)){
|
||||
req.setAttribute("errorMsg","adminUserName 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String adminPassword = req.getParameter("adminPassword");
|
||||
if (StringUtils.isNullOrEmpty(adminPassword)){
|
||||
req.setAttribute("errorMsg","adminPassword 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String isValid = req.getParameter("isValid");
|
||||
if (StringUtils.isNullOrEmpty(idStr)){
|
||||
req.setAttribute("errorMsg","isValid 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
AdminUserEntity adminUserEntity=new AdminUserEntity();
|
||||
adminUserEntity.setAdminId(id);
|
||||
adminUserEntity.setAdminUserName(adminUserName);
|
||||
adminUserEntity.setAdminPassword(adminPassword);
|
||||
adminUserEntity.setIsValid(Integer.valueOf(isValid));
|
||||
|
||||
int result = adminUserService.updateAdmin(adminUserEntity);
|
||||
if (result<=0){
|
||||
req.setAttribute("errorMsg","修改失败!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
resp.sendRedirect("./System/adminManage.jsp");
|
||||
} catch (Exception e) {
|
||||
req.setAttribute("errorMsg","系统异常!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
45
src/main/java/com/landaiqing/servlet/system/ListManage.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.landaiqing.servlet.system;
|
||||
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.landaiqing.entity.UserEntity;
|
||||
import com.landaiqing.service.UserService;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
|
||||
@WebServlet("/listManage")
|
||||
public class ListManage extends HttpServlet {
|
||||
private UserService userService;
|
||||
|
||||
{
|
||||
try {
|
||||
userService = new UserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
doPost(req,resp);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
PrintWriter writer = resp.getWriter();
|
||||
List<UserEntity> userEntities=userService.list();
|
||||
String jsonString = JSONObject.toJSONString(userEntities);
|
||||
writer.println(jsonString);
|
||||
writer.close();
|
||||
// req.setAttribute("listManage",jsonString);
|
||||
// req.getRequestDispatcher("./System/index.jsp").forward(req,resp);
|
||||
}
|
||||
}
|
51
src/main/java/com/landaiqing/servlet/system/OpenAdmin.java
Normal file
@ -0,0 +1,51 @@
|
||||
package com.landaiqing.servlet.system;
|
||||
|
||||
import com.landaiqing.service.AdminUserService;
|
||||
import com.mysql.cj.util.StringUtils;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
@WebServlet("/openAdmin")
|
||||
public class OpenAdmin extends HttpServlet {
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
{
|
||||
try {
|
||||
adminUserService = new AdminUserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
try {
|
||||
String idStr = req.getParameter("id");
|
||||
if (StringUtils.isNullOrEmpty(idStr)){
|
||||
req.setAttribute("errorMsg","id的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
int result = adminUserService.OpenAdmin(Integer.valueOf(idStr));
|
||||
if (result<=0){
|
||||
req.setAttribute("errorMsg","修改失败!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
PrintWriter writer=resp.getWriter();
|
||||
writer.println("修改成功!");
|
||||
writer.close();
|
||||
resp.sendRedirect("");
|
||||
} catch (Exception e) {
|
||||
req.setAttribute("errorMsg","系统异常!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
107
src/main/java/com/landaiqing/servlet/system/UpdateServlet.java
Normal file
@ -0,0 +1,107 @@
|
||||
package com.landaiqing.servlet.system;
|
||||
|
||||
import com.landaiqing.entity.UserEntity;
|
||||
import com.landaiqing.service.UserService;
|
||||
import com.mysql.cj.util.StringUtils;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.annotation.WebServlet;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Date;
|
||||
|
||||
@WebServlet("/update")
|
||||
public class UpdateServlet extends HttpServlet {
|
||||
private UserService userService;
|
||||
|
||||
{
|
||||
try {
|
||||
userService = new UserService();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||
try {
|
||||
String idStr = req.getParameter("id");
|
||||
if (StringUtils.isNullOrEmpty(idStr)){
|
||||
req.setAttribute("errorMsg","id的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
Integer id = Integer.parseInt(idStr);
|
||||
|
||||
String nickName = req.getParameter("nickName");
|
||||
if (StringUtils.isNullOrEmpty(nickName)){
|
||||
req.setAttribute("errorMsg","nickName 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String qq = req.getParameter("qq");
|
||||
if (StringUtils.isNullOrEmpty(qq)){
|
||||
req.setAttribute("errorMsg","qq 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String email = req.getParameter("email");
|
||||
if (StringUtils.isNullOrEmpty(idStr)){
|
||||
req.setAttribute("errorMsg","email 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
|
||||
String content = req.getParameter("content");
|
||||
if (StringUtils.isNullOrEmpty(idStr)){
|
||||
req.setAttribute("errorMsg","content 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
|
||||
String DateTime = req.getParameter("dateTime");
|
||||
if (StringUtils.isNullOrEmpty(idStr)){
|
||||
req.setAttribute("errorMsg","DateTime 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String replyContent = req.getParameter("replyContent");
|
||||
if (StringUtils.isNullOrEmpty(idStr)){
|
||||
req.setAttribute("errorMsg","replyContent 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
String replyDateTime = req.getParameter("replyDateTime");
|
||||
if (StringUtils.isNullOrEmpty(idStr)){
|
||||
req.setAttribute("errorMsg","replyDateTime 的值不能为空!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
UserEntity userEntity=new UserEntity();
|
||||
userEntity.setUserId(id);
|
||||
userEntity.setNickName(nickName);
|
||||
userEntity.setQQ(qq);
|
||||
userEntity.setEmail(email);
|
||||
userEntity.setContent(content);
|
||||
userEntity.setDateTime(Date.valueOf(DateTime));
|
||||
userEntity.setReplyContent(replyContent);
|
||||
userEntity.setReplyDateTime(Date.valueOf(replyDateTime));
|
||||
|
||||
int result = userService.update(userEntity);
|
||||
if (result<=0){
|
||||
req.setAttribute("errorMsg","修改失败!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
return;
|
||||
}
|
||||
resp.sendRedirect("./System/messageManage.jsp");
|
||||
} catch (Exception e) {
|
||||
req.setAttribute("errorMsg","系统异常!!!");
|
||||
req.getRequestDispatcher("error.jsp").forward(req,resp);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
34
src/main/java/com/landaiqing/test/Test01.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.landaiqing.test;
|
||||
|
||||
import com.landaiqing.entity.AdminUserEntity;
|
||||
import com.landaiqing.mapper.adminMapper;
|
||||
import org.apache.ibatis.io.Resources;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class Test01 {
|
||||
public static void main(String[] args) throws IOException {
|
||||
String resource = "mybatis-config.xml";
|
||||
InputStream inputStream = Resources.getResourceAsStream(resource);
|
||||
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
// 2.获取到获取到
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession();
|
||||
// 3.根据 mapper id=getByUsers 执行该s ql 语句 通过 sql语句得到我们的对象 orm
|
||||
// List<UserEntity> userEntitys = sqlSession.selectList("getByUsers", UserEntity.class);
|
||||
adminMapper mapper = sqlSession.getMapper(adminMapper.class);
|
||||
// System.out.println(mapper.login("666","666"));
|
||||
// AdminUserEntity adminUserEntity = new AdminUserEntity();
|
||||
// adminUserEntity.setAdminId(1);
|
||||
// adminUserEntity.setAdminUserName("777");
|
||||
// adminUserEntity.setAdminPassword("777");
|
||||
// adminUserEntity.setIsValid(1);
|
||||
System.out.println(mapper.deleteAdmin(4));
|
||||
sqlSession.commit();
|
||||
// System.out.println(userEntitys);
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
41
src/main/java/com/landaiqing/test/Test02.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.landaiqing.test;
|
||||
|
||||
import com.landaiqing.entity.UserEntity;
|
||||
import com.landaiqing.mapper.adminMapper;
|
||||
import com.landaiqing.mapper.userMapper;
|
||||
import org.apache.ibatis.io.Resources;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.Date;
|
||||
|
||||
public class Test02 {
|
||||
public static void main(String[] args) throws IOException {
|
||||
String resource = "mybatis-config.xml";
|
||||
InputStream inputStream = Resources.getResourceAsStream(resource);
|
||||
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
// 2.获取到获取到
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession();
|
||||
// 3.根据 mapper id=getByUsers 执行该s ql 语句 通过 sql语句得到我们的对象 orm
|
||||
// List<UserEntity> userEntitys = sqlSession.selectList("getByUsers", UserEntity.class);
|
||||
userMapper mapper = sqlSession.getMapper(userMapper.class);
|
||||
// System.out.println(mapper.login("666","666"));
|
||||
UserEntity userEntity = new UserEntity();
|
||||
userEntity.setQQ("888888");
|
||||
userEntity.setNickName("888");
|
||||
userEntity.setContent("8888");
|
||||
userEntity.setEmail("88888");
|
||||
userEntity.setUserId(10);
|
||||
userEntity.setReplyContent("000000000");
|
||||
Date time= new java.sql.Date(new java.util.Date().getTime());
|
||||
userEntity.setReplyDateTime(time);
|
||||
userEntity.setDateTime(time);
|
||||
System.out.println(mapper.update(userEntity));
|
||||
sqlSession.commit();
|
||||
// System.out.println(userEntitys);
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
132
src/main/java/com/landaiqing/utils/JdbcUtils.java
Normal file
@ -0,0 +1,132 @@
|
||||
package com.landaiqing.utils;
|
||||
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.sql.*;
|
||||
import java.util.Properties;
|
||||
|
||||
public class JdbcUtils {
|
||||
|
||||
private JdbcUtils() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.定义工具类 需要 声明 变量
|
||||
*/
|
||||
private static String driverClass;
|
||||
private static String url;
|
||||
private static String user;
|
||||
private static String password;
|
||||
|
||||
/**
|
||||
*3.使用静态代码快 来给我们声明好 jdbc变量赋值(读取config.properties)
|
||||
*/
|
||||
static {
|
||||
try {
|
||||
// 1.读取config.properties IO 路径 相对路径
|
||||
InputStream resourceAsStream = JdbcUtils.class.getClassLoader().
|
||||
getResourceAsStream("config.properties");
|
||||
// 2.赋值给我们声明好的变量
|
||||
Properties properties = new Properties();
|
||||
properties.load(resourceAsStream);
|
||||
driverClass = properties.getProperty("driverClass");
|
||||
url = properties.getProperty("url");
|
||||
user = properties.getProperty("user");
|
||||
password = properties.getProperty("password");
|
||||
// 3.注册驱动类
|
||||
Class.forName(driverClass);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.封装连接方法
|
||||
*/
|
||||
public static Connection getConnection() throws SQLException {
|
||||
Connection connection = DriverManager.getConnection(url, user, password);
|
||||
return connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* 5.封装释放连接方法 (重载)
|
||||
*/
|
||||
public static void closeConnection(ResultSet resultSet, Statement statement, Connection connection) {
|
||||
// 1.查询 释放连接 resultSet statement connection
|
||||
try {
|
||||
if (resultSet != null)
|
||||
resultSet.close();
|
||||
if (statement != null)
|
||||
statement.close();
|
||||
if (connection != null)
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 增删改---释放jdbc资源
|
||||
*
|
||||
* @param statement
|
||||
* @param connection
|
||||
*/
|
||||
public static void closeConnection(Statement statement, Connection connection) {
|
||||
// 1.查询 释放连接 resultSet statement connection
|
||||
closeConnection(null, statement, connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启事务
|
||||
*
|
||||
* @param connection
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static void beginTransaction(Connection connection) throws SQLException {
|
||||
connection.setAutoCommit(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交事务
|
||||
*
|
||||
* @param connection
|
||||
* @throws SQLException
|
||||
*/
|
||||
public static void commitTransaction(Connection connection) throws SQLException {
|
||||
connection.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 回滚事务
|
||||
*
|
||||
* @param connection
|
||||
*/
|
||||
public static void rollBackTransaction(Connection connection) {
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.rollback();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭事务
|
||||
*
|
||||
* @param connection
|
||||
*/
|
||||
public static void endTransaction(Connection connection) {
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.setAutoCommit(true);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
105
src/main/java/com/landaiqing/utils/RandomValidateCode.java
Normal file
@ -0,0 +1,105 @@
|
||||
package com.landaiqing.utils;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 工具类,生成随机验证码
|
||||
*/
|
||||
public class RandomValidateCode {
|
||||
public static final String RANDOMVALIDATECODE = "RandomValidateCode";// 放到session中的key
|
||||
private Random random = new Random();
|
||||
private String randString = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";//随机产生的字符串
|
||||
private int width = 100;// 图片宽度
|
||||
private int height = 26;// 图片高度
|
||||
private int lineSize = 40;// 干扰线数量
|
||||
private int stringNum = 4;// 随机产生的字符数量
|
||||
|
||||
/**
|
||||
* 获得字体
|
||||
*/
|
||||
private Font getFont() {
|
||||
return new Font("Fixedsys", Font.CENTER_BASELINE, 18);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得颜色
|
||||
*/
|
||||
private Color getRandColor(int fc, int bc) {
|
||||
if (fc > 255)
|
||||
fc = 255;
|
||||
if (bc > 255)
|
||||
bc = 255;
|
||||
int r = fc + random.nextInt(bc - fc - 16);
|
||||
int g = fc + random.nextInt(bc - fc - 14);
|
||||
int b = fc + random.nextInt(bc - fc - 18);
|
||||
return new Color(r, g, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成随机图片
|
||||
*/
|
||||
public void getRandcode(HttpServletRequest request, HttpServletResponse response) {
|
||||
HttpSession session = request.getSession();
|
||||
// BufferedImage类是具有缓冲区的Image类,Image类是用于描述图像信息的类
|
||||
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
|
||||
Graphics g = image.getGraphics();// 产生Image对象的Graphics对象,该对象可以在图像上进行各种绘制操作
|
||||
g.fillRect(0, 0, width, height);
|
||||
g.setFont(new Font("Times New Roman", Font.ROMAN_BASELINE, 18));
|
||||
g.setColor(getRandColor(110, 133));
|
||||
// 绘制干扰线
|
||||
for (int i = 0; i <= lineSize; i++) {
|
||||
drowLine(g);
|
||||
}
|
||||
// 绘制随机字符
|
||||
String randomString = "";
|
||||
for (int i = 1; i <= stringNum; i++) {
|
||||
randomString = drowString(g, randomString, i);
|
||||
}
|
||||
session.removeAttribute(RANDOMVALIDATECODE);
|
||||
session.setAttribute(RANDOMVALIDATECODE, randomString);
|
||||
g.dispose();
|
||||
try {
|
||||
ImageIO.write(image, "JPEG", response.getOutputStream());// 将内存中的图片通过流动形式输出到客户端
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制字符串
|
||||
*/
|
||||
private String drowString(Graphics g, String randomString, int i) {
|
||||
g.setFont(getFont());
|
||||
g.setColor(new Color(random.nextInt(101), random.nextInt(111), random.nextInt(121)));
|
||||
String rand = getRandomString(random.nextInt(randString.length()));
|
||||
randomString += rand;
|
||||
g.translate(random.nextInt(3), random.nextInt(3));
|
||||
g.drawString(rand, 13 * i, 16);
|
||||
return randomString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制干扰线
|
||||
*/
|
||||
private void drowLine(Graphics g) {
|
||||
int x = random.nextInt(width);
|
||||
int y = random.nextInt(height);
|
||||
int xl = random.nextInt(13);
|
||||
int yl = random.nextInt(15);
|
||||
g.drawLine(x, y, x + xl, y + yl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取随机的字符
|
||||
*/
|
||||
public String getRandomString(int num) {
|
||||
return String.valueOf(randString.charAt(num));
|
||||
}
|
||||
}
|
4
src/main/resources/config.properties
Normal file
@ -0,0 +1,4 @@
|
||||
driverClass=com.mysql.cj.jdbc.Driver
|
||||
url=jdbc:mysql://127.0.0.1:3306/webguestbook?serverTimezone=GMT%2B8&useAffectedRows=true
|
||||
user=root
|
||||
password=1611
|
37
src/main/resources/mapper/adminMapper.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?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.landaiqing.mapper.adminMapper">
|
||||
<resultMap id="adminMap" type="com.landaiqing.entity.AdminUserEntity">
|
||||
<!-- 数据库中字段名称 column="" property="id" 类中成员属性名称-->
|
||||
<id column="adminId" property="adminId"></id>
|
||||
<result column="adminUserName" property="adminUserName"></result>
|
||||
<result column="adminPassword" property="adminPassword"></result>
|
||||
<result column="is_valid" property="isValid"></result>
|
||||
</resultMap>
|
||||
<insert id="insertAdmin" parameterType="com.landaiqing.entity.AdminUserEntity">
|
||||
INSERT INTO `admin` (`adminId`, `adminUserName`, `adminPassword`, `is_valid`) VALUES (null, #{adminUserName}, #{adminPassword}, #{isValid});
|
||||
</insert>
|
||||
<update id="OpenAdmin" parameterType="int">
|
||||
UPDATE `admin` SET `is_valid` = 1 WHERE `adminId` = #{adminId};
|
||||
</update>
|
||||
<update id="CloseAdmin" parameterType="int">
|
||||
UPDATE `admin` SET `is_valid` = 0 WHERE `adminId` = #{adminId};
|
||||
</update>
|
||||
<update id="updateAdmin" parameterType="com.landaiqing.entity.AdminUserEntity">
|
||||
UPDATE `admin` SET `adminUserName` = #{adminUserName}, `adminPassword` = #{adminPassword},`is_valid`=#{isValid} WHERE `adminId` = #{adminId};
|
||||
</update>
|
||||
<delete id="deleteAdmin" parameterType="int">
|
||||
DELETE from `admin` WHERE `adminId` = #{adminId};
|
||||
</delete>
|
||||
<select id="login" parameterType="com.landaiqing.entity.AdminUserEntity" resultMap="adminMap">
|
||||
select * from admin where adminUserName=#{adminUserName} and adminPassword=#{adminPassword} and is_valid='1';
|
||||
</select>
|
||||
<select id="selectAllAdmin" resultMap="adminMap">
|
||||
select * from admin;
|
||||
</select>
|
||||
<select id="getAdminByID" resultType="com.landaiqing.entity.AdminUserEntity">
|
||||
select * from admin where adminId=#{adminId};
|
||||
</select>
|
||||
</mapper>
|
33
src/main/resources/mapper/userMapper.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?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.landaiqing.mapper.userMapper">
|
||||
<resultMap id="userMap" type="com.landaiqing.entity.UserEntity">
|
||||
<!-- 数据库中字段名称 column="" property="id" 类中成员属性名称-->
|
||||
<id column="userId" property="userId"></id>
|
||||
<result column="nickname" property="nickName"></result>
|
||||
<result column="QQ" property="QQ"></result>
|
||||
<result column="email" property="email"></result>
|
||||
<result column="content" property="content"></result>
|
||||
<result column="datetime" property="dateTime"></result>
|
||||
<result column="replyContent" property="replyContent"></result>
|
||||
<result column="replyDateTime" property="replyDateTime"></result>
|
||||
</resultMap>
|
||||
<insert id="insert" parameterType="com.landaiqing.entity.UserEntity">
|
||||
INSERT INTO `webguestbook`.`user` (`userId`, `nickname`, `qq`, `email`, `content`, `datetime`, `replyContent`, `replyDateTime`) VALUES (null, #{nickName}, #{QQ}, #{email}, #{content} ,#{dateTime},null, null);
|
||||
</insert>
|
||||
<update id="reply" parameterType="com.landaiqing.entity.UserEntity">
|
||||
UPDATE `webguestbook`.`user` SET `replyContent` = #{replyContent}, `replyDateTime` = #{replyDateTime} WHERE `userId` = #{userId};
|
||||
</update>
|
||||
<update id="update" parameterType="com.landaiqing.entity.UserEntity">
|
||||
UPDATE `webguestbook`.`user` SET `nickname` = #{nickName}, `qq` = #{QQ}, `email` = #{email}, `content` = #{content}, `datetime` = #{dateTime}, `replyContent` = #{replyContent}, `replyDateTime` = #{replyDateTime} WHERE `userId` = #{userId};
|
||||
</update>
|
||||
<delete id="deleteUser" parameterType="int">
|
||||
DELETE from `user` WHERE `userId` = #{userId};
|
||||
</delete>
|
||||
<select id="list" resultType="com.landaiqing.entity.UserEntity" resultMap="userMap">
|
||||
select * from user ORDER BY datetime DESC ;
|
||||
</select>
|
||||
|
||||
</mapper>
|
26
src/main/resources/mybatis-config.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<properties resource="config.properties"/>
|
||||
<environments default="development">
|
||||
<environment id="development">
|
||||
<transactionManager type="JDBC"/>
|
||||
<dataSource type="POOLED">
|
||||
<!-- <property name="driver" value="com.mysql.cj.jdbc.Driver"/>-->
|
||||
<!-- <property name="url" value="jdbc:mysql://127.0.0.1:3306/notebook?serverTimezone=GMT%2B8"/>-->
|
||||
<!-- <property name="username" value="root"/>-->
|
||||
<!-- <property name="password" value="1611"/>-->
|
||||
<property name="driver" value="${driverClass}"/>
|
||||
<property name="url" value="${url}"/>
|
||||
<property name="username" value="${user}"/>
|
||||
<property name="password" value="${password}"/>
|
||||
</dataSource>
|
||||
</environment>
|
||||
</environments>
|
||||
<mappers>
|
||||
<mapper resource="mapper/adminMapper.xml"/>
|
||||
<mapper resource="mapper/userMapper.xml"/>
|
||||
</mappers>
|
||||
</configuration>
|
347
src/main/webapp/System/adminManage.jsp
Normal file
@ -0,0 +1,347 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: LDQ
|
||||
Date: 2023/6/9
|
||||
Time: 16:57
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<!-- 引入 layui.css -->
|
||||
<link href="//unpkg.com/layui@2.8.0/dist/css/layui.css" rel="stylesheet">
|
||||
|
||||
<!-- 引入 layui.js -->
|
||||
<script src="//unpkg.com/layui@2.8.0/dist/layui.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="addAdmin">添加管理员</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<table class="layui-hide" id="ID-table-demo-data"></table>
|
||||
|
||||
<script type="text/html" id="ID-table-demo-templet-switch">
|
||||
<!-- 这里的 checked 的状态值判断仅作为演示 -->
|
||||
<input type="checkbox" id="checkbox" name="status" value="{{= d.adminId }}" title="开启|关闭" lay-skin="switch" lay-filter="status" {{= d.isValid == '1' ? "checked" : "" }}>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-clear-space">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="more">
|
||||
更多
|
||||
<i class="layui-icon layui-icon-down"></i>
|
||||
</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||
<script>
|
||||
|
||||
function getDate(){
|
||||
axios({
|
||||
// 请求方式
|
||||
method: 'get',
|
||||
// 请求的地址
|
||||
url: 'http://localhost:8080${pageContext.request.contextPath}/adminList',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
|
||||
}
|
||||
}).then(function (result) {
|
||||
layui.use('table', function(){
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var dropdown = layui.dropdown;
|
||||
// 已知数据渲染
|
||||
var inst = table.render({
|
||||
elem: '#ID-table-demo-data'
|
||||
,toolbar: '#toolbarDemo'
|
||||
,cols: [[ //标题栏
|
||||
{field: 'adminId', title: 'ID', width: 80, sort: true}
|
||||
,{field: 'adminUserName', title: '管理员', width: 180}
|
||||
,{field: 'adminPassword', title: '密码', width: 200}
|
||||
,{field: 'isValid', title: '是否有效', width: 150,templet: function(d){
|
||||
if(d.isValid === 1){
|
||||
return '<span style="color: green" title="有效">●</span>';
|
||||
} else {
|
||||
return '<span style="color: red" title="无效">●</span>';
|
||||
}
|
||||
}},
|
||||
{title: '状态', width:100, templet: '#ID-table-demo-templet-switch'},
|
||||
{fixed: 'right', title:'操作', width: 134, minWidth: 125, toolbar: '#barDemo'}
|
||||
|
||||
]],done:function (){
|
||||
form.on('switch(status)', function (obj) {
|
||||
var id = obj.value;
|
||||
if(this.checked){
|
||||
OpenAdmin(id);
|
||||
|
||||
}else{
|
||||
CloseAdmin(id);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
table.on('toolbar(ID-table-demo-data)', function(obj){
|
||||
var id = obj.config.id;
|
||||
var checkStatus = table.checkStatus(id);
|
||||
var othis = lay(this);
|
||||
switch(obj.event){
|
||||
case 'addAdmin':
|
||||
layer.open({
|
||||
title: '添加管理员',
|
||||
type: 1,
|
||||
area: ['50%','80%'],
|
||||
content: `<div id="warp">
|
||||
<div style="display: flex;flex-direction: column;align-content: center;align-items: center;justify-content: center">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">管理员</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="admin" id="adminUserName" autocomplete="off" class="layui-input" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" id="adminPassword" lay-verify="required" class="layui-input" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">是否有效</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="isValid" placeholder="1 为有效/0为无效" name="open" lay-filter="required" class="layui-input" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn" onclick="addAdmin()">确认</button>
|
||||
<!-- <button type="close" class="layui-btn layui-btn-primary" onclick="close()">关闭</button>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
|
||||
});
|
||||
break;
|
||||
// case 'getData':
|
||||
// var getData = table.getData(id);
|
||||
// console.log(getData);
|
||||
// layer.alert(layui.util.escape(JSON.stringify(getData)));
|
||||
// break;
|
||||
// case 'LAYTABLE_TIPS':
|
||||
// layer.alert('自定义工具栏图标按钮');
|
||||
// break;
|
||||
};
|
||||
});
|
||||
|
||||
// 触发单元格工具事件
|
||||
table.on('tool(ID-table-demo-data)', function(obj){ // 双击 toolDouble
|
||||
var data = obj.data; // 获得当前行数据
|
||||
// console.log(obj)
|
||||
if(obj.event === 'edit'){
|
||||
layer.open({
|
||||
title: '编辑 - id:'+ data.adminId,
|
||||
type: 1,
|
||||
area: ['50%','80%'],
|
||||
content: `<div id="warp">
|
||||
<div style="display: flex;flex-direction: column;align-content: center;align-items: center;justify-content: center">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="id" id="ID" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">管理员</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="admin" id="adminUserName" autocomplete="off" class="layui-input" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" id="adminPassword" lay-verify="required" class="layui-input" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">是否有效</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="isValid" placeholder="1 为有效/0为无效" name="open" lay-filter="required" class="layui-input" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn" onclick="upAdateAdmin()">确认</button>
|
||||
<!-- <button type="close" class="layui-btn layui-btn-primary" onclick="close()">关闭</button>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
|
||||
});
|
||||
|
||||
} else if(obj.event === 'more'){
|
||||
// 更多 - 下拉菜单
|
||||
dropdown.render({
|
||||
elem: this, // 触发事件的 DOM 对象
|
||||
show: true, // 外部事件触发即显示
|
||||
data: [{
|
||||
title: '查看',
|
||||
id: 'detail'
|
||||
},{
|
||||
title: '删除',
|
||||
id: 'del'
|
||||
}],
|
||||
click: function(menudata){
|
||||
if(menudata.id === 'detail'){
|
||||
layer.msg('ID:'+ data.adminId
|
||||
+'\n管理员:'+data.adminUserName
|
||||
+"\n密 码:"+data.adminPassword
|
||||
+"\n是否有效:"+data.isValid);
|
||||
} else if(menudata.id === 'del'){
|
||||
layer.confirm('真的删除行 [id: '+ data.adminId +'] 么', function(){
|
||||
obj.del(); // 删除对应行(tr)的DOM结构
|
||||
// layer.close(index);
|
||||
deleteAdmin(data.adminId);
|
||||
// 向服务端发送删除指令
|
||||
});
|
||||
}
|
||||
},
|
||||
align: 'right', // 右对齐弹出
|
||||
style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' // 设置额外样式
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
,data: result.data
|
||||
//,skin: 'line' // 表格风格
|
||||
//,even: true
|
||||
,page: true // 是否显示分页
|
||||
,limits: [5, 10, 15]
|
||||
,limit: 5 // 每页默认显示的数量
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
})
|
||||
}
|
||||
getDate();
|
||||
|
||||
function OpenAdmin(id){
|
||||
axios({
|
||||
// 请求方式
|
||||
method: 'get',
|
||||
// 请求的地址
|
||||
url: 'http://localhost:8080${pageContext.request.contextPath}/openAdmin',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
id:id
|
||||
}
|
||||
}).then(function (result) {
|
||||
layer.msg('开启成功'), {
|
||||
offset: '6px'
|
||||
}
|
||||
window.location.reload();
|
||||
})
|
||||
}
|
||||
|
||||
function CloseAdmin(id){
|
||||
axios({
|
||||
// 请求方式
|
||||
method: 'get',
|
||||
// 请求的地址
|
||||
url: 'http://localhost:8080${pageContext.request.contextPath}/closeAdmin',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
id:id
|
||||
}
|
||||
}).then(function (result) {
|
||||
layer.msg('关闭成功'), {
|
||||
offset: '6px'
|
||||
}
|
||||
window.location.reload();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function upAdateAdmin(){
|
||||
var id=document.getElementById('ID').value;
|
||||
var adminUserName=document.getElementById('adminUserName').value;
|
||||
var adminPassword=document.getElementById('adminPassword').value;
|
||||
var isValid=document.getElementById('isValid').value;
|
||||
axios({
|
||||
// 请求方式
|
||||
method: 'post',
|
||||
// 请求的地址
|
||||
url: 'http://localhost:8080${pageContext.request.contextPath}/updateAdmin',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
id:id,
|
||||
adminUserName:adminUserName,
|
||||
adminPassword:adminPassword,
|
||||
isValid:isValid
|
||||
}
|
||||
}).then(function (result) {
|
||||
layer.msg('修改成功!'), {
|
||||
offset: '6px'
|
||||
}
|
||||
window.location.reload();
|
||||
})
|
||||
}
|
||||
|
||||
function deleteAdmin(id){
|
||||
axios({
|
||||
// 请求方式
|
||||
method: 'get',
|
||||
// 请求的地址
|
||||
url: 'http://localhost:8080${pageContext.request.contextPath}/deleteAdmin',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
id:id,
|
||||
}
|
||||
}).then(function (result) {
|
||||
layer.msg('删除成功!'), {
|
||||
offset: '6px'
|
||||
}
|
||||
window.location.reload();
|
||||
})
|
||||
}
|
||||
function addAdmin()
|
||||
{
|
||||
var adminUserName=document.getElementById('adminUserName').value;
|
||||
var adminPassword=document.getElementById('adminPassword').value;
|
||||
var isValid=document.getElementById('isValid').value;
|
||||
axios({
|
||||
// 请求方式
|
||||
method: 'post',
|
||||
// 请求的地址
|
||||
url: 'http://localhost:8080${pageContext.request.contextPath}/addAdmin',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
adminUserName:adminUserName,
|
||||
adminPassword:adminPassword,
|
||||
isValid:isValid
|
||||
}
|
||||
}).then(function (result) {
|
||||
layer.msg('添加成功!'), {
|
||||
offset: '6px'
|
||||
}
|
||||
window.location.reload();
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
325
src/main/webapp/System/index.jsp
Normal file
@ -0,0 +1,325 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: LDQ
|
||||
Date: 2023/6/8
|
||||
Time: 19:48
|
||||
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://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<!-- 引入 layui.css -->
|
||||
<link href="//unpkg.com/layui@2.8.0/dist/css/layui.css" rel="stylesheet">
|
||||
|
||||
<!-- 引入 layui.js -->
|
||||
<script src="//unpkg.com/layui@2.8.0/dist/layui.js"></script>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<%-- <script type="text/javascript" src="./static/layui/layui.js"></script>--%>
|
||||
<%-- <link rel="stylesheet" type="text/css" href="./static/layui/css/layui.css">--%>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-layout layui-layout-admin">
|
||||
<div class="layui-header">
|
||||
<div class="layui-logo">后台管理系统</div>
|
||||
<ul class="layui-nav layui-layout-right">
|
||||
<li class="layui-nav-item">
|
||||
<a href="javascript:;">
|
||||
<img src="../static/img/头像修改.png" class="layui-nav-img">
|
||||
Admin
|
||||
</a>
|
||||
<%-- <dl class="layui-nav-child">--%>
|
||||
|
||||
<%-- <dd>--%>
|
||||
<%-- <!--TODO -->--%>
|
||||
<%-- <!--需要修改为自己项目的部分:-->--%>
|
||||
<%-- <!--1、属性data-url(需要在右边选项卡中打开的页面的路径) -->--%>
|
||||
<%-- <!--2、属性data-title(选项卡标题)-->--%>
|
||||
<%-- <!--3、属性data-id必须唯一,tab选项卡根据这个值进行切换-->--%>
|
||||
|
||||
<%-- <a href="#" data-url="profile" data-title="个人资料" data-id="44" class="site-demo-active"--%>
|
||||
<%-- data-type="tabAdd">--%>
|
||||
<%-- 个人资料--%>
|
||||
<%-- </a>--%>
|
||||
<%-- </dd>--%>
|
||||
|
||||
<%-- <dd>--%>
|
||||
<%-- <!--TODO -->--%>
|
||||
<%-- <!--需要修改为自己项目的部分:-->--%>
|
||||
<%-- <!--1、属性data-url(需要在右边选项卡中打开的页面的路径) -->--%>
|
||||
<%-- <!--2、属性data-title(选项卡标题)-->--%>
|
||||
<%-- <!--3、属性data-id必须唯一,tab选项卡根据这个值进行切换-->--%>
|
||||
|
||||
<%-- <a href="#" data-url="password" data-title="修改密码" data-id="55" class="site-demo-active" data-type="tabAdd">--%>
|
||||
<%-- 修改密码--%>
|
||||
<%-- </a>--%>
|
||||
<%-- </dd>--%>
|
||||
|
||||
<%-- </dl>--%>
|
||||
</li>
|
||||
<li class="layui-nav-item">
|
||||
<!--TODO -->
|
||||
<!--可能需要修改路径-->
|
||||
<a href="${pageContext.request.contextPath}/">返回首页</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 左侧导航栏 -->
|
||||
<div class="layui-tab layui-side layui-tab-card site-demo-button">
|
||||
<ul class="layui-nav layui-side layui-nav-tree layui-nav-side">
|
||||
|
||||
<li class="layui-nav-item layui-nav-itemed">
|
||||
|
||||
<a href="javascript:;">系统管理</a>
|
||||
|
||||
<dl class="layui-nav-child">
|
||||
|
||||
<dd>
|
||||
<!--TODO -->
|
||||
<!--需要修改为自己项目的部分:-->
|
||||
<!--1、属性data-url(需要在右边选项卡中打开的页面的路径) -->
|
||||
<!--2、属性data-title(选项卡标题)-->
|
||||
<!--3、属性data-id必须唯一,tab选项卡根据这个值进行切换-->
|
||||
<!--4、id,也必须唯一,这里id设置为default-tab,设置该选项卡为默认显示的-->
|
||||
<a href="#" data-url="${pageContext.request.contextPath}/System/adminManage" data-title="管理员管理" data-id="11" id="default-tab" class="site-demo-active"
|
||||
data-type="tabAdd">
|
||||
管理员管理
|
||||
</a>
|
||||
</dd>
|
||||
|
||||
<dd>
|
||||
<!--TODO -->
|
||||
<!--需要修改为自己项目的部分:-->
|
||||
<!--1、属性data-url(需要在右边选项卡中打开的页面的路径) -->
|
||||
<!--2、属性data-title(选项卡标题)-->
|
||||
<!--3、属性data-id必须唯一,tab选项卡根据这个值进行切换-->
|
||||
<a href="#" data-url="${pageContext.request.contextPath}/System/messageManage" data-title="留言管理" data-id="22" class="site-demo-active"
|
||||
data-type="tabAdd">
|
||||
留言管理
|
||||
</a>
|
||||
</dd>
|
||||
|
||||
<%-- <dd>--%>
|
||||
<%-- <!--TODO -->--%>
|
||||
<%-- <!--需要修改为自己项目的部分:-->--%>
|
||||
<%-- <!--1、属性data-url(需要在右边选项卡中打开的页面的路径) -->--%>
|
||||
<%-- <!--2、属性data-title(选项卡标题)-->--%>
|
||||
<%-- <!--3、属性data-id必须唯一,tab选项卡根据这个值进行切换-->--%>
|
||||
<%-- <a href="#" data-url="profile" data-title="考核管理" data-id="33" class="site-demo-active"--%>
|
||||
<%-- data-type="tabAdd">--%>
|
||||
<%-- 考核管理--%>
|
||||
<%-- </a>--%>
|
||||
<%-- </dd>--%>
|
||||
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
|
||||
<%-- <li class="layui-nav-item layui-nav-itemed">--%>
|
||||
<%-- <a href="javascript:;">个人管理</a>--%>
|
||||
<%-- <dl class="layui-nav-child">--%>
|
||||
|
||||
<%-- <dd>--%>
|
||||
<%-- <!--TODO -->--%>
|
||||
<%-- <!--需要修改为自己项目的部分:-->--%>
|
||||
<%-- <!--1、属性data-url(需要在右边选项卡中打开的页面的路径) -->--%>
|
||||
<%-- <!--2、属性data-title(选项卡标题)-->--%>
|
||||
<%-- <!--3、属性data-id必须唯一,tab选项卡根据这个值进行切换-->--%>
|
||||
<%-- <a href="#" data-url="profile" data-title="个人资料" data-id="44" class="site-demo-active"--%>
|
||||
<%-- data-type="tabAdd">--%>
|
||||
<%-- 个人资料--%>
|
||||
<%-- </a>--%>
|
||||
<%-- </dd>--%>
|
||||
|
||||
<%-- <dd>--%>
|
||||
<%-- <!--TODO -->--%>
|
||||
<%-- <!--需要修改为自己项目的部分:-->--%>
|
||||
<%-- <!--1、属性data-url(需要在右边选项卡中打开的页面的路径) -->--%>
|
||||
<%-- <!--2、属性data-title(选项卡标题)-->--%>
|
||||
<%-- <!--3、属性data-id必须唯一,tab选项卡根据这个值进行切换-->--%>
|
||||
<%-- <a href="#" data-url="password" data-title="修改密码" data-id="55" class="site-demo-active"--%>
|
||||
<%-- data-type="tabAdd">--%>
|
||||
<%-- 修改密码--%>
|
||||
<%-- </a>--%>
|
||||
<%-- </dd>--%>
|
||||
|
||||
<%-- </dl>--%>
|
||||
<%-- </li>--%>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-body">
|
||||
<!-- 内容主体区域 -->
|
||||
<div class="layui-tab" lay-filter="demo" lay-allowClose="true">
|
||||
<!--tab页标题-->
|
||||
<ul class="layui-tab-title">
|
||||
</ul>
|
||||
|
||||
<!--tab页标题上右键,出现下面的 关闭当前和关闭所有的选项-->
|
||||
<ul class="rightMenu" style="display: none;position: absolute;">
|
||||
<li data-type="closeThis" class="layui-bg-cyan">关闭当前</li>
|
||||
|
||||
<li data-type="closeAll" class="layui-bg-cyan">关闭所有</li>
|
||||
</ul>
|
||||
|
||||
<!--tab页主体内容区域-->
|
||||
<div class="layui-tab-content">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-footer">
|
||||
<!-- 底部固定区域 -->
|
||||
© landaiqing.space - 后台管理系统
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
layui.use(['element','layer'], function () {
|
||||
var $ = layui.jquery;
|
||||
var element = layui.element; //Tab的切换功能,切换事件监听等,需要依赖element模块
|
||||
|
||||
//触发事件
|
||||
var active = {
|
||||
// 在这里给active绑定几项事件,后面可通过active调用这些事件
|
||||
tabAdd: function (url, id, name) {
|
||||
// 新增一个Tab项 传入三个参数,分别对应其标题,tab页面的地址,还有一个规定的id,是标签中data-id的属性值
|
||||
// 关于tabAdd的方法所传入的参数可看layui的开发文档中基础方法部分
|
||||
element.tabAdd('demo', {
|
||||
title: name,
|
||||
// TODO
|
||||
// 这里的选项卡页面路径: src="' + url + '.html" ,可能需要根据自己项目实际的后缀名修改
|
||||
content: '<iframe data-frameid="' + id + '" scrolling="auto" frameborder="0" src="' + url + '.jsp" style="width:100%;height:99%;"></iframe>',
|
||||
id: id // 规定好的id
|
||||
})
|
||||
CustomRightClick(id); // 自定义函数,给tab绑定右击事件
|
||||
FrameWH(); // 自定义函数,计算iframe层的大小
|
||||
},
|
||||
tabChange: function (id) {
|
||||
// 切换到指定Tab项
|
||||
element.tabChange('demo', id); // 根据传入的id传入到指定的tab项
|
||||
},
|
||||
tabDelete: function (id) {
|
||||
element.tabDelete("demo", id);// 删除
|
||||
}
|
||||
, tabDeleteAll: function (ids) {// 删除所有
|
||||
$.each(ids, function (i, item) {
|
||||
element.tabDelete("demo", item); //ids是一个数组,里面存放了多个id,调用tabDelete方法分别删除
|
||||
})
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 当点击有site-demo-active属性的标签时,即左侧菜单栏中内容 ,触发点击事件
|
||||
$('.site-demo-active').on('click', function () {
|
||||
var dataid = $(this);
|
||||
|
||||
// 这时会判断右侧.layui-tab-title属性下的有lay-id属性的li的数目,即已经打开的tab项数目
|
||||
if ($(".layui-tab-title li[lay-id]").length <= 0) {
|
||||
// 如果比零小,则直接打开新的tab项
|
||||
active.tabAdd(dataid.attr("data-url"), dataid.attr("data-id"), dataid.attr("data-title"));
|
||||
} else {
|
||||
// 否则判断该tab项是否已经存在
|
||||
|
||||
var isData = false; //初始化一个标志,为false说明未打开该tab项 为true则说明已有
|
||||
$.each($(".layui-tab-title li[lay-id]"), function () {
|
||||
//如果点击左侧菜单栏所传入的id 在右侧tab项中的lay-id属性可以找到,则说明该tab项已经打开
|
||||
if ($(this).attr("lay-id") == dataid.attr("data-id")) {
|
||||
isData = true;
|
||||
}
|
||||
})
|
||||
if (isData == false) {
|
||||
//标志为false 新增一个tab项
|
||||
active.tabAdd(dataid.attr("data-url"), dataid.attr("data-id"), dataid.attr("data-title"));
|
||||
}
|
||||
}
|
||||
// 最后不管是否新增tab,最后都转到要打开的选项页面上
|
||||
active.tabChange(dataid.attr("data-id"));
|
||||
});
|
||||
|
||||
|
||||
function CustomRightClick(id) {
|
||||
|
||||
//取消右键 rightMenu属性开始是隐藏的 ,当右击的时候显示,左击的时候隐藏
|
||||
$('.layui-tab-title li').on('contextmenu', function () {
|
||||
return false;
|
||||
})
|
||||
|
||||
$('.layui-tab-title,.layui-tab-title li').click(function () {
|
||||
$('.rightMenu').hide();
|
||||
});
|
||||
|
||||
//桌面点击右击
|
||||
$('.layui-tab-title li').on('contextmenu', function (e) {
|
||||
var popupmenu = $(".rightMenu");
|
||||
popupmenu.find("li").attr("data-id", id); //在右键菜单中的标签绑定id属性
|
||||
|
||||
//判断右侧菜单的位置
|
||||
l = ($(document).width() - e.clientX) < popupmenu.width() ? (e.clientX - popupmenu.width()) : e.clientX;
|
||||
t = ($(document).height() - e.clientY) < popupmenu.height() ? (e.clientY - popupmenu.height()) : e.clientY;
|
||||
popupmenu.css({left: l, top: t}).show(); //进行绝对定位
|
||||
//alert("右键菜单")
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
$(".rightMenu li").click(function () {
|
||||
|
||||
//右键菜单中的选项被点击之后,判断type的类型,决定关闭所有还是关闭当前。
|
||||
if ($(this).attr("data-type") == "closeThis") {
|
||||
//如果关闭当前,即根据显示右键菜单时所绑定的id,执行tabDelete
|
||||
active.tabDelete($(this).attr("data-id"))
|
||||
} else if ($(this).attr("data-type") == "closeAll") {
|
||||
var tabtitle = $(".layui-tab-title li");
|
||||
var ids = new Array();
|
||||
$.each(tabtitle, function (i) {
|
||||
ids[i] = $(this).attr("lay-id");
|
||||
})
|
||||
//如果关闭所有 ,即将所有的lay-id放进数组,执行tabDeleteAll
|
||||
active.tabDeleteAll(ids);
|
||||
}
|
||||
|
||||
$('.rightMenu').hide(); //最后再隐藏右键菜单
|
||||
})
|
||||
|
||||
// 计算frame高度
|
||||
function FrameWH() {
|
||||
var h = $(window).height() - 41 - 10 - 60 - 10 - 44 - 10;
|
||||
$("iframe").css("height", h + "px");
|
||||
}
|
||||
|
||||
|
||||
$(window).resize(function () {
|
||||
FrameWH();
|
||||
})
|
||||
|
||||
|
||||
var layer = layui.layer;
|
||||
layer.ready(function(){
|
||||
// layer.msg('您已进入页面了!');
|
||||
// 触发点击事件,这样就可以设置默认显示的选项卡页面
|
||||
// TODO
|
||||
// 可能需要修改的地方,标签id值
|
||||
$("#default-tab").trigger( "click" );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
315
src/main/webapp/System/messageManage.jsp
Normal file
@ -0,0 +1,315 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: LDQ
|
||||
Date: 2023/6/9
|
||||
Time: 16:57
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<!-- 引入 layui.css -->
|
||||
<link href="//unpkg.com/layui@2.8.0/dist/css/layui.css" rel="stylesheet">
|
||||
|
||||
<!-- 引入 layui.js -->
|
||||
<script src="//unpkg.com/layui@2.8.0/dist/layui.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="upadte">修 改</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/html" id="barDemo">
|
||||
<div class="layui-clear-space">
|
||||
<%-- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>--%>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="more">
|
||||
更多
|
||||
<i class="layui-icon layui-icon-down"></i>
|
||||
</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<table class="layui-hide" id="ID-table-demo-data"></table>
|
||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||
<script>
|
||||
function getDate(){
|
||||
axios({
|
||||
// 请求方式
|
||||
method: 'get',
|
||||
// 请求的地址
|
||||
url: 'http://localhost:8080${pageContext.request.contextPath}/listManage',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
|
||||
}
|
||||
}).then(function (result) {
|
||||
console.log(result);
|
||||
layui.use('table', function(){
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var dropdown = layui.dropdown;
|
||||
var laydate = layui.laydate;
|
||||
var util = layui.util;
|
||||
// 已知数据渲染
|
||||
var inst = table.render({
|
||||
elem: '#ID-table-demo-data'
|
||||
,toolbar: '#toolbarDemo'
|
||||
,cols: [[ //标题栏
|
||||
{field: 'userId', title: 'ID', width: 80, sort: true}
|
||||
,{field: 'nickName', title: '昵称', width: 130}
|
||||
,{field: 'qQ', title: 'QQ', width: 130}
|
||||
,{field: 'email', title: '邮箱', width: 180},
|
||||
{field:'content', title: '评论内容', width:250, },
|
||||
{field:'dateTime', title: '评论时间', width:130, },
|
||||
{field:'replyContent', title: '回复内容', width:200, },
|
||||
{field:'replyDateTime', title: '回复时间', width:130, },
|
||||
{fixed: 'right', title:'操作', width: 134, minWidth: 125, toolbar: '#barDemo'}
|
||||
// {fixed: 'right', title:'操作', width: 134, minWidth: 125, toolbar: '#barDemo'}
|
||||
|
||||
]],done:function (){
|
||||
// 触发单元格工具事件
|
||||
table.on('tool(ID-table-demo-data)', function(obj){ // 双击 toolDouble
|
||||
var data = obj.data; // 获得当前行数据
|
||||
// console.log(obj)
|
||||
if(obj.event === 'more'){
|
||||
// 更多 - 下拉菜单
|
||||
dropdown.render({
|
||||
elem: this, // 触发事件的 DOM 对象
|
||||
show: true, // 外部事件触发即显示
|
||||
data: [{
|
||||
title: '查看',
|
||||
id: 'detail'
|
||||
},{
|
||||
title: '删除',
|
||||
id: 'del'
|
||||
}],
|
||||
click: function(menudata){
|
||||
if(menudata.id === 'detail'){
|
||||
layer.msg('ID:'+ data.userId
|
||||
+'\n昵称:'+data.nickName
|
||||
+"\nQ Q:"+data.qQ
|
||||
+"\nEmail:"+data.email
|
||||
+"\n评论内容:"+data.content
|
||||
+"\n评论时间:"+data.dateTime
|
||||
+"\n回复内容:"+data.replyContent
|
||||
+"\n回复时间:"+data.replyDateTime
|
||||
);
|
||||
} else if(menudata.id === 'del'){
|
||||
layer.confirm('真的删除行 [id: '+ data.userId +'] 么', function(){
|
||||
obj.del(); // 删除对应行(tr)的DOM结构
|
||||
// layer.close(index);
|
||||
// deleteAdmin(data.adminId);
|
||||
deleteUser(data.userId);
|
||||
// 向服务端发送删除指令
|
||||
});
|
||||
}
|
||||
},
|
||||
align: 'right', // 右对齐弹出
|
||||
style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' // 设置额外样式
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
table.on('toolbar(ID-table-demo-data)', function(obj){
|
||||
var id = obj.config.id;
|
||||
var checkStatus = table.checkStatus(id);
|
||||
var othis = lay(this);
|
||||
switch(obj.event){
|
||||
case 'upadte':
|
||||
layer.open({
|
||||
title: '修改',
|
||||
type: 1,
|
||||
area: ['80%','80%'],
|
||||
content: `<div id="warp">
|
||||
<div style="display: flex;flex-direction: column;align-content: center;align-items: center;justify-content: center">
|
||||
<form class="layui-form" lay-filter="scoreRuleForm">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">ID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="id" id="id" autocomplete="off" class="layui-input" placeholder="被修改数据ID">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">昵 称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="nickName" name="nickName" class="layui-input" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">QQ</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="qq" name="qq" class="layui-input" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" pane>
|
||||
<label class="layui-form-label">Email</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="email" name="email" lay-filter="required" class="layui-input" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">评论内容</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea placeholder="请输入评论内容" id="content" name="content" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">评论日期</label>
|
||||
<div class="layui-input-inline layui-input-wrap">
|
||||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-date"></i>
|
||||
</div>
|
||||
<input type="text" name="dateTime" id="dateTime" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">回复内容</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea placeholder="请输入回复内容" id="replyContent" name="replyContent" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">回复日期</label>
|
||||
<div class="layui-input-inline layui-input-wrap">
|
||||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-date"></i>
|
||||
</div>
|
||||
<input type="text" name="replyDateTime" id="replyDateTime" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<button type="submit" class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>`,
|
||||
|
||||
});
|
||||
break;
|
||||
// case 'getData':
|
||||
// var getData = table.getData(id);
|
||||
// console.log(getData);
|
||||
// layer.alert(layui.util.escape(JSON.stringify(getData)));
|
||||
// break;
|
||||
// case 'LAYTABLE_TIPS':
|
||||
// layer.alert('自定义工具栏图标按钮');
|
||||
// break;
|
||||
};
|
||||
});
|
||||
// 日期
|
||||
|
||||
|
||||
form.on('submit(demo1)', function(data){
|
||||
var field = data.field; // 获取表单字段值
|
||||
// 显示填写结果,仅作演示用
|
||||
layer.alert(JSON.stringify(field), {
|
||||
title: '当前填写的字段值'
|
||||
});
|
||||
$.ajax({
|
||||
url:"http://localhost:8080${pageContext.request.contextPath}/update",
|
||||
async:false,
|
||||
type:"POST",
|
||||
dataType:"text",
|
||||
data:field,
|
||||
success:function(){
|
||||
window.location.reload();
|
||||
}
|
||||
})
|
||||
layer.alert(JSON.stringify(data.field), {
|
||||
})
|
||||
return false; // 阻止默认 form 跳转
|
||||
});
|
||||
|
||||
}
|
||||
,data: result.data
|
||||
//,skin: 'line' // 表格风格
|
||||
//,even: true
|
||||
,page: true // 是否显示分页
|
||||
,limits: [5, 10, 15]
|
||||
,limit: 5 // 每页默认显示的数量
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
})
|
||||
}
|
||||
getDate();
|
||||
function deleteUser(id){
|
||||
axios({
|
||||
// 请求方式
|
||||
method: 'get',
|
||||
// 请求的地址
|
||||
url: 'http://localhost:8080${pageContext.request.contextPath}/deleteUser',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
id:id,
|
||||
}
|
||||
}).then(function (result) {
|
||||
layer.msg('删除成功!'), {
|
||||
offset: '6px'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
layui.use('laydate', function(){
|
||||
var laydate = layui.laydate;
|
||||
laydate.render({
|
||||
elem: '#dateTime',
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#replyDateTime',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
<%--function update(){--%>
|
||||
<%-- var id=document.getElementById('id').value;--%>
|
||||
<%-- var nickName=document.getElementById('nickName').value;--%>
|
||||
<%-- var qq=document.getElementById('qq').value;--%>
|
||||
<%-- var email=document.getElementById('email').value;--%>
|
||||
<%-- var content=document.getElementById('content').value;--%>
|
||||
<%-- var replyContent=document.getElementById('replyContent').value;--%>
|
||||
<%-- var dateTime=document.getElementById('dateTime').value;--%>
|
||||
<%-- var ReplyDateTime=document.getElementById('ReplyDateTime').value;--%>
|
||||
<%-- axios({--%>
|
||||
<%-- // 请求方式--%>
|
||||
<%-- method: 'post',--%>
|
||||
<%-- // 请求的地址--%>
|
||||
<%-- url: 'http://localhost:8080${pageContext.request.contextPath}/update',--%>
|
||||
<%-- // URL 中的查询参数--%>
|
||||
<%-- params: {--%>
|
||||
<%-- id:id,--%>
|
||||
<%-- nickName:nickName,--%>
|
||||
<%-- qq:qq,--%>
|
||||
<%-- email:email,--%>
|
||||
<%-- content:content,--%>
|
||||
<%-- replyContent:replyContent,--%>
|
||||
<%-- dateTime:dateTime,--%>
|
||||
<%-- ReplyDateTime:ReplyDateTime--%>
|
||||
<%-- }--%>
|
||||
<%-- }).then(function (result) {--%>
|
||||
<%-- layer.msg('修改成功!'), {--%>
|
||||
<%-- offset: '6px'--%>
|
||||
<%-- }--%>
|
||||
<%-- window.location.reload();--%>
|
||||
<%-- })--%>
|
||||
<%--}--%>
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
13
src/main/webapp/WEB-INF/web.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
|
||||
version="4.0">
|
||||
</web-app>
|
||||
<!--<!DOCTYPE web-app PUBLIC-->
|
||||
<!-- "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"-->
|
||||
<!-- "http://java.sun.com/dtd/web-app_2_3.dtd" >-->
|
||||
|
||||
<!--<web-app>-->
|
||||
<!-- <display-name>Archetype Created Web Application</display-name>-->
|
||||
<!--</web-app>-->
|
16
src/main/webapp/error.jsp
Normal file
@ -0,0 +1,16 @@
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: LDQ
|
||||
Date: 2023/6/9
|
||||
Time: 1:32
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
${errorMsg}
|
||||
</body>
|
||||
</html>
|
525
src/main/webapp/index.jsp
Normal file
@ -0,0 +1,525 @@
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%--
|
||||
Created by IntelliJ IDEA.
|
||||
User: landaiqing
|
||||
Date: 2023/6/8
|
||||
Time: 19:20
|
||||
To change this template use File | Settings | File Templates.
|
||||
--%>
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%--<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>--%>
|
||||
<%--<%@ taglib uri= "http://java.sun.com/jsp/jstl/core" prefix="c" %>--%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>留言本</title>
|
||||
<%-- Lay-ui组件库--%>
|
||||
<%-- <script type="text/javascript" src="./static/layui/layui.js"></script>--%>
|
||||
<%-- <%– Lay-ui样式–%>--%>
|
||||
<%-- <link rel="stylesheet" type="text/css" href="./static/layui/css/layui.css">--%>
|
||||
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<!-- 引入 layui.css -->
|
||||
<link href="//unpkg.com/layui@2.8.0/dist/css/layui.css" rel="stylesheet">
|
||||
|
||||
<!-- 引入 layui.js -->
|
||||
<script src="//unpkg.com/layui@2.8.0/dist/layui.js">
|
||||
|
||||
// <link rel="stylesheet" href="./static/css/index.css" type="text/css">
|
||||
|
||||
// <script language=JavaScript type="text/javascript" src="static/js/index.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
@IMPORT url("./static/css/index.css");
|
||||
|
||||
.submit {
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
border-radius: 20px;
|
||||
background-color: #1dc48c;
|
||||
}
|
||||
|
||||
.layui-icon-down {
|
||||
color: black;
|
||||
}
|
||||
|
||||
.layui-nav .layui-nav-more {
|
||||
position: absolute;
|
||||
top: -13px;
|
||||
right: 3px;
|
||||
left: auto !important;
|
||||
margin-top: 0;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
transition: all .2s;
|
||||
-webkit-transition: all .2s;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="main">
|
||||
<div class="header">
|
||||
<div style="display: flex;position: fixed;flex-direction: row;flex-wrap: nowrap;align-items: center;z-index: 99999;background-color: white">
|
||||
<div style="width: 570px;height: 45px;">
|
||||
<span style="font-size: 2rem;font-weight: 700;font-family: FZShuTi;color:coral;">留 言 本</span>
|
||||
</div>
|
||||
<button type="button" class="layui-btn layui-btn-warm layui-btn-radius" lay-on="wrap">
|
||||
<i class="layui-icon layui-icon-edit"></i>
|
||||
发布留言
|
||||
</button>
|
||||
<!-- <button type="button" class="layui-btn layui-btn-radius" lay-on="admin">
|
||||
<i class="layui-icon layui-icon-set-fill"></i>
|
||||
管理
|
||||
</button> -->
|
||||
<div>
|
||||
<ul class="layui-nav" style="background: transparent;">
|
||||
<li class="layui-nav-item" lay-unselect>
|
||||
<a href="javascript:;">
|
||||
<img src="./static/img/touxiang.png" class="layui-nav-img">
|
||||
</a>
|
||||
<dl class="layui-nav-child">
|
||||
<button type="button" class="layui-btn layui-btn-radius" lay-on="admin">
|
||||
<i class="layui-icon layui-icon-set-fill"></i>
|
||||
管理
|
||||
</button>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<blockquote style="margin-top: 6%" class="layui-elem-quote layui-text">
|
||||
留言列表
|
||||
</blockquote>
|
||||
|
||||
<!-- 管理员登陆 -->
|
||||
<div class="layui-form" id="adminform" lay-filter="filter-test-layer" style="margin: 16px;display: none;">
|
||||
<form action="/MessageBook2_war_exploded/login" method="post">
|
||||
<div class="demo-login-container">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-wrap">
|
||||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-username"></i>
|
||||
</div>
|
||||
<input type="text" name="username" value="" lay-verify="required" placeholder="用户名"
|
||||
lay-reqtext="请填写用户名" autocomplete="off" class="layui-input" lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-wrap">
|
||||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-password"></i>
|
||||
</div>
|
||||
<input type="password" name="password" value="" lay-verify="required" placeholder="密 码"
|
||||
lay-reqtext="请填写密码" autocomplete="off" class="layui-input" lay-affix="eye">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-xs7">
|
||||
<div class="layui-input-wrap">
|
||||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-vercode"></i>
|
||||
</div>
|
||||
<input type="text" name="code" value="" lay-verify="required" placeholder="验证码"
|
||||
lay-reqtext="请填写验证码" autocomplete="off" class="layui-input"
|
||||
lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs5">
|
||||
<div style="margin-left: 10px;">
|
||||
<img src=VerifycodeServlet
|
||||
onclick="this.src='VerifycodeServlet?'+ new Date().getTime();">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<input class="submit" type="submit" value="登录"/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 发布留言的主体 -->
|
||||
<div class="wrap" id="warp" style="display: none;">
|
||||
<div class="userIfo">
|
||||
<div class="layui-panel">
|
||||
<div style="padding: 32px;" class="panel">
|
||||
<div class="layui-input-wrap">
|
||||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-username"></i>
|
||||
</div>
|
||||
<input type="text" id="name" name="name" placeholder="昵称" class="layui-input">
|
||||
</div>
|
||||
|
||||
<div class="layui-input-wrap">
|
||||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-login-qq"></i>
|
||||
</div>
|
||||
<input type="text" id="qq" name="qq" placeholder="QQ" class="layui-input">
|
||||
</div>
|
||||
|
||||
<div class="layui-input-wrap">
|
||||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-email"></i>
|
||||
</div>
|
||||
<input type="text" id="email" name="email" placeholder="Email" class="layui-input">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-panel">
|
||||
<div class="wrap-head">
|
||||
<div class="head-logo">
|
||||
<img src="./static/img/留言.png" style="height: 20px;width: 20px;"/>
|
||||
</div>
|
||||
<div class="head-txt">
|
||||
<a class="title-txt"
|
||||
href="javascript:void(0)">言无有善恶也,苟有得乎吾心而言也,则其辞不索而获。</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main-txt">
|
||||
<textarea name="content" id="content" rows="" cols="" class="main-area"></textarea>
|
||||
|
||||
</div>
|
||||
<div class="warp-footer">
|
||||
<div class="warp-icon-cont">
|
||||
<ul>
|
||||
<li><img src="./static/img/发表情.png" alt=""/>
|
||||
<a href="javascript:void(0)">表情</a>
|
||||
</li>
|
||||
<li><img src="./static/img/图片_填充.png" alt=""/>
|
||||
<a href="javascript:void(0)">图片</a>
|
||||
</li>
|
||||
<li><img src="./static/img/视频_填充.png" alt=""/>
|
||||
<a href="javascript:void(0)">视频</a>
|
||||
</li>
|
||||
<li><img src="./static/img/话题选中.png" alt=""/>
|
||||
<a href="javascript:void(0)">话题</a>
|
||||
</li>
|
||||
<li><img src="./static/img/文章.png" alt=""/>
|
||||
<a href="javascript:void(0)">文章</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="warp-footer-btns">
|
||||
<div class="release-btn">
|
||||
<a href="javascript:publish()">发布</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 显示留言的主体 -->
|
||||
<c:forEach items="${list}" var="list" varStatus="i">
|
||||
<div class="show">
|
||||
<div class="show-content">
|
||||
<div class="show-name">
|
||||
<div class="avtors"><img src="./static/img/头像修改.png" alt=""
|
||||
style="width: 40px;height: 40px;border-radius: 50%;"></div>
|
||||
<span style="margin-left: 10px;font-size: 1rem;">${list.nickName}</span>
|
||||
</div>
|
||||
<div class="show-txt">
|
||||
<p class="">${list.content}</p>
|
||||
</div>
|
||||
<div class="show-time">${list.dateTime}</div>
|
||||
<!-- <button type="button" class="layui-btn layui-btn-xs" lay-on="wrap">
|
||||
<i class="layui-icon layui-icon-release"></i> 回复
|
||||
</button> -->
|
||||
<div class="layui-panel">
|
||||
<c:choose>
|
||||
<c:when test="${not empty list.replyContent && !(list.replyContent eq null)}">
|
||||
<div class="comment-wrap">
|
||||
<div class="photo">
|
||||
<div class="avatar" style="background-image: url('./static/img/头像修改.png')"></div>
|
||||
</div>
|
||||
<div class="comment-block">
|
||||
<p class="comment-text">${list.replyContent}</p>
|
||||
<div class="bottom-comment">
|
||||
<div class="comment-date">${list.replyDateTime}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%-- <div class="comments">--%>
|
||||
<%-- <div class="comment-wrap">--%>
|
||||
<%-- <div class="photo">--%>
|
||||
<%-- <div class="avatar" style="background-image: url('./static/img/头像修改.png')"></div>--%>
|
||||
<%-- </div>--%>
|
||||
<%-- <div class="comment-block">--%>
|
||||
<%-- <form action="">--%>
|
||||
<%-- <textarea name="content" id="replyContent" cols="30" rows="3" placeholder="Say somthing..."--%>
|
||||
<%-- style="resize:none"></textarea>--%>
|
||||
<%-- <button type="button" class="layui-btn layui-btn-xs" onclick="reply(${list.userId})">--%>
|
||||
<%-- <i class="layui-icon layui-icon-release"></i> 回复--%>
|
||||
<%-- </button>--%>
|
||||
<%-- </form>--%>
|
||||
<%-- </div>--%>
|
||||
<%-- </div>--%>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="comments">
|
||||
<div class="comment-wrap">
|
||||
<div class="photo">
|
||||
<div class="avatar" style="background-image: url('./static/img/头像修改.png')"></div>
|
||||
</div>
|
||||
<div class="comment-block">
|
||||
<form action="">
|
||||
<textarea name="" id="replyContent" cols="30" rows="3" placeholder="Say somthing..."
|
||||
style="resize:none"></textarea>
|
||||
<button type="button" class="layui-btn layui-btn-xs" onclick="reply(${list.userId})">
|
||||
<i class="layui-icon layui-icon-release"></i> 回复
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<div class="show-close">x</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</c:forEach>
|
||||
|
||||
|
||||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
|
||||
|
||||
<script>
|
||||
layui.use(function () {
|
||||
var $ = layui.$;
|
||||
var layer = layui.layer;
|
||||
var util = layui.util;
|
||||
var form = layui.form;
|
||||
|
||||
util.on('lay-on', {
|
||||
|
||||
'wrap': function () {
|
||||
layer.open({
|
||||
type: 1,
|
||||
resize: true,
|
||||
title: '发表留言',
|
||||
shade: false, // 不显示遮罩
|
||||
content: $('#warp'), // 捕获的元素
|
||||
end: function () {
|
||||
// layer.msg('关闭后的回调', {icon:6});
|
||||
}
|
||||
});
|
||||
},
|
||||
'admin': function () {
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: '350px',
|
||||
resize: false,
|
||||
shadeClose: true,
|
||||
title: '管理员登录',
|
||||
content: $('#adminform'),
|
||||
},)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
// 发布评论
|
||||
function publish() {
|
||||
var name = document.getElementById('name').value;
|
||||
var qq = document.getElementById('qq').value;
|
||||
var email = document.getElementById('email').value;
|
||||
var content = document.getElementById('content').value;
|
||||
console.log(name + qq + email + content);
|
||||
axios({
|
||||
// 请求方式
|
||||
method: 'post',
|
||||
// 请求的地址
|
||||
url: 'http://localhost:8080${pageContext.request.contextPath}/publish',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
name: name,
|
||||
qq: qq,
|
||||
email: email,
|
||||
content: content
|
||||
}
|
||||
}).then(function (result) {
|
||||
//定位 span id 名称 error 修改
|
||||
// console.log(result);
|
||||
window.location.reload();
|
||||
})
|
||||
|
||||
}
|
||||
// 回复
|
||||
function reply(userId){
|
||||
var content = document.getElementById('replyContent').value;
|
||||
axios({
|
||||
// 请求方式
|
||||
method: 'post',
|
||||
// 请求的地址
|
||||
url: 'http://localhost:8080${pageContext.request.contextPath}/reply',
|
||||
// URL 中的查询参数
|
||||
params: {
|
||||
userId: userId,
|
||||
replyContent:content
|
||||
}
|
||||
}).then(function (result) {
|
||||
//定位 span id 名称 error 修改
|
||||
// console.log(result);
|
||||
window.location.reload();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
$(function () {
|
||||
// 还能输入的字得个数
|
||||
var able_count = 140;
|
||||
// 是否可以发布留言
|
||||
var release_able = false;
|
||||
// 右上角文字
|
||||
var $title_txt = $('.title-txt');
|
||||
// 留言框
|
||||
var $main_area = $('.main-area');
|
||||
// 发布按钮
|
||||
var $release_btn = $('.release-btn');
|
||||
|
||||
// 输入框获取焦点
|
||||
$main_area.focus(function () {
|
||||
console.log("获取焦点");
|
||||
$(this).parent().addClass('outline');
|
||||
$title_txt.addClass('title');
|
||||
if (able_count >= 0) {
|
||||
$title_txt.html("还可以输入" + able_count + "个字");
|
||||
} else {
|
||||
$title_txt.html("你以超出" + (-able_count) + "个字");
|
||||
}
|
||||
})
|
||||
|
||||
// 输入框失去焦点
|
||||
$main_area.blur(function () {
|
||||
console.log("失去焦点");
|
||||
$(this).parent().removeClass('outline');
|
||||
$title_txt.removeClass('title');
|
||||
$title_txt.html("言无有善恶也,苟有得乎吾心而言也,则其辞不索而获。");
|
||||
})
|
||||
|
||||
// 输入框文本修改
|
||||
$main_area.on('input', function () {
|
||||
console.log("文本修改");
|
||||
// 剩余可输入的字个数
|
||||
able_count = 140 - $main_area.val().length;
|
||||
// console.log(able_count);
|
||||
// 根据可输入字的个数决定右上角文本的提示 与 是否能发布的状态
|
||||
if (able_count >= 0 && able_count <= 140) {
|
||||
$title_txt.html("还可以输入" + able_count + "个字");
|
||||
if (able_count != 140) {
|
||||
release_able = true;
|
||||
} else {
|
||||
release_able = false;
|
||||
}
|
||||
} else {
|
||||
$title_txt.html("你以超出" + (-able_count) + "个字");
|
||||
release_able = false;
|
||||
}
|
||||
// 根据发布状态决定发布按钮的样式
|
||||
if (release_able) {
|
||||
$release_btn.css({
|
||||
backgroundColor: "orange",
|
||||
borderColor: "orange"
|
||||
})
|
||||
} else {
|
||||
$release_btn.css({
|
||||
backgroundColor: "#ffc09f",
|
||||
borderColor: "#ffc09f"
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// 发布事件
|
||||
// $release_btn.click(function () {
|
||||
// console.log("发布");
|
||||
// if (release_able) {
|
||||
// console.log('可以发布');
|
||||
// // 创建show对象的各个部位
|
||||
// var $showContent = $('<div class="show-content"></div>'),
|
||||
// $showName = $('<div class="show-name"></div>'),
|
||||
// $showTxt = $('<div class="show-txt"></div>'),
|
||||
// $showTime = $('<div class="show-time"></div>'),
|
||||
// $showClose = $('<div class="show-close"></div>'),
|
||||
// $showP = $('<p class=""></p>');
|
||||
//
|
||||
// var date = new Date();
|
||||
// // 设置,对象结构内内容
|
||||
// $showName.text("XxXx");
|
||||
// $showP.text($main_area.val());
|
||||
// $showTime.text(date);
|
||||
// $showClose.text("x");
|
||||
// // 添加进入主结构
|
||||
// $showTxt.append($showP);
|
||||
// $showContent.append($showName);
|
||||
// $showContent.append($showTxt);
|
||||
// $showContent.append($showTime);
|
||||
// $showContent.append($showClose);
|
||||
//
|
||||
// // 向所有匹配元素内部的开始处插入内容
|
||||
// $('.show').prepend($showContent);
|
||||
//
|
||||
// // 添加动画
|
||||
// // 位置从输入框处下移
|
||||
// $showContent.css({
|
||||
// top: '-150px'
|
||||
// })
|
||||
// $showContent.animate({
|
||||
// top: 0
|
||||
// }, 200)
|
||||
//
|
||||
// // 删除事件
|
||||
// $showClose.click(function () {
|
||||
// // 显示插入的索引位置
|
||||
// // console.log($(this).parent().index());
|
||||
// // console.log($showContent.index());
|
||||
//
|
||||
//
|
||||
// // 删除操作为顺便
|
||||
// // $showContent.remove();
|
||||
//
|
||||
// // 使用删除动画,创建效果
|
||||
// $showContent.animate({
|
||||
// height: 0
|
||||
// }, 200, function () {
|
||||
// // 动画结束后将自身从dom中移除
|
||||
// $showContent.remove();
|
||||
// })
|
||||
//
|
||||
//
|
||||
// })
|
||||
//
|
||||
// // 发布成功后收尾工作
|
||||
// $main_area.val(""); //输入框清空
|
||||
// able_count = 140; //输入框可输入内容数重置
|
||||
// release_able = false;
|
||||
// $release_btn.css({
|
||||
// backgroundColor: '#ffc09f',
|
||||
// borderColor: '#ffc09f'
|
||||
// }) //按钮点击事件重置
|
||||
//
|
||||
// }
|
||||
// })
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
355
src/main/webapp/static/css/index.css
Normal file
@ -0,0 +1,355 @@
|
||||
body, ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
}
|
||||
body{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: row;
|
||||
}
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
/* main */
|
||||
.main {
|
||||
width: 800px;
|
||||
height: 100%;
|
||||
/* background-color: #eb7350; */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
}
|
||||
/* header */
|
||||
|
||||
.header{
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
/* background-color: #ddd; */
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
flex-wrap: nowrap;
|
||||
/* align-items: center; */
|
||||
/* justify-content: flex-end; */
|
||||
}
|
||||
.userIfo {
|
||||
display: flex;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.panel{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.layui-panel {
|
||||
background:transparent;
|
||||
}
|
||||
.admin {
|
||||
width: 350px;
|
||||
height: 500px;
|
||||
}
|
||||
/* 管理员登陆 */
|
||||
.demo-login-container{width: 320px; margin: 21px auto 0;}
|
||||
.demo-login-other .layui-icon{position: relative; display: inline-block; margin: 0 2px; top: 2px; font-size: 26px;}
|
||||
|
||||
|
||||
|
||||
/*最外层*/
|
||||
.wrap {
|
||||
width: 700px;
|
||||
height: 325px;
|
||||
margin: 20px auto;
|
||||
border-radius: 4px;
|
||||
/* border: 1px solid #ddd; */
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.wrap-head {
|
||||
width: 100%;
|
||||
height: 24px;
|
||||
padding-top: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.head-logo {
|
||||
width: 20%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.head-logo img {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.head-txt {
|
||||
padding: 4px 0;
|
||||
width: 60%;
|
||||
float: right;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.head-txt a {
|
||||
font-size: 12px;
|
||||
color: #eb7350;
|
||||
text-decoration: none;
|
||||
}
|
||||
.title-txt.title {
|
||||
text-align: right;
|
||||
color: black;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
/*内层设计,输入框*/
|
||||
.main-txt {
|
||||
border: 1px solid #ccc;
|
||||
width: 98%;
|
||||
height: 68px;
|
||||
margin: 4px 0 0;
|
||||
padding: 5px;
|
||||
box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.15) inset;
|
||||
}
|
||||
|
||||
.main-txt textarea {
|
||||
border: none;
|
||||
width: 100%;
|
||||
height: 66px;
|
||||
outline: none;
|
||||
resize: none;
|
||||
color: #333;
|
||||
}
|
||||
.main-txt.outline {
|
||||
outline: 2px orange solid;
|
||||
}
|
||||
|
||||
/*下层设计*/
|
||||
.warp-footer {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
margin: 6px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.warp-icon-cont {
|
||||
width: 65%;
|
||||
float: left;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.warp-icon-cont ul li {
|
||||
display: inline-block;
|
||||
margin-right: 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.warp-icon-cont a {
|
||||
font-size: 12px;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
height: 20px;
|
||||
margin-left: 5px;
|
||||
display: block;
|
||||
width: 25px;
|
||||
float: right;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.warp-icon-cont a:hover {
|
||||
color: #eb7350;
|
||||
}
|
||||
|
||||
.warp-icon-cont img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.warp-footer-btns {
|
||||
width: 35%;
|
||||
float: right;
|
||||
overflow: hidden;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.release-btn {
|
||||
width: 80px;
|
||||
height: 28px;
|
||||
float: right;
|
||||
background-color: #ffc09f;
|
||||
border: 4px solid #fbbd9e;
|
||||
cursor: pointer;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.release-btn a {
|
||||
display: block;
|
||||
color: #fff;
|
||||
width: 80px;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
/*后期添加的留言框*/
|
||||
.show {
|
||||
width: 800px;
|
||||
/* margin: 20px auto; */
|
||||
}
|
||||
|
||||
.show-content {
|
||||
width: 775px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 10px;
|
||||
padding: 10px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.show-name {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.show-txt {
|
||||
width: 100%;
|
||||
color: #444;
|
||||
font-size: 14px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.show-txt p {
|
||||
width: 100%;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.show-time {
|
||||
font-size: 12px;
|
||||
color: #808080;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.show-close {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
font-size: 12px;
|
||||
color: #ccc;
|
||||
cursor: pointer;
|
||||
transition: .5s;
|
||||
}
|
||||
|
||||
.show-close:hover {
|
||||
color: red;
|
||||
}
|
||||
|
||||
|
||||
/* html,
|
||||
body {
|
||||
background-color: #f0f2fa;
|
||||
font-family: "PT Sans", "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
|
||||
color: #555f77;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
} */
|
||||
input,
|
||||
textarea {
|
||||
outline: none;
|
||||
border: none;
|
||||
display: block;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-family: "PT Sans", "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
|
||||
font-size: 1rem;
|
||||
color: #555f77;
|
||||
}
|
||||
input::-webkit-input-placeholder,
|
||||
textarea::-webkit-input-placeholder {
|
||||
color: #ced2db;
|
||||
}
|
||||
input::-moz-placeholder,
|
||||
textarea::-moz-placeholder {
|
||||
color: #ced2db;
|
||||
}
|
||||
input:-moz-placeholder,
|
||||
textarea:-moz-placeholder {
|
||||
color: #ced2db;
|
||||
}
|
||||
input:-ms-input-placeholder,
|
||||
textarea:-ms-input-placeholder {
|
||||
color: #ced2db;
|
||||
}
|
||||
p {
|
||||
line-height: 1.3125rem;
|
||||
}
|
||||
.comments {
|
||||
margin: 2.5rem auto 0;
|
||||
max-width: 60.75rem;
|
||||
padding: 0 1.25rem;
|
||||
}
|
||||
.comment-wrap {
|
||||
margin-bottom: 1.25rem;
|
||||
display: table;
|
||||
width: 100%;
|
||||
min-height: 5.3125rem;
|
||||
}
|
||||
.photo {
|
||||
padding-top: 0.625rem;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
width: 3.5rem;
|
||||
}
|
||||
.photo .avatar {
|
||||
height: 2.25rem;
|
||||
width: 2.25rem;
|
||||
border-radius: 50%;
|
||||
background-size: contain;
|
||||
}
|
||||
.comment-block {
|
||||
padding: 1rem;
|
||||
background-color: #fff;
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
border-radius: 0.1875rem;
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
.comment-block textarea {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
.comment-text {
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
.bottom-comment {
|
||||
color: #acb4c2;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
.comment-date {
|
||||
float: left;
|
||||
}
|
||||
.comment-actions {
|
||||
float: right;
|
||||
}
|
||||
.comment-actions li {
|
||||
display: inline;
|
||||
}
|
||||
.comment-actions li.complain {
|
||||
padding-right: 0.625rem;
|
||||
border-right: 1px solid #e1e5eb;
|
||||
}
|
||||
.comment-actions li.reply {
|
||||
padding-left: 0.625rem;
|
||||
}
|
BIN
src/main/webapp/static/img/touxiang.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
src/main/webapp/static/img/发表情.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
src/main/webapp/static/img/图片_填充.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
src/main/webapp/static/img/头像修改.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
BIN
src/main/webapp/static/img/文章.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
src/main/webapp/static/img/留言.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
src/main/webapp/static/img/视频_填充.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
src/main/webapp/static/img/话题选中.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
142
src/main/webapp/static/js/index.js
Normal file
@ -0,0 +1,142 @@
|
||||
// 匿名函数包裹,防止外界操作的修改
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
// 还能输入的字得个数
|
||||
var able_count = 140;
|
||||
// 是否可以发布留言
|
||||
var release_able = false;
|
||||
// 右上角文字
|
||||
var $title_txt = $('.title-txt');
|
||||
// 留言框
|
||||
var $main_area = $('.main-area');
|
||||
// 发布按钮
|
||||
var $release_btn = $('.release-btn');
|
||||
|
||||
// 输入框获取焦点
|
||||
$main_area.focus(function () {
|
||||
console.log("获取焦点");
|
||||
$(this).parent().addClass('outline');
|
||||
$title_txt.addClass('title');
|
||||
if (able_count >= 0) {
|
||||
$title_txt.html("还可以输入" + able_count + "个字");
|
||||
} else {
|
||||
$title_txt.html("你以超出" + (-able_count) + "个字");
|
||||
}
|
||||
})
|
||||
|
||||
// 输入框失去焦点
|
||||
$main_area.blur(function () {
|
||||
console.log("失去焦点");
|
||||
$(this).parent().removeClass('outline');
|
||||
$title_txt.removeClass('title');
|
||||
$title_txt.html("111");
|
||||
})
|
||||
|
||||
// 输入框文本修改
|
||||
$main_area.on('input', function () {
|
||||
console.log("文本修改");
|
||||
// 剩余可输入的字个数
|
||||
able_count = 140 - $main_area.val().length;
|
||||
// console.log(able_count);
|
||||
// 根据可输入字的个数决定右上角文本的提示 与 是否能发布的状态
|
||||
if (able_count >= 0 && able_count <= 140) {
|
||||
$title_txt.html("还可以输入" + able_count + "个字");
|
||||
if (able_count != 140) {
|
||||
release_able = true;
|
||||
} else {
|
||||
release_able = false;
|
||||
}
|
||||
} else {
|
||||
$title_txt.html("你以超出" + (-able_count) + "个字");
|
||||
release_able = false;
|
||||
}
|
||||
// 根据发布状态决定发布按钮的样式
|
||||
if (release_able) {
|
||||
$release_btn.css({
|
||||
backgroundColor: "orange",
|
||||
borderColor: "orange"
|
||||
})
|
||||
} else {
|
||||
$release_btn.css({
|
||||
backgroundColor: "#ffc09f",
|
||||
borderColor: "#ffc09f"
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// 发布事件
|
||||
$release_btn.click(function () {
|
||||
console.log("发布");
|
||||
if (release_able) {
|
||||
console.log('可以发布');
|
||||
// 创建show对象的各个部位
|
||||
var $showContent = $('<div class="show-content"></div>'),
|
||||
$showName = $('<div class="show-name"></div>'),
|
||||
$showTxt = $('<div class="show-txt"></div>'),
|
||||
$showTime = $('<div class="show-time"></div>'),
|
||||
$showClose = $('<div class="show-close"></div>'),
|
||||
$showP = $('<p class=""></p>');
|
||||
|
||||
var date = new Date();
|
||||
// 设置,对象结构内内容
|
||||
$showName.text("XxXx");
|
||||
$showP.text($main_area.val());
|
||||
$showTime.text(date);
|
||||
$showClose.text("x");
|
||||
// 添加进入主结构
|
||||
$showTxt.append($showP);
|
||||
$showContent.append($showName);
|
||||
$showContent.append($showTxt);
|
||||
$showContent.append($showTime);
|
||||
$showContent.append($showClose);
|
||||
|
||||
// 向所有匹配元素内部的开始处插入内容
|
||||
$('.show').prepend($showContent);
|
||||
|
||||
// 添加动画
|
||||
// 位置从输入框处下移
|
||||
$showContent.css({
|
||||
top: '-150px'
|
||||
})
|
||||
$showContent.animate({
|
||||
top: 0
|
||||
}, 200)
|
||||
|
||||
// 删除事件
|
||||
$showClose.click(function () {
|
||||
// 显示插入的索引位置
|
||||
// console.log($(this).parent().index());
|
||||
// console.log($showContent.index());
|
||||
|
||||
|
||||
// 删除操作为顺便
|
||||
// $showContent.remove();
|
||||
|
||||
// 使用删除动画,创建效果
|
||||
$showContent.animate({
|
||||
height: 0
|
||||
}, 200, function () {
|
||||
// 动画结束后将自身从dom中移除
|
||||
$showContent.remove();
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
// 发布成功后收尾工作
|
||||
$main_area.val(""); //输入框清空
|
||||
able_count = 140; //输入框可输入内容数重置
|
||||
release_able = false;
|
||||
$release_btn.css({
|
||||
backgroundColor: '#ffc09f',
|
||||
borderColor: '#ffc09f'
|
||||
}) //按钮点击事件重置
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
})
|
1
src/main/webapp/static/layui/css/layui.css
Normal file
BIN
src/main/webapp/static/layui/font/iconfont.eot
Normal file
405
src/main/webapp/static/layui/font/iconfont.svg
Normal file
After Width: | Height: | Size: 322 KiB |