image.html 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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('表格图片预览')" />
  5. </head>
  6. <body class="gray-bg">
  7. <div class="container-div">
  8. <div class="row">
  9. <div class="col-sm-12 select-table table-striped">
  10. <table id="bootstrap-table"></table>
  11. </div>
  12. </div>
  13. </div>
  14. <div th:include="include :: footer"></div>
  15. <script th:inline="javascript">
  16. var prefix = ctx + "demo/table";
  17. $(function() {
  18. var options = {
  19. url: prefix + "/list",
  20. showSearch: false,
  21. showRefresh: false,
  22. showToggle: false,
  23. showColumns: false,
  24. columns: [{
  25. checkbox: true
  26. },
  27. {
  28. field : 'userId',
  29. title : '用户ID'
  30. },
  31. {
  32. field : 'userCode',
  33. title : '用户编号'
  34. },
  35. {
  36. field : 'userName',
  37. title : '用户姓名'
  38. },
  39. {
  40. title: '图片',
  41. formatter: function(value, row, index) {
  42. // 图片预览(注意:如存储在本地直接获取数据库路径,如有配置context-path需要使用ctx+路径)
  43. // 如:/profile/upload/2019/08/08/3b7a839aced67397bac694d77611ce72.png
  44. if(index % 2 == 0){
  45. return $.table.imageView('http://demo.ruoyi.vip/img/profile.jpg');
  46. }else {
  47. return $.table.imageView('http://demo.ruoyi.vip/ruoyi.png');
  48. }
  49. }
  50. },
  51. {
  52. field : 'userPhone',
  53. title : '用户手机'
  54. },
  55. {
  56. field : 'userEmail',
  57. title : '用户邮箱'
  58. },
  59. {
  60. field : 'userBalance',
  61. title : '用户余额'
  62. },
  63. {
  64. title: '操作',
  65. align: 'center',
  66. formatter: function(value, row, index) {
  67. var actions = [];
  68. actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
  69. actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
  70. return actions.join('');
  71. }
  72. }]
  73. };
  74. $.table.init(options);
  75. });
  76. </script>
  77. </body>
  78. </html>