infoList.jsp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <%@ page import="com.thinkgem.jeesite.common.config.Global" %>
  2. <%@ page contentType="text/html;charset=UTF-8" %>
  3. <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
  4. <html>
  5. <head>
  6. <title>文章列表管理</title>
  7. <meta name="decorator" content="default"/>
  8. <style type="text/css">
  9. .table th{text-align: center;}
  10. .table td{text-align: center;}
  11. .topSelect{
  12. width: 80px;
  13. position: absolute;
  14. right: 50px;
  15. background-color: white;
  16. }
  17. </style>
  18. <% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
  19. <script type="text/javascript">
  20. $(document).ready(function() {
  21. show_title(16);
  22. });
  23. function page(n,s){
  24. $("#pageNo").val(n);
  25. $("#pageSize").val(s);
  26. $("#searchForm").submit();
  27. return false;
  28. }
  29. //状态修改
  30. function updateStatus(status,ids,type,enabledStatus){
  31. if('recommendStatus'==type){
  32. if('0'==enabledStatus){
  33. alert("请先把该文章改为启动状态!");
  34. }else{
  35. update(status,ids,type);
  36. }
  37. }else{
  38. update(status,ids,type);
  39. }
  40. }
  41. function update(status,ids,type){
  42. var msg='确定启用?';
  43. if('0'==status){
  44. msg='确定停用?';
  45. }
  46. top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
  47. if(v=='ok'){
  48. $.post("${ctx}/info/info/updateStatus",{'status':status,'ids':ids,'type':type}, function(data) {
  49. if(true==data.success){
  50. $.jBox.tip(data.msg, 'info');
  51. } else {
  52. $.jBox.tip(data.msg,'error');
  53. }
  54. $("#searchForm").submit();
  55. },"JSON");//这里返回的类型有:json,html,xml,text
  56. }
  57. return;
  58. },{buttonsFocus:1,persistent: true});
  59. }
  60. function updateType(){
  61. var tabmode='${cookie.tabmode.value}';
  62. if(tabmode=='1'){
  63. addTabPage('修改分类项', '${ctx}/info/infoType?type=1&parentId=0');
  64. }else{
  65. location.href="${ctx}/info/infoType?type=1&parentId=0";
  66. }
  67. }
  68. /* //更新所有索引
  69. function updateAllIndex() {
  70. var submit = function (v, h, f) {
  71. if (v == true){
  72. $.post("${ctx}/info/info/updateAllIndex",null, function(data) {
  73. if(true==data.success){
  74. $.jBox.tip(data.msg, 'info');
  75. } else {
  76. $.jBox.tip(data.msg,'error');
  77. }
  78. $("#searchForm").submit();
  79. },"JSON");//这里返回的类型有:json,html,xml,text
  80. }
  81. return true;// close
  82. };
  83. // 自定义按钮
  84. $.jBox.confirm("该操作将更新所有文章索引,约耗时10分钟!!请谨慎操作", "更新索引", submit, { buttons: { '确定': true, '取消': false} });
  85. }
  86. //更新单个索引
  87. function updateIndex(id){
  88. $.post("${ctx}/info/info/updateIndex",{'id':id}, function(data) {
  89. if(true==data.success){
  90. $.jBox.tip(data.msg, 'info');
  91. } else {
  92. $.jBox.tip(data.msg,'error');
  93. }
  94. $("#searchForm").submit();
  95. },"JSON");//这里返回的类型有:json,html,xml,text
  96. }*/
  97. // 更新索引
  98. function updateIndex(id) {
  99. $.post("${caimeiCore}/commodity/search/index/update/article", {articleId: id}, function(res){
  100. $.jBox.tip(res.msg, 'info');
  101. });
  102. }
  103. function updateAllIndex(){
  104. var submit = function (v, h, f) {
  105. if (v == true){
  106. $.post("${caimeiCore}/commodity/search/index/article/all", function(res){
  107. $.jBox.tip(res.msg, 'info');
  108. });
  109. }
  110. return true;// close
  111. };
  112. // 自定义按钮
  113. $.jBox.confirm("该操作将更新所有商品索引,约耗时10分钟!!请谨慎操作", "更新索引", submit, { buttons: { '确定': true, '取消': false} });
  114. }
  115. //展示置顶选项
  116. function showTopSelect(index,status) {
  117. var homePageImage = $("#homePageImage" + index).text();
  118. if (homePageImage != "") {
  119. if ('open' == status) {
  120. document.getElementById("topSelect" + index).style.cssText = "display:block";
  121. }else if ('close' == status) {
  122. document.getElementById("topSelect" + index).style.cssText = "display:none";
  123. }
  124. }else {
  125. alertx("请先去编辑页面上传商城首页图再置顶")
  126. }
  127. }
  128. //更新置顶
  129. function updateTopPosition(topPosition,id,type) {
  130. var msg = '';
  131. if ('setTopPosition' == type) {
  132. msg = '确认置顶该文章吗?';
  133. //已有的置顶文章数量
  134. var topLength = ${topLength};
  135. if (topPosition - 1 > topLength) {
  136. var emptyPosition = topLength == 0 ? '一' : '二' ;
  137. msg = '由于当前没有第'+ emptyPosition +'位的置顶文章,将直接把该条文章置顶为第'+emptyPosition+'位';
  138. topPosition = topLength == 0 ? 1 : topLength == 1 ? 2 : topLength == 2 ? 3 : topLength == 3 ? 4 : 5;
  139. }
  140. }
  141. if ('clearTopPosition' == type) {
  142. msg = '确认清除该条数据的置顶位吗?清除后这条数据将不会在商城首页展示';
  143. }
  144. top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
  145. if (v == 'ok') {
  146. $.post("${ctx}/info/info/updateTopPosition", {
  147. 'topPosition': topPosition,
  148. 'id': id,
  149. 'type': type
  150. }, function (data) {
  151. if (true == data.success) {
  152. $.jBox.tip(data.msg, 'info');
  153. } else {
  154. $.jBox.tip(data.msg, 'error');
  155. }
  156. setTimeout(function () {
  157. $("#searchForm").submit();
  158. }, 800)
  159. }, "JSON");//这里返回的类型有:json,html,xml,text
  160. }
  161. return;
  162. }, {buttonsFocus: 1, persistent: true});
  163. }
  164. var ontypeId = null;
  165. var typeId = null;
  166. function ischangeType() {
  167. if (null != typeId) {
  168. $("#typeListId option[value=" + typeId + "]").val(ontypeId);
  169. }
  170. $("#optionType").find("option").eq(0).prop("selected", true)
  171. optionTypeParent()
  172. }
  173. function optionTypeParent() {
  174. $("#optionType [parent]").each(function (item) {
  175. if ($("#typeListId option:selected").val() == $(this).attr("parent")) {
  176. $(this).show()
  177. } else {
  178. $(this).hide()
  179. }
  180. })
  181. }
  182. function isoptionType() {
  183. if ("" != $("#optionType option:selected").val()) {
  184. ontypeId = $("#optionType option:selected").attr("parent")
  185. typeId = $("#optionType option:selected").val()
  186. $("#typeListId option:selected").val($("#optionType option:selected").val())
  187. }else {
  188. ischangeType()
  189. }
  190. }
  191. $(document).ready(function () {
  192. $("#typeListId option[value=" + $("#optionType option:selected").attr("parent") + "]").prop("selected", true);
  193. optionTypeParent()
  194. isoptionType()
  195. })
  196. </script>
  197. </head>
  198. <body>
  199. <ul class="nav nav-tabs">
  200. <li class="active"><a href="${ctx}/info/info/">文章列表</a></li>
  201. <shiro:hasPermission name="info:info:edit">
  202. <li><a href="${ctx}/info/info/form">文章添加</a></li>
  203. </shiro:hasPermission>
  204. <shiro:hasPermission name="info:infoType:edit">
  205. <li><a href="javascript:void(0);" onclick="updateType();">修改分类项</a></li>
  206. </shiro:hasPermission>
  207. </ul>
  208. <input type="button" class="btn btn-primary" value="更新全部搜索索引" onclick="updateAllIndex()"/>
  209. <form:form id="searchForm" modelAttribute="info" action="${ctx}/info/info/" method="post"
  210. class="breadcrumb form-search">
  211. <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
  212. <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
  213. <form:hidden path="label"/>
  214. <div class="ul-form">
  215. <label>ID:</label>
  216. <form:input path="id" htmlEscape="false" maxlength="11" class="input-mini"/>
  217. <label>标题:</label>
  218. <form:input path="title" htmlEscape="false" maxlength="100" class="input-medium"/>
  219. <label>发布人:</label>
  220. <form:input path="publisher" htmlEscape="false" maxlength="50" class="input-medium"/>
  221. <label>发布时间:</label>
  222. <form:input path="startPubDate" type="text" maxlength="10" class="input-medium Wdate"
  223. value="${startPubDate}"
  224. onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
  225. <form:input path="endPubDate" type="text" maxlength="10" class="input-medium Wdate"
  226. value="${startPubDate}"
  227. onclick="WdatePicker({dateFmt:'yyyy-MM-dd ',isShowClear:false});"/>
  228. <br> <br>
  229. <label>文章分类:</label>
  230. <form:select id="typeListId" path="infoType.id" class="input-small" onchange="ischangeType()">
  231. <form:option value="" label=" "/>
  232. <c:forEach items="${typeList}" var="type" varStatus="index">
  233. <c:if test="${type.parentId eq 0}">
  234. <form:option value="${type.id}" label="${type.name}"/>
  235. </c:if>
  236. </c:forEach>
  237. </form:select>
  238. <form:select id="optionType" path="" class="input-small" onchange="isoptionType()">
  239. <form:option value="" label=" "/>
  240. <c:forEach items="${typeList}" var="type" varStatus="index">
  241. <c:if test="${type.parentId ne 0}">
  242. <form:option value="${type.id}" label="${type.name}" parent="${type.parentId}"
  243. cssStyle="display: none"/>
  244. </c:if>
  245. </c:forEach>
  246. </form:select>
  247. <label>推荐状态:</label>
  248. <form:select path="recommendStatus" class="input-mini">
  249. <form:option value="" label=" "/>
  250. <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value"
  251. htmlEscape="false"/>
  252. </form:select>
  253. <label>状态:</label>
  254. <form:select path="enabledStatus" class="input-mini">
  255. <form:option value="" label=" "/>
  256. <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value"
  257. htmlEscape="false"/>
  258. </form:select>
  259. <label>关联标签库:</label>
  260. <form:select path="isRelevance" class="input-medium">
  261. <form:option value="" label="请选择"/>
  262. <form:option value="1" label="已关联"/>
  263. <form:option value="2" label="未关联"/>
  264. </form:select>
  265. <label>首页置顶:</label>
  266. <form:select path="topFlag" class="input-mini">
  267. <form:option value="" label="全部"/>
  268. <form:option value="1" label="是"/>
  269. <form:option value="0" label="否"/>
  270. </form:select>
  271. &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
  272. <div class="clearfix"></div>
  273. </div>
  274. </form:form>
  275. <sys:message content="${message}"/>
  276. <table id="contentTable" class="table table-striped table-bordered table-condensed">
  277. <thead>
  278. <tr>
  279. <th>ID</th>
  280. <th>文章分类</th>
  281. <th>引导图</th>
  282. <th>文章标题</th>
  283. <th>文章标签</th>
  284. <th>发布人</th>
  285. <th>实际点赞</th>
  286. <%-- <th>基础阅读量</th>--%>
  287. <th>实际阅读量</th>
  288. <th>首页置顶位</th>
  289. <%--<th>优先级</th>--%>
  290. <th>关联标签库</th>
  291. <th>发布时间</th>
  292. <th>添加时间</th>
  293. <%-- <th>推荐状态</th>--%>
  294. <th>状态</th>
  295. <shiro:hasPermission name="info:info:edit"><th>操作</th></shiro:hasPermission>
  296. </tr>
  297. </thead>
  298. <tbody>
  299. <c:forEach items="${page.list}" var="info" varStatus="index">
  300. <tr>
  301. <td>${info.id}</td>
  302. <td>
  303. ${info.infoType.name}
  304. </td>
  305. <td><img src="${info.guidanceImage}" width="100px;" height="100px;" style="width: 100px;height: 100px;"></td>
  306. <td class="comitted">
  307. ${info.title}
  308. </td>
  309. <td>
  310. ${info.label}
  311. </td>
  312. <td>
  313. ${info.publisher}
  314. </td>
  315. <td>${empty info.realPraise?0:(info.realPraise)}</td>
  316. <%-- <td>${empty info.basePv?0:(info.basePv)}</td>--%>
  317. <td>${empty info.pv?0:(info.pv)}</td>
  318. <td>${info.topPosition}</td>
  319. <%--<td>${empty info.priorityIndex?0:(info.priorityIndex)}</td>--%>
  320. <td>
  321. <c:if test="${!empty info.labelIds}">
  322. 已关联
  323. </c:if>
  324. <c:if test="${empty info.labelIds}">
  325. 未关联
  326. </c:if>
  327. </td>
  328. <td><fmt:formatDate value="${info.pubdate}" pattern="yyyy-MM-dd HH:mm"/></td>
  329. <td><fmt:formatDate value="${info.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
  330. <%-- <td>--%>
  331. <%-- <c:if test="${info.recommendStatus eq 1 }">--%>
  332. <%-- <a href="javascript:void(0);" onclick="updateStatus('0','${info.id}','recommendStatus','${info.enabledStatus}');" >--%>
  333. <%-- <img alt="启用" src="/static/images/yes.gif" width="15px" border="none" title="启用">--%>
  334. <%-- </a>--%>
  335. <%-- </c:if>--%>
  336. <%-- <c:if test="${info.recommendStatus ne 1 }">--%>
  337. <%-- <a href="javascript:void(0)" onclick="updateStatus('1','${info.id}','recommendStatus','${info.enabledStatus}');">--%>
  338. <%-- <img alt="停用" src="/static/images/no.gif" width="15px" border="none" title="停用">--%>
  339. <%-- </a>--%>
  340. <%-- </c:if>--%>
  341. <%-- </td>--%>
  342. <td>
  343. <c:if test="${info.enabledStatus eq 1 }">
  344. <font color="green">已发布</font>
  345. <a href="javascript:void(0)" onclick="updateStatus('0','${info.id}','enabledStatus','${info.enabledStatus}');" style="cursor: pointer">存草稿
  346. </a>
  347. </c:if>
  348. <c:if test="${info.enabledStatus ne 1 }">
  349. <font color="red">存草稿</font>
  350. <a href="javascript:void(0)" onclick="updateStatus('1','${info.id}','enabledStatus','${info.enabledStatus}');" style="cursor: pointer">发布
  351. </a>
  352. </c:if>
  353. </td>
  354. <td hidden>
  355. <label id="homePageImage${index.index}">${info.homePageImage}</label>
  356. </td>
  357. <shiro:hasPermission name="info:info:edit"><td style="width: 150px">
  358. <a href="${fns:getConfig('wwwServer')}info/detail-${info.id}-1.html" target="_blank">查看</a>
  359. <a href="${ctx}/info/info/form?id=${info.id}">编辑</a>
  360. <shiro:hasPermission name="info:info:delete">
  361. <a href="${ctx}/info/info/delete?id=${info.id}" onclick="return confirmx('确认要删除该文章列表吗?', this.href)">删除</a>
  362. </shiro:hasPermission>
  363. <a href="javascript:void(0);" onclick="updateIndex('${info.id}');">更新索引</a>
  364. <a onclick="showTopSelect(${index.index},'open')" href="javascript:void(0)">首页置顶</a>
  365. <c:if test="${info.topPosition ne null}">
  366. <a onclick="updateTopPosition('','${info.id}','clearTopPosition')" href="javascript:void(0)">清除置顶</a>
  367. </c:if>
  368. <a style="white-space: nowrap" href="${ctx}/info/info/relatedForm?id=${info.id}">相关阅读</a>
  369. <div style="display: none" class="topSelect" id="topSelect${index.index}" onmouseleave="showTopSelect(${index.index},'close')">
  370. <table style="border: 2px solid #000000;" cellpadding="0" cellspacing="0">
  371. <tbody>
  372. <tr>
  373. <td><a onclick="updateTopPosition('1',${info.id},'setTopPosition')" href="javascript:void(0)">置顶第一位</a></td>
  374. </tr>
  375. <tr>
  376. <td><a onclick="updateTopPosition('2',${info.id},'setTopPosition')" href="javascript:void(0)">置顶第二位</a></td>
  377. </tr>
  378. <tr>
  379. <td><a onclick="updateTopPosition('3',${info.id},'setTopPosition')" href="javascript:void(0)">置顶第三位</a></td>
  380. </tr>
  381. </tbody>
  382. </table>
  383. </div>
  384. </td></shiro:hasPermission>
  385. </tr>
  386. </c:forEach>
  387. </tbody>
  388. </table>
  389. <div class="pagination">${page}</div>
  390. </body>
  391. </html>