discussDetail.js 1.7 KB
Newer Older
doc_wei's avatar
doc_wei 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

layui.config({
	base: basePath,
	version: skyeyeVersion
}).extend({
    window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui'], function (exports) {
	winui.renderColor();
	layui.use(['form', 'layedit'], function (form) {
		var index = parent.layer.getFrameIndex(window.name);
	    var $ = layui.$,
	    	form = layui.form;
	    	layedit = layui.layedit;
	
	    var id = GetUrlParam("id");
	    var replyTemplate = $("#replyTemplate").html();

	    AjaxPostUtil.request({url: reqBasePath + "queryDiscussionById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) {
			$(".disheader").html(json.bean.title);
			$(".disdesc").html('' + json.bean.createName + '' + json.bean.createTime + '发布');
			$(".discontent").html(json.bean.content);

			showGrid({
				id: "disreplay",
				url: reqBasePath + "queryDiscussionReplyList",
				params: {discussionId: id},
doc_wei's avatar
doc_wei 已提交
27
				pagination: true,
doc_wei's avatar
doc_wei 已提交
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
				template: replyTemplate,
				method: "POST",
				ajaxSendLoadBefore: function(hdb) {},
				ajaxSendAfter:function(j) {
				}
			});
			matchingLanguage();
		}});
	    
	    form.on('submit(formAddBean)', function (data) {
	        if (winui.verifyForm(data.elem)) {
        		var params = {
					discussionId: id,
					content: $("#content").val(),
					replyId: "0"
        		};
    			AjaxPostUtil.request({url: reqBasePath + "createDiscussionReply", params: params, type: 'json', method: 'POST', callback: function (json) {
					winui.window.msg("提交成功", {icon: 1, time: 2000}, function() {
						location.reload();
					});
    			}});
	        }
	        return false;
	    });

		$("body").on("click", "#cancle", function() {
			parent.layer.close(index);
		});
		
	});
});