pk.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('点点币PK')"/>
  5. </head>
  6. <body class="gray-bg">
  7. <div class="container-div">
  8. <div class="row">
  9. <div class="col-sm-12 search-collapse">
  10. <form id="role-form">
  11. <div class="select-list">
  12. <ul>
  13. <li>
  14. 期号:<input type="text" name="term" placeholder=""/>
  15. </li>
  16. <li>
  17. 活动状态:<select name="pkStatus" th:with="type=${@dict.getType('point_pk_activity_status')}">
  18. <option value="">所有</option>
  19. <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
  20. th:value="${dict.dictValue}"></option>
  21. </select>
  22. </li>
  23. <li>
  24. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
  25. class="fa fa-search"></i>&nbsp;搜索</a>
  26. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
  27. class="fa fa-refresh"></i>&nbsp;重置</a>
  28. </li>
  29. </ul>
  30. </div>
  31. </form>
  32. </div>
  33. <div class="btn-group-sm" id="toolbar" role="group">
  34. <a class="btn btn-success" onclick="add()" shiro:hasPermission="activity:point:pk:add">
  35. <i class="fa fa-plus"></i> 新增
  36. </a>
  37. </div>
  38. <div class="col-sm-12 select-table table-striped" style="overflow:scroll;">
  39. <table id="bootstrap-table" data-mobile-responsive="false" style="min-width:1500px;"></table>
  40. </div>
  41. </div>
  42. </div>
  43. <th:block th:include="include :: footer"/>
  44. <script th:inline="javascript">
  45. var editFlag = [[${@permission.hasPermi('system:key:edit')}]];
  46. var removeFlag = [[${@permission.hasPermi('system:key:del')}]];
  47. var osType = [[${@dict.getType('point_pk_activity_status')}]];
  48. var prefix = ctx + "activity/point/pk";
  49. $(function () {
  50. var options = {
  51. url: prefix + "/list",
  52. createUrl: prefix + "/add",
  53. updateUrl: prefix + "/edit/{id}",
  54. removeUrl: prefix + "/remove",
  55. modalName: "点点币PK",
  56. height: 600,
  57. columns: [
  58. {
  59. field: 'term',
  60. title: '活动期号',
  61. align: 'center',
  62. formatter: function (val, row, index) {
  63. return "第" + val + "期";
  64. }
  65. },
  66. {
  67. field: 'title',
  68. title: '题目'
  69. },
  70. {
  71. field: 'redPic',
  72. title: '红方图片',
  73. align: 'center',
  74. formatter:function (value,row,index) {
  75. if(typeof value == "undefined" || value == null || value == ""){
  76. return '-';
  77. }else{
  78. return "<img onclick='ShowFloatingImage(this, 400, 300);' src='" + value + "' width='70' height='60'>";
  79. }
  80. }
  81. },
  82. {
  83. field: 'bluePic',
  84. title: '蓝方图片',
  85. align: 'center',
  86. formatter:function (value,row,index) {
  87. if(typeof value == "undefined" || value == null || value == ""){
  88. return '-';
  89. }else{
  90. return "<img onclick='ShowFloatingImage(this, 400, 300);' src='" + value + "' width='70' height='60'>";
  91. }
  92. }
  93. }, {
  94. field: 'redAnswer',
  95. title: '红方选项'
  96. }, {
  97. field: 'blueAnswer',
  98. title: '蓝方选项'
  99. }, {
  100. field: 'redPolls',
  101. title: '红方票数'
  102. }, {
  103. field: 'bluePolls',
  104. title: '蓝方票数'
  105. }, {
  106. field: 'carveUpMcoinNum',
  107. title: '瓜分点点币数'
  108. }, {
  109. field: 'pkStatus',
  110. title: '活动状态',
  111. align: 'center',
  112. formatter: function (value, row, index) {
  113. return $.table.selectDictLabel(osType, value);
  114. }
  115. },
  116. {
  117. field: 'lotteryTime',
  118. title: '开奖时间'
  119. },
  120. {
  121. title: '操作',
  122. align: 'center',
  123. formatter: function (value, row, index) {
  124. var actions = [];
  125. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
  126. return actions.join('');
  127. }
  128. }]
  129. };
  130. $.table.init(options);
  131. });
  132. function add() {
  133. var url = prefix + "/add";
  134. $.modal.open("新增点点币PK", url, '800', '740');
  135. }
  136. function edit(id) {
  137. var url = prefix + "/edit/" + id;
  138. $.modal.open("编辑点点币PK", url, '800', '740');
  139. }
  140. function remove(id) {
  141. $.modal.confirm("确认要删除该记录吗?", function () {
  142. $.operate.post(prefix + "/del?signKey=" + id);
  143. });
  144. }
  145. //3个参数 分别是图片对象,图片宽度,图片高度
  146. function ShowFloatingImage(image, width, height) {
  147. //这一部分是创建一个div,将图片放大成设定的width,height
  148. var id = "trailimageid";
  149. var newdiv = document.getElementById(id);
  150. if(newdiv == null) {
  151. newdiv = document.createElement('div');
  152. newdiv.setAttribute('id',id);
  153. //需要一个移出事件,将图片返回原来大小
  154. newdiv.setAttribute('onmouseout', "HideElement('"+id+"');");
  155. document.body.appendChild(newdiv);
  156. }
  157. newdiv.innerHTML = '<img src='+image.src+ ' width='+(image.width + width) + ' height=' + (image.height + height) + ' />';
  158. //获取图片位置,调整图片位置样式
  159. var absPos = GetAbsPosition(image);
  160. newdiv.style.position = "absolute";
  161. newdiv.style.left =absPos[0] - width/2+'px';
  162. newdiv.style.top = absPos[1] - height/2+'px';
  163. newdiv.style.display="block";
  164. }
  165. //获取图片在表格中位置
  166. function GetAbsPosition(obj) {
  167. var curleft = 0, curtop = 0;
  168. do {
  169. curleft += obj.offsetLeft;
  170. curtop += obj.offsetTop;
  171. } while (obj = obj.offsetParent);
  172. return [curleft,curtop];
  173. }
  174. //隐藏div
  175. function HideElement(id) {
  176. var elem = document.getElementById(id);
  177. elem.style.display="none";
  178. }
  179. </script>
  180. </body>
  181. </html>