index.blade.php 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849
  1. @extends('admin/layout')
  2. @section('header')
  3. <link href="{{asset('css/plugins/chosen/chosen.css')}}" rel="stylesheet">
  4. <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">
  5. <link rel="stylesheet"
  6. href="https://cdn.jsdelivr.net/npm/bootstrap-select@1.13.9/dist/css/bootstrap-select.min.css">
  7. <link rel="stylesheet" href="{{asset('js/plugins/zTree_v3-master/css/zTreeStyle/zTreeStyle.css')}}">
  8. <style>
  9. .ztree {
  10. margin: 0;
  11. padding: 5px;
  12. color: #555;
  13. position: relative;
  14. z-index: 100;
  15. }
  16. .ztree li span.button.add {
  17. margin-left: 2px;
  18. margin-right: -1px;
  19. background-position: -144px 0;
  20. vertical-align: top;
  21. *vertical-align: middle
  22. }
  23. .li_ys {
  24. margin: -10px;
  25. clear: both;
  26. padding-left: 20px;
  27. }
  28. .li_ys li {
  29. display: inline-block;
  30. float: left;
  31. text-align: center;
  32. font-size: 1em;
  33. color: #333;
  34. width: 100px;
  35. overflow: hidden;
  36. margin-right: 5px;
  37. padding: 8px;
  38. border-radius: 4px;
  39. cursor: pointer;
  40. }
  41. .li_ys .selected {
  42. background: #333;
  43. color: #fff;
  44. }
  45. .tab_box div {
  46. border: 1px solid red;
  47. height: 150px;
  48. width: 500px;
  49. }
  50. .form-horizontal .form-boxs {
  51. display: none;
  52. }
  53. .form-horizontal .form-boxs:first-child {
  54. display: block;
  55. }
  56. .hide {
  57. display: none;
  58. }
  59. .ibox-content {
  60. padding: 5px 0;
  61. border: none;
  62. }
  63. .ibox {
  64. overflow: hidden;
  65. }
  66. .ibox-title {
  67. /* border: dotted 1px #ddd; */
  68. border: none;
  69. }
  70. .help-block {
  71. display: block;
  72. margin-top: 5px;
  73. margin-bottom: 0px;
  74. color: #737373;
  75. }
  76. .checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] {
  77. margin: 4px 0 0 !important;
  78. margin-left: -20px !important;
  79. }
  80. .checkbox .control-label {
  81. padding-top: 0 !important;
  82. }
  83. .checkbox label {
  84. margin-bottom: 1px !important;
  85. /* padding-top:0 !important; */
  86. margin-right: 6px;
  87. }
  88. .radio label {
  89. margin-bottom: 1px !important;
  90. /* padding-top:0 !important; */
  91. margin-right: 6px;
  92. }
  93. .form-control-select {
  94. vertical-align: middle;
  95. padding: 6px 8px;
  96. font-size: 13px;
  97. font-weight: normal;
  98. border-radius: 3px;
  99. -webkit-appearance: none;
  100. appearance: none;
  101. background-color: #f8f8f8;
  102. background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='28' viewBox='0 0 16 28' fill='%23777'%3E%3Cpath d='M16 17q0 .406-.297.703l-7 7Q8.406 25 8 25t-.703-.297l-7-7Q0 17.406 0 17t.297-.703T1 16h14q.406 0 .703.297T16 17zm0-6q0 .406-.297.703T15 12H1q-.406 0-.703-.297T0 11t.297-.703l7-7Q7.594 3 8 3t.703.297l7 7Q16 10.594 16 11z'/%3E%3C/svg%3E");
  103. background-position: right 8px center;
  104. background-repeat: no-repeat;
  105. -webkit-background-size: 8px 16px;
  106. background-size: 8px 16px;
  107. padding-right: 25px;
  108. }
  109. input[type="checkbox"]:before, input[type="radio"]:before {
  110. visibility: visible;
  111. content: "\f096";
  112. float: left;
  113. font-family: FontAwesome;
  114. width: 13px;
  115. height: 13px;
  116. line-height: 13px;
  117. font-size: 16px;
  118. border-radius: 5px;
  119. margin-right: 8px;
  120. text-align: left;
  121. font-weight: normal;
  122. color: #888;
  123. }
  124. input[type="checkbox"]:checked:before, input[type="radio"]:checked:before {
  125. content: "\f046";
  126. color: #666;
  127. }
  128. input[type="checkbox"], input[type="radio"] {
  129. visibility: hidden;
  130. cursor: pointer;
  131. }
  132. input[type="radio"]:before {
  133. content: "\f10c";
  134. }
  135. input[type="checkbox"]:checked:before, input[type="radio"]:checked:before {
  136. content: "\f046";
  137. color: #666;
  138. }
  139. input[type="radio"]:checked:before {
  140. content: "\f192";
  141. color: #1fb5ad;
  142. }
  143. .ztree li span.button.ico_docu:before {
  144. content: "\f0f6";
  145. }
  146. </style>
  147. <style>
  148. .wrapper-content {
  149. width: 100%;
  150. height: 100%;
  151. position: relative;
  152. }
  153. .sep-wrap {
  154. position: absolute;
  155. width: 100%;
  156. height: 100%;
  157. left: 0;
  158. top: 0;
  159. display: flex;
  160. display: -webkit-flex;
  161. display: -moz-flex;
  162. display: -ms-flex;
  163. display: -o-flex;
  164. /* padding: 15px; */
  165. }
  166. .sep-sidebar {
  167. width: 400px;
  168. flex-shrink: 0;
  169. /* margin-right: 16px; */
  170. overflow-x: auto;
  171. overflow-y: auto;
  172. background: #f2f4f6;
  173. border-right: solid 1px #d5dbe0;
  174. box-shadow: 0 2px 2px #ddd;
  175. z-index: 10;
  176. padding-top: 15px;
  177. }
  178. .sep-sidebar::-webkit-scrollbar {
  179. width: 6px;
  180. }
  181. .sep-sidebar::-webkit-scrollbar:horizontal {
  182. height: 6px;
  183. }
  184. .sep-sidebar::-webkit-scrollbar-track:horizontal {
  185. border-left: none;
  186. border-top: solid 1px #ddd;
  187. }
  188. .sep-sidebar::-webkit-scrollbar-track {
  189. background: rgba(255, 255, 255, 0.4);
  190. -webkit-border-radius: 0;
  191. border-radius: 0;
  192. border-left: solid 1px #ddd;
  193. }
  194. .sep-sidebar::-webkit-scrollbar-thumb {
  195. -webkit-border-radius: 10px;
  196. border-radius: 10px;
  197. background: rgba(0, 0, 0, 0.5);
  198. }
  199. .sep-sidebar .ibox-content {
  200. background: transparent;
  201. }
  202. .sep-sidebar .ibox {
  203. overflow: unset;
  204. }
  205. .sep-primary {
  206. flex: auto;
  207. overflow-y: auto;
  208. padding: 15px;
  209. }
  210. .control-sidebar {
  211. position: absolute;
  212. top: 0;
  213. bottom: 0;
  214. left: 0;
  215. width: 250px;
  216. z-index: 8;
  217. }
  218. .ui-resizable-handle {
  219. width: 5px;
  220. background: #ddd;
  221. position: absolute;
  222. top: 0;
  223. bottom: 0;
  224. right: -5px;
  225. cursor: col-resize;
  226. opacity: 0;
  227. }
  228. .ui-resizable-handle:hover {
  229. opacity: 1;
  230. }
  231. .ui-resizable-handle:before {
  232. position: absolute;
  233. top: 50%;
  234. right: -10px;
  235. width: 20px;
  236. height: 60px;
  237. line-height: 60px;
  238. font-family: FontAwesome;
  239. content: "\f039";
  240. color: #888;
  241. background: #ddd;
  242. margin-top: -30px;
  243. margin-left: -1px;
  244. border-radius: 0 3px 3px 0;
  245. display: block;
  246. font-size: 12px;
  247. -webkit-transform: scale(.6);
  248. text-transform: rotate(-90deg);
  249. text-align: center;
  250. }
  251. .edui-default .edui-editor {
  252. max-width: 100% !important;
  253. width: 100% !important;
  254. }
  255. .form-action-fixed {
  256. position: fixed;
  257. right: 40px;
  258. top: 16px;
  259. margin: 0;
  260. padding: 12px;
  261. text-indent: 0;
  262. border-radius: 0 0 4px 4px;
  263. background: rgba(200, 200, 200, 0.5);
  264. }
  265. .sui-resource-selector {
  266. height: auto;
  267. padding: 5px;
  268. background: #fff;
  269. overflow: hidden;
  270. }
  271. .sui-resource-selector .sui-selector-value {
  272. display: none;
  273. }
  274. .sui-resource-selector .sui-selector-box {
  275. position: relative;
  276. background: #fff;
  277. border-radius: 4px 4px 0 0;
  278. }
  279. .sui-resource-selector .sui-selector-btns {
  280. padding: 7px 10px;
  281. position: relative;
  282. overflow: hidden;
  283. min-height: 30px;
  284. background: #f9f9f9;
  285. margin: -5px;
  286. width: 100%;
  287. }
  288. .sui-resource-selector .sui-selector-box .img-item {
  289. position: relative;
  290. float: left;
  291. width: 33.33%;
  292. margin: 0;
  293. background: none;
  294. }
  295. .sui-resource-selector .sui-selector-box .img-item .box {
  296. position: relative;
  297. background: #f0f0f0;
  298. box-shadow: 0 0 3px #ddd;
  299. border: solid 1px #ddd;
  300. padding-left: 100px;
  301. margin: 5px;
  302. height: 102px;
  303. border-radius: 4px;
  304. overflow: hidden;
  305. }
  306. .sui-resource-selector .sui-selector-box .img-item .box .thumb {
  307. position: absolute;
  308. left: 0;
  309. top: 0;
  310. display: block;
  311. width: 100px;
  312. height: 100px;
  313. line-height: 96px;
  314. text-align: center;
  315. background: #f8f8f8;
  316. }
  317. .sui-resource-selector .sui-selector-box img, .sui-resource-selector .sui-selector-box .img-item img {
  318. max-width: 100%;
  319. max-height: 100%;
  320. }
  321. .cutstr {
  322. display: block;
  323. height: 1.5em;
  324. line-height: 1.5em;
  325. width: 100%;
  326. white-space: nowrap;
  327. overflow: hidden;
  328. text-overflow: ellipsis;
  329. }
  330. .sui-resource-selector .sui-selector-box .img-item .box .title {
  331. margin: 5px 10px;
  332. font-weight: bold;
  333. }
  334. .sui-resource-selector .sui-selector-box .img-item .box .summary {
  335. margin: 5px 10px;
  336. line-height: 1.4em;
  337. height: 4.2em;
  338. overflow: hidden;
  339. color: #777;
  340. }
  341. .sui-resource-selector .sui-selector-box .img-item .operate {
  342. position: absolute;
  343. top: 1px;
  344. right: 1px;
  345. background-color: rgba(0, 0, 0, 0.75);
  346. line-height: 1em;
  347. padding: 3px 5px;
  348. }
  349. .sui-resource-selector .sui-selector-box .img-item .operate a {
  350. color: #fff;
  351. }
  352. .sui-resource-selector .sui-selector-btns .btn {
  353. position: absolute;
  354. top: 0;
  355. right: 0;
  356. bottom: 0;
  357. border-radius: 0;
  358. font-size: 14px;
  359. color: #333;
  360. }
  361. .float-e-margins .btn {
  362. margin-bottom: 0px;
  363. }
  364. .modal {
  365. position: fixed;
  366. top: 0;
  367. right: 0;
  368. bottom: 0;
  369. left: 0;
  370. z-index: 1050;
  371. display: none;
  372. overflow: hidden;
  373. -webkit-overflow-scrolling: touch;
  374. outline: 0;
  375. }
  376. .sui-resource-explorer {
  377. padding: 20px 0;
  378. margin: -10px;
  379. }
  380. .sui-resource-explorer.pop {
  381. margin-top: 10px;
  382. }
  383. .sui-resource-explorer dl {
  384. background: #f0f0f0;
  385. box-shadow: 0 0 3px #ddd;
  386. border: solid 1px #ddd;
  387. border-radius: 3px;
  388. padding: 8px;
  389. cursor: pointer;
  390. }
  391. .sui-resource-explorer.pop dl {
  392. padding: 2px;
  393. position: relative;
  394. overflow: hidden;
  395. }
  396. .sui-resource-explorer.pop dl {
  397. padding-left: 110px;
  398. min-height: 100px;
  399. }
  400. .sui-resource-explorer dl .thumb {
  401. display: block;
  402. height: 160px;
  403. width: 100%;
  404. text-align: center;
  405. line-height: 156px;
  406. overflow: hidden;
  407. background: #fff;
  408. }
  409. .sui-resource-explorer.pop dl .thumb {
  410. height: 100px;
  411. width: 100%;
  412. text-align: center;
  413. line-height: 96px;
  414. }
  415. .sui-resource-explorer.pop dl .thumb {
  416. position: absolute;
  417. left: 0;
  418. top: 0;
  419. width: 100px;
  420. overflow: hidden;
  421. }
  422. .sui-resource-explorer.pop dl .fa {
  423. position: absolute;
  424. right: 6px;
  425. top: 6px;
  426. color: #1fb5ad;
  427. font-size: 14px;
  428. display: none;
  429. }
  430. .cutstr {
  431. display: block;
  432. height: 1.5em;
  433. line-height: 1.5em;
  434. width: 100%;
  435. white-space: nowrap;
  436. overflow: hidden;
  437. text-overflow: ellipsis;
  438. }
  439. .sui-resource-explorer dl .filename, .sui-resource-explorer dl .title, .sui-resource-explorer dl .summary {
  440. margin: 3px;
  441. }
  442. .sui-resource-explorer.pop dl .title {
  443. font-weight: bold;
  444. }
  445. .sui-resource-explorer.pop dl.selected {
  446. border-color: #1fb5ad;
  447. background: #1fb5ad;
  448. }
  449. .sui-resource-explorer.pop dl.selected .filename, .sui-resource-explorer.pop dl.selected .title, .sui-resource-explorer.pop dl.selected .summary {
  450. color: #fff;
  451. }
  452. .sui-resource-explorer.pop dl.selected .filename, .sui-resource-explorer.pop dl.selected .title, .sui-resource-explorer.pop dl.selected .summary {
  453. color: #fff;
  454. }
  455. .pagination {
  456. vertical-align: middle;
  457. }
  458. .pagination.pagination-sm {
  459. margin: 0;
  460. }
  461. .pagination > li {
  462. display: inline;
  463. }
  464. .pagination li a {
  465. color: #333;
  466. }
  467. .pagination.pagination-sm li a {
  468. height: 28px;
  469. padding: 4px 10px;
  470. vertical-align: middle;
  471. }
  472. .pagination li.active a, .pagination li.active a:hover {
  473. background: #f0f0f0;
  474. border-color: #ddd;
  475. color: #333;
  476. }
  477. .form-control-select {
  478. max-width: 100%;
  479. }
  480. div#rMenu {
  481. position: absolute;
  482. visibility: hidden;
  483. top: 0;
  484. background-color: #555;
  485. text-align: left;
  486. padding: 2px 4px;
  487. z-index: 999;
  488. }
  489. div#rMenu ul li {
  490. margin: 1px 0;
  491. cursor: pointer;
  492. list-style: none outside none;
  493. background-color: #DFDFDF;
  494. padding: 4px;
  495. }
  496. div#rMenu ul {
  497. padding-left: 0;
  498. margin: 0;
  499. width: 100%;
  500. }
  501. .image-li img {
  502. width: 100%;
  503. max-height: 100%;
  504. }
  505. .imageDiv {
  506. border: 2px solid #F0F0F0;
  507. border-radius: 5px;
  508. }
  509. .image-li {
  510. list-style-type: none;
  511. cursor: pointer;
  512. float: left;
  513. width: 200px;
  514. padding: 5px 5px;
  515. text-align: center;
  516. }
  517. </style>
  518. @endsection
  519. @section('content')
  520. <body class="gray-bg">
  521. <div class="wrapper wrapper-content animated fadeInRight">
  522. <div class="sep-wrap">
  523. <div class="sep-sidebar">
  524. <div class="ibox float-e-margins">
  525. <div class="ibox float-e-margins">
  526. <div class="ibox-content">
  527. <ul id="treeDemo" class="ztree"></ul>
  528. </div>
  529. </div>
  530. </div>
  531. </div>
  532. <div class="sep-primary">
  533. <div style="background: #fff;padding-top: 10px;border: dotted 1px #ddd; position: relative;">
  534. <div class="ibox-title">
  535. <ul class="li_ys clearfix" id="clearfix">
  536. <li class="selected">基本设置</li>
  537. <li>更多设置</li>
  538. <li>SEO设置</li>
  539. <li>模版变量</li>
  540. </ul>
  541. </div>
  542. <div class="ibox float-e-margins">
  543. <div class="ibox-content">
  544. <form method="post" class="form-horizontal" id="form">
  545. <div class="form-boxs">
  546. <div class="row">
  547. <div class="col-md-8">
  548. <div class="form-group">
  549. <label class="control-label" for="title"><span class="red">* </span>主标题</label>
  550. <input type="text" class="form-control" id="title" name="title"
  551. autocomplete="off">
  552. <input type="hidden" id="index_id" name="index_id">
  553. </div>
  554. <div class="form-group">
  555. <label class="control-label" for="subtitle">副标题</label>
  556. <input type="text" class="form-control" id="subtitle" name="subtitle"
  557. autocomplete="off">
  558. </div>
  559. <div class="form-group">
  560. <label class="control-label" for="summary">内容摘要</label>
  561. <textarea class="form-control" rows="5" placeholder="" id="summary"
  562. name="summary"></textarea>
  563. <div class="help-block">此项为空使,系统会自动截取正文前200个字符</div>
  564. </div>
  565. </div>
  566. <div class="col-md-4">
  567. <div class="form-group">
  568. <label class="control-label" for="tpl_id">选择模版</label>
  569. <select class="form-control form-control-select"
  570. id="tpl_id" name="tpl_id">
  571. <option value="0">请选择模版</option>
  572. @foreach ($templateList as $key => $value)
  573. @if(!$value->alias)
  574. <option value="{{$value->id}}">{{$value->name}}</option>
  575. @else
  576. <option value="{{$value->id}}">{{$value->name}}
  577. -{{$value->alias}}</option>
  578. @endif
  579. @endforeach
  580. </select>
  581. </div>
  582. <div class="form-group">
  583. <label class="control-label" for="css_id">请选择样式</label>
  584. <select class="form-control form-control-select"
  585. id="css_id" name="css_id">
  586. <option value="0">请选择样式</option>
  587. </select>
  588. </div>
  589. <div class="form-group">
  590. <label class="control-label" for="alias">URL别名(自动生成)</label>
  591. <input type="text" placeholder="" class="form-control" id="alias"
  592. name="alias">
  593. </div>
  594. <div class="form-group">
  595. <label class="control-label" for="menu_text">导航标题</label>
  596. <input type="text" placeholder="" class="form-control" id="menu_text"
  597. name="menu_text">
  598. </div>
  599. <div class="form-group">
  600. <div class="checkbox">
  601. <label class="control-label" for="deny_spider">
  602. <input type="checkbox" id="deny_spider" name="deny_spider"
  603. class="js-switch-case1">禁止搜索引擎抓取
  604. </label>
  605. <label class="control-label" for="is_hidemenu">
  606. <input type="checkbox" id="is_hidemenu" name="is_hidemenu"
  607. class="js-switch-case2">
  608. 在导航中隐藏
  609. </label>
  610. <label class="control-label" for="is_enabled">
  611. <input type="checkbox" id="is_enabled" name="is_enabled"
  612. class="js-switch-case3">立即发布
  613. </label>
  614. </div>
  615. </div>
  616. </div>
  617. </div>
  618. <div class="form-group">
  619. <label class="control-label" for="translate_content">内容正文</label>
  620. <div id="div1" class="text"></div>
  621. </div>
  622. </div>
  623. <div class="form-boxs">
  624. <div class="row">
  625. <div class="col-md-8">
  626. <div class="form-group">
  627. <label class="control-label" for="content_type">
  628. 内容类型
  629. </label>
  630. <select class="form-control form-control-select" id="content_type"
  631. name="content_type">
  632. <option value="html">HTML</option>
  633. <option value="js">JSON</option>
  634. <option value="pdf">PDF</option>
  635. <option value="txt">TEXT</option>
  636. <option value="xml">XML</option>
  637. </select>
  638. </div>
  639. <div class="form-group">
  640. <label class=" control-label" for="redirect">重定向</label>
  641. <input type="text" placeholder="" class="form-control" id="redirect"
  642. name="redirect">
  643. <div class="checkbox">
  644. <label class=" control-label" for="is_301">
  645. <input type="checkbox" id="is_301" name="is_301">开启301跳转
  646. </label>
  647. </div>
  648. </div>
  649. <div class="row">
  650. <div class="col-md-8" style="padding-right:0;">
  651. <div class="form-group">
  652. <label class="control-label" for="img">
  653. 缩略图:</label>
  654. <button type="button" class="btn btn-primary"
  655. onclick="addImages('alone')">
  656. 图片上传
  657. </button>
  658. </div>
  659. <div id="images">
  660. </div>
  661. </div>
  662. </div>
  663. </div>
  664. <div class="col-md-4">
  665. <div class="form-group">
  666. <label class=" control-label" for="publish_time">发布时间</label>
  667. <div class="input-group">
  668. <input type="text" class="form-control lay-datetime deadline"
  669. id="publish_time" name="publish_time">
  670. <span class="input-group-addon"><i
  671. class="fa fa-calendar"></i></span>
  672. </div>
  673. </div>
  674. <div class="form-group">
  675. <label class=" control-label" for="expired_time">截止时间</label>
  676. <div class="input-group">
  677. <input type="text" class="form-control lay-datetime deadline"
  678. id="expired_time" name="expired_time">
  679. <span class="input-group-addon"><i
  680. class="fa fa-calendar"></i></span>
  681. </div>
  682. </div>
  683. <div class="form-group" style="display: flex">
  684. <div style="margin-right: 20px">
  685. <label class=" control-label" for="rank">排序编号</label>
  686. <input type="text" placeholder="" class="form-control" id="rank"
  687. name="rank" style="width:120px">
  688. </div>
  689. <div>
  690. <label class=" control-label" for="parent_id">父级id</label>
  691. <input type="text" placeholder="" class="form-control"
  692. id="parent_id" name="parent_id" style="width:120px">
  693. </div>
  694. </div>
  695. </div>
  696. </div>
  697. </div>
  698. <div class="form-boxs">
  699. <div class="form-group">
  700. <label class="control-label" for="seo_title">SEO标题</label>
  701. <input type="text" placeholder="" class="form-control" id="seo_title"
  702. name="seo_title">
  703. </div>
  704. <div class="form-group">
  705. <label class="control-label" for="seo_keywords">SEO关键词</label>
  706. <textarea class="form-control" rows="5" placeholder="" id="seo_keywords"
  707. name="seo_keywords"></textarea>
  708. </div>
  709. <div class="form-group">
  710. <label class="control-label" for="seo_description">SEO描述</label>
  711. <textarea class="form-control" rows="5" placeholder="" id="seo_description"
  712. name="seo_description"></textarea>
  713. </div>
  714. <div class="form-group">
  715. <div class="checkbox">
  716. <label class="control-label" for="is_freeze_url">
  717. <input type="checkbox" id="is_freeze_url" name="is_freeze_url">绑定URI
  718. </label>
  719. </div>
  720. </div>
  721. <div class="form-group uri">
  722. <label class="control-label" for="uri">URI 地址(自动生成)</label>
  723. <input type="text" placeholder="" class="form-control" id="uri" name="uri">
  724. </div>
  725. </div>
  726. <div class="form-boxs" id="tpl">
  727. </div>
  728. </form>
  729. </div>
  730. </div>
  731. <div class="form-action-fixed" style="text-align:right;">
  732. <button class="btn btn-primary" type="button" id="indexSave">
  733. 保存
  734. </button>
  735. </div>
  736. </div>
  737. </div>
  738. </div>
  739. </div>
  740. <div class="modal fade" id="default-dialog" tabindex="-1" role="dialog" aria-hidden="false"></div>
  741. <div id="rMenu">
  742. <ul>
  743. <li id="m_add" onclick="addTreeNode();">增加子节点</li>
  744. <li id="m_add_father" onclick="addParentMenu();">增加顶级节点</li>
  745. <li id="m_del" onclick="removeTreeNode();">删除</li>
  746. <li id="m_recovery" onclick="recoveryTreeNode();">恢复</li>
  747. <li id="m_preview" onclick="preview();">预览</li>
  748. <li id="m_copy" onclick="copyTreeNode();">复制节点</li>
  749. </ul>
  750. </div>
  751. <input type="hidden" id="new_pid">
  752. <input type="hidden" id="new_title">
  753. </body>
  754. @endsection
  755. @section('footer')
  756. <script src="{{asset('js/plugins/chosen/chosen.jquery.js')}}"></script>
  757. <script src="{{asset('js/plugins/switchery/switchery.js')}}"></script>
  758. <script src="{{asset('js/plugins/zTree_v3-master/js/jquery.ztree.core.min.js')}}"></script>
  759. <script src="{{asset('js/plugins/zTree_v3-master/js/jquery.ztree.all.min.js')}}"></script>
  760. <script src="{{asset('js/plugins/zTree_v3-master/js/jquery.ztree.excheck.min.js')}}"></script>
  761. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  762. <script src="{{asset('js/plugins/js-base64-main/base64.js')}}"></script>
  763. <script src="{{asset('js/plugins/jquery-cookie/jquery.cookie.js')}}"></script>
  764. <script src="{{asset('js/plugins/sortable/Sortable.js')}}"></script>
  765. <!-- 引入 wangEditor.min.js -->
  766. <script src="{{asset('js/plugins/wangEditor/wangEditor.min.js')}}"></script>
  767. <script>
  768. //富文本
  769. var E = window.wangEditor;
  770. var editor = new E('#div1');
  771. // 配置 server 接口地址
  772. editor.config.uploadImgServer = '/admin/stencil/editorUpload/{{$siteId}}';
  773. editor.config.uploadFileName = 'editorFile';
  774. editor.config.uploadImgMaxLength = 5;// 一次最多上传 5 个图片
  775. editor.config.uploadImgAccept = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
  776. editor.config.uploadImgMaxSize = 5 * 1024 * 1024;// 5M
  777. editor.create();
  778. //富文本变量列表
  779. var editorList = [];
  780. //复选框变量列表
  781. var checkboxList = [];
  782. //资源变量列表
  783. var resourceList = [];
  784. //图片变量列表
  785. var imageList = [];
  786. //文件变量列表
  787. var fileList = [];
  788. //时间插件
  789. lay('.deadline').each(function () {
  790. laydate.render({
  791. elem: this
  792. , trigger: 'click'
  793. });
  794. });
  795. $('ul li:first-child').addClass('selected');
  796. $('ul li').click(function () {
  797. $(this).addClass('selected').siblings().removeClass('selected');
  798. $('.form-horizontal .form-boxs').eq($(this).index()).show().siblings().hide();
  799. });
  800. //左侧菜单树
  801. var setting = {
  802. view: {
  803. fontCss: getFont,
  804. dblClickExpand: false
  805. },
  806. edit: {
  807. enable: true,
  808. showRemoveBtn: false,
  809. showRenameBtn: false
  810. },
  811. data: {
  812. simpleData: {
  813. enable: true
  814. }
  815. },
  816. callback: {
  817. beforeDrag: beforeDrag,
  818. beforeDrop: beforeDrop,
  819. onExpand: onExpand,
  820. onCollapse: onCollapse,
  821. onRightClick: OnRightClick,
  822. onClick: function (event, treeId, treeNode) {
  823. //重新设置编辑器内容
  824. editor.txt.html('');
  825. if (treeNode.content) {
  826. editor.txt.html(treeNode.content);
  827. }
  828. //模版联动样式
  829. changeCss(treeNode.tpl_id, treeNode.css_id);
  830. //模版联动变量
  831. changeTemplateVariableList(treeNode.tpl_id, treeNode.id);
  832. var object = $('#images');
  833. object.empty();
  834. if (treeNode.thumb) {
  835. var thumb =
  836. '<li class="image-li">' +
  837. '<div class="imageDiv">' +
  838. '<div style="justify-content: center;align-items: center;flex-direction: column;overflow: hidden;margin: auto;">' +
  839. '<img src="' + treeNode.thumb + '" alt="' + treeNode.thumb + '">' +
  840. '</div>' +
  841. '<div style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;padding: 10px;">' + treeNode.thumb + '</div>' +
  842. '<a href="javascript:;" class="js-del-item-alone">' +
  843. '<i class="fa fa-remove"></i>移除' +
  844. '</a>' +
  845. '</div>' +
  846. '</li>';
  847. object.append(thumb);
  848. }
  849. $("#index_id").val(treeNode.id);
  850. $("#title").val(treeNode.title);
  851. $('#parent_id').val(treeNode.parent_id);
  852. if (!treeNode.content_type) {
  853. treeNode.content_type = 'html';
  854. }
  855. $("#content_type").val(treeNode.content_type);
  856. if (!treeNode.tpl_id) {
  857. treeNode.tpl_id = 0;
  858. }
  859. $("#tpl_id").val(treeNode.tpl_id);
  860. $("#subtitle").val(treeNode.subtitle);
  861. $("#alias").val(treeNode.alias);
  862. $('#summary').val(treeNode.summary);
  863. $("#uri").val(treeNode.uri);
  864. $("#menu_text").val(treeNode.menu_text);
  865. $('#redirect').val(treeNode.redirect);
  866. if (treeNode.publish_time) {
  867. $('#publish_time').val(treeNode.publish_time);
  868. }
  869. if (treeNode.expired_time) {
  870. $('#expired_time').val(treeNode.expired_time);
  871. }
  872. $('#rank').val(treeNode.rank);
  873. $('#seo_title').val(treeNode.seo_title);
  874. $('#seo_keywords').val(treeNode.seo_keywords);
  875. $('#seo_description').val(treeNode.seo_description);
  876. var denySpider = $('#deny_spider');
  877. denySpider.prop('checked', false);
  878. if (treeNode.deny_spider === 1) {
  879. denySpider.prop('checked', true);
  880. }
  881. var isHidemenu = $('#is_hidemenu');
  882. isHidemenu.prop('checked', false);
  883. if (treeNode.is_hidemenu === 1) {
  884. isHidemenu.prop('checked', true);
  885. }
  886. var isEnabled = $('#is_enabled');
  887. isEnabled.prop('checked', false);
  888. if (treeNode.is_enabled === 1) {
  889. isEnabled.prop('checked', true);
  890. }
  891. var is301 = $('#is_301');
  892. is301.prop('checked', false);
  893. if (treeNode.is_301 === 1) {
  894. is301.prop('checked', true);
  895. }
  896. var isFreezeUrl = $('#is_freeze_url');
  897. isFreezeUrl.prop('checked', false);
  898. if (treeNode.is_freeze_url === 1) {
  899. isFreezeUrl.prop('checked', true);
  900. }
  901. }
  902. }
  903. };
  904. function beforeDrag(treeId, treeNodes) {
  905. for (var i = 0, l = treeNodes.length; i < l; i++) {
  906. if (treeNodes[i].drag === false) {
  907. return false;
  908. }
  909. }
  910. return true;
  911. }
  912. function beforeDrop(treeId, treeNodes, targetNode, moveType) {
  913. var pid;
  914. if (targetNode === null) {
  915. pid = 0;
  916. } else {
  917. pid = targetNode.id;
  918. }
  919. var url = '/admin/stencil/indexMoveNode/{{$siteId}}';
  920. var ajaxConfig = {
  921. url: url,
  922. type: 'post',
  923. data: {id: treeNodes[0].id, pid: pid, type: moveType},
  924. success: function () {
  925. }
  926. };
  927. tips.ajax(ajaxConfig);
  928. return targetNode ? targetNode.drop !== false : true;
  929. }
  930. function onExpand(event, treeId, treeNode) {
  931. var cookie = $.cookie("z_tree1");
  932. var z_tree = null;
  933. if (cookie) {
  934. z_tree = JSON.parse(cookie);
  935. }
  936. if (!z_tree) {
  937. z_tree = [];
  938. }
  939. if (jQuery.inArray(treeNode.id, z_tree) < 0) {
  940. z_tree.push(treeNode.id);
  941. }
  942. $.cookie("z_tree1", JSON.stringify(z_tree))
  943. }
  944. function onCollapse(event, treeId, treeNode) {
  945. var cookie = $.cookie("z_tree1");
  946. var z_tree = null;
  947. if (cookie) {
  948. z_tree = JSON.parse(cookie);
  949. }
  950. if (!z_tree) {
  951. z_tree = []
  952. }
  953. var index = jQuery.inArray(treeNode.id, z_tree);
  954. z_tree.splice(index, 1);
  955. $.cookie("z_tree1", JSON.stringify(z_tree))
  956. }
  957. function OnRightClick(event, treeId, treeNode) {
  958. if (!treeNode && event.target.tagName.toLowerCase() !== "button" && $(event.target).parents("a").length === 0) {
  959. zTree.cancelSelectedNode();
  960. showRMenu("root", event.clientX, event.clientY);
  961. } else if (treeNode && !treeNode.noR) {
  962. zTree.selectNode(treeNode);
  963. showRMenu("node", event.clientX, event.clientY);
  964. }
  965. }
  966. function showRMenu(type, x, y) {
  967. $("#rMenu ul").show();
  968. if (type !== "root") {
  969. $("#m_add").show();
  970. $("#m_add_father").show();
  971. $("#m_del").show();
  972. $("#m_recovery").show();
  973. $("#m_preview").show();
  974. $("#m_copy").show();
  975. y += document.body.scrollTop;
  976. x += document.body.scrollLeft;
  977. rMenu.css({"top": y + "px", "left": x + "px", "visibility": "visible"});
  978. $("body").bind("mousedown", onBodyMouseDown);
  979. }
  980. }
  981. function hideRMenu() {
  982. if (rMenu) rMenu.css({"visibility": "hidden"});
  983. $("body").unbind("mousedown", onBodyMouseDown);
  984. }
  985. function onBodyMouseDown(event) {
  986. if (!(event.target.id === "rMenu" || $(event.target).parents("#rMenu").length > 0)) {
  987. rMenu.css({"visibility": "hidden"});
  988. }
  989. }
  990. var addCount = 1;
  991. function addTreeNode() {
  992. hideRMenu();
  993. var name = "NewFile";
  994. var newNode = {name: name};
  995. if (zTree.getSelectedNodes()[0]) {
  996. zTree.addNodes(zTree.getSelectedNodes()[0], newNode);
  997. $('#new_pid').val(zTree.getSelectedNodes()[0].id);
  998. } else {
  999. zTree.addNodes(null, newNode);
  1000. }
  1001. }
  1002. function removeTreeNode() {
  1003. hideRMenu();
  1004. layer.confirm('确定要删除这个节点(如果是父节点子节点也会被删除)吗?', {icon: 3, title: '确认'}, function () {
  1005. //异步删除
  1006. var nodes = zTree.getSelectedNodes();
  1007. if (!nodes[0]) {
  1008. layer.msg('请选择节点', {icon: 2});
  1009. return;
  1010. }
  1011. var url = '/admin/stencil/indexDelNode/{{$siteId}}';
  1012. var ajaxConfig = {
  1013. url: url,
  1014. type: 'post',
  1015. data: {id: nodes[0].id, type: 2},
  1016. success: function (result) {
  1017. layer.msg(result.message, {icon: 1});
  1018. window.location.reload();
  1019. }
  1020. };
  1021. tips.ajax(ajaxConfig);
  1022. });
  1023. }
  1024. function recoveryTreeNode() {
  1025. hideRMenu();
  1026. layer.confirm('确定要恢复这个节点(如果是父节点子节点也会被恢复)吗?', {icon: 3, title: '确认'}, function () {
  1027. var nodes = zTree.getSelectedNodes();
  1028. if (!nodes[0]) {
  1029. layer.msg('请选择节点', {icon: 2});
  1030. return;
  1031. }
  1032. var url = '/admin/stencil/indexDelNode/{{$siteId}}';
  1033. var ajaxConfig = {
  1034. url: url,
  1035. type: 'post',
  1036. data: {id: nodes[0].id, type: 1},
  1037. success: function (result) {
  1038. layer.msg(result.message, {icon: 1});
  1039. window.location.reload();
  1040. }
  1041. };
  1042. tips.ajax(ajaxConfig);
  1043. });
  1044. }
  1045. function copyTreeNode() {
  1046. layer.confirm('确定拷贝这个文件(目录)吗?', {icon: 3, title: '确认'}, function () {
  1047. var nodes = zTree.getSelectedNodes();
  1048. //异步复制
  1049. var url = '/admin/stencil/indexCopyNode/{{$siteId}}';
  1050. var ajaxConfig = {
  1051. url: url,
  1052. type: 'post',
  1053. data: {id: nodes[0].id, pid: nodes[0].pid},
  1054. success: function (result) {
  1055. layer.msg(result.message, {icon: 1});
  1056. window.location.reload();
  1057. }
  1058. };
  1059. tips.ajax(ajaxConfig);
  1060. });
  1061. }
  1062. function preview() {
  1063. var nodes = zTree.getSelectedNodes();
  1064. window.open('http://{{$site->domain??''}}/' + nodes[0].uri);
  1065. }
  1066. function addParentMenu() {
  1067. layer.confirm('确定创建顶级节点吗?', {icon: 3, title: '确认'}, function () {
  1068. //异步添加顶级菜单
  1069. var url = '/admin/stencil/addParentMenu/{{$siteId}}';
  1070. var ajaxConfig = {
  1071. url: url,
  1072. type: 'post',
  1073. data: {name: 'NewFile'},
  1074. success: function (result) {
  1075. layer.msg(result.message, {icon: 1}, function () {
  1076. window.location.reload();
  1077. });
  1078. }
  1079. };
  1080. tips.ajax(ajaxConfig);
  1081. });
  1082. }
  1083. function getFont(treeId, node) {
  1084. var status = node.status;
  1085. if (status === 2) {
  1086. return {"text-decoration": "line-through", "font-weight": "bold"};
  1087. } else {
  1088. return {"font-weight": "bold"};
  1089. }
  1090. }
  1091. //单行文本
  1092. function text(item) {
  1093. return '<div class="form-group">' +
  1094. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1095. '<div >' +
  1096. '<input type="text" class="form-control" id="' + item.name + '" name="' + item.name + '" value="' + item.value + '">' +
  1097. '</div>' +
  1098. '</div>';
  1099. }
  1100. //多行文本
  1101. function textarea(item) {
  1102. return '<div class="form-group">' +
  1103. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1104. '<div >' +
  1105. '<textarea class="form-control" rows="6" id="' + item.name + '" name="' + item.name + '">' + item.value + '</textarea>' +
  1106. '</div>' +
  1107. '</div>';
  1108. }
  1109. //富文本
  1110. function richtext(item) {
  1111. return '<div class="form-group">' +
  1112. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1113. '<div id="' + item.name + '" class="editor" ></div>' +
  1114. '</div>';
  1115. }
  1116. //tag 文本框
  1117. function taginput(item) {
  1118. return '<div class="form-group">' +
  1119. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1120. '<div >' +
  1121. '<textarea class="form-control" rows="6" id="' + item.name + '" name="' + item.name + '">' + item.value + '</textarea>' +
  1122. '</div>' +
  1123. '</div>';
  1124. }
  1125. //下拉列表
  1126. function select(item) {
  1127. var str =
  1128. '<div class="form-group">' +
  1129. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1130. '<select class="form-control" id="' + item.name + '" name="' + item.name + '">';
  1131. if (item.input_opts && item.input_opts.length > 0) {
  1132. $.each(item.input_opts, function (index, value) {
  1133. if (value === item.value) {
  1134. str += '<option value="' + value + '" selected="selected">' + value;
  1135. } else {
  1136. str += '<option value="' + value + '">' + value;
  1137. }
  1138. });
  1139. }
  1140. str +=
  1141. '</select>' +
  1142. '</div>';
  1143. return str;
  1144. }
  1145. //复选框
  1146. function checkbox(item) {
  1147. var str =
  1148. '<div class="form-group">' +
  1149. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1150. '<div class="checkbox checkbox-list">';
  1151. if (item.input_opts && item.input_opts.length > 0) {
  1152. $.each(item.input_opts, function (index, value) {
  1153. if (item.value && item.value.indexOf(value) !== -1) {
  1154. str += '<label class="sui-custom-radio" ><input type="checkbox" name="' + item.name + '" value="' + value + '" checked>' + value + '</label>';
  1155. } else {
  1156. str += '<label class="sui-custom-radio" ><input type="checkbox" name="' + item.name + '" value="' + value + '">' + value + '</label>';
  1157. }
  1158. });
  1159. }
  1160. str +=
  1161. '</div>' +
  1162. '</div>';
  1163. return str;
  1164. }
  1165. //单选框
  1166. function radio(item) {
  1167. var str =
  1168. '<div class="form-group">' +
  1169. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1170. '<div class="radio">';
  1171. if (item.input_opts && item.input_opts.length > 0) {
  1172. $.each(item.input_opts, function (index, value) {
  1173. if (value === item.value) {
  1174. str += '<label class="sui-custom-radio" ><input type="radio" name="' + item.name + '" value="' + value + '" checked>' + value + '</label>';
  1175. } else {
  1176. str += '<label class="sui-custom-radio" ><input type="radio" name="' + item.name + '" value="' + value + '">' + value + '</label>';
  1177. }
  1178. });
  1179. }
  1180. str +=
  1181. '</div>' +
  1182. '</div>';
  1183. return str;
  1184. }
  1185. //时间框
  1186. function date(item) {
  1187. var str =
  1188. '<div class="form-group">' +
  1189. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1190. '<input type="text" class="form-control deadline" id="' + item.name + '" name="' + item.name + '" value="' + item.value + '">' +
  1191. '</div>' +
  1192. '<script>';
  1193. str += '' +
  1194. ' lay(\'.deadline\').each(function () {' +
  1195. ' laydate.render({' +
  1196. ' elem: this' +
  1197. ' , trigger: \'click\'' +
  1198. ' });' +
  1199. ' });';
  1200. str += '<\/script>';
  1201. return str;
  1202. }
  1203. //资源选择
  1204. function resource(item) {
  1205. var str =
  1206. '<div class="form-group">' +
  1207. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1208. '<div class="sui-resource-selector form-control">' +
  1209. '<div class="sui-selector-box clearfix resource" id="' + item.name + '" data-listidx="0">';
  1210. if (item.value && item.value.length > 0) {
  1211. $.each(item.value, function (index, value) {
  1212. str +=
  1213. '<div class="js-item img-item resource-list ' + item.name + '" style="cursor: pointer;" >' +
  1214. '<div class="box">' +
  1215. '<a class="thumb">' +
  1216. '<img class="image-result" src="' + value.thumb + '" alt="' + value.title + '" data-id="' + value.id + '">' +
  1217. '</a>' +
  1218. '<div class="title cutstr resource-sub-title">' + value.title + '</div>' +
  1219. '<div class="summary resource-summary">' + value.summary + '</div>' +
  1220. '<div class="operate"><a href="javascript:;" class="js-del-item"><i class="fa fa-remove"></i>移除</a></div>' +
  1221. '</div>' +
  1222. '</div>';
  1223. });
  1224. }
  1225. str +=
  1226. '</div>' +
  1227. '<div class="sui-selector-btns"><button type="button" class="btn" onclick="addContent(\'' + item.name + '\')">选择内容</button></div>' +
  1228. '</div>' +
  1229. '</div>';
  1230. return str;
  1231. }
  1232. //图片上传
  1233. function image(item) {
  1234. var str =
  1235. '<div class="form-group">' +
  1236. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1237. '<div class="sui-resource-selector form-control">' +
  1238. '<div class="sui-selector-box clearfix images-result" id="' + item.name + '" data-listidx="0">';
  1239. if (item.value && item.value.length > 0) {
  1240. $.each(item.value, function (index, value) {
  1241. str +=
  1242. '<div class="js-item img-item images-list ' + item.name + '" style="cursor:pointer" id="images-info">' +
  1243. '<div class="box">' +
  1244. '<a class="thumb">' +
  1245. '<img class="image-result" src="' + value.src + '" alt="" style="width: 500px">' +
  1246. '</a>' +
  1247. '<div class="title cutstr">' + value.src + '</div>' +
  1248. '<div class="summary" data-id="' + value.id + '">alt<input type="text" class="form-control image-alt" value="' + value.alt + '"></div>' +
  1249. '<div class="operate">' +
  1250. '<a href="javascript:;" class="js-del-item"><i class="fa fa-remove"></i>移除</a>' +
  1251. '</div>' +
  1252. '</div>' +
  1253. '</div>';
  1254. });
  1255. }
  1256. str +=
  1257. '</div>' +
  1258. '<div class="sui-selector-btns">' +
  1259. '<button type="button" class="btn" onclick="addImages(\'' + item.name + '\')">选择图片</button>' +
  1260. '</div>' +
  1261. '</div>' +
  1262. '</div>';
  1263. return str;
  1264. }
  1265. //文件上传
  1266. function file(item) {
  1267. var str =
  1268. '<div class="form-group">' +
  1269. '<label class="control-label" for="' + item.name + '" >' + item.caption + '</label>' +
  1270. '<div class="sui-resource-selector form-control">' +
  1271. '<div class="sui-selector-box clearfix" id="' + item.name + '" data-listidx="0">';
  1272. if (item.value && item.value.length > 0) {
  1273. $.each(item.value, function (index, value) {
  1274. str +=
  1275. '<div class="js-item img-item file-result-list ' + item.name + '" style="cursor:pointer">' +
  1276. '<div>' +
  1277. '<input type="text" class="form-control file-value" name="' + item.name + '" value="' + value.file + '" data-file-size="' + value.file_size + '">' +
  1278. '<div class="operate">' +
  1279. '<a href="javascript:;" class="js-del-item"><i class="fa fa-remove"></i>移除</a>' +
  1280. '</div>' +
  1281. '</div>' +
  1282. '</div>';
  1283. });
  1284. }
  1285. str +=
  1286. '</div>' +
  1287. '<div class="sui-selector-btns">' +
  1288. '<button type="button" class="btn" id="file_upload" name="file_upload">文件上传</button>' +
  1289. '<input type="file" value="" style="display: none" id="uploadFile" name="uploadFile" multiple data-info="' + item.name + '">' +
  1290. '</div>' +
  1291. '</div>' +
  1292. '</div>';
  1293. return str;
  1294. }
  1295. var trees = JSON.parse('{!! addslashes(json_encode($trees)) !!}');
  1296. $(document).ready(function () {
  1297. zTreeObj = $.fn.zTree.init($("#treeDemo"), setting, trees);
  1298. zTree = $.fn.zTree.getZTreeObj("treeDemo");
  1299. rMenu = $("#rMenu");
  1300. var cookie = $.cookie("z_tree1");
  1301. if (cookie) {
  1302. z_tree = JSON.parse(cookie);
  1303. for (var i = 0; i < z_tree.length; i++) {
  1304. var node = zTree.getNodeByParam('id', z_tree[i]);
  1305. zTree.expandNode(node, true)
  1306. }
  1307. }
  1308. });
  1309. function addContent(type) {
  1310. layer.open({
  1311. type: 2,
  1312. content: ['/admin/stencil/resources/{{$siteId}}/' + type],
  1313. area: ['60%', '60%'],
  1314. title: '编辑'
  1315. });
  1316. }
  1317. function addImages(type) {
  1318. layer.open({
  1319. type: 2,
  1320. content: ['/admin/stencil/images/{{$siteId}}/' + type],
  1321. area: ['60%', '60%'],
  1322. title: '编辑'
  1323. });
  1324. }
  1325. //ctrl+s 保存
  1326. window.addEventListener("keydown", function (e) {
  1327. //可以判断是不是mac,如果是mac,ctrl变为花键
  1328. //event.preventDefault() 方法阻止元素发生默认的行为。
  1329. if (e.keyCode === 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
  1330. e.preventDefault();
  1331. // Process event...
  1332. save();
  1333. }
  1334. }, false);
  1335. function save() {
  1336. var data = tips.getFormValues('#form');
  1337. data.subtitle = $('#subtitle').val();//副标题
  1338. data.new_pid = $('#new_pid').val();//新建页面父id
  1339. data.deny_spider = 0;
  1340. if ($('#deny_spider').is(':checked')) {
  1341. data.deny_spider = 1;
  1342. }
  1343. data.is_hidemenu = 0;
  1344. if ($('#is_hidemenu').is(':checked')) {
  1345. data.is_hidemenu = 1;
  1346. }
  1347. data.is_enabled = 0;
  1348. if ($('#is_enabled').is(':checked')) {
  1349. data.is_enabled = 1;
  1350. }
  1351. data.is_301 = 0;
  1352. if ($('#is_301').is(':checked')) {
  1353. data.is_301 = 1;
  1354. }
  1355. data.is_freeze_url = 0;
  1356. if ($('#is_freeze_url').is(':checked')) {
  1357. data.is_freeze_url = 1;
  1358. }
  1359. //图片
  1360. data.thumb = $('#images').find("img").attr('src');
  1361. //富文本内容
  1362. data.content = editor.txt.html();
  1363. //复选框
  1364. $(checkboxList).each(function (key, value) {
  1365. var checkbox = [];
  1366. var jqObject = '.checkbox-list input[name=' + value + ']:checked';
  1367. $(jqObject).each(function () {
  1368. checkbox.push($(this).val());
  1369. });
  1370. data[value] = checkbox;
  1371. });
  1372. //富文本
  1373. $(editorList).each(function (key, value) {
  1374. data[value.name] = value.editorObject.txt.html();
  1375. });
  1376. //资源
  1377. $(resourceList).each(function (key, value) {
  1378. var resourceInfo = [];
  1379. var jqObject = '.' + value;
  1380. $(jqObject).each(function (kk, vv) {
  1381. var resource = {};
  1382. resource.id = $(vv).find(".image-result").attr('data-id');
  1383. resource.title = $(vv).find(".resource-sub-title").text();
  1384. resource.thumb = $(vv).find(".image-result").attr('src');
  1385. resource.summary = $(vv).find(".resource-summary").text();
  1386. resourceInfo.push(resource);
  1387. });
  1388. data[value] = resourceInfo;
  1389. });
  1390. //图片
  1391. $(imageList).each(function (key, value) {
  1392. var image = [];
  1393. var jqObject = '.' + value;
  1394. $(jqObject).each(function (kk, vv) {
  1395. var images = {};
  1396. images.src = $(vv).find(".image-result").attr('src');
  1397. images.alt = $(vv).find(".image-alt").val();
  1398. images.id = $(vv).find(".summary").attr('data-id');
  1399. image.push(images);
  1400. });
  1401. data[value] = image;
  1402. });
  1403. //文件
  1404. $(fileList).each(function (key, value) {
  1405. var file = [];
  1406. var jqObject = '.' + value;
  1407. $(jqObject).each(function (kk, vv) {
  1408. var files = {};
  1409. files.file = $(vv).find(".file-value").val();
  1410. files.file_size = $(vv).find(".file-value").attr('data-file-size');
  1411. file.push(files);
  1412. });
  1413. data[value] = file;
  1414. });
  1415. var url = '/admin/stencil/indexSave/{{$siteId}}';
  1416. var type = 'post';
  1417. var ajaxConfig = {
  1418. url: url,
  1419. type: type,
  1420. data: data,
  1421. success: function (result) {
  1422. layer.msg(result.message, {icon: 1});
  1423. window.location.reload();
  1424. }
  1425. };
  1426. tips.ajax(ajaxConfig);
  1427. }
  1428. //删除图片
  1429. $(document).on('click', '.js-del-item', function () {
  1430. $(this).parent().parent().parent().remove();
  1431. });
  1432. //删除图片
  1433. $(document).on('click', '.js-del-item-alone', function () {
  1434. $(this).parent().parent().remove();
  1435. });
  1436. //模版联动样式和变量
  1437. $(document).on('change', '#tpl_id', function () {
  1438. var tid = $('#tpl_id').val();
  1439. var indexId = $('#index_id').val();
  1440. changeCss(tid);
  1441. changeTemplateVariableList(tid, indexId);
  1442. });
  1443. //保存
  1444. $(document).on('click', '#indexSave', function () {
  1445. save();
  1446. });
  1447. //上传
  1448. $(document).on('click', '[name=file_upload]', function () {
  1449. $(this).next().trigger('click');
  1450. });
  1451. //多文件上传
  1452. $(document).on('change', '[name=uploadFile]', function () {
  1453. var _this = $(this).attr('data-info');
  1454. var formData = new FormData();
  1455. if ($(this)[0].files.length > 10) {
  1456. layer.alert("最多只能选择10个文件哦", {icon: 5});
  1457. return;
  1458. }
  1459. var maxSize = 20480;//文件上传大小限制
  1460. for (var i = 0; i < $(this)[0].files.length; i++) {
  1461. var size = $(this)[0].files[i].size;
  1462. var fileSize = (size / 1024).toFixed(2);
  1463. if (fileSize > maxSize) {
  1464. layer.alert("上传文件不许超过20MB", {icon: 5});
  1465. return;
  1466. }
  1467. formData.append('files[]', $(this)[0].files[i]);
  1468. }
  1469. formData.append('siteId', "{{$siteId}}");
  1470. var ln;
  1471. $.ajax({
  1472. url: '/admin/stencil/bulkUpload',
  1473. type: 'POST',
  1474. cache: false,
  1475. data: formData,
  1476. processData: false,
  1477. contentType: false,
  1478. beforeSend: function () {
  1479. ln = layer.load();
  1480. },
  1481. complete: function () {
  1482. layer.close(ln);
  1483. },
  1484. success: function (result) {
  1485. var str = '';
  1486. $.each(result.data, function (key, value) {
  1487. str += '' +
  1488. '<div class="js-item img-item file-result-list ' + _this + '" style="cursor:pointer">' +
  1489. '<div>' +
  1490. '<input type="text" class="form-control file-value" name="' + _this + '" value="' + value.file_url + '" data-file-size="' + value.file_size + '">' +
  1491. '<div class="operate">' +
  1492. '<a href="javascript:;" class="js-del-item"><i class="fa fa-remove"></i>移除</a>' +
  1493. '</div>' +
  1494. '</div>' +
  1495. '</div>';
  1496. });
  1497. var object = '#' + _this;
  1498. $(object).append(str);
  1499. },
  1500. error: function (XMLHttpRequest) {
  1501. if (XMLHttpRequest.status === 500) {
  1502. layer.alert("异步请求失败", {icon: 5});
  1503. return;
  1504. }
  1505. layer.alert(JSON.parse(XMLHttpRequest.responseText).message, {icon: 0});
  1506. }
  1507. });
  1508. });
  1509. //异步加载模版关联的样式列表
  1510. function changeCss(tplId, cssId) {
  1511. var url = '/admin/stencil/getCssList?siteId={{$siteId}}&tpl_id=' + tplId;
  1512. var type = 'get';
  1513. var ajaxConfig = {
  1514. url: url,
  1515. type: type,
  1516. data: {},
  1517. success: function (result) {
  1518. var object = $("#css_id");
  1519. object.empty();
  1520. object.append('<option value="0">请选择样式</option>');
  1521. if (result.data.length > 0) {
  1522. $(result.data).each(function (key, value) {
  1523. var option = '<option value="' + value.id + '">' + value.name + '</option>';
  1524. object.append(option);
  1525. });
  1526. if (cssId > 0) {
  1527. $('#css_id').val(cssId);
  1528. }
  1529. }
  1530. }
  1531. };
  1532. tips.ajax(ajaxConfig);
  1533. }
  1534. //异步加载模版关联的变量列表
  1535. function changeTemplateVariableList(tplId, indexId) {
  1536. var url = '/admin/stencil/getTemplateVariableByTplId?siteId={{$siteId}}&tpl_id=' + tplId + '&content_id=' + indexId;
  1537. var type = 'get';
  1538. var ajaxConfig = {
  1539. url: url,
  1540. type: type,
  1541. data: {},
  1542. success: function (result) {
  1543. var str = '';
  1544. var tpl = $('#tpl');
  1545. tpl.empty();
  1546. editorList = [];
  1547. checkboxList = [];
  1548. resourceList = [];
  1549. imageList = [];
  1550. fileList = [];
  1551. if (result.data.length > 0) {
  1552. var richTextList1 = [];
  1553. $.each(result.data, function (index, item) {
  1554. if (item.input_type === 'text') {
  1555. str += text(item);
  1556. }
  1557. if (item.input_type === 'textarea') {
  1558. str += textarea(item);
  1559. }
  1560. if (item.input_type === 'richtext') {
  1561. str += richtext(item);
  1562. richTextList1.push(item.name + ':' + Base64.encode(item.value));
  1563. }
  1564. if (item.input_type === 'taginput') {
  1565. str += taginput(item);
  1566. }
  1567. if (item.input_type === 'select') {
  1568. str += select(item);
  1569. }
  1570. if (item.input_type === 'checkbox') {
  1571. str += checkbox(item);
  1572. checkboxList.push(item.name);
  1573. }
  1574. if (item.input_type === 'radio') {
  1575. str += radio(item);
  1576. }
  1577. if (item.input_type === 'date') {
  1578. str += date(item);
  1579. }
  1580. if (item.input_type === 'resource') {
  1581. str += resource(item);
  1582. resourceList.push(item.name);
  1583. }
  1584. if (item.input_type === 'image') {
  1585. str += image(item);
  1586. imageList.push(item.name);
  1587. }
  1588. if (item.input_type === 'file') {
  1589. str += file(item);
  1590. fileList.push(item.name);
  1591. }
  1592. });
  1593. tpl.append(str);
  1594. if (richTextList1.length > 0) {
  1595. $(richTextList1).each(function (key, value) {
  1596. var result = value.split(':');
  1597. var editor = new E("#" + result[0]);
  1598. editor.config.uploadImgServer = '/admin/stencil/editorUpload/{{$siteId}}';
  1599. editor.config.uploadFileName = 'editorFile';
  1600. editor.config.uploadImgMaxLength = 5;// 一次最多上传 5 个图片
  1601. editor.config.uploadImgAccept = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
  1602. editor.config.uploadImgMaxSize = 5 * 1024 * 1024;// 5M
  1603. editor.create();
  1604. var data = {};
  1605. data.editorObject = editor;
  1606. data.name = result[0];
  1607. editorList.push(data);
  1608. if (Base64.decode(result[1])) {
  1609. editor.txt.html(Base64.decode(result[1])); // 重新设置编辑器内容
  1610. }
  1611. });
  1612. }
  1613. //图片拖拽
  1614. if (imageList.length > 0) {
  1615. $(imageList).each(function (key, value) {
  1616. //获取对象
  1617. var el = document.getElementById(value);
  1618. //设置配置
  1619. var ops = {
  1620. animation: 1000,
  1621. //拖动结束
  1622. onEnd: function (evt) {
  1623. //console.log(evt);
  1624. //获取拖动后的排序
  1625. //var arr = sortable.toArray();
  1626. //alert(JSON.stringify(arr));
  1627. }
  1628. };
  1629. //初始化
  1630. Sortable.create(el, ops);
  1631. });
  1632. }
  1633. //资源拖拽
  1634. if (resourceList.length > 0) {
  1635. $(resourceList).each(function (key, value) {
  1636. //获取对象
  1637. var el = document.getElementById(value);
  1638. //设置配置
  1639. var ops = {
  1640. animation: 1000,
  1641. //拖动结束
  1642. onEnd: function (evt) {
  1643. //console.log(evt);
  1644. //获取拖动后的排序
  1645. //var arr = sortable.toArray();
  1646. //alert(JSON.stringify(arr));
  1647. }
  1648. };
  1649. //初始化
  1650. Sortable.create(el, ops);
  1651. });
  1652. }
  1653. }
  1654. }
  1655. };
  1656. tips.ajax(ajaxConfig);
  1657. }
  1658. </script>
  1659. @endsection