提交后台控制界面

master
lanxuewei 8 years ago
commit 15ef0a528b

@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="lanxuewei" />
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.attoparser:attoparser:2.0.4.RELEASE">
<CLASSES>
<root url="jar://$USER_HOME$/maven/repository/org/attoparser/attoparser/2.0.4.RELEASE/attoparser-2.0.4.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$USER_HOME$/maven/repository/org/attoparser/attoparser/2.0.4.RELEASE/attoparser-2.0.4.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$USER_HOME$/maven/repository/org/attoparser/attoparser/2.0.4.RELEASE/attoparser-2.0.4.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot-devtools:2.0.0.RELEASE">
<CLASSES>
<root url="jar://$USER_HOME$/maven/repository/org/springframework/boot/spring-boot-devtools/2.0.0.RELEASE/spring-boot-devtools-2.0.0.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$USER_HOME$/maven/repository/org/springframework/boot/spring-boot-devtools/2.0.0.RELEASE/spring-boot-devtools-2.0.0.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$USER_HOME$/maven/repository/org/springframework/boot/spring-boot-devtools/2.0.0.RELEASE/spring-boot-devtools-2.0.0.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:2.0.0.RELEASE">
<CLASSES>
<root url="jar://$USER_HOME$/maven/repository/org/springframework/boot/spring-boot-starter-thymeleaf/2.0.0.RELEASE/spring-boot-starter-thymeleaf-2.0.0.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$USER_HOME$/maven/repository/org/springframework/boot/spring-boot-starter-thymeleaf/2.0.0.RELEASE/spring-boot-starter-thymeleaf-2.0.0.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$USER_HOME$/maven/repository/org/springframework/boot/spring-boot-starter-thymeleaf/2.0.0.RELEASE/spring-boot-starter-thymeleaf-2.0.0.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.1.RELEASE">
<CLASSES>
<root url="jar://$USER_HOME$/maven/repository/org/thymeleaf/extras/thymeleaf-extras-java8time/3.0.1.RELEASE/thymeleaf-extras-java8time-3.0.1.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$USER_HOME$/maven/repository/org/thymeleaf/extras/thymeleaf-extras-java8time/3.0.1.RELEASE/thymeleaf-extras-java8time-3.0.1.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$USER_HOME$/maven/repository/org/thymeleaf/extras/thymeleaf-extras-java8time/3.0.1.RELEASE/thymeleaf-extras-java8time-3.0.1.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.thymeleaf:thymeleaf:3.0.9.RELEASE">
<CLASSES>
<root url="jar://$USER_HOME$/maven/repository/org/thymeleaf/thymeleaf/3.0.9.RELEASE/thymeleaf-3.0.9.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$USER_HOME$/maven/repository/org/thymeleaf/thymeleaf/3.0.9.RELEASE/thymeleaf-3.0.9.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$USER_HOME$/maven/repository/org/thymeleaf/thymeleaf/3.0.9.RELEASE/thymeleaf-3.0.9.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.thymeleaf:thymeleaf-spring5:3.0.9.RELEASE">
<CLASSES>
<root url="jar://$USER_HOME$/maven/repository/org/thymeleaf/thymeleaf-spring5/3.0.9.RELEASE/thymeleaf-spring5-3.0.9.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$USER_HOME$/maven/repository/org/thymeleaf/thymeleaf-spring5/3.0.9.RELEASE/thymeleaf-spring5-3.0.9.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$USER_HOME$/maven/repository/org/thymeleaf/thymeleaf-spring5/3.0.9.RELEASE/thymeleaf-spring5-3.0.9.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.unbescape:unbescape:1.1.5.RELEASE">
<CLASSES>
<root url="jar://$USER_HOME$/maven/repository/org/unbescape/unbescape/1.1.5.RELEASE/unbescape-1.1.5.RELEASE.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$USER_HOME$/maven/repository/org/unbescape/unbescape/1.1.5.RELEASE/unbescape-1.1.5.RELEASE-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$USER_HOME$/maven/repository/org/unbescape/unbescape/1.1.5.RELEASE/unbescape-1.1.5.RELEASE-sources.jar!/" />
</SOURCES>
</library>
</component>

@ -0,0 +1,2 @@
# code_on_line
code_on_line(c++) Java Imp

225
mvnw vendored

@ -0,0 +1,225 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
echo $MAVEN_PROJECTBASEDIR
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

143
mvnw.cmd vendored

@ -0,0 +1,143 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.lanxuewei</groupId>
<artifactId>code_on_line</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>code_on_line</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<!-- 依赖版本管理 -->
<pagehelper.version>4.1.6</pagehelper.version>
</properties>
<!-- 依赖 -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Spring-Mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
<!-- PageHelper分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.3</version>
</dependency>
<!-- <dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>-->
<!-- alibaba的druid数据库连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.11</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.0</version>
</dependency>
<!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.3.8.RELEASE</version>
</dependency>
<!-- thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 这个需要为 true 热部署才有效 -->
</dependency>
<!-- TODO swagger-->
<dependency>
<groupId>com.mangofactory</groupId>
<artifactId>swagger-springmvc</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- mybatis generator 自动生成代码插件 -->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile>
<overwrite>true</overwrite>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
<!-- 解决接口和sql不匹配问题 -->
<resources>
<resource>
<directory>src/main/java</directory>
<!-- 此配置不可缺否则mybatis的Mapper.xml将会丢失 -->
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<!--指定资源的位置-->
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</project>

@ -0,0 +1,20 @@
package com.lanxuewei.code_on_line;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@SpringBootApplication
public class CodeOnLineApplication {
public static void main(String[] args) {
SpringApplication.run(CodeOnLineApplication.class, args);
}
@RequestMapping(value = "/", produces = "text/plain;charset=UTF-8")
String index(){
return "Hello Spring Boot!";
}
}

@ -0,0 +1,15 @@
package com.lanxuewei.code_on_line.authorization.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* create by lanxuewei in 2018/4/18 00:02
* description: Controller使401
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Authorization {
}

@ -0,0 +1,9 @@
package com.lanxuewei.code_on_line.authorization.annotation;
/**
* create by lanxuewei in 2018/4/18 00:30
* description: controller使User
* @see com.lanxuewei.code_on_line.authorization.resolvers.CurrentUserMethodArgumentResolver
*/
public @interface CurrentUser {
}

@ -0,0 +1,24 @@
package com.lanxuewei.code_on_line.authorization.config;
/**
* create by lanxuewei in 2018/4/14 15:03
* description:
*/
public class Constants {
/**
* id
*/
public static final String CURRENT_USER_ID = "CURRENT_USER_ID";
/**
* token
*/
public static final int TOKEN_EXPIRES_HOUR = 72;
/**
* Authorizationheader
*/
public static final String AUTHORIZATION = "authorization";
}

@ -0,0 +1,49 @@
package com.lanxuewei.code_on_line.authorization.interceptor;
import com.lanxuewei.code_on_line.authorization.annotation.Authorization;
import com.lanxuewei.code_on_line.authorization.config.Constants;
import com.lanxuewei.code_on_line.authorization.manager.TokenManager;
import com.lanxuewei.code_on_line.authorization.model.TokenModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
/**
* create by lanxuewei in 2018/4/18 00:07
* description:
*
* @see com.lanxuewei.code_on_line.authorization.annotation.Authorization
*/
@Component
public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
@Autowired
private TokenManager tokenManager;
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) {
if (!(handler instanceof HandlerMethod)) { //如果不是映射方法直接通过
return true;
}
HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod();
String authorization = request.getHeader(Constants.AUTHORIZATION); //从请求头中得到token
TokenModel model = tokenManager.getToken(authorization); //验证token
if (tokenManager.checkToken(model)) { //token验证成功
//如果token验证成功将token对应的用户的id存入request便于之后的注入
request.setAttribute(Constants.CURRENT_USER_ID, model.getUserId());
return true;
}
//如果验证token失败并且方法注明了Authorization返回401错误
if (method.getAnnotation(Authorization.class) != null) {
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
return false;
}
return false;
}
}

@ -0,0 +1,37 @@
package com.lanxuewei.code_on_line.authorization.manager;
import com.lanxuewei.code_on_line.authorization.model.TokenModel;
/**
* create by lanxuewei in 2018/4/14 15:07
* description: token
*/
public interface TokenManager {
/**
* token
* @param userId userId
* @return token
*/
TokenModel createToken(Long userId);
/**
* token
* @param model token
* @return
*/
boolean checkToken(TokenModel model);
/**
* token
* @param authentication
* @return token
*/
TokenModel getToken(String authentication);
/**
* token
* @param userId userId
*/
void deleteToken(Long userId);
}

@ -0,0 +1,70 @@
package com.lanxuewei.code_on_line.authorization.manager.imp;
import com.lanxuewei.code_on_line.authorization.config.Constants;
import com.lanxuewei.code_on_line.authorization.manager.TokenManager;
import com.lanxuewei.code_on_line.authorization.model.TokenModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
* create by lanxuewei in 2018/4/14 15:18
* description: TokenManager imp
*/
@Component
public class TokenManagerImp implements TokenManager {
private RedisTemplate<Long, String> redis;
@Autowired
public void setRedis(@Qualifier("stringRedisTemplate") RedisTemplate redis) {
this.redis = redis;
//泛型设置成Long后必须更改对应的序列化方案
redis.setKeySerializer(new JdkSerializationRedisSerializer());
}
public TokenModel createToken(Long userId) {
//使用uuid作为源token
String token = UUID.randomUUID().toString().replace("-", "");
TokenModel model = new TokenModel(userId, token);
//存储到redis并设置过期时间
redis.boundValueOps(userId).set(token, Constants.TOKEN_EXPIRES_HOUR, TimeUnit.HOURS);
return model;
}
public TokenModel getToken(String authentication) {
if (authentication == null || authentication.length() == 0) {
return null;
}
String[] param = authentication.split("_");
if (param.length != 2) {
return null;
}
//使用userId和源token简单拼接成的token可以增加加密措施
long userId = Long.parseLong(param[0]);
String token = param[1];
return new TokenModel(userId, token);
}
public boolean checkToken(TokenModel model) {
if (model == null) {
return false;
}
String token = redis.boundValueOps(model.getUserId()).get();
if (!token.equals(model.getToken())) {
return false;
}
//如果验证成功说明此用户进行了一次有效操作延长token的过期时间
redis.boundValueOps(model.getUserId()).expire(Constants.TOKEN_EXPIRES_HOUR, TimeUnit.HOURS);
return true;
}
public void deleteToken(Long userId) {
redis.delete(userId);
}
}

