<html xmlns:th="http://www.thymeleaf.org">
<head>
	<title>私塾家</title>
	<script th:include="sys/common/metaCSS" th:remove="tag"></script>
	<script th:include="sys/common/metaJS" th:remove="tag"></script>
</head>
<style>
	.tablelink{margin-right:10px;}
	.stylecss{
		color: red;
	}
	.select_width{
		width: 70px;
	}
	.date_width{
		width: 100px;
	}
</style>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">系统管理</a></li>
		<li><a th:href="@{/sys/appinfo/appinfoList.html}">版本信息列表</a></li>
	</ul>
</div>
<div class="rightinfo">
	<form id="seachform" th:action="@{/sys/appinfo/appinfoList.html}" method="post">
		<ul class="seachform">
			<li>
				<label>&nbsp;</label>
				<input type="button" class="scbtn" value="刷新" />
			</li>
			<li>
				<ul class="toolbar">
					<a th:href="@{/sys/appinfo/appinfoAdd.html}"><li class="click"><span><img th:src="@{/static/sys/images/t01.png}" /></span>新增</li></a>
				</ul>
			</li>
		</ul>
	</form>
	<table class="tablelist">
		<thead>
		<tr>
			<th>版本号</th>
			<th>版本存放路径</th>
			<th>发版端</th>
			<th>更新内容</th>
			<th>是否需要升级</th>
			<th>附件地址</th>
			<th>创建时间</th>
			<th>操作</th>
		</tr>
		</thead>
		<tbody>
		<tr th:each="item:${list}" >
			<td th:text="${item.version}" ></td>
			<td th:text="${item.fileKey}" ></td>
			<td th:switch="${item.type}" >
				<span th:case="1">小塾(深圳)</span>
				<span th:case="4">小塾(上海)</span>
				<span th:case="2">家长端（Android）</span>
				<span th:case="3">家长端（iOS）</span>
				<span th:case="5">老师端（android）</span>
				<span th:case="6">老师端（iOS）</span>
				<span th:case="7">小塾pro</span>
				<span th:case="8">小塾学伴pad（iOS）</span>
				<span th:case="11">小塾学伴pad（Android）</span>
				<span th:case="10">小塾学伴（iOS）</span>
				<span th:case="9">小塾学伴（Android）</span>
			</td>
			<td>
				<textarea readonly="readonly" rows="1">[[${item.updateContent}]]</textarea>
			</td>
			<td th:switch="${item.needUpdate}" >
				<span th:case="1">是</span>
				<span th:case="0">否</span>
			</td>
			<td>
				<a th:href="${imgUrl}+''+${item.attachmentUrl}" class="tablelink" th:text="${item.attachmentUrl}" th:target="_blank"></a>
			</td>
			<td style="width: 141px;" th:text="${#calendars.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}" ></td>
			<td>
				<a th:href="@{/sys/appinfo/appinfoAdd.html(id=${item.id})}" class="tablelink" >修改</a>
				<a href="javascript:;" th:onclick="'deleteById(\''+${item.id}+'\')'"  class="tablelink" >删除</a>
			</td>

		</tr>
		</tbody>
	</table>
	<!--分页-->
	<div class="pagin">
		<div class="appinfo">共<i class="blue">[[${page.rowCnt}]]</i>条记录，当前显示第&nbsp;<i class="blue">[[${page.pageNo }]]&nbsp;</i>页</div>
		<div th:utext='${listNavigatHtml}' th:remove="tag" ></div>
	</div>
</div>
</body>
<script type="text/javascript">
    function deleteById(id){
        parent.layer.confirm("确定删除吗？",
            {icon: 4, btn: ['确定','取消']
            }, function(){
                $.ajax({
                    url: '[[${sysUrl}]]/sys/appinfo/appinfoDelete',
                    type: "post",
                    data:{
                        'id': id
                    },
                    dataType: "json",
                    success:function(data){
                        if(data.meta.success){
                            parent.layer.msg("删除成功",{icon:1});
                            setTimeout(function(){
                                location.reload();
                            },1000);
                        }else{
                            parent.layer.msg(data.meta.message,{icon:11});
                        }
                    }
                });
            });
    }
</script>
</html>