advert.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <!--[if lt IE 9]>
  10. <script type="text/javascript" src="${ctx}/assets/lib/html5.js"></script>
  11. <script type="text/javascript" src="${ctx}/assets/lib/respond.min.js"></script>
  12. <script type="text/javascript" src="${ctx}/assets/lib/PIE_IE678.js"></script>
  13. <![endif]-->
  14. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui/css/H-ui.min.css" />
  15. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/H-ui.admin.css" />
  16. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/Hui-iconfont/1.0.7/iconfont.css" />
  17. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/icheck/icheck.css" />
  18. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/skin/default/skin.css" id="skin" />
  19. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/style.css" />
  20. <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
  21. <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.js"></script>
  22. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
  23. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
  24. <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
  25. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
  26. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
  27. <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
  28. <script type="text/javascript" src="${ctx}/assets/lib/layer/3.0.3/layer.js"></script>
  29. <!--[if IE 6]>
  30. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  31. <script>DD_belatedPNG.fix('*');</script>
  32. <![endif]-->
  33. <script type="text/javascript">
  34. $(function() {
  35. $(window).resize(function(){
  36. $("#jqGrid").setGridWidth($(window).width()-40); 
  37. });
  38. $("#jqGrid").jqGrid({
  39. url : '${ctx}/myconsole/advert/getByPage',
  40. editurl:"${ctx}/myconsole/advert/saveOrUpdate2",
  41. mtype : "POST",
  42. datatype : "json",
  43. prmNames:{id:"keyid"},
  44. caption:'广告管理',
  45. colModel : [ {
  46. label : '编号',
  47. name : 'keyid',
  48. hidden : true,
  49. key : true,
  50. width : 50
  51. }, {
  52. label : '广告名称',
  53. name : 'advertname',
  54. editable: true,
  55. width : 80
  56. },{
  57. label : '广告内容',
  58. name : 'advertcontent',
  59. editable: true,
  60. hidden :true,
  61. editrules:{edithidden:true},
  62. edittype : "textarea",
  63. editoptions: {
  64. size:50,
  65. maxlength: 500,
  66. rows:"5",
  67. cols:"40"
  68. }
  69. }, {
  70. label : '广告链接',
  71. name : 'advertlink',
  72. editable: true,
  73. width : 80
  74. }, {
  75. label : '广告宽度',
  76. name : 'advertwidth',
  77. editable: true,
  78. width : 80
  79. }, {
  80. label : '广告高度',
  81. name : 'advertheight',
  82. editable: true,
  83. width : 80
  84. }, {
  85. label : '顶部位置',
  86. name : 'adverttop',
  87. editable: true,
  88. width : 80
  89. }, {
  90. label : '左侧位置',
  91. name : 'advertleft',
  92. editable: true,
  93. width : 80
  94. }, {
  95. label : '广告状态',
  96. name : 'tstate',
  97. editable: true,
  98. formatter:"select",
  99. edittype: "select",
  100. editoptions: {
  101. value: "true:启用;false:停用"
  102. },
  103. stype:"select",
  104. searchoptions:{
  105. value: "true:启用;false:停用"
  106. },
  107. width : 80
  108. }, {
  109. label : '展示方式',
  110. name : 'adverttype',
  111. editable: true,
  112. formatter:"select",
  113. edittype: "select",
  114. editoptions: {
  115. value: "bay:飘窗;fix:固定"
  116. },
  117. stype:"select",
  118. searchoptions:{
  119. value: "bay:飘窗;fix:固定"
  120. },
  121. width : 80
  122. }, {
  123. label : '广告位置',
  124. name : 'advertposition',
  125. editable: true,
  126. formatter:"select",
  127. edittype: "select",
  128. editoptions: {
  129. value: "${AdvertPosition}"
  130. },
  131. stype:"select",
  132. searchoptions:{
  133. value: "${AdvertPosition}"
  134. },
  135. }, {
  136. label : '是否可关闭',
  137. name : 'showclose',
  138. editable: true,
  139. formatter:"select",
  140. edittype: "select",
  141. editoptions: {
  142. value: "true:是;false:否"
  143. },
  144. stype:"select",
  145. searchoptions:{
  146. value: "true:是;false:否"
  147. },
  148. width : 80
  149. }, {
  150. label : '是否显示头部',
  151. name : 'showheader',
  152. editable: true,
  153. formatter:"select",
  154. edittype: "select",
  155. editoptions: {
  156. value: "true:是;false:否"
  157. },
  158. stype:"select",
  159. searchoptions:{
  160. value: "true:是;false:否"
  161. },
  162. width : 80
  163. }, {
  164. label : '是否固定位置',
  165. name : 'isfixed',
  166. editable: true,
  167. formatter:"select",
  168. edittype: "select",
  169. editoptions: {
  170. value: "true:是;false:否"
  171. },
  172. stype:"select",
  173. searchoptions:{
  174. value: "true:是;false:否"
  175. },
  176. width : 80
  177. }, {
  178. label : '延迟消失时间',
  179. name : 'delayhide',
  180. editable: true,
  181. formatter:"select",
  182. edittype: "select",
  183. editoptions: {
  184. value: "0:不消失;3000:3秒;5000:5秒;10000:10秒"
  185. },
  186. stype:"select",
  187. searchoptions:{
  188. value: "0:不消失;3000:3秒;5000:5秒;10000:10秒"
  189. },
  190. width : 80
  191. }, {
  192. label : '站点',
  193. name : 'siteid',
  194. editable: true,
  195. formatter:"select",
  196. edittype: "select",
  197. editoptions: {
  198. value: "${siteOption}"
  199. },
  200. stype:"select",
  201. searchoptions:{
  202. value: "${siteOption}"
  203. },
  204. width : 80
  205. },{
  206. label : '操作',
  207. name:'operMod',
  208. index:'operMod',
  209. align:"center",
  210. width:"40",
  211. formatter: function (cellvalue, options, rowdata) {
  212. var html = "";
  213. //html=html+"<button class='btn btn-success radius size-S' onclick=publish('"+rowdata.keyid+"')>发布</button>";
  214. return html;
  215. }
  216. }],
  217. rownumbers : true,//添加左侧行号
  218. viewrecords : true,//是否在浏览导航栏显示记录总数
  219. rowNum : 10,//每页显示记录数
  220. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  221. autowidth : true,
  222. height : 'auto',
  223. pager : "#jqGridPager"
  224. });
  225. $('#jqGrid').navGrid('#jqGridPager',
  226. // the buttons to appear on the toolbar of the grid
  227. {
  228. edit : true,
  229. add : true,
  230. del : true,
  231. search : true,
  232. refresh : true,
  233. view : true,
  234. position : "left",
  235. cloneToTop : true
  236. },
  237. // options for the Edit Dialog
  238. {
  239. recreateForm : true,
  240. checkOnUpdate : true,
  241. checkOnSubmit : true,
  242. closeAfterEdit : true,
  243. onInitializeForm:function(formid) {
  244. },
  245. serializeEditData: function(postdata) {
  246. //myconsole.log(postdata);
  247. $.each(postdata,function (index, value) {
  248. //myconsole.log(index);
  249. if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
  250. modifyJosnKey(postdata,index,"advert."+index);
  251. }
  252. if(index=="keyid"){
  253. postdata["advert."+index]=value
  254. }
  255. })
  256. //myconsole.log(postdata);
  257. return postdata;
  258. },
  259. afterSubmit: function (response, postdata) {
  260. // console.log(response);
  261. var res=eval('(' + response.responseText + ')');
  262. layer.msg(res.msg);
  263. return [res.state,res.msg,''];
  264. },
  265. errorTextFormat : function(data) {
  266. return 'Error: ' + data.responseText
  267. }
  268. },
  269. // options for the Add Dialog
  270. {
  271. closeAfterAdd : true,
  272. recreateForm : true,
  273. beforeSubmit: function(postdata, formid){
  274. $.each(postdata,function (index, value) {
  275. if(index!="jqGrid_id" && index!="oper"){
  276. modifyJosnKey(postdata,index,"advert."+index);
  277. }
  278. })
  279. return[true,''];
  280. },
  281. afterSubmit: function (response, postdata) {
  282. // console.log(response);
  283. var res=eval('(' + response.responseText + ')');
  284. layer.msg(res.msg);
  285. return [res.state,res.msg,''];
  286. },
  287. errorTextFormat : function(data) {
  288. return 'Error: ' + data.responseText
  289. }
  290. },
  291. // options for the Delete Dailog
  292. {
  293. errorTextFormat : function(data) {
  294. return 'Error: ' + data.responseText
  295. }
  296. },{
  297. // search options 这里支持多条件查询
  298. multipleSearch: true,
  299. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  300. afterSubmit: function(r, data) {
  301. var messageString = r.responseText;
  302. var mesObj = eval('(' + messageString + ')');
  303. return [mesObj.state, mesObj.message];
  304. }
  305. }
  306. );
  307. $("#publishAll").click(function(){
  308. $.post("${ctx}/myconsole/advert/publishAll",function(data){
  309. var msg="执行失败";
  310. if(data=="true"){
  311. msg="执行成功";
  312. }
  313. layer.msg(msg);
  314. })
  315. })
  316. })
  317. function publish(advertKeyID){
  318. $.post("${ctx}/myconsole/advert/publish",{"advertKeyID":advertKeyID},function(data){
  319. var msg="执行失败";
  320. if(data=="true"){
  321. msg="执行成功";
  322. }
  323. layer.msg(msg);
  324. })
  325. }
  326. </script>
  327. <title>我的桌面</title>
  328. </head>
  329. <body>
  330. <div class="page-container">
  331. <div style="text-align:right">
  332. <button id="publishAll" class="btn btn-primary radius" type="button"><i class="Hui-iconfont">&#xe632;</i>发布广告</button>
  333. </div>
  334. <table id="jqGrid"></table>
  335. <div id="jqGridPager"></div>
  336. </div>
  337. <footer class="footer mt-20">
  338. <div class="container">
  339. <p></p>
  340. </div>
  341. </footer>
  342. </body>
  343. </html>