截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284
  1. {layout name="layout1" /}
  2. <div class="wrapper">
  3. <div class="layui-card">
  4. <div class="layui-card-body">
  5. <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
  6. <div class="layui-colla-item">
  7. <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
  8. <div class="layui-colla-content layui-show">
  9. *配置微信公众号菜单,点击确认,保存菜单并发布至微信公众号。
  10. </div>
  11. </div>
  12. </div>
  13. </div>
  14. <div class="layui-form" lay-filter="">
  15. <div id="app" class="row">
  16. <div class="col-sm-12">
  17. <div class="wechat-reply-wrapper wechat-menu">
  18. <div class="ibox-content clearfix">
  19. <div class="view-wrapper col-sm-4">
  20. <div class="mobile-header">公众号</div>
  21. <section class="view-body">
  22. <div class="time-wrapper"><span class="time">{:date('H:i:s', time())}</span></div>
  23. </section>
  24. <div class="menu-footer">
  25. <ul class="flex" id="menu">
  26. {foreach $menu as $item_menu => $val_menu}
  27. <li data-id={$item_menu}>
  28. <span class="active-menu"><i class="icon-sub"></i>{$val_menu.name}</span>
  29. <div class="sub-menu">
  30. <ul>
  31. {foreach $val_menu.sub_button as $item_child => $val_child }
  32. <li data-id={$item_menu}_{$item_child}>
  33. <span class="active-menu">{$val_child.name}</span>
  34. </li>
  35. {/foreach}
  36. {if count($val_menu.sub_button) <5}
  37. <li data-id={$item_menu}_1 class="add-menu"><i class="icon-add"></i>
  38. </li>
  39. {/if}
  40. </ul>
  41. </div>
  42. </li>
  43. {/foreach}
  44. {if (!empty($menu) && count($menu) < 3) }
  45. <li data-id={++$item_menu} class="add-menu"><i class="icon-add"></i></li>
  46. {/if}
  47. {if empty($menu) }
  48. <li data-id=1 class="add-menu"><i class="icon-add"></i></li>
  49. {/if}
  50. </ul>
  51. </div>
  52. </div>
  53. <div class="control-wrapper menu-control col-sm-8">
  54. <h3 class="popover-title">菜单名称 <a class="fr del-menu" href="javascript:void(0);">删除</a>
  55. </h3>
  56. <p class="tips-txt">已添加子菜单,仅可设置菜单名称。</p>
  57. <div class="layui-form layui-card-header layuiadmin-card-header-auto">
  58. <div class="layui-form-item">
  59. <div class="layui-inline">
  60. <label class="layui-form-label">菜单名称</label>
  61. <div class="layui-input-block">
  62. <input type="text" name="name" id="menu_name" placeholder="请输入"
  63. autocomplete="off" class="layui-input">
  64. </div>
  65. </div>
  66. <div class="layui-inline">
  67. <label class="layui-form-label">菜单类型</label>
  68. <div class="layui-input-block">
  69. <select lay-filter="menu_type" class="select" id="menu_type">
  70. <option value="click">关键字</option>
  71. <option value="view">跳转网页</option>
  72. <option value="miniprogram">小程序</option>
  73. </select>
  74. </div>
  75. </div>
  76. <div class="layui-inline click">
  77. <label class="layui-form-label">关键字</label>
  78. <div class="layui-input-block">
  79. <input type="text" name="key" id="key" placeholder="请输入"
  80. autocomplete="off" class="layui-input">
  81. </div>
  82. </div>
  83. <div class="layui-inline view" style="display: none">
  84. <label class="layui-form-label">网页链接</label>
  85. <div class="layui-input-block">
  86. <input type="text" name="url" id="url" placeholder="请输入"
  87. autocomplete="off" class="layui-input">
  88. </div>
  89. </div>
  90. <div class="layui-inline miniprogram" style="display: none">
  91. <label class="layui-form-label">appid</label>
  92. <div class="layui-input-block">
  93. <input type="text" name="appid" id="appid" placeholder="请输入"
  94. autocomplete="off" class="layui-input">
  95. </div>
  96. </div>
  97. <div class="layui-inline miniprogram" style="display: none">
  98. <label class="layui-form-label">小程序路径</label>
  99. <div class="layui-input-block">
  100. <input type="text" name="pagepath" id="pagepath" placeholder="请输入"
  101. autocomplete="off" class="layui-input">
  102. </div>
  103. </div>
  104. <div class="layui-block">
  105. <button class="layui-btn layui-btn-sm layui-btn-add_menu {$view_theme_color}">
  106. 确定
  107. </button>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. <div class="layui-form-item">
  116. <div class="layui-input-block">
  117. <button class="layui-btn {$view_theme_color} publish" lay-submit lay-filter="setmnp">发布菜单
  118. </button>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. <style>
  126. @charset "UTF-8";
  127. .flex {
  128. display: -webkit-box;
  129. display: -moz-box;
  130. display: -webkit-flex;
  131. display: -moz-flex;
  132. display: -ms-flexbox;
  133. display: flex;
  134. }
  135. #app {
  136. padding-bottom: 80px
  137. }
  138. #app .layout {
  139. border: 1px solid #d7dde4;
  140. background: #f5f7f9;
  141. position: relative;
  142. border-radius: 4px;
  143. overflow: hidden
  144. }
  145. #app .layout-logo {
  146. width: 100px;
  147. height: 30px;
  148. background: #5b6270;
  149. border-radius: 3px;
  150. float: left;
  151. position: relative;
  152. top: 15px;
  153. left: 20px
  154. }
  155. #app .layout-copy {
  156. text-align: center;
  157. padding: 10px 0 20px;
  158. color: #9ea7b4
  159. }
  160. #app .layout-ceiling {
  161. background: #464c5b;
  162. padding: 10px 0;
  163. overflow: hidden
  164. }
  165. #app .layout-ceiling-main {
  166. float: right;
  167. margin-right: 15px;
  168. }
  169. #app .layout-ceiling-main a {
  170. color: #9ba7b5
  171. }
  172. #app .layout-breadcrumb {
  173. padding: 10px 15px 0
  174. }
  175. #app .layout-content {
  176. min-height: 200px;
  177. margin: 15px;
  178. overflow: hidden;
  179. background: #fff;
  180. border-radius: 4px;
  181. margin-right: 0;
  182. }
  183. #app .layout-content-main {
  184. padding-left: 10px;
  185. position: relative;
  186. width: 98.5%;
  187. }
  188. #app .layout-copy {
  189. text-align: center;
  190. padding: 10px 0 20px;
  191. color: #9ea7b4
  192. }
  193. #app .layout-menu-left {
  194. background: #464c5b
  195. }
  196. #app .layout-header {
  197. height: 40px;
  198. padding-left: 15px;
  199. background: #fff;
  200. box-shadow: 0 1px 1px rgba(0, 0, 0, .1)
  201. }
  202. #app .layout-logo-left {
  203. width: 90%;
  204. height: 30px;
  205. background: #5b6270;
  206. border-radius: 3px;
  207. margin: 15px auto
  208. }
  209. #app .m-frame {
  210. position: absolute;
  211. background-color: #fff;
  212. }
  213. #app .m-tag-item {
  214. display: inline-block
  215. }
  216. #app .layout-header {
  217. padding-left: 15px;
  218. margin-bottom: 5px;
  219. }
  220. #table-list {
  221. padding: 25px 25px 0 25px;
  222. }
  223. #table-list .mp-search-wrapper {
  224. float: right;
  225. margin-left: 12px;
  226. }
  227. #table-list .mp-header-wrapper {
  228. overflow: hidden;
  229. }
  230. #table-list .mp-header-wrapper h1 {
  231. padding-left: 15px;
  232. float: left;
  233. font-size: 18px;
  234. line-height: 24px;
  235. padding-bottom: 20px;
  236. font-weight: 400;
  237. color: #464c5b;
  238. }
  239. .mp-form {
  240. padding: 20px 20px 20px 0;
  241. }
  242. .mp-form .ivu-tree li {
  243. margin: 0;
  244. }
  245. .mp-form .ivu-color-picker .ivu-select-dropdown {
  246. left: -38px !important;
  247. }
  248. .mp-form .mp-upload {
  249. display: inline-block;
  250. }
  251. .mp-form .demo-upload-list {
  252. display: inline-block;
  253. width: 60px;
  254. height: 60px;
  255. text-align: center;
  256. line-height: 60px;
  257. border: 1px solid transparent;
  258. border-radius: 4px;
  259. overflow: hidden;
  260. background: #fff;
  261. position: relative;
  262. box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
  263. margin-right: 4px;
  264. }
  265. .mp-form .demo-upload-list img {
  266. width: 100%;
  267. height: 100%;
  268. }
  269. .mp-form .demo-upload-list-cover {
  270. display: none;
  271. position: absolute;
  272. top: 0;
  273. bottom: 0;
  274. left: 0;
  275. right: 0;
  276. background: rgba(0, 0, 0, .6);
  277. }
  278. .mp-form .demo-upload-list:hover .demo-upload-list-cover {
  279. display: block;
  280. }
  281. .mp-form .demo-upload-list-cover i {
  282. color: #fff;
  283. font-size: 20px;
  284. cursor: pointer;
  285. margin: 0 2px;
  286. }
  287. [v-cloak] {
  288. display: none
  289. }
  290. .mp-form .mp-upload-btn {
  291. width: 58px;
  292. height: 58px;
  293. line-height: 58px;
  294. }
  295. .mp-form .add-submit-item .ivu-btn {
  296. position: fixed;
  297. left: 0;
  298. bottom: 0;
  299. border-radius: 0;
  300. }
  301. .frameMove-enter-active {
  302. animation-name: slideInLeft;
  303. animation-duration: 0.4s !important;
  304. }
  305. .frameMove-leave-active {
  306. animation-name: slideOutRight;
  307. animation-duration: 0.4s !important;
  308. }
  309. .vertical-center-modal {
  310. display: flex;
  311. align-items: center;
  312. justify-content: center;
  313. }
  314. .vertical-center-modal .ivu-modal {
  315. top: 0;
  316. }
  317. .vertical-center-modal .ivu-modal-header {
  318. z-index: 9;
  319. position: relative;
  320. }
  321. .vertical-center-modal .ivu-modal-close {
  322. z-index: 10;
  323. }
  324. .layout-header {
  325. height: 40px;
  326. background: #fff;
  327. box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
  328. }
  329. .wechat-reply-wrapper .fl {
  330. float: left;
  331. }
  332. .wechat-reply-wrapper .fr {
  333. float: right;
  334. }
  335. .wechat-reply-wrapper .clearfix:after {
  336. content: ".";
  337. display: block;
  338. height: 0;
  339. visibility: hidden;
  340. clear: both;
  341. }
  342. .wechat-reply-wrapper .ibox-title {
  343. padding: 15px;
  344. font-size: 16px;
  345. border-bottom: 1px solid #e7eaec;
  346. }
  347. .wechat-reply-wrapper .ibox-title p {
  348. border-left: 2px solid #2494f2;
  349. text-indent: 8px;
  350. }
  351. .wechat-reply-wrapper .ibox-content {
  352. padding: 15px;
  353. display: flex;
  354. flex-wrap: wrap
  355. }
  356. .wechat-reply-wrapper .ibox-content .view-wrapper {
  357. position: relative;
  358. margin-right: 20px;
  359. width: 317px;
  360. background-image: url("/static/admin/images/mobile_head.png");
  361. background-repeat: no-repeat;
  362. background-position: left top;
  363. background-color: #f5f5f5;
  364. margin-bottom: 20px;
  365. }
  366. .wechat-reply-wrapper .ibox-content .view-wrapper .mobile-header {
  367. position: absolute;
  368. left: 0;
  369. top: 36px;
  370. width: 100%;
  371. text-align: center;
  372. color: #fff;
  373. font-size: 16px;
  374. }
  375. .wechat-reply-wrapper .ibox-content .view-wrapper .view-body {
  376. margin-top: 65px;
  377. height: 500px;
  378. }
  379. .wechat-reply-wrapper .view-wrapper .view-body .time-wrapper {
  380. margin-bottom: 10px;
  381. text-align: center;
  382. }
  383. .wechat-reply-wrapper .view-wrapper .view-body .time-wrapper .time {
  384. display: inline-block;
  385. color: #f5f5f5;
  386. display: inline-block;
  387. color: #f5f5f5;
  388. background: rgba(0, 0, 0, .3);
  389. padding: 3px 8px;
  390. border-radius: 3px;
  391. font-size: 12px;
  392. }
  393. .wechat-reply-wrapper .view-wrapper .view-body .view-item {
  394. display: none;
  395. }
  396. .wechat-reply-wrapper .view-wrapper .view-body .view-item.show {
  397. display: none;
  398. }
  399. .wechat-reply-wrapper .view-wrapper .view-body .view-item .avatar {
  400. width: 40px;
  401. height: 40px;
  402. }
  403. .wechat-reply-wrapper .view-wrapper .view-body .view-item .avatar img {
  404. max-width: 100%;
  405. height: auto;
  406. }
  407. .wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content {
  408. position: relative;
  409. max-width: 60%;
  410. min-height: 40px;
  411. margin-left: 15px;
  412. padding: 10px;
  413. border: 1px solid #ccc;
  414. word-break: break-all;
  415. word-wrap: break-word;
  416. line-height: 1.5;
  417. border-radius: 5px;
  418. }
  419. .wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content .picbox {
  420. max-width: 100%;
  421. }
  422. .wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content:before {
  423. content: '';
  424. position: absolute;
  425. left: -13px;
  426. top: 11px;
  427. display: block;
  428. width: 0;
  429. height: 0;
  430. border-left: 8px solid transparent;
  431. border-right: 8px solid transparent;
  432. border-top: 10px solid #ccc;
  433. -webkit-transform: rotate(90deg);
  434. transform: rotate(90deg);
  435. }
  436. .wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content:after {
  437. content: '';
  438. content: '';
  439. position: absolute;
  440. left: -12px;
  441. top: 11px;
  442. display: block;
  443. width: 0;
  444. height: 0;
  445. border-left: 8px solid transparent;
  446. border-right: 8px solid transparent;
  447. border-top: 10px solid #f5f5f5;
  448. -webkit-transform: rotate(90deg);
  449. transform: rotate(90deg);
  450. }
  451. .wechat-reply-wrapper .submit {
  452. text-align: center;
  453. }
  454. /* 图文 */
  455. .view-wrapper .view-body .view-item.news-box {
  456. width: 100%;
  457. background-color: #fff;
  458. border-radius: 5px;
  459. }
  460. .view-wrapper .view-body .view-item .vn-content {
  461. padding: 0;
  462. }
  463. .view-wrapper .view-body .view-item .vn-content .vn-title {
  464. line-height: 1.5;
  465. font-size: 16px;
  466. }
  467. .view-wrapper .view-body .view-item .vn-content .vn-time {
  468. padding: 5px 0;
  469. font-size: 12px;
  470. color: #999;
  471. }
  472. .view-wrapper .view-body .view-item .vn-content .vn-picture {
  473. width: 100%;
  474. height: 150px;
  475. background-size: cover;
  476. background-position: center center;
  477. border-radius: 5px 5px 0 0;
  478. }
  479. .view-wrapper .view-body .view-item .vn-content .vn-picture-info {
  480. line-height: 22px;
  481. color: #7b7b7b;
  482. padding: 0;
  483. display: block;
  484. overflow: hidden;
  485. word-break: break-all;
  486. text-overflow: ellipsis;
  487. font-size: 12px;
  488. white-space: nowrap;
  489. }
  490. .view-wrapper .view-body .view-item .vn-more {
  491. display: block;
  492. padding: 10px 0 0;
  493. border-top: 1px solid #dddddd;
  494. overflow: hidden;
  495. white-space: nowrap;
  496. text-overflow: ellipsis;
  497. }
  498. .view-wrapper .view-body .view-item .vn-content .con-item-box {
  499. position: relative;
  500. }
  501. .view-wrapper .view-body .view-item .vn-content .con-item-box .first-title {
  502. width: 100%;
  503. height: 44px;
  504. line-height: 44px;
  505. font-size: 14px;
  506. position: absolute;
  507. left: 0;
  508. bottom: 0;
  509. overflow: hidden;
  510. text-overflow: ellipsis;
  511. white-space: nowrap; /*background: rgba(0,0,0,.8);*/
  512. color: #fff;
  513. text-indent: 1em;
  514. }
  515. .view-wrapper .view-body .view-item .vn-content .con-item-list {
  516. margin-top: 10px;
  517. margin: 6px 10px 0 10px;
  518. border-top: 1px solid #FBFBFB;
  519. }
  520. .view-wrapper .view-body .view-item .vn-content .con-item-list .list-tit-info {
  521. width: 70%;
  522. line-height: 1.5;
  523. word-wrap: break-word;
  524. }
  525. .view-wrapper .view-body .view-item .vn-content .con-item-list .list-pic {
  526. width: 20%;
  527. min-height: 50px;
  528. background-size: cover;
  529. background-position: center center;
  530. }
  531. /* 音乐 */
  532. .view-wrapper .view-body .view-item.music-box .box-content {
  533. position: relative;
  534. width: 100%;
  535. background: #080;
  536. color: #fff;
  537. border-color: #080;
  538. }
  539. .view-wrapper .view-body .view-item.music-box .box-content p {
  540. width: 75%;
  541. overflow: hidden;
  542. white-space: nowrap;
  543. text-overflow: ellipsis;
  544. }
  545. .view-wrapper .view-body .view-item.music-box .box-content .music-icon {
  546. position: absolute;
  547. right: 11px;
  548. top: 50%;
  549. width: 30px;
  550. height: 30px;
  551. background: #0a0;
  552. text-align: center;
  553. line-height: 30px;
  554. margin-top: -15px;
  555. font-size: 16px;
  556. }
  557. .view-wrapper .view-body .view-item.music-box .box-content:after {
  558. display: none;
  559. }
  560. .view-wrapper .view-body .view-item.music-box .box-content:before {
  561. border-top: 10px solid #080;
  562. }
  563. /* 视频 */
  564. .view-wrapper .view-body .view-item.video-box {
  565. width: 100%;
  566. background-color: #fff;
  567. border: 1px solid #ccc;
  568. border-radius: 5px;
  569. }
  570. .view-wrapper .view-body .view-item.video-box .vn-title {
  571. overflow: hidden;
  572. white-space: nowrap;
  573. text-overflow: ellipsis;
  574. }
  575. /* 右侧控制器 */
  576. .wechat-reply-wrapper .ibox-content .control-wrapper {
  577. position: relative;
  578. width: 535px;
  579. height: 565px;
  580. padding: 0;
  581. border: 1px solid #e2e2e2;
  582. display: none
  583. }
  584. .wechat-reply-wrapper .ibox-content .control-wrapper .control-title {
  585. position: absolute;
  586. left: 71px;
  587. top: -12px;
  588. width: auto;
  589. padding: 0 10px;
  590. font-size: 20px;
  591. background-color: #fff;
  592. }
  593. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body {
  594. margin-top: 40px;
  595. padding: 0 10px;
  596. }
  597. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group label {
  598. font-weight: normal;
  599. }
  600. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .tips:after {
  601. content: '*';
  602. color: red;
  603. position: absolute;
  604. margin-left: 4px;
  605. font-weight: bold;
  606. line-height: 1.8em;
  607. }
  608. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .group-item {
  609. position: relative;
  610. }
  611. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .group-item .file-btn {
  612. position: absolute;
  613. right: 15px;
  614. top: 0;
  615. display: block;
  616. width: 66px;
  617. border-radius: 6px;
  618. cursor: pointer;
  619. padding: .5rem;
  620. background-color: #18a689;
  621. color: #fff;
  622. text-align: center;
  623. height: 100%;
  624. line-height: 23px;
  625. }
  626. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .group-item textarea {
  627. resize: none;
  628. width: 100%;
  629. height: 100px;
  630. padding: 10px;
  631. }
  632. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body .tips-info {
  633. padding-left: 100px;
  634. font-size: 12px;
  635. color: #737373;
  636. }
  637. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body .control-main .control-item {
  638. display: none;
  639. }
  640. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body .control-main .control-item.show {
  641. display: block;
  642. }
  643. /* 微信菜单定制 */
  644. .wechat-menu {
  645. position: relative;
  646. }
  647. .wechat-menu ul {
  648. padding: 0;
  649. }
  650. .wechat-menu .menu-footer {
  651. position: absolute;
  652. left: 0;
  653. bottom: -10px;
  654. width: 100%;
  655. padding-left: 43px;
  656. box-sizing: border-box;
  657. background: url("/static/admin/images/mobile_foot.png") no-repeat 0 0;
  658. border-top: 1px solid #e7e7eb;
  659. }
  660. .wechat-menu .menu-footer span {
  661. display: block;
  662. }
  663. .wechat-menu .menu-footer .icon-add {
  664. background: url("/static/admin/images/index.png") 0 0 no-repeat;
  665. width: 14px;
  666. height: 14px;
  667. vertical-align: middle;
  668. display: inline-block;
  669. margin-top: -2px;
  670. border-bottom: none !important;
  671. }
  672. .wechat-menu .menu-footer li {
  673. position: relative;
  674. -webkit-flex: 1;
  675. -moz-flex: 1;
  676. -ms-flex: 1;
  677. flex: 1;
  678. height: 50px;
  679. line-height: 50px;
  680. text-align: center;
  681. cursor: pointer;
  682. list-style: none;
  683. border: 1px solid transparent;
  684. border-right: 1px solid #e7e7eb;
  685. }
  686. .wechat-menu .menu-footer .icon-sub {
  687. background: url("/static/admin/images/index.png") 0 -48px no-repeat;
  688. width: 7px;
  689. height: 7px;
  690. vertical-align: middle;
  691. display: inline-block;
  692. margin-right: 2px;
  693. margin-top: -2px;
  694. }
  695. .wechat-menu .menu-footer .sub-menu {
  696. position: absolute;
  697. border-radius: 3px;
  698. border: 1px solid #d0d0d0;
  699. display: block;
  700. bottom: 60px;
  701. width: 100%;
  702. background-color: #fafafa;
  703. }
  704. .wechat-menu .menu-footer .sub-menu:after {
  705. content: '';
  706. position: absolute;
  707. width: 10px;
  708. height: 10px;
  709. background: #fafafa;
  710. -webkit-transform: rotate(45deg);
  711. -moz-transform: rotate(45deg);
  712. -ms-transform: rotate(45deg);
  713. transform: rotate(45deg);
  714. bottom: -5px;
  715. border-bottom: 1px solid #d0d0d0;
  716. border-right: 1px solid #d0d0d0;
  717. left: 50%;
  718. margin-left: -5px;
  719. }
  720. .wechat-menu .menu-footer .sub-menu li {
  721. border-right: 0;
  722. border-bottom: 1px solid #d0d0d0;
  723. }
  724. .wechat-menu .menu-footer .sub-menu li:last-child {
  725. border-bottom: 0;
  726. }
  727. .wechat-menu .menu-footer .active {
  728. border: 1px solid #44b549;
  729. }
  730. .wechat-menu .menu-footer .sub-menu li.active {
  731. border: 1px solid #44b549 !important;
  732. }
  733. /* 右侧 */
  734. .wechat-menu .menu-control .popover-title {
  735. padding: 8px 14px;
  736. margin: 0;
  737. font-size: 14px;
  738. background-color: #f7f7f7;
  739. border-bottom: 1px solid #ebebeb;
  740. border-radius: 5px 5px 0 0;
  741. font-weight: 400;
  742. wechat-reply-wrapper . ibox-content . control-wrapper
  743. }
  744. .wechat-menu .menu-control .popover-title a {
  745. color: #06C;
  746. font-size: 12px;
  747. }
  748. .wechat-menu .menu-control .tips-txt {
  749. line-height: 40px;
  750. padding: 0 20px;
  751. }
  752. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content {
  753. padding: 0 20px;
  754. margin-top: 0;
  755. }
  756. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content .radio {
  757. display: inline-block !important;
  758. width: 45%;
  759. }
  760. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content .menu-control-box {
  761. padding: 0 20px;
  762. }
  763. .wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content .menu-control-box .radio {
  764. display: block !important;
  765. width: 100%;
  766. }
  767. .menu-control-box .item {
  768. display: none;
  769. }
  770. .menu-control-box .show {
  771. display: block;
  772. }
  773. </style>
  774. <script>
  775. layui.config({
  776. version:"{$front_version}",
  777. base: '/static/lib/' //静态资源所在路径
  778. }).use(['element', 'table', 'jquery'], function () {
  779. var $ = layui.$, form = layui.form;
  780. var menu = JSON.parse('{:json_encode($menu)}');
  781. // 菜单被选中
  782. $(document).on('click', '.active-menu', function () {
  783. var ids = $(this).parent().attr("data-id");
  784. var id = ids.split("_");
  785. $('.active').removeClass('active');
  786. $(this).addClass("active");
  787. if (id.length < 2) { // 一级菜单
  788. var one_id = $('.active').parent().index();
  789. menu_info = menu[one_id];
  790. } else { // 二级菜单
  791. var two_id = $('.active').parent().index();
  792. var one_id = $('.active').parent().parent().parent().parent().index();
  793. menu_info = menu[one_id].sub_button[two_id];
  794. }
  795. if (menu_info) {
  796. // 回显菜单信息
  797. menuInfo(menu_info);
  798. // 显示 右侧菜单控制框
  799. $('.menu-control').css('display', 'block');
  800. } else { //
  801. initMenu();
  802. }
  803. })
  804. //删除菜单
  805. $(document).on('click', '.del-menu', function () {
  806. var data_id = $('.active').parent();
  807. //用于判断几级菜单
  808. var ids = data_id.attr("data-id");
  809. var id = ids.split("_");
  810. if (id.length == 1) { // 一级菜单
  811. var one_id = $('.active').parent().index();
  812. menu.splice(one_id, 1);
  813. if (menu.length == 2) { // 如果一级菜单的第3个菜单被删除了,要追加一个 添加一级菜单 的按钮
  814. var data_id = parseInt(id[0]) + 1;
  815. $('#menu').append("<li data-id='" + data_id + " ' class='add-menu'> <i class='icon-add'></i></li>");
  816. }
  817. } else { // 二级菜单
  818. var two_id = $('.active').parent().index();
  819. var one_id = $('.active').parent().parent().parent().parent().index();
  820. menu[one_id].sub_button.splice(two_id, 1);
  821. if (menu[one_id].sub_button.length < 5) { // 二级菜单数量限制判断
  822. var sub_button_id = parseInt(id[1]) + 1
  823. var data_id = id[0] + '_' + sub_button_id;
  824. if (menu[one_id].sub_button.length == 4) { // 如果删除的是二级菜单的第5个菜单,追加 添加菜单按钮
  825. $('.active').parent().parent().append("<li data-id='" + data_id + " ' class='add-menu'><i class='icon-add'></i></li>");
  826. }
  827. }
  828. }
  829. $('.active').parent().remove()
  830. $('.active').removeClass('active');
  831. $('.menu-control').css('display', 'none');
  832. })
  833. //添加菜单
  834. $(document).on('click', '.add-menu', function () {
  835. if ($('.menu-control').css('display') == 'block') {
  836. layer.msg('请先确定菜单', {
  837. time: 2000, //2s后自动关闭
  838. });
  839. return false;
  840. }
  841. $(this).removeClass("add-menu");
  842. var ids = $(this).attr("data-id");
  843. var id = ids.split("_");
  844. $('.menu-control').css('display', 'block');
  845. initMenu();
  846. if (id.length == 1) { // 一级菜单
  847. // 只有一个一级菜单
  848. if (menu.length < 2) {
  849. var data_id = menu.length + 1
  850. // 追加 添加菜单按钮
  851. $(this).parent().append("<li data-id='" + data_id + " ' class='add-menu'> <i class='icon-add'></i></li>");
  852. // 移除添加图标
  853. $(this).children().remove();
  854. // 增加 一级菜单 文本
  855. $(this).append("<span class='active-menu'> <i class='icon-sub'></i>一级菜单</span>")
  856. // 置为 被激活状态
  857. $(this).children().addClass('active');
  858. }
  859. // 最后一个一级菜单
  860. if (menu.length == 2) {
  861. $(this).children().remove();
  862. $(this).append("<span class='active-menu'><i class='icon-sub'></i>一级菜单</span>")
  863. $(this).children().addClass('active');
  864. }
  865. // 追加 二级菜单添加按钮
  866. var data_id = id[0] + '_' + 0;
  867. $(this).append("<div class='sub-menu'><ul><li data-id='" + data_id + " 'class='add-menu'><i class='icon-add'></i></li></ul></div>");
  868. } else { //二级菜单
  869. var one_id = $(this).parent().parent().parent().index();
  870. if (menu[one_id].sub_button.length < 4) { // 不是最后一个二级菜单
  871. var sub_button_id = parseInt(id[1]) + 1
  872. var data_id = id[0] + '_' + sub_button_id;
  873. $(this).parent().append("<li data-id='" + data_id + " ' class='add-menu'> <i class='icon-add'></i></li>");
  874. $(this).children().remove();
  875. $(this).append("<span class='active-menu' >二级菜单</span>")
  876. $(this).children().addClass('active');
  877. return 0;
  878. }
  879. // 最后一个二级菜单
  880. if (menu[one_id].sub_button.length == 4) {
  881. $(this).children().remove();
  882. $(this).append("<span class='active-menu'>二级菜单</span>")
  883. }
  884. $(this).children().addClass('active');
  885. }
  886. })
  887. // 右侧菜单控制器输入完菜单名称后,同步至被激活的菜单上
  888. $(document).on('change', '#menu_name', function () {
  889. menu_name = $(this).val();
  890. active = $('.active').text(menu_name);
  891. });
  892. // 确认添加菜单
  893. $(document).on('click', '.layui-btn-add_menu', function () {
  894. var menu_name = $('#menu_name').val();
  895. var menu_type = $('#menu_type').val();
  896. var result = checkData(menu_name, menu_type); //验证数据
  897. if (result) {
  898. mergeMenu(menu_name, menu_type); //合并菜单
  899. $('.active').removeClass('active');
  900. $('.menu-control').css('display', 'none');
  901. }
  902. })
  903. //菜单类型切换
  904. form.on('select(menu_type)', function (data) {
  905. if (data.value == 'click') {
  906. $('.click').css('display', 'block');
  907. $('.view').css('display', 'none');
  908. $('.miniprogram').css('display', 'none');
  909. }
  910. if (data.value == 'view') {
  911. $('.click').css('display', 'none');
  912. $('.view').css('display', 'block');
  913. $('.miniprogram').css('display', 'none');
  914. }
  915. if (data.value == 'miniprogram') {
  916. $('.click').css('display', 'none');
  917. $('.view').css('display', 'block');
  918. $('.miniprogram').css('display', 'block');
  919. }
  920. })
  921. //回显菜单信息
  922. function menuInfo(menu_info) {
  923. $('#menu_name').val(menu_info.name);
  924. $("#menu_type").val(menu_info.type);
  925. form.render('select');
  926. if (menu_info.type == 'click') { // 关键字
  927. $('.click').css('display', 'block');
  928. $('.view').css('display', 'none');
  929. $('.miniprogram').css('display', 'none');
  930. $('#key').val(menu_info.key);
  931. }
  932. if (menu_info.type == 'view') { // 跳转网页
  933. $('.click').css('display', 'none');
  934. $('.view').css('display', 'block');
  935. $('.miniprogram').css('display', 'none');
  936. $('#url').val(menu_info.url);
  937. }
  938. if (menu_info.type == 'miniprogram') { // 小程序
  939. $('.click').css('display', 'none');
  940. $('.view').css('display', 'block');
  941. $('.miniprogram').css('display', 'block');
  942. $('#url').val(menu_info.url);
  943. $('#appid').val(menu_info.appid);
  944. $('#pagepath').val(menu_info.pagepath);
  945. }
  946. }
  947. //验证数据
  948. function checkData(name, type) {
  949. if ($.trim(name) == '') {
  950. layer.msg('请输入菜单名称', {
  951. time: 2000, //2s后自动关闭
  952. });
  953. return false;
  954. }
  955. switch (type) {
  956. case 'click':
  957. if ($('#key').val() == '') {
  958. layer.msg('请输入关键词', {
  959. time: 2000, //2s后自动关闭
  960. });
  961. return false;
  962. }
  963. break;
  964. case 'view':
  965. if ($('#url').val() == '') {
  966. layer.msg('请输入网页链接', {
  967. time: 2000, //2s后自动关闭
  968. });
  969. return false;
  970. }
  971. break;
  972. case 'miniprogram':
  973. if ($('#url').val() == '') {
  974. layer.msg('请输入网页链接', {
  975. time: 2000, //2s后自动关闭
  976. });
  977. return false;
  978. }
  979. if ($('#appid').val() == '') {
  980. layer.msg('请输入appid', {
  981. time: 2000, //2s后自动关闭
  982. });
  983. return false;
  984. }
  985. if ($('#pagepath').val() == '') {
  986. layer.msg('请输入小程序路径', {
  987. time: 2000, //20s后自动关闭
  988. });
  989. return false;
  990. }
  991. break;
  992. }
  993. return true;
  994. }
  995. //合并菜单
  996. function mergeMenu(name, type) {
  997. var data_id = $('.active').parent();
  998. var ids = data_id.attr("data-id");
  999. var id = ids.split("_");
  1000. var data = new Object();
  1001. switch (type) {
  1002. case 'click':
  1003. data = {
  1004. 'name': name,
  1005. 'key': $('#key').val(),
  1006. 'type': type,
  1007. }
  1008. break;
  1009. case 'view':
  1010. data = {
  1011. 'name': name,
  1012. 'url': $('#url').val(),
  1013. 'type': type,
  1014. }
  1015. break;
  1016. case 'miniprogram':
  1017. data = {
  1018. 'name': name,
  1019. 'url': $('#url').val(),
  1020. 'appid': $('#appid').val(),
  1021. 'pagepath': $('#pagepath').val(),
  1022. 'type': type,
  1023. }
  1024. break;
  1025. }
  1026. if (id.length < 2) { // 一级菜单
  1027. var one_id = $('.active').parent().index();
  1028. data.sub_button = [];
  1029. if (menu[one_id]) { //如果存在数组,进行更新
  1030. menu[one_id] = data;
  1031. return true
  1032. }
  1033. menu.push(data);
  1034. } else { // 二级菜单
  1035. var two_id = $('.active').parent().index();
  1036. var one_id = $('.active').parent().parent().parent().parent().index();
  1037. if (menu[one_id].sub_button[two_id]) { //如果存在数组,进行更新
  1038. menu[one_id].sub_button[two_id] = data;
  1039. return true;
  1040. }
  1041. menu[one_id].sub_button.push(data);
  1042. }
  1043. return true;
  1044. }
  1045. //初始化菜单
  1046. function initMenu() {
  1047. // 显示 关键字输入框
  1048. $('.click').css('display', 'block');
  1049. // 隐藏 网页链接输入框
  1050. $('.view').css('display', 'none');
  1051. // 隐藏 appid/小程序路径 输入框
  1052. $('.miniprogram').css('display', 'none');
  1053. // 设置 菜单类型 为 click(关键字)
  1054. $("#menu_type").val('click');
  1055. // 刷新 下拉菜单
  1056. form.render('select');
  1057. // 设置输入框初始值为 空字符串
  1058. $('#menu_name').val('');
  1059. $('#url').val('');
  1060. $('#key').val('');
  1061. $('#appid').val('');
  1062. $('#pagepath').val('');
  1063. }
  1064. //发布
  1065. $(document).on('click', '.publish', function () {
  1066. if (menu.length === 0) {
  1067. layer.msg('请先设置菜单', {
  1068. time: 2000, //20s后自动关闭
  1069. });
  1070. return false;
  1071. }
  1072. like.ajax({
  1073. url: '{:url("wechat.oa/pulishMenu")}',
  1074. data: JSON.stringify({button: menu}),
  1075. type: 'post',
  1076. dataType: 'json',
  1077. contentType: "application/json;charset=utf-8",
  1078. success: function (res) {
  1079. if (res.code) {
  1080. layui.layer.msg(res.msg, {
  1081. offset: '15px'
  1082. , icon: 1
  1083. , time: 1000
  1084. });
  1085. } else {
  1086. layui.layer.msg(res.msg, {
  1087. offset: '15px'
  1088. , icon: 2
  1089. , time: 2000
  1090. });
  1091. }
  1092. }
  1093. })
  1094. })
  1095. });
  1096. </script>