Skip to content

Commit

Permalink
去除响应式,隐藏后端细节
Browse files Browse the repository at this point in the history
  • Loading branch information
Husen committed Dec 27, 2017
1 parent df09fc6 commit 9162c7a
Show file tree
Hide file tree
Showing 13 changed files with 114 additions and 72 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ PC端网址:www.hemingsheng.cn ,移动端网址:https://m.hemingsheng.cn
│ editor-article.css
├─error
│ error.jsp
│ error.html
├─images
│ │ favicon.ico
Expand Down
3 changes: 1 addition & 2 deletions WebContent/css/upload/editor-article.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
@charset "UTF-8";

/************** 新版编辑文章 ***************/
.editor-form-div {
margin-top: 20px;
margin: 20px 15px;
}

.article-type {
Expand Down
12 changes: 11 additions & 1 deletion WebContent/js/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@
* 2017年9月28日
*/

/** 加载插件 * */
$.ajax({
url : '/plugins/plugins.html', // 这里是静态页的地址
async : false,
type : 'GET', // 静态页用get方法,否则服务器会抛出405错误
success : function(data) {
$($('head')[0]).find('script:first').after(data);
}
});

var article_id = -1;// 文章id,新文章默认为-1,编辑文章为相应的id
var article_type = -1; //文章类型,默认-1,博客=blog,代码=code

$(document).ready(function() {
// 判断是否超级管理员,否则不能访问
/*if ($.cookie('username') != 'super_admin') {
window.location.replace('/module/error/error.jsp');
window.location.replace('/module/error/error.html');
return;
}*/

Expand Down
6 changes: 2 additions & 4 deletions WebContent/js/login/formvalidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,11 @@ function showLoginStatus() {
* @returns
*/
function persCenterBtnClick() {
// window.open('/personal_center/mycenter.jsp');

// 如果没有登录,跳转到错误页面
if (!$.cookie('username')) {
window.open('/module/error/error.jsp');
window.open('/module/error/error.html');
} else {
window.open('/personal_center/mycenter.jsp');
window.open('/usercenter.hms');
}
}

Expand Down
2 changes: 1 addition & 1 deletion WebContent/js/personal_center/modify-email.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function nextStepClick(){
$('#mainWindow').html('');

$.ajax( {
url: 'modify_email1.html', //这里是静态页的地址
url: '/personal_center/modify_email1.html', //这里是静态页的地址
async : false,
type: 'GET', //静态页用get方法,否则服务器会抛出405错误
success: function(data){
Expand Down
29 changes: 13 additions & 16 deletions WebContent/js/personal_center/personal-center.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $(function() {
// 如果没有登录
/*
* if(!$.cookie('username')){
* window.location.replace('/module/error/error.jsp'); }
* window.location.replace('/module/error/error.html'); }
*/

// 调整顶部导航的宽度
Expand Down Expand Up @@ -70,9 +70,6 @@ $(function() {
$('#btn_modifyEmail').click(modifyEmail);
$('#btn_uploadFile').click(uploadFile);
$('#btn_showUsers').click(showUsers);

// $('#privatemessage').click();
// $('#aboutweb').click();
});

/**
Expand All @@ -90,8 +87,8 @@ function loadAdminManageMenu() {
+ ' class="pull-right glyphicon glyphicon-chevron-down"></span>'
+ '</a>'
+ '<ul id="webManagement" class="nav nav-list collapse secondmenu">'
+ '<li><a href="/module/upload/editor_article.jsp" target="_blank"><i class="glyphicon glyphicon-user"></i> 写新博客</a></li>'
+ '<li><a href="/module/upload/editor_article.jsp" target="_blank"><i class="glyphicon glyphicon-th-list"></i> 写新代码库</a></li>'
+ '<li><a href="/editor/article.hms" target="_blank"><i class="glyphicon glyphicon-user"></i> 写新博客</a></li>'
+ '<li><a href="/editor/article.hms" target="_blank"><i class="glyphicon glyphicon-th-list"></i> 写新代码库</a></li>'
+ '<li><a href="#" id="btn_uploadFile"><i class="glyphicon glyphicon-asterisk"></i> 上传新文件</a></li>'
+ '<li><a href="#" id="editorVerFeature"><i class="glyphicon glyphicon-edit"></i> 编辑新版特性</a></li>'
+ '<li><a href="#" id="btn_showUsers"><i class="glyphicon glyphicon-eye-open"></i> 查看所有用户</a></li>'
Expand All @@ -105,8 +102,8 @@ function loadAdminManageMenu() {
+ ' class="pull-right glyphicon glyphicon-chevron-down"></span>'
+ '</a>'
+ '<ul id="webManagement" class="nav nav-list collapse secondmenu">'
+ '<li><a href="/module/upload/editor_article.jsp" target="_blank"><i class="glyphicon glyphicon-user"></i> 写新博客</a></li>'
+ '<li><a href="/module/upload/editor_article.jsp" target="_blank"><i class="glyphicon glyphicon-th-list"></i> 写新代码库</a></li>'
+ '<li><a href="/editor/article.hms" target="_blank"><i class="glyphicon glyphicon-user"></i> 写新博客</a></li>'
+ '<li><a href="/editor/article.hms" target="_blank"><i class="glyphicon glyphicon-th-list"></i> 写新代码库</a></li>'
+ '<li><a href="#" id="btn_uploadFile"><i class="glyphicon glyphicon-asterisk"></i> 上传新文件</a></li>'
+ '</ul>' + '</li>');
}
Expand All @@ -125,7 +122,7 @@ function modifyPassword() {
$('#mainWindow').html('');

$.ajax({
url : 'modify_pwd.html', // 这里是静态页的地址
url : '/personal_center/modify_pwd.html', // 这里是静态页的地址
async : false,
type : 'GET', // 静态页用get方法,否则服务器会抛出405错误
success : function(data) {
Expand Down Expand Up @@ -271,7 +268,7 @@ function editUserInfo() {
$('#mainWindow').html('');

$.ajax({
url : 'modify_userinfo.html', // 这里是静态页的地址
url : '/personal_center/modify_userinfo.html', // 这里是静态页的地址
async : false,
type : 'GET', // 静态页用get方法,否则服务器会抛出405错误
success : function(data) {
Expand All @@ -289,7 +286,7 @@ function editVerFeature() {
$('#mainWindow').html('');

$.ajax({
url : 'editor_version.html', // 这里是静态页的地址
url : '/personal_center/editor_version.html', // 这里是静态页的地址
async : false,
type : 'GET', // 静态页用get方法,否则服务器会抛出405错误
success : function(data) {
Expand All @@ -311,7 +308,7 @@ function modifyEmail() {
$('#mainWindow').html('');

$.ajax({
url : 'modify_email.html', // 这里是静态页的地址
url : '/personal_center/modify_email.html', // 这里是静态页的地址
async : false,
type : 'GET', // 静态页用get方法,否则服务器会抛出405错误
success : function(data) {
Expand All @@ -327,11 +324,11 @@ function modifyEmail() {
*/
function uploadFile() {
$('#mainWindow').html('');

$.ajax({
url : 'upload_file.html', // 这里是静态页的地址
url : '/personal_center/upload_file.html',
async : false,
type : 'GET', // 静态页用get方法,否则服务器会抛出405错误
type : 'GET',
success : function(data) {
$('#mainWindow').html(data);
}
Expand All @@ -346,7 +343,7 @@ function showUsers(){
$('#mainWindow').html('');

$.ajax({
url : 'show_users.html', // 这里是静态页的地址
url : '/personal_center/show_users.html', // 这里是静态页的地址
async : false,
type : 'GET', // 静态页用get方法,否则服务器会抛出405错误
success : function(data) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

<!doctype html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head>
Expand All @@ -11,7 +8,8 @@
<!-- 网站图标 -->
<link rel="shortcut icon" href="/images/favicon.ico">

<%@include file="/plugins/plugins.jsp"%>
<!-- jQuery -->
<script src="/plugins/jquery/js/jquery-3.2.1.min.js"></script>

<!-- editormd start -->
<link rel="stylesheet" href="/plugins/editormd/css/editormd.min.css" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
Expand Down
38 changes: 0 additions & 38 deletions WebContent/plugins/plugins.jsp

This file was deleted.

6 changes: 6 additions & 0 deletions src/pers/husen/web/common/constants/ResponseConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ public class ResponseConstants {
public static final String DOWNLOAD_MODULE_TEMPLATE_PATH = ProjectDeployConfig.WEB_DEPLOY_PATH + "/topic/download/download.html";
/** 返回博客模块的模板地址 **/
public static final String MESSAGE_MODULE_TEMPLATE_PATH = ProjectDeployConfig.WEB_DEPLOY_PATH + "/topic/message/message.html";

/** 返回个人中心的模板地址 **/
public static final String USER_CENTER_TEMPLATE_PATH = ProjectDeployConfig.WEB_DEPLOY_PATH + "/personal_center/usercenter.html";

/** 返回编辑文章的模板地址 **/
public static final String EDITOR_ARTICLE_TEMPLATE_PATH = ProjectDeployConfig.WEB_DEPLOY_PATH + "/module/upload/editor.html";
}
38 changes: 38 additions & 0 deletions src/pers/husen/web/servlet/module/usercenter/EditorArticleSvt.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package pers.husen.web.servlet.module.usercenter;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import pers.husen.web.common.constants.ResponseConstants;
import pers.husen.web.common.helper.ReadH5Helper;

/**
* @desc 编辑文章
*
* @author 何明胜
*
* @created 2017年12月27日 下午3:56:11
*/
@WebServlet(urlPatterns = "/editor/article.hms")
public class EditorArticleSvt extends HttpServlet {
private static final long serialVersionUID = 1L;

public EditorArticleSvt() {
super();
}

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");

ReadH5Helper.writeHtmlByName(ResponseConstants.EDITOR_ARTICLE_TEMPLATE_PATH, response);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package pers.husen.web.servlet.module.usercenter;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import pers.husen.web.common.constants.ResponseConstants;
import pers.husen.web.common.helper.ReadH5Helper;

/**
* @desc 个人中心
*
* @author 何明胜
*
* @created 2017年12月27日 下午3:28:38
*/
@WebServlet(urlPatterns = "/usercenter.hms")
public class PersonalCenterSvt extends HttpServlet {
private static final long serialVersionUID = 1L;

public PersonalCenterSvt() {
super();
}

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");

ReadH5Helper.writeHtmlByName(ResponseConstants.USER_CENTER_TEMPLATE_PATH, response);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}

0 comments on commit 9162c7a

Please sign in to comment.