<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>查看详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <style type="text/css">
        .tenant-li {
            margin: 10px
        }

        img {
            width: 40%;
            height: 30%;
            margin-bottom: 20px;
        }
    </style>
</head>
<body>
<div class="layui-card" style="min-height: 400px; padding: 10px" id="tenant_detail"></div>
<script id="tenant_detail_demo" type="text/html">
    <div class="layui-tab-item layui-show">
        <ui>
            <li class="tenant-li layui-col-md6">
                <h3>标题：{{ d.title }}</h3>
            </li>
            <li class="tenant-li layui-col-md6">
                <h3>内容:</h3>
                <div id="content_demo"></div>
            </li>
            <li class="tenant-li">
                <h3>添加人：{{ d.create_user_name }}</h3>
            </li>
            <li class="tenant-li">
                <h3>企业：{{ d.tenant_name }}</h3>
            </li>
            <li class="tenant-li">
                <h3>添加时间：{{ d.create_time }}</h3>
            </li>
            <li class="tenant-li">
                <h3>是否在用：{{ d.enable_text }}</h3>
            </li>
        </ui>
    </div>
</script>


<script src="../../layuiadmin/layui/layui.js"></script>

<script>
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index',
    }).use(['index',  'laytpl'], function () {
        var $ = layui.$
            , laytpl = layui.laytpl;
        var data = JSON.parse(JSON.stringify(parent.layui.table.editdata)); // 框架有Bug所以这么转换

        var getTpl = tenant_detail_demo.innerHTML
            , tenant_detail = document.getElementById('tenant_detail');
        laytpl(getTpl).render(data, function (html) {
            tenant_detail.innerHTML = html;
        });
        var dom = document.getElementById("content_demo");
        if(data.content && dom){
            if(data.content.indexOf('video') !== -1){
               let tempList = data.content.split('video');
               //修改video标签的样式
               tempList[0] += 'video style="width: 100%;"';
               data.content = tempList.join("");
            }
           dom.innerHTML = data.content;
        }
    });
</script>
</body>
</html>
