mirror of https://github.com/halo-dev/halo
👽 后台登录保存登录名到cookie
parent
c6a4b2de20
commit
5d46efcbec
|
@ -157,10 +157,6 @@ public class PostController extends BaseController {
|
||||||
public JsonResult pushPost(@ModelAttribute Post post, @RequestParam("cateList") List<String> cateList, @RequestParam("tagList") String tagList, HttpSession session) {
|
public JsonResult pushPost(@ModelAttribute Post post, @RequestParam("cateList") List<String> cateList, @RequestParam("tagList") String tagList, HttpSession session) {
|
||||||
User user = (User) session.getAttribute(HaloConst.USER_SESSION_KEY);
|
User user = (User) session.getAttribute(HaloConst.USER_SESSION_KEY);
|
||||||
String msg = "发表成功";
|
String msg = "发表成功";
|
||||||
//判断文章路径是否已经存在
|
|
||||||
if (null != postService.findByPostUrl(post.getPostUrl(), HaloConst.POST_TYPE_POST)) {
|
|
||||||
return new JsonResult(0, "该文章路径已存在!");
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
//提取摘要
|
//提取摘要
|
||||||
int postSummary = 50;
|
int postSummary = 50;
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#login-name").val(localStorage.getItem("loginName"));
|
||||||
|
});
|
||||||
function btn_login() {
|
function btn_login() {
|
||||||
$('#btn-login').button('loading');
|
$('#btn-login').button('loading');
|
||||||
var name = $("#login-name").val();
|
var name = $("#login-name").val();
|
||||||
|
@ -15,6 +18,7 @@ function btn_login() {
|
||||||
'loginPwd': pwd
|
'loginPwd': pwd
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
localStorage.setItem('loginName', $("#login-name").val());
|
||||||
if(data.code==1){
|
if(data.code==1){
|
||||||
$.toast({
|
$.toast({
|
||||||
text: data.msg,
|
text: data.msg,
|
||||||
|
|
Loading…
Reference in New Issue