draftArticleDetail.html 18.9 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
<!DOCTYPE html>
<html>

<!--<body class="easyui-layout">-->


<!--<div region="center" id="articleDetail" style="margin-left: 20px">-->
    <div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
        <form name="publishArticleForm" id="publishArticleForm" method="post">
            <!--<input id="checkedId" name="articleId" type="hidden"/>-->
            <!--<input id="articleImages" name="articleImages" type="hidden"/>-->
            <!--<input id="articleSkns" name="articleSkns" type="hidden"/>-->

            <div style="margin-top: 20px;margin-left: 30px">
                <!--<h2>查看详情</h2>-->
                <table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">

                    <!--<tr style="height: 60px">-->
                        <!--<td style="font-size: 18px">-->
                            <!--笔记详情-->
                        <!--</td>-->
                    <!--</tr>-->

                    <tr style="height: 60px">
                        <td>
                            <div>
                                用户Uid: <span id="authorUid"></span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;昵称:<span
                                    id="nickName" style="margin-left: 10px"></span>
                                <br>
                                内容来源: <span id="sourceStr"></span>
                                <br>
                                信息流结构:<span id="flowTypeDetail"></span>
                                <br>
                                内容统计: 文字-<span id="contentLength" ></span>&nbsp;&nbsp;&nbsp; 图片-<span
                                    id="imgSize"></span>&nbsp;&nbsp;&nbsp;关联商品-<span id="productSize"></span>
                                <br>
                                审核状态:<span id="authStatusStr"></span>
                            </div>
                        </td>
                    </tr>

                    <tr style="height: 60px">
                        <td>
                            <div style="float: left"> 双列封面图(首图):
                            </div>
                            <div style="float: left" id="coverImg"></div>
                            <div style="float: left; margin-left: 20px;"> 单列封面图(小图):
                            </div>
                            <div style="float: left" id="coverImgSquare"></div>
                            <div style="float: left; margin-left: 20px;"> 单列封面图(大图):
                            </div>
                            <div style="float: left" id="coverImgFlat"></div>
                        </td>
                    </tr>

                    <tr style="height: 60px">
                        <td>
                            <div id="articleContent1" style="float: left">
                                <span>文字内容:</span>
                            </div>
                            <div id="articleContent"  style=" white-space: pre-wrap;float: left; margin-left: 18px; width: 800px;word-wrap:break-word">
                            </div>
                        </td>
                    </tr>
                    <tr style="height: 20px">
                        <td>
                            <div id="labelList">

                            </div>

                        </td>
                    </tr>
                    <tr style="height: 20px">
                        <td>
                            <div id="topic">

                            </div>

                        </td>
                    </tr>
                    <tr id="imgTr" style="height: 60px;display: none">
                        <td>
                            <div class="swiper-container">
                                <div class="swiper-wrapper" id="imageListDiv">

                                </div>
                                <!--&lt;!&ndash; 如果需要分页器 &ndash;&gt;-->
                                <!--<div class="swiper-pagination"></div>-->

                                <!-- 如果需要导航按钮 -->
                                <div class="swiper-button-prev"></div>
                                <div class="swiper-button-next"></div>

                                <!--&lt;!&ndash; 如果需要滚动条 &ndash;&gt;-->
                                <!--<div class="swiper-scrollbar"></div>-->
                            </div>
                        </td>
                    </tr>
                    <tr id="videoTr" style="height: 60px;display: none">
                        <td>
                            <div id="videoDiv">

                            </div>
                        </td>
                    </tr>
                    <tr style="height: 60px">
                        <td>

                            <div id="relatedProduct">


                            </div>

                        </td>

                    </tr>
                    <tr style="height: 60px">
                        <td id="goodstd">
                            <!--<div style="float: left;margin-left: 30px">-->
                                <!--<a id="publishBtn" class="btn-info" style="display: none">发布</a>-->
                                <!--<a id="cancelBtn" class="btn-info" style="display: none">取消定时</a>-->
                            <!--</div>-->
                            <!--<div style="float: left;margin-left: 30px">-->
                                <!--<a id="timerBtn" class="btn-info" style="display: none">定时发布</a>-->
                            <!--</div>-->
                        </td>
                    </tr>

                </table>
            </div>
        </form>

    </div>

<!--</div>-->
<script>
    var mySwiper = new Swiper('.swiper-container', {
//        direction: 'vertical', // 垂直切换选项
//        loop: true, // 循环模式选项

//        // 如果需要分页器
//        pagination: {
//            el: '.swiper-pagination',
//        },
        observer: true,           //修改swiper自己或子元素时,自动初始化swiper
        observeParents: true,    //修改swiper的父元素时,自动初始化swipe
        // 如果需要前进后退按钮
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },

//        // 如果需要滚动条
//        scrollbar: {
//            el: '.swiper-scrollbar',
//        },
    })
</script>


