新建标签相关
This commit is contained in:
@@ -1,40 +1,38 @@
|
|||||||
|
|
||||||
|
|
||||||
let pageNum = null;
|
let pageNum = null;
|
||||||
let pageAll = null;
|
let pageAll = null;
|
||||||
let pageUrl= '/';
|
let pageUrl = '/';
|
||||||
|
|
||||||
function setpageNum(data,allList) {
|
function setpageNum(data, allList) {
|
||||||
var url = window.location.href;
|
var url = window.location.href;
|
||||||
console.log('当前url:'+url)
|
console.log('当前url:' + url)
|
||||||
if(url.indexOf('index') > 0){
|
if (url.indexOf('index') > 0) {
|
||||||
pageUrl= '/index';
|
pageUrl = '/index';
|
||||||
}
|
}
|
||||||
console.log('当前页码:'+data)
|
console.log('当前页码:' + data)
|
||||||
pageNum = parseInt(data) // pageNum
|
pageNum = parseInt(data) // pageNum
|
||||||
pageAll = parseInt(allList)
|
pageAll = parseInt(allList)
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#upPage").click(function () {
|
$("#upPage").click(function () {
|
||||||
console.log("点击 upPage");
|
console.log("点击 upPage");
|
||||||
console.log('当前页码:'+pageNum);
|
console.log('当前页码:' + pageNum);
|
||||||
if(pageNum > 1){
|
if (pageNum > 1) {
|
||||||
let page = pageNum - 1
|
let page = pageNum - 1
|
||||||
window.location.href=pageUrl + "?pageNum=" + page;
|
window.location.href = pageUrl + "?pageNum=" + page;
|
||||||
}else{
|
} else {
|
||||||
massage('已经是首页!','');
|
massage('已经是首页!', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#nextPage").click(function () {
|
$("#nextPage").click(function () {
|
||||||
console.log("点击 nextPage");
|
console.log("点击 nextPage");
|
||||||
console.log('当前页码:'+pageNum);
|
console.log('当前页码:' + pageNum);
|
||||||
console.log('当前pageAll页码:'+pageAll);
|
console.log('当前pageAll页码:' + pageAll);
|
||||||
if((pageNum + 1) <= pageAll){
|
if ((pageNum + 1) <= pageAll) {
|
||||||
let page = pageNum + 1
|
let page = pageNum + 1
|
||||||
window.location.href=pageUrl + "?pageNum=" + page;
|
window.location.href = pageUrl + "?pageNum=" + page;
|
||||||
}else{
|
} else {
|
||||||
massage('已经是尾页!','');
|
massage('已经是尾页!', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -42,21 +40,21 @@ $("#createNewDiccuss").click(function () {
|
|||||||
console.log("点击 createNewDiccuss");
|
console.log("点击 createNewDiccuss");
|
||||||
console.log(username);
|
console.log(username);
|
||||||
|
|
||||||
if(username && username!=null){
|
if (username && username != null) {
|
||||||
$('.ui.modal.createNewDiccuss')
|
$('.ui.modal.createNewDiccuss')
|
||||||
.modal('show')
|
.modal('show')
|
||||||
;
|
;
|
||||||
tinymce.init({
|
tinymce.init({
|
||||||
selector: '#discussionscontent',
|
selector: '#discussionscontent',
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
massage('您未登录,请先登录!','');
|
massage('您未登录,请先登录!', '');
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#newdiscussions").click(function(){
|
$("#newdiscussions").click(function () {
|
||||||
|
|
||||||
var token = $("meta[name='_csrf']").attr("content");
|
var token = $("meta[name='_csrf']").attr("content");
|
||||||
var header = $("meta[name='_csrf_header']").attr("content");
|
var header = $("meta[name='_csrf_header']").attr("content");
|
||||||
@@ -66,29 +64,29 @@ $("#newdiscussions").click(function(){
|
|||||||
var tag = $("#selectTag").val();
|
var tag = $("#selectTag").val();
|
||||||
// $("#discussionscontent").val();
|
// $("#discussionscontent").val();
|
||||||
console.log(tinyMCE.editors[0].getContent());
|
console.log(tinyMCE.editors[0].getContent());
|
||||||
var content =tinyMCE.editors[0].getContent();
|
var content = tinyMCE.editors[0].getContent();
|
||||||
console.log(title);
|
console.log(title);
|
||||||
console.log(content);
|
console.log(content);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/newdiscussions",
|
url: "/newdiscussions",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
title: title,
|
title: title,
|
||||||
content: content
|
content: content
|
||||||
}),
|
}),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
beforeSend: function(request) {
|
beforeSend: function (request) {
|
||||||
request.setRequestHeader(header, token); // 添加 CSRF Token
|
request.setRequestHeader(header, token); // 添加 CSRF Token
|
||||||
},
|
},
|
||||||
dataType: "JSON",
|
dataType: "JSON",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
if(data.flag){
|
if (data.flag) {
|
||||||
massage(title+',添加成功!','');
|
massage(title + ',添加成功!', '');
|
||||||
$('.ui.modal.createNewDiccuss').modal('hide');
|
$('.ui.modal.createNewDiccuss').modal('hide');
|
||||||
location.reload();
|
location.reload();
|
||||||
}else{
|
} else {
|
||||||
massage(data.msg,'');
|
massage(data.msg, '');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,47 +94,53 @@ $("#newdiscussions").click(function(){
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#newtags").click(function(){
|
$("#newtags").click(function () {
|
||||||
$('#createNewtagsDiv').show();
|
$('#createNewtagsDiv').show();
|
||||||
$('#createNewtagsBtn').show();
|
$('#createNewtagsBtn').show();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#commitnewtags").click(function(){
|
$("#commitnewtags").click(function () {
|
||||||
|
|
||||||
var header = $("meta[name='_csrf_header']").attr("content");
|
var header = $("meta[name='_csrf_header']").attr("content");
|
||||||
var token =$("meta[name='_csrf']").attr("content");
|
var token = $("meta[name='_csrf']").attr("content");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var name = $("#tagsname").val();
|
var name = $("#tagsname").val();
|
||||||
|
|
||||||
var tagColor = $("#tagColor").val();
|
var tagColor = $("#tagColor").val();
|
||||||
var tagIcon = $("#tagIcon").val();
|
var tagIcon = $("#tagIcon").val();
|
||||||
var parentTag = $("#parentTag").val();
|
var parentTag = $("#parentTag").val();
|
||||||
|
|
||||||
|
let coloricon = tagColor + ',' + tagIcon
|
||||||
|
var tagdescription = $("#tagdescription").val();
|
||||||
|
|
||||||
console.log(tagColor);
|
console.log(tagColor);
|
||||||
console.log(tagIcon);
|
console.log(tagIcon);
|
||||||
console.log(parentTag);
|
console.log(parentTag);
|
||||||
|
console.log(tagdescription);
|
||||||
console.log(name);
|
console.log(name);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/newtags",
|
url: "/newtags",
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
name: name,
|
name: name,
|
||||||
|
color: coloricon,
|
||||||
|
description: tagdescription,
|
||||||
|
parentId: parentTag
|
||||||
}),
|
}),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
beforeSend : function(xhr) {
|
beforeSend: function (xhr) {
|
||||||
xhr.setRequestHeader(header, token);
|
xhr.setRequestHeader(header, token);
|
||||||
},
|
},
|
||||||
dataType: "JSON",
|
dataType: "JSON",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
if(data.flag){
|
if (data.flag) {
|
||||||
massage(name+',添加成功!','');
|
massage(name + ',添加成功!', '');
|
||||||
$("#selectTag").html("");
|
$("#selectTag").html("");
|
||||||
}else{
|
} else {
|
||||||
massage(name+',添加失败!','');
|
massage(name + ',添加失败!', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -72,6 +72,11 @@
|
|||||||
<label>标签名</label>
|
<label>标签名</label>
|
||||||
<input type="text" placeholder="标签名" id="tagsname">
|
<input type="text" placeholder="标签名" id="tagsname">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="two fields">
|
||||||
|
<div class="field" id="createNewtagsDiv" style="display:none">
|
||||||
|
<label>描述</label>
|
||||||
|
<input type="text" placeholder="描述" id="tagdescription">
|
||||||
|
</div>
|
||||||
<div class="field" id="createNewtagsDiv" style="display:none">
|
<div class="field" id="createNewtagsDiv" style="display:none">
|
||||||
<label>父标签</label>
|
<label>父标签</label>
|
||||||
<select class="ui fluid dropdown" id="parentTag">
|
<select class="ui fluid dropdown" id="parentTag">
|
||||||
@@ -80,6 +85,7 @@
|
|||||||
</#list>
|
</#list>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="two fields">
|
<div class="two fields">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>选择颜色</label>
|
<label>选择颜色</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user