lijunjie_branch
lee 1 year ago
parent 8eb0d9f9c9
commit 1a6de0a31e

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ForestBlog.iml" filepath="$PROJECT_DIR$/.idea/ForestBlog.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -5,8 +5,7 @@
</component>
<component name="ChangeListManager">
<list default="true" id="690df2e4-065b-4e1e-9ecc-de15c4a25040" name="更改" comment="">
<change beforePath="$PROJECT_DIR$/doc" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/webapp/resource/assets/js/back.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/webapp/resource/assets/js/back.js" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -16,28 +15,18 @@
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 7
}]]></component>
<component name="ProjectId" id="2pkoas9hD1WLgDh1lyVWy1g01SE" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.ShowReadmeOnStart": "true",
"git-widget-placeholder": "develop",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "D:/Git/ForestBlog",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="SharedIndexes">
<attachedChunks>
<set>
@ -55,6 +44,7 @@
<option name="presentableId" value="Default" />
<updated>1733319500475</updated>
<workItem from="1733319501582" duration="660000" />
<workItem from="1734317927648" duration="308000" />
</task>
<servers />
</component>

@ -1,3 +1,4 @@
// 检查全选框是否被选中,并根据状态设置其他复选框的选中状态
function DoCheck() {
var ch = document.getElementsByName("ids");
if (document.getElementById("allSelect").checked == true) {
@ -11,25 +12,25 @@ function DoCheck() {
}
}
// 确认删除操作弹出确认对话框根据用户选择返回true或false
function confirmDelete() {
var msg = "您确定要删除吗?";
if (confirm(msg)==true){
if (confirm(msg) == true) {
return true;
}else{
} else {
return false;
}
}
//获取相对路径
function getPath(){
// 获取当前页面的相对路径
function getPath() {
var pathName = document.location.pathname;
var index = pathName.substr(1).indexOf("/");
var result = pathName.substr(0,index+1);
var result = pathName.substr(0, index + 1);
return result;
}
//显示和隐藏row-actions
// 当鼠标进入dashboard-comment-wrap时显示row-actions离开时隐藏
$(".dashboard-comment-wrap").mouseenter(function () {
$(this).find(".row-actions").show();
})
@ -37,118 +38,115 @@ $(".dashboard-comment-wrap").mouseleave(function () {
$(this).find(".row-actions").hide();
})
//删除评论
// 删除评论先确认删除然后发送AJAX请求删除评论并刷新页面
function deleteComment(id) {
if(confirmDelete()==true){
if (confirmDelete() == true) {
$.ajax({
async: false,
type: "POST",
url:'/admin/comment/delete/'+id,
contentType : "application/x-www-form-urlencoded; charset=utf-8",
url: '/admin/comment/delete/' + id,
contentType: "application/x-www-form-urlencoded; charset=utf-8",
dataType: "text",
complete:function () {
complete: function () {
window.location.reload();
}
})
}
}
//添加草稿
// 添加草稿检查文章内容和标题是否为空然后发送AJAX请求添加草稿并刷新页面
function insertDraft() {
if($("#articleContent").val!=""&&$("#articleTitle").val()!="") {
if ($("#articleContent").val != "" && $("#articleTitle").val() != "") {
$.ajax({
async: false,
type: "POST",
url:'/admin/article/insert',
contentType : "application/x-www-form-urlencoded; charset=utf-8",
url: '/admin/article/insert',
contentType: "application/x-www-form-urlencoded; charset=utf-8",
dataType: "text",
complete:function () {
complete: function () {
window.location.reload();
}
})
})
}
}
//删除文章
// 删除文章先确认删除然后发送AJAX请求删除文章并刷新页面
function deleteArticle(id) {
if(confirmDelete()==true){
if (confirmDelete() == true) {
$.ajax({
async: false,
type: "POST",
url:'/admin/article/delete/'+id,
contentType : "application/x-www-form-urlencoded; charset=utf-8",
url: '/admin/article/delete/' + id,
contentType: "application/x-www-form-urlencoded; charset=utf-8",
dataType: "text",
complete:function () {
complete: function () {
window.location.reload();
}
})
}
}
//查询文章
// 查询文章,提交表单到搜索页面
function queryArticle() {
//提交form
$("#articleForm").attr("action", "/admin/article/search");
$("#articleForm").submit();
}
//批量删除文章
// 批量删除文章先确认删除然后获取选中的文章ID发送AJAX请求批量删除并刷新页面
function confirmDeleteArticleBatch() {
if(confirmDelete()==true){
var text = $("input:checkbox[name='ids']:checked").map(function(index,elem) {
if (confirmDelete() == true) {
var text = $("input:checkbox[name='ids']:checked").map(function (index, elem) {
return $(elem).val();
}).get().join(',');
$.ajax({
async: false,
type: "POST",
url:'/admin/article/deleteBatch',
data:{ids:text},
contentType : "application/x-www-form-urlencoded; charset=utf-8",
url: '/admin/article/deleteBatch',
data: { ids: text },
contentType: "application/x-www-form-urlencoded; charset=utf-8",
dataType: "text",
complete:function () {
complete: function () {
window.location.reload();
}
})
}
}
//退出登录
// 退出登录发送AJAX请求退出登录并刷新页面
function logout() {
$.ajax({
async: false,
type: "POST",
url:'/admin/logout',
contentType : "application/x-www-form-urlencoded; charset=utf-8",
url: '/admin/logout',
contentType: "application/x-www-form-urlencoded; charset=utf-8",
dataType: "text",
complete:function () {
complete: function () {
window.location.reload();
}
})
}
//添加用户检查用户名是否存在
// 添加用户时检查用户名是否存在
function checkUserName() {
var result;
$.ajax({
async: false,//同步,待请求完毕后再执行后面的代码
async: false, //同步,待请求完毕后再执行后面的代码
type: "POST",
url: '/admin/user/checkUserName',
contentType: "application/x-www-form-urlencoded; charset=utf-8",
data: {"username": $("#userName").val(), "id": $("#userId").val()},
data: { "username": $("#userName").val(), "id": $("#userId").val() },
dataType: "json",
success: function (data) {
//用户名存在
if(data.code==1) {
if (data.code == 1) {
$("#userNameTips").html(data.msg);
result=1;
result = 1;
}
//用户名不存在
if(data.code==0) {
if (data.code == 0) {
$("#userNameTips").html(data.msg);
result=0;
result = 0;
}
},
error: function () {
@ -158,26 +156,26 @@ function checkUserName() {
return result;
}
//添加用户检查电子邮箱是否存在
// 添加用户检查电子邮箱是否存在
function checkUserEmail() {
var result;
$.ajax({
async: false,//同步,待请求完毕后再执行后面的代码
async: false, //同步,待请求完毕后再执行后面的代码
type: "POST",
url: '/admin/user/checkUserEmail',
contentType: "application/x-www-form-urlencoded; charset=utf-8",
data: {"email": $("#userEmail").val(), "id": $("#userId").val()},
data: { "email": $("#userEmail").val(), "id": $("#userId").val() },
dataType: "json",
success: function (data) {
//用户名存在
if(data.code==1) {
//电子邮箱存在
if (data.code == 1) {
$("#userEmailTips").html(data.msg);
result=1;
result = 1;
}
//用户名不存在
if(data.code==0) {
//电子邮箱不存在
if (data.code == 0) {
$("#userEmailTips").html(data.msg);
result=0;
result = 0;
}
},
error: function () {
@ -187,29 +185,28 @@ function checkUserEmail() {
return result;
}
//添加用户验证和编辑用户验证
// 使用layui框架进行表单验证
layui.use(['form', 'layedit', 'laydate'], function () {
var form = layui.form, layer = layui.layer;
form.verify({
// 用户名验证规则
userName: function (value) {
if (value.length > 12 || value.length < 4) {
return "用户名必须4到12位";
}
if(checkUserName()==1) {
if (checkUserName() == 1) {
return "用户名已存在";
}
},
// 电子邮箱验证规则
userEmail: function () {
if(checkUserEmail()==1) {
if (checkUserEmail() == 1) {
return "电子邮箱已存在";
}
}
});
// 表单提交事件
form.on('submit(demo1)', function (data) {
return true;
});

Loading…
Cancel
Save