@ -0,0 +1,33 @@
package com.lanxuewei.code_on_line.authorization.model;
/**
* create by lanxuewei in 2018/4/14 15:03
* description: TokenModelModel
* TODO url
*/
public class TokenModel {
private Long userId; //用户名
private String token; //随机生成的 uuid
public TokenModel(Long userId, String token) {
this.userId = userId;
this.token = token;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}

@ -0,0 +1,45 @@
package com.lanxuewei.code_on_line.authorization.resolvers;
import com.lanxuewei.code_on_line.authorization.annotation.CurrentUser;
import com.lanxuewei.code_on_line.authorization.config.Constants;
import com.lanxuewei.code_on_line.dao.entity.User;
import com.lanxuewei.code_on_line.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.MethodParameter;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import org.springframework.web.multipart.support.MissingServletRequestPartException;
/**
* create by lanxuewei in 2018/4/18 00:34
* description: CurrentUser
* @see com.lanxuewei.code_on_line.authorization.annotation.CurrentUser
*/
@Component
public class CurrentUserMethodArgumentResolver implements HandlerMethodArgumentResolver {
@Autowired
private UserService userService;
@Override
public boolean supportsParameter(MethodParameter methodParameter) {
//如果参数类型是User并且有CurrentUser注解则支持
if (methodParameter.getParameterType().isAssignableFrom(User.class)
&& methodParameter.hasMethodAnnotation(CurrentUser.class)) {
return true;
}
return false;
}
@Override
public Object resolveArgument(MethodParameter methodParameter, ModelAndViewContainer modelAndViewContainer, NativeWebRequest nativeWebRequest, WebDataBinderFactory webDataBinderFactory) throws Exception {
//取出鉴权时存入的登陆的用户id
Long currentUserId = (Long) nativeWebRequest.getAttribute(Constants.CURRENT_USER_ID, RequestAttributes.SCOPE_REQUEST);
//从数据库查询并返回
return userService.findByUserId(currentUserId);
}
}

@ -0,0 +1,54 @@
package com.lanxuewei.code_on_line.constant;
/**
* create by lanxuewei in 2018/4/16 14:40
* description:
*/
public enum ReturnCodeAndMsgEnum {
Success(0, "ok"), //请求成功
/**
* User
*/
Username_Or_Password_Error(-1000, "username or password error"), //账号或密码错误
User_Not_Exist(-1001, "user not exist"), //用户不存在
User_Not_Login(-1002, "user not login"), //账号未登录
/**
* Problem
*/
Problem_Not_Exist(-2001, "problem not exist");
/**
* code
*/
private int code;
/**
* info
*/
private String info;
ReturnCodeAndMsgEnum(int code, String info) {
this.code = code;
this.info = info;
}
public static ReturnCodeAndMsgEnum getByCode(int code) {
for (ReturnCodeAndMsgEnum item : ReturnCodeAndMsgEnum.values()) {
if (item.code == code) {
return item;
}
}
return null;
}
public int getCode() {
return code;
}
public String getInfo() {
return info;
}
}

@ -0,0 +1,20 @@
/**
* Copyright (c) 2017-2018 DeepWise All Rights Reserved.
* http://www.deepwise.com
*/
package com.lanxuewei.code_on_line.constant;
/**
* @author lanxuewei Create in 2018/5/2 19:56
* Description:
*/
public class ServiceConstant {
/**
* case
*/
public interface Case {
String Default_PageNum = "1"; //默认为第1页
String Default_PageSize = "5"; //默认每页大小为5
}
}

@ -0,0 +1,38 @@
package com.lanxuewei.code_on_line.controller;
import com.lanxuewei.code_on_line.constant.ReturnCodeAndMsgEnum;
import com.lanxuewei.code_on_line.constant.ServiceConstant;
import com.lanxuewei.code_on_line.model.Page;
import com.lanxuewei.code_on_line.model.ReturnValue;
import com.lanxuewei.code_on_line.service.CaseService;
import com.wordnik.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* create by lanxuewei in 2018/4/22 08:40
* description: case controller
*/
@RestController
@RequestMapping(value = "/case")
public class CaseController {
private static final Logger logger = LoggerFactory.getLogger(CaseController.class);
@Autowired
private CaseService caseService;
@RequestMapping(method = RequestMethod.GET)
@ApiOperation("select case by page")
public ReturnValue<Page> pageHelpTest(@RequestParam(defaultValue = ServiceConstant.Case.Default_PageNum) Integer pageNum,
@RequestParam(defaultValue = ServiceConstant.Case.Default_PageSize) Integer pageSize) {
return new ReturnValue<>(ReturnCodeAndMsgEnum.Success, caseService.selectByPage(pageNum, pageSize));
}
}

@ -0,0 +1,48 @@
package com.lanxuewei.code_on_line.controller;
import com.lanxuewei.code_on_line.constant.ReturnCodeAndMsgEnum;
import com.lanxuewei.code_on_line.dao.entity.Problem;
import com.lanxuewei.code_on_line.model.ReturnValue;
import com.lanxuewei.code_on_line.service.ProblemService;
import com.wordnik.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* create by lanxuewei in 2018/4/21 17:27
* description: problem controller
*/
@RestController
@RequestMapping("/problem")
public class ProblemController {
private static final Logger logger = LoggerFactory.getLogger(ProblemController.class);
@Autowired
private ProblemService problemService;
/**
* find problem by id
* @param id
* @return problem
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation("find problem by id")
public ReturnValue<Problem> findProblemById(@PathVariable Long id) {
logger.info("---> findProblemById");
Assert.notNull(id, "id can not be empty");
Problem data = problemService.findProblemById(id);
if (data != null) { //查询不为空
return new ReturnValue<>(ReturnCodeAndMsgEnum.Success, data);
} //查询结果为空 TODO data is always null
return new ReturnValue<>(ReturnCodeAndMsgEnum.Problem_Not_Exist, data);
}
}

@ -0,0 +1,61 @@
package com.lanxuewei.code_on_line.controller;
import com.lanxuewei.code_on_line.model.ReturnValue;
import com.lanxuewei.code_on_line.service.TagService;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
/**
* create by lanxuewei in 2018/4/22 08:43
* description: tag controller
*/
@RestController
@RequestMapping(value = "/tag")
public class TagController {
private static final Logger logger = LoggerFactory.getLogger(TagController.class);
@Autowired
private TagService tagService;
/**
* TODO
* @param tagName
* @return
*/
@RequestMapping(method = RequestMethod.POST)
@ApiOperation("add a tag")
public ReturnValue addTag(@RequestParam String tagName) {
return null;
}
/**
* TODO
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ApiOperation("delete a tag")
public ReturnValue deleteTagById(@PathVariable Long id) {
Assert.notNull(id, "tagId can not be empty");
tagService.deleteTagById(id);
return null;
}
/**
*
* @return tags
*/
@RequestMapping(method = RequestMethod.GET)
@ApiOperation("get tag list")
public ReturnValue getTagList() {
// TODO
return null;
}
}

@ -0,0 +1,85 @@
package com.lanxuewei.code_on_line.controller;
import com.lanxuewei.code_on_line.authorization.annotation.Authorization;
import com.lanxuewei.code_on_line.authorization.annotation.CurrentUser;
import com.lanxuewei.code_on_line.authorization.manager.TokenManager;
import com.lanxuewei.code_on_line.authorization.model.TokenModel;
import com.lanxuewei.code_on_line.constant.ReturnCodeAndMsgEnum;
import com.lanxuewei.code_on_line.dao.entity.User;
import com.lanxuewei.code_on_line.model.ReturnValue;
import com.lanxuewei.code_on_line.service.UserService;
import com.wordnik.swagger.annotations.ApiImplicitParam;
import com.wordnik.swagger.annotations.ApiImplicitParams;
import com.wordnik.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* create by lanxuewei in 2018/4/15 08:01
* description: token Restful 退
*/
@RestController
@RequestMapping("/tokens")
public class TokenController {
private static Logger logger = LoggerFactory.getLogger(TokenController.class);
@Autowired
private UserService userService;
@Autowired
private TokenManager tokenManager;
//test
@RequestMapping(value = "/test")
public void test() {
logger.info("---> test");
}
/**
*
* @param userName
* @param password
* @param status
* @return
*/
@RequestMapping(method = RequestMethod.POST)
@ApiOperation("login")
public ReturnValue<TokenModel> login(@RequestParam String userName, @RequestParam String password, @RequestParam Byte status) {
logger.info("---> login");
Assert.notNull(userName, "username can not be empty");
Assert.notNull(password, "password can not be empty");
Assert.notNull(status, "status can not be empty");
User user = userService.findByUserName(userName, status);
if (user == null || //未注册
!user.getPassword().equals(password)) { //密码错误
return new ReturnValue<TokenModel>(ReturnCodeAndMsgEnum.Username_Or_Password_Error);
}
TokenModel model = tokenManager.createToken(user.getId()); //生成一个token保持用户登陆状态
return new ReturnValue<>(ReturnCodeAndMsgEnum.Success, model);
}
/**
*
* @param user
* @return
*/
@RequestMapping(method = RequestMethod.DELETE)
@Authorization
@ApiOperation(value = "logout")
@ApiImplicitParams(
@ApiImplicitParam(name = "authorization", value = "authorization", required = true, dataType = "string", paramType = "header")
)
public ReturnValue logout(@CurrentUser User user) {
logger.info("---> logout");
tokenManager.deleteToken(user.getId());
return new ReturnValue(ReturnCodeAndMsgEnum.Success);
}
}

@ -0,0 +1,26 @@
package com.lanxuewei.code_on_line.dao.common;
/**
* create by lanxuewei in 2018/4/21 14:48
* description: dao
*/
public interface DaoConstants {
interface User{
/** user 表中 sex 字段 */
Byte Female = 0; //女
Byte Male = 1; //男
/** user 表中 status 字段 */
Byte TeacherOrManager = 0; //老师或管理员
Byte Student = 1; //学生
}
interface Problem{
/** problem 表中 difficult 字段*/
Byte easy = 0; //简单
Byte medium = 1; //中等
Byte difficult = 2; //难
}
}

@ -0,0 +1,74 @@
package com.lanxuewei.code_on_line.dao.entity;
import java.util.Date;
/**
* ( case)
*/
public class Case {
//id
private Long id;
//输入
private String input;
//输出
private String output;
//创建时间
private Date createTime;
//更新时间
private Date updateTime;
//状态码
private Byte status;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getInput() {
return input;
}
public void setInput(String input) {
this.input = input == null ? null : input.trim();
}
public String getOutput() {
return output;
}
public void setOutput(String output) {
this.output = output == null ? null : output.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
}

@ -0,0 +1,129 @@
package com.lanxuewei.code_on_line.dao.entity;
import java.util.Date;
/**
* ( problem)
*/
public class Problem {
//id
private Long id;
//问题名
private String name;
//问题难度 0:简单 1:中等 2:难 默认为0
private Byte difficulty;
//提交次数 默认为0
private Integer submit;
//失败次数 默认为 0
private Integer fail;
//成功次数 默认为 0
private Integer success;
//作者
private String author;
//创建时间
private Date createTime;
//更新时间
private Date updateTime;
//状态码
private Byte status;
//描述
private String des;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Byte getDifficulty() {
return difficulty;
}
public void setDifficulty(Byte difficulty) {
this.difficulty = difficulty;
}
public Integer getSubmit() {
return submit;
}
public void setSubmit(Integer submit) {
this.submit = submit;
}
public Integer getFail() {
return fail;
}
public void setFail(Integer fail) {
this.fail = fail;
}
public Integer getSuccess() {
return success;
}
public void setSuccess(Integer success) {
this.success = success;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public String getDes() {
return des;
}
public void setDes(String des) {
this.des = des == null ? null : des.trim();
}
}

@ -0,0 +1,63 @@
package com.lanxuewei.code_on_line.dao.entity;
import java.util.Date;
/**
* ( tag)
*/
public class Tag {
//id
private Long id;
//标签名
private String name;
//创建时间
private Date createTime;
//更新时间
private Date updateTime;
//状态码 默认0
private Byte status;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
}

@ -0,0 +1,94 @@
package com.lanxuewei.code_on_line.dao.entity;
/**
* ( user) TODO createTime updateTime
*/
public class User {
//用户id
private Long id;
//用户名
private String userName;
//密码
private String password;
//状态码 权限默认学生 0表示老师以及管理员 1表示学生
private Byte status;
//真实姓名
private String realName;
//性别
private Byte sex;
//头像
private String img;
//个人描述
private String des;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName == null ? null : userName.trim();
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName == null ? null : realName.trim();
}
public Byte getSex() {
return sex;
}
public void setSex(Byte sex) {
this.sex = sex;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img == null ? null : img.trim();
}
public String getDes() {
return des;
}
public void setDes(String des) {
this.des = des == null ? null : des.trim();
}
}

@ -0,0 +1,37 @@
package com.lanxuewei.code_on_line.dao.mapper;
import com.lanxuewei.code_on_line.dao.entity.Case;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* Problem CURD
*/
@Mapper
public interface CaseMapper {
//新增
int insert(Case record);
int insertSelective(Case record);
//删除
int deleteByPrimaryKey(Long id);
//查找
Case selectByPrimaryKey(Long id);
/**
*
* @return all case
*/
List<Case> selectAll();
/**
*
* @return count all case
*/
int selectCount();
//更新
int updateByPrimaryKeySelective(Case record);
int updateByPrimaryKey(Case record);
}

@ -0,0 +1,87 @@
<?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.lanxuewei.code_on_line.dao.mapper.CaseMapper" >
<resultMap id="BaseResultMap" type="com.lanxuewei.code_on_line.dao.entity.Case" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="input" property="input" jdbcType="VARCHAR" />
<result column="output" property="output" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="status" property="status" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List" >
id, input, output, create_time, update_time, `status`
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from `case`
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from `case`
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.lanxuewei.code_on_line.dao.entity.Case" useGeneratedKeys="true" keyProperty="id">
insert into `case` (`input`, `output`, `status`)
values (#{input,jdbcType=VARCHAR}, #{output,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.lanxuewei.code_on_line.dao.entity.Case" useGeneratedKeys="true" keyProperty="id">
insert into `case`
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="input != null" >
input,
</if>
<if test="output != null" >
output,
</if>
<if test="status != null" >
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="input != null" >
#{input,jdbcType=VARCHAR},
</if>
<if test="output != null" >
#{output,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.lanxuewei.code_on_line.dao.entity.Case" >
update `case`
<set >
<if test="input != null" >
input = #{input,jdbcType=VARCHAR},
</if>
<if test="output != null" >
output = #{output,jdbcType=VARCHAR},
</if>
<if test="status != null" >
`status` = #{status,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.lanxuewei.code_on_line.dao.entity.Case" >
update `case`
set input = #{input,jdbcType=VARCHAR},
output = #{output,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
<!-- select all -->
<select id="selectAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from `case`
</select>
<!-- count all case -->
<select id="selectCount" resultType="java.lang.Integer">
select count(*)
from `case`
</select>
</mapper>

@ -0,0 +1,26 @@
package com.lanxuewei.code_on_line.dao.mapper;
import com.lanxuewei.code_on_line.dao.entity.Problem;
import org.apache.ibatis.annotations.Mapper;
/**
* Problem CURD
*/
@Mapper
public interface ProblemMapper {
//新增
int insert(Problem record);
int insertSelective(Problem record);
//删除
int deleteByPrimaryKey(Long id);
//查找
Problem selectByPrimaryKey(Long id);
//更新
int updateByPrimaryKeySelective(Problem record);
int updateByPrimaryKeyWithBLOBs(Problem record);
int updateByPrimaryKey(Problem record);
}

@ -0,0 +1,159 @@
<?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.lanxuewei.code_on_line.dao.mapper.ProblemMapper">
<resultMap id="BaseResultMap" type="com.lanxuewei.code_on_line.dao.entity.Problem">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="difficulty" jdbcType="TINYINT" property="difficulty" />
<result column="submit" jdbcType="INTEGER" property="submit" />
<result column="fail" jdbcType="INTEGER" property="fail" />
<result column="success" jdbcType="INTEGER" property="success" />
<result column="author" jdbcType="VARCHAR" property="author" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="TINYINT" property="status" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.lanxuewei.code_on_line.dao.entity.Problem">
<result column="des" jdbcType="LONGVARCHAR" property="des" />
</resultMap>
<sql id="Base_Column_List">
id, `name`, difficulty, submit, fail, success, author, create_time, update_time, `status`
</sql>
<sql id="Blob_Column_List">
des
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from problem
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from problem
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.lanxuewei.code_on_line.dao.entity.Problem" useGeneratedKeys="true" keyProperty="id">
insert into problem (id, `name`, difficulty,
submit, fail, success,
author, status, des)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{difficulty,jdbcType=TINYINT},
#{submit,jdbcType=INTEGER}, #{fail,jdbcType=INTEGER}, #{success,jdbcType=INTEGER},
#{author,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{des,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.lanxuewei.code_on_line.dao.entity.Problem" useGeneratedKeys="true" keyProperty="id">
insert into problem
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="difficulty != null">
difficulty,
</if>
<if test="submit != null">
submit,
</if>
<if test="fail != null">
fail,
</if>
<if test="success != null">
success,
</if>
<if test="author != null">
author,
</if>
<if test="status != null">
status,
</if>
<if test="des != null">
des,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="difficulty != null">
#{difficulty,jdbcType=TINYINT},
</if>
<if test="submit != null">
#{submit,jdbcType=INTEGER},
</if>
<if test="fail != null">
#{fail,jdbcType=INTEGER},
</if>
<if test="success != null">
#{success,jdbcType=INTEGER},
</if>
<if test="author != null">
#{author,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="des != null">
#{des,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.lanxuewei.code_on_line.dao.entity.Problem">
update problem
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="difficulty != null">
difficulty = #{difficulty,jdbcType=TINYINT},
</if>
<if test="submit != null">
submit = #{submit,jdbcType=INTEGER},
</if>
<if test="fail != null">
fail = #{fail,jdbcType=INTEGER},
</if>
<if test="success != null">
success = #{success,jdbcType=INTEGER},
</if>
<if test="author != null">
author = #{author,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=TINYINT},
</if>
<if test="des != null">
des = #{des,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.lanxuewei.code_on_line.dao.entity.Problem">
update problem
set name = #{name,jdbcType=VARCHAR},
difficulty = #{difficulty,jdbcType=TINYINT},
submit = #{submit,jdbcType=INTEGER},
fail = #{fail,jdbcType=INTEGER},
success = #{success,jdbcType=INTEGER},
author = #{author,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT},
des = #{des,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.lanxuewei.code_on_line.dao.entity.Problem">
update problem
set name = #{name,jdbcType=VARCHAR},
difficulty = #{difficulty,jdbcType=TINYINT},
submit = #{submit,jdbcType=INTEGER},
fail = #{fail,jdbcType=INTEGER},
success = #{success,jdbcType=INTEGER},
author = #{author,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

@ -0,0 +1,25 @@
package com.lanxuewei.code_on_line.dao.mapper;
import com.lanxuewei.code_on_line.dao.entity.Tag;
import org.apache.ibatis.annotations.Mapper;
/**
* Tag CURD
*/
@Mapper
public interface TagMapper {
//添加
int insert(Tag record);
int insertSelective(Tag record);
//删除
int deleteByPrimaryKey(Long id);
//查找
Tag selectByPrimaryKey(Long id);
//修改
int updateByPrimaryKeySelective(Tag record);
int updateByPrimaryKey(Tag record);
}

@ -0,0 +1,75 @@
<?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.lanxuewei.code_on_line.dao.mapper.TagMapper" >
<resultMap id="BaseResultMap" type="com.lanxuewei.code_on_line.dao.entity.Tag" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="status" property="status" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List" >
id, `name`, create_time, update_time, `status`
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from tag
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from tag
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.lanxuewei.code_on_line.dao.entity.Tag" useGeneratedKeys="true" keyProperty="id">
insert into tag (id, `name`, `status`)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.lanxuewei.code_on_line.dao.entity.Tag" useGeneratedKeys="true" keyProperty="id">
insert into tag
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="name != null" >
name,
</if>
<if test="status != null" >
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.lanxuewei.code_on_line.dao.entity.Tag" >
update tag
<set >
<if test="name != null" >
name = #{name,jdbcType=VARCHAR},
</if>
<if test="status != null" >
`status` = #{status,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.lanxuewei.code_on_line.dao.entity.Tag" >
update tag
set `name` = #{name,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT}
where id = #{id,jdbcType=BIGINT}
</update>
<!-- get all tags -->
<select id="selectTagList" >
</select>
</mapper>

@ -0,0 +1,39 @@
package com.lanxuewei.code_on_line.dao.mapper;
import com.lanxuewei.code_on_line.dao.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* User CURD
*/
@Mapper
public interface UserMapper {
//增加
int insert(User record);
int insertSelective(User record);
//删除
int deleteByPrimaryKey(Long id);
//查找
/**
* idUser
* @param id id
* @return User
*/
User selectByPrimaryKey(Long id);
/**
* User
* @param userName
* @param status
* @return User
*/
User selectByUserName(@Param("userName") String userName, @Param("status") Byte status);
//修改
int updateByPrimaryKey(User record);
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKeyWithBLOBs(User record);
}

@ -0,0 +1,155 @@
<?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.lanxuewei.code_on_line.dao.mapper.UserMapper" >
<resultMap id="BaseResultMap" type="com.lanxuewei.code_on_line.dao.entity.User" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="user_name" property="userName" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="real_name" property="realName" jdbcType="VARCHAR" />
<result column="sex" property="sex" jdbcType="TINYINT" />
<result column="img" property="img" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="com.lanxuewei.code_on_line.dao.entity.User" extends="BaseResultMap" >
<result column="des" property="des" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, user_name, `password`, `status`, real_name, sex, img
</sql>
<sql id="Blob_Column_List" >
des
</sql>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from `user`
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from `user`
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.lanxuewei.code_on_line.dao.entity.User" keyProperty="id" useGeneratedKeys="true">
insert into `user` (id, user_name, password,
status, real_name, sex,
img, des)
values (#{id,jdbcType=BIGINT}, #{userName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{status,jdbcType=TINYINT}, #{realName,jdbcType=VARCHAR}, #{sex,jdbcType=TINYINT},
#{img,jdbcType=VARCHAR}, #{des,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.lanxuewei.code_on_line.dao.entity.User" keyProperty="id" useGeneratedKeys="true">
insert into `user`
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="userName != null" >
user_name,
</if>
<if test="password != null" >
password,
</if>
<if test="status != null" >
status,
</if>
<if test="realName != null" >
real_name,
</if>
<if test="sex != null" >
sex,
</if>
<if test="img != null" >
img,
</if>
<if test="des != null" >
des,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="userName != null" >
#{userName,jdbcType=VARCHAR},
</if>
<if test="password != null" >
#{password,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=TINYINT},
</if>
<if test="realName != null" >
#{realName,jdbcType=VARCHAR},
</if>
<if test="sex != null" >
#{sex,jdbcType=TINYINT},
</if>
<if test="img != null" >
#{img,jdbcType=VARCHAR},
</if>
<if test="des != null" >
#{des,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.lanxuewei.code_on_line.dao.entity.User" >
update `user`
<set >
<if test="userName != null" >
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="password != null" >
`password` = #{password,jdbcType=VARCHAR},
</if>
<if test="status != null" >
`status` = #{status,jdbcType=TINYINT},
</if>
<if test="realName != null" >
real_name = #{realName,jdbcType=VARCHAR},
</if>
<if test="sex != null" >
sex = #{sex,jdbcType=TINYINT},
</if>
<if test="img != null" >
img = #{img,jdbcType=VARCHAR},
</if>
<if test="des != null" >
des = #{des,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.lanxuewei.code_on_line.dao.entity.User" >
update `user`
set user_name = #{userName,jdbcType=VARCHAR},
`password` = #{password,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT},
real_name = #{realName,jdbcType=VARCHAR},
sex = #{sex,jdbcType=TINYINT},
img = #{img,jdbcType=VARCHAR},
des = #{des,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.lanxuewei.code_on_line.dao.entity.User" >
update `user`
set user_name = #{userName,jdbcType=VARCHAR},
`password` = #{password,jdbcType=VARCHAR},
`status` = #{status,jdbcType=TINYINT},
real_name = #{realName,jdbcType=VARCHAR},
sex = #{sex,jdbcType=TINYINT},
img = #{img,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<!-- 通过userName和status查找User -->
<select id="selectByUserName" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from `user`
where user_name = #{userName,jdbcType=VARCHAR} and
`status` = #{status,jdbcType=TINYINT}
</select>
</mapper>

@ -0,0 +1,227 @@
package com.lanxuewei.code_on_line.judger;
import sun.misc.Signal;
import sun.misc.SignalHandler;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
public class CppSolution {
public static final long OUTPUT_MAX_SIZE = 1024 * 1024;
private String mSourceCode;
private int mTimeLimit;
private long mMemoryLimit;
private Map<String, String> mTestCases;
public CppSolution(String sourceCode, int timeLimit, long memoryLimit, Map<String, String> testCases) {
mSourceCode = sourceCode;
mTimeLimit = timeLimit;
mMemoryLimit = memoryLimit;
mTestCases = testCases;
}
private static Map<String, String> makeMap(String k, String v) {
Map<String, String> map = new TreeMap<String, String>();
map.put(k, v);
return map;
}
public CppSolution(String sourceCode, int timeLimit, long memoryLimit, String input, String output) {
this(sourceCode, timeLimit, memoryLimit, makeMap(input, output));
}
private static File sWorkDir = new File(getTempDir());
private static String getTempDir() {
String tmp = System.getProperty("java.io.tmpdir");
if (tmp == null || tmp.length() == 0) {
System.getenv("TMP");
}
if (tmp == null || tmp.length() == 0) {
tmp = System.getenv("TEMP");
}
System.out.println("TMP: " + tmp);
return tmp;
}
public static void setWorkDir(String workDir) {
sWorkDir = new File(workDir);
if (!sWorkDir.exists()) {
sWorkDir.mkdirs();
}
}
private static AtomicLong mCodeCounter = new AtomicLong(0);
private File mCodeFile;
private File mBinaryFile;
private File mCompileLog;
private Map<File, File> mCaseFiles = new TreeMap<File, File>();
// create source code file and testcase input output files in work dir
private void prepareFiles() {
long codeNo = mCodeCounter.incrementAndGet();
mCodeFile = new File(sWorkDir, codeNo + ".cpp");
Utils.createTextFile(mCodeFile, mSourceCode);
int caseNo = 1;
for (Map.Entry<String, String> entry : mTestCases.entrySet()) {
File in = new File(mCodeFile.getParent(), codeNo + "-" + caseNo + ".in");
File out = new File(mCodeFile.getParent(),codeNo + "-" + caseNo + ".out");
Utils.createTextFile(in, entry.getKey());
Utils.createTextFile(out, entry.getValue());
mCaseFiles.put(in, out);
caseNo++;
}
}
private boolean mCompiled = false;
// compile source code file
private boolean compile() {
if (!mCodeFile.exists() || !new File(mCodeFile.getParent()).exists()) {
return false;
}
Process process = null;
try {
mBinaryFile = new File(mCodeFile.getAbsolutePath() + ".bin");
mCompileLog = new File(mCodeFile.getAbsolutePath() + ".log");
process = new ProcessBuilder().directory(sWorkDir)
.command("g++", mCodeFile.getAbsolutePath(), "-o", mBinaryFile.getPath())
.redirectOutput(mCompileLog)
.redirectErrorStream(true)
.start();
process.waitFor();
return process.exitValue() == 0;
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
if (process != null && process.isAlive()) {
process.destroy();
}
mCompiled = true;
}
return false;
}
public String getCompileLog() {
return mCompiled ? Utils.readTextFile(mCompileLog) : null;
}
private JudgeStatus run() {
for (Map.Entry<File, File> entry: mCaseFiles.entrySet()) {
File tin = entry.getKey();
File tout = new File(tin.getAbsolutePath() + ".out");
Process process = null;
try {
Signal.handle(new Signal("CHLD"), new SignalHandler() {
@Override
public void handle(Signal sig) {
System.out.println("sig: " + sig);
}
});
process = new ProcessBuilder().directory(sWorkDir)
.command(mBinaryFile.getAbsolutePath())
.redirectInput(tin)
.redirectOutput(tout)
.redirectErrorStream(true)
.start();
process.waitFor(mTimeLimit, TimeUnit.SECONDS);
if (tout.length() > OUTPUT_MAX_SIZE) {
return JudgeStatus.OUTPUT_LIMIT_EXCEEDED;
}
if (process.exitValue() != 0) {
return JudgeStatus.NON_ZERO_EXIT_CODE;
}
File eout = entry.getValue(); // expected output;
if (Utils.compareTextFile(tout, eout) != 0) {
return JudgeStatus.WRONG_ANSWER;
}
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
Signal.handle(new Signal("CHLD"), SignalHandler.SIG_DFL);
if (tout.exists()) {
tout.delete();
}
if (process != null && process.isAlive()) {
process.destroy();
return JudgeStatus.TIME_LIMIT_EXCEEDED;
}
}
}
return JudgeStatus.ACCEPTED;
}
/**
* clear temp file
*/
public void removeFiles() {
if (mCodeFile.exists() && mCodeFile.isFile()) {
if (mCodeFile.delete()) {
System.out.println("delete cpp file successfully!");
}
} else {
System.out.println("delete cpp file failed!");
}
if (mBinaryFile.exists() && mBinaryFile.isFile()) {
if (mBinaryFile.delete()) {
System.out.println("delete binaryFile successfully!");
}
} else {
System.out.println("delete binaryFile failed!");
}
if (mCompileLog.exists() && mCompileLog.isFile()) {
if (mCompileLog.delete()) {
System.out.println("delete compileLog successfully!");
}
} else {
System.out.println("delete compileLog failed!");
}
for (Map.Entry<File, File> entry: mCaseFiles.entrySet()) {
File tmpCaseIn = entry.getKey();
File tmpCaseOut = entry.getValue();
if (tmpCaseIn.exists() && tmpCaseIn.isFile()) {
if (tmpCaseIn.delete()){
System.out.println("delete tmpCaseIn file successfully!");
}
} else {
System.out.println("delete tmpCaseIn file failed!");
}
if (tmpCaseOut.exists() && tmpCaseOut.isFile()){
if (tmpCaseOut.delete()){
System.out.println("delete tmpCaseOut file successfully!");
}
} else {
System.out.println("delete tmpCaseOut file failed!");
}
}
}
public JudgeStatus judge() {
prepareFiles();
if (!compile()) {
return JudgeStatus.COMPILE_ERROR;
}
return run();
}
}

@ -0,0 +1,17 @@
package com.lanxuewei.code_on_line.judger;
// referenced ZOJ FAQ: http://acm.zju.edu.cn/onlinejudge/faq.do
public enum JudgeStatus {
QUEUING,
ACCEPTED,
PRESENTATION_ERROR,
WRONG_ANSWER,
TIME_LIMIT_EXCEEDED,
MEMORY_LIMIT_EXECEEDED,
OUTPUT_LIMIT_EXCEEDED,
NON_ZERO_EXIT_CODE,
COMPILE_ERROR,
SEGMENTATION_FAULT,
FLOATING_POINT_ERROR,
RUNTIME_ERROR,
}

@ -0,0 +1,69 @@
package com.lanxuewei.code_on_line.judger;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Utils {
public static boolean createTextFile(File file, String content) {
if (file == null || content == null) {
System.out.println("file or content null");
return false;
}
if (content.length() == 0) {
System.out.println("empty content!");
}
FileOutputStream out = null;
try {
if (file.exists()) {
file.delete();
}
if (!file.createNewFile()) {
System.out.println("create file " + file + " failed!");
return false;
}
out = new FileOutputStream(file);
out.write(content.getBytes());
out.flush();
return true;
} catch (IOException e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
System.out.println("create text file: `" + file + "`, content: `" + content + "` failed!");
return false;
}
public static String readTextFile(File file) {
if (file == null) return null;
try {
byte[] bytes = Files.readAllBytes(Paths.get(file.toURI()));
return new String(bytes);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
public static int compareTextFile(File a, File b) {
String atxt = readTextFile(a);
if (atxt == null) atxt = "";
return atxt.compareTo(readTextFile(b));
}
public static int secondToMilliSecond(int second) {
return second * 1000;
}
}

@ -0,0 +1,73 @@
package com.lanxuewei.code_on_line.judger.test;
import com.lanxuewei.code_on_line.judger.CppSolution;
import com.lanxuewei.code_on_line.judger.JudgeStatus;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
public class CppSolutionTest extends TestCase {
@Test
public void testAccepted() {
String source = "#include <stdio.h>\n"
+ "int main() {\n"
+ " int a, b;\n"
+ " scanf(\"%d%d\", &a, &b);\n"
+ " printf(\"%d\", a + b);\n"
+ " return 0;\n"
+ "}\n";
CppSolution solution = new CppSolution(source, 1000, 1024, "1 2", "3");
Assert.assertEquals(solution.judge(), JudgeStatus.ACCEPTED);
solution.removeFiles();
}
@Test
public void testWrongAnswer() {
String source = "#include <stdio.h>\n"
+ "int main() {\n"
+ " int a, b;\n"
+ " scanf(\"%d%d\", &a, &b);\n"
+ " printf(\"%d\", a + b);\n"
+ " return 0;\n"
+ "}\n";
CppSolution solution = new CppSolution(source, 1000, 1024, "1 2", "4");
Assert.assertEquals(solution.judge(), JudgeStatus.WRONG_ANSWER);
}
@Test
public void testCompileFailed() {
String source = "#include <stdio.h>\n"
+ "int m() {\n"
+ "}\n";
CppSolution solution = new CppSolution(source, 1000, 1024, "1 2", "3");
Assert.assertEquals(solution.judge(), JudgeStatus.COMPILE_ERROR);
System.out.println("compile failed: `" + solution.getCompileLog() + "`");
Assert.assertTrue(solution.getCompileLog().length() > 0);
}
@Test
public void testTimeLimitExceed() {
String source = "#include <stdio.h>\n"
+ "int main() {\n"
+ " while(1);"
+ "}\n";
CppSolution solution = new CppSolution(source, 5, 1024, "1 2", "3");
Assert.assertEquals(solution.judge(), JudgeStatus.TIME_LIMIT_EXCEEDED);
}
@Test
public void testOutputLimitExceeded() {
String source = "#include <stdio.h>\n"
+ "int main() {\n"
+ " for (int i = 0; i < 1024*1024+1; i++) {"
+ " printf(\".\");\n"
+ " }\n"
+ " return 0;\n"
+ "}\n";
CppSolution solution = new CppSolution(source, 3, 1024, "1 2", "3");
Assert.assertEquals(solution.judge(), JudgeStatus.OUTPUT_LIMIT_EXCEEDED);
}
}

@ -0,0 +1,115 @@
package com.lanxuewei.code_on_line.model;
import com.github.pagehelper.PageInfo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* create by lanxuewei in 2018/4/15 22:29
* description:
*/
public class Page<T> implements Serializable {
private static final long serialVersionUID = 1L;
public final static int PAGE_INDEX = 1;
public final static int PAGE_SIZE = 10;
/**
* 1
*/
private int pageIndex = PAGE_INDEX;
/**
*
*/
private int pageSize = PAGE_SIZE;
/**
*
*/
private List<T> rows;
/**
*
*/
private long total;
/**
*
*/
private long pageCount;
/**
*
*/
private boolean hasNext;
/**
*
*/
private boolean hasPrevious;
/**
*
*/
public Page() {
this(PAGE_INDEX, PAGE_SIZE, 0, new ArrayList<T>());
}
/**
*
* @param pageIndex
* @param pageSize
* @param total
* @param rows
*/
public Page(int pageIndex, int pageSize, long total, List<T> rows) {
this.pageIndex = pageIndex;
this.pageSize = pageSize;
this.total = total;
this.pageCount = total / pageSize + ((total % pageSize) > 0 ? 1 : 0);
this.hasNext = pageIndex < pageCount;
this.hasPrevious = pageIndex > 1;
this.rows = rows;
}
/**
*
* PageHelperList
* @param rows
*/
public Page(List<T> rows) {
PageInfo<T> pageInfo = new PageInfo<>(rows);
this.pageIndex = pageInfo.getPageNum();
this.pageSize = pageInfo.getPageSize();
this.total = pageInfo.getTotal();
this.pageCount = total / pageSize + ((total % pageSize) > 0 ? 1 : 0);
this.hasNext = pageIndex < pageCount;
this.hasPrevious = pageIndex > 1;
this.rows = rows;
}
public int getPageSize() {
return pageSize;
}
public int getPageIndex() {
return pageIndex;
}
public List<T> getRows() {
return rows;
}
public long getTotal() {
return total;
}
public long getPageCount() {
return pageCount;
}
public boolean isHasNext() {
return hasNext;
}
public boolean isHasPrevious() {
return hasPrevious;
}
}

@ -0,0 +1,68 @@
package com.lanxuewei.code_on_line.model;
import com.lanxuewei.code_on_line.constant.ReturnCodeAndMsgEnum;
/**
* create by lanxuewei in 2018/4/15 22:29
* description: controller model
*/
public class ReturnValue<T> {
/**
*
*/
private Integer code = null;
/**
*
*/
private String info = null;
/**
*
*/
private T data = null;
/**
*
*
* @param code
* @param info
*/
public ReturnValue(Integer code, String info) {
this.code = code;
this.info = info;
}
/**
* ()
*
* @param code
* @param info
* @param data
*/
public ReturnValue(Integer code, String info, T data) {
this.code = code;
this.info = info;
this.data = data;
}
public ReturnValue(ReturnCodeAndMsgEnum codeAndMsg) {
this(codeAndMsg.getCode(), codeAndMsg.getInfo());
}
public ReturnValue(ReturnCodeAndMsgEnum codeAndMsgEnum, T data) {
this(codeAndMsgEnum.getCode(), codeAndMsgEnum.getInfo(), data);
}
public Integer getCode() {
return code;
}
public String getInfo() {
return info;
}
public Object getData() {
return data;
}
}

@ -0,0 +1,62 @@
package com.lanxuewei.code_on_line.service;
import com.lanxuewei.code_on_line.dao.entity.Case;
import com.lanxuewei.code_on_line.model.Page;
import java.util.List;
/**
* create by lanxuewei in 2018/4/21 19:04
* description: Case CURD
*/
public interface CaseService {
//新增
/**
* add case
* @param problemCase
* @return true or false
*/
boolean addCase(Case problemCase);
//删除
/**
* delete case by id
* @param id
* @return true or false
*/
boolean deleteCaseById(Long id);
//查询
/**
* find case by id
* @param id
* @return true or false
*/
Case findCaseById(Long id);
/**
*
* @return all case
*/
List<Case> selectAll();
/**
*
* @return count all case
*/
int selectCount();
/**
* case
* @param pageNum
* @param pageSize
* @return
*/
Page<Case> selectByPage(Integer pageNum, Integer pageSize);
//修改
/**
* modify case by id
* @param problemCase
* @return true or false
*/
boolean modifyCaseById(Case problemCase);
}

@ -0,0 +1,44 @@
package com.lanxuewei.code_on_line.service;
import com.lanxuewei.code_on_line.dao.entity.Problem;
import org.springframework.stereotype.Service;
/**
* create by lanxuewei in 2018/4/21 17:30
* description: Problem CURD
*/
@Service
public interface ProblemService {
//add
/**
* add problem
* @param problem
* @return true or false
*/
boolean addProblem(Problem problem);
//delete
/**
* delete problem by id
* @param id
* @return true or false
*/
boolean deleteProblemById(Long id);
//find
/**
* find problem
* @param id
* @return true or false
*/
Problem findProblemById(Long id);
//modify
/**
* modify problem
* @param problem
* @return true or false
*/
boolean modifyProblemById(Problem problem);
}

@ -0,0 +1,42 @@
package com.lanxuewei.code_on_line.service;
import com.lanxuewei.code_on_line.dao.entity.Tag;
/**
* create by lanxuewei in 2018/4/21 19:15
* description: Tag CURD
*/
public interface TagService {
//新增
/**
* add tag
* @param tag
* @return true or false
*/
boolean addTag(Tag tag);
//删除
/**
* delete tag by id
* @param id
* @return true or false
*/
boolean deleteTagById(Long id);
//查询
/**
* find tag by id
* @param id
* @return tag
*/
Tag findTagById(Long id);
//修改
/**
* modify tag by id
* @param tag
* @return true or false
*/
boolean modifyTagById(Tag tag);
}

@ -0,0 +1,49 @@
package com.lanxuewei.code_on_line.service;
import com.lanxuewei.code_on_line.dao.entity.User;
import org.springframework.stereotype.Service;
/**
* create by lanxuewei in 2018/4/15 21:06
* description: User CURD
*/
@Service
public interface UserService {
//add
/**
*
* @param user
* @return
*/
boolean addUser(User user);
//delete
/**
* (TODO )
* @param userId
* @return
*/
boolean deleteUserByUserId(Long userId);
//find
/**
* status
* @param userName
* @param status
* @return
*/
User findByUserName(String userName, Byte status);
User findByUserId(Long userId);
//modify
/**
*
* @param userName
* @return
*/
boolean modifyUserByUserName(String userName);
}

@ -0,0 +1,64 @@
package com.lanxuewei.code_on_line.service.imp;
import com.github.pagehelper.PageHelper;
import com.lanxuewei.code_on_line.constant.ServiceConstant;
import com.lanxuewei.code_on_line.dao.entity.Case;
import com.lanxuewei.code_on_line.dao.mapper.CaseMapper;
import com.lanxuewei.code_on_line.model.Page;
import com.lanxuewei.code_on_line.service.CaseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* create by lanxuewei in 2018/4/21 19:10
* description: Case
*/
@Service
public class CaseServiceImp implements CaseService{
private static final Logger logger = LoggerFactory.getLogger(CaseServiceImp.class);
@Autowired
private CaseMapper caseMapper;
@Override
public boolean addCase(Case problemCase) {
return caseMapper.insert(problemCase) != 0;
}
@Override
public boolean deleteCaseById(Long id) {
return caseMapper.deleteByPrimaryKey(id) != 0;
}
@Override
public Case findCaseById(Long id) {
return caseMapper.selectByPrimaryKey(id);
}
@Override
public List<Case> selectAll() {
return caseMapper.selectAll();
}
@Override
public Page<Case> selectByPage(Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize); //分页查询
List<Case> cases = caseMapper.selectAll();
return new Page<>(cases);
}
@Override
public int selectCount() {
return caseMapper.selectCount();
}
@Override
public boolean modifyCaseById(Case problemCase) {
return caseMapper.updateByPrimaryKey(problemCase) != 0;
}
}

@ -0,0 +1,42 @@
package com.lanxuewei.code_on_line.service.imp;
import com.lanxuewei.code_on_line.dao.entity.Problem;
import com.lanxuewei.code_on_line.dao.mapper.ProblemMapper;
import com.lanxuewei.code_on_line.service.ProblemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* create by lanxuewei in 2018/4/21 18:39
* description: Problem
*/
@Service
public class ProblemServiceImp implements ProblemService{
private static final Logger logger = LoggerFactory.getLogger(ProblemServiceImp.class);
@Autowired
private ProblemMapper problemMapper;
@Override
public boolean addProblem(Problem problem) {
return problemMapper.insert(problem) != 0;
}
@Override
public boolean deleteProblemById(Long id) {
return problemMapper.deleteByPrimaryKey(id) != 0;
}
@Override
public Problem findProblemById(Long id) {
return problemMapper.selectByPrimaryKey(id);
}
@Override
public boolean modifyProblemById(Problem problem) {
return problemMapper.updateByPrimaryKey(problem) != 0;
}
}

@ -0,0 +1,42 @@
package com.lanxuewei.code_on_line.service.imp;
import com.lanxuewei.code_on_line.dao.entity.Tag;
import com.lanxuewei.code_on_line.dao.mapper.TagMapper;
import com.lanxuewei.code_on_line.service.TagService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* create by lanxuewei in 2018/4/21 19:19
* description: Tag
*/
@Service
public class TagServiceImp implements TagService{
private static final Logger logger = LoggerFactory.getLogger(TagServiceImp.class);
@Autowired
private TagMapper tagMapper;
@Override
public boolean addTag(Tag tag) {
return tagMapper.insert(tag) != 0;
}
@Override
public boolean deleteTagById(Long id) {
return tagMapper.deleteByPrimaryKey(id) != 0;
}
@Override
public Tag findTagById(Long id) {
return tagMapper.selectByPrimaryKey(id);
}
@Override
public boolean modifyTagById(Tag tag) {
return tagMapper.updateByPrimaryKey(tag) != 0;
}
}

@ -0,0 +1,68 @@
package com.lanxuewei.code_on_line.service.imp;
import com.lanxuewei.code_on_line.dao.entity.User;
import com.lanxuewei.code_on_line.dao.mapper.UserMapper;
import com.lanxuewei.code_on_line.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* create by lanxuewei in 2018/4/15 21:32
* description: User
*/
@Service
public class UserServiceImp implements UserService{
private static Logger logger = LoggerFactory.getLogger(UserServiceImp.class);
@Autowired
private UserMapper userMapper;
/**
*
* @param user
* @return
*/
@Override
public boolean addUser(User user) {
return false;
}
/**
*
* @param userId
* @return
*/
@Override
public boolean deleteUserByUserId(Long userId) {
return false;
}
/**
*
* @param userName
* @param status
* @return
*/
@Override
public User findByUserName(String userName, Byte status) {
return userMapper.selectByUserName(userName, status);
}
@Override
public User findByUserId(Long userId) {
return userMapper.selectByPrimaryKey(userId);
}
/**
*
* @param userName
* @return
*/
@Override
public boolean modifyUserByUserName(String userName) {
return false;
}
}

@ -0,0 +1,182 @@
package com.lanxuewei.code_on_line.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Field;
import java.util.*;
/**
* create by lanxuewei in 2018/3/31
*
*/
public class CompareUtil {
private static final Logger logger = LoggerFactory.getLogger(CompareUtil.class);
/**
*
*/
public static boolean isPropertiesEquals(Object o1, Object o2) {
if (o1 == null && o2 == null) { //两者为空
return true;
}
if (o1 == null || o2 == null) { //其中有一个为空
return false;
}
//两者都不为空,对实例中属性值进行对比
Field[] fields = o1.getClass().getDeclaredFields(); //获得所有属性值
for (Field field : fields){
field.setAccessible(true); //设置对象属性的可见行,访问私有属性
try {
Object fieldObj1 = field.get(o1); //获取该o1和o2该字段的具体属性值
Object fieldObj2 = field.get(o2);
if (!isEqual(fieldObj1, fieldObj2)){ //属性值对比,不相同则false
logger.error("{} property is different : obj1 = {} ---> obj2 = {}", field.getName() , fieldObj1, fieldObj2);
return false;
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
return true;
}
/**
* ignoreProperties
*/
public static boolean isPropertiesEquals(Object o1, Object o2, Set<String> ignoreProperties){
if (o1 == null && o2 == null) { //两者为空
return true;
}
if (o1 == null || o2 == null) { //其中有一个为空
return false;
}
//两者都不为空,对实例中属性值进行对比
Field[] fields = o1.getClass().getDeclaredFields(); //获得所有属性值
for (Field field : fields) {
field.setAccessible(true); //设置对象属性的可见行,访问私有属性
try {
if (!ignoreProperties.contains(field.getName())) { //遇到需要比较的属性值则比较
Object fieldObj1 = field.get(o1);
Object fieldObj2 = field.get(o2);
if (!isEqual(fieldObj1, fieldObj2)) { //某个属性值不相同false
logger.error("{} property is different : obj1 = {} ---> obj2 = {}", field.getName() , fieldObj1, fieldObj2);
return false;
}
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
return true;
}
public static boolean isEqual(Object o1, Object o2) {
if (o1 == null) {
return o2 == null;
} else if (o2 == null) {
return false;
} else {
return o1 instanceof Date ? isDateEqual((Date)o1, (Date)o2) : o1.equals(o2);
}
}
public static boolean isStringEqualIgnoreCase(String o1, String o2) {
if (o1 == null) {
return o2 == null;
} else {
return o2 == null ? false : o1.equalsIgnoreCase(o2);
}
}
public static boolean isEmpty(String str) {
return str == null || "".equals(str.trim());
}
public static boolean isNotEmpty(String str) {
return !isEmpty(str);
}
public static boolean isBigThan0(Number val) {
return val != null && val.doubleValue() > 0.0D;
}
public static boolean isNotEmpty(Collection list) {
return list != null && list.size() > 0;
}
public static boolean isEmpty(Collection list) {
return list == null || list.size() == 0;
}
public static boolean isBetween(Number num, Number min, Number max) {
return isGreaterAndEqualThan(num, min) && isLessAndEqualThan(num, max);
}
public static boolean isGreaterThan(Number num1, Number num2) {
double numA = 0.0D;
double numB = 0.0D;
if (num1 != null) {
numA = num1.doubleValue();
}
if (num2 != null) {
numB = num2.doubleValue();
}
return numA - numB > 0.0D;
}
public static boolean isLessThan(Number num1, Number num2) {
double numA = 0.0D;
double numB = 0.0D;
if (num1 != null) {
numA = num1.doubleValue();
}
if (num2 != null) {
numB = num2.doubleValue();
}
return numA - numB < 0.0D;
}
public static boolean isGreaterAndEqualThan(Number num1, Number num2) {
double numA = 0.0D;
double numB = 0.0D;
if (num1 != null) {
numA = num1.doubleValue();
}
if (num2 != null) {
numB = num2.doubleValue();
}
return numA - numB >= 0.0D;
}
public static boolean isLessAndEqualThan(Number num1, Number num2) {
double numA = 0.0D;
double numB = 0.0D;
if (num1 != null) {
numA = num1.doubleValue();
}
if (num2 != null) {
numB = num2.doubleValue();
}
return numA - numB <= 0.0D;
}
private static boolean isDateEqual(Date o1, Date o2) {
Calendar c1 = Calendar.getInstance();
c1.setTime(o1);
Calendar c2 = Calendar.getInstance();
c2.setTime(o2);
return c1.get(1) == c2.get(1) && c1.get(2) == c2.get(2) && c1.get(5) == c2.get(5) && c1.get(11) == c2.get(11) && c1.get(12) == c2.get(12) && c1.get(13) == c2.get(13);
}
}

@ -0,0 +1,23 @@
package com.lanxuewei.code_on_line.utils;
import org.springframework.util.DigestUtils;
/**
*
*/
public class Md5Util {
private static final String salt = "%*HE$24hdi55)&H"; //盐值
/**
* 使 md5
* @param sourceStr
* @return
*/
public static String getMd5(String sourceStr){
String base = sourceStr + "/" + salt;
String md5 = DigestUtils.md5DigestAsHex(base.getBytes());
return md5;
}
}

@ -0,0 +1,26 @@
package com.lanxuewei.code_on_line.utils;
import java.util.Random;
/**
* create by lanxuewei in 2018/3/31
* String util
*/
public class StringUtil {
/**
*
* @param length string length
*/
public static String createStringByRandom(int length) {
Random random = new Random();
String string = "zxcvbnmlkjhgfdsaqwertyuiopQWERTYUIOPASDFGHJKLZXCVBNM1234567890"; //定义一个字符串A-Za-z0-9即62位
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < length; i++) {
int number = random.nextInt(61); //由Random生成随机数(0-61)
stringBuffer.append(string.charAt(number));
}
return stringBuffer.toString();
}
}

@ -0,0 +1,42 @@
server:
port: 8080
spring:
datasource:
name: codeonline
url: jdbc:mysql://127.0.0.1:3306/code_on_line?characterEncoding=utf8&useSSL=true
username: root
password: 520027
type: com.alibaba.druid.pool.DruidDataSource # 使用druid数据源
driver-class-name: com.mysql.jdbc.Driver
filters: stat
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
redis:
database: 0 # Redis数据库索引默认为0
host: localhost # Redis服务器地址
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码默认为空
jedis:
pool:
max-active: 8 # 连接池最大连接数(使用负数表示没有限制)
max-idle: 8 # 连接池中的最大空闲连接
min-idle: 0 # 连接池中最小空闲连接
mybatis:
mybatis.mapper-locations: classpath:com.lanxuewei.code_on_line.dao.mapper/*.xml
type-aliases-package: com.lanxuewei.code_on_line.dao.entity
#分页插件配置 默认配置
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql

@ -0,0 +1,6 @@
.__ .__
| | _____ ____ ___ _____ __ ______ _ __ ____ |__|
| | \__ \ / \\ \/ / | \_/ __ \ \/ \/ // __ \| |
| |__/ __ \| | \> <| | /\ ___/\ /\ ___/| |
|____(____ /___| /__/\_ \____/ \___ >\/\_/ \___ >__|
\/ \/ \/ \/ \/

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- 数据库驱动:选择你的本地硬盘上面的数据库驱动包-->
<classPathEntry location="/Users/lanxuewei/maven/repository/mysql/mysql-connector-java/5.1.45/mysql-connector-java-5.1.45.jar"/>
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true"/>
<!-- 是否去除自动生成的注释 true false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!--数据库链接URL用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1/code_on_line" userId="root" password="520027">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 生成模型的包名和位置-->
<javaModelGenerator targetPackage="com.lanxuewei.code_on_line.dao.entity" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- 生成映射文件的包名和位置-->
<sqlMapGenerator targetPackage="com.lanxuewei.code_on_line.dao.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 生成DAO的包名和位置-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.lanxuewei.code_on_line.dao.mapper" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<!--<table tableName="user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<table tableName="problem" domainObjectName="Problem" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="tag" domainObjectName="Tag" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="case" domainObjectName="Case" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="problem" domainObjectName="Problem" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="problem" domainObjectName="Problem" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
</context>
</generatorConfiguration>

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds">
<property name="LOG_HOME" value="log" />
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>
[ %-5level] [%date{yyyy-MM-dd HH:mm:ss.SSS}] %logger{96} [%line] [%thread]- %msg%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily 配置日志所生成的目录以及生成文件名的规则 -->
<fileNamePattern>${LOG_HOME}/log_%d{yyyyMMdd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>64 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>30</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<!-- Safely log to the same file from multiple JVMs. Degrades performance! -->
<prudent>false</prudent>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
[ %-5level] [%date{yyyy-MM-dd HH:mm:ss.SSS}] %logger{96} [%line] [%thread]- %msg%n
</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
</appender>
<!-- 邮件监控异常 -->
<!-- <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
<smtpHost>smtp.163.com</smtpHost>
<username>cairs-2w010@163.com</username>
<password>zxc1s2dsa46</password>
<from>cairs-2010@163.com</from>
<to>403411d876@qq.com</to>
<subject>【web-ext-Error】: %logger</subject>
<layout class="ch.qos.logback.classic.html.HTMLLayout"/>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>-->
<!-- Enable FILE and STDOUT appenders for all log messages. By default,
only log at level INFO and above. -->
<root level="DEBUG">
<appender-ref ref="STDOUT" />
<!--<appender-ref ref="FILE" />-->
<!--<appender-ref ref="EMAIL" />-->
</root>
<!-- For loggers in the these namespaces, log at all levels. -->
<!-- <logger name="pedestal" level="ALL" /> <logger name="hammock-cafe"
level="ALL" /> <logger name="user" level="ALL" /> -->
</configuration>

@ -0,0 +1,145 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.0</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="x-body">
<form class="layui-form">
<div class="layui-form-item">
<label for="username" class="layui-form-label">
<span class="x-red">*</span>登录名
</label>
<div class="layui-input-inline">
<input type="text" id="username" name="username" required="" lay-verify="required"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
<span class="x-red">*</span>将会成为您唯一的登入名
</div>
</div>
<div class="layui-form-item">
<label for="phone" class="layui-form-label">
<span class="x-red">*</span>手机
</label>
<div class="layui-input-inline">
<input type="text" id="phone" name="phone" required="" lay-verify="phone"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
<span class="x-red">*</span>将会成为您唯一的登入名
</div>
</div>
<div class="layui-form-item">
<label for="L_email" class="layui-form-label">
<span class="x-red">*</span>邮箱
</label>
<div class="layui-input-inline">
<input type="text" id="L_email" name="email" required="" lay-verify="email"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
<span class="x-red">*</span>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="x-red">*</span>角色</label>
<div class="layui-input-block">
<input type="checkbox" name="like1[write]" lay-skin="primary" title="超级管理员" checked="">
<input type="checkbox" name="like1[read]" lay-skin="primary" title="编辑人员">
<input type="checkbox" name="like1[write]" lay-skin="primary" title="宣传人员" checked="">
</div>
</div>
<div class="layui-form-item">
<label for="L_pass" class="layui-form-label">
<span class="x-red">*</span>密码
</label>
<div class="layui-input-inline">
<input type="password" id="L_pass" name="pass" required="" lay-verify="pass"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
6到16个字符
</div>
</div>
<div class="layui-form-item">
<label for="L_repass" class="layui-form-label">
<span class="x-red">*</span>确认密码
</label>
<div class="layui-input-inline">
<input type="password" id="L_repass" name="repass" required="" lay-verify="repass"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="L_repass" class="layui-form-label">
</label>
<button class="layui-btn" lay-filter="add" lay-submit="">
增加
</button>
</div>
</form>
</div>
<script>
layui.use(['form','layer'], function(){
$ = layui.jquery;
var form = layui.form
,layer = layui.layer;
//自定义验证规则
form.verify({
nikename: function(value){
if(value.length < 5){
return '昵称至少得5个字符啊';
}
}
,pass: [/(.+){6,12}$/, '密码必须6到12位']
,repass: function(value){
if($('#L_pass').val()!==$('#L_repass').val()){
return '两次密码不一致';
}
}
});
//监听提交
form.on('submit(add)', function(data){
console.log(data);
//发异步把数据提交给php
layer.alert("增加成功", {icon: 6},function () {
// 获得frame索引
var index = parent.layer.getFrameIndex(window.name);
//关闭当前frame
parent.layer.close(index);
});
return false;
});
});
</script>
<script>var _hmt = _hmt || []; (function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>

@ -0,0 +1,154 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.0</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="x-nav">
<span class="layui-breadcrumb">
<a href="">首页</a>
<a href="">演示</a>
<a>
<cite>导航元素</cite></a>
</span>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
<i class="layui-icon" style="line-height:30px"></i></a>
</div>
<div class="x-body">
<div class="layui-row">
<form class="layui-form layui-col-md12 x-so layui-form-pane">
<input class="layui-input" placeholder="分类名" name="cate_name">
<button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon"></i>增加</button>
</form>
</div>
<xblock>
<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
<span class="x-right" style="line-height:40px">共有数据88 条</span>
</xblock>
<table class="layui-table">
<thead>
<tr>
<th>
<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
</th>
<th>ID</th>
<th>分类名</th>
<th>操作</th>
</thead>
<tbody>
<tr>
<td>
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
</td>
<td>1</td>
<td>会员相关</td>
<td class="td-manage">
<a title="编辑" onclick="x_admin_show('编辑','admin-edit.html')" href="javascript:;">
<i class="layui-icon">&#xe642;</i>
</a>
<a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">
<i class="layui-icon">&#xe640;</i>
</a>
</td>
</tr>
</tbody>
</table>
<div class="page">
<div>
<a class="prev" href="">&lt;&lt;</a>
<a class="num" href="">1</a>
<span class="current">2</span>
<a class="num" href="">3</a>
<a class="num" href="">489</a>
<a class="next" href="">&gt;&gt;</a>
</div>
</div>
</div>
<script>
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
});
/*用户-停用*/
function member_stop(obj,id){
layer.confirm('确认要停用吗?',function(index){
if($(obj).attr('title')=='启用'){
//发异步把用户状态进行更改
$(obj).attr('title','停用')
$(obj).find('i').html('&#xe62f;');
$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
layer.msg('已停用!',{icon: 5,time:1000});
}else{
$(obj).attr('title','启用')
$(obj).find('i').html('&#xe601;');
$(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
layer.msg('已启用!',{icon: 5,time:1000});
}
});
}
/*用户-删除*/
function member_del(obj,id){
layer.confirm('确认要删除吗?',function(index){
//发异步删除数据
$(obj).parents("tr").remove();
layer.msg('已删除!',{icon:1,time:1000});
});
}
function delAll (argument) {
var data = tableCheck.getData();
layer.confirm('确认要删除吗?'+data,function(index){
//捉到所有被选中的,发异步进行删除
layer.msg('删除成功', {icon: 1});
$(".layui-form-checked").not('.header').parents('tr').remove();
});
}
</script>
<script>var _hmt = _hmt || []; (function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>

@ -0,0 +1,145 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.0</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="x-body">
<form class="layui-form">
<div class="layui-form-item">
<label for="username" class="layui-form-label">
<span class="x-red">*</span>登录名
</label>
<div class="layui-input-inline">
<input type="text" id="username" name="username" required="" lay-verify="required"
autocomplete="off" value="admin" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
<span class="x-red">*</span>将会成为您唯一的登入名
</div>
</div>
<div class="layui-form-item">
<label for="phone" class="layui-form-label">
<span class="x-red">*</span>手机
</label>
<div class="layui-input-inline">
<input type="text" value="18925139194" id="phone" name="phone" required="" lay-verify="phone"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
<span class="x-red">*</span>将会成为您唯一的登入名
</div>
</div>
<div class="layui-form-item">
<label for="L_email" class="layui-form-label">
<span class="x-red">*</span>邮箱
</label>
<div class="layui-input-inline">
<input type="text" value="113664000@qq.com" id="L_email" name="email" required="" lay-verify="email"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
<span class="x-red">*</span>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="x-red">*</span>角色</label>
<div class="layui-input-block">
<input type="checkbox" name="like1[write]" lay-skin="primary" title="超级管理员" checked="">
<input type="checkbox" name="like1[read]" lay-skin="primary" title="编辑人员">
<input type="checkbox" name="like1[write]" lay-skin="primary" title="宣传人员" >
</div>
</div>
<div class="layui-form-item">
<label for="L_pass" class="layui-form-label">
<span class="x-red">*</span>密码
</label>
<div class="layui-input-inline">
<input type="password" id="L_pass" name="pass" required="" lay-verify="pass"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
6到16个字符
</div>
</div>
<div class="layui-form-item">
<label for="L_repass" class="layui-form-label">
<span class="x-red">*</span>确认密码
</label>
<div class="layui-input-inline">
<input type="password" id="L_repass" name="repass" required="" lay-verify="repass"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="L_repass" class="layui-form-label">
</label>
<button class="layui-btn" lay-filter="add" lay-submit="">
增加
</button>
</div>
</form>
</div>
<script>
layui.use(['form','layer'], function(){
$ = layui.jquery;
var form = layui.form
,layer = layui.layer;
//自定义验证规则
form.verify({
nikename: function(value){
if(value.length < 5){
return '昵称至少得5个字符啊';
}
}
,pass: [/(.+){6,12}$/, '密码必须6到12位']
,repass: function(value){
if($('#L_pass').val()!=$('#L_repass').val()){
return '两次密码不一致';
}
}
});
//监听提交
form.on('submit(add)', function(data){
console.log(data);
//发异步把数据提交给php
layer.alert("增加成功", {icon: 6},function () {
// 获得frame索引
var index = parent.layer.getFrameIndex(window.name);
//关闭当前frame
parent.layer.close(index);
});
return false;
});
});
</script>
<script>var _hmt = _hmt || []; (function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>

@ -0,0 +1,171 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.0</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="x-nav">
<span class="layui-breadcrumb">
<a href="">首页</a>
<a href="">演示</a>
<a>
<cite>导航元素</cite></a>
</span>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
<i class="layui-icon" style="line-height:30px"></i></a>
</div>
<div class="x-body">
<div class="layui-row">
<form class="layui-form layui-col-md12 x-so">
<input class="layui-input" placeholder="开始日" name="start" id="start">
<input class="layui-input" placeholder="截止日" name="end" id="end">
<input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
<button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
</form>
</div>
<xblock>
<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
<button class="layui-btn" onclick="x_admin_show('添加用户','./admin-add.html')"><i class="layui-icon"></i>添加</button>
<span class="x-right" style="line-height:40px">共有数据88 条</span>
</xblock>
<table class="layui-table">
<thead>
<tr>
<th>
<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
</th>
<th>ID</th>
<th>登录名</th>
<th>手机</th>
<th>邮箱</th>
<th>角色</th>
<th>加入时间</th>
<th>状态</th>
<th>操作</th>
</thead>
<tbody>
<tr>
<td>
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
</td>
<td>1</td>
<td>admin</td>
<td>18925139194</td>
<td>113664000@qq.com</td>
<td>超级管理员</td>
<td>2017-01-01 11:11:42</td>
<td class="td-status">
<span class="layui-btn layui-btn-normal layui-btn-mini">已启用</span></td>
<td class="td-manage">
<a onclick="member_stop(this,'10001')" href="javascript:;" title="启用">
<i class="layui-icon">&#xe601;</i>
</a>
<a title="编辑" onclick="x_admin_show('编辑','admin-edit.html')" href="javascript:;">
<i class="layui-icon">&#xe642;</i>
</a>
<a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">
<i class="layui-icon">&#xe640;</i>
</a>
</td>
</tr>
</tbody>
</table>
<div class="page">
<div>
<a class="prev" href="">&lt;&lt;</a>
<a class="num" href="">1</a>
<span class="current">2</span>
<a class="num" href="">3</a>
<a class="num" href="">489</a>
<a class="next" href="">&gt;&gt;</a>
</div>
</div>
</div>
<script>
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
});
/*用户-停用*/
function member_stop(obj,id){
layer.confirm('确认要停用吗?',function(index){
if($(obj).attr('title')=='启用'){
//发异步把用户状态进行更改
$(obj).attr('title','停用')
$(obj).find('i').html('&#xe62f;');
$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
layer.msg('已停用!',{icon: 5,time:1000});
}else{
$(obj).attr('title','启用')
$(obj).find('i').html('&#xe601;');
$(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
layer.msg('已启用!',{icon: 5,time:1000});
}
});
}
/*用户-删除*/
function member_del(obj,id){
layer.confirm('确认要删除吗?',function(index){
//发异步删除数据
$(obj).parents("tr").remove();
layer.msg('已删除!',{icon:1,time:1000});
});
}
function delAll (argument) {
var data = tableCheck.getData();
layer.confirm('确认要删除吗?'+data,function(index){
//捉到所有被选中的,发异步进行删除
layer.msg('删除成功', {icon: 1});
$(".layui-form-checked").not('.header').parents('tr').remove();
});
}
</script>
<script>var _hmt = _hmt || []; (function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>

@ -0,0 +1,167 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.0</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="x-nav">
<span class="layui-breadcrumb">
<a href="">首页</a>
<a href="">演示</a>
<a>
<cite>导航元素</cite></a>
</span>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
<i class="layui-icon" style="line-height:30px"></i></a>
</div>
<div class="x-body">
<div class="layui-row">
<form class="layui-form layui-col-md12 x-so">
<input class="layui-input" placeholder="开始日" name="start" id="start">
<input class="layui-input" placeholder="截止日" name="end" id="end">
<input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
<button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
</form>
</div>
<xblock>
<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
<button class="layui-btn" onclick="x_admin_show('添加用户','./role-add.html')"><i class="layui-icon"></i>添加</button>
<span class="x-right" style="line-height:40px">共有数据88 条</span>
</xblock>
<table class="layui-table">
<thead>
<tr>
<th>
<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
</th>
<th>ID</th>
<th>角色名</th>
<th>拥有权限规则</th>
<th>描述</th>
<th>状态</th>
<th>操作</th>
</thead>
<tbody>
<tr>
<td>
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
</td>
<td>1</td>
<td>超级管理员</td>
<td>会员列表,问题列表</td>
<td>具有至高无上的权利</td>
<td class="td-status">
<span class="layui-btn layui-btn-normal layui-btn-mini">已启用</span></td>
<td class="td-manage">
<a onclick="member_stop(this,'10001')" href="javascript:;" title="启用">
<i class="layui-icon">&#xe601;</i>
</a>
<a title="编辑" onclick="x_admin_show('编辑','role-add.html')" href="javascript:;">
<i class="layui-icon">&#xe642;</i>
</a>
<a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">
<i class="layui-icon">&#xe640;</i>
</a>
</td>
</tr>
</tbody>
</table>
<div class="page">
<div>
<a class="prev" href="">&lt;&lt;</a>
<a class="num" href="">1</a>
<span class="current">2</span>
<a class="num" href="">3</a>
<a class="num" href="">489</a>
<a class="next" href="">&gt;&gt;</a>
</div>
</div>
</div>
<script>
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
});
/*用户-停用*/
function member_stop(obj,id){
layer.confirm('确认要停用吗?',function(index){
if($(obj).attr('title')=='启用'){
//发异步把用户状态进行更改
$(obj).attr('title','停用')
$(obj).find('i').html('&#xe62f;');
$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
layer.msg('已停用!',{icon: 5,time:1000});
}else{
$(obj).attr('title','启用')
$(obj).find('i').html('&#xe601;');
$(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
layer.msg('已启用!',{icon: 5,time:1000});
}
});
}
/*用户-删除*/
function member_del(obj,id){
layer.confirm('确认要删除吗?',function(index){
//发异步删除数据
$(obj).parents("tr").remove();
layer.msg('已删除!',{icon:1,time:1000});
});
}
function delAll (argument) {
var data = tableCheck.getData();
layer.confirm('确认要删除吗?'+data,function(index){
//捉到所有被选中的,发异步进行删除
layer.msg('删除成功', {icon: 1});
$(".layui-form-checked").not('.header').parents('tr').remove();
});
}
</script>
<script>var _hmt = _hmt || []; (function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>

@ -0,0 +1,184 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.0</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="x-nav">
<span class="layui-breadcrumb">
<a href="">首页</a>
<a href="">演示</a>
<a>
<cite>导航元素88</cite></a>
</span>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
<i class="layui-icon" style="line-height:30px"></i></a>
</div>
<div class="x-body">
<div class="layui-row">
<form class="layui-form layui-col-md12 x-so layui-form-pane">
<div class="layui-input-inline">
<select name="cateid">
<option>规则分类</option>
<option>文章</option>
<option>会员</option>
<option>权限</option>
</select>
</div>
<div class="layui-input-inline">
<select name="contrller">
<option>请控制器</option>
<option>Index</option>
<option>Goods</option>
<option>Cate</option>
</select>
</div>
<div class="layui-input-inline">
<select name="action">
<option>请方法</option>
<option>add</option>
<option>login</option>
<option>checklogin</option>
</select>
</div>
<input class="layui-input" placeholder="权限名" name="cate_name" >
<button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon"></i>增加</button>
</form>
</div>
<xblock>
<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
<span class="x-right" style="line-height:40px">共有数据88 条</span>
</xblock>
<table class="layui-table">
<thead>
<tr>
<th>
<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
</th>
<th>ID</th>
<th>权限规则</th>
<th>权限名称</th>
<th>所属分类</th>
<th>操作</th>
</thead>
<tbody>
<tr>
<td>
<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
</td>
<td>1</td>
<td>admin/user/userlist</td>
<td>会员列表</td>
<td>会员相关</td>
<td class="td-manage">
<a title="编辑" onclick="x_admin_show('编辑','xxx.html')" href="javascript:;">
<i class="layui-icon">&#xe642;</i>
</a>
<a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">
<i class="layui-icon">&#xe640;</i>
</a>
</td>
</tr>
</tbody>
</table>
<div class="page">
<div>
<a class="prev" href="">&lt;&lt;</a>
<a class="num" href="">1</a>
<span class="current">2</span>
<a class="num" href="">3</a>
<a class="num" href="">489</a>
<a class="next" href="">&gt;&gt;</a>
</div>
</div>
</div>
<script>
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#start' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#end' //指定元素
});
});
/*用户-停用*/
function member_stop(obj,id){
layer.confirm('确认要停用吗?',function(index){
if($(obj).attr('title')=='启用'){
//发异步把用户状态进行更改
$(obj).attr('title','停用')
$(obj).find('i').html('&#xe62f;');
$(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
layer.msg('已停用!',{icon: 5,time:1000});
}else{
$(obj).attr('title','启用')
$(obj).find('i').html('&#xe601;');
$(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
layer.msg('已启用!',{icon: 5,time:1000});
}
});
}
/*用户-删除*/
function member_del(obj,id){
layer.confirm('确认要删除吗?',function(index){
//发异步删除数据
$(obj).parents("tr").remove();
layer.msg('已删除!',{icon:1,time:1000});
});
}
function delAll (argument) {
var data = tableCheck.getData();
layer.confirm('确认要删除吗?'+data,function(index){
//捉到所有被选中的,发异步进行删除
layer.msg('删除成功', {icon: 1});
$(".layui-form-checked").not('.header').parents('tr').remove();
});
}
</script>
<script>var _hmt = _hmt || []; (function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();</script>
</body>
</html>

@ -0,0 +1,16 @@
@font-face {
font-family: 'iconfont';
src: url('../fonts/iconfont.eot');
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/iconfont.woff') format('woff'),
url('../fonts/iconfont.ttf') format('truetype'),
url('../fonts/iconfont.svg#iconfont') format('svg');
}
.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;
}

@ -0,0 +1,63 @@
@charset "utf-8";
@import url(../lib/layui/css/layui.css);
*{
margin: 0px;
padding: 0px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px;
}
a{
text-decoration: none;
}
html{
width: 100%;
height: 100%;
overflow-x:hidden;
overflow-y:auto;
}
body{
width: 100%;
min-height: 100%;
}
.login .layui-form-label{
width: 30%;
}
.login .layui-input-inline{
width: 70%;
margin-right: 0px;
}
.login .layui-input{
border-radius: 0px !important;
height: 38px !important;
}
/*#username-label{
width: 30%;
}
#username-input-inline{
width: 70%;
margin-right: 0px;
}
#username{
border-radius: 0px;
height: 38px;
}*/
/*#password-label{
width: 30%;
}
#password-input-inline{
width: 70%;
margin-right: 0px;
}
#password{
border-radius: 0px;
height: 38px;
}*/
/*
#identity-label{
width: 30%;
}
#identity{
width: 70%;
text-align: center;
}*/

@ -0,0 +1,101 @@
@charset "utf-8";
@import url(../lib/layui/css/layui.css);
*{
margin: 0px;
padding: 0px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px;
}
a{
text-decoration: none;
}
html{
width: 100%;
height: 100%;
overflow-x:hidden;
overflow-y:auto;
}
body{
width: 100%;
min-height: 100%;
}
.register .layui-form-label{
width: 30%;
}
.register .layui-input-inline{
width: 70%;
margin-right: 0px;
}
.register .layui-input{
/*border-radius: 0px !important;
height: 38px !important;*/
}
/*账号提示标签*/
/*#username-label{
width: 30%;
}
!*div*!
#username-input-inline{
width: 70%;
margin-right: 0px;
}
!**!
#username{
padding-left: 15px;
}
!**!
#password-label{
width: 30%;
}
!*div*!
#password-input-inline{
width: 70%;
margin-right: 0px;
}
!**!
#password{
padding-left: 15px;
}
!**!
#realname-label{
width: 30%;
}
!*div*!
#realname-input-inline{
width: 70%;
margin-right: 0px;
}
#realname{
padding-left: 15px;
}
!**!
#sex-label{
width: 30%;
}
!**!*/
#sex{
/*width: 70%;*/
text-align: center;
}
/*总面板*/
.register{
margin: 75px auto 0 auto;
margin-right: auto;
margin-left: auto;
min-height: 420px;
max-width: 500px;
padding: 40px;
background-color: #ffffff;
margin-left: auto;
margin-right: auto;
border-radius: 4px;
box-sizing: border-box;
}
/*设置背景图*/
.register-bg{
/*background: #eeeeee url() 0 0 no-repeat;*/
background:url(../images/bg.png) no-repeat center;
background-size: cover;
overflow: hidden;
}

@ -0,0 +1,469 @@
@charset "utf-8";
@import url(../lib/layui/css/layui.css);
*{
margin: 0px;
padding: 0px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px;
}
a{
text-decoration: none;
}
html{
width: 100%;
height: 100%;
overflow-x:hidden;
overflow-y:auto;
}
body{
width: 100%;
min-height: 100%;
}
.login-bg{
/*background: #eeeeee url() 0 0 no-repeat;*/
background:url(../images/bg.png) no-repeat center;
background-size: cover;
overflow: hidden;
}
.login{
margin: 140px auto 0 auto;
min-height: 420px;
max-width: 420px;
padding: 40px;
background-color: #ffffff;
margin-left: auto;
margin-right: auto;
border-radius: 4px;
/* overflow-x: hidden; */
box-sizing: border-box;
}
.login a.logo{
display: block;
height: 58px;
width: 167px;
margin: 0 auto 30px auto;
background-size: 167px 42px;
}
.login .message {
margin: 10px 0 0 -58px;
padding: 18px 10px 18px 60px;
background: #189F92;
position: relative;
color: #fff;
font-size: 16px;
}
.login #darkbannerwrap {
background: url(../images/aiwrap.png);
width: 18px;
height: 10px;
margin: 0 0 20px -58px;
position: relative;
}
.login input[type=text],
.login input[type=file],
.login input[type=password],
.login input[type=email], select {
border: 1px solid #DCDEE0;
vertical-align: middle;
border-radius: 3px;
height: 50px;
padding: 0px 16px;
font-size: 14px;
color: #555555;
outline:none;
width:100%;
box-sizing: border-box;
}
.login input[type=text]:focus,
.login input[type=file]:focus,
.login input[type=password]:focus,
.login input[type=email]:focus, select:focus {
border: 1px solid #27A9E3;
}
.login input[type=submit],
.login input[type=button]{
display: inline-block;
vertical-align: middle;
padding: 12px 24px;
margin: 0px;
font-size: 18px;
line-height: 24px;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
color: #ffffff;
background-color: #189F92;
border-radius: 3px;
border: none;
-webkit-appearance: none;
outline:none;
width:100%;
}
.login hr {
background: #fff url() 0 0 no-repeat;
}
.login hr.hr15 {
height: 15px;
border: none;
margin: 0px;
padding: 0px;
width: 100%;
}
.login hr.hr20 {
height: 20px;
border: none;
margin: 0px;
padding: 0px;
width: 100%;
}
.x-body{
padding: 20px;
}
.x-nav{
padding: 0 20px;
position: relative;
z-index: 99;
border-bottom: 1px solid #e5e5e5;
line-height: 39px;
height: 39px;
overflow: hidden;
}
xblock{
display: block;
margin-bottom: 10px;
padding: 5px;
line-height: 22px;
/* border-left: 5px solid #009688; */
border-radius: 0 2px 2px 0;
background-color: #f2f2f2;
}
.x-right{
float: right;
}
.x-so{
text-align: center;
margin-bottom: 20px;
}
.x-so input.layui-input{
width: 190px;
}
.x-so .layui-form-label{
display: inline-block;
}
.x-so input.layui-input,.x-so input.layui-btn{
display: inline-block;
}
.x-red{
color: red;
}
.page{
margin-top: 20px;
text-align: center;
}
.page a{
display: inline-block;
background: #fff url() 0 0 no-repeat;
color: #888;
padding: 10px;
min-width: 15px;
border: 1px solid #E2E2E2;
}
.page span{
display: inline-block;
padding: 10px;
min-width: 15px;
border: 1px solid #E2E2E2;
}
.page span.current{
display: inline-block;
background: #009688 url() 0 0 no-repeat;
color: #fff;
padding: 10px;
min-width: 15px;
border: 1px solid #009688;
}
.page .pagination li{
display: inline-block;
margin-right: 5px;
text-align: center;
}
.page .pagination li.active span{
background: #009688 url() 0 0 no-repeat;
color: #fff;
border: 1px solid #009688;
}
/*登录样式*/
/*头部*/
.container{
width: 100%;
height: 45px;
background-color: #222;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.container .logo a{
float: left;
color: #fff;
font-size: 18px;
padding-left: 20px;
line-height: 45px;
width: 200px;
}
.container .right{
background-color:rgba(0,0,0,0);
float: right;
}
.container .left_open{
height: 45px;
float: left;
}
.container .left_open i{
display: block;
background: rgba(255,255,255,0.1) url() 0 0 no-repeat;
color: #fff;
width: 32px;
height: 32px;
line-height: 32px;
border-radius: 3px;
text-align: center;
margin-top: 7px;
cursor: pointer;
}
.container .left_open i:hover{
background: rgba(255,255,255,0.3) url() 0 0 no-repeat;
}
.container .left{
background-color:rgba(0,0,0,0);
float: left;
}
.container .layui-nav-item{
line-height: 45px;
}
.container .layui-nav-more{
top: 20px;
}
.container .layui-nav-child{
top: 50px;
}
.container .layui-nav-child i{
margin-right: 10px;
}
.layui-nav .layui-nav-item a{
color: #fff;
}
.layui-nav .layui-nav-child a{
color: #333;
}
.left-nav{
position: absolute;
top: 46px;
bottom: 42px;
left: 0;
z-index: 2;
padding-top: 10px;
background-color: #EEEEEE;
width: 220px;
max-width: 220px;
overflow: auto;
overflow-x:hidden;
border-right: 1px solid #e5e5e5;
/*width: 0px;*/
}
.left-nav #nav li{
border-bottom: 1px solid #e5e5e5;
}
.left-nav #nav li:hover > a{
/*color: blue;*/
}
.left-nav #nav .current{
background-color: rgba(0, 0, 0, 0.3);
}
.left-nav #nav li a{
font-size: 14px;
padding: 10px 15px 10px 20px;
display: block;
cursor: pointer;
}
.left-nav #nav li a cite{
font-size: 14px;
}
.left-nav #nav li .sub-menu{
display: none;
}
.left-nav #nav li .opened{
display: block;
}
.left-nav #nav li .opened:hover{
/*background: #fff url() 0 0 no-repeat;*/
}
.left-nav #nav li .opened .current{
}
.left-nav #nav li .sub-menu li:hover{
/*color: blue;*/
/*background: #fff url() 0 0 no-repeat;*/
}
.left-nav #nav li .sub-menu li a{
padding: 12px 15px 12px 30px;
font-size: 14px;
cursor: pointer;
}
.left-nav #nav li .sub-menu li .sub-menu li a{
padding-left: 45px;
}
.left-nav #nav li .sub-menu li a:hover{
color: #148cf1;
}
.left-nav #nav li .sub-menu li a i{
font-size: 12px;
}
.left-nav #nav li a i{
padding-right: 10px;
line-height: 14px;
}
.left-nav #nav li .nav_right{
float: right;
font-size: 16px;
}
.x-slide_left {
width: 17px;
height: 61px;
background: url(../images/icon.png) 0 0 no-repeat;
position: absolute;
top: 200px;
left: 221px;
cursor: pointer;
z-index: 3;
}
.page-content{
position: absolute;
top: 46px;
right: 0;
bottom: 42px;
left: 221px;
overflow: hidden;
z-index: 1;
}
.page-content-bg{
position: absolute;
top: 46px;
right: 0;
bottom: 42px;
left: 221px;
background: rgba(0,0,0,0.5); url() 0 0 no-repeat;
overflow: hidden;
z-index: 100;
display: none;
}
.page-content .tab{
height: 100%;
width: 100%;
background: #EFEEF0 url() 0 0 no-repeat;
margin: 0px;
}
.page-content .layui-tab-title{
/*padding-top: 5px;*/
height: 35px;
background: #EFEEF0 url() 0 0 no-repeat;
position: relative;
z-index: 100;
}
.page-content .layui-tab-title li{
line-height: 35px;
}
.page-content .layui-tab-title .layui-this:after{
height: 36px;
}
.page-content .layui-tab-title li .layui-tab-close{
border-radius: 50%;
}
.page-content .layui-tab-title .layui-this{
background: #fff url() 0 0 no-repeat;
}
.page-content .layui-tab-bar{
height:34px;
line-height: 35px;
}
.page-content .layui-tab-content{
position: absolute;
top: 36px;
bottom: 0px;
width: 100%;
background: #fff url() 0 0 no-repeat;
padding: 0px;
overflow: hidden;
}
.page-content .layui-tab-content .layui-tab-item{
width: 100%;
height: 100%;
}
.page-content .layui-tab-content .layui-tab-item iframe{
width: 100%;
height: 100%;
}
.welcome-footer{padding: 30px 0; line-height: 30px; text-align: center; background-color: #eee; color: #666; font-weight: 300;}
body .layui-layout-admin .footer-demo{height: auto; padding: 15px 0; line-height: 26px;}
.welcome-footer a{padding: 0 5px;}
table th, table td {
word-break: break-all;
}
.footer{
position: fixed;
bottom: 0px;
width: 100%;
background-color: #222;
border-top: 1px solid rgba(255, 255, 255, 0.2);
line-height: 41px;
color: #fff;
/*padding-left: 10px;*/
}
.footer .copyright{
margin-left: 10px;
}
@media screen and (max-width: 768px){
.fast-add{
display: none;
}
.layui-nav .to-index{
display: none;
}
.container .logo a{
width: 140px;
}
.container .left_open {
/*float: right;*/
}
.left-nav{
left: -221px;
}
.page-content{
left: 0px;
}
.page-content .layui-tab-content .layui-tab-item{
-webkit-overflow-scrolling: touch;
overflow-y: scroll;
}
.x-so input.layui-input{
width: 100%;
margin: 10px;
}
}

@ -0,0 +1,109 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>后台登录-X-admin2.0</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
特别声明ECharts一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上兼容当前绝大部分浏览器IE8/9/10/11ChromeFirefoxSafari等底层依赖轻量级的 Canvas 类库 ZRender提供直观生动可交互可高度个性化定制的数据可视化图表。如需使用详细了解可以访问官网 <a href="http://echarts.baidu.com/" style="color:red">ECharts</a>。 x-admin不承担任何版权问题。
</blockquote>
<!-- 为 ECharts 准备一个具备大小(宽高)的 DOM -->
<div id="main" style="width: 100%;height:400px;"></div>
<blockquote class="layui-elem-quote">
注意本案例的Echarts图表库由cdn引入需要在线才能正常使用如想离想请至Echarts官网下载。
</blockquote>
</div>
<script src="//cdn.bootcss.com/echarts/3.3.2/echarts.min.js" charset="utf-8"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var option = {
title: {
text: '折线图堆叠'
},
tooltip: {
trigger: 'axis'
},
legend: {
data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['周一','周二','周三','周四','周五','周六','周日']
},
yAxis: {
type: 'value'
},
series: [
{
name:'邮件营销',
type:'line',
stack: '总量',
data:[120, 132, 101, 134, 90, 230, 210]
},
{
name:'联盟广告',
type:'line',
stack: '总量',
data:[220, 182, 191, 234, 290, 330, 310]
},
{
name:'视频广告',
type:'line',
stack: '总量',
data:[150, 232, 201, 154, 190, 330, 410]
},
{
name:'直接访问',
type:'line',
stack: '总量',
data:[320, 332, 301, 334, 390, 330, 320]
},
{
name:'搜索引擎',
type:'line',
stack: '总量',
data:[820, 932, 901, 934, 1290, 1330, 1320]
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>

@ -0,0 +1,107 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>后台登录-X-admin2.0</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
特别声明ECharts一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上兼容当前绝大部分浏览器IE8/9/10/11ChromeFirefoxSafari等底层依赖轻量级的 Canvas 类库 ZRender提供直观生动可交互可高度个性化定制的数据可视化图表。如需使用或者详细更多案例可以访问官网 <a href="http://echarts.baidu.com/" style="color:red">ECharts</a>。 x-admin不承担任何版权问题。
</blockquote>
<!-- 为 ECharts 准备一个具备大小(宽高)的 DOM -->
<div id="main" style="width: 100%;height:400px;"></div>
<blockquote class="layui-elem-quote">
注意本案例的Echarts图表库由cdn引入需要在线才能正常使用如想离想请至Echarts官网下载。
</blockquote>
</div>
<script src="//cdn.bootcss.com/echarts/3.3.2/echarts.min.js" charset="utf-8"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var labelRight = {
normal: {
position: 'right'
}
};
option = {
title: {
text: '交错正负轴标签',
subtext: 'From ExcelHome',
sublink: 'http://e.weibo.com/1341556070/AjwF2AgQm'
},
tooltip : {
trigger: 'axis',
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
top: 80,
bottom: 30
},
xAxis: {
type : 'value',
position: 'top',
splitLine: {lineStyle:{type:'dashed'}},
},
yAxis: {
type : 'category',
axisLine: {show: false},
axisLabel: {show: false},
axisTick: {show: false},
splitLine: {show: false},
data : ['ten', 'nine', 'eight', 'seven', 'six', 'five', 'four', 'three', 'two', 'one']
},
series : [
{
name:'生活费',
type:'bar',
stack: '总量',
label: {
normal: {
show: true,
formatter: '{b}'
}
},
data:[
{value: -0.07, label: labelRight},
{value: -0.09, label: labelRight},
0.2, 0.44,
{value: -0.23, label: labelRight},
0.08,
{value: -0.17, label: labelRight},
0.47,
{value: -0.36, label: labelRight},
0.18
]
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>

@ -0,0 +1,350 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>后台登录-X-admin2.0</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
特别声明ECharts一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上兼容当前绝大部分浏览器IE8/9/10/11ChromeFirefoxSafari等底层依赖轻量级的 Canvas 类库 ZRender提供直观生动可交互可高度个性化定制的数据可视化图表。如需使用或者详细更多案例可以访问官网 <a href="http://echarts.baidu.com/" style="color:red">ECharts</a>。 x-admin不承担任何版权问题。
</blockquote>
<!-- 为 ECharts 准备一个具备大小(宽高)的 DOM -->
<div id="main" style="width: 100%;height:400px;"></div>
<blockquote class="layui-elem-quote">
注意本案例的Echarts图表库由cdn引入需要在线才能正常使用如想离想请至Echarts官网下载。
</blockquote>
</div>
<script src="//cdn.bootcss.com/echarts/3.3.2/echarts.min.js" charset="utf-8"></script>
<script src="//cdn.bootcss.com/echarts/3.3.2/extension/bmap.min.js" type="text/javascript"></script>
<script src="http://echarts.baidu.com/asset/map/js/china.js"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
myChart.setOption({
series: [{
type: 'map',
map: 'china'
}]
});
// 指定图表的配置项和数据
var geoCoordMap = {
'上海': [121.4648,31.2891],
'东莞': [113.8953,22.901],
'东营': [118.7073,37.5513],
'中山': [113.4229,22.478],
'临汾': [111.4783,36.1615],
'临沂': [118.3118,35.2936],
'丹东': [124.541,40.4242],
'丽水': [119.5642,28.1854],
'乌鲁木齐': [87.9236,43.5883],
'佛山': [112.8955,23.1097],
'保定': [115.0488,39.0948],
'兰州': [103.5901,36.3043],
'包头': [110.3467,41.4899],
'北京': [116.4551,40.2539],
'北海': [109.314,21.6211],
'南京': [118.8062,31.9208],
'南宁': [108.479,23.1152],
'南昌': [116.0046,28.6633],
'南通': [121.1023,32.1625],
'厦门': [118.1689,24.6478],
'台州': [121.1353,28.6688],
'合肥': [117.29,32.0581],
'呼和浩特': [111.4124,40.4901],
'咸阳': [108.4131,34.8706],
'哈尔滨': [127.9688,45.368],
'唐山': [118.4766,39.6826],
'嘉兴': [120.9155,30.6354],
'大同': [113.7854,39.8035],
'大连': [122.2229,39.4409],
'天津': [117.4219,39.4189],
'太原': [112.3352,37.9413],
'威海': [121.9482,37.1393],
'宁波': [121.5967,29.6466],
'宝鸡': [107.1826,34.3433],
'宿迁': [118.5535,33.7775],
'常州': [119.4543,31.5582],
'广州': [113.5107,23.2196],
'廊坊': [116.521,39.0509],
'延安': [109.1052,36.4252],
'张家口': [115.1477,40.8527],
'徐州': [117.5208,34.3268],
'德州': [116.6858,37.2107],
'惠州': [114.6204,23.1647],
'成都': [103.9526,30.7617],
'扬州': [119.4653,32.8162],
'承德': [117.5757,41.4075],
'拉萨': [91.1865,30.1465],
'无锡': [120.3442,31.5527],
'日照': [119.2786,35.5023],
'昆明': [102.9199,25.4663],
'杭州': [119.5313,29.8773],
'枣庄': [117.323,34.8926],
'柳州': [109.3799,24.9774],
'株洲': [113.5327,27.0319],
'武汉': [114.3896,30.6628],
'汕头': [117.1692,23.3405],
'江门': [112.6318,22.1484],
'沈阳': [123.1238,42.1216],
'沧州': [116.8286,38.2104],
'河源': [114.917,23.9722],
'泉州': [118.3228,25.1147],
'泰安': [117.0264,36.0516],
'泰州': [120.0586,32.5525],
'济南': [117.1582,36.8701],
'济宁': [116.8286,35.3375],
'海口': [110.3893,19.8516],
'淄博': [118.0371,36.6064],
'淮安': [118.927,33.4039],
'深圳': [114.5435,22.5439],
'清远': [112.9175,24.3292],
'温州': [120.498,27.8119],
'渭南': [109.7864,35.0299],
'湖州': [119.8608,30.7782],
'湘潭': [112.5439,27.7075],
'滨州': [117.8174,37.4963],
'潍坊': [119.0918,36.524],
'烟台': [120.7397,37.5128],
'玉溪': [101.9312,23.8898],
'珠海': [113.7305,22.1155],
'盐城': [120.2234,33.5577],
'盘锦': [121.9482,41.0449],
'石家庄': [114.4995,38.1006],
'福州': [119.4543,25.9222],
'秦皇岛': [119.2126,40.0232],
'绍兴': [120.564,29.7565],
'聊城': [115.9167,36.4032],
'肇庆': [112.1265,23.5822],
'舟山': [122.2559,30.2234],
'苏州': [120.6519,31.3989],
'莱芜': [117.6526,36.2714],
'菏泽': [115.6201,35.2057],
'营口': [122.4316,40.4297],
'葫芦岛': [120.1575,40.578],
'衡水': [115.8838,37.7161],
'衢州': [118.6853,28.8666],
'西宁': [101.4038,36.8207],
'西安': [109.1162,34.2004],
'贵阳': [106.6992,26.7682],
'连云港': [119.1248,34.552],
'邢台': [114.8071,37.2821],
'邯郸': [114.4775,36.535],
'郑州': [113.4668,34.6234],
'鄂尔多斯': [108.9734,39.2487],
'重庆': [107.7539,30.1904],
'金华': [120.0037,29.1028],
'铜川': [109.0393,35.1947],
'银川': [106.3586,38.1775],
'镇江': [119.4763,31.9702],
'长春': [125.8154,44.2584],
'长沙': [113.0823,28.2568],
'长治': [112.8625,36.4746],
'阳泉': [113.4778,38.0951],
'青岛': [120.4651,36.3373],
'韶关': [113.7964,24.7028]
};
var BJData = [
[{name:'北京'}, {name:'上海',value:95}],
[{name:'北京'}, {name:'广州',value:90}],
[{name:'北京'}, {name:'大连',value:80}],
[{name:'北京'}, {name:'南宁',value:70}],
[{name:'北京'}, {name:'南昌',value:60}],
[{name:'北京'}, {name:'拉萨',value:50}],
[{name:'北京'}, {name:'长春',value:40}],
[{name:'北京'}, {name:'包头',value:30}],
[{name:'北京'}, {name:'重庆',value:20}],
[{name:'北京'}, {name:'常州',value:10}]
];
var SHData = [
[{name:'上海'},{name:'包头',value:95}],
[{name:'上海'},{name:'昆明',value:90}],
[{name:'上海'},{name:'广州',value:80}],
[{name:'上海'},{name:'郑州',value:70}],
[{name:'上海'},{name:'长春',value:60}],
[{name:'上海'},{name:'重庆',value:50}],
[{name:'上海'},{name:'长沙',value:40}],
[{name:'上海'},{name:'北京',value:30}],
[{name:'上海'},{name:'丹东',value:20}],
[{name:'上海'},{name:'大连',value:10}]
];
var GZData = [
[{name:'广州'},{name:'福州',value:95}],
[{name:'广州'},{name:'太原',value:90}],
[{name:'广州'},{name:'长春',value:80}],
[{name:'广州'},{name:'重庆',value:70}],
[{name:'广州'},{name:'西安',value:60}],
[{name:'广州'},{name:'成都',value:50}],
[{name:'广州'},{name:'常州',value:40}],
[{name:'广州'},{name:'北京',value:30}],
[{name:'广州'},{name:'北海',value:20}],
[{name:'广州'},{name:'海口',value:10}]
];
var planePath = 'path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z';
var convertData = function (data) {
var res = [];
for (var i = 0; i < data.length; i++) {
var dataItem = data[i];
var fromCoord = geoCoordMap[dataItem[0].name];
var toCoord = geoCoordMap[dataItem[1].name];
if (fromCoord && toCoord) {
res.push({
fromName: dataItem[0].name,
toName: dataItem[1].name,
coords: [fromCoord, toCoord]
});
}
}
return res;
};
var color = ['#a6c84c', '#ffa022', '#46bee9'];
var series = [];
[['北京', BJData], ['上海', SHData], ['广州', GZData]].forEach(function (item, i) {
series.push({
name: item[0] + ' Top10',
type: 'lines',
zlevel: 1,
effect: {
show: true,
period: 6,
trailLength: 0.7,
color: '#fff',
symbolSize: 3
},
lineStyle: {
normal: {
color: color[i],
width: 0,
curveness: 0.2
}
},
data: convertData(item[1])
},
{
name: item[0] + ' Top10',
type: 'lines',
zlevel: 2,
effect: {
show: true,
period: 6,
trailLength: 0,
symbol: planePath,
symbolSize: 15
},
lineStyle: {
normal: {
color: color[i],
width: 1,
opacity: 0.4,
curveness: 0.2
}
},
data: convertData(item[1])
},
{
name: item[0] + ' Top10',
type: 'effectScatter',
coordinateSystem: 'geo',
zlevel: 2,
rippleEffect: {
brushType: 'stroke'
},
label: {
normal: {
show: true,
position: 'right',
formatter: '{b}'
}
},
symbolSize: function (val) {
return val[2] / 8;
},
itemStyle: {
normal: {
color: color[i]
}
},
data: item[1].map(function (dataItem) {
return {
name: dataItem[1].name,
value: geoCoordMap[dataItem[1].name].concat([dataItem[1].value])
};
})
});
});
option = {
backgroundColor: '#404a59',
title : {
text: '模拟迁徙',
subtext: '数据纯属虚构',
left: 'center',
textStyle : {
color: '#fff'
}
},
tooltip : {
trigger: 'item'
},
legend: {
orient: 'vertical',
top: 'bottom',
left: 'right',
data:['北京 Top10', '上海 Top10', '广州 Top10'],
textStyle: {
color: '#fff'
},
selectedMode: 'single'
},
geo: {
map: 'china',
label: {
emphasis: {
show: false
}
},
roam: true,
itemStyle: {
normal: {
areaColor: '#323c48',
borderColor: '#404a59'
},
emphasis: {
areaColor: '#2a333d'
}
}
},
series: series
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>

@ -0,0 +1,115 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>后台登录-X-admin2.0</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
特别声明ECharts一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上兼容当前绝大部分浏览器IE8/9/10/11ChromeFirefoxSafari等底层依赖轻量级的 Canvas 类库 ZRender提供直观生动可交互可高度个性化定制的数据可视化图表。如需使用或者详细更多案例可以访问官网 <a href="http://echarts.baidu.com/" style="color:red">ECharts</a>。 x-admin不承担任何版权问题。
</blockquote>
<!-- 为 ECharts 准备一个具备大小(宽高)的 DOM -->
<div id="main" style="width: 100%;height:400px;"></div>
<blockquote class="layui-elem-quote">
注意本案例的Echarts图表库由cdn引入需要在线才能正常使用如想离想请至Echarts官网下载。
</blockquote>
</div>
<script src="//cdn.bootcss.com/echarts/3.3.2/echarts.min.js" charset="utf-8"></script>
<script src="//cdn.bootcss.com/echarts/3.3.2/extension/bmap.min.js" type="text/javascript"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
option = {
backgroundColor: '#2c343c',
title: {
text: 'Customized Pie',
left: 'center',
top: 20,
textStyle: {
color: '#ccc'
}
},
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
visualMap: {
show: false,
min: 80,
max: 600,
inRange: {
colorLightness: [0, 1]
}
},
series : [
{
name:'访问来源',
type:'pie',
radius : '55%',
center: ['50%', '50%'],
data:[
{value:335, name:'直接访问'},
{value:310, name:'邮件营销'},
{value:274, name:'联盟广告'},
{value:235, name:'视频广告'},
{value:400, name:'搜索引擎'}
].sort(function (a, b) { return a.value - b.value}),
roseType: 'angle',
label: {
normal: {
textStyle: {
color: 'rgba(255, 255, 255, 0.3)'
}
}
},
labelLine: {
normal: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.3)'
},
smooth: 0.2,
length: 10,
length2: 20
}
},
itemStyle: {
normal: {
color: '#c23531',
shadowBlur: 200,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>

@ -0,0 +1,81 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>后台登录-X-admin2.0</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
特别声明ECharts一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上兼容当前绝大部分浏览器IE8/9/10/11ChromeFirefoxSafari等底层依赖轻量级的 Canvas 类库 ZRender提供直观生动可交互可高度个性化定制的数据可视化图表。如需使用详细了解可以访问官网 <a href="http://echarts.baidu.com/" style="color:red">ECharts</a>。 x-admin不承担任何版权问题。
</blockquote>
<!-- 为 ECharts 准备一个具备大小(宽高)的 DOM -->
<div id="main" style="width: 100%;height:400px;"></div>
<blockquote class="layui-elem-quote">
注意本案例的Echarts图表库由cdn引入需要在线才能正常使用如想离想请至Echarts官网下载。
</blockquote>
</div>
<script src="//cdn.bootcss.com/echarts/3.3.2/echarts.min.js" charset="utf-8"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
var option = {
title: {
text: '基础雷达图'
},
tooltip: {},
legend: {
data: ['预算分配Allocated Budget', '实际开销Actual Spending']
},
radar: {
// shape: 'circle',
indicator: [
{ name: '销售sales', max: 6500},
{ name: '管理Administration', max: 16000},
{ name: '信息技术Information Techology', max: 30000},
{ name: '客服Customer Support', max: 38000},
{ name: '研发Development', max: 52000},
{ name: '市场Marketing', max: 25000}
]
},
series: [{
name: '预算 vs 开销Budget vs spending',
type: 'radar',
// areaStyle: {normal: {}},
data : [
{
value : [4300, 10000, 28000, 35000, 50000, 19000],
name : '预算分配Allocated Budget'
},
{
value : [5000, 14000, 28000, 31000, 42000, 21000],
name : '实际开销Actual Spending'
}
]
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>

@ -0,0 +1,344 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>后台登录-X-admin2.0</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
特别声明ECharts一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上兼容当前绝大部分浏览器IE8/9/10/11ChromeFirefoxSafari等底层依赖轻量级的 Canvas 类库 ZRender提供直观生动可交互可高度个性化定制的数据可视化图表。如需使用详细了解可以访问官网 <a href="http://echarts.baidu.com/" style="color:red">ECharts</a>。 x-admin不承担任何版权问题。
</blockquote>
<!-- 为 ECharts 准备一个具备大小(宽高)的 DOM -->
<div id="main" style="width: 100%;height:400px;"></div>
<blockquote class="layui-elem-quote">
注意本案例的Echarts图表库由cdn引入需要在线才能正常使用如想离想请至Echarts官网下载。
</blockquote>
</div>
<script src="//cdn.bootcss.com/echarts/3.3.2/echarts.min.js" charset="utf-8"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
// 数据意义:开盘(open),收盘(close),最低(lowest),最高(highest)
var data0 = splitData([
['2013/1/24', 2320.26,2320.26,2287.3,2362.94],
['2013/1/25', 2300,2291.3,2288.26,2308.38],
['2013/1/28', 2295.35,2346.5,2295.35,2346.92],
['2013/1/29', 2347.22,2358.98,2337.35,2363.8],
['2013/1/30', 2360.75,2382.48,2347.89,2383.76],
['2013/1/31', 2383.43,2385.42,2371.23,2391.82],
['2013/2/1', 2377.41,2419.02,2369.57,2421.15],
['2013/2/4', 2425.92,2428.15,2417.58,2440.38],
['2013/2/5', 2411,2433.13,2403.3,2437.42],
['2013/2/6', 2432.68,2434.48,2427.7,2441.73],
['2013/2/7', 2430.69,2418.53,2394.22,2433.89],
['2013/2/8', 2416.62,2432.4,2414.4,2443.03],
['2013/2/18', 2441.91,2421.56,2415.43,2444.8],
['2013/2/19', 2420.26,2382.91,2373.53,2427.07],
['2013/2/20', 2383.49,2397.18,2370.61,2397.94],
['2013/2/21', 2378.82,2325.95,2309.17,2378.82],
['2013/2/22', 2322.94,2314.16,2308.76,2330.88],
['2013/2/25', 2320.62,2325.82,2315.01,2338.78],
['2013/2/26', 2313.74,2293.34,2289.89,2340.71],
['2013/2/27', 2297.77,2313.22,2292.03,2324.63],
['2013/2/28', 2322.32,2365.59,2308.92,2366.16],
['2013/3/1', 2364.54,2359.51,2330.86,2369.65],
['2013/3/4', 2332.08,2273.4,2259.25,2333.54],
['2013/3/5', 2274.81,2326.31,2270.1,2328.14],
['2013/3/6', 2333.61,2347.18,2321.6,2351.44],
['2013/3/7', 2340.44,2324.29,2304.27,2352.02],
['2013/3/8', 2326.42,2318.61,2314.59,2333.67],
['2013/3/11', 2314.68,2310.59,2296.58,2320.96],
['2013/3/12', 2309.16,2286.6,2264.83,2333.29],
['2013/3/13', 2282.17,2263.97,2253.25,2286.33],
['2013/3/14', 2255.77,2270.28,2253.31,2276.22],
['2013/3/15', 2269.31,2278.4,2250,2312.08],
['2013/3/18', 2267.29,2240.02,2239.21,2276.05],
['2013/3/19', 2244.26,2257.43,2232.02,2261.31],
['2013/3/20', 2257.74,2317.37,2257.42,2317.86],
['2013/3/21', 2318.21,2324.24,2311.6,2330.81],
['2013/3/22', 2321.4,2328.28,2314.97,2332],
['2013/3/25', 2334.74,2326.72,2319.91,2344.89],
['2013/3/26', 2318.58,2297.67,2281.12,2319.99],
['2013/3/27', 2299.38,2301.26,2289,2323.48],
['2013/3/28', 2273.55,2236.3,2232.91,2273.55],
['2013/3/29', 2238.49,2236.62,2228.81,2246.87],
['2013/4/1', 2229.46,2234.4,2227.31,2243.95],
['2013/4/2', 2234.9,2227.74,2220.44,2253.42],
['2013/4/3', 2232.69,2225.29,2217.25,2241.34],
['2013/4/8', 2196.24,2211.59,2180.67,2212.59],
['2013/4/9', 2215.47,2225.77,2215.47,2234.73],
['2013/4/10', 2224.93,2226.13,2212.56,2233.04],
['2013/4/11', 2236.98,2219.55,2217.26,2242.48],
['2013/4/12', 2218.09,2206.78,2204.44,2226.26],
['2013/4/15', 2199.91,2181.94,2177.39,2204.99],
['2013/4/16', 2169.63,2194.85,2165.78,2196.43],
['2013/4/17', 2195.03,2193.8,2178.47,2197.51],
['2013/4/18', 2181.82,2197.6,2175.44,2206.03],
['2013/4/19', 2201.12,2244.64,2200.58,2250.11],
['2013/4/22', 2236.4,2242.17,2232.26,2245.12],
['2013/4/23', 2242.62,2184.54,2182.81,2242.62],
['2013/4/24', 2187.35,2218.32,2184.11,2226.12],
['2013/4/25', 2213.19,2199.31,2191.85,2224.63],
['2013/4/26', 2203.89,2177.91,2173.86,2210.58],
['2013/5/2', 2170.78,2174.12,2161.14,2179.65],
['2013/5/3', 2179.05,2205.5,2179.05,2222.81],
['2013/5/6', 2212.5,2231.17,2212.5,2236.07],
['2013/5/7', 2227.86,2235.57,2219.44,2240.26],
['2013/5/8', 2242.39,2246.3,2235.42,2255.21],
['2013/5/9', 2246.96,2232.97,2221.38,2247.86],
['2013/5/10', 2228.82,2246.83,2225.81,2247.67],
['2013/5/13', 2247.68,2241.92,2231.36,2250.85],
['2013/5/14', 2238.9,2217.01,2205.87,2239.93],
['2013/5/15', 2217.09,2224.8,2213.58,2225.19],
['2013/5/16', 2221.34,2251.81,2210.77,2252.87],
['2013/5/17', 2249.81,2282.87,2248.41,2288.09],
['2013/5/20', 2286.33,2299.99,2281.9,2309.39],
['2013/5/21', 2297.11,2305.11,2290.12,2305.3],
['2013/5/22', 2303.75,2302.4,2292.43,2314.18],
['2013/5/23', 2293.81,2275.67,2274.1,2304.95],
['2013/5/24', 2281.45,2288.53,2270.25,2292.59],
['2013/5/27', 2286.66,2293.08,2283.94,2301.7],
['2013/5/28', 2293.4,2321.32,2281.47,2322.1],
['2013/5/29', 2323.54,2324.02,2321.17,2334.33],
['2013/5/30', 2316.25,2317.75,2310.49,2325.72],
['2013/5/31', 2320.74,2300.59,2299.37,2325.53],
['2013/6/3', 2300.21,2299.25,2294.11,2313.43],
['2013/6/4', 2297.1,2272.42,2264.76,2297.1],
['2013/6/5', 2270.71,2270.93,2260.87,2276.86],
['2013/6/6', 2264.43,2242.11,2240.07,2266.69],
['2013/6/7', 2242.26,2210.9,2205.07,2250.63],
['2013/6/13', 2190.1,2148.35,2126.22,2190.1]
]);
function splitData(rawData) {
var categoryData = [];
var values = []
for (var i = 0; i < rawData.length; i++) {
categoryData.push(rawData[i].splice(0, 1)[0]);
values.push(rawData[i])
}
return {
categoryData: categoryData,
values: values
};
}
function calculateMA(dayCount) {
var result = [];
for (var i = 0, len = data0.values.length; i < len; i++) {
if (i < dayCount) {
result.push('-');
continue;
}
var sum = 0;
for (var j = 0; j < dayCount; j++) {
sum += data0.values[i - j][1];
}
result.push(sum / dayCount);
}
return result;
}
option = {
title: {
text: '上证指数',
left: 0
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'line'
}
},
legend: {
data: ['日K', 'MA5', 'MA10', 'MA20', 'MA30']
},
grid: {
left: '10%',
right: '10%',
bottom: '15%'
},
xAxis: {
type: 'category',
data: data0.categoryData,
scale: true,
boundaryGap : false,
axisLine: {onZero: false},
splitLine: {show: false},
splitNumber: 20,
min: 'dataMin',
max: 'dataMax'
},
yAxis: {
scale: true,
splitArea: {
show: true
}
},
dataZoom: [
{
type: 'inside',
start: 50,
end: 100
},
{
show: true,
type: 'slider',
y: '90%',
start: 50,
end: 100
}
],
series: [
{
name: '日K',
type: 'candlestick',
data: data0.values,
markPoint: {
label: {
normal: {
formatter: function (param) {
return param != null ? Math.round(param.value) : '';
}
}
},
data: [
{
name: 'XX标点',
coord: ['2013/5/31', 2300],
value: 2300,
itemStyle: {
normal: {color: 'rgb(41,60,85)'}
}
},
{
name: 'highest value',
type: 'max',
valueDim: 'highest'
},
{
name: 'lowest value',
type: 'min',
valueDim: 'lowest'
},
{
name: 'average value on close',
type: 'average',
valueDim: 'close'
}
],
tooltip: {
formatter: function (param) {
return param.name + '<br>' + (param.data.coord || '');
}
}
},
markLine: {
symbol: ['none', 'none'],
data: [
[
{
name: 'from lowest to highest',
type: 'min',
valueDim: 'lowest',
symbol: 'circle',
symbolSize: 10,
label: {
normal: {show: false},
emphasis: {show: false}
}
},
{
type: 'max',
valueDim: 'highest',
symbol: 'circle',
symbolSize: 10,
label: {
normal: {show: false},
emphasis: {show: false}
}
}
],
{
name: 'min line on close',
type: 'min',
valueDim: 'close'
},
{
name: 'max line on close',
type: 'max',
valueDim: 'close'
}
]
}
},
{
name: 'MA5',
type: 'line',
data: calculateMA(5),
smooth: true,
lineStyle: {
normal: {opacity: 0.5}
}
},
{
name: 'MA10',
type: 'line',
data: calculateMA(10),
smooth: true,
lineStyle: {
normal: {opacity: 0.5}
}
},
{
name: 'MA20',
type: 'line',
data: calculateMA(20),
smooth: true,
lineStyle: {
normal: {opacity: 0.5}
}
},
{
name: 'MA30',
type: 'line',
data: calculateMA(30),
smooth: true,
lineStyle: {
normal: {opacity: 0.5}
}
},
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>

@ -0,0 +1,497 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>后台登录-X-admin2.0</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
特别声明ECharts一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上兼容当前绝大部分浏览器IE8/9/10/11ChromeFirefoxSafari等底层依赖轻量级的 Canvas 类库 ZRender提供直观生动可交互可高度个性化定制的数据可视化图表。如需使用或者详细更多案例可以访问官网 <a href="http://echarts.baidu.com/" style="color:red">ECharts</a>。 x-admin不承担任何版权问题。
</blockquote>
<!-- 为 ECharts 准备一个具备大小(宽高)的 DOM -->
<div id="main" style="width: 100%;height:400px;"></div>
<blockquote class="layui-elem-quote">
注意本案例的Echarts图表库由cdn引入需要在线才能正常使用如想离想请至Echarts官网下载。
</blockquote>
</div>
<script src="//cdn.bootcss.com/echarts/3.3.2/echarts.min.js" charset="utf-8"></script>
<script src="//cdn.bootcss.com/echarts/3.3.2/extension/bmap.min.js" type="text/javascript"></script>
<script src="http://echarts.baidu.com/asset/map/js/china.js"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
myChart.setOption({
series: [{
type: 'map',
map: 'china'
}]
});
var geoCoordMap = {
"海门":[121.15,31.89],
"鄂尔多斯":[109.781327,39.608266],
"招远":[120.38,37.35],
"舟山":[122.207216,29.985295],
"齐齐哈尔":[123.97,47.33],
"盐城":[120.13,33.38],
"赤峰":[118.87,42.28],
"青岛":[120.33,36.07],
"乳山":[121.52,36.89],
"金昌":[102.188043,38.520089],
"泉州":[118.58,24.93],
"莱西":[120.53,36.86],
"日照":[119.46,35.42],
"胶南":[119.97,35.88],
"南通":[121.05,32.08],
"拉萨":[91.11,29.97],
"云浮":[112.02,22.93],
"梅州":[116.1,24.55],
"文登":[122.05,37.2],
"上海":[121.48,31.22],
"攀枝花":[101.718637,26.582347],
"威海":[122.1,37.5],
"承德":[117.93,40.97],
"厦门":[118.1,24.46],
"汕尾":[115.375279,22.786211],
"潮州":[116.63,23.68],
"丹东":[124.37,40.13],
"太仓":[121.1,31.45],
"曲靖":[103.79,25.51],
"烟台":[121.39,37.52],
"福州":[119.3,26.08],
"瓦房店":[121.979603,39.627114],
"即墨":[120.45,36.38],
"抚顺":[123.97,41.97],
"玉溪":[102.52,24.35],
"张家口":[114.87,40.82],
"阳泉":[113.57,37.85],
"莱州":[119.942327,37.177017],
"湖州":[120.1,30.86],
"汕头":[116.69,23.39],
"昆山":[120.95,31.39],
"宁波":[121.56,29.86],
"湛江":[110.359377,21.270708],
"揭阳":[116.35,23.55],
"荣成":[122.41,37.16],
"连云港":[119.16,34.59],
"葫芦岛":[120.836932,40.711052],
"常熟":[120.74,31.64],
"东莞":[113.75,23.04],
"河源":[114.68,23.73],
"淮安":[119.15,33.5],
"泰州":[119.9,32.49],
"南宁":[108.33,22.84],
"营口":[122.18,40.65],
"惠州":[114.4,23.09],
"江阴":[120.26,31.91],
"蓬莱":[120.75,37.8],
"韶关":[113.62,24.84],
"嘉峪关":[98.289152,39.77313],
"广州":[113.23,23.16],
"延安":[109.47,36.6],
"太原":[112.53,37.87],
"清远":[113.01,23.7],
"中山":[113.38,22.52],
"昆明":[102.73,25.04],
"寿光":[118.73,36.86],
"盘锦":[122.070714,41.119997],
"长治":[113.08,36.18],
"深圳":[114.07,22.62],
"珠海":[113.52,22.3],
"宿迁":[118.3,33.96],
"咸阳":[108.72,34.36],
"铜川":[109.11,35.09],
"平度":[119.97,36.77],
"佛山":[113.11,23.05],
"海口":[110.35,20.02],
"江门":[113.06,22.61],
"章丘":[117.53,36.72],
"肇庆":[112.44,23.05],
"大连":[121.62,38.92],
"临汾":[111.5,36.08],
"吴江":[120.63,31.16],
"石嘴山":[106.39,39.04],
"沈阳":[123.38,41.8],
"苏州":[120.62,31.32],
"茂名":[110.88,21.68],
"嘉兴":[120.76,30.77],
"长春":[125.35,43.88],
"胶州":[120.03336,36.264622],
"银川":[106.27,38.47],
"张家港":[120.555821,31.875428],
"三门峡":[111.19,34.76],
"锦州":[121.15,41.13],
"南昌":[115.89,28.68],
"柳州":[109.4,24.33],
"三亚":[109.511909,18.252847],
"自贡":[104.778442,29.33903],
"吉林":[126.57,43.87],
"阳江":[111.95,21.85],
"泸州":[105.39,28.91],
"西宁":[101.74,36.56],
"宜宾":[104.56,29.77],
"呼和浩特":[111.65,40.82],
"成都":[104.06,30.67],
"大同":[113.3,40.12],
"镇江":[119.44,32.2],
"桂林":[110.28,25.29],
"张家界":[110.479191,29.117096],
"宜兴":[119.82,31.36],
"北海":[109.12,21.49],
"西安":[108.95,34.27],
"金坛":[119.56,31.74],
"东营":[118.49,37.46],
"牡丹江":[129.58,44.6],
"遵义":[106.9,27.7],
"绍兴":[120.58,30.01],
"扬州":[119.42,32.39],
"常州":[119.95,31.79],
"潍坊":[119.1,36.62],
"重庆":[106.54,29.59],
"台州":[121.420757,28.656386],
"南京":[118.78,32.04],
"滨州":[118.03,37.36],
"贵阳":[106.71,26.57],
"无锡":[120.29,31.59],
"本溪":[123.73,41.3],
"克拉玛依":[84.77,45.59],
"渭南":[109.5,34.52],
"马鞍山":[118.48,31.56],
"宝鸡":[107.15,34.38],
"焦作":[113.21,35.24],
"句容":[119.16,31.95],
"北京":[116.46,39.92],
"徐州":[117.2,34.26],
"衡水":[115.72,37.72],
"包头":[110,40.58],
"绵阳":[104.73,31.48],
"乌鲁木齐":[87.68,43.77],
"枣庄":[117.57,34.86],
"杭州":[120.19,30.26],
"淄博":[118.05,36.78],
"鞍山":[122.85,41.12],
"溧阳":[119.48,31.43],
"库尔勒":[86.06,41.68],
"安阳":[114.35,36.1],
"开封":[114.35,34.79],
"济南":[117,36.65],
"德阳":[104.37,31.13],
"温州":[120.65,28.01],
"九江":[115.97,29.71],
"邯郸":[114.47,36.6],
"临安":[119.72,30.23],
"兰州":[103.73,36.03],
"沧州":[116.83,38.33],
"临沂":[118.35,35.05],
"南充":[106.110698,30.837793],
"天津":[117.2,39.13],
"富阳":[119.95,30.07],
"泰安":[117.13,36.18],
"诸暨":[120.23,29.71],
"郑州":[113.65,34.76],
"哈尔滨":[126.63,45.75],
"聊城":[115.97,36.45],
"芜湖":[118.38,31.33],
"唐山":[118.02,39.63],
"平顶山":[113.29,33.75],
"邢台":[114.48,37.05],
"德州":[116.29,37.45],
"济宁":[116.59,35.38],
"荆州":[112.239741,30.335165],
"宜昌":[111.3,30.7],
"义乌":[120.06,29.32],
"丽水":[119.92,28.45],
"洛阳":[112.44,34.7],
"秦皇岛":[119.57,39.95],
"株洲":[113.16,27.83],
"石家庄":[114.48,38.03],
"莱芜":[117.67,36.19],
"常德":[111.69,29.05],
"保定":[115.48,38.85],
"湘潭":[112.91,27.87],
"金华":[119.64,29.12],
"岳阳":[113.09,29.37],
"长沙":[113,28.21],
"衢州":[118.88,28.97],
"廊坊":[116.7,39.53],
"菏泽":[115.480656,35.23375],
"合肥":[117.27,31.86],
"武汉":[114.31,30.52],
"大庆":[125.03,46.58]
};
var convertData = function (data) {
var res = [];
for (var i = 0; i < data.length; i++) {
var geoCoord = geoCoordMap[data[i].name];
if (geoCoord) {
res.push(geoCoord.concat(data[i].value));
}
}
return res;
};
option = {
title: {
text: '全国主要城市空气质量',
subtext: 'data from PM25.in',
sublink: 'http://www.pm25.in',
left: 'center',
textStyle: {
color: '#fff'
}
},
backgroundColor: '#404a59',
visualMap: {
min: 0,
max: 500,
splitNumber: 5,
inRange: {
color: ['#d94e5d','#eac736','#50a3ba'].reverse()
},
textStyle: {
color: '#fff'
}
},
geo: {
map: 'china',
label: {
emphasis: {
show: false
}
},
roam: true,
itemStyle: {
normal: {
areaColor: '#323c48',
borderColor: '#111'
},
emphasis: {
areaColor: '#2a333d'
}
}
},
series: [{
name: 'AQI',
type: 'heatmap',
coordinateSystem: 'geo',
data: convertData([
{name: "海门", value: 9},
{name: "鄂尔多斯", value: 12},
{name: "招远", value: 12},
{name: "舟山", value: 12},
{name: "齐齐哈尔", value: 14},
{name: "盐城", value: 15},
{name: "赤峰", value: 16},
{name: "青岛", value: 18},
{name: "乳山", value: 18},
{name: "金昌", value: 19},
{name: "泉州", value: 21},
{name: "莱西", value: 21},
{name: "日照", value: 21},
{name: "胶南", value: 22},
{name: "南通", value: 23},
{name: "拉萨", value: 24},
{name: "云浮", value: 24},
{name: "梅州", value: 25},
{name: "文登", value: 25},
{name: "上海", value: 25},
{name: "攀枝花", value: 25},
{name: "威海", value: 25},
{name: "承德", value: 25},
{name: "厦门", value: 26},
{name: "汕尾", value: 26},
{name: "潮州", value: 26},
{name: "丹东", value: 27},
{name: "太仓", value: 27},
{name: "曲靖", value: 27},
{name: "烟台", value: 28},
{name: "福州", value: 29},
{name: "瓦房店", value: 30},
{name: "即墨", value: 30},
{name: "抚顺", value: 31},
{name: "玉溪", value: 31},
{name: "张家口", value: 31},
{name: "阳泉", value: 31},
{name: "莱州", value: 32},
{name: "湖州", value: 32},
{name: "汕头", value: 32},
{name: "昆山", value: 33},
{name: "宁波", value: 33},
{name: "湛江", value: 33},
{name: "揭阳", value: 34},
{name: "荣成", value: 34},
{name: "连云港", value: 35},
{name: "葫芦岛", value: 35},
{name: "常熟", value: 36},
{name: "东莞", value: 36},
{name: "河源", value: 36},
{name: "淮安", value: 36},
{name: "泰州", value: 36},
{name: "南宁", value: 37},
{name: "营口", value: 37},
{name: "惠州", value: 37},
{name: "江阴", value: 37},
{name: "蓬莱", value: 37},
{name: "韶关", value: 38},
{name: "嘉峪关", value: 38},
{name: "广州", value: 38},
{name: "延安", value: 38},
{name: "太原", value: 39},
{name: "清远", value: 39},
{name: "中山", value: 39},
{name: "昆明", value: 39},
{name: "寿光", value: 40},
{name: "盘锦", value: 40},
{name: "长治", value: 41},
{name: "深圳", value: 41},
{name: "珠海", value: 42},
{name: "宿迁", value: 43},
{name: "咸阳", value: 43},
{name: "铜川", value: 44},
{name: "平度", value: 44},
{name: "佛山", value: 44},
{name: "海口", value: 44},
{name: "江门", value: 45},
{name: "章丘", value: 45},
{name: "肇庆", value: 46},
{name: "大连", value: 47},
{name: "临汾", value: 47},
{name: "吴江", value: 47},
{name: "石嘴山", value: 49},
{name: "沈阳", value: 50},
{name: "苏州", value: 50},
{name: "茂名", value: 50},
{name: "嘉兴", value: 51},
{name: "长春", value: 51},
{name: "胶州", value: 52},
{name: "银川", value: 52},
{name: "张家港", value: 52},
{name: "三门峡", value: 53},
{name: "锦州", value: 54},
{name: "南昌", value: 54},
{name: "柳州", value: 54},
{name: "三亚", value: 54},
{name: "自贡", value: 56},
{name: "吉林", value: 56},
{name: "阳江", value: 57},
{name: "泸州", value: 57},
{name: "西宁", value: 57},
{name: "宜宾", value: 58},
{name: "呼和浩特", value: 58},
{name: "成都", value: 58},
{name: "大同", value: 58},
{name: "镇江", value: 59},
{name: "桂林", value: 59},
{name: "张家界", value: 59},
{name: "宜兴", value: 59},
{name: "北海", value: 60},
{name: "西安", value: 61},
{name: "金坛", value: 62},
{name: "东营", value: 62},
{name: "牡丹江", value: 63},
{name: "遵义", value: 63},
{name: "绍兴", value: 63},
{name: "扬州", value: 64},
{name: "常州", value: 64},
{name: "潍坊", value: 65},
{name: "重庆", value: 66},
{name: "台州", value: 67},
{name: "南京", value: 67},
{name: "滨州", value: 70},
{name: "贵阳", value: 71},
{name: "无锡", value: 71},
{name: "本溪", value: 71},
{name: "克拉玛依", value: 72},
{name: "渭南", value: 72},
{name: "马鞍山", value: 72},
{name: "宝鸡", value: 72},
{name: "焦作", value: 75},
{name: "句容", value: 75},
{name: "北京", value: 79},
{name: "徐州", value: 79},
{name: "衡水", value: 80},
{name: "包头", value: 80},
{name: "绵阳", value: 80},
{name: "乌鲁木齐", value: 84},
{name: "枣庄", value: 84},
{name: "杭州", value: 84},
{name: "淄博", value: 85},
{name: "鞍山", value: 86},
{name: "溧阳", value: 86},
{name: "库尔勒", value: 86},
{name: "安阳", value: 90},
{name: "开封", value: 90},
{name: "济南", value: 92},
{name: "德阳", value: 93},
{name: "温州", value: 95},
{name: "九江", value: 96},
{name: "邯郸", value: 98},
{name: "临安", value: 99},
{name: "兰州", value: 99},
{name: "沧州", value: 100},
{name: "临沂", value: 103},
{name: "南充", value: 104},
{name: "天津", value: 105},
{name: "富阳", value: 106},
{name: "泰安", value: 112},
{name: "诸暨", value: 112},
{name: "郑州", value: 113},
{name: "哈尔滨", value: 114},
{name: "聊城", value: 116},
{name: "芜湖", value: 117},
{name: "唐山", value: 119},
{name: "平顶山", value: 119},
{name: "邢台", value: 119},
{name: "德州", value: 120},
{name: "济宁", value: 120},
{name: "荆州", value: 127},
{name: "宜昌", value: 130},
{name: "义乌", value: 132},
{name: "丽水", value: 133},
{name: "洛阳", value: 134},
{name: "秦皇岛", value: 136},
{name: "株洲", value: 143},
{name: "石家庄", value: 147},
{name: "莱芜", value: 148},
{name: "常德", value: 152},
{name: "保定", value: 153},
{name: "湘潭", value: 154},
{name: "金华", value: 157},
{name: "岳阳", value: 169},
{name: "长沙", value: 175},
{name: "衢州", value: 177},
{name: "廊坊", value: 193},
{name: "菏泽", value: 194},
{name: "合肥", value: 229},
{name: "武汉", value: 273},
{name: "大庆", value: 279}
])
}]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>

@ -0,0 +1,239 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>后台登录-X-admin2.0</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
特别声明ECharts一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上兼容当前绝大部分浏览器IE8/9/10/11ChromeFirefoxSafari等底层依赖轻量级的 Canvas 类库 ZRender提供直观生动可交互可高度个性化定制的数据可视化图表。如需使用详细了解可以访问官网 <a href="http://echarts.baidu.com/" style="color:red">ECharts</a>。 x-admin不承担任何版权问题。
</blockquote>
<!-- 为 ECharts 准备一个具备大小(宽高)的 DOM -->
<div id="main" style="width: 100%;height:400px;"></div>
<blockquote class="layui-elem-quote">
注意本案例的Echarts图表库由cdn引入需要在线才能正常使用如想离想请至Echarts官网下载。
</blockquote>
</div>
<script src="//cdn.bootcss.com/echarts/3.3.2/echarts.min.js" charset="utf-8"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
option = {
tooltip : {
formatter: "{a} <br/>{c} {b}"
},
toolbox: {
show: true,
feature: {
restore: {show: true},
saveAsImage: {show: true}
}
},
series : [
{
name: '速度',
type: 'gauge',
z: 3,
min: 0,
max: 220,
splitNumber: 11,
radius: '50%',
axisLine: { // 坐标轴线
lineStyle: { // 属性lineStyle控制线条样式
width: 10
}
},
axisTick: { // 坐标轴小标记
length: 15, // 属性length控制线长
lineStyle: { // 属性lineStyle控制线条样式
color: 'auto'
}
},
splitLine: { // 分隔线
length: 20, // 属性length控制线长
lineStyle: { // 属性lineStyle详见lineStyle控制线条样式
color: 'auto'
}
},
title : {
textStyle: { // 其余属性默认使用全局文本样式详见TEXTSTYLE
fontWeight: 'bolder',
fontSize: 20,
fontStyle: 'italic'
}
},
detail : {
textStyle: { // 其余属性默认使用全局文本样式详见TEXTSTYLE
fontWeight: 'bolder'
}
},
data:[{value: 40, name: 'km/h'}]
},
{
name: '转速',
type: 'gauge',
center: ['20%', '55%'], // 默认全局居中
radius: '35%',
min:0,
max:7,
endAngle:45,
splitNumber:7,
axisLine: { // 坐标轴线
lineStyle: { // 属性lineStyle控制线条样式
width: 8
}
},
axisTick: { // 坐标轴小标记
length:12, // 属性length控制线长
lineStyle: { // 属性lineStyle控制线条样式
color: 'auto'
}
},
splitLine: { // 分隔线
length:20, // 属性length控制线长
lineStyle: { // 属性lineStyle详见lineStyle控制线条样式
color: 'auto'
}
},
pointer: {
width:5
},
title: {
offsetCenter: [0, '-30%'], // x, y单位px
},
detail: {
textStyle: { // 其余属性默认使用全局文本样式详见TEXTSTYLE
fontWeight: 'bolder'
}
},
data:[{value: 1.5, name: 'x1000 r/min'}]
},
{
name: '油表',
type: 'gauge',
center: ['77%', '50%'], // 默认全局居中
radius: '25%',
min: 0,
max: 2,
startAngle: 135,
endAngle: 45,
splitNumber: 2,
axisLine: { // 坐标轴线
lineStyle: { // 属性lineStyle控制线条样式
width: 8
}
},
axisTick: { // 坐标轴小标记
splitNumber: 5,
length: 10, // 属性length控制线长
lineStyle: { // 属性lineStyle控制线条样式
color: 'auto'
}
},
axisLabel: {
formatter:function(v){
switch (v + '') {
case '0' : return 'E';
case '1' : return 'Gas';
case '2' : return 'F';
}
}
},
splitLine: { // 分隔线
length: 15, // 属性length控制线长
lineStyle: { // 属性lineStyle详见lineStyle控制线条样式
color: 'auto'
}
},
pointer: {
width:2
},
title : {
show: false
},
detail : {
show: false
},
data:[{value: 0.5, name: 'gas'}]
},
{
name: '水表',
type: 'gauge',
center : ['77%', '50%'], // 默认全局居中
radius : '25%',
min: 0,
max: 2,
startAngle: 315,
endAngle: 225,
splitNumber: 2,
axisLine: { // 坐标轴线
lineStyle: { // 属性lineStyle控制线条样式
width: 8
}
},
axisTick: { // 坐标轴小标记
show: false
},
axisLabel: {
formatter:function(v){
switch (v + '') {
case '0' : return 'H';
case '1' : return 'Water';
case '2' : return 'C';
}
}
},
splitLine: { // 分隔线
length: 15, // 属性length控制线长
lineStyle: { // 属性lineStyle详见lineStyle控制线条样式
color: 'auto'
}
},
pointer: {
width:2
},
title: {
show: false
},
detail: {
show: false
},
data:[{value: 0.5, name: 'gas'}]
}
]
};
setInterval(function (){
option.series[0].data[0].value = (Math.random()*100).toFixed(2) - 0;
option.series[1].data[0].value = (Math.random()*7).toFixed(2) - 0;
option.series[2].data[0].value = (Math.random()*2).toFixed(2) - 0;
option.series[3].data[0].value = (Math.random()*2).toFixed(2) - 0;
myChart.setOption(option,true);
},2000);
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 315 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

@ -0,0 +1,22 @@
var utilRequest = {
/**
* request method
* @returns {string}
*/
GET : function () {
return "GET";
},
POST : function () {
return "post";
},
DELETE : function () {
return "DELETE";
},
PUT : function () {
return "PUT";
}
}

@ -0,0 +1,42 @@
var login = {
URL : {
/**
* login url
* @returns {string}
*/
login : function () {
return "/tokens"
}
},
/**
* login 登陆
*/
login : function () {
layui.use('form', function(){
var form = layui.form;
/**表单提交事件*/
$('#login-form').submit(function () {
var username = $("#username").val();
var password = $("#password").val();
console.log(username);
console.log(password);
$.ajax({
type : utilRequest.POST(),
url : login.URL.login(),
data : "userName=" + username + "&password=" + password + "&status=0",
success : function (msg) {
alert(JSON.stringify(msg));
console.log(msg);
location.href='management.html';
},
fail : function (msg) {
alert(msg);
console.log(msg);
}
});
});
});
}
}

@ -0,0 +1,171 @@
$(function () {
//加载弹出层
layui.use(['form','element'],
function() {
layer = layui.layer;
element = layui.element;
});
//触发事件
var tab = {
tabAdd: function(title,url,id){
//新增一个Tab项
element.tabAdd('xbs_tab', {
title: title
,content: '<iframe tab-id="'+id+'" frameborder="0" src="'+url+'" scrolling="yes" class="x-iframe"></iframe>'
,id: id
})
}
,tabDelete: function(othis){
//删除指定Tab项
element.tabDelete('xbs_tab', '44'); //删除:“商品管理”
othis.addClass('layui-btn-disabled');
}
,tabChange: function(id){
//切换到指定Tab项
element.tabChange('xbs_tab', id); //切换到:用户管理
}
};
tableCheck = {
init:function () {
$(".layui-form-checkbox").click(function(event) {
if($(this).hasClass('layui-form-checked')){
$(this).removeClass('layui-form-checked');
if($(this).hasClass('header')){
$(".layui-form-checkbox").removeClass('layui-form-checked');
}
}else{
$(this).addClass('layui-form-checked');
if($(this).hasClass('header')){
$(".layui-form-checkbox").addClass('layui-form-checked');
}
}
});
},
getData:function () {
var obj = $(".layui-form-checked").not('.header');
var arr=[];
obj.each(function(index, el) {
arr.push(obj.eq(index).attr('data-id'));
});
return arr;
}
}
//开启表格多选
tableCheck.init();
$('.container .left_open i').click(function(event) {
if($('.left-nav').css('left')=='0px'){
$('.left-nav').animate({left: '-221px'}, 100);
$('.page-content').animate({left: '0px'}, 100);
$('.page-content-bg').hide();
}else{
$('.left-nav').animate({left: '0px'}, 100);
$('.page-content').animate({left: '221px'}, 100);
if($(window).width()<768){
$('.page-content-bg').show();
}
}
});
$('.page-content-bg').click(function(event) {
$('.left-nav').animate({left: '-221px'}, 100);
$('.page-content').animate({left: '0px'}, 100);
$(this).hide();
});
$('.layui-tab-close').click(function(event) {
$('.layui-tab-title li').eq(0).find('i').remove();
});
//左侧菜单效果
// $('#content').bind("click",function(event){
$('.left-nav #nav li').click(function (event) {
if($(this).children('.sub-menu').length){
if($(this).hasClass('open')){
$(this).removeClass('open');
$(this).find('.nav_right').html('&#xe697;');
$(this).children('.sub-menu').stop().slideUp();
$(this).siblings().children('.sub-menu').slideUp();
}else{
$(this).addClass('open');
$(this).children('a').find('.nav_right').html('&#xe6a6;');
$(this).children('.sub-menu').stop().slideDown();
$(this).siblings().children('.sub-menu').stop().slideUp();
$(this).siblings().find('.nav_right').html('&#xe697;');
$(this).siblings().removeClass('open');
}
}else{
var url = $(this).children('a').attr('_href');
var title = $(this).find('cite').html();
var index = $('.left-nav #nav li').index($(this));
for (var i = 0; i <$('.x-iframe').length; i++) {
if($('.x-iframe').eq(i).attr('tab-id')==index+1){
tab.tabChange(index+1);
event.stopPropagation();
return;
}
};
tab.tabAdd(title,url,index+1);
tab.tabChange(index+1);
}
event.stopPropagation();
})
})
/*弹出层*/
/*
参数解释
title 标题
url 请求的url
id 需要操作的数据id
w 弹出层宽度缺省调默认值
h 弹出层高度缺省调默认值
*/
function x_admin_show(title,url,w,h){
if (title == null || title == '') {
title=false;
};
if (url == null || url == '') {
url="404.html";
};
if (w == null || w == '') {
w=($(window).width()*0.9);
};
if (h == null || h == '') {
h=($(window).height() - 50);
};
layer.open({
type: 2,
area: [w+'px', h +'px'],
fix: false, //不固定
maxmin: true,
shadeClose: true,
shade:0.4,
title: title,
content: url
});
}
/*关闭弹出框口*/
function x_admin_close(){
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}

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.0.2 MIT License By http://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}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 200 KiB

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

Loading…
Cancel
Save