<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sptg="http://www.thymeleaf.org">
<head>
    <script th:replace="common/head"></script>
</head>

<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto" style="padding:0;">
            <div class="layui-form-item border-b">
                <div class="layui-inline">
                    <label class="layui-form-label">广告名称</label>
                    <div class="layui-input-block">
                        <input type="text" id="selectedAdTitle" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline" style="margin-left: 38px;">
                    <button class="layui-btn layuiadmin-btn-useradmin"  lay-submit lay-filter="query">查询</button>
                    <button class="layui-btn  layui-btn-primary"  lay-submit lay-filter="reset">重置</button>
                </div>
            </div>

            <!-- 表格+头部按钮 -->
            <div class="layui-card-body" style="padding:0;" id="layPhotosTbImg">
                <div style="padding-bottom: 10px;">
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="add" sptg:security="ad:push:task:insert">发布广告</button>
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="threshold">阈值配置</button>
                </div>
                <table id="table-id" lay-filter="table-id"></table>
            </div>
        </div>
    </div>
</div>

<!--操作-->
<script type="text/html" id="table-operate-id">
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="task_detail">详情</a>
    <!--发布状态{ -1：发布失败，0：待发布，1：发布成功，2：已撤销 }-->
    {{# if(d.pushStatus==0){ }}
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="cancel" sptg:security="ad:push:task:cancel">撤回发布</a>
    {{# } }}
</script>
<input type="hidden" id="fastDfsServer" th:value="${fastDfsServer}"/>
<script type="text/html" id="materialFileTemplate">
    {{# if(d.adMaterialId!=null&&d.adMaterial.materialType == '图片'){ }}
    <img src="{{fastDfsServer + d.adMaterial.materialFile}}"
         style="display: inline-block; width: 80%; height: 100%;cursor: zoom-in">
    {{#  }else{ }}
    <span class="layui-btn layui-btn-danger layui-btn-xs">未关联</span>
    {{# } }}
</script>

<!-- 发布结果 -->
<script type="text/html" id="pushStatus">
    {{#  if(d.pushStatus == -1){ }}
    <span style="color: red" >发布失败</span>
    {{#  } else if(d.pushStatus == 0){ }}
    <span style="color: blue">待发布</span>
    {{#  } else if(d.pushStatus == 1){ }}
    <span style="color: green">已完成</span>
    {{#  } else if(d.pushStatus == 2){ }}
    <span style="color: gray">已撤销</span>
    {{#  }  }}
</script>

<!-- 发布结果 -->
<script type="text/html" id="imgPlayTime">
    {{#  if(d.imgPlayTime != null){ }}
    {{d.imgPlayTime}}秒
    {{#  }  }}
</script>
<!-- javascript -->
<script th:src="@{'/layui/layui.js'}" charset="utf-8"></script>
<script>
    layui.config({
        base: '/' //静态资源所在路径
    });
    var fastDfsServer = document.getElementById("fastDfsServer").value;
</script>
<script th:src="@{'/js/ad/ad-push-task-manage.js'}" charset="utf-8"></script>
</body>

</html>
