学生成绩管理系统源代码

main
heruyi 7 months ago
parent 7e7afee682
commit 6fa00e3299

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/../../../../:\IdeaProjects\StudentScore\.idea/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="StudentScore" />
</profile>
</annotationProcessing>
</component>
</project>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
</component>
</project>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://maven.aliyun.com/repository/public" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

@ -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_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
</component>
</project>

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/target/classes/public/assets/admin" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Spring-5.2.3.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.5.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.5.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.5.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.5.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.5.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.11" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.11" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.24" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.24" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.24" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.24" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.7.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.5.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.11" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.11" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.11" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.3.4.Final" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.7" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:1.5.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:8.5.11" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-juli:8.5.11" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.3.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.2.0" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.2" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:druid:1.0.29" level="project" />
<orderEntry type="module-library">
<library name="Maven: com.alibaba:jconsole:1.8.0">
<CLASSES>
<root url="jar://C:/jdk1.8_64x_v1/jdk1.8/lib/jconsole.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Maven: com.alibaba:tools:1.8.0">
<CLASSES>
<root url="jar://C:/jdk1.8_64x_v1/jdk1.8/lib/tools.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.26" level="project" />
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.11.4" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.1" level="project" />
</component>
</module>

@ -0,0 +1,64 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.score.study</groupId>
<artifactId>StudentScore</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>StudentScore</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<!-- 添加相关依赖 -->
<dependencies>
<!-- 添加web支持的starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- spingBoot整合Mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.2.0</version>
</dependency>
<!-- 数据源 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.29</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
<!-- mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.26</version>
</dependency>
<!-- 好用的分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.3.2</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.1</version>
</dependency>
</dependencies>
<!-- 添加编译和打包的相关插件 -->
<build>
<!-- 添加Spring boot编译插件 -->
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,36 @@
package com.score.bean;
public class ResultObject<T> {
private String code;
private String msg;
private T data;
private Long count;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
}

