Browse Source

文章存草稿及预览之后就能删除

jack 8 years ago
parent
commit
6e70eba58d
4 changed files with 66 additions and 8 deletions
  1. 1 1
      articalIssue.html
  2. 1 1
      cmp-portal/articalIssue.html
  3. 32 3
      cmp-portal/js/articalIssue.js
  4. 32 3
      js/articalIssue.js

+ 1 - 1
articalIssue.html

116
							<em class="operateicon icon-draft"></em>
116
							<em class="operateicon icon-draft"></em>
117
							<p>存草稿</p>
117
							<p>存草稿</p>
118
						</li>
118
						</li>
119
						<li class="disableLi">
119
						<li class="disableLi" id="delete">
120
							<em class="operateicon icon-delete"></em>
120
							<em class="operateicon icon-delete"></em>
121
							<p>删除</p>
121
							<p>删除</p>
122
						</li>
122
						</li>

+ 1 - 1
cmp-portal/articalIssue.html

115
							<em class="operateicon icon-draft"></em>
115
							<em class="operateicon icon-draft"></em>
116
							<p>存草稿</p>
116
							<p>存草稿</p>
117
						</li>
117
						</li>
118
						<li class="disableLi">
118
						<li class="disableLi" id="delete">
119
							<em class="operateicon icon-delete"></em>
119
							<em class="operateicon icon-delete"></em>
120
							<p>删除</p>
120
							<p>删除</p>
121
						</li>
121
						</li>

+ 32 - 3
cmp-portal/js/articalIssue.js

301
		var ImageKey = $("#uploader").attr("data-id");
301
		var ImageKey = $("#uploader").attr("data-id");
302
		var newstitle = $("#newstitle").val();
302
		var newstitle = $("#newstitle").val();
303
		if(ImageKey == "") {
303
		if(ImageKey == "") {
304
			$(".imgtis").text("请上传封面图片");
304
			//$(".imgtis").text("请上传封面图片");
305
			$.MsgBox.Alert('提示', '请上传封面图片');
306
			return;
305
		} else {
307
		} else {
306
			$(".imgtis").text("");
308
			$(".imgtis").text("");
307
			imgflase = true;
309
			imgflase = true;
308
		}
310
		}