<script>

    $(function () {
        //加载数据
        var data = paramObject.mkData;
        var articleId = data.articleId;

        //获取文章的详细信息
        $.ajax({
            type: "get",
            url: serverContextPath + "/grassArticle/getArticleById?articleId=" + articleId,
            success: function (data) {
                debugger;
                if (data != null) {//成功的
                    var detailInfo = data.data;
                    $("#authorUid").html(detailInfo.authorUid);
                    $("#nickName").html(detailInfo.nickName);

                    //信息流结构
                    var flowTypeStr = "";
                    var flowTypeDetail = detailInfo.flowType;
                    if (flowTypeDetail == null || flowTypeDetail == 1) {
                        flowTypeStr = "长图";
//                        $("#authBtn").attr("style", "display:block");
                    } else if (flowTypeDetail == 2) {
                        flowTypeStr = "方图";
                    }
                    $("#flowTypeDetail").html(flowTypeStr);
                    $("#sourceStr").html(detailInfo.sourceStr);
                    $("#contentLength").html(detailInfo.articleContent == null ? 0 : detailInfo.articleContent.length);
                    $("#articleContent").html(detailInfo.articleContent == null || detailInfo.articleContent.length == 0 ? "空" :  detailInfo.articleContent);
                    if (detailInfo.coverImgSquare != null && detailInfo.coverImgSquare != '') {
                        var width = detailInfo.coverImgSquareWidth;
                        var height = detailInfo.coverImgSquareHeight;
                        var w = width;
                        if(width >240){
                            w =240;
                        }
                        if(width ==1 || height == 1){
                            w =240;
                        }
                        var h = w * height/width;
                        var imgHtml = '<img src="' + detailInfo.coverImgSquare + '" style="width:'+w+'px;height:'+h+'px;"/>';
                        $("#coverImgSquare").html(imgHtml);
                    }
                    if (detailInfo.coverImgFlat != null && detailInfo.coverImgFlat != '') {
                        var w = detailInfo.coverImgFlatWidth;
                        var h = detailInfo.coverImgFlatHeight;
                        var w = width;
                        if(width >240){
                            w =240;
                        }
                        if(width ==1 || height == 1){
                            w =240;
                        }
                        var h = w * height/width;
                        var imgHtml = '<img src="' + detailInfo.coverImgFlat + '" style="width:'+w+'px;height:'+h+'px;"/>';
                        $("#coverImgFlat").html(imgHtml);
                    }
                    if(detailInfo.coverImg !=null && detailInfo.coverImg !=''){
                        var width = detailInfo.imgWidth;
                        var height = detailInfo.imgHeight;
                        var w = width;
                        if(width >240){
                            w =240;
                        }
                        if(width ==1 || height == 1){
                            w =240;
                        }
                        var h = w * height/width;
                        imgHtml = '<img src="'+detailInfo.coverImg+'" style="width:'+w+'px;height:'+h+'px;"/>';
                        $("#coverImg").html(imgHtml);
                    }
                    var imgSize = detailInfo.imgList == null ? 0 : detailInfo.imgList.length;
                    $("#imgSize").html(imgSize);

                    if(detailInfo.sort != 4){
                        $("#imgTr").show();
                        $("#videoTr").hide();
                        //展示图片(肯定有图片,没图片那就是业务有问题,或者数据有问题)
                        if (detailInfo.imgList != null && detailInfo.imgList.length > 0) {
                            var imageDivStr = "";
                            for (var i = 0; i < detailInfo.imgList.length; i++) {
                                imageDivStr += '<div class="swiper-slide" style="text-align: center;line-height:300px;"><img src="' + detailInfo.imgList[i] + '" style="max-width: 400px;max-height:300px;margin-left: 100px;margin-right: 5px"/></div>';
                            }
                            $("#imageListDiv").html(imageDivStr);
                        }
                    }else{
                        $("#imgTr").hide();
                        $("#videoTr").show();
                        var videoStr = '<video src="' + detailInfo.videoUrl + '" controls autoplay loop muted preload="auto" poster="' + detailInfo.coverImg + '" style="width:600px;height:600px;">';
                        //var videoStr = '<video src="http://flv01.static.yhbimg.com/goodsvideo/2017/08/25/17/039b9ce839a967ee0352049ebe2484df21.mp4" controls autoplay loop muted preload="auto" poster="' + detailInfo.coverImg + '" >';
                        $("#videoDiv").html(videoStr);
                    }


                    var productSize = detailInfo.productlList == null ? 0 : detailInfo.productlList.length;
                    $("#productSize").html(productSize);
                    var authStatusStr = "";
                    var authStatus = detailInfo.authStatus;
                    if (authStatus == null || authStatus == '0') {
                        authStatusStr = "待审核";
                        // $("#authBtn").attr("style", "display:block");
                        $("#publishBtn").attr("style", "display:none");
                        $("#timerBtn").attr("style", "display:none");
                        $("#cancelBtn").attr("style", "display:none");
                    } else if (authStatus == '1' ) {
                        authStatusStr = "已通过";
                        if(detailInfo.hasPublished == 'N'){
                            // $("#cancelBtn").attr("style", "display:block");
                            $("#publishBtn").attr("style", "display:none");
                            $("#timerBtn").attr("style", "display:none");
                        }
                    } else if (authStatus == '2') {
                        authStatusStr = "未通过";
                        $("#publishBtn").attr("style", "display:none");
                        $("#timerBtn").attr("style", "display:none");
                        $("#cancelBtn").attr("style", "display:none");
                    }else if(authStatus == '9'){
                        authStatusStr = "未审核";
                        // $("#publishBtn").attr("style", "display:block");
                        // $("#timerBtn").attr("style", "display:block");
                        $("#cancelBtn").attr("style", "display:none");
                    }
                    $("#authStatusStr").html(authStatusStr);

                    if (detailInfo.labelList != null && detailInfo.labelList.length > 0) {
                        var labelStr = "关联标签:  ";
                        for (var i = 0; i < detailInfo.labelList.length; i++) {
                            labelStr += "<span style='margin-left: 10px'>#" + detailInfo.labelList[i].name + "</span>";
                        }
                        $("#labelList").html(labelStr);
                    } else {
                        $("#labelList").html("关联标签: 无");
                    }

                    if (detailInfo.topicName != null ) {
                        var topicStr = "关联话题:  ";
                        topicStr += "<span style='margin-left: 10px'>#" + detailInfo.topicName + "</span>";
                        $("#topic").html(topicStr);
                    } else {
                        $("#topic").html("关联话题: 无");
                    }

                    //关联商品
                    if (detailInfo.productlList != null && detailInfo.productlList.length > 0) {
                        var productStr = "";
                        for (var i = 0; i < detailInfo.productlList.length; i++) {
                            productStr += "<div style='float:left;word-wrap:break-word;word-break: break-all;width: 100px;margin-left: 10px;font-size: 12px'>" +
                                "<img src='" + detailInfo.productlList[i].productImage + "' style='margin-left:30px;width:50px;height: 50px;align: center'><br>商品:"
                                + detailInfo.productlList[i].productName + "<br>skn:" +
                                detailInfo.productlList[i].productSkn + "</div>";
                        }
                        $("#relatedProduct").html(productStr);

                    } else {//没有关联商品
                        $("#relatedProduct").html("关联商品: 无");
                    }
                }
            }
        });


    });

    //获取url中的参数方法
    function getUrlParam(name) {
        //构造一个含有目标参数的正则表达式对象
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        //匹配目标参数
        var r = window.location.search.substr(1).match(reg);
        //返回参数
        if (r != null) {
            return unescape(r[2]);
        } else {
            return null;
        }
    }

    // //发布
    // $("#publishBtn").linkbutton({
    //     iconCls: "icon-search",
    //     onClick: function () {
    //         publishArticle(articleId);
    //     }
    // });
    //
    // //定时发布
    // $("#timerBtn").linkbutton({
    //     iconCls: "icon-search",
    //     onClick: function () {
    //         getEditDialog(articleId,1);
    //     }
    // });
    //
    // //取消定时
    // $("#cancelBtn").linkbutton({
    //     iconCls: "icon-search",
    //     onClick: function () {
    //         switchTimer(articleId, 2,'');
    //     }
    // });
    //
    //
    // function switchTimer(id, status,publishTime) {
    //     debugger
    //     var operateType = status == 1 ? 3 : 4;
    //     $.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + id + "&publishTime=" + publishTime+ "&operateType="+ operateType, function (data) {
    //         if(data.code != 200){
    //             alert(data.message);
    //         }else{
    //             $.messager.alert("操作成功", "操作成功", "info");
    //             location .reload();
    //         }
    //     }, "json");
    // }
    //
    // function publishArticle(id) {
    //     debugger
    //     var operateType = 5;
    //     $.post(serverContextPath + "/grassArticle/updateArticle.do?articleId=" + id +  "&operateType="+ operateType, function (data) {
    //         if(data.code != 200){
    //             alert(data.message);
    //         }else{
    //             $.messager.alert("操作成功", "发布成功", "info");
    //             location .reload();
    //         }
    //     }, "json");
    // }
    //
    // // 定时 选择时间
    // function getEditDialog(id, status){
    //     var timeChoose = $("<div id='timeChoose'>").appendTo($(document.body));
    //     var title =  "选择时间";
    //     var textVar = "确认";
    //
    //     $(timeChoose).myDialog({
    //         title: title,
    //         width: "20%",
    //         height: "20%",
    //         resizable:false,
    //         buttons:[{
    //             id : "saveBtn",
    //             text:textVar,
    //             iconCls : "icon-save",
    //             handler:function(){
    //                 debugger;
    //                 if($("#publishTimeStr").datetimebox('getValue') !=null && $("#publishTimeStr").datetimebox('getValue') !=''){
    //                     var time = parseInt(new Date($("#publishTimeStr").datetimebox('getValue')).getTime() );
    //                     switchTimer(id, status,time);
    //                 }
    //                 $(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"
    //     });
    // }


</script>
</html>