Compare commits

..

10 Commits

Author SHA1 Message Date
8c2e43c04f Merge branch 'master' into release_v2.0.1 2020-05-17 22:21:50 +08:00
f553d23fb9 v2.0.1发布 2020-05-17 22:14:53 +08:00
xxy
9773b73475 修改版本号 2020-05-16 13:29:32 +08:00
xxy
5543b905cd 小说发布防xss攻击 2020-05-16 13:20:08 +08:00
xxy
e273906441 小说发布防xss攻击 2020-05-16 13:05:44 +08:00
xxy
83dc04c50b Merge branch 'develop' of https://gitee.com/xiongxyang/novel-plus into develop 2020-05-16 12:05:33 +08:00
xxy
b4f5b18e93 1.修复昵称修改不会显示在顶部栏的问题
2.修复底部作者专区超链接问题
2020-05-16 12:01:02 +08:00
fe80c21812 Merge branch 'develop' of https://gitee.com/xiongxyang/novel-plus into develop 2020-05-16 11:46:11 +08:00
4c2a7f12c1 gitignore add file 2020-05-16 11:44:33 +08:00
xxy
e24e87b546 修复性别修改问题 2020-05-16 03:05:49 +08:00
23 changed files with 136 additions and 75 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@
/novel-admin/target
/*.iml
/novel-admin/*.iml
.DS_Store

View File

@ -44,17 +44,47 @@ Springboot+Mybatis+Mysql+Ehcache+Thymeleaf+Layui
#### PC站截图
1. 首页
![img](https://oscimg.oschina.net/oscnet/up-bbb1c7f72e183327bff754a9fa8bb75223e.png)
![index](./assets/1588548668698.gif)
2. 分类索引页
![img](https://oscimg.oschina.net/oscnet/up-d0b2e03129bfae47b8bb96a491b73d383c5.png)
3. 排行榜
![index](./assets/1588548784395.gif)
![img](https://oscimg.oschina.net/oscnet/up-78d5a68586cd92a86c669311f414508f922.png)
4. 详情页
![img](https://oscimg.oschina.net/oscnet/up-8be2495a2869f93626b0c9c1df6f329747a.png)
![index](./assets/1588548916980.gif)
5. 阅读页
![img](https://oscimg.oschina.net/oscnet/up-517c84148d2db8e11717a8bbecc57fa1be7.png)
6. 用户中心
![img](https://oscimg.oschina.net/oscnet/up-805a30e7a663a3fd5cb39a7ea26bc132a01.png)
7. 充值
![img](https://oscimg.oschina.net/oscnet/up-5a601b0b3af3224d0bebcfe12fc15075d34.png)
![img](https://oscimg.oschina.net/oscnet/up-face25d02c07b05b2ce954cc4bf4ee6a0cc.png)
8.作家专区
![img](https://oscimg.oschina.net/oscnet/up-30766372cc7f56480ff1d7d55198204f6ea.png)
![img](https://oscimg.oschina.net/oscnet/up-9737995e465b86f3bee3211221f6c3b8a56.png)
9.购买
![img](https://oscimg.oschina.net/oscnet/up-ce0f585efd82a9670335f118cf5897c85e9.png)
![img](https://oscimg.oschina.net/oscnet/up-f849960f4c1303fea77d26e64fc505a7180.png)
@ -86,7 +116,11 @@ Springboot+Mybatis+Mysql+Ehcache+Thymeleaf+Layui
![QQ图片20191018161901](./assets/crawl_index.png)
#### 后台管理系统截图
![img](https://oscimg.oschina.net/oscnet/up-0552343538674a22a64819834100558f39b.png)
![img](https://oscimg.oschina.net/oscnet/up-faf5dda7320674c29a1772bc0c81d74762e.png)
#### 安装步骤
@ -127,7 +161,7 @@ docker安装教程[点击前往](https://my.oschina.net/java2nb/blog/4271989)
#### QQ交流群
![mini-code](./assets/qq_group.png)
![mini-code](./assets/小说精品屋开源项目交流群群聊二维码.png)
#### 捐赠支持

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>novel</artifactId>
<groupId>com.java2nb</groupId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@ spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password:
password: test123456
driver-class-name: com.mysql.cj.jdbc.Driver

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>novel</artifactId>
<groupId>com.java2nb</groupId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>novel</artifactId>
<groupId>com.java2nb</groupId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -101,7 +101,9 @@ public class UserController extends BaseController {
token = jwtTokenUtil.refreshToken(token);
Map<String, Object> data = new HashMap<>(2);
data.put("token", token);
data.put("username", jwtTokenUtil.getUserDetailsFromToken(token).getUsername());
UserDetails userDetail = jwtTokenUtil.getUserDetailsFromToken(token);
data.put("username", userDetail.getUsername());
data.put("nickName", userDetail.getNickName());
return ResultBean.ok(data);
} else {
@ -232,6 +234,12 @@ public class UserController extends BaseController {
return ResultBean.fail(ResponseStatus.NO_LOGIN);
}
userService.updateUserInfo(userDetails.getId(),user);
if(user.getNickName() != null){
userDetails.setNickName(user.getNickName());
Map<String, Object> data = new HashMap<>(1);
data.put("token", jwtTokenUtil.generateToken(userDetails));
return ResultBean.ok(data);
}
return ResultBean.ok();
}

View File

@ -11,4 +11,6 @@ public class UserDetails {
private Long id;
private String username;
private String nickName;
}

View File

@ -1,37 +1,42 @@
package com.java2nb.novel.core.wrapper;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.Arrays;
import java.util.List;
/**
* XSS过滤处理
*
* @author Administrator
*/
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
{
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
/**
* 假如有有html 代码是自己传来的 需要设定对应的name 不过滤
*/
private static final List<String> noFilterNames = Arrays.asList("content");
/**
* @param request
*/
public XssHttpServletRequestWrapper(HttpServletRequest request)
{
public XssHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
}
@Override
public String[] getParameterValues(String name)
{
public String[] getParameterValues(String name) {
String[] values = super.getParameterValues(name);
if (values != null)
{
if (!noFilterNames.contains(name) && values != null) {
int length = values.length;
String[] escapseValues = new String[length];
for (int i = 0; i < length; i++)
{
// 防xss攻击和过滤前后空格
escapseValues[i] = values[i].replaceAll("<","&lt;").replaceAll(">","&gt;");
for (int i = 0; i < length; i++) {
escapseValues[i] = values[i].replaceAll("<", "&lt;").replaceAll(">", "&gt;");
}
return escapseValues;
}
return super.getParameterValues(name);
return values;
}
}

View File

@ -86,13 +86,14 @@ public class UserServiceImpl implements UserService {
UserDetails userDetails = new UserDetails();
userDetails.setId(id);
userDetails.setUsername(entity.getUsername());
userDetails.setNickName(entity.getNickName());
return userDetails;
}
@Override
public UserDetails login(UserForm form) {
//根据用户名密码查询记录
SelectStatementProvider selectStatement = select(id, username)
SelectStatementProvider selectStatement = select(id, username,nickName)
.from(user)
.where(username, isEqualTo(form.getUsername()))
.and(password, isEqualTo(MD5Util.MD5Encode(form.getPassword(), Charsets.UTF_8.name())))
@ -104,7 +105,9 @@ public class UserServiceImpl implements UserService {
}
//生成UserDetail对象并返回
UserDetails userDetails = new UserDetails();
userDetails.setId(users.get(0).getId());
User user = users.get(0);
userDetails.setId(user.getId());
userDetails.setNickName(user.getNickName());
userDetails.setUsername(form.getUsername());
return userDetails;
}

View File

@ -23,7 +23,7 @@ xss:
# 排除链接多个用逗号分隔
excludes: /system/notice/*
# 匹配链接 多个用逗号分隔
urlPatterns: /book/addBookComment,/user/addFeedBack
urlPatterns: /book/addBookComment,/user/addFeedBack,/author/addBook,/author/addBookContent,/author/register.html

View File

@ -65,7 +65,7 @@ if(!token){
success: function(data){
if(data.code == 200){
$(".user_link").html("<i class=\"line mr20\">|</i>" +
"<a href=\"/user/userinfo.html\" class=\"mr15\">"+data.data.username+"</a>" +
"<a href=\"/user/userinfo.html\" class=\"mr15\">"+data.data.nickName+"</a>" +
"<a href=\"javascript:logout()\" >退出</a>");
;
if("/user/login.html" == window.location.pathname){

View File

@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="common/header :: common_head(~{::title},~{::meta},~{::link})">
<title th:text="${book.bookName}+'_'+${bookIndex.indexName}+'_'+#{website.name}"></title>
<title th:utext="${book.bookName}+'_'+${bookIndex.indexName}+'_'+#{website.name}"></title>
<meta name="keywords" th:content="${book.bookName}+'官方首发,'+${book.bookName}+'小说,'+${book.bookName}+'最新章节,'+${book.bookName}+'txt下载,'+${book.bookName}+'无弹窗,'+${book.bookName}+'吧,'+${book.bookName}+'离线完本'" />
<meta name="description" th:content="${book.bookName}+','+${book.bookName}+'小说阅读,'+#{website.name}+'提供'+${book.bookName}+'首发最新章节及txt下载,'+${book.bookName}+'最新更新章节,精彩尽在'+#{website.name}+'。'" />
<link rel="stylesheet" href="/css/read.css" />
@ -74,7 +74,7 @@
<div class="readWrap">
<div class="bookNav">
<a href="/" >首页 </a>&gt; <a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}">
</a>&gt; <a th:href="'/book/'+${book.id}+'.html'" th:text="${book.bookName}">
</a>&gt; <a th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookName}">
</a>
</div>
@ -82,11 +82,11 @@
<div class="textbox cf">
<div class="book_title">
<h1 th:text="${bookIndex.indexName}">
<h1 th:utext="${bookIndex.indexName}">
</h1>
<div class="textinfo">
类别:<a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}"></a>
作者:<a th:href="'javascript:searchByK(\''+${book.authorName}+'\')'" th:text="${book.authorName}"></a><span th:text="'字数'+${bookIndex.wordCount}"></span><span th:text="'更新时间'+${#dates.format(bookIndex.updateTime, 'yy/MM/dd HH:mm:ss')}"></span>
作者:<a th:href="'javascript:searchByK(\''+${book.authorName}+'\')'" th:utext="${book.authorName}"></a><span th:text="'字数'+${bookIndex.wordCount}"></span><span th:text="'更新时间'+${#dates.format(bookIndex.updateTime, 'yy/MM/dd HH:mm:ss')}"></span>
</div>
</div>
<div class="txtwrap" th:if="${needBuy}">

View File

@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head th:replace="common/header :: common_head(~{::title},~{::meta},~{::link})">
<title th:text="${book.bookName}+'_'+${book.authorName}+'_'+${book.bookName}+'txt下载'+'_'+${book.bookName}+'无弹窗_'+#{website.name}"></title>
<title th:utext="${book.bookName}+'_'+${book.authorName}+'_'+${book.bookName}+'txt下载'+'_'+${book.bookName}+'无弹窗_'+#{website.name}"></title>
<meta name="keywords"
th:content="${book.bookName}+'官方首发,'+${book.bookName}+'小说,'+${book.bookName}+'最新章节'+${book.bookName}+'txt下载,'+${book.bookName}+'无弹窗,'+${book.bookName}+'吧,'+${book.bookName}+'离线完本'"/>
<meta name="description"
@ -23,7 +23,7 @@
<div class="main box_center cf mb50">
<div class="nav_sub">
<a href="/" th:text="#{website.name}"></a>&gt;<a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}"></a>&gt;<a
th:href="'/book/'+${book.id}+'.html'" th:text="${book.bookName}"></a>
th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookName}"></a>
</div>
<div class="channelWrap channelBookInfo cf">
<div class="bookCover cf">
@ -31,8 +31,8 @@
th:attr="alt=${book.bookName}"/></a>
<div class="book_info">
<div class="tit">
<h1 th:text="${book.bookName}"></h1><!--<i class="vip_b">VIP</i>--><a class="author"
th:text="${book.authorName}+' '"></a>
<h1 th:utext="${book.bookName}"></h1><!--<i class="vip_b">VIP</i>--><a class="author"
th:utext="${book.authorName}+' '"></a>
</div>
<ul class="list">
<li><span class="item">类别:<em th:text="${book.catName}"></em></span>
@ -70,7 +70,7 @@
</div>
<ul class="list cf">
<li>
<span class="fl font16"> <a th:href="'/book/'+${book.id}+'/'+${book.lastIndexId}+'.html'" th:text="${book.lastIndexName}"><!--<i class="vip">VIP</i>--></a></span>
<span class="fl font16"> <a th:href="'/book/'+${book.id}+'/'+${book.lastIndexId}+'.html'" th:utext="${book.lastIndexName}"><!--<i class="vip">VIP</i>--></a></span>
<span class="black9 fr"
th:text="'更新时间'+${#dates.format(book.lastIndexUpdateTime, 'yy/MM/dd HH:mm:ss')}"></span>
</li>
@ -143,7 +143,7 @@
<div class="msg">
<span class="icon_qyzz">签约作家</span>
<h4><a th:href="'javascript:searchByK(\''+${book.authorName}+'\')'"
th:text="${book.authorName}"></a></h4>
th:utext="${book.authorName}"></a></h4>
</div>
</div>
<div class="author_intro cf">

View File

@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head th:replace="common/header :: common_head(~{::title},~{::meta},~{::link})">
<title th:text="${book.bookName}+'目录,'+${book.bookName}+'最新章节列表_'+#{website.name}"></title>
<title th:utext="${book.bookName}+'目录,'+${book.bookName}+'最新章节列表_'+#{website.name}"></title>
<meta name="keywords" th:content="${book.bookName}+','+${book.bookName}+'目录,'+${book.bookName}+'最新章节列表'"/>
<meta name="description"
th:content="#{website.name}+'小说为您提供'+${book.bookName}+'目录,'+${book.bookName}+'最新章节列表,'+${book.bookName}+'全文阅读,'+${book.bookName}+'免费阅读,'+${book.bookName}+'下载'"/>
@ -17,7 +17,7 @@
<div class="main box_center cf">
<div class="nav_sub">
<a href="/" th:text="#{website.name}"></a>&gt;<a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}"></a>&gt;<a
th:href="'/book/'+${book.id}+'.html'" th:text="${book.bookName}"></a>&gt;<a
th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookName}"></a>&gt;<a
th:href="'/book/indexList-'+${book.id}+'.html'">作品目录</a>
</div>
<div class="channelWrap channelChapterlist cf mb50">
@ -26,11 +26,11 @@
<div class="bookCover cf">
<div class="book_info1">
<div class="tit">
<h1 th:text="${book.bookName}"></h1><!--<i class="vip_b">VIP</i>-->
<h1 th:utext="${book.bookName}"></h1><!--<i class="vip_b">VIP</i>-->
</div>
<ul class="list">
<li>
<span>作者:<a href="javascript:void(0)" th:text="${book.authorName}"></a></span>
<span>作者:<a href="javascript:void(0)" th:utext="${book.authorName}"></a></span>
<span>类别:<a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}"></a></span>
<span th:switch="${book.bookStatus}">状态:<em class="black3" th:case="'0'">连载中</em><em class="black3"
th:case="*">已完结</em></span>
@ -45,9 +45,9 @@
<div class="dirList">
<ul th:each="bookIndex : ${bookIndexList}">
<li><a th:if="${bookIndex.isVip} != '1'" th:href="'/book/'+${book.id}+'/'+${bookIndex.id}+'.html'" >
<span th:text="${bookIndex.indexName}"></span><i class="red" > [免费]</i>
<span th:utext="${bookIndex.indexName}"></span><i class="red" > [免费]</i>
</a>
<a th:if="${bookIndex.isVip} == '1'" th:href="'/book/'+${book.id}+'/'+${bookIndex.id}+'.html'" th:text="${bookIndex.indexName}">
<a th:if="${bookIndex.isVip} == '1'" th:href="'/book/'+${book.id}+'/'+${bookIndex.id}+'.html'" th:utext="${bookIndex.indexName}">
</a></li>
</ul>
</div>

View File

@ -2,7 +2,7 @@
<div class="box_center cf">
<div class="copyright">
<ul >
<li class="menu"><a href="/?to=mobile">手机站</a><i class="line">|</i><a href="/">网站首页</a><i class="line">|</i><a href="/about/default.html" >关于我们</a><i class="line">|</i><a href="/about/contact.html" >联系我们</a><i class="line">|</i><a href="/user/feedback.html" >反馈留言</a><i class="line">|</i><a href="javascript:layer.alert('待开通敬请期待');" >作家专区</a></li>
<li class="menu"><a href="/?to=mobile">手机站</a><i class="line">|</i><a href="/">网站首页</a><i class="line">|</i><a href="/about/default.html" >关于我们</a><i class="line">|</i><a href="/about/contact.html" >联系我们</a><i class="line">|</i><a href="/user/feedback.html" >反馈留言</a><i class="line">|</i><a href="/author/index.html" >作家专区</a></li>
<li th:text="'Copyright (C) '+#{website.domain}+' All rights reserved&nbsp;&nbsp;'+#{website.name}+'版权所有'"></li>
</ul>

View File

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta th:if="${catId == 9}" name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=1">
<meta th:if="${catId != 9}" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title th:text="${book.bookName}+${bookIndex.indexName}"></title>
<title th:utext="${book.bookName}+${bookIndex.indexName}"></title>
<meta name="keywords" th:content="${book.bookName}+','+${bookIndex.indexName}">
@ -183,7 +183,7 @@
<a href="javascript:history.go(-1)">
<i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe65c;</i></a>
</div>
<a style="color: #ffffff;" th:href="'/book/'+ ${book.id} + '.html'"><b style="padding-left: 5%;float: left;width: 69%" class="line-limit-length" th:text="${bookIndex.indexName}+' '+${book.bookName}"></b></a>
<a style="color: #ffffff;" th:href="'/book/'+ ${book.id} + '.html'"><b style="padding-left: 5%;float: left;width: 69%" class="line-limit-length" th:utext="${bookIndex.indexName}+' '+${book.bookName}"></b></a>
<div style="width:10%;float: right;margin-right: 10px"><a href="/">
<i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe68e;</i>
</a>

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title th:text="${book.bookName}+'小说最新章节免费阅读和下载'"></title>
<title th:utext="${book.bookName}+'小说最新章节免费阅读和下载'"></title>
<meta name="keywords" th:content="${book.bookName}+','+${book.bookName}+'最新章节,'+${book.bookName}+'免费阅读,'+${book.bookName}+'TXT下载'">
@ -121,7 +121,7 @@
<a href="javascript:history.go(-1)">
<i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe65c;</i></a>
</div>
<b class="layui-icon" th:text="${book.bookName}"></b>
<b class="layui-icon" th:utext="${book.bookName}"></b>
<div style="float: right;margin-right: 10px">
<a href="/"><i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe68e;</i></a>
</div>
@ -133,7 +133,7 @@
</div>
<div style="position:relative;padding: 10px 20px" class="layui-col-xs8 layui-col-sm8 layui-col-md8 layui-col-lg8">
<a th:href="'javascript:searchBooks(\''+ ${book.authorName}+'\')'"><div style=";color: #4c6978;" th:text="'作者'+ ${book.authorName}"></div></a>
<a th:href="'javascript:searchBooks(\''+ ${book.authorName}+'\')'"><div style=";color: #4c6978;" th:utext="'作者'+ ${book.authorName}"></div></a>
<a th:href="'/book/book_ranking.html?catId='+${book.catId}"><div style="margin-top: 5px;color: #4c6978;" th:text="'类别'+ ${book.catName}"></div></a>
<div style="margin-top: 5px;color: #4c6978;" th:text="'状态'+ ${book.bookStatus==0?'连载':'完结'}"></div>
<div style="margin-top: 5px;color: #4c6978;">更新:<i th:text="${#dates.format(book.lastIndexUpdateTime, 'yy-MM-dd')}"></i></div>

View File

@ -5,7 +5,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title th:text="${book.bookName}+'最新免费章节目录列表'"></title>
<title th:utext="${book.bookName}+'最新免费章节目录列表'"></title>
<meta name="keywords" th:content="${book.bookName}+','+${book.bookName}+'最新章节'">
@ -48,7 +48,7 @@
<a href="javascript:history.go(-1)">
<i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe65c;</i></a>
</div>
<a style="color: #ffffff;" th:href="'/book/'+ ${book.id} + '.html'"><b class="layui-icon" th:text="${book.bookName}"></b></a>
<a style="color: #ffffff;" th:href="'/book/'+ ${book.id} + '.html'"><b class="layui-icon" th:utext="${book.bookName}"></b></a>
<div style="float: right;margin-right: 10px">
<a href="/"><i style="font-size: 20px;color: #92B8B1;" class="layui-icon">&#xe68e;</i></a>
</div>
@ -63,7 +63,7 @@
<div class="layui-colla-content layui-show indexP layui-row">
<p class="line-limit-length layui-col-xs12 layui-col-sm4 layui-col-md3 layui-col-lg2" style="padding-left:10px;height: 50px;line-height: 50px;" th:each="index : ${bookIndexList}">
<a th:href="'/book/'+${index.bookId}+'/'+${index.id}+'.html'" th:text="${index.indexName}">
<a th:href="'/book/'+${index.bookId}+'/'+${index.id}+'.html'" th:utext="${index.indexName}">
</a>
</p>

View File

@ -1,4 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head th:replace="common/header :: common_head(~{::title},~{},~{::link})">
<title th:text="'修改昵称_'+#{website.name}"></title>
@ -24,21 +25,26 @@
<div class="my_r">
<div class="my_info cf">
<div class="my_info_txt">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTI5MzkzMzQyMw9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZLj1Uo6akAHRsP9HH/tJWCPmjwlzm9tv02sZRfbbCnBA" />
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUKMTI5MzkzMzQyMw9kFgJmD2QWAmYPFgIeBFRleHQFqAE8YSBocmVmPSIvc2VhcmNoLmFzcHg/c2VhcmNoS2V5PeWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqyIgdGFyZ2V0PSJfYmxhbmsiPuWWu+Wuiembr++8jOeLhOazve+8jOeBteW8gu+8jOWJjeS4luS7iueUn++8jOWGpeeOi+msvOWkqzwvYT5kZLj1Uo6akAHRsP9HH/tJWCPmjwlzm9tv02sZRfbbCnBA"/>
</div>
<div class="aspNetHidden">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="6C876674" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAO8SPdUDpH0Q7nHjeqbvI7ld2C+OxfjpZOniBJbql7XdnRgTJ25FWigbeFr84Vgoxdi/cg2vS37N0KER6F1nyr1wKHztnXmDR5zls+9dCeAZg==" />
</div>
<ul class="mytab_list">
<li><i class="tit">我的昵称</i><input name="txtNiceName" type="text" value="15171695474" maxlength="20" id="txtNiceName" class="s_input" placeholder="" /></li>
<li><i class="tit">&nbsp;</i>用户名只能包括汉字、英文字母、数字和下划线</li>
<li><i class="tit">&nbsp;</i><input type="button" onclick="updateName()" name="btn" value="修改" id="btn" class="s_btn btn_red" /></li>
<li><i class="tit">&nbsp;</i><span id="LabErr"></span></li>
</ul>
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="6C876674"/>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEdAAO8SPdUDpH0Q7nHjeqbvI7ld2C+OxfjpZOniBJbql7XdnRgTJ25FWigbeFr84Vgoxdi/cg2vS37N0KER6F1nyr1wKHztnXmDR5zls+9dCeAZg=="/>
</div>
<ul class="mytab_list">
<li><i class="tit">我的昵称</i><input name="txtNiceName" type="text" value="15171695474"
maxlength="20" id="txtNiceName" class="s_input"
placeholder=""/></li>
<li><i class="tit">&nbsp;</i>用户名只能包括汉字、英文字母、数字和下划线</li>
<li><i class="tit">&nbsp;</i><input type="button" onclick="updateName()" name="btn" value="修改"
id="btn" class="s_btn btn_red"/></li>
<li><i class="tit">&nbsp;</i><span id="LabErr"></span></li>
</ul>
</div>
</div>
</div>
@ -57,14 +63,13 @@
dataType: "json",
success: function (data) {
if (data.code == 200) {
if(data.data.nickName){
if (data.data.nickName) {
$("#txtNiceName").val(data.data.nickName);
}else{
} else {
$("#txtNiceName").val(data.data.username);
}
} else if (data.code == 1001) {
//未登录
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
@ -78,23 +83,26 @@
layer.alert('网络异常');
}
})
function updateName() {
var nickname = $("#txtNiceName").val();
if(nickname.isBlank()){
if (nickname.isBlank()) {
$("#LabErr").html("昵称不能为空");
return;
}
if(!nickname.isNickName()){
if (!nickname.isNickName()) {
$("#LabErr").html("昵称格式不正确");
return;
}
$.ajax({
type: "POST",
url: "/user/updateUserInfo",
data: {'nickName':nickname},
data: {'nickName': nickname},
dataType: "json",
success: function (data) {
if (data.code == 200) {
$.cookie('Authorization', data.data.token, {path: '/'});
window.location.href = '/user/setup.html';
} else if (data.code == 1001) {

View File

@ -59,7 +59,7 @@
dataType: "json",
success: function (data) {
if (data.code == 200) {
if(data.data.userSex === 0){
if(data.data.userSex === '0'){
$("input[name=sex]").eq(0).attr("checked",true);
}

View File

@ -59,9 +59,9 @@
}else{
$("#my_name").html(data.data.username+"<em class=\"ml10\">[修改]</em>");
}
if(data.data.userSex === 0){
if(data.data.userSex === '0'){
$("#my_sex").html("男<em class=\"ml10\">[修改]</em>");
}else if(data.data.userSex === 1){
}else if(data.data.userSex === '1'){
$("#my_sex").html("女<em class=\"ml10\">[修改]</em>");
}else{
$("#my_sex").html("请选择");

View File

@ -5,7 +5,7 @@
<groupId>com.java2nb</groupId>
<artifactId>novel</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<modules>
<module>novel-common</module>
<module>novel-front</module>