Example.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <?php
  2. namespace addons\example;
  3. use app\common\library\Menu;
  4. use think\Addons;
  5. /**
  6. * Example
  7. */
  8. class Example extends Addons
  9. {
  10. /**
  11. * 插件安装方法
  12. * @return bool
  13. */
  14. public function install()
  15. {
  16. $menu = [
  17. [
  18. 'name' => 'example',
  19. 'title' => '开发示例管理',
  20. 'icon' => 'fa fa-magic',
  21. 'sublist' => [
  22. [
  23. 'name' => 'example/bootstraptable',
  24. 'title' => '表格完整示例',
  25. 'icon' => 'fa fa-table',
  26. 'sublist' => [
  27. ['name' => 'example/bootstraptable/index', 'title' => '查看'],
  28. ['name' => 'example/bootstraptable/detail', 'title' => '详情'],
  29. ['name' => 'example/bootstraptable/change', 'title' => '变更'],
  30. ['name' => 'example/bootstraptable/del', 'title' => '删除'],
  31. ['name' => 'example/bootstraptable/multi', 'title' => '批量更新'],
  32. ]
  33. ],
  34. [
  35. 'name' => 'example/customsearch',
  36. 'title' => '自定义搜索',
  37. 'icon' => 'fa fa-table',
  38. 'sublist' => [
  39. ['name' => 'example/customsearch/index', 'title' => '查看'],
  40. ['name' => 'example/customsearch/del', 'title' => '删除'],
  41. ['name' => 'example/customsearch/multi', 'title' => '批量更新'],
  42. ]
  43. ],
  44. [
  45. 'name' => 'example/customform',
  46. 'title' => '自定义表单示例',
  47. 'icon' => 'fa fa-edit',
  48. 'sublist' => [
  49. ['name' => 'example/customform/index', 'title' => '查看'],
  50. ]
  51. ],
  52. [
  53. 'name' => 'example/tablelink',
  54. 'title' => '表格联动示例',
  55. 'icon' => 'fa fa-table',
  56. 'remark' => '点击左侧日志列表,右侧的表格数据会显示指定管理员的日志列表',
  57. 'sublist' => [
  58. ['name' => 'example/tablelink/index', 'title' => '查看'],
  59. ]
  60. ],
  61. [
  62. 'name' => 'example/colorbadge',
  63. 'title' => '彩色角标',
  64. 'icon' => 'fa fa-table',
  65. 'remark' => '左侧彩色的角标会根据当前数据量的大小进行更新',
  66. 'sublist' => [
  67. ['name' => 'example/colorbadge/index', 'title' => '查看'],
  68. ['name' => 'example/colorbadge/del', 'title' => '删除'],
  69. ['name' => 'example/colorbadge/multi', 'title' => '批量更新'],
  70. ]
  71. ],
  72. [
  73. 'name' => 'example/controllerjump',
  74. 'title' => '控制器间跳转',
  75. 'icon' => 'fa fa-table',
  76. 'remark' => '点击IP地址可以跳转到新的选项卡中查看指定IP的数据',
  77. 'sublist' => [
  78. ['name' => 'example/controllerjump/index', 'title' => '查看'],
  79. ['name' => 'example/controllerjump/del', 'title' => '删除'],
  80. ['name' => 'example/controllerjump/multi', 'title' => '批量更新'],
  81. ]
  82. ],
  83. [
  84. 'name' => 'example/cxselect',
  85. 'title' => '多级联动',
  86. 'icon' => 'fa fa-table',
  87. 'remark' => '基于jquery.cxselect实现的多级联动',
  88. 'sublist' => [
  89. ['name' => 'example/cxselect/index', 'title' => '查看'],
  90. ['name' => 'example/cxselect/del', 'title' => '删除'],
  91. ['name' => 'example/cxselect/multi', 'title' => '批量更新'],
  92. ]
  93. ],
  94. [
  95. 'name' => 'example/multitable',
  96. 'title' => '多表格示例',
  97. 'icon' => 'fa fa-table',
  98. 'remark' => '展示在一个页面显示多个Bootstrap-table表格',
  99. 'sublist' => [
  100. ['name' => 'example/multitable/index', 'title' => '查看'],
  101. ['name' => 'example/multitable/del', 'title' => '删除'],
  102. ['name' => 'example/multitable/multi', 'title' => '批量更新'],
  103. ]
  104. ],
  105. [
  106. 'name' => 'example/relationmodel',
  107. 'title' => '关联模型示例',
  108. 'icon' => 'fa fa-table',
  109. 'remark' => '列表中的头像、用户名和昵称字段均从关联表中取出',
  110. 'sublist' => [
  111. ['name' => 'example/relationmodel/index', 'title' => '查看'],
  112. ['name' => 'example/relationmodel/del', 'title' => '删除'],
  113. ['name' => 'example/relationmodel/multi', 'title' => '批量更新'],
  114. ]
  115. ],
  116. [
  117. 'name' => 'example/tabletemplate',
  118. 'title' => '表格模板示例',
  119. 'icon' => 'fa fa-table',
  120. 'remark' => '',
  121. 'sublist' => [
  122. ['name' => 'example/tabletemplate/index', 'title' => '查看'],
  123. ['name' => 'example/tabletemplate/detail', 'title' => '详情'],
  124. ['name' => 'example/tabletemplate/del', 'title' => '删除'],
  125. ['name' => 'example/tabletemplate/multi', 'title' => '批量更新'],
  126. ]
  127. ],
  128. [
  129. 'name' => 'example/baidumap',
  130. 'title' => '百度地图示例',
  131. 'icon' => 'fa fa-map-pin',
  132. 'sublist' => [
  133. ['name' => 'example/baidumap/index', 'title' => '查看'],
  134. ['name' => 'example/baidumap/map', 'title' => '详情'],
  135. ['name' => 'example/baidumap/del', 'title' => '删除'],
  136. ]
  137. ],
  138. [
  139. 'name' => 'example/echarts',
  140. 'title' => '统计图表示例',
  141. 'icon' => 'fa fa-bar-chart',
  142. 'sublist' => [
  143. ['name' => 'example/echarts/index', 'title' => '查看'],
  144. ]
  145. ],
  146. ]
  147. ]
  148. ];
  149. Menu::create($menu);
  150. return true;
  151. }
  152. /**
  153. * 插件卸载方法
  154. * @return bool
  155. */
  156. public function uninstall()
  157. {
  158. Menu::delete('example');
  159. return true;
  160. }
  161. /**
  162. * 插件启用方法
  163. */
  164. public function enable()
  165. {
  166. Menu::enable('example');
  167. }
  168. /**
  169. * 插件禁用方法
  170. */
  171. public function disable()
  172. {
  173. Menu::disable('example');
  174. }
  175. }