publish.html 34.5 KB
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 27 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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>Yoho!Buy运营平台</title>
    <script src="/pfcms/js/include.js"></script>
    <script src="/pfcms/js/ajaxfileupload.js"></script>
    <script src="/pfcms/js/jquery.imageUpload.js"></script>
    <script charset="utf-8" src="/pfcms/ueditor/ueditor.config.js"></script>
    <script charset="utf-8" src="/pfcms/ueditor/ueditor.all.min.js"></script>
    <!--建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/pfcms/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script charset="utf-8" src="/pfcms/ueditor/ueditor.yoho.js"></script>
    <style>
        .btn-long {
            width: 120px;
            height: 37px;
            line-height: 37px;
            font-size: 15px;
            color: white;
            border-radius: 5px;
            display: inline-block;
            cursor: pointer;
            text-align: center;
        }
        .btn-long:hover {
            opacity: 0.9;
        }

        .tag{
            display: block;
            float: left;
            padding: 2px 5px;
            background: #1caf9a;
            margin-right: 5px;
            margin-bottom: 5px;
            margin-top: 5px;
            -moz-border-radius: 2px;
            -webkit-border-radius: 2px;
            border-radius: 2px;
            font-size: 13px;
        }
        .goodTag{
            display: block;
            float: right;
            font-size: 18px;
        }

    </style>


</head>
<body class="easyui-layout "  fit="true">
<div  region="north" style="height: 100px;">
    <script>
        document.write(addHead('种草社区管理', '种草长文章发布'));
    </script>

</div>
<div region="center" id="labelGroupList" style="margin-left: 20px;width: 100%">
    <div id="tt" class="easyui-layout"  style="margin-right:20px;height:100%;overflow-y: scroll">
        <form name="publishArticleForm" id="publishArticleForm" method="post"   >
            <input id="sort" name="sort" value="2" hidden>
            <div style="margin-top: 20px;margin-left: 30px">
                <table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">



                    <tr style="height: 60px">
                        <td style="width:100%; word-wrap:break-word;" >
                            <span style="color:red">*</span><label style="font-size: 14px;">标题</label> <br>

                            <div style="width:600px; word-wrap:break-word;float: left;position: relative" >
                                <input id="title" name="title" style="width:600px "  class="easyui-textbox" />
                            </div>

                            <!--<div style="clear: both;"> <span id="content-count">0</span>/500</div>-->
                        </td>
                    </tr>

                    <tr style="height: 60px">
                        <td style="width:100%; word-wrap:break-word;" >
                            <label style="font-size: 14px;">副标题</label> <br>

                            <div style="width:600px; word-wrap:break-word;float: left;position: relative" >
                                <input id="subtitle" name="subtitle" style="width:600px "  class="easyui-textbox" />
                                <span> &nbsp非必填项,填写后更易于曝光</span>
                            </div>

                            <!--<div style="clear: both;"> <span id="content-count">0</span>/500</div>-->
                        </td>
                    </tr>

                    <tr style="height: 60px">
                        <td style="width:100%;">
                            <label style="font-size: 14px;">版权声明</label> <br>
                            <input id="copyright" name="copyright" class="easyui-combobox" style="width:600px; "/><br>
                        </td>
                    </tr>

                    <tr style="height: 60px">
                        <td style="width:100% ">
                            <div  style="float: left;width:700px;"    >
                                <span style="color:red">*</span><label style="font-size: 14px;">选择用户</label>  <br>
                                <input id="articleUid" name="authorUid" style="width:600px "  class="easyui-textbox" />
                                <a  id="userBotton" class="btn btn-small"   style="font-size: 18px; " >确认</a>
                                <br>
                                <span style="color:red">&nbsp必填项,选择某个用户身份后,才能发布</span>
                            </div>
                            <div id="userInfo"  style="float: left;margin-left: 30px;">
                            </div>
                        </td>
                    </tr>

                    <tr style="height: 60px">
                        <td style="width:100% ">
                            <label style="font-size: 14px;">正文内容</label> <br>
                            <div  style="float: left;width:700px;"    >
                                <textarea id="content" name="content" type="text/plain" style="width:1024px;height:500px;"></textarea>
                            </div>
                        </td>
                    </tr>
                            <tr style="height: 60px">
                            <td>
                            <span style="color:red">*</span><label>封面</label> <br>
                                <input id="coverImage" name="articleImages" hidden>
                            <div id="imageUpload" style="float:left;">
                                </div>
                                    <div>
                                    <div style="float:left;">
                                        <span style=" margin-left: 10px; color: red">1. 请上传 3:4/4:3/1:1 的图片,优质清晰的封面有利于推荐</span></br>
                                        <span style=" margin-left: 10px; color: red">2. 请上传500K以内的图片,请勿上传像素过高的图片</span>
                                    </div>
                            </div>
                            </td>
                            </tr>


                            <tr style="height: 60px">
                                <td>
                                    <div class="form-group">
                                            <div style="margin-top:20px;">
                                              <input type="checkbox"  id = "appurl" value="1"/>链接<span style="color:red">(直接配置的H5或其他类型的内容落地页)</span>
                                        </div>
                                        <div class="col-sm-6">
                                            <input  name="actionUrl" id="actionUrl" style="width:600px "  class="easyui-textbox" />
                                            <button type="button" class="btn btn-info" id="addAppUrl">添加链接</button>
                                            <button type="button" class="btn btn-default" id="clearAppUrl">清除链接</button>
                                            <p style="color:#999">注:链接中不能有英文单引号 </p>

                                        </div>

                                    </div>
                                </td>
                            </tr>



                    <tr style="height: 60px">
                        <td style="width:100%;">
                            <label style="font-size: 14px;">选择标签</label> <br>
                            <input id="labelId" name="labelId" class="easyui-combobox" style="width:600px; "/><br>
                            <span style="color:red">至多添加5个标签,非必填项</span><label></label>

                            <input id="labelIds" name="labelIds" hidden="hidden"/>
                            <div id="labelList">
                                
                            </div>
                        </td>
                    </tr>

                    <tr style="height: 60px">
                        <td style="width:100%;">
                            <label style="font-size: 14px;">选择话题</label> <br>
                            <input id="topicGroupId" name="topicGroupId" class="easyui-combobox" style="width:300px; "/>
                            <input id="topicId" name="topicId" class="easyui-combobox" style="width:300px; "/><br>
                            <span style="color:red">至多添加1个话题,非必填项</span><label></label>

                            <input id="topicIds" name="topicIds" hidden="hidden"/>
                            <div id="topicList">

                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td  valign="bottom">
                            <input  id="draftBotton" class="btn btn-primary"   style="font-size: 16px; height: 36px;" value="保存到草稿箱"/>
                            <input  id="timerBotton" class="btn btn-primary"   style="font-size: 16px; height: 36px;" value="定时发布"/>
                            <input  id="subBotton" class="btn btn-primary"   style="font-size: 16px; margin-left: 30px; height: 36px;" value="立即发布"/>
                            <span style="color:red">*运营平台发布的内容,均免审核,直接发布。</span><label></label><br>
                        </td>
                    </tr>
                </table>
            </div>
        </form>

    </div>

</div>



</body>
<script>
    var checkedItems = [];
    var checkedItemsObj = {};
    var searchType = 1;
    var checkType = 1;
    $(function () {



        UE.delEditor("content");
        var ue = UE.getEditor('content', {
            autoHeightEnabled: false,
            autoFloatEnabled: false,
            initialFrameWidth : "90%",
            initialFrameHeight : 400,
            removeFormatTags:'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,sub,sup,tt,u,var',
            toolbars: [[
                  'source', '|', 'undo', 'redo', '|','formatmatch','removeformat',
                    'bold', 'italic', 'underline','strikethrough','horizontal','|','paragraph',     'rowspacingtop',
                'rowspacingbottom', '|',
                'insertorderedlist', 'insertunorderedlist', 'blockquote','|',
                  'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
                'imagenone', 'imageleft', 'imageright', 'imagecenter', '|', 'simpleupload', 'insertimage', 'help','fullscreen'
            ]],
            elementPathEnabled : false,
            catchRemoteImageEnable:false,
            enableAutoSave:false,
            enableContextMenu: false,
            retainOnlyLabelPasted:true,
            pasteplain:true,
            'filterTxtRules' : function(){
               function transP(node){
                   node.tagName = 'p';
                   node.setStyle();
               }
               return {
                   //直接删除及其字节点内容
                   '-' : 'script style object iframe embed input select',
                   'p': {$:{}},
                   'br':{$:{}},
                   'div':{'$':{}},
                   'li':{'$':{}},
                   'h1':{'$':{}},
                   'h2':{'$':{}},
                   'h3':{'$':{}},
                   'h4':{'$':{}},
                   'h5':{'$':{}},
                   'h6':{'$':{}},
                   'ol':{'$':{}},
                   'ul':{'$':{}},
                   'hr':{'$':{}},
                   'strong':{'$':{}},
                   'caption':transP,
                   'th':transP,
                   'tr':transP,
                   'td':function(node){
                       //没有内容的td直接删掉
                       var txt = !!node.innerText();
                       if(txt){
                           node.parentNode.insertAfter(UE.uNode.createText(' &nbsp; &nbsp;'),node);
                       }
                       node.parentNode.removeChild(node,node.innerText())
                   }
               }
            }(),
            maximumWords:100000,
        });
        UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
        UE.Editor.prototype.getActionUrl = function(action) {
            if (action == 'uploadimage' || action == 'uploadfile') {
                return serverContextPath + "/fileupload/uploadFile4Editor.do?bucket=grassImg";
            } else {
                return this._bkGetActionUrl.call(this, action);
            }
        };
        $("#addImage").linkbutton({
            iconCls : "icon-search",
            onClick : function() {

            }
        });

        $("#copyright").combobox({
            valueField : "value",
            textField : "text",
            editable : false,
            required:false,
            prompt: "选择版权形式",
            data:[{text:"原创",value:"1"},{text:"第三方授权",value:"2"},{text: "未授权", value: "3"},
                {text: "其他", value: "4"}]
        });


        $("#userBotton").linkbutton({
            iconCls : "icon-search",
            onClick : function() {
                //发送请求
                $.ajax({
                    type: "POST",
                    url: serverContextPath + "/grassArticle/getUserInfo",     //提交到后端的url
                    dataType: 'json',
                    data:{
                        uid : $("#articleUid").textbox("getValue")
                    },
                    success: function (result) {
                        if(result.code == 200) {
                            if(result.data !=null && result.data !=''){
                                var headIco = result.data.headIco.substring(0, result.data.headIco.indexOf("?"));
                                var html = '';
                                html += "<span style='font-size: 18px;'>&nbsp&nbsp<img src='"+headIco+"' width='60px;' height='60px;'></span>&nbsp&nbsp&nbsp&nbsp";
                                html += "<span style='font-size: 15px;'>&nbsp&nbsp<label>"+result.data.nickName+"</label></span>";
                                $("#userInfo").html(html);
                            }else{
                                var html = '<span style="color:red;font-size: 15px;">获取用户信息失败,请检查uid输入是否正确</span>';
                                $("#userInfo").html(html);
                            }
                        }
                        else {
                            var html = '<span style="color:red;font-size: 15px;">获取用户信息失败,请稍后重试</span>';
                            $("#userInfo").html(html);
                        }

                    }
                });
            }
        });

        $("#timerBotton").linkbutton({
            iconCls : "icon-search",
            onClick : function() {
                getTimeDialog();
            }
        });

        $(document).on("click", "#addAppUrl", function () {
            getAppUrlDialog();
        });
        $(document).on("click", "#clearAppUrl", function () {
            $("#actionUrl").val("");
        });

        $("#articleUid").textbox({
            required: true,
            missingMessage: "发布用户不能为空",
            prompt: "请输入发布用户",
            onChange: function () {
            }
        });


        $("#actionUrl").textbox({
            required: false,
            prompt: "APP内容链接",
            readonly: true
        });


        $("#title").textbox({
            required: true,
            missingMessage: "请输入80字以内的标题",
            prompt: "请输入80字以内的标题",
            validType:"length[1,80]",
            onChange: function () {
            }
        });

        $("#subtitle").textbox({
            required: false,
            missingMessage: "请输入120字以内的副标题",
            prompt: "请输入120字以内的副标题",
            validType:"length[0,120]",
            onChange: function (data) {
            }
        });

        $("#labelId").combobox({
            prompt: "请选择标签",
            required: false,
            selectOnNavigation : true,
            valueField: 'id',
            textField: 'labelName',
            multiple:true,
            url : serverContextPath + "/grassLabelManage/getAllGrassLabelInfo",
            loadFilter: function (data) {
                return defaultLoadFilter(data);
            },
            onChange:function (data) {
                var arr = $(this).combobox("getValues");
                var textarr = $(this).combobox("getData");
                if(arr.length > 5 ){
                    $(this).combobox("unselect",arr[arr.length-1]);
                    // $.messager.alert("提示","标签最多只能选择5个", "info");
                    arr = $(this).combobox("getValues");
                }
                var labelList='';
                debugger
                for (var i=0; i<arr.length;i++){
                    var text = '';
                    for (var j=0; j< textarr.length;j++){
                        if(arr[i] == textarr[j].id){
                            text=textarr[j].labelName;
                        }
                    }
                    labelList+='<span class="tag"><span>'+text+'</span><a href="#" class="labelTag" data-index="'+i+'">x</a></span>&nbsp&nbsp&nbsp'
                }
                $("#labelList").html(labelList);
            }
        });

        $("#imageUpload").imageUpload({
            width: 171,
            height: 120,
            realInputName: "url",
            uploadInputName: "files",
            url: serverContextPath + '/fileupload/uploads',
            queryParams: {
                bucket: "grassImg"
            },
            onBeforeSubmit: function () {
                debugger;
                var oobj = $(this).find("input[type='file']");
                var files = oobj[0].files;

                for(var i=0; i<files.length;i++){
                    var obj = files[i];
                    if(obj!=null && obj!=''){
                        debugger
                        if(obj.name.substring(obj.name.lastIndexOf(".")).toLowerCase() == '.png'){
                            $.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;});
                            return false;
                        }
                        if(obj.type.toLowerCase() == 'image/png'){
                            $.messager.alert("提示","不允许上传png格式的图片", "info", function(){return false;});
                            return false;
                        }
                    }
                }
                $.messager.progress({
                    title: "正在执行",
                    msg: "正在执行,请稍后...",
                    interval: 500,
                    text: ""
                });
            },
            filterFileName: function (data) {
                debugger;
                if (!data || data.code != 200) {
                    $.messager.progress("close");
                    $.messager.alert("错误", data.message);
                    return "";
                }
                return data.data;
            },
            onLoadSuccess: function (data) {
                $.messager.progress("close");

                return false;
            }
        });

        $("#topicGroupId").combobox({
            prompt: "选择话题分组",
            required: false,
            selectOnNavigation : false,
            valueField: 'id',
            textField: 'groupName',
            url : serverContextPath + "/topicGroupManage/getAllTopicGroupInfo",
            loadFilter: function (data) {
                return defaultLoadFilter(data);
            },
            onChange:function (data) {
                $('#topicId').combobox('reload',serverContextPath + "/grassTopicManage/grassTopicByGroupId?groupId="+data);

                // 清空业务线
                $("#topicId").combobox("setValue",'');
            }
        });

        $("#topicId").combobox({
            prompt: "选择话题",
            required: false,
            selectOnNavigation : true,
            valueField: 'id',
            textField: 'topicName',
            url : serverContextPath + "/grassTopicManage/grassTopicByGroupId",
            loadFilter: function (data) {
                return defaultLoadFilter(data);
            },
            onChange:function (data) {
                var arr = $(this).combobox("getValue");
                var textarr = $(this).combobox("getData");
                var html='';
                debugger
                var text = '';
                for (var j=0; j< textarr.length;j++){
                    if( arr == textarr[j].id){
                        text=textarr[j].topicName;
                    }
                }
                if(text !=''){
                    html+='<span class="tag"><span>'+text+'</span><a href="#" class="topicTag" ">x</a></span>&nbsp&nbsp&nbsp'
                }
                $("#topicList").html(html);
            }
        });

        $(document).on("click", ".labelTag", function () {
            var index = $(this).attr("data-index");
            var arr =  $("#labelId").combobox("getValues");
            $("#labelId").combobox("unselect",arr[index]);
        });

        $(document).on("click", ".topicTag", function () {
            $("#topicId").combobox("setValue","");
        });

        $(document).on("click", ".goodTag", function () {
            debugger
            var product_skn = $(this).attr("data-index");
            removeSingleItemById(product_skn);
            var skns = '';
            // for (var i = 0; i < checkedItems.length; i++) {
            //     if( i == checkedItems.length -1){
            //         skns = skns+ checkedItems[i]
            //     }else{
            //         skns = skns+ checkedItems[i] +","
            //     }
            // }
            // $("#skns").val(skns);
            var div= $(this).parent("span").parent("div");
            div.remove();
        });

        $("#subBotton").linkbutton({
            iconCls: "icon-save",
            width:200,
            onClick: function () {
                $("#publishArticleForm").form("submit",{
                    url : serverContextPath+"/grassArticle/publishArticle",
                    onSubmit : function(param) {
                        debugger;
                        if (!$("#publishArticleForm").form("validate")) {
                            return false;

                        }
                        if($("#appurl").is(":checked")){
                            $("#sort").val(3);
                        }
                        if(!$("#appurl").is(":checked")){
                            var content = ue.getContent();
                            if(content ==null ||content == ''){
                                $.messager.alert("发布失败", "正文内容不能为空", "error");
                                return false;
                            }
                        }


                        var imgs = '';
                        var imageCount = 0;
                        $("input[name='url']").each(function(j,item){
                            debugger
                            var url = item.value;
                            if(imgs == ''){
                                imgs = url;
                            }else{
                                imgs = imgs + ","+url;
                            }
                            imageCount++;
                        });
                        $("#coverImage").val(imgs);

                        if(imageCount < 1){
                            $.messager.alert("发布失败", "请上传封面图", "error");
                            return false;
                        }
                        var labels = '';
                        $("input[name='labelId']").each(function(j,item){
                            debugger
                            var id = item.value;
                            if(labels == ''){
                                labels = id;
                            }else{
                                labels = labels + ","+id;
                            }
                        });
                        $("#labelIds").val(labels);

                        return true;
                    },
                    success : function(data) {
                        if (data) {
                            data = $.parseJSON(data);
                            if (data.code == 200) {
                                $.messager.alert("提示","发布成功", "info", function(){window.location.reload()});
                                // alert("保存成功");


                            } else {
                                $.messager.alert("保存失败", data.message, "error");
                            }
                        } else {
                            $.messager.alert("保存失败", data.message, "error");
                        }
                    }
                });

            }
        });

        $("#draftBotton").linkbutton({
            iconCls: "icon-save",
            width:200,
            onClick: function () {
                $("#publishArticleForm").form("submit",{
                    url : serverContextPath+"/grassArticle/saveArticleDraft",
                    onSubmit : function(param) {
                        debugger;
                        if (!$("#publishArticleForm").form("validate")) {
                            return false;

                        }
                        if($("#appurl").is(":checked")){
                            $("#sort").val(3);
                        }

                        if(!$("#appurl").is(":checked")){
                            var content = ue.getContent();
                            if(content ==null ||content == ''){
                                $.messager.alert("发布失败", "正文内容不能为空", "error");
                                return false;
                            }
                        }
                        var imgs = '';
                        var imageCount = 0;
                        $("input[name='url']").each(function(j,item){
                            debugger
                            var url = item.value;
                            if(imgs == ''){
                                imgs = url;
                            }else{
                                imgs = imgs + ","+url;
                            }
                            imageCount++;
                        });
                        if(imageCount < 1){
                            $.messager.alert("发布失败", "请上传封面图", "error");
                            return false;
                        }
                        $("#coverImage").val(imgs);

                        var labels = '';
                        $("input[name='labelId']").each(function(j,item){
                            debugger
                            var id = item.value;
                            if(labels == ''){
                                labels = id;
                            }else{
                                labels = labels + ","+id;
                            }
                        });
                        $("#labelIds").val(labels);
                        var html = '';

                        return true;
                    },
                    success : function(data) {
                        if (data) {
                            data = $.parseJSON(data);
                            if (data.code == 200) {
                                $.messager.alert("提示","保存成功", "info", function(){window.location.reload()});
                                // alert("保存成功");


                            } else {
                                $.messager.alert("保存失败", data.message, "error");
                            }
                        } else {
                            $.messager.alert("保存失败", data.message, "error");
                        }
                    }
                });

            }
        });



    // 定时 选择时间
    function getTimeDialog(data,id, status){
        var timeChoose = $("<div id='timeChoose'>").appendTo($(document.body));
        var title =  "选择时间";
        var textVar = "确认";

        window.self.paramObject.mkData = data;
        $(timeChoose).myDialog({
            title: title,
            width: "20%",
            height: "30%",
            resizable:false,
            buttons:[{
                id : "saveBtn",
                text:textVar,
                iconCls : "icon-save",
                handler:function(){
                    debugger;
                    var time=''
                    if($("#publishTimeStr").datetimebox('getValue') !=null && $("#publishTimeStr").datetimebox('getValue') !=''){
                         time = parseInt(new Date($("#publishTimeStr").datetimebox('getValue')).getTime() );
                    }else {
                        $.messager.alert("发布失败", "请选择时间", "error");
                        return;
                    }
                    $("#publishArticleForm").form("submit",{
                        url : serverContextPath+"/grassArticle/timerPublish",
                        onSubmit : function(param) {
                            debugger;
                            if (!$("#publishArticleForm").form("validate")) {
                                return false;
                            }
                            if($("#appurl").is(":checked")){
                                $("#sort").val(3);
                            }

                            if(!$("#appurl").is(":checked")){
                                var content = ue.getContent();
                                if(content ==null ||content == ''){
                                    $.messager.alert("发布失败", "正文内容不能为空", "error");
                                    return false;
                                }
                            }

                            param.publishTime =time;
                            var imgs = '';
                            var imageCount = 0;
                            $("input[name='url']").each(function(j,item){
                                debugger
                                var url = item.value;
                                if(imgs == ''){
                                    imgs = url;
                                }else{
                                    imgs = imgs + ","+url;
                                }
                                imageCount++;
                            });
                            $("#coverImage").val(imgs);

                            if(imageCount < 1){
                                $.messager.alert("发布失败", "请上传封面图", "error");
                                return false;
                            }
                            var labels = '';
                            $("input[name='labelId']").each(function(j,item){
                                debugger
                                var id = item.value;
                                if(labels == ''){
                                    labels = id;
                                }else{
                                    labels = labels + ","+id;
                                }
                            });
                            $("#labelIds").val(labels);

                            return true;
                        },
                        success : function(data) {
                            if (data) {
                                data = $.parseJSON(data);
                                if (data.code == 200) {
                                    $.messager.alert("提示","发布成功", "info", function(){window.location.reload()});
                                    // alert("保存成功");
                                } else {
                                    $.messager.alert("保存失败", data.message, "error");
                                }
                            } else {
                                $.messager.alert("保存失败", data.message, "error");
                            }
                        }
                    });
                    $(timeChoose).dialog("close");
                }
            }, {
                text: "关闭",
                iconCls: "icon-cancel",
                handler: function () {
                    $.messager.confirm("确认", "确认关闭吗?", function (flag) {
                        if(flag){
                            $(timeChoose).dialog("close");
                        }
                    });
                }
            }],
            modal: true,
            href: contextPath + "/html/grass/article/chooseTime.html"
        });
    }

        // 跳转链接
        function getAppUrlDialog(data){
            var timeChoose = $("<div id='appUrl'>").appendTo($(document.body));
            var title =  "添加链接";
            var textVar = "确认";

            window.self.paramObject.mkData = data;
            $(timeChoose).myDialog({
                title: title,
                width: "40%",
                height: "30%",
                resizable:true,
                buttons:[{
                    id : "saveBtn",
                    text:textVar,
                    iconCls : "icon-save",
                    handler:function(){
                        debugger;

                        var json = JSON.stringify({
                            action: $("#goTo").combobox("getValue"),
                            url: $("#goToUrl").textbox("getValue")});
                        $("#actionUrl").textbox("setValue", json);
                        $(timeChoose).dialog("close");
                    }
                }, {
                    text: "关闭",
                    iconCls: "icon-cancel",
                    handler: function () {
                        $.messager.confirm("确认", "确认关闭吗?", function (flag) {
                            if(flag){
                                $(timeChoose).dialog("close");
                            }
                        });
                    }
                }],
                modal: true,
                href: contextPath + "/html/grass/longArticle/appUrl.html"
            });
        }


    })




</script>
</html>