recovery.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. {extend name="base"/}
  2. {block name="resources"}
  3. <style>
  4. .no-content-tip{
  5. text-align:center;
  6. padding:20px 0px;
  7. }
  8. </style>
  9. {/block}
  10. {block name="main"}
  11. {if condition="!empty($upgrade_log_info)"}
  12. <div class="single-filter-box">
  13. <button class="layui-btn" id="recovery_btn">一键回滚</button>
  14. </div>
  15. <div class="index-box">
  16. <div class="index-content">
  17. <div class="system-function">
  18. <table class="layui-table">
  19. <colgroup>
  20. <col width="15%">
  21. <col width="15%">
  22. <col width="15%">
  23. <col width="15%">
  24. <col width="40%">
  25. </colgroup>
  26. <thead>
  27. <tr>
  28. <th>主体</th>
  29. <th>操作</th>
  30. <th>升级前版本</th>
  31. <th>升级后版本</th>
  32. <th>升级内容</th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. {volist name="$upgrade_log_info.version_info" id="item"}
  37. <tr>
  38. <td>{$item.goods_name}</td>
  39. <td>{$item.action_name}</td>
  40. <td>{$item.current_version_name}</td>
  41. <td>{$item.latest_version_name}</td>
  42. <td>
  43. <a href="javascript:;" onclick="showScripts(this)" data-data='{:json_encode($item.scripts)}'>查看升级内容</a>
  44. </td>
  45. </tr>
  46. {/volist}
  47. </tbody>
  48. </table>
  49. </div>
  50. </div>
  51. </div>
  52. {else/}
  53. <div class="no-content-tip">暂无可回滚内容</div>
  54. {/if}
  55. {/block}
  56. {block name="script"}
  57. <script type="text/html" id="upgrade_desc">
  58. <div><span>更新版本数:{{d.length}}</span></div>
  59. <table class="layui-table" lay-skin="lg">
  60. <colgroup>
  61. <col width="20%">
  62. <col width="80%">
  63. </colgroup>
  64. <thead>
  65. <tr>
  66. <th>版本号</th>
  67. <th>更新说明</th>
  68. </tr>
  69. </thead>
  70. <tbody>
  71. {{# layui.each(d, function(index, item){ }}
  72. <tr>
  73. <td>{{item.version_name}}</td>
  74. <td>{{item.description}}</td>
  75. </tr>
  76. {{# }) }}
  77. </tbody>
  78. </table>
  79. </script>
  80. <script>
  81. var laytpl;
  82. layui.use(['laytpl'], function() {
  83. laytpl = layui.laytpl;
  84. })
  85. function showScripts(e) {
  86. var scripts = $(e).data('data');
  87. var uploadHtml = $("#upgrade_desc").html();
  88. laytpl(uploadHtml).render(scripts, function(html) {
  89. layer.open({
  90. type: 1,
  91. title: '更新说明',
  92. area: ['700px', '500px'],
  93. content: html
  94. });
  95. })
  96. }
  97. $("#recovery_btn").click(function(){
  98. var confirm_index = layer.confirm('确定要回滚吗?', ['确定', '取消'], function(){
  99. layer.close(confirm_index);
  100. var load_index = layer.load(1, {
  101. shade: [0.1,'#fff'] //0.1透明度的白色背景
  102. });
  103. $.ajax({
  104. type:'post',
  105. url : ns.url("shop/upgrade/recovery"),
  106. dataType : 'json',
  107. success:function(res){
  108. if(res.code >= 0){
  109. layer.msg('回滚成功', function(index, layero){
  110. window.location.reload();
  111. })
  112. }else{
  113. layer.msg('回滚失败,错误信息为:' + res.message);
  114. }
  115. layer.close(load_index);
  116. }
  117. })
  118. })
  119. })
  120. </script>
  121. {/block}