This commit is contained in:
裴浩宇 2020-04-07 18:10:21 +08:00
parent 3083b05840
commit 689354dff2
52 changed files with 4540 additions and 42 deletions

31
HSLink-back/.gitignore vendored Normal file
View File

@ -0,0 +1,31 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/

View File

@ -0,0 +1,118 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed 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
*
* https://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.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}

Binary file not shown.

View File

@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

310
HSLink-back/mvnw vendored Normal file
View File

@ -0,0 +1,310 @@
#!/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
#
# https://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.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven 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 Mingw, 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)`"
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
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
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
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
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 "$@"

182
HSLink-back/mvnw.cmd vendored Normal file
View File

@ -0,0 +1,182 @@
@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 https://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 Maven 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 keystroke 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 set title of command window
title %0
@REM enable echoing by 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
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%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%

75
HSLink-back/pom.xml Normal file
View File

@ -0,0 +1,75 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.qinxx</groupId>
<artifactId>hslink</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>hslink</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<!--不然编译找不到xml-->
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>

View File

@ -0,0 +1,15 @@
package com.qinxx.hslink;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@MapperScan(basePackages = {"com.qinxx.hslink.dao"})
@SpringBootApplication
public class HslinkApplication {
public static void main(String[] args) {
SpringApplication.run(HslinkApplication.class, args);
}
}

View File

