From 6d5df8e2a99fd9767bce96960cd7bbe840d5f6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=AF=E7=9C=9F?= <305389431@qq.com> Date: Fri, 11 Sep 2020 18:24:28 +0800 Subject: [PATCH 1/3] fix sync blog to platform --- WebContent/index.html | 5 +++- WebContent/js/main.js | 52 +++++++++++++++++++++++++++------- src/action/MoveBlogAction.java | 14 ++++++--- 3 files changed, 56 insertions(+), 15 deletions(-) diff --git a/WebContent/index.html b/WebContent/index.html index 4cc9744..9f2e76a 100644 --- a/WebContent/index.html +++ b/WebContent/index.html @@ -64,8 +64,11 @@ - + ', + /*'',*/ + '', '', '', '' ].join('\n'); @@ -205,6 +207,7 @@ var Api = (function(conf, $) { link : url, user_catalog : obj.user_catalog, sys_catalog : obj.sys_catalog, + circle_catalog : obj.circle_catalog, reprint : obj.reprint, priva : obj.priva }); @@ -242,7 +245,8 @@ $(function() { $input_file = $('input[name="file"]'), $all_sys = $('#all_sys_catalog'), - $all_user = $('#all_user_catalog'); + $all_user = $('#all_user_catalog'), + $all_circle = $('#all_circle_catalog'); // 查询 login user 信息 Api.user(function(user) { @@ -291,12 +295,12 @@ $(function() { // 爬取博客列表 $submit.on('click', function() { - if (!Api.logined()) { + /*if (!Api.logined()) { if (confirm('OSChina未授权,需刷新页面,并重新登录!')) { location.reload(); } return; - } + }*/ var is_upload = !$input_file.attr('disabled') && $input_file.val().length > 0; if (is_upload) { @@ -325,6 +329,7 @@ $(function() { function(data) { var options = ""; var user_options = ""; + var circle_options = ""; $.each(data.blog_sys_catalog_list, function( optionindex, option) { options = ""; - $('.person_select_box').append(user_options); + $('.person_select_box').append(circle_options); + }); + $.each(data.circle_catalog_list, function( + optionindex, user_option) { + user_options = ""; + $('.circle_select_box').append(user_options); }); }); @@ -381,6 +393,7 @@ $(function() { 'url' : '', 'user_catalog' : '', 'sys_catalog' : '', + 'circle_catalog' : '', 'reprint' : '', 'priva' : '' }; @@ -389,6 +402,8 @@ $(function() { ".person_select_box").val(); obj.sys_catalog = $(this).parent().next().children( ".select_box").val(); + obj.circle_catalog = $(this).parent().next().children( + ".circle_select_box").val(); obj.reprint = $('.reprint').val(); obj.priva = $('.private').val(); return obj; @@ -457,12 +472,13 @@ $(function() { function(data) { var options = ""; var user_options = ""; - $.each(data.blog_sys_catalog_list, function( + var circle_options = ""; + /*$.each(data.blog_sys_catalog_list, function( optionindex, option) { options = ""; $('.select_box').append(options); - }); + });*/ $.each(data.blog_user_catalog_list, function( optionindex, user_option) { user_options = ""; + $('.circle_select_box') + .append(circle_options); + }); }); } @@ -499,4 +523,12 @@ $(function() { }); }); + + $all_circle.on('change', function() { + var num = $all_circle.val(); + $('.circle_select_box').each(function() { + $(this).val(num); + }); + + }); }); \ No newline at end of file diff --git a/src/action/MoveBlogAction.java b/src/action/MoveBlogAction.java index 81fc38a..8986937 100644 --- a/src/action/MoveBlogAction.java +++ b/src/action/MoveBlogAction.java @@ -48,9 +48,15 @@ public class MoveBlogAction extends HttpServlet { String link = request.getParameter("link"); String user_catalog = request.getParameter("user_catalog"); - String sys_catalog = request.getParameter("sys_catalog"); + //String sys_catalog = request.getParameter("sys_catalog"); + String circle_catalog = request.getParameter("circle_catalog"); String type = request.getParameter("reprint"); String privacy = request.getParameter("priva"); + + if(StringUtils.isBlank(circle_catalog) && !StringUtils.isNumeric(circle_catalog)){//id获取失败 + JsonMsg.json_out(JsonMsg.jsonError("请选择专区"),response); + return; + } if(StringUtils.isBlank(link)){//id获取失败 JsonMsg.json_out(JsonMsg.jsonError("link获取失败"),response); @@ -61,9 +67,9 @@ public class MoveBlogAction extends HttpServlet { user_catalog = "0"; } - if(StringUtils.isBlank(sys_catalog)){ + /*if(StringUtils.isBlank(sys_catalog)){ sys_catalog = "430381"; - } + }*/ if(StringUtils.isBlank(type)){ type = "1"; @@ -110,7 +116,7 @@ public class MoveBlogAction extends HttpServlet { * as_top=0; // false 非置顶:0、置顶:1 0 */ blog.setCatalog(user_catalog); - blog.setClassification(sys_catalog); + blog.setClassification(circle_catalog); blog.setType(type); blog.setPrivacy(privacy); -- Gitee From f194cfdca27da8f3885e86713e13ac4caac2b84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=AF=E7=9C=9F?= <305389431@qq.com> Date: Fri, 11 Sep 2020 18:30:53 +0800 Subject: [PATCH 2/3] fix sync blog to platform --- WebContent/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebContent/js/main.js b/WebContent/js/main.js index 69dbed1..5b654a1 100644 --- a/WebContent/js/main.js +++ b/WebContent/js/main.js @@ -7,7 +7,7 @@ }; */ -var devMode=true; +var devMode=false; /*Online Config * var Conf = { 'host' : 'http://www.oschina.net', -- Gitee From 4a7358958da2c9f2425e5d7874ede88e10bc7add Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=AF=E7=9C=9F?= <305389431@qq.com> Date: Fri, 11 Sep 2020 18:32:58 +0800 Subject: [PATCH 3/3] fix sync blog to platform --- WebContent/js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WebContent/js/main.js b/WebContent/js/main.js index 5b654a1..8e49ae4 100644 --- a/WebContent/js/main.js +++ b/WebContent/js/main.js @@ -295,12 +295,12 @@ $(function() { // 爬取博客列表 $submit.on('click', function() { - /*if (!Api.logined()) { + if (!Api.logined()) { if (confirm('OSChina未授权,需刷新页面,并重新登录!')) { location.reload(); } return; - }*/ + } var is_upload = !$input_file.attr('disabled') && $input_file.val().length > 0; if (is_upload) { -- Gitee