309
		if(newstitle == "") {
311
		if(newstitle == "") {
310
			$("#aboutTit span").text("请输入文章标题");
312
			//$("#aboutTit span").text("请输入文章标题");
313
			$.MsgBox.Alert('提示', '请输入文章标题');
314
			return;
311
		} else {
315
		} else {
312
			$("#aboutTit span").text("");
316
			$("#aboutTit span").text("");
313
			titleflase = true;
317
			titleflase = true;
457
				if(num == 1) {
461
				if(num == 1) {
458
					if(data.success) {
462
					if(data.success) {
459
						$("#hidearticleId").val(data.data);
463
						$("#hidearticleId").val(data.data);
464
						articleId = data.data;
460
						$.MsgBox.Alert("提示", "文章已保存草稿。");
465
						$.MsgBox.Alert("提示", "文章已保存草稿。");
461
						$("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
466
						$("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
467
						$("#delete").removeClass("disableLi").addClass("odele");
462
					}
468
					}
463
				}
469
				}
464
				if(num == 2) {
470
				if(num == 2) {
465
					if(data.success) {
471
					if(data.success) {
466
						$("#hidearticleId").val(data.data);
472
						$("#hidearticleId").val(data.data);
467
						articleId = data.data;
473
						articleId = data.data;
474
						$("#delete").removeClass("disableLi").addClass("odele");
468
						fa = true;
475
						fa = true;
469
					}
476
					}
470
					if(fa) {
477
					if(fa) {
482
		var tim = osr.substring(0, 4) + osr.substring(5, 7) + osr.substring(8, 10) + osr.substring(11, 13) + osr.substring(14, 16);
489
		var tim = osr.substring(0, 4) + osr.substring(5, 7) + osr.substring(8, 10) + osr.substring(11, 13) + osr.substring(14, 16);
483
		return tim;
490
		return tim;
484
	}
491
	}
485

492
	/*删除文章*/
493
	$(".operateBlock").on("click",".odele",function(){
494
		$.MsgBox.Confirm("提示","确认删除该文章?",newsDelet);
495
	})
496
	/*文章删除*/
497
    function newsDelet() {
498
    	$.ajax({
499
			"url" : "/ajax/article/deleteArticle",
500
			"type" : "POST",
501
			"dataType" : "json",
502
			"data": {
503
				"articleId": articleId
504
			},
505
			"success" : function($data) {							
506
				if ($data.success) {
507
					location.href = "cmp-articalList.html";	
508
				} 
509
			},
510
			"error":function(){
511
				$.MsgBox.Alert('提示','链接服务器超时')
512
			}
513
		})
514
	}
486
});
515
});

+ 32 - 3
js/articalIssue.js

302
		var ImageKey = $("#uploader").attr("data-id");
302
		var ImageKey = $("#uploader").attr("data-id");
303
		var newstitle = $("#newstitle").val();
303
		var newstitle = $("#newstitle").val();
304
		if(ImageKey == "") {
304
		if(ImageKey == "") {
305
			$(".imgtis").text("请上传封面图片");
305
			//$(".imgtis").text("请上传封面图片");
306
			$.MsgBox.Alert('提示', '请上传封面图片');
307
			return;
306
		} else {
308
		} else {
307
			$(".imgtis").text("");
309
			$(".imgtis").text("");
308
			imgflase = true;
310
			imgflase = true;
309
		}
311
		}
310
		if(newstitle == "") {
312
		if(newstitle == "") {
311
			$("#aboutTit span").text("请输入文章标题");
313
			$.MsgBox.Alert('提示', '请输入文章标题')
314
			//$("#aboutTit span").text("请输入文章标题");
315
			return;
312
		} else {
316
		} else {
313
			$("#aboutTit span").text("");
317
			$("#aboutTit span").text("");
314
			titleflase = true;
318
			titleflase = true;
458
				if(num == 1) {
462
				if(num == 1) {
459
					if(data.success) {
463
					if(data.success) {
460
						$("#hidearticleId").val(data.data);
464
						$("#hidearticleId").val(data.data);
465
						articleId = data.data;
461
						$.MsgBox.Alert("提示", "文章已保存草稿。");
466
						$.MsgBox.Alert("提示", "文章已保存草稿。");
462
						$("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
467
						$("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
468
						$("#delete").removeClass("disableLi").addClass("odele");
463
					}
469
					}
464
				}
470
				}
465
				if(num == 2) {
471
				if(num == 2) {
466
					if(data.success) {
472
					if(data.success) {
467
						$("#hidearticleId").val(data.data);
473
						$("#hidearticleId").val(data.data);
468
						articleId = data.data;
474
						articleId = data.data;
475
						$("#delete").removeClass("disableLi").addClass("odele");
469
						fa = true;
476
						fa = true;
470
					}
477
					}
471
					if(fa) {
478
					if(fa) {
483
		var tim = osr.substring(0, 4) + osr.substring(5, 7) + osr.substring(8, 10) + osr.substring(11, 13) + osr.substring(14, 16);
490
		var tim = osr.substring(0, 4) + osr.substring(5, 7) + osr.substring(8, 10) + osr.substring(11, 13) + osr.substring(14, 16);
484
		return tim;
491
		return tim;
485
	}
492
	}
486

493
	/*删除文章*/
494
	$(".operateBlock").on("click",".odele",function(){
495
		$.MsgBox.Confirm("提示","确认删除该文章?",newsDelet);
496
	})
497
	/*文章删除*/
498
    function newsDelet() {
499
    	$.ajax({
500
			"url" : "/ajax/article/deleteArticle",
501
			"type" : "POST",
502
			"dataType" : "json",
503
			"data": {
504
				"articleId": articleId
505
			},
506
			"success" : function($data) {							
507
				if ($data.success) {
508
					location.href = "articalList.html";	
509
				} 
510
			},
511
			"error":function(){
512
				$.MsgBox.Alert('提示','链接服务器超时')
513
			}
514
		})
515
	}
487
});
516
});