@ -0,0 +1,62 @@
package com.qinxx.hslink.controller;
import com.qinxx.hslink.service.HSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/hs")
public class HSController {
@Autowired
HSService hsService;
//登录验证
@RequestMapping(value = "/login", method = {RequestMethod.POST, RequestMethod.GET})
@ResponseBody
public Map<String,Object> hello(@RequestBody Map<String,Object> param) {
Map<String,Object> result = new HashMap<>();
result = hsService.login(param);
return result;
}
//注册
@RequestMapping(value = "/register", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public Map<String,Object> register(@RequestBody Map<String,Object> param) {
Map<String,Object> result = new HashMap<>();
result = hsService.register(param);
return result;
}
//获取首页内容
@RequestMapping(value = "/getAllContent", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public Map<String,Object> getAllContent(@RequestBody Map<String,Object> param) {
Map<String,Object> result = new HashMap<>();
result = hsService.getAllContent(param);
return result;
}
//获取一条数据具体内容
@RequestMapping(value = "/getOneContent", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public Map<String,Object> getOneContent(@RequestBody Map<String,Object> param) {
Map<String,Object> result = hsService.getOneContent(param);
return result;
}
//新增留言
@RequestMapping(value = "/addMessage", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public Map<String,Object> addMessage(@RequestBody Map<String,Object> param) {
Map<String,Object> result = hsService.addMessage(param);
return result;
}
}

View File

@ -0,0 +1,51 @@
package com.qinxx.hslink.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface HSLinkMapper {
/**
*登录验证
* @return
*/
Map<String,Object> login(Map<String,Object> param);
/**
* 注册
*/
int register(Map<String,Object> param);
/**
* 获取校园通知
*/
List<Map<String,Object>> getSchoolNotice(Map<String,Object> param);
/**
* 获取优秀建议
*/
List<Map<String,Object>> getParentAdvice(Map<String,Object> param);
/**
* 获取神奇想法
*/
List<Map<String,Object>> getStudentThinking(Map<String,Object> param);
/**
* 获取一条数据具体内容
*/
Map<String,Object> getOneContent(Map<String,Object> param);
/**
* 获取一条数据具体内容
*/
List<Map<String,Object>> getOneLeaveMessage(Map<String,Object> param);
/**
* 新增留言
*/
int addMessage(Map<String,Object> param);
}

View File

@ -0,0 +1,120 @@
<?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.qinxx.hslink.dao.HSLinkMapper">
<!--登录验证-->
<select id="login" resultType="map" parameterType="map">
select * from hs_user where (real_name = #{username} and pass_word = #{password} and user_type = #{role})
or (mobile = #{username} and pass_word = #{password} and user_type = #{role})
</select>
<!--注册-->
<insert id="register" parameterType="map">
INSERT INTO hs_user ( user_id, pass_word,real_name, mobile, user_type, creat_time, frozen_state, error_times)
VALUES
(
uuid(),
#{password},
#{realname},
#{mobile},
#{type},
now(),
'00',
'0'
)
</insert>
<!--获取校园通知-->
<select id="getSchoolNotice" parameterType="map" resultType="map">
SELECT
s.id,
label,
title,
content,
real_name,
release_time
FROM
hs_notice s left join hs_user u on s.release_id = u.user_id
where type = '校园通知'
<if test="id != null and id != ''">
and s.id = #{id}
</if>
<if test="type != null and type != ''">
and label = #{label}
</if>
ORDER BY release_time desc
</select>
<!--获取家长建议-->
<select id="getParentAdvice" parameterType="map" resultType="map">
SELECT
p.id,
label,
title,
content,
real_name,
release_time
FROM
hs_notice p left join hs_user u on p.release_id = u.user_id
where type = '家长建议'
<if test="id != null and id != ''">
and p.id = #{id}
</if>
<if test="type != null and type != ''">
and label = #{label}
</if>
ORDER BY release_time desc
</select>
<!--获取学生想法-->
<select id="getStudentThinking" parameterType="map" resultType="map">
SELECT
s.id,
label,
title,
content,
real_name,
release_time
FROM
hs_notice s left join hs_user u on s.release_id = u.user_id
where type = '学生想法'
<if test="id != null and id != ''">
and s.id = #{id}
</if>
<if test="type != null and type != ''">
and label = #{label}
</if>
ORDER BY release_time desc
</select>
<!--获取一条数据的具体内容-->
<select id="getOneContent" resultType="map" parameterType="map">
select
id,
release_id author_id,
real_name author_name,
create_time,
label,
title,
content,
integral,
'' header_photo
from hs_notice n left join hs_user u on n.release_id = u.user_id
where id = #{id}
</select>
<!--获取一条数据的留言-->
<select id="getOneLeaveMessage" parameterType="map" resultType="map">
select id,
messager_id,
content,
hs_leave_message.create_time,
real_name,
'' header_photot from hs_leave_message left join hs_user on messager_id = user_id where notice_id = #{id} ORDER BY create_time desc
</select>
<!--新增留言-->
<insert id="addMessage" parameterType="map">
insert into hs_leave_message(id,notice_id,messager_id,content,create_time) VALUES (uuid(),#{noticeId},#{userId},#{content},#{createTime})
</insert>
</mapper>

View File

@ -0,0 +1,35 @@
package com.qinxx.hslink.service;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
public interface HSService {
/**
*登录验证
* @return
*/
Map<String,Object> login(Map<String,Object> param);
/**
* 注册
*/
Map<String, Object> register(Map<String, Object> parameter);
/**
* 获取首页内容
*/
Map<String,Object> getAllContent(Map<String,Object> param);
/**
* 获取一条数据具体内容
*/
Map<String,Object> getOneContent(Map<String,Object> param);
/**
* 新增留言
*/
Map<String,Object> addMessage(Map<String,Object> param);
}

View File

@ -0,0 +1,83 @@
package com.qinxx.hslink.service.impl;
import com.qinxx.hslink.dao.HSLinkMapper;
import com.qinxx.hslink.service.HSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class HSServiceImpl implements HSService {
@Autowired
HSLinkMapper hsLinkMapper;
@Override
public Map<String, Object> login(Map<String, Object> param) {
Map<String,Object> result = new HashMap<>();
Map<String,Object> res = hsLinkMapper.login(param);
result.put("data",res);
result.put("success",true);
return result;
}
@Override
public Map<String, Object> register(Map<String, Object> parameter) {
Map<String, Object> result = new HashMap<>();
int res = 0;
try {
res = hsLinkMapper.register(parameter);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
@Override
public Map<String, Object> getAllContent(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
Map<String,Object> res = new HashMap<>();
List<Map<String,Object>> schoolNoticeList = hsLinkMapper.getSchoolNotice(param);
res.put("schoolNoticeList",schoolNoticeList);
List<Map<String,Object>> parentAdvice = hsLinkMapper.getParentAdvice(param);
res.put("parentAdvice",parentAdvice);
List<Map<String,Object>> studentThinking = hsLinkMapper.getStudentThinking(param);
res.put("studentThinking",studentThinking);
result.put("data",res);
result.put("success",true);
return result;
}
@Override
public Map<String, Object> getOneContent(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
Map<String, Object> res = new HashMap<>();
Map<String, Object> res1 = hsLinkMapper.getOneContent(param);
List<Map<String, Object>> res2 = hsLinkMapper.getOneLeaveMessage(param);
res.put("content",res1);
res.put("message",res2);
result.put("data",res);
result.put("success",true);
return result;
}
@Override
public Map<String, Object> addMessage(Map<String, Object> param) {
int res = 0;
Map<String, Object> result = new HashMap<>();
try {
res = hsLinkMapper.addMessage(param);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
}

View File

@ -0,0 +1,25 @@
package com.qinxx.hslink.util;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
@Configuration
public class CorsConfig {
private CorsConfiguration buildConfig() {
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.addAllowedOrigin("*"); // 1允许任何域名使用
corsConfiguration.addAllowedHeader("*"); // 2允许任何头
corsConfiguration.addAllowedMethod("*"); // 3允许任何方法postget等
return corsConfiguration;
}
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", buildConfig()); // 4
return new CorsFilter(source);
}
}

View File

@ -0,0 +1,21 @@
##端口号
server:
port: 8048
## mybatis配置
mybatis:
mapper-locations: classpath*:com/qinxx/hslink/dao/mapping/*.xml
typeAliasesPackage: com.qinxx.hslink.model
##日志等级
logging:
level:
com.qinxx.hslink.dao : debug
##数据源
spring:
datasource:
# url: jdbc:mysql://123.57.22.91:3306/hslink?serverTimezone=Hongkong&useUnicode=true&characterEncoding=utf8
url: jdbc:mysql://127.0.0.1:3306/hslink?serverTimezone=Hongkong&useUnicode=true&characterEncoding=utf8
username: root
password: 123456
db-name: hslink
filters: log4j,wall,mergeStat
driverClassName: com.mysql.cj.jdbc.Driver

View File

@ -13,7 +13,7 @@ module.exports = {
proxyTable: {},
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
host: '192.168.10.29', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,

View File

@ -262,6 +262,14 @@
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
"dev": true
},
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/async-validator/-/async-validator-1.8.5.tgz",
"integrity": "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==",
"requires": {
"babel-runtime": "6.x"
}
},
"atob": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
@ -282,6 +290,32 @@
"postcss-value-parser": "^3.2.3"
}
},
"axios": {
"version": "0.19.2",
"resolved": "https://registry.npm.taobao.org/axios/download/axios-0.19.2.tgz",
"integrity": "sha1-PqNsXYgY0NX4qKl6bTa4bNwAyyc=",
"requires": {
"follow-redirects": "1.5.10"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-3.1.0.tgz",
"integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=",
"requires": {
"ms": "2.0.0"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.5.10.tgz",
"integrity": "sha1-e3qfmuov3/NnhqlP9kPtB/T/Xio=",
"requires": {
"debug": "=3.1.0"
}
}
}
},
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
@ -532,8 +566,7 @@
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==",
"dev": true
"integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg=="
},
"babel-helpers": {
"version": "6.24.1",
@ -1061,7 +1094,6 @@
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"dev": true,
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
@ -2000,8 +2032,7 @@
"core-js": {
"version": "2.6.11",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
"dev": true
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg=="
},
"core-util-is": {
"version": "1.0.2",
@ -3149,6 +3180,11 @@
"regexp.prototype.flags": "^1.2.0"
}
},
"deepmerge": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz",
"integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ=="
},
"define-properties": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
@ -3433,6 +3469,19 @@
"integrity": "sha512-4RvbM5x+002gKI8sltkqWEk5pptn0UnzekUx8RTThAMPDSb8jjpm6SwGiSnEve7f85biyZl8DMXaipaCxDjXag==",
"dev": true
},
"element-ui": {
"version": "2.13.0",
"resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.13.0.tgz",
"integrity": "sha512-KYsHWsBXYbLELS8cdfvgJTOMSUby3UEjvsPV1V1VmgJ/DdkOAS4z3MiOrPxrT9w2Cc5lZ4eVSQiGhYFR5NVChw==",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
"deepmerge": "^1.2.0",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
}
},
"elliptic": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
@ -5894,6 +5943,11 @@
"object-visit": "^1.0.0"
}
},
"marked": {
"version": "0.8.2",
"resolved": "https://registry.npm.taobao.org/marked/download/marked-0.8.2.tgz?cache=0&sync_timestamp=1584894910023&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmarked%2Fdownload%2Fmarked-0.8.2.tgz",
"integrity": "sha1-T6rSjSbt41Gnoaql/sZ5Fchp41U="
},
"math-expression-evaluator": {
"version": "1.2.22",
"resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-1.2.22.tgz",
@ -6220,8 +6274,7 @@
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"multicast-dns": {
"version": "6.2.3",
@ -6400,6 +6453,11 @@
"sort-keys": "^1.0.0"
}
},
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"npm-run-path": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
@ -9586,8 +9644,7 @@
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==",
"dev": true
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
},
"regenerator-transform": {
"version": "0.10.1",
@ -9724,6 +9781,11 @@
"integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=",
"dev": true
},
"resize-observer-polyfill": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz",
"integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg=="
},
"resolve": {
"version": "1.15.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz",
@ -10660,6 +10722,11 @@
"integrity": "sha512-2wsvQ+4GwBvLPLWsNfLCDYGsW6xb7aeC6utq2Qh0PFwgEy7K7dsma9Jsmb2zSQj7GvYAyUGSntLtsv++GmgL1A==",
"dev": true
},
"throttle-debounce": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz",
"integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg=="
},
"through2": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
@ -11248,6 +11315,11 @@
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.6.tgz",
"integrity": "sha512-GYhn2ynaZlysZMkFE5oCHRUTqE8BWs/a9YbKpNLi0i7xD6KG1EzDqpHQmv1F5gXjr8kL5iIVS8EOtRaVUEXTqA=="
},
"vue-scroll": {
"version": "2.1.13",
"resolved": "https://registry.npm.taobao.org/vue-scroll/download/vue-scroll-2.1.13.tgz",
"integrity": "sha1-Q+KfQ/1k1S/yhWh3wtDFsPZDMYg="
},
"vue-style-loader": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-3.1.2.tgz",

View File

@ -10,9 +10,12 @@
"build": "node build/build.js"
},
"dependencies": {
"axios": "^0.19.2",
"element-ui": "^2.13.0",
"marked": "^0.8.2",
"vue": "^2.5.2",
"vue-router": "^3.0.1"
"vue-router": "^3.0.1",
"vue-scroll": "^2.1.13"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
@ -39,6 +42,8 @@
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"sass": "^1.26.3",
"sass-loader": "^7.3.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",

View File

@ -0,0 +1,88 @@
// 配置API接口地址
import de from "element-ui/src/locale/lang/de";
// let root = 'http://192.168.10.29:8008'
// let root = 'http://123.57.22.91:8002'
let root = 'http://127.0.0.1:8048'
// 引用axios
let axios = require('axios')
// 自定义判断元素类型JS
function toType (obj) {
return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
}
// 参数过滤函数
function filterNull (o) {
for (let key in o) {
if (o[key] === null) {
delete o[key]
}
if (toType(o[key]) === 'string') {
o[key] = o[key].trim()
} else if (toType(o[key]) === 'object') {
o[key] = filterNull(o[key])
} else if (toType(o[key]) === 'array') {
o[key] = filterNull(o[key])
}
}
return o
}
/*
接口处理函数
这个函数每个项目都是不一样的我现在调整的是适用于
https://cnodejs.org/api/v1 的接口,如果是其他接口
需要根据接口的参数进行调整参考说明文档地址
https://cnodejs.org/topic/5378720ed6e2d16149fa16bd
主要是不同的接口的成功标识和失败提示是不一致的
另外不同的项目的处理方法也是不一致的这里出错就是简单的alert
*/
function apiAxios (method, url, params, success, failure) {
if (params) {
params = filterNull(params)
}
axios({
method: method,
url: url,
data: method === 'POST' || method === 'PUT' ? params : null,
params: method === 'GET' || method === 'DELETE' ? params : null,
baseURL: root,
withCredentials: false
})
.then(function (res) {
console.log("success",res)
if (res.data.success === true) {
if (success) {
success(res.data.data)
}
} else {
if (failure) {
failure(res.data)
} else {
console.log('error: ' + JSON.stringify(res.data))
}
}
})
.catch(function (err) {
console.log("error",err)
let res = err.response
if (err) {
console.log('api error, HTTP CODE: ' + res)
}
})
}
// 返回在vue模板中的调用接口
export default {
get: function (url, params, success, failure) {
return apiAxios('GET', url, params, success, failure)
},
post: function (url, params, success, failure) {
return apiAxios('POST', url, params, success, failure)
},
put: function (url, params, success, failure) {
return apiAxios('PUT', url, params, success, failure)
},
delete: function (url, params, success, failure) {
return apiAxios('DELETE', url, params, success, failure)
}
}

View File

@ -0,0 +1 @@
.hljs{display:block;overflow-x:auto;padding:0.5em;color:#abb2bf;background:#282c34}.hljs-comment,.hljs-quote{color:#5c6370;font-style:italic}.hljs-doctag,.hljs-keyword,.hljs-formula{color:#c678dd}.hljs-section,.hljs-name,.hljs-selector-tag,.hljs-deletion,.hljs-subst{color:#e06c75}.hljs-literal{color:#56b6c2}.hljs-string,.hljs-regexp,.hljs-addition,.hljs-attribute,.hljs-meta-string{color:#98c379}.hljs-built_in,.hljs-class .hljs-title{color:#e6c07b}.hljs-attr,.hljs-variable,.hljs-template-variable,.hljs-type,.hljs-selector-class,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-number{color:#d19a66}.hljs-symbol,.hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-title{color:#61aeee}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:bold}.hljs-link{text-decoration:underline}

View File

@ -0,0 +1,681 @@
@font-face {
font-family: octicons-link;
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAAizAFoAAABiAGIAznjaY2BkYGAA4in8zwXi+W2+MjCzMIDApSwvXzC97Z4Ig8N/BxYGZgcgl52BCSQKAA3jCV8CAABfAAAAAAQAAEB42mNgZGBg4f3vACQZQABIMjKgAmYAKEgBXgAAeNpjYGY6wTiBgZWBg2kmUxoDA4MPhGZMYzBi1AHygVLYQUCaawqDA4PChxhmh/8ODDEsvAwHgMKMIDnGL0x7gJQCAwMAJd4MFwAAAHjaY2BgYGaA4DAGRgYQkAHyGMF8NgYrIM3JIAGVYYDT+AEjAwuDFpBmA9KMDEwMCh9i/v8H8sH0/4dQc1iAmAkALaUKLgAAAHjaTY9LDsIgEIbtgqHUPpDi3gPoBVyRTmTddOmqTXThEXqrob2gQ1FjwpDvfwCBdmdXC5AVKFu3e5MfNFJ29KTQT48Ob9/lqYwOGZxeUelN2U2R6+cArgtCJpauW7UQBqnFkUsjAY/kOU1cP+DAgvxwn1chZDwUbd6CFimGXwzwF6tPbFIcjEl+vvmM/byA48e6tWrKArm4ZJlCbdsrxksL1AwWn/yBSJKpYbq8AXaaTb8AAHja28jAwOC00ZrBeQNDQOWO//sdBBgYGRiYWYAEELEwMTE4uzo5Zzo5b2BxdnFOcALxNjA6b2ByTswC8jYwg0VlNuoCTWAMqNzMzsoK1rEhNqByEyerg5PMJlYuVueETKcd/89uBpnpvIEVomeHLoMsAAe1Id4AAAAAAAB42oWQT07CQBTGv0JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==) format('woff');
}
.markdown-body {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
line-height: 1.5;
color: #333;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 16px;
line-height: 1.5;
word-wrap: break-word;
}
.markdown-body .pl-c {
color: #969896;
}
.markdown-body .pl-c1,
.markdown-body .pl-s .pl-v {
color: #0086b3;
}
.markdown-body .pl-e,
.markdown-body .pl-en {
color: #795da3;
}
.markdown-body .pl-smi,
.markdown-body .pl-s .pl-s1 {
color: #333;
}
.markdown-body .pl-ent {
color: #63a35c;
}
.markdown-body .pl-k {
color: #a71d5d;
}
.markdown-body .pl-s,
.markdown-body .pl-pds,
.markdown-body .pl-s .pl-pse .pl-s1,
.markdown-body .pl-sr,
.markdown-body .pl-sr .pl-cce,
.markdown-body .pl-sr .pl-sre,
.markdown-body .pl-sr .pl-sra {
color: #183691;
}
.markdown-body .pl-v {
color: #ed6a43;
}
.markdown-body .pl-id {
color: #b52a1d;
}
.markdown-body .pl-ii {
color: #f8f8f8;
background-color: #b52a1d;
}
.markdown-body .pl-sr .pl-cce {
font-weight: bold;
color: #63a35c;
}
.markdown-body .pl-ml {
color: #693a17;
}
.markdown-body .pl-mh,
.markdown-body .pl-mh .pl-en,
.markdown-body .pl-ms {
font-weight: bold;
color: #1d3e81;
}
.markdown-body .pl-mq {
color: #008080;
}
.markdown-body .pl-mi {
font-style: italic;
color: #333;
}
.markdown-body .pl-mb {
font-weight: bold;
color: #333;
}
.markdown-body .pl-md {
color: #bd2c00;
background-color: #ffecec;
}
.markdown-body .pl-mi1 {
color: #55a532;
background-color: #eaffea;
}
.markdown-body .pl-mdr {
font-weight: bold;
color: #795da3;
}
.markdown-body .pl-mo {
color: #1d3e81;
}
.markdown-body .octicon {
display: inline-block;
vertical-align: text-top;
fill: currentColor;
}
.markdown-body a {
background-color: transparent;
-webkit-text-decoration-skip: objects;
}
.markdown-body a:active,
.markdown-body a:hover {
outline-width: 0;
}
.markdown-body strong {
font-weight: inherit;
}
.markdown-body strong {
font-weight: bolder;
}
.markdown-body h1 {
font-size: 2em;
margin: 0.67em 0;
}
.markdown-body img {
border-style: none;
}
.markdown-body svg:not(:root) {
overflow: hidden;
}
.markdown-body code,
.markdown-body kbd,
.markdown-body pre {
font-family: monospace, monospace;
font-size: 1em;
}
.markdown-body hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
.markdown-body input {
font: inherit;
margin: 0;
}
.markdown-body input {
overflow: visible;
}
.markdown-body [type="checkbox"] {
box-sizing: border-box;
padding: 0;
}
.markdown-body * {
box-sizing: border-box;
}
.markdown-body input {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
.markdown-body a {
color: #4078c0;
text-decoration: none;
}
.markdown-body a:hover,
.markdown-body a:active {
text-decoration: underline;
}
.markdown-body strong {
font-weight: 600;
}
.markdown-body hr {
height: 0;
margin: 15px 0;
overflow: hidden;
background: transparent;
border: 0;
border-bottom: 1px solid #ddd;
}
.markdown-body hr::before {
display: table;
content: "";
}
.markdown-body hr::after {
display: table;
clear: both;
content: "";
}
.markdown-body table {
border-spacing: 0;
border-collapse: collapse;
}
.markdown-body td,
.markdown-body th {
padding: 0;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
margin-top: 0;
margin-bottom: 0;
}
.markdown-body h1 {
font-size: 32px;
font-weight: 600;
}
.markdown-body h2 {
font-size: 24px;
font-weight: 600;
}
.markdown-body h3 {
font-size: 20px;
font-weight: 600;
}
.markdown-body h4 {
font-size: 16px;
font-weight: 600;
}
.markdown-body h5 {
font-size: 14px;
font-weight: 600;
}
.markdown-body h6 {
font-size: 12px;
font-weight: 600;
}
.markdown-body p {
margin-top: 0;
margin-bottom: 10px;
}
.markdown-body blockquote {
margin: 0;
}
.markdown-body ul,
.markdown-body ol {
padding-left: 0;
margin-top: 0;
margin-bottom: 0;
}
.markdown-body ol ol,
.markdown-body ul ol {
list-style-type: lower-roman;
}
.markdown-body ul ul ol,
.markdown-body ul ol ol,
.markdown-body ol ul ol,
.markdown-body ol ol ol {
list-style-type: lower-alpha;
}
.markdown-body dd {
margin-left: 0;
}
.markdown-body code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 12px;
}
.markdown-body pre {
margin-top: 0;
margin-bottom: 0;
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
.markdown-body .octicon {
vertical-align: text-bottom;
}
.markdown-body input {
-webkit-font-feature-settings: "liga" 0;
font-feature-settings: "liga" 0;
}
.markdown-body::before {
display: table;
content: "";
}
.markdown-body::after {
display: table;
clear: both;
content: "";
}
.markdown-body>*:first-child {
margin-top: 0 !important;
}
.markdown-body>*:last-child {
margin-bottom: 0 !important;
}
.markdown-body a:not([href]) {
color: inherit;
text-decoration: none;
}
.markdown-body .anchor {
float: left;
padding-right: 4px;
margin-left: -20px;
line-height: 1;
}
.markdown-body .anchor:focus {
outline: none;
}
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre {
margin-top: 0;
margin-bottom: 16px;
}
.markdown-body hr {
height: 0.25em;
padding: 0;
margin: 24px 0;
background-color: #e7e7e7;
border: 0;
}
.markdown-body blockquote {
padding: 0 1em;
color: #777;
border-left: 0.25em solid #ddd;
}
.markdown-body blockquote>:first-child {
margin-top: 0;
}
.markdown-body blockquote>:last-child {
margin-bottom: 0;
}
.markdown-body kbd {
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
margin-top: 24px;
margin-bottom: 16px;
font-weight: 600;
line-height: 1.25;
}
.markdown-body h1 .octicon-link,
.markdown-body h2 .octicon-link,
.markdown-body h3 .octicon-link,
.markdown-body h4 .octicon-link,
.markdown-body h5 .octicon-link,
.markdown-body h6 .octicon-link {
color: #000;
vertical-align: middle;
visibility: hidden;
}
.markdown-body h1:hover .anchor,
.markdown-body h2:hover .anchor,
.markdown-body h3:hover .anchor,
.markdown-body h4:hover .anchor,
.markdown-body h5:hover .anchor,
.markdown-body h6:hover .anchor {
text-decoration: none;
}
.markdown-body h1:hover .anchor .octicon-link,
.markdown-body h2:hover .anchor .octicon-link,
.markdown-body h3:hover .anchor .octicon-link,
.markdown-body h4:hover .anchor .octicon-link,
.markdown-body h5:hover .anchor .octicon-link,
.markdown-body h6:hover .anchor .octicon-link {
visibility: visible;
}
.markdown-body h1 {
padding-bottom: 0.3em;
font-size: 2em;
border-bottom: 1px solid #eee;
}
.markdown-body h2 {
padding-bottom: 0.3em;
font-size: 1.5em;
border-bottom: 1px solid #eee;
}
.markdown-body h3 {
font-size: 1.25em;
}
.markdown-body h4 {
font-size: 1em;
}
.markdown-body h5 {
font-size: 0.875em;
}
.markdown-body h6 {
font-size: 0.85em;
color: #777;
}
.markdown-body ul,
.markdown-body ol {
padding-left: 2em;
}
.markdown-body ul ul,
.markdown-body ul ol,
.markdown-body ol ol,
.markdown-body ol ul {
margin-top: 0;
margin-bottom: 0;
}
.markdown-body li>p {
margin-top: 16px;
}
.markdown-body li+li {
margin-top: 0.25em;
}
.markdown-body dl {
padding: 0;
}
.markdown-body dl dt {
padding: 0;
margin-top: 16px;
font-size: 1em;
font-style: italic;
font-weight: bold;
}
.markdown-body dl dd {
padding: 0 16px;
margin-bottom: 16px;
}
.markdown-body table {
display: block;
width: 100%;
overflow: auto;
}
.markdown-body table th {
font-weight: bold;
}
.markdown-body table th,
.markdown-body table td {
padding: 6px 13px;
border: 1px solid #ddd;
}
.markdown-body table tr {
background-color: #fff;
border-top: 1px solid #ccc;
}
.markdown-body table tr:nth-child(2n) {
background-color: #f8f8f8;
}
.markdown-body img {
max-width: 100%;
box-sizing: content-box;
background-color: #fff;
}
.markdown-body code {
padding: 0;
padding-top: 0.2em;
padding-bottom: 0.2em;
margin: 0;
font-size: 85%;
background-color: rgba(0,0,0,0.04);
border-radius: 3px;
}
.markdown-body code::before,
.markdown-body code::after {
letter-spacing: -0.2em;
content: "\00a0";
}
.markdown-body pre {
word-wrap: normal;
}
.markdown-body pre>code {
padding: 0;
margin: 0;
font-size: 100%;
word-break: normal;
white-space: pre;
background: transparent;
border: 0;
}
.markdown-body .highlight {
margin-bottom: 16px;
}
.markdown-body .highlight pre {
margin-bottom: 0;
word-break: normal;
}
.markdown-body .highlight pre,
.markdown-body pre {
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: #f7f7f7;
border-radius: 3px;
}
.markdown-body pre code {
display: inline;
max-width: auto;
padding: 0;
margin: 0;
overflow: visible;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0;
}
.markdown-body pre code::before,
.markdown-body pre code::after {
content: normal;
}
.markdown-body .pl-0 {
padding-left: 0 !important;
}
.markdown-body .pl-1 {
padding-left: 3px !important;
}
.markdown-body .pl-2 {
padding-left: 6px !important;
}
.markdown-body .pl-3 {
padding-left: 12px !important;
}
.markdown-body .pl-4 {
padding-left: 24px !important;
}
.markdown-body .pl-5 {
padding-left: 36px !important;
}
.markdown-body .pl-6 {
padding-left: 48px !important;
}
.markdown-body .full-commit .btn-outline:not(:disabled):hover {
color: #4078c0;
border: 1px solid #4078c0;
}
.markdown-body kbd {
display: inline-block;
padding: 3px 5px;
font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
.markdown-body :checked+.radio-label {
position: relative;
z-index: 1;
border-color: #4078c0;
}
.markdown-body .task-list-item {
list-style-type: none;
}
.markdown-body .task-list-item+.task-list-item {
margin-top: 3px;
}
.markdown-body .task-list-item input {
margin: 0 0.2em 0.25em -1.6em;
vertical-align: middle;
}
.markdown-body hr {
border-bottom-color: #eee;
}

View File

@ -0,0 +1,30 @@
html {
overflow-y: overlay;
}
.default-color{
color: #666!important;
}
.pointer{
cursor: pointer!important;
}
.blue{
color: #419EFF!important;
}
.special-font-blue:hover{
color: #419EFF!important;
}
.white{
color: #fff!important;
}
.text-underline:hover{
text-decoration: underline;
}
.theme-font-blue{
color: #1B94D4;
}
.body-background{
background: #EEFCFE;
}
body{
padding-right:0 !important
}

View File

@ -0,0 +1,436 @@
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS and IE text size adjust after device orientation change,
* without disabling user zoom.
*/
*{
margin: 0;
padding: 0;
border: 0px;
}
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
height: 100%;
}
/**
* Remove default margin.
*/
body {
margin: 0;
height: 100%;
}
/* HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined for any HTML5 element in IE 8/9.
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox.
* Correct `block` display not defined for `main` in IE 11.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block;
}
/**
* 1. Correct `inline-block` display not defined in IE 8/9.
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
*/
audio,
canvas,
progress,
video {
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9/10.
* Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.
*/
[hidden],
template {
display: none;
}
/* Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* Improve readability of focused elements when they are also in an
* active/hover state.
*/
a:active,
a:hover {
outline: 0;
}
/* Text-level semantics
========================================================================== */
/**
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/**
* Address styling not present in Safari and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9/10.
*/
img {
border: 0;
}
/**
* Correct overflow not hidden in IE 9/10/11.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari.
*/
figure {
margin: 1em 40px;
}
/**
* Address differences between Firefox and other browsers.
*/
hr {
box-sizing: content-box;
height: 0;
}
/**
* Contain overflow in all browsers.
*/
pre {
overflow: auto;
}
/**
* Address odd `em`-unit font size rendering in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
/* Forms
========================================================================== */
/**
* Known limitation: by default, Chrome and Safari on OS X allow very limited
* styling of `select`, unless a `border` property is set.
*/
/**
* 1. Correct color not being inherited.
* Known issue: affects color of disabled elements.
* 2. Correct font properties not being inherited.
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
*/
button,
input,
optgroup,
select,
textarea {
color: inherit; /* 1 */
font: inherit; /* 2 */
margin: 0; /* 3 */
}
/**
* Address `overflow` set to `hidden` in IE 8/9/10/11.
*/
button {
overflow: visible;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
* Correct `select` style inheritance in Firefox.
*/
button,
select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
}
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
input {
line-height: normal;
}
/**
* It's recommended that you don't attempt to style these elements.
* Firefox's implementation doesn't respect box-sizing, padding, or width.
*
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
* `font-size` values of the `input`, it causes the cursor style of the
* decrement button to change from `default` to `text`.
*/
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Address `appearance` set to `searchfield` in Safari and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari and Chrome.
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
box-sizing: content-box; /* 2 */
}
/**
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
* Safari (but not Chrome) clips the cancel button when the search input has
* padding (and `textfield` appearance).
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct `color` not being inherited in IE 8/9/10/11.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/**
* Remove default vertical scrollbar in IE 8/9/10/11.
*/
textarea {
overflow: auto;
}
/**
* Don't inherit the `font-weight` (applied by a rule above).
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
*/
optgroup {
font-weight: bold;
}
/* Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}
.clearfix {
overflow: hidden;
_zoom: 1;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,130 @@
// 获取光标位置
function getCursortPosition(textDom) {
var cursorPos = 0;
if (document.selection) {
// IE Support
textDom.focus();
var selectRange = document.selection.createRange();
selectRange.moveStart('character', -textDom.value.length);
cursorPos = selectRange.text.length;
} else if (textDom.selectionStart || textDom.selectionStart == '0') {
// Firefox support
cursorPos = textDom.selectionStart;
}
return cursorPos;
}
// 设置光标位置
function setCaretPosition(textDom, pos) {
if (textDom.setSelectionRange) {
// IE Support
textDom.focus();
textDom.setSelectionRange(pos, pos);
} else if (textDom.createTextRange) {
// Firefox support
var range = textDom.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
}
// 获取选中文字
function getSelectText() {
var userSelection, text;
if (window.getSelection) {
// Firefox support
userSelection = window.getSelection();
} else if (document.selection) {
// IE Support
userSelection = document.selection.createRange();
}
if (!(text = userSelection.text)) {
text = userSelection;
}
return text;
}
/**
* 选中特定范围的文本
* 参数
* textDom [JavaScript DOM String] 当前对象
* startPos [Int] 起始位置
* endPos [Int] 终点位置
*/
function setSelectText(textDom, startPos, endPos) {
var startPos = parseInt(startPos),
endPos = parseInt(endPos),
textLength = textDom.value.length;
if (textLength) {
if (!startPos) {
startPos = 0;
}
if (!endPos) {
endPos = textLength;
}
if (startPos > textLength) {
startPos = textLength;
}
if (endPos > textLength) {
endPos = textLength;
}
if (startPos < 0) {
startPos = textLength + startPos;
}
if (endPos < 0) {
endPos = textLength + endPos;
}
if (textDom.createTextRange) {
// IE Support
var range = textDom.createTextRange();
range.moveStart("character", -textLength);
range.moveEnd("character", -textLength);
range.moveStart("character", startPos);
range.moveEnd("character", endPos);
range.select();
} else {
// Firefox support
textDom.setSelectionRange(startPos, endPos);
textDom.focus();
}
}
}
/**
* 在光标后插入文本
* 参数
* textDom [JavaScript DOM String] 当前对象
* value [String] 要插入的文本
*/
function insertAfterText(textDom, value) {
var selectRange;
if (document.selection) {
// IE Support
textDom.focus();
selectRange = document.selection.createRange();
selectRange.text = value;
textDom.focus();
} else if (textDom.selectionStart || textDom.selectionStart == '0') {
// Firefox support
var startPos = textDom.selectionStart;
var endPos = textDom.selectionEnd;
var scrollTop = textDom.scrollTop;
textDom.value = textDom.value.substring(0, startPos) + value + textDom.value.substring(endPos, textDom.value.length);
textDom.focus();
textDom.selectionStart = startPos + value.length;
textDom.selectionEnd = startPos + value.length;
textDom.scrollTop = scrollTop;
} else {
textDom.value += value;
textDom.focus();
}
}
module.exports = {
getCursortPosition,
setCaretPosition,
getSelectText,
setSelectText,
insertAfterText
};

View File

@ -0,0 +1,369 @@
<template>
<el-container>
<el-main>
<div class="content">
<div class="header">
<h1>{{all.title}}</h1>
<span>作者</span>
<span class="blue pointer authorspan">{{all.author_name}}</span>
<span>发布时间:{{all.creat_time}}</span>
<div class="label">
<span>文章标签:</span>
<span class="special-text-yellow blue">{{all.label}}</span>
</div>
</div>
<div class="middle">
<div class="editorContainer">
<markdown
:mdValuesP="msg.mdValue"
:fullPageStatusP="false"
:editStatusP="true"
:previewStatusP="true"
:navStatusP="true"
:icoStatusP="true"
@childevent="childEventHandler"
ref="markdown"
></markdown>
</div>
</div>
<div class="footer">
<el-row>
<el-button type="primary" icon="el-icon-thumb" plain>点赞</el-button>
<el-button type="primary" icon="el-icon-share" plain>分享</el-button>
</el-row>
</div>
</div>
<div class="comment-area">
<el-button class="message" type="primary" @click="messages">留言</el-button>
<div class="comment-list">
<div class="comment-one" v-for="item in message">
<div class="comment-header">
<div class="header-photo">{{item.header_photo}}</div>
<div class="name">{{item.real_name}}</div>
<div class="time">{{item.create_time}}</div>
</div>
<div class="comment-content">{{item.content}}</div>
<hr>
</div>
</div>
</div>
</el-main>
<el-aside>
<div class="person-info">
<div class="info">
<div class="name">
<div class="header-photo">{{all.header_photo}}</div>
<div class="username">{{all.author_name}}</div>
<div class="go-homepage pointer">TA的个人主页 ></div>
</div>
<div class="grades">
<div class="grade">
<span>等级:</span>
<div class="number">
<span>博客</span>
<span>2</span>
</div>
</div>
<div class="integral">
<span>积分: </span>
<span>{{all.integral}}</span>
</div>
</div>
</div>
<hr>
<div class="operation">
<el-button type="primary" plain> </el-button>
<el-button type="primary" plain>私信</el-button>
</div>
</div>
<footers></footers>
</el-aside>
</el-container>
</template>
<script>
import footers from './components/Footer'
import markdown from "./components/Mdeditor";
export default {
name: "Content",
data() {
return {
all: "",
message: '',
id:'',
msgShow:'我要显示的内容',
dilogStatus:false,
msg: {
mdValue:''
},
flag:false,
}
},
created() {
},
mounted() {
this.$ajax.post("/hs/getOneContent", {
id: sessionStorage.getItem("noticeId")
}, r => {
this.all = r.content;
this.message = r.message;
this.msg.mdValue = r.content.content;
this.all.header_photo = this.all.author_name.substring(0, 1)
for (let i = 0; i < this.message.length; i++) {
this.message[i].header_photo = this.message[i].real_name.substring(0, 1)
}
setTimeout(()=>{this.$refs.markdown.addLine()},1)
})
},
methods: {
messages() {
this.$prompt('请输入留言', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
inputErrorMessage: '邮箱格式不正确'
}).then(({ value }) => {
let day2 = new Date();
day2.setTime(day2.getTime());
let date = day2.getFullYear()+"-" + (day2.getMonth()+1) + "-" + day2.getDate()+" "+day2.getHours()+"-"+day2.getMinutes()
this.$ajax.post("/hs/addMessage",{noticeId:sessionStorage.getItem("noticeId"),content:value,
createTime:date,userId:JSON.parse(sessionStorage.getItem("userInfo")).user_id},r=>{
if (r == "1") {
this.$message({
type: 'success',
message: '留言成功'
});
this.$ajax.post("/hs/getOneContent", {
id: sessionStorage.getItem("noticeId")
}, r => {this.message = r.message;})
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消输入'
});
});
},
childEventHandler:function(res){
// resdata,mdValuehtmlValue
this.msg=res;
},
closeMaskFn:function(){
this.msgShow='';
this.dilogStatus=false;
},
handleChange(val) {
console.log(val);
},
},
components: {
footers,
markdown
},
}
</script>
<style lang="scss" scoped>
.message{
margin: 1rem 1rem 0 0;
float: right;
}
.mdContainer >>> .editContainer,.mdContainer >>> .navContainer{
display: none!important;
}
.list{
.title{
padding-left: 1rem;
height: 3rem;
line-height: 3rem;
background: #999;
color: #fff;
}
background: #fff;
ul{
margin: 0;
list-style: none;
li{
padding: 0.5rem 0;
}
}
}
.aside-right{
margin-left: 1rem;
}
.authorspan{
/*float: right;*/
/*margin-left: 2.5rem;*/
}
.navContainer{
display: none!important;
}
.comment-content{
margin: 0.5rem 0 0 2rem;
}
.reply{
display: inline-block;
float: right;
font-size: 0.9rem;
line-height: 1.5rem;
}
.comment-one{
padding: 1rem 1rem 0 1rem;
}
.comment-header{
display: flex;
}
.comment-header .name{
font-weight: bold;
}
.comment-header .name, .comment-header .time{
line-height: 1.5rem;
}
.comment-one div{
margin-right: 0.5rem;
}
.comment-one .header-photo{
height: 1.5rem;
width: 1.5rem;
line-height: 1.5rem;
font-weight: bold;
border-radius: 50%;
background: #3399ea;
color: #fff;
text-align: center;
float: left;
font-size: 1rem;
}
.comment-area{
margin-top: 1rem;
background: #fff;
min-height: 4.5rem;
}
.achievement{
font-size: 0.9rem;
margin-left: 3.5rem;
margin-top: 0.5rem;
}
.content .middle{
margin: 1rem 0;
}
.type span:nth-child(2){
background: #F5F6F7;
font-size: 0.9rem;
}
.label span:nth-child(n+2){
background: #F5F6F7;
font-size: 0.9rem;
}
.original1{
position: absolute;
color: #ca0c16;
background: #f9ecec;
font-size: 0.9rem;
margin-right: 1rem;
}
.reprint{
color: #74cf59;
background: #eaf9e3;
font-size: 0.9rem;
margin-right: 1rem;
}
.header span:nth-child(-n+4){
margin-right: 0.5rem;
}
.content{
padding: 1rem;
background: #fff;
}
.content .header .label{
margin-top: 0.5rem;
}
.operation .el-button:nth-child(1){
margin-left: 2rem;
}
.operation .el-button:nth-child(2){
margin-right: 2rem;
float: right;
}
.integral span:nth-child(2).ranking span:nth-child(2){
font-weight: bold;
}
.number{
font-size: 0.8rem;
color: #fff;
border-radius: 5px;
position: absolute;
margin-left: 2.6rem;
margin-top: -1.1rem!important;
}
.number span:nth-child(1){
background: #9DC75F;
float: left;
}
.number span:nth-child(2){
background: #2D5315;
float: left;
min-width: 1rem;
text-align: center;
}
.grades{
margin-top: 1rem;
}
.grades div{
margin-top: 0.5rem;
}
.read{
margin: 0.5rem 0;
}
.read div{
flex: 1;
text-align: center;
width: 20%;
}
.read div p:nth-child(2){
overflow: hidden;
text-overflow: ellipsis;
font-weight: bold;
}
.person-info{
background: #fff;
padding: 1rem;
}
.username{
margin-left: 3.5rem;
font-size: 0.9rem;
}
.go-homepage{
font-size: 0.9rem;
color: #3399ea;
margin-left: 3.5rem;
margin-top: 0.5rem;
}
.header-photo{
height: 3rem;
width: 3rem;
line-height: 3rem;
font-weight: bold;
border-radius: 50%;
background: #3399ea;
color: #fff;
text-align: center;
float: left;
font-size: 1.5rem;
margin-right: 2rem;
}
.el-container{
padding: 0;
}
.el-aside{
/*margin-top: 1rem;*/
}
.el-main{
padding: 0;
margin-right: 1rem;
}
.read{
display: flex;
}
</style>

View File

@ -0,0 +1,60 @@
<template>
<el-main class="body-background">
<div class="left">
<div class="top">
<img src="../assets/img/left-1.gif" height="83" width="142"/>
</div>
<div class="bottom">
<el-menu
default-active="2"
class="el-menu-vertical-demo">
<el-menu-item index="1">首页</el-menu-item>
<el-menu-item index="2">校园通知</el-menu-item>
<el-menu-item index="3">家长意见</el-menu-item>
<el-menu-item index="4">学生想法</el-menu-item>
<el-menu-item index="5">我的班级</el-menu-item>
<el-menu-item index="6">常见问题</el-menu-item>
</el-menu>
</div>
</div>
<div class="right">
<div>请联系管理员更新内容</div>
<div>管理员联系方式15006732580</div>
<div>管理员QQ邮箱617594538@qq.com</div>
</div>
</el-main>
</template>
<script>
export default {
name: "Help"
}
</script>
<style scoped>
.right{
border: 1px solid #419EFF;
border-radius: 5px;
background: #fff;
width: calc(85% - 1rem);
margin-left: 1rem;
padding: 1rem;
}
.el-menu-item{
text-align: center;
}
.left{
border: 1px solid #419EFF;
border-radius: 5px;
background: #fff;
width: 15%;
}
.left img{
display: block;
margin: 0 auto;
}
.el-main{
padding: 1rem 0;
display: flex;
}
</style>

View File

@ -1,9 +1,377 @@
<template>
<p>hhh</p>
<el-container>
<div id="top">
<div class="school-dynamic">
<div id="title">
<br><br><br>
</div>
<el-carousel indicator-position="outside">
<el-carousel-item>
<img src="../assets/img/carousel/carousel1.jpg" height="100%" width="100%"/>
</el-carousel-item>
<el-carousel-item>
<img src="../assets/img/carousel/carousel2.jpg" height="100%" width="100%"/>
</el-carousel-item>
<el-carousel-item>
<img src="../assets/img/carousel/carousel3.jpg" height="100%" width="100%"/>
</el-carousel-item>
<el-carousel-item>
<img src="../assets/img/carousel/carousel4.jpg" height="100%" width="100%"/>
</el-carousel-item>
</el-carousel>
</div>
</div>
<div id="bottom">
<div class="left">
<el-tabs v-model="activeName" @tab-click="">
<el-tab-pane label="校园通知" name="first">
<div class="newest-notice module">
<div class="title">
<i class="el-icon-chat-dot-square"></i>
</div>
<div class="content">
<div class="one theme-font-blue" v-for="item in newestNotice" :data-id="item.id" >
<div class="type">
[{{item.label}}]
</div>
<div class="text" @click="getContent(item.id)">{{item.title}}</div>
<div class="release">{{item.real_name}}</div>
<div class="release-time">{{item.release_time}}</div>
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="家长意见" name="second">
<div class="good-advice module">
<div class="title">
<i class="el-icon-chat-line-square"></i>
</div>
<div class="content">
<div class="one theme-font-blue" v-for="item in goodAdvice" :data-id="item.id">
<div class="type">
[{{item.label}}]
</div>
<div class="text">{{item.title}}</div>
<div class="release">{{item.real_name}}</div>
<div class="release-time">{{item.release_time}}</div>
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="学生想法" name="third">
<div class="magical-thinking module">
<div class="title">
<i class="el-icon-chat-square"></i>
</div>
<div class="content">
<div class="one theme-font-blue" v-for="item in magicalThinking" :data-id="item.id">
<div class="type">
[{{item.label}}]
</div>
<div class="text">{{item.title}}</div>
<div class="release">{{item.real_name}}</div>
<div class="release-time">{{item.release_time}}</div>
</div>
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
<div class="right">
<div class="prominent-teacher">
<div class="header">
<i class="el-icon-trophy"></i>
</div>
<div class="one" v-for="item in prominentTeacher">
<div class="name theme-font-blue">{{item.name}}老师</div>
<!-- <div class="subject theme-font-blue">数学</div>-->
<!-- <div class="grade theme-font-blue">2016</div>-->
<div class="class theme-font-blue">{{item.class}}</div>
</div>
</div>
<div class="merit-student">
<div class="header">
<i class="el-icon-trophy-1"></i>
</div>
<div class="one" v-for="item in meritStudent">
<div class="name theme-font-blue">{{item.name}}同学</div>
<!-- <div class="grade theme-font-blue">2016</div>-->
<div class="subject theme-font-blue">{{item.class}}</div>
</div>
</div>
</div>
</div>
</el-container>
</template>
<script>
export default {
name: "Hompage",
data() {
return{
newestNotice: '',
goodAdvice: '',
magicalThinking: '',
activeName: 'first',
prominentTeacher: [
{
id: '',
name: '张伟',
class: '2016届物联网一班',
},
{
id: '',
name: '吕小布',
class: '2016届物联网二班',
},
{
id: '',
name: '李星',
class: '大数据一班',
},
{
id: '',
name: '吴达',
class: '软件外包一班',
},
{
id: '',
name: '田七',
class: '机算计科学与技术一班',
},
],
meritStudent: [
{
id: '',
name: '王阔',
class: '2016届物联网一班',
},
{
id: '',
name: '于洋',
class: '2016届生物医学1班',
},
{
id: '',
name: '冯宇',
class: '2016届大数据一班',
},
{
id: '',
name: '刘强',
class: '2016届软件外包一班',
},
{
id: '',
name: '张智超',
class: '2016届护理一班',
},
],
}
},
mounted() {
this.$ajax.post("/hs/getAllContent",{},r=>{
this.newestNotice = r.schoolNoticeList.slice(0,12);
this.goodAdvice = r.parentAdvice.slice(0,12);
this.magicalThinking = r.studentThinking.slice(0,12);
})
},
methods: {
getContent(id) {
this.$router.push({name: 'content'});
sessionStorage.setItem("noticeId",id);
}
}
}
</script>
<style>
<style scoped>
.release-time{
color: #999;
text-decoration: none;
cursor: default;
}
#top{
background: #fff;
border-radius: 5px;
padding-bottom: 4rem;
}
#bottom{
display: flex;
background: #fff;
margin-top: 1rem;
border-radius: 5px;
padding: 0 0 0 1rem;
}
#title{
border-left: 1px solid #419EFF;
cursor: default;
}
.merit-student, .prominent-teacher{
font-size: 0.9rem;
}
.merit-student{
border: 1px solid #419EFF;
border-radius: 5px;
background: #fff;
margin-top: 1rem;
width: 100%;
height: 9.5rem;
}
.merit-student .header{
cursor: default;
height: 2rem;
line-height: 2rem;
padding: 0 1rem;
font-weight: bold;
color: #1B94D4;
background: url("../assets/img/title-background.jpg");
}
.merit-student .one{
display: flex;
height: 1.5rem;
line-height: 1.5rem;
padding: 0 2rem;
}
.merit-student .one div:nth-child(1){
flex: 2;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
.merit-student .one div:nth-child(2){
flex: 3;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
.prominent-teacher .one{
display: flex;
height: 1.5rem;
line-height: 1.5rem;
padding: 0 2rem;
}
.prominent-teacher .one .subject{
flex: 1!important;
}
.prominent-teacher .one div:nth-child(1){
flex: 2;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
.prominent-teacher .one div:nth-child(2){
flex: 3;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
.prominent-teacher{
margin-top: 2.4rem;
border: 1px solid #419EFF;
border-radius: 5px;
background: #fff;
width: 100%;
height: 9.5rem;
}
.prominent-teacher .header{
cursor: default;
height: 2rem;
line-height: 2rem;
padding: 0 1rem;
font-weight: bold;
color: #1B94D4;
background: url("../assets/img/title-background.jpg");
}
.left{
width: 70%;
}
.right{
width: 30%;
padding: 1rem;
}
.one div{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
.one div:hover{
text-decoration: underline;
}
.content .one{
display: flex;
padding: 0 1rem;
font-size: 0.9rem;
height: 1.5rem;
line-height: 1.5rem;
}
.one .type{
flex: 1;
}
.one .text{
flex: 4;
}
.one .release{
flex: 1;
}
.one .release-time{
flex: 1;
}
.module{
border: 1px solid #419EFF;
border-radius: 5px;
background: #fff;
width: calc(100% - 1rem);
height: 20.2rem;
}
.module .title{
cursor: default;
height: 2rem;
line-height: 2rem;
padding: 0 1rem;
font-weight: bold;
color: #1B94D4;
background: url("../assets/img/title-background.jpg");
}
.school-dynamic{
display: flex;
width: 80%;
padding: 0 10%;
height: 24rem;
}
#title{
color: #419EFF;
padding: 1rem;
font-size: 1.5rem;
font-family: 楷体;
}
.el-carousel >>> .el-carousel__container{
height: 90% !important;
}
.el-carousel >>> .el-carousel__indicators{
height: 10%!important;
}
.el-carousel{
margin-top: 1rem;
padding: 1rem;
width: calc(100% - 3.5rem);
height: 100%;
border: 1px solid #419EFF;
border-radius: 5px;
background: #fff;
}
.el-container{
/*padding: 0 20%;*/
background: #EEFCFE;
display: block;
}
</style>

View File

@ -0,0 +1,207 @@
<template>
<el-container>
<el-header>
<div id="header">
<div class="date default-color">{{date}}</div>
<div class="function">
<span class="pointer special-font-blue " v-if="!isLogin" @click="login">登录</span>
<span class="pointer special-font-blue " v-if="isLogin">欢迎{{userInfo.real_name}}{{userInfo.user_type}}</span>
<span class="pointer special-font-blue " v-if="isLogin" @click="cancellation">注销</span>
<el-divider direction="vertical"></el-divider>
<span class="pointer special-font-blue" @click="service">客服中心</span>
<el-divider direction="vertical"></el-divider>
<span class="pointer special-font-blue" @click="opinion">用户意见</span>
<el-divider direction="vertical"></el-divider>
<span class="pointer special-font-blue" v-if="!isLogin" @click="register">免费注册</span>
<el-divider direction="vertical" v-if="!isLogin"></el-divider>
<span class="pointer special-font-blue" v-if="isLogin" @click="forget">忘记密码</span>
<el-divider direction="vertical" v-if="isLogin"></el-divider>
<span class="pointer special-font-blue" @click="help">帮助中心</span>
</div>
</div>
</el-header>
<el-container class="second">
<el-aside>
<el-menu
default-active="1"
class="el-menu-vertical-demo">
<el-menu-item index="1" @click="goHomepage">首页</el-menu-item>
<el-menu-item index="2" @click="goSchoolNotice">校园通知</el-menu-item>
<el-menu-item index="3" @click="goMyClass">我的班级</el-menu-item>
<el-menu-item index="4" @click="goParentsOpinion">家长意见</el-menu-item>
<el-menu-item index="5" @click="goStudentThought">学生想法</el-menu-item>
<el-menu-item index="6" @click="goMore">更多···</el-menu-item>
</el-menu>
</el-aside>
<el-main>
<!--<div id="tab">
<span class="pointer white text-underline" @click="goHomepage">首页</span>
<el-divider direction="vertical"></el-divider>
<span class="pointer white text-underline" @click="goSchoolNotice">校园通知</span>
<el-divider direction="vertical"></el-divider>
<span class="pointer white text-underline" @click="goParentsOpinion">家长建议</span>
<el-divider direction="vertical"></el-divider>
<span class="pointer white text-underline" @click="goStudentThought">学生想法</span>
<el-divider direction="vertical"></el-divider>
<span class="pointer white text-underline" @click="goMyClass">我的班级</span>
<el-divider direction="vertical"></el-divider>
<span class="pointer white text-underline" @click="goMore">更多···</span>
<span class="pointer white text-underline user-info" v-if="!isLogin" @click="login">登录</span>
<span class="pointer white text-underline user-cancellation" v-if="isLogin" @click="cancellation">注销</span>
<span class="pointer white text-underline user-info" v-if="isLogin">欢迎{{userInfo.real_name}}{{userInfo.user_type}}</span>
</div>-->
<router-view></router-view>
</el-main>
</el-container>
</el-container>
</template>
<script>
export default {
data() {
return{
isCollapse: true,
isLogin: false,
date: '',
userInfo: '',
}
},
mounted() {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
this.userInfo = userInfo;
if (userInfo != '' || userInfo != null) {
this.isLogin = true;
}
setInterval(()=>{
let day2 = new Date();
day2.setTime(day2.getTime());
this.date = day2.getFullYear()+"年" + (day2.getMonth()+1) + "月" + day2.getDate()+'日 星期'+"日一二三四五六".charAt(new Date().getDay())
+" | "+day2.getHours()+"时"+day2.getMinutes()+"分"+day2.getSeconds()+"秒";},1000)
},
methods:{
goMore() {
this.$message({
message:"期待更多内容",
})
},
goMyClass() {
this.$router.push({name: "myclass"})
},
goStudentThought() {
this.$router.push({name: "studentthought"})
},
goParentsOpinion() {
this.$router.push({name: "parentsproposal"})
},
goSchoolNotice() {
this.$router.push({name: "schoolnotice"})
},
goHomepage() {
this.$router.push({name: "homepage"})
},
help() {
this.$router.push({
name: "help",
})
},
forget() {
this.$message("请联系管理员重置密码")
},
register() {
this.$router.push({
name: "homepage",
params: {
type: "register"
}
})
},
opinion() {
this.$message('用户意见请发邮箱至617594538@qq.com')
},
service() {
this.$message('客服中心请拨打15006732580')
},
login() {
this.$router.push({
name: "login"
})
},
cancellation() {
this.$confirm('确认退出?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
sessionStorage.setItem("userInfo","");
this.$router.push({
name: "login"
})
// location.reload()
}).catch(() => {
this.$message({
type: 'info',
message: '已取消退出'
});
});
}
},
}
</script>
<style scoped>
.el-menu{
border-radius: 5px;
}
.el-aside{
background: #FFF;
overflow-x: hidden;
width: 10rem!important;
margin-top: 1rem;
text-align: center;
}
.el-radio-group{
margin-bottom: 0!important;
}
.second{
background: #EEFCFE;
padding: 0 20%;
}
.user-cancellation{
float: right;
}
.user-info{
float: right;
margin-right: 1rem;
}
.el-main{
padding: 1rem;
}
#tab{
background-image: url("../assets/img/dh-002.gif");
padding: 0 20%;
height: 2rem;
font-size: 0.9rem;
line-height: 2rem;
}
#header{
font-size: 0.9rem;
padding: 0.2rem 0 0.4rem 0;
}
#header .date{
margin-left: 20%;
float: left;
}
#header .function{
float: right;
margin-right: 20%;
}
.el-header{
height: 7.8rem!important;
background-image: url("../assets/img/title.jpg");
background-size: 100%;
background-position: 0 2rem;
background-repeat: no-repeat;
}
</style>

View File

@ -1,33 +1,300 @@
<template>
<div id="login">
<el-span>账号</el-span>
<el-col :span="8">
<el-input placeholder = "请输入用户名"></el-input>
</el-col>
<el-span>密码</el-span>
<el-col :span="8">
<el-input placeholder = "请输入密码" show-password></el-input>
</el-col>
<el-button type = "text">登录</el-button>
<router-view/>
<el-container>
<el-main>
<div class="login-box" v-loading="loading">
<el-tabs type="border-card" v-model="defaultTabs">
<el-tab-pane name="login">
<span slot="label"><i class="el-icon-user"></i> 登录</span>
<el-form :model="form"
:rules="rules"
ref="form"
label-width="80px"
class="demo-ruleForm"
close-on-click-modal=false
label-position="left">
<el-form-item label="角色" prop="role">
<el-select v-model="form.role" placeholder="请选择">
<el-option value="学生"></el-option>
<el-option value="家长"></el-option>
<el-option value="教师"></el-option>
</el-select>
</el-form-item>
<el-form-item label="账号" prop="username">
<el-select
v-if="isSelect"
v-model="form.username"
filterable
allow-create
default-first-option
placeholder="请输入手机号或姓名"
@change="selectUsername">
<el-option
v-for="(item,index) in rememberList"
:key="item.username"
:label="item.username"
:value="item.username">
<span style="float: left">{{ item.username}}</span>
<span style="float: right; color: #8492a6; font-size: 13px" @click="deleteUser(item.username,index)"><i class="el-icon-circle-close"></i></span>
</el-option>
</el-select>
<!-- <el-input v-model="form.username" type="text" placeholder="请输入手机号或姓名"></el-input>-->
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="form.password" type="password" placeholder="请输入密码" @keyup.enter.native="login"></el-input>
</el-form-item>
</el-form>
<div id="forget" @click="forget">忘记密码</div>
<el-checkbox class="remember-password" v-model="rememberPassword">记住密码</el-checkbox>
<el-button type="primary" @click="login"> </el-button>
</el-tab-pane>
<el-tab-pane name="register">
<span slot="label"><i class="el-icon-circle-plus-outline"></i>注册</span>
<el-form :model="form1"
:rules="rules1"
ref="form1"
label-width="80px"
class="demo-ruleForm"
close-on-click-modal=false
label-position="left">
<el-form-item label="角色" prop="role">
<el-select v-model="form1.role" placeholder="请选择">
<!-- <el-option value="学生"></el-option>-->
<el-option value="家长"></el-option>
<el-option value="教师"></el-option>
</el-select>
</el-form-item>
<el-form-item label="姓名" prop="realName">
<el-input v-model="form1.realName" type="text"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="form1.mobile" type="text"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="form1.password" type="password"></el-input>
</el-form-item>
<el-form-item label="确认密码" prop="againPassword" @keyup.enter.native="register">
<el-input v-model="form1.againPassword" type="password"></el-input>
</el-form-item>
<el-button type="primary" @click="register"> </el-button>
</el-form>
</el-tab-pane>
</el-tabs>
</div>
</el-main>
</el-container>
</template>
<script>
export default{
data() {
let againPassword = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.form1.password) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
}
let type;
if (this.$route.params.type == "login" || this.$route.params.type == "register") {
type = this.$route.params.type
} else {
type = "login"
}
return{
isSelect: true,
rememberList: JSON.parse(sessionStorage.getItem("rememberList")),
rememberPassword: false,
defaultTabs: type,
loading: false,
form: {
role: '',
username: '',
password: '',
},
rules: {
role: [
{ required: true, message: '请选择身份', trigger: 'blur' },
{ min: 2, max: 2, message: '请选择身份', trigger: 'blur' }
],
username: [
{ required: true, message: '请输入用户名', trigger: 'blur' },
{ min: 6, max: 11, message: '长度在 6 到 11 个字符', trigger: 'blur' }
],
password: [
{ required: true, message: '请输入密码', trigger: 'blur' },
{ min: 6, max: 8, message: '长度在 6 到 8 个字符', trigger: 'blur' }
],
},
form1: {
role: '',
realName: '',
mobile: '',
username: '',
password: '',
againPassword: '',
},
rules1: {
role: [
{ required: true, message: '请选择身份', trigger: 'blur' },
{ min: 2, max: 2, message: '请选择身份', trigger: 'blur' }
],
realName: [
{ required: true, message: '请输入真实姓名', trigger: 'blur' },
{ min: 2, max: 10, message: '请输入正确的姓名', trigger: 'blur' }
],
mobile: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{ min: 11, max: 11, message: '手机号格式不正确', trigger: 'blur' }
],
password: [
{ required: true, message: '请输入密码', trigger: 'blur' },
{ min: 6, max: 8, message: '长度在 6 到 8 个字符', trigger: 'blur' }
],
againPassword: [
{ required: true, message: '请确认密码', trigger: 'blur' },
{ validator:againPassword, trigger: 'blur'},
],
}
}
},
mounted() {
},
methods:{
change() {
// console.log(1)
// this.$router.push({
// name: 'box1',
// params:{
// id:1
// }
// })
deleteUser(username,index) {
if (this.rememberList != null) {
this.rememberList.forEach((item)=>{
if (item.username == username) {
this.rememberList.splice(index,1);
}
})
}
sessionStorage.setItem("rememberList",JSON.stringify(this.rememberList));
this.form.role = '';
this.form.password = '';
setTimeout(()=>{
this.form.username = '';
},10)
console.log(this.form.username)
},
selectUsername(event) {
if (this.rememberList != null) {
this.rememberList.forEach((item)=>{
if (item.username == event) {
this.form = item
}
})
}
this.isSelect = false
this.isSelect = true
},
forget() {
this.$message("请联系管理员重置密码")
},
login() {
this.loading = true;
this.$ajax.post("/hs/login",{role:this.form.role,username: this.form.username,password:this.form.password},r=>{
if (r == '' || r == null) {
this.$message.error('用户名和密码不匹配');
this.loading = false;
} else {
this.$message({
message: "登录成功",
type: "success"
});
if (this.rememberPassword == true) {
let one = {
role: this.form.role,
username: this.form.username,
password: this.form.password,
}
if (this.rememberList != null) {
let flag = false;
this.rememberList.forEach((item)=>{
if (item.username == one.username) {
flag = true;
}
})
if (flag == false) {
this.rememberList.push(one)
sessionStorage.setItem("rememberList",JSON.stringify(this.rememberList));
}
} else {
let rememberList = [];
rememberList.push(one)
sessionStorage.setItem("rememberList",JSON.stringify(rememberList));
}
}
this.loading = false;
this.$router.push({
name: "homepage"
})
sessionStorage.setItem("userInfo",JSON.stringify(r));
// location.reload();
}
})
},
register() {
this.$ajax.post("/hs/register",{type:this.form1.role,realname:this.form1.realName,mobile:this.form1.mobile,password:this.form1.password},r=>{
console.log(r)
if (r == '0') {
this.$message.error('该手机号已被注册');
this.form1.password = '';
this.form1.againPassword = '';
} else {
this.$message({
message: "注册成功",
type: "success"
});
this.form.role = this.form1.role;
this.form.username = this.form1.realName;
this.form.password = this.form1.password;
this.form1.role = '';
this.form1.realName = '';
this.form1.mobile = '';
this.form1.password = '';
this.form1.againPassword = '';
this.defaultTabs = 'login';
}
})
}
},
}
</script>
<style>
<style scoped>
.remember-password{
float: right;
margin-right: 1rem;
}
#forget{
font-size: 0.9rem;
float: right;
cursor: pointer;
margin-right: 1rem;
}
#forget:hover{
text-decoration: underline;
color: #419EFF;
}
.login-box{
width: 30rem;
/*height: 20rem;*/
margin: 8rem auto;
/*color: #FAFAFA;*/
/*border-radius: 5px;*/
/*border: 1px solid #419EFF;*/
/*padding: 2rem;*/
}
.el-button--primary{
width: 6rem;
margin-left: 11rem;
margin-top: 2rem;
}
.el-main{
background: #EEFCFE;
height: 55rem;
}
</style>

View File

@ -0,0 +1,19 @@
<template>
<el-main>
<h1>我的班级</h1>
</el-main>
</template>
<script>
export default {
name: "MyClass"
}
</script>
<style scoped>
.el-main{
padding: 0;
background: #EEFCFE;
}
</style>

View File

@ -0,0 +1,19 @@
<template>
<el-main>
<h1>家长意见</h1>
</el-main>
</template>
<script>
export default {
name: "ParentsOpinion"
}
</script>
<style scoped>
.el-main{
padding: 0;
background: #EEFCFE;
}
</style>

View File

@ -0,0 +1,61 @@
<template>
<el-main>
<div class="search">
<el-input class="searchinp" v-model="condition" placeholder="请输入内容"></el-input>
<el-button type="primary" class="searchbtn">搜索</el-button>
</div>
<el-calendar>
<!-- 这里使用的是 2.5 slot 语法对于新项目请使用 2.6 slot 语法-->
<template
slot="dateCell"
slot-scope="{date, data}">
<p :class="data.isSelected ? 'is-selected' : ''">
{{ data.day.split('-').slice(1).join('-') }} {{ data.isSelected ? '✔️' : ''}}
</p>
</template>
</el-calendar>
</el-main>
</template>
<script>
export default {
name: "Home",
data() {
return{
condition: '',
}
},
}
</script>
<style scoped>
.search{
margin: 0 0 3rem 0;
}
.el-main{
padding: 0;
}
.searchinp{
float: left;
width: calc(100% - 6rem);
}
.searchbtn{
float: left;
width: 6rem;
}
.el-calendar{
margin: 0;
}
.el-calendar__body{
background: #fff;
}
.el-container{
background: #EEFCFE;
height: 45rem;
}
.is-selected {
color: #1989FA;
}
</style>

View File

@ -0,0 +1,17 @@
<template>
<el-main>
<h1>学生想法</h1>
</el-main>
</template>
<script>
export default {
name: "StudentThought"
}
</script>
<style scoped>
.el-main{
padding: 0;
}
</style>

View File

@ -0,0 +1,74 @@
<template>
<div class="container">
<el-main>
<div class="list">
<div class="one">
<img src="../../assets/img/qq.png" />
<span>QQ客服</span>
</div>
<div class="one">
<i class="el-icon-s-promotion"></i>
<span>{{emil}}</span>
</div>
<div class="one">
<i class="el-icon-s-home"></i>
<span>客服论坛</span>
</div>
<div class="one">
<i class="el-icon-phone"></i>
<span>150-0673-2580</span>
</div>
<p>工作时间 8:30-22:00</p>
<a class="beian" rel="nofollow" href="http://www.beian.miit.gov.cn" target="_blank"><p>备案号鲁ICP备19037910号-1</p></a>
</div>
</el-main>
</div>
</template>
<script>
export default {
name: "Footer",
data() {
return{
emil: "617594538@qq.com"
}
}
}
</script>
<style scoped>
.container{
padding: 0;
margin-top: 1rem;
}
.el-main{
background: #fff;
}
.list p{
color: #8590A6;
}
.one{
height: 2rem;
color: #8590A6;
cursor: pointer;
}
.one img{
margin-top: 0.5rem;
height: 1rem;
width: 1rem;
}
.one i{
margin-top: 0.5rem;
}
.one span{
position: absolute;
margin-top: 0.3rem;
margin-left: 0.5rem;
}
.beian{
text-decoration: none;
}
.beian p{
font-size: 0.9rem;
}
</style>

View File

@ -0,0 +1,390 @@
<template>
<div class="mdContainer" :class="{ fullPage: fullPageStatus }">
<div class="navContainer" v-if="navStatus">
<!--<div class="nameContainer" v-if="icoStatusP" @click="happyDay">OVEN-mdEditor</div>-->
<div class="markContainer">
<ul class="markListGroup">
<li class="markListItem" @click="addStrong" title="strong"><b>B</b></li>
<li class="markListItem" @click="addItalic" title="italic"><i>I</i></li>
<li class="markListItem" @click="addStrikethrough" title="strikethrough"><i class="fa fa-strikethrough" aria-hidden="true"></i></li>
<li class="markListItem" @click="addHTitle(1)" title="H1-title">H1</li>
<li class="markListItem" @click="addHTitle(2)" title="H2-title">H2</li>
<li class="markListItem" @click="addHTitle(3)" title="H3-title">H3</li>
<li class="markListItem" @click="addHTitle(4)" title="H4-title">H4</li>
<li class="markListItem" @click="addHTitle(5)" title="H5-title">H5</li>
<li class="markListItem" @click="addHTitle(6)" title="H6-title">H6</li>
<li class="markListItem" @click="addLine" title="line"></li>
<li class="markListItem" @click="addQuote" title="quote"><i class="fa fa-quote-left" aria-hidden="true"></i></li>
<li class="markListItem" @click="addCode"><i class="fa fa-code" aria-hidden="true"></i></li>
<li class="markListItem" @click="addLink"><i class="fa fa-link" aria-hidden="true"></i></li>
<li class="markListItem" @click="addImage"><i class="fa fa-picture-o" aria-hidden="true"></i></li>
<li class="markListItem" @click="addTable" title="table"><i class="fa fa-table" aria-hidden="true"></i></li>
<li class="markListItem" @click="addUl" title="ul-list"><i class="fa fa-list-ul" aria-hidden="true"></i></li>
<li class="markListItem" @click="addOl" title="ol-list"><i class="fa fa-list-ol" aria-hidden="true"></i></li>
<li class="markListItem" @click="fullPageFn" title="fullpage"><i class="fa fa-arrows-alt" aria-hidden="true"></i></li>
<li class="markListItem" @click="previewFn" title="preview"><i class="fa fa-eye-slash" aria-hidden="true"></i></li>
<li class="markListItem" @click="previewAllFn" title="previewAll"><i class="fa fa-eye" aria-hidden="true"></i></li>
</ul>
</div>
</div>
<div class="mdBodyContainer" :class="{ noMenu: !navStatus }">
<div class="editContainer" v-if="editStatus">
<textarea name="" class="mdEditor" @keydown.9="tabFn" v-scroll="editScroll" v-model="input">{{this.mdValuesP}}</textarea>
</div>
<div class="previewContainer markdown-body" v-scroll="previewScroll" v-html="compiledMarkdown" v-if="previewStatus">
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue'
import marked from 'marked'
import scroll from 'vue-scroll'
import hljs from '../../assets/js/highlight.min.js'
import range from '../../assets/js/rangeFn.js'
Vue.use(scroll)
marked.setOptions({
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
highlight: function(code) {
return hljs.highlightAuto(code).value
}
});
function insertContent(val, that) {
let textareaDom = document.querySelector('.mdEditor');
let value = textareaDom.value;
let point = range.getCursortPosition(textareaDom);
let lastChart = value.substring(point - 1, point);
let lastFourCharts = value.substring(point - 4, point);
if (lastChart != '\n' && value != '' && lastFourCharts != ' ') {
val = '\n' + val;
range.insertAfterText(textareaDom, val);
} else {
range.insertAfterText(textareaDom, val);
}
that.input = document.querySelector('.mdEditor').value;
}
export default {
name: 'markdown',
props: ['mdValuesP', 'fullPageStatusP', 'editStatusP', 'previewStatusP', 'navStatusP', 'icoStatusP'],
data() {
return {
input: this.mdValuesP || '',
editStatus: Boolean(this.editStatusP),
previewStatus: Boolean(this.previewStatusP),
fullPageStatus: Boolean(this.fullPageStatusP),
navStatus: Boolean(this.navStatusP),
icoStatus: Boolean(this.icoStatusP),
maxEditScrollHeight: 0,
maxPreviewScrollHeight: 0,
htmlText: marked(this.mdValuesP, {
sanitize: true
})
}
},
created: function() {
if (!this.editStatus && !this.previewStatus) {
this.editStatus = true;
this.previewStatus = true;
}
},
mounted() {
},
methods: {
tabFn: function(evt) {
insertContent(" ", this);
// tab
if (evt.preventDefault) {
evt.preventDefault();
} else {
evt.returnValue = false;
}
},
addImage: function(evt) {
insertContent("![Vue](https://cn.vuejs.org/images/logo.png)", this);
},
addHTitle: function(index) {
let tmp = '';
switch (index) {
case 1:
tmp = '# ';
break;
case 2:
tmp = '## ';
break;
case 3:
tmp = '### ';
break;
case 4:
tmp = '#### ';
break;
case 5:
tmp = '##### ';
break;
case 6:
tmp = '###### ';
break;
default:
break;
}
insertContent(tmp, this);
},
addCode: function() {
let textareaDom = document.querySelector('.mdEditor');
let value = textareaDom.value;
let point = range.getCursortPosition(textareaDom);
let lastChart = value.substring(point - 1, point);
insertContent('```\n\n```', this);
if (lastChart != '\n' && value != '') {
range.setCaretPosition(textareaDom, point + 5);
} else {
range.setCaretPosition(textareaDom, point + 4);
}
},
addStrikethrough: function() {
let textareaDom = document.querySelector('.mdEditor');
let value = textareaDom.value;
let point = range.getCursortPosition(textareaDom);
let lastChart = value.substring(point - 1, point);
insertContent('~~~~', this);
if (lastChart != '\n' && value != '') {
range.setCaretPosition(textareaDom, point + 3);
} else {
range.setCaretPosition(textareaDom, point + 2);
}
},
addStrong: function() {
let textareaDom = document.querySelector('.mdEditor');
let value = textareaDom.value;
let point = range.getCursortPosition(textareaDom);
let lastChart = value.substring(point - 1, point);
insertContent('****', this);
if (lastChart != '\n' && value != '') {
range.setCaretPosition(textareaDom, point + 3);
} else {
range.setCaretPosition(textareaDom, point + 2);
}
},
addItalic: function() {
let textareaDom = document.querySelector('.mdEditor');
let value = textareaDom.value;
let point = range.getCursortPosition(textareaDom);
let lastChart = value.substring(point - 1, point);
insertContent('**', this);
if (lastChart != '\n' && value != '') {
range.setCaretPosition(textareaDom, point + 2);
} else {
range.setCaretPosition(textareaDom, point + 1);
}
},
setStrong: function() {
let textareaDom = document.querySelector('.mdEditor');
let point = range.getCursortPosition(textareaDom);
},
addLine: function() {
insertContent('\n----\n', this);
},
addLink: function() {
insertContent("[Vue](https://cn.vuejs.org/images/logo.png)", this);
},
addQuote: function() {
let textareaDom = document.querySelector('.mdEditor');
let value = textareaDom.value;
let point = range.getCursortPosition(textareaDom);
let lastChart = value.substring(point - 1, point);
insertContent('> ', this);
if (lastChart != '\n' && value != '') {
range.setCaretPosition(textareaDom, point + 3);
} else {
range.setCaretPosition(textareaDom, point + 2);
}
},
addTable: function() {
insertContent('\nheader 1 | header 2\n', this);
insertContent('---|---\n', this);
insertContent('row 1 col 1 | row 1 col 2\n', this);
insertContent('row 2 col 1 | row 2 col 2\n\n', this);
},
addUl: function() {
insertContent('* ', this);
},
addOl: function() {
insertContent('1. ', this);
},
previewFn: function() {
if (!this.editStatus) {
this.editStatus = true;
this.previewStatus = !this.previewStatus;
} else {
this.previewStatus = !this.previewStatus;
}
},
previewAllFn: function() {
if (!this.editStatus && this.previewStatus) {
this.editStatus = true;
this.previewStatus = true;
} else {
this.editStatus = false;
this.previewStatus = true;
}
},
fullPageFn: function() {
this.fullPageStatus = !this.fullPageStatus;
let maxEditScrollHeight=document.querySelector('.mdEditor').scrollHeight-document.querySelector('.mdEditor').clientHeight;
let maxPreviewScrollHeight=document.querySelector('.previewContainer').scrollHeight-document.querySelector('.previewContainer').clientHeight;
this.maxEditScrollHeight = maxEditScrollHeight;
this.maxPreviewScrollHeight = maxPreviewScrollHeight
},
previewScroll: function(e, position) {
if(this.maxEditScrollHeight!==0){
let topPercent=position.scrollTop/this.maxPreviewScrollHeight;
document.querySelector('.mdEditor').scrollTop = this.maxEditScrollHeight*topPercent;
}
},
editScroll:function(e, position){
if(this.maxPreviewScrollHeight!==0){
let topPercent=position.scrollTop/this.maxEditScrollHeight;
document.querySelector('.previewContainer').scrollTop = this.maxPreviewScrollHeight*topPercent;
}
},
happyDay:function(){
window.open('https://github.com/ovenslove/vue-mdEditor');
}
},
computed: {
compiledMarkdown: function() {
return marked(this.input, {
sanitize: true
})
}
},
watch: {
input: function() {
let data = {};
data.mdValue = this.input;
data.htmlValue = marked(this.input, {
sanitize: false
});
this.$emit('childevent', data);
let maxEditScrollHeight=document.querySelector('.mdEditor').scrollHeight-document.querySelector('.mdEditor').clientHeight;
let maxPreviewScrollHeight=document.querySelector('.previewContainer').scrollHeight-document.querySelector('.previewContainer').clientHeight;
this.maxEditScrollHeight = maxEditScrollHeight;
this.maxPreviewScrollHeight = maxPreviewScrollHeight
}
}
}
</script>
<style lang="scss" scoped>
/*引入reset文件*/
@import "../../assets/css/reset";
/*引入github的markdown样式文件*/
@import "../../assets/css/github-markdown.css";
/*引入atom的代码高亮样式文件*/
@import "../../assets/css/atom-one-dark.min.css";
.mdContainer {
width: 100%;
height: 100%;
background: lightblue;
&.fullPage {
position: fixed;
z-index: 1000;
left: 0;
top: 0;
}
.navContainer {
width: 100%;
height: 36px;
background: #fff;
box-sizing: border-box;
border-bottom: 1px solid #eee;
display: flex;
justify-content: flex-start;
align-items: center;
padding: 0 10px;
.nameContainer {
color: lightblue;
margin-right: 10px;
cursor:pointer;
}
.markContainer {
width: auto;
height: 100%;
margin-left: 0px;
ul.markListGroup {
height: 100%;
width: auto;
display: flex;
justify-content: flex-start;
align-items: center;
li.markListItem {
list-style: none;
width: 20px;
height: 20px;
margin: 0 1rem 0 0;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
font-size: 18px;
color: #333;
&:hover {
background: #eee;
}
}
}
}
}
.mdBodyContainer {
width: 100%;
height: calc(100% - 36px);
background: #fff;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
&.noMenu{
height: 100%;
}
}
}
//
.editContainer {
height: 100%;
width: 100%;
box-sizing: border-box;
border-right: 1px solid #ddd;
background: #333;
color: #fff;
padding: 10px;
.mdEditor {
height: 100%;
width: 100%;
background: transparent;
outline: none;
color: #fff;
resize: none;
}
}
//
.previewContainer {
width: 100%;
height: 100%;
box-sizing: border-box;
background: #fff;
overflow: auto;
padding: 10px;
}
</style>

View File

@ -0,0 +1,27 @@
<template>
<el-container>
<el-main>
<img src="../../assets/img/no-data.png" height="200" width="200"/>
<div class="nodata">
暂无数据
</div>
</el-main>
</el-container>
</template>
<script>
export default {
name: "NoData"
}
</script>
<style scoped>
.el-main img{
display: block;
margin: 2rem auto 0;
}
.nodata{
text-align: center;
color: #999;
}
</style>

View File

@ -5,8 +5,16 @@ import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/css/public.css'
// 引用API文件
import api from './api/index.js'
// 将API方法绑定到全局
import marked from 'marked'
import scroll from 'vue-scroll'
Vue.prototype.$ajax = api
Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.use(scroll)
/* eslint-disable no-new */
new Vue({
el: '#app',

View File

@ -8,14 +8,50 @@ export default new Router({
routes: [{
path: '/login',
name: 'login',
component:() => import('@/components/Login'),
children:[{
//path和name不区分大小写
component:() => import('@/components/Login')
},
{
path:'/',
name:'index',
component:() => import('@/components/Index'),
children: [
{
path:'help',
name:'help',
component:() => import('@/components/Help')
},
{
path:'homepage',
name:'homepage',
component:() => import('@/components/Homepage')
}]
},
{
path:'schoolnotice',
name:'schoolnotice',
component:() => import('@/components/SchoolNotice')
},
{
path:'parentsproposal',
name:'parentsproposal',
component:() => import('@/components/ParentsProposal')
},
{
path:'studentthought',
name:'studentthought',
component:() => import('@/components/StudentThought')
},
{
path:'myclass',
name:'myclass',
component:() => import('@/components/MyClass')
},
{
path:'content',
name:'content',
component:() => import('@/components/Content')
}
]
}