@ -0,0 +1,170 @@
package com.score.bean;
import java.io.Serializable;
public class TScore implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column t_score.score_id
*
* @mbggenerated
*/
private Integer scoreId;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column t_score.score_value
*
* @mbggenerated
*/
private Integer scoreValue;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column t_score.score_type
*
* @mbggenerated
*/
private String scoreType;
private String scoreTypeName;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column t_score.student_id
*
* @mbggenerated
*/
private Integer studentId;
private String studentName;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table t_score
*
* @mbggenerated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column t_score.score_id
*
* @return the value of t_score.score_id
*
* @mbggenerated
*/
public Integer getScoreId() {
return scoreId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column t_score.score_id
*
* @param scoreId the value for t_score.score_id
*
* @mbggenerated
*/
public void setScoreId(Integer scoreId) {
this.scoreId = scoreId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column t_score.score_value
*
* @return the value of t_score.score_value
*
* @mbggenerated
*/
public Integer getScoreValue() {
return scoreValue;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column t_score.score_value
*
* @param scoreValue the value for t_score.score_value
*
* @mbggenerated
*/
public void setScoreValue(Integer scoreValue) {
this.scoreValue = scoreValue;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column t_score.score_type
*
* @return the value of t_score.score_type
*
* @mbggenerated
*/
public String getScoreType() {
return scoreType;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column t_score.score_type
*
* @param scoreType the value for t_score.score_type
*
* @mbggenerated
*/
public void setScoreType(String scoreType) {
this.scoreType = scoreType == null ? null : scoreType.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column t_score.student_id
*
* @return the value of t_score.student_id
*
* @mbggenerated
*/
public Integer getStudentId() {
return studentId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column t_score.student_id
*
* @param studentId the value for t_score.student_id
*
* @mbggenerated
*/
public void setStudentId(Integer studentId) {
this.studentId = studentId;
}
public String getStudentName() {
return studentName;
}
public void setStudentName(String studentName) {
this.studentName = studentName;
}
public String getScoreTypeName() {
return scoreTypeName;
}
public void setScoreTypeName(String scoreTypeName) {
this.scoreTypeName = scoreTypeName;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_score
*
* @mbggenerated
*/
}

@ -0,0 +1,195 @@
package com.score.bean;
import java.io.Serializable;
public class TStudent implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column t_student.student_no
*
* @mbggenerated
*/
private Integer studentNo;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column t_student.student_name
*
* @mbggenerated
*/
private String studentName;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column t_student.student_sex
*
* @mbggenerated
*/
private String studentSex;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column t_student.del_status
*
* @mbggenerated
*/
private String stuPass;
private double score1;
private double score2;
private double score3;
private double sumScore;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table t_student
*
* @mbggenerated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column t_student.student_no
*
* @return the value of t_student.student_no
*
* @mbggenerated
*/
public Integer getStudentNo() {
return studentNo;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column t_student.student_no
*
* @param studentNo the value for t_student.student_no
*
* @mbggenerated
*/
public void setStudentNo(Integer studentNo) {
this.studentNo = studentNo;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column t_student.student_name
*
* @return the value of t_student.student_name
*
* @mbggenerated
*/
public String getStudentName() {
return studentName;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column t_student.student_name
*
* @param studentName the value for t_student.student_name
*
* @mbggenerated
*/
public void setStudentName(String studentName) {
this.studentName = studentName == null ? null : studentName.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column t_student.student_sex
*
* @return the value of t_student.student_sex
*
* @mbggenerated
*/
public String getStudentSex() {
return studentSex;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column t_student.student_sex
*
* @param studentSex the value for t_student.student_sex
*
* @mbggenerated
*/
public void setStudentSex(String studentSex) {
this.studentSex = studentSex == null ? null : studentSex.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column t_student.del_status
*
* @return the value of t_student.del_status
*
* @mbggenerated
*/
public double getScore1() {
return score1;
}
public String getStuPass() {
return stuPass;
}
public void setStuPass(String stuPass) {
this.stuPass = stuPass;
}
public void setScore1(double score1) {
this.score1 = score1;
}
public double getScore2() {
return score2;
}
public void setScore2(double score2) {
this.score2 = score2;
}
public double getScore3() {
return score3;
}
public void setScore3(double score3) {
this.score3 = score3;
}
public double getSumScore() {
return sumScore;
}
public void setSumScore(double sumScore) {
this.sumScore = sumScore;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_student
*
* @mbggenerated
*/
@Override
public String toString() {
return "TStudent{" +
"studentNo=" + studentNo +
", studentName='" + studentName + '\'' +
", studentSex='" + studentSex + '\'' +
", stuPass='" + stuPass + '\'' +
", score1=" + score1 +
", score2=" + score2 +
", score3=" + score3 +
", sumScore=" + sumScore +
'}';
}
}

@ -0,0 +1,41 @@
package com.score.bean;
import org.springframework.stereotype.Component;
@Component
public class User {
/*用户名称*/
private int userId;
/*用户登录名称*/
private String userName;
/* 用户登录密码 */
private String password;
private String type;
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

@ -0,0 +1,16 @@
package com.score.boot;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication //SpringBoot启动类注解
@EnableAutoConfiguration //开启自动化配置
@ComponentScan("com.score") //类似于Spring的基础类扫描包用来扫描实体接口和控制器
@MapperScan("com.score.dao") //mybatis的接口扫描包
public class StartApplication {
public static void main(String[] args) {
SpringApplication.run(StartApplication.class, args);
}
}

@ -0,0 +1,145 @@
package com.score.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageInfo;
import com.score.bean.ResultObject;
import com.score.bean.TScore;
import com.score.bean.TStudent;
import com.score.service.IScoreService;
import com.score.util.Constant;
@RequestMapping("/score")
@RestController //标识为返回类型为Json的控制
public class ScoreController {
/**
*
*/
@Autowired
private IScoreService scoreService;
//标识请求地址
@RequestMapping("/addScore")
public ResultObject<Object> addScore(TScore score) {
ResultObject<Object> rs=scoreService.insertScore(score);
return rs;
}
//标识请求地址
@RequestMapping("/getAllScore")
public ResultObject<List<TScore>> getAllScore(TScore score,@RequestParam("limit") int limit,@RequestParam("page") int page) {
PageInfo<TScore> pageInfo=scoreService.getAllScore(score,limit, page);
ResultObject<List<TScore>> rs=new ResultObject<List<TScore>>();
List<TScore> list=pageInfo.getList();
for(TScore temp:list) {
String type=temp.getScoreType();
if("1".equals(type)) {
temp.setScoreTypeName("习题");
}
if("2".equals(type)) {
temp.setScoreTypeName("测验");
}
if("3".equals(type)) {
temp.setScoreTypeName("考试成绩");
}
}
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(list);
rs.setCount(pageInfo.getTotal());
return rs;
}
//标识请求地址
@RequestMapping("/updateScore")
public ResultObject<Object> updateScore(TScore score) {
Integer total=scoreService.updateScore(score);
//统一返回
ResultObject<Object> rs=new ResultObject<Object>();
if(null==total||0==total) {
rs.setCode(Constant.FAILURE_RETUEN_CODE);
rs.setMsg("修改学生成绩信息失败");
}else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("修改学生成绩信息成功");
}
return rs;
}
//标识请求地址
@RequestMapping("/deleteScore")
public ResultObject<Object> deleteScore(TScore score) {
Integer total=scoreService.deleteScore(score.getScoreId());
//统一返回
ResultObject<Object> rs=new ResultObject<Object>();
if(null==total||0==total) {
rs.setCode(Constant.FAILURE_RETUEN_CODE);
rs.setMsg("删除学生成绩信息失败");
}else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("删除学生成绩信息成功");
}
return rs;
}
@RequestMapping("/getAllSumScore")
public ResultObject<List<TStudent>> getAllSumScore(TStudent student,@RequestParam("limit") int limit,@RequestParam("page") int page) {
PageInfo<TStudent> pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(pageInfo.getList());
rs.setCount(pageInfo.getTotal());
return rs;
}
//获取我的成绩
@RequestMapping("/getMyScore")
public ResultObject<List<TStudent>> getAllSumScore(HttpServletRequest request,@RequestParam("limit") int limit,@RequestParam("page") int page) {
TStudent student = (TStudent)request.getSession().getAttribute("student");
PageInfo<TStudent> pageInfo =scoreService.getAllFinalScore(student, limit, page);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(pageInfo.getList());
rs.setCount(pageInfo.getTotal());
return rs;
}
@RequestMapping("/getMyScoreInfo")
public ResultObject<List<TScore>> getMyScoreInfo(HttpServletRequest request,@RequestParam("limit") int limit,@RequestParam("page") int page) {
TStudent student = (TStudent)request.getSession().getAttribute("student");
TScore score=new TScore();
score.setStudentId(student.getStudentNo());
PageInfo<TScore> pageInfo=scoreService.getAllScore(score,limit, page);
ResultObject<List<TScore>> rs=new ResultObject<List<TScore>>();
List<TScore> list=pageInfo.getList();
for(TScore temp:list) {
String type=temp.getScoreType();
if("1".equals(type)) {
temp.setScoreTypeName("习题");
}
if("2".equals(type)) {
temp.setScoreTypeName("测验");
}
if("3".equals(type)) {
temp.setScoreTypeName("考试成绩");
}
}
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(list);
rs.setCount(pageInfo.getTotal());
return rs;
}
}

@ -0,0 +1,107 @@
package com.score.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageInfo;
import com.score.bean.ResultObject;
import com.score.bean.TStudent;
import com.score.service.TStudentService;
import com.score.util.Constant;
/**
* @author hmg
*
*/
@RequestMapping("/student")
@RestController //标识为返回类型为Json的控制
public class StudentController {
@Autowired
private TStudentService studentService;
//标识请求地址
@RequestMapping("/getAllStudent")
public ResultObject<List<TStudent>> getUsers(TStudent student,@RequestParam("limit") int limit,@RequestParam("page") int page) {
System.out.println(limit);
PageInfo<TStudent> pageInfo=studentService.getAll(student, page, limit);
System.out.println(pageInfo.getPageNum());
System.out.println(pageInfo.getPageSize()+"-------------1");
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(pageInfo.getList());
rs.setCount(pageInfo.getTotal());
return rs;
}
//标识请求地址
@RequestMapping("/addStudent")
public ResultObject<Object> addStudent(TStudent student) {
Integer studentNo=student.getStudentNo();
student.setStuPass(studentNo.toString());
TStudent result=studentService.selectByNo(studentNo);
//统一返回
ResultObject<Object> rs=new ResultObject<Object>();
if(null==result) {
studentService.addStudent(student);
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("增加学生信息成功");
}else {
rs.setCode(Constant.HASE_RETUEN_CODE);
rs.setMsg("学号已存在");
}
return rs;
}
//标识请求地址
@RequestMapping("/updateStudent")
public ResultObject<Object> updateStudent(TStudent student) {
Integer total=studentService.updateStudent(student);
//统一返回
ResultObject<Object> rs=new ResultObject<Object>();
if(null==total||0==total) {
rs.setCode(Constant.FAILURE_RETUEN_CODE);
rs.setMsg("修改学生信息失败");
}else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("修改学生信息成功");
}
return rs;
}
//标识请求地址
@RequestMapping("/deleteStudent")
public ResultObject<Object> deleteStudent(@RequestParam("studentNo") int studentNo) {
Integer total=studentService.deleteStudent(studentNo);
//统一返回
ResultObject<Object> rs=new ResultObject<Object>();
if(null==total||0==total) {
rs.setCode(Constant.FAILURE_RETUEN_CODE);
rs.setMsg("修改学生信息失败");
}else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("修改学生信息成功");
}
return rs;
}
/**
*
* @return
*/
@RequestMapping("/studentSelect")
public ResultObject<List<TStudent>> studentSelect() {
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
List<TStudent> list=studentService.selectAllStudent();
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("查询成功");
rs.setData(list);
int total=list.size();
Long a=Long.parseLong(String.valueOf(total));
rs.setCount(a);
return rs;
}
}

@ -0,0 +1,104 @@
package com.score.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.score.bean.ResultObject;
import com.score.bean.TStudent;
import com.score.bean.User;
import com.score.service.IUserService;
import com.score.service.TStudentService;
import com.score.util.Constant;
/**
* @author hmg
*
*/
@RequestMapping("/user")
@RestController //标识为返回类型为Json的控制器
public class UserController {
//自动注入服务类
@Autowired
private IUserService userService;
@Autowired
private TStudentService studentService;
//标识请求地址
@RequestMapping("/login")
public ResultObject<List<User>> getUsers(User user,HttpServletRequest request) {
//查询用户列表
List<User> list= userService.getUser(user);
ResultObject<List<User>> rs=new ResultObject<List<User>>();
if(list.isEmpty()) {
//状态码
rs.setCode(Constant.FAILURE_RETUEN_CODE);
//提示
rs.setMsg("登录失败");
}else {
//状态码
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
request.getSession().setAttribute("user", list.get(0));
//提示
rs.setMsg("登录成功");
}
//数据
rs.setData(list);
return rs;
}
@RequestMapping("/loginOut")
public ResultObject<Object> loginOut(HttpServletRequest request) {
//查询用户列表
ResultObject<Object> rs=new ResultObject<Object>();
request.getSession().removeAttribute("user");
//数据
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("退出成功");
return rs;
}
//标识请求地址
@RequestMapping("/studentLogin")
public ResultObject<List<TStudent>> studentLogin(User user,HttpServletRequest request) {
//查询用户列表
TStudent student=new TStudent();
student.setStudentNo(Integer.parseInt(user.getUserName()));
student.setStuPass(user.getPassword());
List<TStudent> list= studentService.selectloginStudent(student);
ResultObject<List<TStudent>> rs=new ResultObject<List<TStudent>>();
if(list.isEmpty()) {
//状态码
rs.setCode(Constant.FAILURE_RETUEN_CODE);
//提示
rs.setMsg("登录失败");
}else {
//状态码
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
request.getSession().setAttribute("student", list.get(0));
//提示
rs.setMsg("登录成功");
}
//数据
rs.setData(list);
return rs;
}
@RequestMapping("/studentloginOut")
public ResultObject<Object> studentloginOut(HttpServletRequest request) {
//查询用户列表
ResultObject<Object> rs=new ResultObject<Object>();
request.getSession().removeAttribute("student");
//数据
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("退出成功");
return rs;
}
}

@ -0,0 +1,48 @@
package com.score.dao;
import com.score.bean.TScore;
import java.util.List;
public interface TScoreMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_score
*
* @mbggenerated
*/
int deleteByPrimaryKey(Integer scoreId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_score
*
* @mbggenerated
*/
int insert(TScore record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_score
*
* @mbggenerated
*/
TScore selectByPrimaryKey(Integer scoreId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_score
*
* @mbggenerated
*/
List<TScore> selectAll(TScore score);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_score
*
* @mbggenerated
*/
int updateByPrimaryKey(TScore record);
//判断类型已经添加了几次
int countByType(TScore record);
}

@ -0,0 +1,62 @@
package com.score.dao;
import com.score.bean.TStudent;
import java.util.List;
import java.util.Map;
public interface TStudentMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_student
*
* @mbggenerated
*/
int deleteByPrimaryKey(Integer studentNo);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_student
*
* @mbggenerated
*/
int insert(TStudent record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_student
*
* @mbggenerated
*/
TStudent selectByPrimaryKey(Integer studentNo);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_student
*
* @mbggenerated
*/
List<TStudent> selectAll(TStudent record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_student
*
* @mbggenerated
*/
int updateByPrimaryKey(TStudent record);
/**
*
* @param student
* @return
*/
Map<String,Object> selectFinalScore(TStudent student);
/**
*
* @param record
* @return
*/
List<TStudent> selectloginStudent(TStudent student);
}

@ -0,0 +1,22 @@
package com.score.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.score.bean.User;
/**
*
* @author hmg
*
*/
@Mapper //标识为mybatis数据层接口
public interface UserDao {
/**
*
* @param user
* @return
*/
List<User> getUser(User user);
}

@ -0,0 +1,34 @@
package com.score.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
/**
*  * 1  
*/
@Controller
public class ErrorInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
/* if (response.getStatus() == 404) {
modelAndView.setViewName("/404.html");
}*/
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
throws Exception {
}
}

@ -0,0 +1,20 @@
package com.score.interceptor;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FilterConfig {
@Bean
public FilterRegistrationBean registFilter() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(new LoginFilter());
registration.addUrlPatterns("/*");
registration.setName("loginFilter");
registration.setOrder(1);
return registration;
}
}

@ -0,0 +1,64 @@
package com.score.interceptor;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.score.util.Constant;
@WebFilter(filterName = "loginFilter", urlPatterns = "/*.html")
public class LoginFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
System.out.println("----------------------->过滤器被创建");
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response=(HttpServletResponse)servletResponse;
String requestURI = request.getRequestURI();
System.out.println("--------------------->过滤器:请求地址"+requestURI);
if(Constant.loginUrl.equals(requestURI)||requestURI.contains(Constant.AESSET)||Constant.LOGIN_URI.equals(requestURI)||Constant.STUDENT_LOGIN_URL.equals(requestURI)) {
filterChain.doFilter(servletRequest, servletResponse);
}else {
if(Constant.STUDENT_INDEX.equals(requestURI)||Constant.MY_SCORE.equals(requestURI)||
Constant.STUDENT_LOGINOUT_URL.equals(requestURI)||Constant.GET_MY_SCORE.equals(requestURI)||
Constant.SCORE.equals(requestURI)||Constant.GET_MY_SCORE_COUNT.equals(requestURI)
) {
Object obj=request.getSession().getAttribute("student");
if(obj==null){
response.sendRedirect("/login.html");
return;
}else {
filterChain.doFilter(servletRequest, servletResponse);
}
}else {
Object obj=request.getSession().getAttribute("user");
if(obj==null){
response.sendRedirect("/login.html");
return;
}else {
filterChain.doFilter(servletRequest, servletResponse);
}
}
}
}
@Override
public void destroy() {
System.out.println("----------------------->过滤器被销毁");
}
}

@ -0,0 +1,17 @@
package com.score.interceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter {
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 多个拦截器组成一个拦截器链
// addPathPatterns 用于添加拦截规则
// excludePathPatterns 用户排除拦截
registry.addInterceptor(new ErrorInterceptor()).addPathPatterns("/**");
super.addInterceptors(registry);
}
}

@ -0,0 +1,52 @@
package com.score.service;
import com.github.pagehelper.PageInfo;
import com.score.bean.ResultObject;
import com.score.bean.TScore;
import com.score.bean.TStudent;
public interface IScoreService {
/**
*
* @param score
* @return
*/
public PageInfo<TScore> getAllScore(TScore score,int limit,int page);
/**
*
* @param score
* @return
*/
public ResultObject<Object> insertScore(TScore score);
/**
*
* @param score
* @return
*/
public Integer updateScore(TScore score);
/**
*
* @param score
* @return
*/
public Integer deleteScore(int scoreId);
/**
*
* @param score
* @return
*/
public TScore selectScoreById(int scoreId);
/**
*
* @param student
* @param limit
* @param page
* @return
*/
public PageInfo<TStudent> getAllFinalScore(TStudent student, int limit, int page);
}

@ -0,0 +1,27 @@
package com.score.service;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.score.bean.User;
/**
*
* @author Yang
*
*/
public interface IUserService {
/**
*
* @return
*/
List<User> getUser(User user);
/**
*
* @param page
* @param size
* @return
*/
PageInfo<User> getUsersLimit(int page,int size);
}

@ -0,0 +1,57 @@
package com.score.service;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.score.bean.TStudent;
public interface TStudentService {
/**
*
* @return
*/
PageInfo<TStudent> getAll(TStudent student,int pageNum,int pageSize);
/**
*
* @return
*/
TStudent selectByNo(int studentNo);
/**
*
* @param student
* @return
*/
Integer addStudent(TStudent student);
/**
*
* @param student
* @return
*/
Integer updateStudent(TStudent student);
/**
*
* @param student
* @return
*/
Integer deleteStudent(int studentNo);
/**
*
* @return
*/
List <TStudent> selectAllStudent();
/**
*
* @param record
* @return
*/
List<TStudent> selectloginStudent(TStudent student);
}

@ -0,0 +1,131 @@
package com.score.service.impl;
import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.score.bean.ResultObject;
import com.score.bean.TScore;
import com.score.bean.TStudent;
import com.score.dao.TScoreMapper;
import com.score.dao.TStudentMapper;
import com.score.service.IScoreService;
import com.score.util.Constant;
@Service
public class SoreServiceImpl implements IScoreService {
@Autowired
private TScoreMapper scoreMapper;
@Autowired
private TStudentMapper studentMapper;
@Override
public PageInfo<TScore> getAllScore(TScore score, int limit, int page) {
// 首先开启PageHelper的分页
PageHelper.startPage(page, limit);
// 查询分页信息 调用方式与普通方式一致
List<TScore> list = scoreMapper.selectAll(score);
// 生成PageInfo对象
PageInfo<TScore> pageInfo = new PageInfo<TScore>(list);
return pageInfo;
}
@Override
public ResultObject<Object> insertScore(TScore score) {
int count = scoreMapper.countByType(score);
String type = score.getScoreType();
boolean flag = true;
String str="";
switch (Integer.parseInt(type)) {
case 1:
if (count >= 16) {
flag = false;
str = "该学生的习题成绩已经达到16条";
}
break;
case 2:
if (count >= 3) {
flag = false;
str = "该学生的测验成绩已经达到3条";
}
break;
case 3:
if (count >= 1) {
flag = false;
str = "该学生的考试成绩已经达到1条";
}
break;
default:
flag = true;
break;
}
// 统一返回
ResultObject<Object> rs = new ResultObject<Object>();
if(flag) {
Integer total = scoreMapper.insert(score);
if (null == total || 0 == total) {
rs.setCode(Constant.HASE_RETUEN_CODE);
rs.setMsg("成绩添加失败");
} else {
rs.setCode(Constant.SUCCESS_RETUEN_CODE);
rs.setMsg("成绩添加成功");
}
}else {
rs.setCode(Constant.HASE_RETUEN_CODE);
rs.setMsg(str);
}
return rs;
}
@Override
public Integer updateScore(TScore score) {
// TODO Auto-generated method stub
return scoreMapper.updateByPrimaryKey(score);
}
@Override
public Integer deleteScore(int scoreId) {
// TODO Auto-generated method stub
return scoreMapper.deleteByPrimaryKey(scoreId);
}
@Override
public TScore selectScoreById(int scoreId) {
// TODO Auto-generated method stub
return scoreMapper.selectByPrimaryKey(scoreId);
}
@Override
public PageInfo<TStudent> getAllFinalScore(TStudent student, int limit, int page) {
// 首先开启PageHelper的分页
PageHelper.startPage(page, limit);
// 查询分页信息 调用方式与普通方式一致
List<TStudent> list = studentMapper.selectAll(student);
for(TStudent temp:list) {
double sum=0;
Map<String,Object> map=studentMapper.selectFinalScore(temp);
DecimalFormat df = new DecimalFormat("#.00");
double score1=Double.parseDouble(map.get("score1").toString());
temp.setScore1(Double.parseDouble(df.format(score1)));
double score2=Double.parseDouble(map.get("score2").toString());
temp.setScore2(Double.parseDouble(df.format(score2)));
double score3=Double.parseDouble(map.get("score3").toString());
temp.setScore3(Double.parseDouble(df.format(score3)));
sum=(score1)+(score2)+(score3);
temp.setSumScore(Double.parseDouble(df.format(sum)));
}
// 生成PageInfo对象
PageInfo<TStudent> pageInfo = new PageInfo<TStudent>(list);
return pageInfo;
}
}

@ -0,0 +1,83 @@
package com.score.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.score.bean.TStudent;
import com.score.dao.TStudentMapper;
import com.score.service.TStudentService;
@Service // 标识为服务类
public class StudentServiceImpl implements TStudentService {
@Autowired
private TStudentMapper studentMapper;
@Override
public PageInfo<TStudent> getAll(TStudent student,int pageNum,int pageSize) {
// 首先开启PageHelper的分页
PageHelper.startPage(pageNum, pageSize);
// 查询分页信息 调用方式与普通方式一致
List<TStudent> list = studentMapper.selectAll(student);
//生成PageInfo对象
PageInfo<TStudent> pageInfo=new PageInfo<TStudent>(list);
return pageInfo;
}
/**
*
* @return
*/
public TStudent selectByNo(int studentNo) {
TStudent student=studentMapper.selectByPrimaryKey(studentNo);
return student;
}
/**
*
* @param student
* @return
*/
public Integer addStudent(TStudent student) {
Integer total=studentMapper.insert(student);
return total;
}
/**
*
* @param student
* @return
*/
public Integer updateStudent(TStudent student) {
Integer total=studentMapper.updateByPrimaryKey(student);
return total;
}
/**
*
* @param student
* @return
*/
public Integer deleteStudent(int studentNo) {
Integer total=studentMapper.deleteByPrimaryKey(studentNo);
return total;
}
/**
*
* @return
*/
public List<TStudent> selectAllStudent(){
return studentMapper.selectAll(null);
}
/**
*
* @param record
* @return
*/
public List<TStudent> selectloginStudent(TStudent student){
return studentMapper.selectloginStudent(student);
}
}

@ -0,0 +1,43 @@
package com.score.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.score.bean.User;
import com.score.dao.UserDao;
import com.score.service.IUserService;
/**
*
* @author hmg
*
*/
@Service //标识为服务类
public class UserServiceImpl implements IUserService {
//注入数据层接口
@Autowired
private UserDao userDao;
public List<User> getUser(User user) {
return userDao.getUser(user);
}
/**
*
* @param page
* @param size
* @return
*/
public PageInfo<User> getUsersLimit(int page,int size){
//首先开启PageHelper的分页
PageHelper.startPage(page, size);
//查询分页信息 调用方式与普通方式一致
List<User> list=userDao.getUser(new User());
//生成PageInfo对象
PageInfo<User> pageInfo=new PageInfo<User>(list);
return pageInfo;
}
}

@ -0,0 +1,26 @@
package com.score.util;
public class Constant {
public static String loginUrl="/login.html";
public static String NULL_URI="/404.html";
public static String STUDENT_INDEX="/student-index.html";
public static String MY_SCORE="/my-score.html";
public static String SCORE="/score.html";
public static String ERROR_URI="/error";
public static String AESSET="/assets/";
public static String LOGIN_URI="/user/login";
//学生登录请求地址
public static String STUDENT_LOGIN_URL="/user/studentLogin";
//学生退出请求地址
public static String STUDENT_LOGINOUT_URL="/user/studentloginOut";
//查询我的总成绩
public static String GET_MY_SCORE_COUNT="/score/getMyScore";
//查询我的成绩
public static String GET_MY_SCORE="/score/getMyScoreInfo";
//统一返回码--成功
public static String SUCCESS_RETUEN_CODE="0";
//统一返回码--失败
public static String FAILURE_RETUEN_CODE="-9999";
//统一返回码--已存在
public static String HASE_RETUEN_CODE="1";
}

@ -0,0 +1,23 @@
#数据库连接池配置
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.platform=mysql
#配置数据源
spring.datasource.url=jdbc:mysql://localhost:3306/score?characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#Mybatis配置
#扫描的实体的包
mybatis.typeAliasesPackage=com.score.bean
#扫描的配置文件地址
mybatis.mapperLocations=classpath:mapper/*.xml
#mybatis.configLocation=classpath:mybatis-config.xml
server.port=8088
#控制台打印SQL语句
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
pagehelper.helper-dialect=mysql
pagehelper.reasonable=true
pagehelper.support-methods-arguments=true
pagehelper.params=count=countSql

@ -0,0 +1,62 @@
<?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.score.dao.TScoreMapper">
<resultMap id="BaseResultMap" type="com.score.bean.TScore">
<id column="score_id" property="scoreId" jdbcType="INTEGER" />
<result column="score_value" property="scoreValue" jdbcType="INTEGER" />
<result column="score_type" property="scoreType" jdbcType="VARCHAR" />
<result column="student_id" property="studentId" jdbcType="INTEGER" />
<result column="student_name" property="studentName" jdbcType="VARCHAR" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from
t_score
where score_id = #{scoreId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.score.bean.TScore">
<selectKey resultType="java.lang.Integer" keyProperty="scoreId"
order="AFTER">
SELECT LAST_INSERT_ID()
</selectKey>
insert into t_score (score_value, score_type, student_id
)
values
(#{scoreValue,jdbcType=INTEGER}, #{scoreType,jdbcType=VARCHAR},
#{studentId,jdbcType=INTEGER}
)
</insert>
<update id="updateByPrimaryKey" parameterType="com.score.bean.TScore">
update t_score
set
score_value = #{scoreValue,jdbcType=INTEGER},
score_type =#{scoreType,jdbcType=VARCHAR},
student_id =#{studentId,jdbcType=INTEGER}
where score_id =#{scoreId,jdbcType=INTEGER}
</update>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select score_id, score_value, score_type, student_id
from t_score
where score_id = #{scoreId,jdbcType=INTEGER}
</select>
<select id="selectAll" resultMap="BaseResultMap" parameterType="com.score.bean.TScore">
select score_id, score_value, score_type, student_id,student_name
from
t_score c LEFT JOIN t_student s ON s.student_no=c.student_id
where 1=1
<if test="studentName !=null and studentName !=''">
and student_name like concat('%',#{studentName},'%')
</if>
<if test="studentId !=null and studentId !=''">
and student_id =#{studentId}
</if>
</select>
<select id="countByType" resultType="java.lang.Integer"
parameterType="com.score.bean.TScore">
select count(1)
from t_score
where score_type=#{scoreType}
and student_id=#{studentId}
</select>
</mapper>

@ -0,0 +1,88 @@
<?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.score.dao.TStudentMapper">
<resultMap id="BaseResultMap" type="com.score.bean.TStudent">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="student_no" jdbcType="INTEGER" property="studentNo" />
<result column="student_name" jdbcType="VARCHAR" property="studentName" />
<result column="student_sex" jdbcType="VARCHAR" property="studentSex" />
<result column="stu_pass" jdbcType="VARCHAR" property="stuPass" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from t_student
where student_no = #{studentNo,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.score.bean.TStudent">
insert into t_student (student_no,student_name, student_sex, stu_pass
)
values (#{studentNo,jdbcType=INTEGER},#{studentName,jdbcType=VARCHAR}, #{studentSex,jdbcType=VARCHAR}, #{stuPass,jdbcType=VARCHAR}
)
</insert>
<update id="updateByPrimaryKey" parameterType="com.score.bean.TStudent">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update t_student
set student_name = #{studentName,jdbcType=VARCHAR},
student_sex = #{studentSex,jdbcType=VARCHAR},
stu_pass = #{stuPass,jdbcType=VARCHAR}
where student_no = #{studentNo,jdbcType=INTEGER}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select student_no, student_name, student_sex, stu_pass
from t_student
where student_no = #{studentNo,jdbcType=INTEGER}
</select>
<select id="selectAll" resultMap="BaseResultMap" parameterType="com.score.bean.TStudent">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select student_no, student_name, student_sex, stu_pass
from t_student
where 1=1
<if test="studentName !=null and studentName !=''">
and student_name like concat('%',#{studentName},'%')
</if>
</select>
<select id="selectFinalScore" parameterType="com.score.bean.TStudent" resultType="java.util.Map">
SELECT IFNULL(a.score,0) score1,IFNULL(b.score,0)
score2,IFNULL(c.score,0) score3 FROM (
SELECT (sum(score_value)) score FROM t_score WHERE score_type='1' AND
student_id=#{studentNo}
)a,
(
SELECT (sum(score_value)) score FROM t_score WHERE score_type='2' AND
student_id=#{studentNo}
) b,
(
SELECT sum(score_value) score FROM t_score WHERE score_type='3' AND
student_id=#{studentNo}
)c
</select>
<select id="selectloginStudent" resultMap="BaseResultMap" parameterType="com.score.bean.TStudent">
select student_no, student_name, student_sex, stu_pass
from t_student
where 1=1
<if test="studentNo !=null and studentNo !=''">
and student_no =#{studentNo}
</if>
<if test="stuPass !=null and stuPass !=''">
and stu_pass =#{stuPass}
</if>
</select>
</mapper>

@ -0,0 +1,16 @@
<?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.score.dao.UserDao">
<!-- 获得用户列表 -->
<select id="getUser" resultType="com.score.bean.User" parameterType="com.score.bean.User">
select user_id userId,user_name userName,pass_word password from t_user
<where>
<if test="userName !=null and userName !=''">
and user_name=#{userName}
</if>
<if test="password !=null and password !=''">
and pass_word=#{password}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,36 @@
<?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>
<plugins>
<!-- com.github.pagehelper为PageHelper类所在包名 -->
<plugin interceptor="com.github.pagehelper.PageHelper">
<!-- 4.0.0以后版本可以不设置该参数 -->
<property name="dialect" value="mysql"/>
<!-- 该参数默认为false -->
<!-- 设置为true时会将RowBounds第一个参数offset当成pageNum页码使用 -->
<!-- 和startPage中的pageNum效果一样-->
<property name="offsetAsPageNum" value="true"/>
<!-- 该参数默认为false -->
<!-- 设置为true时使用RowBounds分页会进行count查询 -->
<property name="rowBoundsWithCount" value="true"/>
<!-- 设置为true时如果pageSize=0或者RowBounds.limit = 0就会查询出全部的结果 -->
<!-- 相当于没有执行分页查询但是返回结果仍然是Page类型-->
<property name="pageSizeZero" value="true"/>
<!-- 3.3.0版本可用 - 分页参数合理化默认false禁用 -->
<!-- 启用合理化时如果pageNum<1会查询第一页如果pageNum>pages会查询最后一页 -->
<!-- 禁用合理化时如果pageNum<1或pageNum>pages会返回空数据 -->
<property name="reasonable" value="false"/>
<!-- 3.5.0版本可用 - 为了支持startPage(Object params)方法 -->
<!-- 增加了一个`params`参数来配置参数映射用于从Map或ServletRequest中取值 -->
<!-- 可以配置pageNum,pageSize,count,pageSizeZero,reasonable,orderBy,不配置映射的用默认值 -->
<!-- 不理解该含义的前提下,不要随便复制该配置 -->
<property name="params" value="pageNum=pageHelperStart;pageSize=pageHelperRows;"/>
<!-- 支持通过Mapper接口参数来传递分页参数 -->
<property name="supportMethodsArguments" value="false"/>
<!-- always总是返回PageInfo类型,check检查返回类型是否为PageInfo,none返回Page -->
<property name="returnPageInfo" value="none"/>
</plugin>
</plugins>
</configuration>

@ -0,0 +1,56 @@
/*3.6.3
Name: mod_avatar
Example: <i class="avatar avatar-L radius"><img src="static/h-ui/images/ucenter/avatar-default.jpg"></i>
*/
.avatar {
display: inline-block;
position: relative;
overflow: hidden;
}
.avatar img {
display: block;
}
.avatar.radius,
.avatar.radius img {
border-radius: 50%;
}
.avatar,
.avatar img {
width: 32px;
height: 32px;
}
.avatar.size-MINI {
width: 16px;
height: 16px;
}
.avatar.size-S,
.avatar.size-S img {
width: 24px;
height: 24px;
}
.avatar.size-M,
.avatar.size-M img {
width: 32px;
height: 32px;
}
/*默认为中,可以不写,可以理解为:均码*/
.avatar.size-L,
.avatar.size-L img {
width: 40px;
height: 40px;
}
.avatar.size-XL,
.avatar.size-XL img {
width: 64px;
height: 64px;
}
.avatar.size-XXL,
.avatar.size-XXL img {
width: 100px;
height: 100px;
}
.avatar.size-XXXL,
.avatar.size-XXXL img {
width: 128px;
height: 128px;
}

@ -0,0 +1,74 @@
.column-wrap {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
height: 100%;
width: 100%;
padding: 0px;
background: #f5f5f5;
overflow-x: hidden;
overflow-y: auto;
}
.iframe-h {
height: 100%;
}
.column-edge {
float: left;
padding-top: 16px;
width: 150px;
height: 100%;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.column-content {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 15px;
background: #f5f5f5;
height: 100%;
overflow-x: hidden;
margin-left: 0px;
}
.column-content-detail {
background: #fff;
padding: 20px;
margin: 0;
}
.page-content {
padding: 0px;
}
.page-content-wrap {
background: #fff;
padding: 20px;
margin: 0;
}
@media (max-width: 600px) {
.layui-nav-no-bg {
background: #fff;
}
.layui-nav-no-bg .layui-nav-item {
border-bottom: 1px solid #f8f8f8;
}
.column-edge {
float: none;
width: 100%;
height: auto;
padding-bottom: 10px;
}
.column-content {
background: #fff;
height: auto;
margin-left: 0px;
}
.layui-tab-content {
padding: 15px 0;
}
.layui-form-label {
padding: 9px 0px;
}
.layui-input-block {
margin-left: 80px;
}
}

@ -0,0 +1,90 @@
.commentList .item {
list-style: none outside none;
margin: 1.6rem 0 0;
}
.commentList .avatar {
border: 1px solid transparent;
float: left;
}
.comment-main {
position: relative;
margin-left: 64px;
border: 1px solid #dedede;
border-radius: 2px;
}
.comment-main:after,
.comment-main:before {
position: absolute;
top: 11px;
left: -16px;
right: 100%;
width: 0;
height: 0;
display: block;
content: " ";
border-color: transparent;
border-style: solid solid outset;
pointer-events: none;
}
.comment-main:before {
border-right-color: #dedede;
border-width: 8px;
}
.comment-main:after {
border-width: 7px;
border-right-color: #f8f8f8;
margin-top: 1px;
margin-left: 2px;
}
.comment-header {
padding: 10px 15px;
background: #f8f8f8;
border-bottom: 1px solid #eee;
}
.comment-title {
margin: 0 0 8px;
font-size: 1.6rem;
line-height: 1.2;
}
.comment-meta {
font-size: 13px;
color: #999;
line-height: 1.2;
}
.comment-meta a {
color: #999;
}
.comment-author {
font-weight: 700;
color: #999;
}
.comment-body {
padding: 15px;
overflow: hidden;
}
.comment-body > :last-child {
margin-bottom: 0;
}
.commentList .comment-flip .avatar {
float: right;
}
.comment-flip .comment-main {
margin-left: 0;
margin-right: 64px;
}
.comment-flip .comment-main:before {
border-left-color: #dedede;
border-right-color: transparent;
}
.comment-flip .comment-main:after,
.comment-flip .comment-main:before {
left: 100%;
position: absolute;
right: -16px;
}
.comment-flip .comment-main:after {
border-left-color: #f8f8f8;
border-right-color: transparent;
margin-left: auto;
margin-right: 2px;
}

@ -0,0 +1,5 @@
/*圆角*/
/*阴影*/
/*字体*/
/*动画属性*/
/*清楚浮动*/

@ -0,0 +1,154 @@
.email-wrap {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
height: 100%;
width: 100%;
padding: 15px;
background: #f5f5f5;
overflow-x: hidden;
overflow-y: auto;
}
.email-wrap .email-write-btn {
width: 100%;
}
.email-wrap .email-folder {
padding-top: 20px;
}
.email-wrap .email-folder dt {
font-size: 14px;
font-weight: bold;
color: #333;
line-height: 32px;
}
.email-wrap .email-folder dd {
font-size: 12px;
color: #545454;
line-height: 32px;
border-bottom: 1px solid #eee;
}
.email-wrap .email-folder dd button {
margin-top: 4px;
}
.email-wrap .email-folder dd .iconfont,
.email-wrap .email-folder dd .layui-icon {
float: left;
padding-right: 10px;
font-size: 16px;
}
.email-wrap .email-classify {
padding-top: 20px;
}
.email-wrap .email-classify dt {
font-size: 14px;
font-weight: bold;
color: #333;
line-height: 32px;
}
.email-wrap .email-classify dd {
font-size: 12px;
color: #545454;
line-height: 32px;
}
.email-wrap .email-classify dd .iconfont,
.email-wrap .email-classify dd .layui-icon {
float: left;
padding-right: 10px;
font-size: 14px;
}
.email-wrap .email-classify dd .icon-blue {
color: #01AAED;
}
.email-wrap .email-classify dd .icon-green {
color: #009688;
}
.email-wrap .email-classify dd .icon-wran {
color: #F7B824;
}
.email-wrap .email-classify dd .icon-red {
color: #FF5722;
}
.email-wrap .email-classify dd .icon-gray {
color: #2F4056;
}
.email-wrap .email-label {
padding-top: 20px;
padding-bottom: 20px;
}
.email-wrap .email-label dt {
font-size: 14px;
font-weight: bold;
color: #333;
line-height: 32px;
}
.email-wrap .email-label .layui-btn {
margin-bottom: 10px;
}
.email-wrap .email-label .layui-btn + .layui-btn {
margin-left: 0;
margin-right: 0;
}
.email-wrap .email-content {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
background: #fff;
height: 100%;
width: 100%;
overflow: auto;
padding: 15px;
overflow: hidden;
}
.iframe-h {
height: 100%;
}
.email-write {
padding: 15px;
}
.email-write .layui-btn {
margin-bottom: 10px;
}
.email-content-title {
padding: 15px;
}
.email-content-title .write-title {
font-size: 20px;
}
.email-tool-btn {
margin-top: 3px;
}
.email-tool-btn .layui-form-item {
margin: 0;
}
.email-tool-btn .layui-form-item .layui-inline {
margin-bottom: 0;
}
.email-tool-btn .email-tool-btn-right {
text-align: right;
}
.email-list {
padding: 0 15px;
}
@media (max-width: 768px) {
.email-wrap .email-content {
padding: 0;
}
.email-write {
padding: 15px;
}
.email-write .layui-btn {
width: 100%;
margin: 0 0 10px;
}
.email-tool-btn .email-tool-btn-right {
text-align: left;
}
.email-tool-btn-left,
.email-tool-btn-right {
padding-bottom: 10px;
}
.email-tool-btn-left .layui-inline,
.email-tool-btn-right .layui-inline {
padding-bottom: 10px;
}
}

@ -0,0 +1,89 @@
html {
height: 100%;
overflow: hidden;
}
body {
background: url("../images/login/login_line.jpg") left center repeat-x;
height: 100%;
}
/*移除表单填充色*/
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px #ececec inset;
}
/*按钮移上去颜色*/
.layui-btn-primary:hover {
border-color: #1E9FFF;
color: #333;
}
/*页面背景色*/
.m-login-bg {
background: url("../images/login/login_bg.png") left center repeat-x;
height: 100%;
}
.m-login {
width: 390px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -195px;
margin-top: -205px;
}
.m-login h3 {
color: #fff;
text-align: center;
height: 60px;
font-size: 28px;
}
.m-login .copyright {
text-align: center;
color: #999;
padding-top: 10px;
}
.m-login-warp {
background: #fff;
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
-webkit-border-radius: 6px;
border-radius: 6px;
padding: 25px;
}
.m-login-warp .layui-input {
height: 40px;
line-height: 40px\9;
margin-bottom: 5px;
-webkit-transition-property: none;
transition-property: none;
background: #ececec;
border: 1px solid #ececec;
}
.m-login-warp .m-login-btn .layui-inline {
width: 49%;
margin: 0;
}
.m-login-warp .m-login-btn .layui-inline button {
width: 100%;
}
.m-login-warp .verifyImg {
width: 130px;
height: 42px;
}
@media screen and (max-width: 450px) {
.m-login {
width: 300px;
position: absolute;
left: 50%;
top: 50%;
margin-left: -150px;
margin-top: -240px;
}
.layui-form-item .layui-inline {
display: block;
margin-right: 0;
margin-bottom: 20px;
clear: both;
}
.m-login-warp .m-login-btn .layui-inline {
width: 100%;
margin: 0 0 10px;
}
}

@ -0,0 +1,44 @@
.page-wrap {
text-align: center;
}
.pagination {
display: inline-block;
*display: inline;
*zoom: 1;
text-align: center;
margin: 10px 0;
font-size: 0;
}
.pagination li {
position: relative;
display: inline-block;
*display: inline;
*zoom: 1;
border: 1px solid #e2e2e2;
width: 28px;
height: 28px;
line-height: 28px;
margin: 0 -1px 5px 0;
background-color: #fff;
color: #333;
font-size: 12px;
text-align: center;
}
.pagination li a {
display: block;
width: 100%;
height: 100%;
}
.pagination li.active {
border: 1px solid #1E9FFF;
}
.pagination li.active span {
display: block;
width: 100%;
height: 100%;
background-color: #1E9FFF;
color: #fff;
}
.pagination li.disabled {
background: #f2f2f2;
}

@ -0,0 +1,75 @@
.panel {
background-color: #fff;
border: solid 1px transparent;
}
.panel-header {
border-bottom: solid 1px transparent;
padding: 8px 15px;
font-size: 14px;
font-weight: 700;
}
/*面板标题*/
.panel-body {
padding: 15px;
}
/*面板内容*/
.panel-footer {
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding: 5px 20px;
}
/*面板页脚*/
/*默认面板*/
.panel-default {
border-color: #dddddd;
}
.panel-default > .panel-header {
border-color: #ddd;
background-color: #f5f5f5;
color: #444444;
}
/*主要面板*/
.panel-primary {
border-color: #5a98de;
}
.panel-primary > .panel-header {
border-color: #5a98de;
background-color: #5a98de;
color: #ffffff;
}
/*次要面板*/
.panel-secondary {
border-color: #3bb4f2;
}
.panel-secondary > .panel-header {
border-color: #3bb4f2;
background-color: #3bb4f2;
color: #ffffff;
}
/*成功面板*/
.panel-success {
border-color: #5eb95e;
}
.panel-success > .panel-header {
border-color: #5eb95e;
background-color: #5eb95e;
color: #ffffff;
}
/*警告面板*/
.panel-warning {
border-color: #f37b1d;
}
.panel-warning > .panel-header {
border-color: #f37b1d;
background-color: #f37b1d;
color: #ffffff;
}
/*危险面板*/
.panel-danger {
border-color: #dd514c;
}
.panel-danger > .panel-header {
border-color: #dd514c;
background-color: #dd514c;
color: #ffffff;
}

@ -0,0 +1,117 @@
/*圆角*/
/*阴影*/
/*字体*/
/*动画属性*/
/*清楚浮动*/
.f-l {
float: left;
}
.f-r {
float: right;
}
@font-face {
font-family: 'iconfont';
src: url('../fonts//iconfont.eot');
src: url('../fonts//iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('../fonts//iconfont.woff') format('woff'), /* Modern Browsers */ url('../fonts//iconfont.ttf') format('truetype'), /* Safari, Android, iOS */ url('../fonts//iconfont.svg#svgFontName') format('svg');
/* IE9 Compat Modes */
/* Legacy iOS */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.panel-default {
border-color: #ebeaea;
}
.panel-default .panel-header {
border-color: transparent;
background-color: #fff;
color: #555555;
}
.panel-header {
border-bottom: solid 1px transparent;
padding: 8px 15px;
font-size: 16px;
font-weight: normal;
}
.layui-form-select dl dd.layui-this {
background: #f2f2f2;
color: #333;
}
.layui-btn-primary:hover {
border-color: #00b5f9;
color: #333;
}
.layui-tab-bar {
position: absolute;
right: 3px;
top: 3px;
z-index: 10;
width: 30px;
height: 30px;
line-height: 30px;
border: 1px solid #e2e2e2;
border-radius: 2px;
background-color: #fff;
}
.layui-elem-quote {
border-left: 5px solid #00b5f9;
}
/*清楚浮动*/
.clearfix {
zoom: 1;
}
.clearfix:after {
display: block;
content: '';
clear: both;
}
.layui-nav-no-bg {
background: transparent;
width: auto;
}
.layui-nav-no-bg.layui-nav-tree .layui-nav-item a:hover {
background-color: transparent;
color: #00b5f9;
}
.layui-nav-no-bg.layui-nav .layui-nav-item a {
color: #333;
}
.layui-nav-no-bg .layui-nav-itemed > a,
.layui-nav-no-bg .layui-nav-tree .layui-nav-title a,
.layui-nav-no-bg .layui-nav-tree .layui-nav-title a:hover {
background: transparent!important;
color: #333!important;
}
.layui-nav-no-bg.layui-nav-tree .layui-nav-child a {
height: 40px;
line-height: 40px;
text-indent: 10px;
color: #666;
}
.layui-nav-no-bg.layui-nav-tree .layui-nav-child dd.layui-this,
.layui-nav-no-bg.layui-nav-tree .layui-this,
.layui-nav-no-bg.layui-nav-tree .layui-this > a:hover {
background-color: #fff;
color: #00b5f9;
}
.layui-nav-no-bg.layui-nav-tree .layui-this > a {
background-color: #fff;
color: #00b5f9;
border-left: 3px solid #00b5f9;
margin-right: -20px;
}
.layui-nav-no-bg .layui-nav-bar {
display: none;
}
.showSubBtn {
width: 16px;
height: 16px;
line-height: 16px;
margin-left: 5px;
}

@ -0,0 +1,370 @@
*{margin: 0;padding: 0;list-style: none;}
/*
KISSY CSS Reset
1. reset
2. reset
3. reset 使
1. 2.
<lifesinger@gmail.com>, <ragecarrier@gmail.com>
*/
/** 清除内外边距 **/
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */
dl, dt, dd, ul, ol, li, /* list elements 列表元素 */
pre, /* text formatting elements 文本格式元素 */
form, fieldset, legend, button, input, textarea, /* form elements 表单元素 */
th, td /* table elements 表格元素 */ {
margin: 0;
padding: 0;
}
/** 设置默认字体 **/
body,
button, input, select, textarea /* for ie */ {
font: 12px/1.5 tahoma, arial, \5b8b\4f53, sans-serif;
}
h1, h2, h3, h4, h5, h6 { font-size: 100%; }
address, cite, dfn, em, var { font-style: normal; } /* 将斜体扶正 */
code, kbd, pre, samp { font-family: courier new, courier, monospace; } /* 统一等宽字体 */
small { font-size: 12px; } /* 小于 12px 的中文很难阅读,让 small 正常化 */
/** 重置列表元素 **/
ul, ol { list-style: none; }
/** 重置文本格式元素 **/
a { text-decoration: none; }
a:hover { text-decoration: underline; }
/** 重置表单元素 **/
legend { color: #000; } /* for ie6 */
fieldset, img { border: 0; } /* img 搭车:让链接里的 img 无边框 */
button, input, select, textarea { font-size: 100%; } /* 使得表单元素在 ie 下能继承字体大小 */
/* 注optgroup 无法扶正 */
/** 重置表格元素 **/
table { border-collapse: collapse; border-spacing: 0; }
/* 清除浮动 */
.ks-clear:after, .clear:after {
content: '\20';
display: block;
height: 0;
clear: both;
}
.ks-clear, .clear {
*zoom: 1;
}
.main {
padding: 30px 100px;
width: 960px;
margin: 0 auto;
}
.main h1{font-size:36px; color:#333; text-align:left;margin-bottom:30px; border-bottom: 1px solid #eee;}
.helps{margin-top:40px;}
.helps pre{
padding:20px;
margin:10px 0;
border:solid 1px #e7e1cd;
background-color: #fffdef;
overflow: auto;
}
.icon_lists{
width: 100% !important;
}
.icon_lists li{
float:left;
width: 100px;
height:180px;
text-align: center;
list-style: none !important;
}
.icon_lists .icon{
font-size: 42px;
line-height: 100px;
margin: 10px 0;
color:#333;
-webkit-transition: font-size 0.25s ease-out 0s;
-moz-transition: font-size 0.25s ease-out 0s;
transition: font-size 0.25s ease-out 0s;
}
.icon_lists .icon:hover{
font-size: 100px;
}
.markdown {
color: #666;
font-size: 14px;
line-height: 1.8;
}
.highlight {
line-height: 1.5;
}
.markdown img {
vertical-align: middle;
max-width: 100%;
}
.markdown h1 {
color: #404040;
font-weight: 500;
line-height: 40px;
margin-bottom: 24px;
}
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
color: #404040;
margin: 1.6em 0 0.6em 0;
font-weight: 500;
clear: both;
}
.markdown h1 {
font-size: 28px;
}
.markdown h2 {
font-size: 22px;
}
.markdown h3 {
font-size: 16px;
}
.markdown h4 {
font-size: 14px;
}
.markdown h5 {
font-size: 12px;
}
.markdown h6 {
font-size: 12px;
}
.markdown hr {
height: 1px;
border: 0;
background: #e9e9e9;
margin: 16px 0;
clear: both;
}
.markdown p,
.markdown pre {
margin: 1em 0;
}
.markdown > p,
.markdown > blockquote,
.markdown > .highlight,
.markdown > ol,
.markdown > ul {
width: 80%;
}
.markdown ul > li {
list-style: circle;
}
.markdown > ul li,
.markdown blockquote ul > li {
margin-left: 20px;
padding-left: 4px;
}
.markdown > ul li p,
.markdown > ol li p {
margin: 0.6em 0;
}
.markdown ol > li {
list-style: decimal;
}
.markdown > ol li,
.markdown blockquote ol > li {
margin-left: 20px;
padding-left: 4px;
}
.markdown code {
margin: 0 3px;
padding: 0 5px;
background: #eee;
border-radius: 3px;
}
.markdown pre {
border-radius: 6px;
background: #f7f7f7;
padding: 20px;
}
.markdown pre code {
border: none;
background: #f7f7f7;
margin: 0;
}
.markdown strong,
.markdown b {
font-weight: 600;
}
.markdown > table {
border-collapse: collapse;
border-spacing: 0px;
empty-cells: show;
border: 1px solid #e9e9e9;
width: 95%;
margin-bottom: 24px;
}
.markdown > table th {
white-space: nowrap;
color: #333;
font-weight: 600;
}
.markdown > table th,
.markdown > table td {
border: 1px solid #e9e9e9;
padding: 8px 16px;
text-align: left;
}
.markdown > table th {
background: #F7F7F7;
}
.markdown blockquote {
font-size: 90%;
color: #999;
border-left: 4px solid #e9e9e9;
padding-left: 0.8em;
margin: 1em 0;
font-style: italic;
}
.markdown blockquote p {
margin: 0;
}
.markdown .anchor {
opacity: 0;
transition: opacity 0.3s ease;
margin-left: 8px;
}
.markdown .waiting {
color: #ccc;
}
.markdown h1:hover .anchor,
.markdown h2:hover .anchor,
.markdown h3:hover .anchor,
.markdown h4:hover .anchor,
.markdown h5:hover .anchor,
.markdown h6:hover .anchor {
opacity: 1;
display: inline-block;
}
.markdown > br,
.markdown > p > br {
clear: both;
}
.hljs {
display: block;
background: white;
padding: 0.5em;
color: #333333;
overflow-x: auto;
}
.hljs-comment,
.hljs-meta {
color: #969896;
}
.hljs-string,
.hljs-variable,
.hljs-template-variable,
.hljs-strong,
.hljs-emphasis,
.hljs-quote {
color: #df5000;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-type {
color: #a71d5d;
}
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-attribute {
color: #0086b3;
}
.hljs-section,
.hljs-name {
color: #63a35c;
}
.hljs-tag {
color: #333333;
}
.hljs-title,
.hljs-attr,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #795da3;
}
.hljs-addition {
color: #55a532;
background-color: #eaffea;
}
.hljs-deletion {
color: #bd2c00;
background-color: #ffecec;
}
.hljs-link {
text-decoration: underline;
}
pre{
background: #fff;
}

@ -0,0 +1,151 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>IconFont</title>
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="iconfont.css">
</head>
<body>
<div class="main">
<h1>IconFont 图标</h1>
<ul class="icon_lists clear">
<li>
<i class="icon iconfont">&#xe60d;</i>
<div class="name">刷新</div>
<div class="code">&amp;#xe60d;</div>
<div class="fontclass">.shuaxin</div>
</li>
<li>
<i class="icon iconfont">&#xe600;</i>
<div class="name">数据库</div>
<div class="code">&amp;#xe600;</div>
<div class="fontclass">.shujuku</div>
</li>
<li>
<i class="icon iconfont">&#xe601;</i>
<div class="name">删除</div>
<div class="code">&amp;#xe601;</div>
<div class="fontclass">.shanchu</div>
</li>
<li>
<i class="icon iconfont">&#xe602;</i>
<div class="name">文章</div>
<div class="code">&amp;#xe602;</div>
<div class="fontclass">.wenzhang</div>
</li>
<li>
<i class="icon iconfont">&#xe60c;</i>
<div class="name">链接</div>
<div class="code">&amp;#xe60c;</div>
<div class="fontclass">.lianjie</div>
</li>
<li>
<i class="icon iconfont">&#xe60e;</i>
<div class="name">菜单</div>
<div class="code">&amp;#xe60e;</div>
<div class="fontclass">.caidan</div>
</li>
<li>
<i class="icon iconfont">&#xe603;</i>
<div class="name">邮件</div>
<div class="code">&amp;#xe603;</div>
<div class="fontclass">.youjian</div>
</li>
<li>
<i class="icon iconfont">&#xe604;</i>
<div class="name">推荐</div>
<div class="code">&amp;#xe604;</div>
<div class="fontclass">.tuijian</div>
</li>
<li>
<i class="icon iconfont">&#xe605;</i>
<div class="name">评论 </div>
<div class="code">&amp;#xe605;</div>
<div class="fontclass">.msg</div>
</li>
<li>
<i class="icon iconfont">&#xe606;</i>
<div class="name">头像</div>
<div class="code">&amp;#xe606;</div>
<div class="fontclass">.userpro</div>
</li>
<li>
<i class="icon iconfont">&#xe607;</i>
<div class="name">类目链接</div>
<div class="code">&amp;#xe607;</div>
<div class="fontclass">.leimulianjie</div>
</li>
<li>
<i class="icon iconfont">&#xe608;</i>
<div class="name">名单</div>
<div class="code">&amp;#xe608;</div>
<div class="fontclass">.list</div>
</li>
<li>
<i class="icon iconfont">&#xe609;</i>
<div class="name">提醒</div>
<div class="code">&amp;#xe609;</div>
<div class="fontclass">.remind</div>
</li>
<li>
<i class="icon iconfont">&#xe60a;</i>
<div class="name">密码</div>
<div class="code">&amp;#xe60a;</div>
<div class="fontclass">.Password</div>
</li>
<li>
<i class="icon iconfont">&#xe60b;</i>
<div class="name">设置</div>
<div class="code">&amp;#xe60b;</div>
<div class="fontclass">.Setup</div>
</li>
</ul>
<div class="helps">
第一步使用font-face声明字体
<pre>
@font-face {font-family: 'iconfont';
src: url('iconfont.eot'); /* IE9*/
src: url('iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('iconfont.woff') format('woff'), /* chrome、firefox */
url('iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
url('iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
}
</pre>
第二步定义使用iconfont的样式
<pre>
.iconfont{
font-family:"iconfont" !important;
font-size:16px;font-style:normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;}
</pre>
第三步:挑选相应图标并获取字体编码,应用于页面
<pre>
&lt;i class="iconfont"&gt;&amp;#x33;&lt;/i&gt;
</pre>
</div>
</div>
</body>
</html>

@ -0,0 +1,154 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>IconFont</title>
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="iconfont.css">
</head>
<body>
<div class="main markdown">
<h1>IconFont 图标</h1>
<ul class="icon_lists clear">
<li>
<i class="icon iconfont icon-shuaxin"></i>
<div class="name">刷新</div>
<div class="fontclass">.icon-shuaxin</div>
</li>
<li>
<i class="icon iconfont icon-shujuku"></i>
<div class="name">数据库</div>
<div class="fontclass">.icon-shujuku</div>
</li>
<li>
<i class="icon iconfont icon-shanchu"></i>
<div class="name">删除</div>
<div class="fontclass">.icon-shanchu</div>
</li>
<li>
<i class="icon iconfont icon-wenzhang"></i>
<div class="name">文章</div>
<div class="fontclass">.icon-wenzhang</div>
</li>
<li>
<i class="icon iconfont icon-lianjie"></i>
<div class="name">链接</div>
<div class="fontclass">.icon-lianjie</div>
</li>
<li>
<i class="icon iconfont icon-caidan"></i>
<div class="name">菜单</div>
<div class="fontclass">.icon-caidan</div>
</li>
<li>
<i class="icon iconfont icon-youjian"></i>
<div class="name">邮件</div>
<div class="fontclass">.icon-youjian</div>
</li>
<li>
<i class="icon iconfont icon-tuijian"></i>
<div class="name">推荐</div>
<div class="fontclass">.icon-tuijian</div>
</li>
<li>
<i class="icon iconfont icon-msg"></i>
<div class="name">评论 </div>
<div class="fontclass">.icon-msg</div>
</li>
<li>
<i class="icon iconfont icon-userpro"></i>
<div class="name">头像</div>
<div class="fontclass">.icon-userpro</div>
</li>
<li>
<i class="icon iconfont icon-leimulianjie"></i>
<div class="name">类目链接</div>
<div class="fontclass">.icon-leimulianjie</div>
</li>
<li>
<i class="icon iconfont icon-list"></i>
<div class="name">名单</div>
<div class="fontclass">.icon-list</div>
</li>
<li>
<i class="icon iconfont icon-remind"></i>
<div class="name">提醒</div>
<div class="fontclass">.icon-remind</div>
</li>
<li>
<i class="icon iconfont icon-Password"></i>
<div class="name">密码</div>
<div class="fontclass">.icon-Password</div>
</li>
<li>
<i class="icon iconfont icon-Setup"></i>
<div class="name">设置</div>
<div class="fontclass">.icon-Setup</div>
</li>
<li>
<i class="icon iconfont icon-shangsheng"></i>
<div class="name">上升</div>
<div class="fontclass">.icon-shangsheng</div>
</li>
<li>
<i class="icon iconfont icon-fajianxiang"></i>
<div class="name">发件箱</div>
<div class="fontclass">.icon-fajianxiang</div>
</li>
<li>
<i class="icon iconfont icon-xiajiang"></i>
<div class="name">上升</div>
<div class="fontclass">.icon-xiajiang</div>
</li>
<li>
<i class="icon iconfont icon-paixu"></i>
<div class="name">排序</div>
<div class="fontclass">.icon-paixu</div>
</li>
</ul>
<h2 id="font-class-">font-class引用</h2>
<hr>
<p>font-class是unicode使用方式的一种变种主要是解决unicode书写不直观语意不明确的问题。</p>
<p>与unicode使用方式相比具有如下特点</p>
<ul>
<li>兼容性良好支持ie8+,及所有现代浏览器。</li>
<li>相比于unicode语意明确书写更直观。可以很容易分辨这个icon是什么。</li>
<li>因为使用class来定义图标所以当要替换图标时只需要修改class里面的unicode引用。</li>
<li>不过因为本质上还是使用的字体,所以多色图标还是不支持的。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-fontclass-">第一步引入项目下面生成的fontclass代码</h3>
<pre><code class="lang-js hljs javascript"><span class="hljs-comment">&lt;link rel="stylesheet" type="text/css" href="./iconfont.css"&gt;</span></code></pre>
<h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="lang-css hljs">&lt;<span class="hljs-selector-tag">i</span> <span class="hljs-selector-tag">class</span>="<span class="hljs-selector-tag">iconfont</span> <span class="hljs-selector-tag">icon-xxx</span>"&gt;&lt;/<span class="hljs-selector-tag">i</span>&gt;</code></pre>
<blockquote>
<p>"iconfont"是你项目下的font-family。可以通过编辑项目查看默认是"iconfont"。</p>
</blockquote>
</div>
</body>
</html>

@ -0,0 +1,215 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>IconFont</title>
<link rel="stylesheet" href="demo.css">
<script src="iconfont.js"></script>
<style type="text/css">
.icon {
/* 通过设置 font-size 来改变图标大小 */
width: 1em; height: 1em;
/* 图标和文字相邻时,垂直对齐 */
vertical-align: -0.15em;
/* 通过设置 color 来改变 SVG 的颜色/fill */
fill: currentColor;
/* path 和 stroke 溢出 viewBox 部分在 IE 下会显示
normalize.css 中也包含这行 */
overflow: hidden;
}
</style>
</head>
<body>
<div class="main markdown">
<h1>IconFont 图标</h1>
<ul class="icon_lists clear">
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-shuaxin"></use>
</svg>
<div class="name">刷新</div>
<div class="fontclass">#icon-shuaxin</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-shujuku"></use>
</svg>
<div class="name">数据库</div>
<div class="fontclass">#icon-shujuku</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-shanchu"></use>
</svg>
<div class="name">删除</div>
<div class="fontclass">#icon-shanchu</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-wenzhang"></use>
</svg>
<div class="name">文章</div>
<div class="fontclass">#icon-wenzhang</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-lianjie"></use>
</svg>
<div class="name">链接</div>
<div class="fontclass">#icon-lianjie</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-caidan"></use>
</svg>
<div class="name">菜单</div>
<div class="fontclass">#icon-caidan</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-youjian"></use>
</svg>
<div class="name">邮件</div>
<div class="fontclass">#icon-youjian</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-tuijian"></use>
</svg>
<div class="name">推荐</div>
<div class="fontclass">#icon-tuijian</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-msg"></use>
</svg>
<div class="name">评论 </div>
<div class="fontclass">#icon-msg</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-userpro"></use>
</svg>
<div class="name">头像</div>
<div class="fontclass">#icon-userpro</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-leimulianjie"></use>
</svg>
<div class="name">类目链接</div>
<div class="fontclass">#icon-leimulianjie</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-list"></use>
</svg>
<div class="name">名单</div>
<div class="fontclass">#icon-list</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-remind"></use>
</svg>
<div class="name">提醒</div>
<div class="fontclass">#icon-remind</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-Password"></use>
</svg>
<div class="name">密码</div>
<div class="fontclass">#icon-Password</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-Setup"></use>
</svg>
<div class="name">设置</div>
<div class="fontclass">#icon-Setup</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-shangsheng"></use>
</svg>
<div class="name">上升</div>
<div class="fontclass">#icon-shangsheng</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-fajianxiang"></use>
</svg>
<div class="name">发件箱</div>
<div class="fontclass">#icon-fajianxiang</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-xiajiang"></use>
</svg>
<div class="name">上升</div>
<div class="fontclass">#icon-xiajiang</div>
</li>
<li>
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-paixu"></use>
</svg>
<div class="name">排序</div>
<div class="fontclass">#icon-paixu</div>
</li>
</ul>
<h2 id="symbol-">symbol引用</h2>
<hr>
<p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
这种用法其实是做了一个svg的集合与另外两种相比具有如下特点</p>
<ul>
<li>支持多色图标了,不再受单色限制。</li>
<li>通过一些技巧,支持像字体那样,通过<code>font-size</code>,<code>color</code>来调整样式。</li>
<li>兼容性较差,支持 ie9+,及现代浏览器。</li>
<li>浏览器渲染svg的性能一般还不如png。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-symbol-">第一步引入项目下面生成的symbol代码</h3>
<pre><code class="lang-js hljs javascript"><span class="hljs-comment">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;</span></code></pre>
<h3 id="-css-">第二步加入通用css代码引入一次就行</h3>
<pre><code class="lang-js hljs javascript">&lt;style type=<span class="hljs-string">"text/css"</span>&gt;
.icon {
width: <span class="hljs-number">1</span>em; height: <span class="hljs-number">1</span>em;
vertical-align: <span class="hljs-number">-0.15</span>em;
fill: currentColor;
overflow: hidden;
}
&lt;<span class="hljs-regexp">/style&gt;</span></code></pre>
<h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="lang-js hljs javascript">&lt;svg <span class="hljs-class"><span class="hljs-keyword">class</span></span>=<span class="hljs-string">"icon"</span> aria-hidden=<span class="hljs-string">"true"</span>&gt;<span class="xml"><span class="hljs-tag">
&lt;<span class="hljs-name">use</span> <span class="hljs-attr">xlink:href</span>=<span class="hljs-string">"#icon-xxx"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">use</span>&gt;</span>
</span>&lt;<span class="hljs-regexp">/svg&gt;
</span></code></pre>
</div>
</body>
</html>

@ -0,0 +1,192 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>IconFont</title>
<link rel="stylesheet" href="demo.css">
<style type="text/css">
@font-face {font-family: "iconfont";
src: url('iconfont.eot'); /* IE9*/
src: url('iconfont.eot#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('iconfont.woff') format('woff'), /* chrome, firefox */
url('iconfont.ttf') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family:"iconfont" !important;
font-size:16px;
font-style:normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
</style>
</head>
<body>
<div class="main markdown">
<h1>IconFont 图标</h1>
<ul class="icon_lists clear">
<li>
<i class="icon iconfont">&#xe60d;</i>
<div class="name">刷新</div>
<div class="code">&amp;#xe60d;</div>
</li>
<li>
<i class="icon iconfont">&#xe600;</i>
<div class="name">数据库</div>
<div class="code">&amp;#xe600;</div>
</li>
<li>
<i class="icon iconfont">&#xe601;</i>
<div class="name">删除</div>
<div class="code">&amp;#xe601;</div>
</li>
<li>
<i class="icon iconfont">&#xe602;</i>
<div class="name">文章</div>
<div class="code">&amp;#xe602;</div>
</li>
<li>
<i class="icon iconfont">&#xe60c;</i>
<div class="name">链接</div>
<div class="code">&amp;#xe60c;</div>
</li>
<li>
<i class="icon iconfont">&#xe60e;</i>
<div class="name">菜单</div>
<div class="code">&amp;#xe60e;</div>
</li>
<li>
<i class="icon iconfont">&#xe603;</i>
<div class="name">邮件</div>
<div class="code">&amp;#xe603;</div>
</li>
<li>
<i class="icon iconfont">&#xe604;</i>
<div class="name">推荐</div>
<div class="code">&amp;#xe604;</div>
</li>
<li>
<i class="icon iconfont">&#xe605;</i>
<div class="name">评论 </div>
<div class="code">&amp;#xe605;</div>
</li>
<li>
<i class="icon iconfont">&#xe606;</i>
<div class="name">头像</div>
<div class="code">&amp;#xe606;</div>
</li>
<li>
<i class="icon iconfont">&#xe607;</i>
<div class="name">类目链接</div>
<div class="code">&amp;#xe607;</div>
</li>
<li>
<i class="icon iconfont">&#xe608;</i>
<div class="name">名单</div>
<div class="code">&amp;#xe608;</div>
</li>
<li>
<i class="icon iconfont">&#xe609;</i>
<div class="name">提醒</div>
<div class="code">&amp;#xe609;</div>
</li>
<li>
<i class="icon iconfont">&#xe60a;</i>
<div class="name">密码</div>
<div class="code">&amp;#xe60a;</div>
</li>
<li>
<i class="icon iconfont">&#xe60b;</i>
<div class="name">设置</div>
<div class="code">&amp;#xe60b;</div>
</li>
<li>
<i class="icon iconfont">&#xe628;</i>
<div class="name">上升</div>
<div class="code">&amp;#xe628;</div>
</li>
<li>
<i class="icon iconfont">&#xe639;</i>
<div class="name">发件箱</div>
<div class="code">&amp;#xe639;</div>
</li>
<li>
<i class="icon iconfont">&#xe60f;</i>
<div class="name">上升</div>
<div class="code">&amp;#xe60f;</div>
</li>
<li>
<i class="icon iconfont">&#xe656;</i>
<div class="name">排序</div>
<div class="code">&amp;#xe656;</div>
</li>
</ul>
<h2 id="unicode-">unicode引用</h2>
<hr>
<p>unicode是字体在网页端最原始的应用方式特点是</p>
<ul>
<li>兼容性最好支持ie6+,及所有现代浏览器。</li>
<li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
<li>但是因为是字体,所以不支持多色。只能使用平台里单色的图标,就算项目里有多色图标也会自动去色。</li>
</ul>
<blockquote>
<p>注意新版iconfont支持多色图标这些多色图标在unicode模式下将不能使用如果有需求建议使用symbol的引用方式</p>
</blockquote>
<p>unicode使用步骤如下</p>
<h3 id="-font-face">第一步拷贝项目下面生成的font-face</h3>
<pre><code class="lang-js hljs javascript">@font-face {
font-family: <span class="hljs-string">'iconfont'</span>;
src: url(<span class="hljs-string">'iconfont.eot'</span>);
src: url(<span class="hljs-string">'iconfont.eot?#iefix'</span>) format(<span class="hljs-string">'embedded-opentype'</span>),
url(<span class="hljs-string">'iconfont.woff'</span>) format(<span class="hljs-string">'woff'</span>),
url(<span class="hljs-string">'iconfont.ttf'</span>) format(<span class="hljs-string">'truetype'</span>),
url(<span class="hljs-string">'iconfont.svg#iconfont'</span>) format(<span class="hljs-string">'svg'</span>);
}
</code></pre>
<h3 id="-iconfont-">第二步定义使用iconfont的样式</h3>
<pre><code class="lang-js hljs javascript">.iconfont{
font-family:<span class="hljs-string">"iconfont"</span> !important;
font-size:<span class="hljs-number">16</span>px;font-style:normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: <span class="hljs-number">0.2</span>px;
-moz-osx-font-smoothing: grayscale;
}
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
<pre><code class="lang-js hljs javascript">&lt;i <span class="hljs-class"><span class="hljs-keyword">class</span></span>=<span class="hljs-string">"iconfont"</span>&gt;&amp;#x33;<span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">i</span>&gt;</span></span></code></pre>
<blockquote>
<p>"iconfont"是你项目下的font-family。可以通过编辑项目查看默认是"iconfont"。</p>
</blockquote>
</div>
</body>
</html>

@ -0,0 +1,55 @@
@font-face {font-family: "iconfont";
src: url('iconfont.eot?t=1490337422326'); /* IE9*/
src: url('iconfont.eot?t=1490337422326#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('iconfont.woff?t=1490337422326') format('woff'), /* chrome, firefox */
url('iconfont.ttf?t=1490337422326') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('iconfont.svg?t=1490337422326#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family:"iconfont" !important;
font-size:16px;
font-style:normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-shuaxin:before { content: "\e60d"; }
.icon-shujuku:before { content: "\e600"; }
.icon-shanchu:before { content: "\e601"; }
.icon-wenzhang:before { content: "\e602"; }
.icon-lianjie:before { content: "\e60c"; }
.icon-caidan:before { content: "\e60e"; }
.icon-youjian:before { content: "\e603"; }
.icon-tuijian:before { content: "\e604"; }
.icon-msg:before { content: "\e605"; }
.icon-userpro:before { content: "\e606"; }
.icon-leimulianjie:before { content: "\e607"; }
.icon-list:before { content: "\e608"; }
.icon-remind:before { content: "\e609"; }
.icon-Password:before { content: "\e60a"; }
.icon-Setup:before { content: "\e60b"; }
.icon-shangsheng:before { content: "\e628"; }
.icon-fajianxiang:before { content: "\e639"; }
.icon-xiajiang:before { content: "\e60f"; }
.icon-paixu:before { content: "\e656"; }

File diff suppressed because one or more lines are too long

@ -0,0 +1,110 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
Created by FontForge 20120731 at Fri Mar 24 14:37:02 2017
By admin
</metadata>
<defs>
<font id="iconfont" horiz-adv-x="1024" >
<font-face
font-family="iconfont"
font-weight="500"
font-stretch="normal"
units-per-em="1024"
panose-1="2 0 6 3 0 0 0 0 0 0"
ascent="896"
descent="-128"
x-height="792"
bbox="-1.14286 -212 1024 896"
underline-thickness="0"
underline-position="0"
unicode-range="U+0078-E656"
/>
<missing-glyph
/>
<glyph glyph-name=".notdef"
/>
<glyph glyph-name=".notdef"
/>
<glyph glyph-name=".null" horiz-adv-x="0"
/>
<glyph glyph-name="nonmarkingreturn" horiz-adv-x="341"
/>
<glyph glyph-name="x" unicode="x" horiz-adv-x="1001"
d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5
t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5
t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />
<glyph glyph-name="shuaxin" unicode="&#xe60d;"
d="M692 133q-85 -61 -190 -59q-13 0 -26 1q-2 0 -6 0.5t-5 0.5q-14 2 -20 3q-2 1 -13 3q-13 3 -19 5q-1 0 -9 3q-14 5 -22 9q-1 0 -5 2q-15 6 -25 12h-1q-41 23 -74 56q0 1 -1 1v1q-10 10 -19 21q-1 1 -2 2.5t-2 2.5q-71 90 -71 205h75q3 0 4.5 2.5t0.5 5.5l-127 192
q-1 3 -4 3t-5 -3l-126 -192q-2 -3 -0.5 -5.5t4.5 -2.5h75q0 -135 76 -245q0 -1 0.5 -2t1.5 -1q2 -4 15 -21q1 0 3 -3t3 -4q10 -13 25 -28l2 -2q43 -43 96 -73q2 -1 3 -2q13 -7 31 -15q1 0 3.5 -1.5t4.5 -1.5q11 -5 27 -11q10 -3 14 -4q9 -3 24 -6q14 -4 17 -4q1 0 3.5 -1
t3.5 -1q5 -1 24 -3q1 0 4 -0.5t4 -0.5q24 -3 43 -3q133 0 244 79q17 12 21 33t-8.5 39t-33 21.5t-38.5 -8.5v0zM933 402q0 133 -75 244l-1 1.5l-1 1.5q-6 8 -19 25l-1 1t-1 2q-65 80 -159 121q-1 0 -3 1l-2 1q-13 5 -31 11l-4 1.5t-6 2.5q-11 3 -27 7q-13 3 -15 3
q-2 1 -4 1.5t-4 0.5q-4 1 -11.5 1.5t-8.5 1.5q-1 0 -6 0.5t-8 0.5q-15 2 -34 2q-1 0 -3 0.5t-3 0.5l-0.5 -0.5l-0.5 -0.5q-134 0 -243 -78q-18 -12 -21.5 -33t8.5 -38.5t33 -21.5t38 8q85 61 189 60q14 0 28 -2q2 0 5 -0.5t4 -0.5q13 -2 23 -3q0 -1 9 -3q13 -3 22 -5
q2 -1 4 -1.5t3 -1.5q14 -4 25 -9l1 -0.5l1 -0.5q72 -31 122 -93h0.5h0.5q73 -91 73 -208h-75q-3 0 -4.5 -3t0.5 -6l126 -192q2 -2 5 -2t4 2l127 192q1 3 -0.5 6t-4.5 3h-75z" />
<glyph glyph-name="shujuku" unicode="&#xe600;"
d="M429 -120q-100 0 -185.5 21t-135 56.5t-49.5 76.5v3v4v3v0v90q51 -49 150.5 -79.5t219.5 -30.5q64 0 124 9q2 21 7 42q-63 -10 -131 -10q-100 0 -185.5 21t-135 56.5t-49.5 76.5v3v4v3v0v90q51 -49 150.5 -79.5t219.5 -30.5t219.5 30.5t150.5 79.5v-48h10q16 0 31 -2v372
v0q-23 70 -140.5 117t-270.5 47t-270.5 -47t-140.5 -117v0v-637v0q24 -72 140 -121t271 -47q95 1 178 20q-16 21 -25 38q-73 -14 -153 -14zM429.5 764q100.5 0 185.5 -20.5t134.5 -56t49.5 -77.5t-49.5 -77.5t-134.5 -56t-185.5 -20.5t-186 20.5t-135 56t-49.5 77.5
t49.5 77.5t135 56t186 20.5zM59 414v111q51 -50 150.5 -80t219.5 -30t219.5 30t150.5 80v-111v0v-10q0 -41 -49.5 -76.5t-134.5 -56.5t-185.5 -21t-186 21t-135 56.5t-49.5 76.5v10v0zM799 230q-85 0 -145 -60.5t-60 -145.5t60 -145t145 -60t145.5 60t60.5 145t-60.5 145.5
t-145.5 60.5zM799 -140q-68 0 -116 48t-48 116t48 116.5t116 48.5t116.5 -48.5t48.5 -116.5t-48.5 -116t-116.5 -48zM820 127h-41v-82h-83v-41h83v-83h41v83h82v41h-82v82z" />
<glyph glyph-name="shanchu" unicode="&#xe601;"
d="M622 7q-15 0 -26 11t-11 26v402q0 15 11 26t26 11t25.5 -11t10.5 -26v-402q0 -15 -10.5 -26t-25.5 -11v0v0zM402 7q-15 0 -25.5 11t-10.5 26v402q0 15 10.5 26t25.5 11t26 -11t11 -26v-402q0 -15 -11 -26t-26 -11v0v0zM987 629h-182v73q0 46 -32 78t-77 32h-367
q-45 0 -77.5 -32t-32.5 -78v-73h-182q-16 0 -26.5 -10.5t-10.5 -26t10.5 -26t26.5 -10.5h950q16 0 26.5 10.5t10.5 26t-10.5 26t-26.5 10.5v0v0zM293 702q0 15 10.5 26t25.5 11h367q15 0 25 -10.5t10 -26.5v-73h-438v73v0zM768 -212h-512q-45 0 -77.5 32t-32.5 78v549
q0 15 11 25.5t26 10.5t26 -10.5t11 -25.5v-549q0 -15 10.5 -26t25.5 -11h512q15 0 26 11t11 26v547q0 15 10.5 26t25.5 11t26 -11t11 -26v-547q0 -46 -32 -78t-78 -32v0v0z" />
<glyph glyph-name="wenzhang" unicode="&#xe602;"
d="M715 886h-561q-30 0 -52 -21t-22 -50v-869q0 -29 22 -50t52 -21h710q31 0 52.5 21t21.5 50v690zM840 637h-150v168zM849 -48h-679q-5 0 -8.5 2.5t-3.5 5.5v841q0 4 3.5 6.5t8.5 2.5h462v-183q0 -25 18 -43t43 -18h169v-606q0 -3 -4 -5.5t-9 -2.5v0zM849 -48zM567 578
q0 -16 -11.5 -27.5t-27.5 -11.5h-210q-16 0 -27.5 11.5t-11.5 27.5v0q0 16 11.5 27.5t27.5 11.5h210q16 0 27.5 -11.5t11.5 -27.5v0zM749 385q0 -16 -11 -27.5t-28 -11.5h-389q-16 0 -27.5 11.5t-11.5 27.5v0q0 16 11.5 27.5t27.5 11.5h389q16 0 27.5 -11.5t11.5 -27.5v0z
M749 192q0 -16 -11 -27.5t-28 -11.5h-389q-16 0 -27.5 11.5t-11.5 27.5v0q0 16 11.5 27.5t27.5 11.5h389q16 0 27.5 -11.5t11.5 -27.5v0z" />
<glyph glyph-name="lianjie" unicode="&#xe60c;"
d="M119 384q0 62 44 106t106 44h194v93h-194q-100 0 -171 -71.5t-71 -171.5t71 -171.5t171 -71.5h194v93h-194q-62 0 -106 44t-44 106zM318 335h388v98h-388v-98zM755 627h-194v-93h194q62 0 106 -44t44 -106t-44 -106t-106 -44h-194v-93h194q100 0 171 71.5t71 171.5
t-71 171.5t-171 71.5z" />
<glyph glyph-name="caidan" unicode="&#xe60e;"
d="M961 702h-896v128h896v-128zM65 322v128h896v-128h-896zM65 -65v128h896v-128h-896z" />
<glyph glyph-name="youjian" unicode="&#xe603;"
d="M902 655h-798q-35 0 -60 -23.5t-25 -55.5v-475q0 -32 25 -55.5t60 -23.5h798q36 0 61 23.5t25 55.5v475q0 32 -25 55.5t-61 23.5v0v0zM76 101v464l251 -232l-251 -233v1v0zM117 602h773l-373 -345q-14 -12 -27 0zM368 296l100 -91q15 -14 35.5 -14t35.5 14l101 91
l239 -221h-750zM681 333h-2l252 232v-463zM681 333z" />
<glyph glyph-name="tuijian" unicode="&#xe604;"
d="M1013 574l-489 -279q-5 -3 -10.5 -3t-10.5 3l-492 281q-11 6 -11 19t11 19l489 279q10 6 20 0l493 -281q10 -6 10 -19t-10 -19zM510 819l-403 -217l407 -233l415 224zM32 420l482 -276l478 274q8 4 16 1.5t13 -10.5q4 -7 1.5 -31.5t-9.5 -28.5l-489 -280q-5 -2 -10.5 -2
t-10.5 2l-492 282q-7 4 -10 28.5t2 31.5q4 8 12.5 10.5t16.5 -1.5zM32 225l482 -275l478 273q8 5 16 2.5t13 -10.5q4 -8 1.5 -32t-9.5 -28l-489 -280q-5 -3 -10.5 -3t-10.5 3l-492 282q-7 4 -10 28t2 32q4 8 12.5 10.5t16.5 -2.5z" />
<glyph glyph-name="msg" unicode="&#xe605;"
d="M551 -111q-7 0 -13 3q-18 9 -18 29v155h-114q-109 0 -201.5 54t-146.5 146.5t-54 201.5t54 201.5t146.5 146.5t201.5 54h213q109 0 201.5 -54t146.5 -146.5t54 -201.5q0 -132 -78 -238q-8 -10 -20.5 -12t-23 5.5t-12.5 20.5t6 23q66 90 66 201q0 92 -45.5 170t-124 123.5
t-170.5 45.5h-213q-92 0 -170 -45.5t-123.5 -123.5t-45.5 -170t45.5 -170t123.5 -123.5t170 -45.5h145q13 0 22 -9t9 -22v-117l228 202q10 9 23 8t21.5 -10.5t8 -22.5t-10.5 -22l-280 -249q-9 -8 -21 -8v0zM362 478q0 -24 -17 -41t-41 -17t-41 17t-17 41t17 41t41 17t41 -17
t17 -41v0zM513 536q-24 0 -41.5 -17t-17.5 -41t17.5 -41t41.5 -17t41 17t17 41t-17 41t-41 17v0zM721 536q-24 0 -41 -17t-17 -41t17 -41t41 -17t41 17t17 41t-17 41t-41 17v0zM721 536z" />
<glyph glyph-name="userpro" unicode="&#xe606;"
d="M993 -70q-5 90 -64 150q-40 41 -116 73q-15 7 -43 18q-42 17 -58 25q-28 14 -36 26q-1 24 -1 58q2 3 4 5q10 14 20 35q13 26 20 59q10 5 17 14q23 29 29 77q4 34 -13 63q23 81 18 149q-5 65 -36 108q-32 44 -92 59q-43 46 -132 46h-1q-85 -2 -144 -35.5t-86 -94.5
q-38 -87 -6 -230q-18 -29 -14 -65q6 -48 29 -77q7 -9 18 -15q7 -33 20 -58q10 -20 21 -35q2 -2 4 -5q0 -34 -2 -57q-8 -13 -35 -27q-17 -8 -59 -25q-28 -11 -43 -18q-77 -33 -117 -73q-59 -60 -64 -150l-4 -57h970zM112 -50q10 48 38 76q31 32 92 58q11 5 49 19.5t56 24.5
q61 30 76 72l1 3l1 3q2 23 2 97v13l-12 6v1l-7 7q-8 10 -14 23q-16 32 -19 62l-2 19l-19 1q-3 0 -7 5q-8 11 -12 39q0 5 0.5 9.5t1.5 7t2.5 4.5t2 2.5l0.5 0.5l15 9l-5 17q-34 133 -2 206q35 81 160 83h1q32 0 54 -8t29 -20l5 -9l11 -1q41 -6 62 -35q18 -25 21 -69
q6 -67 -21 -146l-5 -18l15 -9l0.5 -0.5t2 -2.5t2.5 -4.5t1.5 -7t0.5 -9.5q-4 -28 -12 -39q-4 -5 -7 -5l-19 -1l-2 -19q-3 -29 -19 -62q-7 -14 -13 -23q-2 -3 -6 -7l-1 -1l-11 -6v-13q0 -74 2 -97v-3l1 -3q16 -43 75 -72q19 -10 57 -24.5t49 -19.5q60 -26 91 -58
q28 -28 38 -76h-800v0z" />
<glyph glyph-name="leimulianjie" unicode="&#xe607;"
d="M906 893h-249q-46 0 -79.5 -33.5t-33.5 -80.5v-250q0 -47 33.5 -80.5t79.5 -33.5h249q47 0 80.5 33.5t33.5 80.5v250q0 47 -33.5 80.5t-80.5 33.5v0zM950 536q0 -21 -15 -36v0v0q-15 -15 -36 -15h-234q-21 0 -36 15t-15 36v236q0 21 15 36.5t36 15.5h234q21 0 36 -15.5
t15 -36.5v-236zM365 893h-249q-47 0 -80 -33.5t-33 -80.5v-250q0 -47 33 -80.5t80 -33.5h249q47 0 80 33.5t33 80.5v250q0 47 -33 80.5t-80 33.5v0zM409 536q0 -21 -15 -36v0v0q-15 -15 -36 -15h-234q-22 0 -37 15t-15 36v236q0 21 15 36.5t37 15.5h234q21 0 36 -15.5
t15 -36.5v-236zM905 354h-249q-47 0 -80 -33.5t-33 -80.5v-250q0 -47 33 -80.5t80 -33.5h249q47 0 80 33.5t33 80.5v250q0 47 -33 80.5t-80 33.5v0zM949 -3q0 -21 -15 -36v0v0q-15 -16 -36 -16h-234q-22 0 -37 15.5t-15 36.5v236q0 21 15 36.5t37 15.5h234q21 0 36 -15.5
t15 -36.5v-236v0zM364 354h-249q-47 0 -80 -33.5t-33 -80.5v-250q0 -47 33 -80.5t80 -33.5h249q47 0 80 33.5t33 80.5v250q0 47 -33 80.5t-80 33.5v0zM408 -3q0 -21 -15 -36v0v0q-15 -16 -36 -16h-234q-22 0 -37 15.5t-15 36.5v236q0 21 15 36.5t37 15.5h234q21 0 36 -15.5
t15 -36.5v-236v0z" />
<glyph glyph-name="list" unicode="&#xe608;"
d="M896 -128h-768q-35 0 -60 25t-25 60v854q0 35 25 60t60 25h768q35 0 60 -25t25 -60v-854q0 -35 -25 -60t-60 -25zM896 811h-768v-854h768v854zM277 427h470q8 0 14.5 -6.5t6.5 -15.5v-42q0 -9 -6.5 -15.5t-14.5 -6.5h-470q-8 0 -14.5 6.5t-6.5 15.5v42q0 9 6.5 15.5
t14.5 6.5zM277 213h470q8 0 14.5 -6t6.5 -15v-43q0 -8 -6.5 -14.5t-14.5 -6.5h-470q-8 0 -14.5 6.5t-6.5 14.5v43q0 9 6.5 15t14.5 6zM747 555h-470q-8 0 -14.5 6t-6.5 15v43q0 9 6.5 15t14.5 6h470q8 0 14.5 -6t6.5 -15v-43q0 -9 -6.5 -15t-14.5 -6z" />
<glyph glyph-name="remind" unicode="&#xe609;"
d="M917 160q-48 42 -78.5 144t-30.5 229q0 96 -55.5 173t-143.5 107q-6 36 -33.5 59.5t-64 23.5t-63.5 -23.5t-33 -59.5q-88 -30 -143.5 -107t-55.5 -173q0 -127 -30.5 -229t-78.5 -144q-56 -49 -56 -123q0 -41 29 -70t70 -29h296q0 -41 12.5 -53.5t53.5 -12.5t53.5 12.5
t12.5 53.5h296q41 0 70 29t29 70q0 74 -56 123zM188 9q-21 0 -35 10t-18 23t-3 25.5t6 17.5q67 57 105 177.5t38 270.5q0 53 35 107.5t89 89t107 34.5t107 -34.5t88.5 -89t34.5 -107.5q0 -150 38.5 -270.5t104.5 -177.5q8 -7 9.5 -25t-12.5 -34.5t-46 -16.5h-648v0z" />
<glyph glyph-name="Password" unicode="&#xe60a;"
d="M916 -128h-808q-23 0 -38.5 16t-15.5 38v485q0 22 15.5 38t38.5 16h81v108q0 87 43 161.5t117.5 118t162.5 43.5t162.5 -43.5t117.5 -118t43 -161.5v-108h81q23 0 38.5 -16t15.5 -38v-485q0 -22 -15.5 -38t-38.5 -16zM781 573q0 111 -78.5 190t-190.5 79t-190.5 -79
t-78.5 -190v-108h538v108zM916 411h-808v-485h808v485zM512 303q11 0 19 -8t8 -19v-215q0 -12 -8 -19.5t-19 -7.5t-19 7.5t-8 19.5v215q0 11 8 19t19 8z" />
<glyph glyph-name="Setup" unicode="&#xe60b;"
d="M1020 447q1 -8 2 -23q2 -26 2 -40t-2 -40q-1 -15 -2 -23v0q-4 -27 -11 -57q-80 -20 -123.5 -96t-20.5 -155q-21 -19 -45 -37v0q-37 -28 -77 -49h-1q-20 -10 -41 -18q0 -1 -1 -1t-2 -1q-22 -8 -41 -14q-57 60 -145 60t-145 -60v0q-19 6 -41 14q-1 1 -2 1t-1 1
q-22 8 -41 18h-1q-40 21 -77 49v0q-24 18 -45 37q23 79 -20.5 155t-123.5 96q-7 30 -11 57v0q-1 7 -2 23q-2 26 -2 40t2 40q1 16 2 23v0q4 27 11 57q80 20 123.5 96t20.5 155q21 19 45 37v0q37 28 77 49h1q20 10 41 18q0 1 1 1t2 1q21 8 41 14q57 -60 145 -60t145 60
q19 -6 41 -14q1 -1 2 -1t1 -1q21 -8 41 -18h1q40 -21 77 -49v0q24 -18 45 -37q-23 -79 20.5 -155t123.5 -96q7 -30 11 -57v0zM963 462q-79 33 -124 111q-45 77 -34 162q-62 52 -135 79q-68 -52 -158 -52t-158 52q-73 -27 -135 -79q11 -85 -34 -162q-45 -78 -124 -111
q-7 -39 -7 -78t7 -78q79 -33 124 -111q45 -77 34 -162q62 -52 135 -79q69 52 158 52t158 -52q73 27 135 79q-11 85 34 162q45 78 124 111q7 40 7 78t-7 78zM512 196q-78 0 -133 55t-55 133t55 133t133 55t133 -55t55 -133t-55 -133t-133 -55zM512 518q-56 0 -95 -39t-39 -95
t39 -95t95 -39t95 39t39 95t-39 95t-95 39z" />
<glyph glyph-name="shangsheng" unicode="&#xe628;"
d="M512 672l-224 -288h149v-288h149l1 288h149z" />
<glyph glyph-name="fajianxiang" unicode="&#xe639;"
d="M895 469l-125 148q-46 57 -87 57h-342q-38 0 -87 -57l-125 -148q-21 -28 -21 -99v-206q0 -29 20.5 -49.5t49.5 -20.5h668q29 0 49.5 20.5t20.5 49.5v206q0 73 -21 99zM297 599q25 28 44 28h342q22 0 44 -28l125 -149q5 -7 3.5 -8.5t-9.5 -1.5h-218q-9 0 -16 -7t-7 -16
v-23q0 -39 -27.5 -66t-65.5 -27t-65.5 27t-27.5 66v23q0 9 -7 16t-16 7h-218q-14 0 -6 10zM869 164q0 -10 -6.5 -16.5t-16.5 -6.5h-668q-10 0 -16.5 6.5t-6.5 16.5v206q0 10 6.5 17t16.5 7h194q0 -58 41 -99t99 -41t99 41t41 99h194q10 0 16.5 -7t6.5 -17v-206z" />
<glyph glyph-name="xiajiang" unicode="&#xe60f;"
d="M512 96l224 288h-149v288h-149l-1 -288h-149z" />
<glyph glyph-name="paixu" unicode="&#xe656;"
d="M363.5 3q-8.5 0 -14.5 6t-6 15v679l-201 -170q-6 -5 -14.5 -4.5t-14 7t-5 15t7.5 13.5l234 198q6 5 14 5t14 -6t6 -14v-723q0 -9 -6 -15t-14.5 -6zM673 4l234 198q7 5 7.5 13.5t-5 15t-14 7.5t-14.5 -5l-201 -169v679q0 8 -6 14t-14.5 6t-14.5 -6t-6 -14v-724q0 -8 6 -14
t14 -6t14 5z" />
</font>
</defs></svg>

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1,168 @@
layui.config({
base: '../../static/admin/js/module/'
}).extend({
dialog: 'dialog',
});
layui.use(['form', 'jquery', 'laydate', 'layer', 'laypage', 'dialog', 'element'], function() {
var form = layui.form(),
layer = layui.layer,
$ = layui.jquery,
dialog = layui.dialog;
//获取当前iframe的name值
var iframeObj = $(window.frameElement).attr('name');
//全选
form.on('checkbox(allChoose)', function(data) {
var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
child.each(function(index, item) {
item.checked = data.elem.checked;
});
form.render('checkbox');
});
//渲染表单
form.render();
//顶部添加
$('.addBtn').click(function() {
var url=$(this).attr('data-url');
//将iframeObj传递给父级窗口,执行操作完成刷新
parent.page("菜单添加", url, iframeObj, w = "700px", h = "620px");
return false;
}).mouseenter(function() {
dialog.tips('添加', '.addBtn');
})
//顶部排序
$('.listOrderBtn').click(function() {
var url=$(this).attr('data-url');
dialog.confirm({
message:'您确定要进行排序吗?',
success:function(){
layer.msg('确定了')
},
cancel:function(){
layer.msg('取消了')
}
})
return false;
}).mouseenter(function() {
dialog.tips('批量排序', '.listOrderBtn');
})
//顶部批量删除
$('.delBtn').click(function() {
var url=$(this).attr('data-url');
dialog.confirm({
message:'您确定要删除选中项',
success:function(){
layer.msg('删除了')
},
cancel:function(){
layer.msg('取消了')
}
})
return false;
}).mouseenter(function() {
dialog.tips('批量删除', '.delBtn');
})
//列表添加
$('#table-list').on('click', '.add-btn', function() {
var url=$(this).attr('data-url');
//将iframeObj传递给父级窗口
parent.page("菜单添加", url, iframeObj, w = "700px", h = "620px");
return false;
})
//列表删除
$('#table-list').on('click', '.del-btn', function() {
var url=$(this).attr('data-url');
var id = $(this).attr('data-id');
dialog.confirm({
message:'您确定要进行删除吗?',
success:function(){
layer.msg('确定了')
},
cancel:function(){
layer.msg('取消了')
}
})
return false;
})
//列表跳转
$('#table-list,.tool-btn').on('click', '.go-btn', function() {
var url=$(this).attr('data-url');
var id = $(this).attr('data-id');
window.location.href=url+"?id="+id;
return false;
})
//编辑栏目
$('#table-list').on('click', '.edit-btn', function() {
var That = $(this);
var id = That.attr('data-id');
var url=That.attr('data-url');
//将iframeObj传递给父级窗口
parent.page("菜单编辑", url + "?id=" + id, iframeObj, w = "700px", h = "620px");
return false;
})
});
/**
* 控制iframe窗口的刷新操作
*/
var iframeObjName;
//父级弹出页面
function page(title, url, obj, w, h) {
if(title == null || title == '') {
title = false;
};
if(url == null || url == '') {
url = "404.html";
};
if(w == null || w == '') {
w = '700px';
};
if(h == null || h == '') {
h = '350px';
};
iframeObjName = obj;
//如果手机端,全屏显示
if(window.innerWidth <= 768) {
var index = layer.open({
type: 2,
title: title,
area: [320, h],
fixed: false, //不固定
content: url
});
layer.full(index);
} else {
var index = layer.open({
type: 2,
title: title,
area: [w, h],
fixed: false, //不固定
content: url
});
}
}
/**
* 刷新子页,关闭弹窗
*/
function refresh() {
//根据传递的name值获取子iframe窗口执行刷新
if(window.frames[iframeObjName]) {
window.frames[iframeObjName].location.reload();
} else {
window.location.reload();
}
layer.closeAll();
}

@ -0,0 +1,92 @@
layui.use(['layer', 'form', 'element', 'jquery', 'dialog'], function() {
var layer = layui.layer;
var element = layui.element();
var form = layui.form();
var $ = layui.jquery;
var dialog = layui.dialog;
var hideBtn = $('#hideBtn');
var mainLayout = $('#main-layout');
var mainMask = $('.main-mask');
//监听导航点击
element.on('nav(leftNav)', function(elem) {
var navA = $(elem).find('a');
var id = navA.attr('data-id');
var url = navA.attr('data-url');
var text = navA.attr('data-text');
if(!url){
return;
}
var isActive = $('.main-layout-tab .layui-tab-title').find("li[lay-id=" + id + "]");
if(isActive.length > 0) {
//切换到选项卡
element.tabChange('tab', id);
} else {
element.tabAdd('tab', {
title: text,
content: '<iframe src="' + url + '" name="iframe' + id + '" class="iframe" framborder="0" data-id="' + id + '" scrolling="auto" width="100%" height="100%"></iframe>',
id: id
});
element.tabChange('tab', id);
}
mainLayout.removeClass('hide-side');
});
//监听导航点击
element.on('nav(rightNav)', function(elem) {
var navA = $(elem).find('a');
var id = navA.attr('data-id');
var url = navA.attr('data-url');
var text = navA.attr('data-text');
if(!url){
return;
}
var isActive = $('.main-layout-tab .layui-tab-title').find("li[lay-id=" + id + "]");
if(isActive.length > 0) {
//切换到选项卡
element.tabChange('tab', id);
} else {
element.tabAdd('tab', {
title: text,
content: '<iframe src="' + url + '" name="iframe' + id + '" class="iframe" framborder="0" data-id="' + id + '" scrolling="auto" width="100%" height="100%"></iframe>',
id: id
});
element.tabChange('tab', id);
}
mainLayout.removeClass('hide-side');
});
//菜单隐藏显示
hideBtn.on('click', function() {
if(!mainLayout.hasClass('hide-side')) {
mainLayout.addClass('hide-side');
} else {
mainLayout.removeClass('hide-side');
}
});
//遮罩点击隐藏
mainMask.on('click', function() {
mainLayout.removeClass('hide-side');
})
//示范一个公告层
// layer.open({
// type: 1
// ,title: false //不显示标题栏
// ,closeBtn: false
// ,area: '300px;'
// ,shade: 0.8
// ,id: 'LAY_layuipro' //设定一个id防止重复弹出
// ,resize: false
// ,btn: ['火速围观', '残忍拒绝']
// ,btnAlign: 'c'
// ,moveType: 1 //拖拽模式0或者1
// ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">后台模版1.1版本今日更新:<br><br><br>数据列表页...<br><br>编辑删除弹出功能<br><br>失去焦点排序功能<br>数据列表页<br>数据列表页<br>数据列表页</div>'
// ,success: function(layero){
// var btn = layero.find('.layui-layer-btn');
// btn.find('.layui-layer-btn0').attr({
// href: 'http://www.layui.com/'
// ,target: '_blank'
// });
// }
// });
});

@ -0,0 +1,57 @@
layui.define(['jquery', 'layer'], function (exports) {
var $ = layui.jquery;
var layer = layui.layer;
var dialog = {
/*确认框*/
confirm: function (jsonData) {
layer.confirm(jsonData.message, {
btn: ['确定', '取消'],
shade: [0.1, '#fff']
}, function () {
jsonData.success && jsonData.success();
}, function () {
jsonData.cancel && jsonData.cancel();
});
},
page: function (title, url, w, h) {
if (title == null || title == '') {
title = false;
}
;
if (url == null || url == '') {
url = "404.html";
}
;
if (w == null || w == '') {
w = '700px';
}
;
if (h == null || h == '') {
h = '350px';
}
;
var index = layer.open({
type: 2,
title: title,
area: [w, h],
fixed: false, //不固定
maxmin: true,
content: url
});
},
/**
* 提示
* @param title
* @param obj
*/
tips: function(title, obj) {
layer.tips(title, obj, {
tips: [1, '#444c63'], //还可配置颜色
time: 1000
});
}
};
//输出test接口
exports('dialog', dialog);
}
);

@ -0,0 +1,64 @@
layui.define(function(exports){
var formate = {
/**
* 获取当前的日期函数
* 传入一个时间戳,如果不传则为当前时间
* 注意如果是uinx时间戳记得乘于1000, 比如php函数time()获得的时间戳就要乘于1000
* @type String timestamp 要转换的时间戳格式 1469504554276
* @returns {String} 日期格式: 2016-07-26 10:55:38
*/
ge_time_format:function(timestamp){
if(timestamp){
var date = new Date(timestamp*1000);
}else{
var date = new Date();
}
Y = date.getFullYear(),
m = date.getMonth()+1,
d = date.getDate(),
H = date.getHours(),
i = date.getMinutes(),
s = date.getSeconds();
if(m<10){
m = '0'+m;
}
if(d<10){
d = '0'+d;
}
if(H<10){
H = '0'+H;
}
if(i<10){
i = '0'+i;
}
if(s<10){
s = '0'+s;
}
var t = Y+'-'+m+'-'+d+' '+H+':'+i+':'+s;
return t;
},
/**
* 日期函数转为时间戳格式
* 传入一个日期时间格式,如果不传入就是获取现在的时间了
* @type String strtime 要转换的日期时间格式 2016-07-26 10:55:38
* @return {String} 时间戳格式: 1469504554276
*/
get_unix_time_stamp:function (strtime) {
if(strtime){
var date = new Date(strtime);
}else{
var date = new Date();
}
time1 = date.getTime(); //会精确到毫秒---长度为13位
//time2 = date.valueOf(); //会精确到毫秒---长度为13位
//time3 = Date.parse(date); //只能精确到秒毫秒将用0来代替---长度为10位
return time1;
}
};
//输出test接口
exports('formate', formate);
});

@ -0,0 +1,34 @@
layui.define(['jquery'], function (exports) {
var $ = layui.jquery;
var tool = {
/**
* 移除数组的值
* @param arr 数组
* @param val 删除的值
*/
removeByValue: function (arr, val) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == val) {
arr.splice(i, 1);
break;
}
}
},
/**
* 转义字符防止xxs
* @param str
* @returns {string}
*/
stringEncode:function (str){
var div=document.createElement('div');
if(div.innerText){
div.innerText=str;
}else{
div.textContent=str;//Support firefox
}
return div.innerHTML;
}
};
exports('tool', tool);
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,2 @@
/** layui-v2.2.6-rc2 MIT License By https://www.layui.com */
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -0,0 +1,96 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>聊天记录</title>
<link rel="stylesheet" href="http://local.res.layui.com/layui/src/css/layui.css">
<style>
body .layim-chat-main{height: auto;}
</style>
</head>
<body>
<div class="layim-chat-main">
<ul id="LAY_view"></ul>
</div>
<div id="LAY_page" style="margin: 0 10px;"></div>
<textarea title="消息模版" id="LAY_tpl" style="display:none;">
{{# layui.each(d.data, function(index, item){
if(item.id == parent.layui.layim.cache().mine.id){ }}
<li class="layim-chat-mine"><div class="layim-chat-user"><img src="{{ item.avatar }}"><cite><i>{{ layui.data.date(item.timestamp) }}</i>{{ item.username }}</cite></div><div class="layim-chat-text">{{ layui.layim.content(item.content) }}</div></li>
{{# } else { }}
<li><div class="layim-chat-user"><img src="{{ item.avatar }}"><cite>{{ item.username }}<i>{{ layui.data.date(item.timestamp) }}</i></cite></div><div class="layim-chat-text">{{ layui.layim.content(item.content) }}</div></li>
{{# }
}); }}
</textarea>
<!--
上述模版采用了 laytpl 语法不了解的同学可以去看下文档http://www.layui.com/doc/modules/laytpl.html
-->
<script src="http://local.res.layui.com/layui/src/layui.js"></script>
<script>
layui.use(['layim', 'laypage'], function(){
var layim = layui.layim
,layer = layui.layer
,laytpl = layui.laytpl
,$ = layui.jquery
,laypage = layui.laypage;
//聊天记录的分页此处不做演示你可以采用laypage不了解的同学见文档http://www.layui.com/doc/modules/laypage.html
//开始请求聊天记录
var param = location.search //获得URL参数。该窗口url会携带会话id和type他们是你请求聊天记录的重要凭据
//实际使用时下述的res一般是通过Ajax获得而此处仅仅只是演示数据格式
,res = {
code: 0
,msg: ''
,data: [{
username: '纸飞机'
,id: 100000
,avatar: 'http://tva3.sinaimg.cn/crop.0.0.512.512.180/8693225ajw8f2rt20ptykj20e80e8weu.jpg'
,timestamp: 1480897882000
,content: 'face[抱抱] face[心] 你好啊小美女'
}, {
username: 'Z_子晴'
,id: 108101
,avatar: 'http://tva3.sinaimg.cn/crop.0.0.512.512.180/8693225ajw8f2rt20ptykj20e80e8weu.jpg'
,timestamp: 1480897892000
,content: '你没发错吧face[微笑]'
},{
username: 'Z_子晴'
,id: 108101
,avatar: 'http://tva3.sinaimg.cn/crop.0.0.512.512.180/8693225ajw8f2rt20ptykj20e80e8weu.jpg'
,timestamp: 1480897898000
,content: '你是谁呀亲。。我爱的是贤心!我爱的是贤心!我爱的是贤心!重要的事情要说三遍~'
},{
username: 'Z_子晴'
,id: 108101
,avatar: 'http://tva3.sinaimg.cn/crop.0.0.512.512.180/8693225ajw8f2rt20ptykj20e80e8weu.jpg'
,timestamp: 1480897908000
,content: '注意:这些都是模拟数据,实际使用时,需将其中的模拟接口改为你的项目真实接口。\n该模版文件所在目录相对于layui.js\n/css/modules/layim/html/chatlog.html'
}]
}
//console.log(param)
var html = laytpl(LAY_tpl.value).render({
data: res.data
});
$('#LAY_view').html(html);
});
</script>
</body>
</html>

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>发现</title>
<link rel="stylesheet" href="http://local.res.layui.com/layui/src/css/layui.css">
<style>
</style>
</head>
<body>
<div style="margin: 15px;">
<blockquote class="layui-elem-quote">此为自定义的【查找】页面,因需求不一,所以官方暂不提供该模版结构与样式,实际使用时,可移至该文件到你的项目中,对页面自行把控。
<br>文件所在目录相对于layui.js/css/modules/layim/html/find.html</blockquote>
</div>
<script src="http://local.res.layui.com/layui/src/layui.js"></script>
<script>
layui.use(['layim', 'laypage'], function(){
var layim = layui.layim
,layer = layui.layer
,laytpl = layui.laytpl
,$ = layui.jquery
,laypage = layui.laypage;
//一些添加好友请求之类的交互参见文档
});
</script>
</body>
</html>

@ -0,0 +1,87 @@
{
"code": 0,
"pages": 1,
"data": [
{
"id": 76,
"content": "申请添加你为好友",
"uid": 168,
"from": 166488,
"from_group": 0,
"type": 1,
"remark": "有问题要问",
"href": null,
"read": 1,
"time": "刚刚",
"user": {
"id": 166488,
"avatar": "http://q.qlogo.cn/qqapp/101235792/B704597964F9BD0DB648292D1B09F7E8/100",
"username": "李彦宏",
"sign": null
}
},
{
"id": 75,
"content": "申请添加你为好友",
"uid": 168,
"from": 347592,
"from_group": 0,
"type": 1,
"remark": "你好啊!",
"href": null,
"read": 1,
"time": "刚刚",
"user": {
"id": 347592,
"avatar": "http://q.qlogo.cn/qqapp/101235792/B78751375E0531675B1272AD994BA875/100",
"username": "麻花疼",
"sign": null
}
},
{
"id": 62,
"content": "雷军 拒绝了你的好友申请",
"uid": 168,
"from": null,
"from_group": null,
"type": 1,
"remark": null,
"href": null,
"read": 1,
"time": "10天前",
"user": {
"id": null
}
},
{
"id": 60,
"content": "马小云 已经同意你的好友申请",
"uid": 168,
"from": null,
"from_group": null,
"type": 1,
"remark": null,
"href": null,
"read": 1,
"time": "10天前",
"user": {
"id": null
}
},
{
"id": 61,
"content": "贤心 已经同意你的好友申请",
"uid": 168,
"from": null,
"from_group": null,
"type": 1,
"remark": null,
"href": null,
"read": 1,
"time": "10天前",
"user": {
"id": null
}
}
]
}

@ -0,0 +1,208 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>消息盒子</title>
<link rel="stylesheet" href="../../../layui.css?v=1">
<style>
.layim-msgbox{margin: 15px;}
.layim-msgbox li{position: relative; margin-bottom: 10px; padding: 0 130px 10px 60px; padding-bottom: 10px; line-height: 22px; border-bottom: 1px dotted #e2e2e2;}
.layim-msgbox .layim-msgbox-tips{margin: 0; padding: 10px 0; border: none; text-align: center; color: #999;}
.layim-msgbox .layim-msgbox-system{padding: 0 10px 10px 10px;}
.layim-msgbox li p span{padding-left: 5px; color: #999;}
.layim-msgbox li p em{font-style: normal; color: #FF5722;}
.layim-msgbox-avatar{position: absolute; left: 0; top: 0; width: 50px; height: 50px;}
.layim-msgbox-user{padding-top: 5px;}
.layim-msgbox-content{margin-top: 3px;}
.layim-msgbox .layui-btn-small{padding: 0 15px; margin-left: 5px;}
.layim-msgbox-btn{position: absolute; right: 0; top: 12px; color: #999;}
</style>
</head>
<body>
<ul class="layim-msgbox" id="LAY_view"></ul>
<div style="margin: 0 15px;">
<blockquote class="layui-elem-quote">注意:这些都是模拟数据,实际使用时,需将其中的模拟接口改为你的项目真实接口。
<br>该模版文件所在目录相对于layui.js/css/modules/layim/html/msgbox.html</blockquote>
</div>
<textarea title="消息模版" id="LAY_tpl" style="display:none;">
{{# layui.each(d.data, function(index, item){
if(item.from){ }}
<li data-uid="{{ item.from }}" data-fromGroup="{{ item.from_group }}">
<a href="/u/{{ item.from }}/" target="_blank">
<img src="{{ item.user.avatar }}" class="layui-circle layim-msgbox-avatar">
</a>
<p class="layim-msgbox-user">
<a href="/u/{{ item.from }}/" target="_blank">{{ item.user.username||'' }}</a>
<span>{{ item.time }}</span>
</p>
<p class="layim-msgbox-content">
{{ item.content }}
<span>{{ item.remark ? '附言: '+item.remark : '' }}</span>
</p>
<p class="layim-msgbox-btn">
<button class="layui-btn layui-btn-small" data-type="agree">同意</button>
<button class="layui-btn layui-btn-small layui-btn-primary" data-type="refuse">拒绝</button>
</p>
</li>
{{# } else { }}
<li class="layim-msgbox-system">
<p><em>系统:</em>{{ item.content }}<span>{{ item.time }}</span></p>
</li>
{{# }
}); }}
</textarea>
<!--
上述模版采用了 laytpl 语法不了解的同学可以去看下文档http://www.layui.com/doc/modules/laytpl.html
-->
<script src="../../../../layui.js?v=1"></script>
<script>
layui.use(['layim', 'flow'], function(){
var layim = layui.layim
,layer = layui.layer
,laytpl = layui.laytpl
,$ = layui.jquery
,flow = layui.flow;
var cache = {}; //用于临时记录请求到的数据
//请求消息
var renderMsg = function(page, callback){
//实际部署时,请将下述 getmsg.json 改为你的接口地址
$.get('getmsg.json', {
page: page || 1
}, function(res){
if(res.code != 0){
return layer.msg(res.msg);
}
//记录来源用户信息
layui.each(res.data, function(index, item){
cache[item.from] = item.user;
});
callback && callback(res.data, res.pages);
});
};
//消息信息流
flow.load({
elem: '#LAY_view' //流加载容器
,isAuto: false
,end: '<li class="layim-msgbox-tips">暂无更多新消息</li>'
,done: function(page, next){ //加载下一页
renderMsg(page, function(data, pages){
var html = laytpl(LAY_tpl.value).render({
data: data
,page: page
});
next(html, page < pages);
});
}
});
//打开页面即把消息标记为已读
/*
$.post('/message/read', {
type: 1
});
*/
//操作
var active = {
//同意
agree: function(othis){
var li = othis.parents('li')
,uid = li.data('uid')
,from_group = li.data('fromGroup')
,user = cache[uid];
//选择分组
parent.layui.layim.setFriendGroup({
type: 'friend'
,username: user.username
,avatar: user.avatar
,group: parent.layui.layim.cache().friend //获取好友分组数据
,submit: function(group, index){
//将好友追加到主面板
parent.layui.layim.addList({
type: 'friend'
,avatar: user.avatar //好友头像
,username: user.username //好友昵称
,groupid: group //所在的分组id
,id: uid //好友ID
,sign: user.sign //好友签名
});
parent.layer.close(index);
othis.parent().html('已同意');
//实际部署时,请开启下述注释,并改成你的接口地址
/*
$.post('/im/agreeFriend', {
uid: uid //对方用户ID
,from_group: from_group //对方设定的好友分组
,group: group //我设定的好友分组
}, function(res){
if(res.code != 0){
return layer.msg(res.msg);
}
//将好友追加到主面板
parent.layui.layim.addList({
type: 'friend'
,avatar: user.avatar //好友头像
,username: user.username //好友昵称
,groupid: group //所在的分组id
,id: uid //好友ID
,sign: user.sign //好友签名
});
parent.layer.close(index);
othis.parent().html('已同意');
});
*/
}
});
}
//拒绝
,refuse: function(othis){
var li = othis.parents('li')
,uid = li.data('uid');
layer.confirm('确定拒绝吗?', function(index){
$.post('/im/refuseFriend', {
uid: uid //对方用户ID
}, function(res){
if(res.code != 0){
return layer.msg(res.msg);
}
layer.close(index);
othis.parent().html('<em>已拒绝</em>');
});
});
}
};
$('body').on('click', '.layui-btn', function(){
var othis = $(this), type = othis.data('type');
active[type] ? active[type].call(this, othis) : '';
});
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save