<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../common/common.jsp"%>
<title>APP-详情</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);" 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="featureData" <c:if test="${empty record.featureData || record.featureData == ''}"> style="height: 320px"</c:if> >${record.featureData }</div>
	    <div id="basicInfo" class="mTop20 hd-title">最新资源</div>
	    <br>
	    <div id="latestResources" <c:if test="${empty record.latestResources || record.latestResources == ''}"> style="height: 320px"</c:if> >${record.latestResources }</div>
	    <br>
	    <div id="saveAppInfo" 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/app.js"></script>
<script type="text/javascript">
    var flag = true;
    var tvDesc,featureData,latestResources;
    function edit(){
    	if(flag){
    		var v1 = $("#tvDesc").html();
            var v2 = $("#featureData").html();
            var v3 = $("#latestResources").html();
            
    		$("#tvDesc").html("");
    		$("#featureData").html("");
    		$("#latestResources").html("");
            var E = window.wangEditor
            tvDesc = new E('#tvDesc');
            featureData = new E('#featureData');
            latestResources = new E('#latestResources');
            tvDesc.customConfig.uploadImgServer = 'upload_notice_img.do';//上传图片到服务器
            tvDesc.customConfig.uploadFileName = 'file';//上传文件的name 接口参数名
            tvDesc.customConfig.showLinkImg = false;//隐藏网络图片tab页
            tvDesc.create();
            tvDesc.txt.html(v1);
            
            featureData.customConfig.uploadImgServer = 'upload_notice_img.do';//上传图片到服务器
            featureData.customConfig.uploadFileName = 'file';//上传文件的name 接口参数名
            featureData.customConfig.showLinkImg = false;//隐藏网络图片tab页
            featureData.create();
            featureData.txt.html(v2);
            
            latestResources.customConfig.uploadImgServer = 'upload_notice_img.do';//上传图片到服务器
            latestResources.customConfig.uploadFileName = 'file';//上传文件的name 接口参数名
            latestResources.customConfig.showLinkImg = false;//隐藏网络图片tab页
            latestResources.create();
            latestResources.txt.html(v3);
            flag = false;
            $("#saveAppInfo").show();
    	}
    }
    function save(){
    	var data = {
    			"id":'${record.id}',
    			"resourceId":'${resourceId}',
    			"tvDesc":tvDesc.txt.html(),
    			"featureData":featureData.txt.html(),
    			"latestResources":latestResources.txt.html(),
    	}
    	console.log(data);
    	ajax("save_resource_by_app_info.do",data,function(res){
    		if (res.code == 1){
                top.alert("保存成功", 1, function(){
                	location.reload();
                });
            } else {
                top.alert(res.msg);
            }
    	})
    }
</script>
</body>
</html>