新增系统问题下载
This commit is contained in:
parent
be36d03fce
commit
417cb7e497
|
|
@ -1,29 +1,44 @@
|
|||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<div class="navbar-header pull-right" >
|
||||
<!-- <div class="navbar-header pull-right" role="navigation"> -->
|
||||
<ul class="nav ace-nav">
|
||||
<li class="userperLi">
|
||||
<a data-toggle="dropdown" href="#" class="dropdown-toggle">
|
||||
<i class="icon-user nav-user-icon"></i>
|
||||
<span class="user-info">
|
||||
<small>欢迎光临,</small>
|
||||
<span id="user-info-name ">
|
||||
<c:choose>
|
||||
<div class="navbar-header pull-right" >
|
||||
<!-- <div class="navbar-header pull-right" role="navigation"> -->
|
||||
<ul class="nav ace-nav">
|
||||
<!-- 问号图标 -->
|
||||
<li class="light-blue">
|
||||
<a href="javascript:void(0);" onclick="downloadInstructions()" title="常见问题说明">
|
||||
<i class="icon-question-sign nav-icon"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="userperLi">
|
||||
<a data-toggle="dropdown" href="#" class="dropdown-toggle">
|
||||
<i class="icon-user nav-user-icon"></i>
|
||||
<span class="user-info">
|
||||
<small>欢迎光临,</small>
|
||||
<span id="user-info-name ">
|
||||
<c:choose>
|
||||
<c:when test="${!empty currentAccount.name}">${currentAccount.name}</c:when>
|
||||
<c:when test="${!empty currentAccount.loginName}">${currentAccount.loginName}</c:when>
|
||||
<c:otherwise>用户</c:otherwise>
|
||||
</c:choose>
|
||||
</span>
|
||||
</c:choose>
|
||||
</span>
|
||||
<i class="icon-caret-down"></i>
|
||||
</a>
|
||||
<ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
|
||||
<li><a href="javascript:void(0);" onclick="perData();" ><i class="icon-user"></i>个人设置</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="perSetting();" ><i class="icon-cog"></i>系统设置</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="javascript:void(0);" onclick="logout();"><i class="icon-off"></i>退出</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul><!-- /.ace-nav -->
|
||||
</div><!-- /.navbar-header -->
|
||||
</span>
|
||||
<i class="icon-caret-down"></i>
|
||||
</a>
|
||||
<ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
|
||||
<li><a href="javascript:void(0);" onclick="perData();" ><i class="icon-user"></i>个人设置</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="perSetting();" ><i class="icon-cog"></i>系统设置</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="javascript:void(0);" onclick="logout();"><i class="icon-off"></i>退出</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul><!-- /.ace-nav -->
|
||||
</div><!-- /.navbar-header -->
|
||||
|
||||
<script type="text/javascript">
|
||||
// 下载使用说明文件
|
||||
function downloadInstructions() {
|
||||
// 直接跳转到下载接口
|
||||
window.location.href = '${pageContext.request.contextPath}/backstage/index/downloadManual';
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
|
|
@ -1,5 +1,12 @@
|
|||
package com.bonus.sys.controller;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
|
@ -26,4 +33,34 @@ public class IndexController {
|
|||
mv.setViewName("index/mapSpecial");
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载系统常见问题手册
|
||||
*/
|
||||
@RequestMapping(value = "/downloadManual")
|
||||
public void downloadManual(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
// 读取resources/template目录下的文件
|
||||
InputStream inputStream = getClass().getResourceAsStream("/template/系统常见问题手册.docx");
|
||||
|
||||
// 设置响应头
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
||||
String fileName = URLEncoder.encode("系统常见问题手册.docx", "UTF-8");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
|
||||
|
||||
// 将文件内容写入响应输出流
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int len;
|
||||
while ((len = inputStream.read(buffer)) > 0) {
|
||||
outputStream.write(buffer, 0, len);
|
||||
}
|
||||
|
||||
// 关闭流
|
||||
outputStream.close();
|
||||
inputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue