local.php 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. use common\helpers\Url;
  3. use common\helpers\Html;
  4. use common\helpers\AddonHelper;
  5. $this->title = '安装插件';
  6. $this->params['breadcrumbs'][] = ['label' => $this->title];
  7. ?>
  8. <div class="row">
  9. <div class="col-sm-12">
  10. <div class="nav-tabs-custom">
  11. <ul class="nav nav-tabs">
  12. <li><a href="<?= Url::to(['index']) ?>"> 已安装的插件</a></li>
  13. <li class="active"><a href="<?= Url::to(['local']) ?>"> 安装插件</a></li>
  14. <li><a href="<?= Url::to(['create']) ?>"> 设计新插件</a></li>
  15. </ul>
  16. <div class="tab-content">
  17. <div class="active tab-pane">
  18. <table class="table table-hover">
  19. <thead>
  20. <tr>
  21. <th>图标</th>
  22. <th>插件名称</th>
  23. <th>作者</th>
  24. <th>简单介绍</th>
  25. <th>版本号</th>
  26. <th>操作</th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. <?php foreach ($list as $key => $vo) { ?>
  31. <tr>
  32. <td class="feed-element" style="width: 70px">
  33. <?php
  34. if ($path = AddonHelper::getAddonIcon($vo['name'])) {
  35. echo Html::img($path, [
  36. 'class' => 'img-rounded m-t-xs img-responsive',
  37. 'width' => '64',
  38. 'height' => '64',
  39. ]);
  40. } else {
  41. echo '<span class="iconfont iconchajian blue" style="font-size: 50px"></span>';
  42. }
  43. ?>
  44. </td>
  45. <td>
  46. <h4><?= Html::encode($vo['title']) ?></h4>
  47. <small><?= Html::encode($vo['name']) ?></small>
  48. </td>
  49. <td><?= Html::encode($vo['author']) ?></td>
  50. <td><?= Html::encode($vo['brief_introduction']) ?></td>
  51. <td><?= Html::encode($vo['version']) ?></td>
  52. <td>
  53. <a href="<?= Url::to(['install', 'name' => $vo['name']]) ?>" onclick="install(this);return false;"><span class="btn btn-primary btn-sm">安装插件</span></a>
  54. </td>
  55. </tr>
  56. <?php } ?>
  57. </tbody>
  58. </table>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <script>
  65. function install(that) {
  66. var href = $(that).attr('href');
  67. swal({
  68. title: '安装中...',
  69. text: '请不要关闭窗口,等待安装',
  70. button: "确定",
  71. });
  72. $.ajax({
  73. type: "get",
  74. url: href,
  75. dataType: "json",
  76. success: function (data) {
  77. if (parseInt(data.code) === 200) {
  78. swal("安装成功", "小手一抖就打开了一个框", "success").then((value) => {
  79. location.reload();
  80. });
  81. } else {
  82. rfAffirm(data.message);
  83. }
  84. }
  85. });
  86. }
  87. </script>
粤ICP备19079148号