<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../common/common.jsp"%>
<title>长视频-详情</title>
</head>
<body>
<%@ include file="../common/head.jsp"%>
<div class="screen main">
    <%@ include file="../common/left.jsp" %>
    <div class="main-content">
	    <div class="btn-radius"> 媒体资源-->网络长视频资源详情 :${name}</div>
	    <div class="rFloat buttons">
            <a href="javascript:void(0);" id="edit" onclick="edit()" class="btn">编 辑</a>
        </div>
	    <div id="resourceInfo" class="mTop20 hd-title">资源简介</div>
	    <br>
	    <div id="tvDesc" <c:if test="${empty record.tvDesc || record.tvDesc == ''}"> style="height: 320px"</c:if> >${record.tvDesc }</div>
	    <div id="basicInfo" class="mTop20 hd-title">基本信息</div>
	    <br>
	    <div id="infos" <c:if test="${empty record.infos || record.infos == ''}"> style="height: 320px"</c:if> >${record.infos }</div><br>
	    <div id="saveLongInfo" class="buttons" style="display: none;text-align: center;">
            <a href="javascript:void(0);" onclick="save()" class="btn">提 交</a>
        </div>
    </div>
    <div class="clear"></div>
</div>
<%@ include file="../common/footer.jsp"%>
<iframe name="hframe" style="display: none;"></iframe>
<script type="text/javascript" src="${staticPath}wangeditor/wangEditor.min.js"></script>
<script type="text/javascript" src="${staticPath}js/adresource/long.js"></script>
<script type="text/javascript">
    var flag = true;
    var tvDesc,infos;
    function edit(){
    	if(flag){
    		$("#edit").hide();
    		var v1 = $("#tvDesc").html();
            var v2 = $("#infos").html();
    		$("#tvDesc").html("");
    		$("#infos").html("");
            var E = window.wangEditor
            tvDesc = new E('#tvDesc');
            infos = new E('#infos');
            tvDesc.customConfig.uploadImgServer = 'upload_notice_img.do';//上传图片到服务器
            tvDesc.customConfig.uploadFileName = 'file';//上传文件的name 接口参数名
            tvDesc.customConfig.showLinkImg = false;//隐藏网络图片tab页
            tvDesc.create();
            $("#tvDesc").attr('style','height:auto;');
            tvDesc.txt.html(v1);
            
            infos.customConfig.uploadImgServer = 'upload_notice_img.do';//上传图片到服务器
            infos.customConfig.uploadFileName = 'file';//上传文件的name 接口参数名
            infos.customConfig.showLinkImg = false;//隐藏网络图片tab页
            infos.create();
            $("#infos").attr('style','height:auto;');
            infos.txt.html(v2);
            flag = false;
            $("#saveLongInfo").show();
    	}
    }
    function save(){
    	var data = {
    			"id":'${record.id}',
    			"resourceId":'${resourceId}',
    			"tvDesc":tvDesc.txt.html(),
    			"infos":infos.txt.html(),
    	}
    	console.log(data);
    	ajax("save_resource_by_long_info.do",data,function(res){
    		if (res.code == 1){
                top.alert("保存成功", 1, function(){
                	location.reload();
                });
            } else {
                top.alert(res.msg);
            }
    	})
    }
</script>
</body>
</html>