易优批量新增模型字段

2022/4/27 11:36:36

  1. // ==UserScript==
  2. // @name 易优批量新增模型字段
  3. // @namespace Violentmonkey Scripts
  4. // @include https://www.eyoucms.com/
  5. // @match http://*/*/login.php?m=admin&c=Field&a=channel_index&channel_id=*&lang=cn
  6. // @grant none
  7. // @version 1.0
  8. // @author sunzehui
  9. // @license MIT
  10. // @description 2022/4/27 11:36:36
  11. // ==/UserScript==
  12.  
  13. function init(){
  14. const parent = $(".flexigrid");
  15. parent.children(".mDiv").append(`<div class="ftitle">
  16. <div class="fbutton">
  17. <a href="javascript:void(0);" id="batchInsert" >
  18. <div class="add" title="新增字段">
  19. <span><i class="layui-icon layui-icon-addition"></i>批量新增</span>
  20. </div>
  21. </a>
  22. </div>
  23. </div>`)
  24. $('#batchInsert').on("click", showBox)
  25.  
  26. }
  27. let isBoxShow = false
  28. function showBox(){
  29. console.log(isBoxShow)
  30. if(!isBoxShow){
  31. isBoxShow = true
  32. }else{
  33. $(".flexigrid .bDiv").empty();
  34. isBoxShow=false
  35. }
  36. const style =document.createElement("style");style.innerHTML= `*,
  37. ::before,
  38. ::after {
  39. box-sizing: border-box;
  40. /* 1 */
  41. border-width: 0;
  42. /* 2 */
  43. border-style: solid;
  44. /* 2 */
  45. border-color: #e5e7eb;
  46. /* 2 */
  47. }
  48. input[type="text"], input[type="password"], textarea, select, .editable, .editable2, .editable-tarea, .editable-tarea2{
  49. }
  50. .editable, .editable2, input[type="text"], input[type="password"]{
  51. height:50px;
  52. line-height:auto;
  53. font-size:1em;
  54. }/*
  55. ! tailwindcss v3.0.24 | MIT License | https://tailwindcss.com
  56. */
  57.  
  58. /*
  59. 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
  60. 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
  61. */
  62.  
  63. *,
  64. ::before,
  65. ::after {
  66. box-sizing: border-box;
  67. /* 1 */
  68. border-width: 0;
  69. /* 2 */
  70. border-style: solid;
  71. /* 2 */
  72. border-color: #e5e7eb;
  73. /* 2 */
  74. }
  75.  
  76. ::before,
  77. ::after {
  78. --tw-content: "";
  79. }
  80.  
  81. /*
  82. 1. Use a consistent sensible line-height in all browsers.
  83. 2. Prevent adjustments of font size after orientation changes in iOS.
  84. 3. Use a more readable tab size.
  85. 4. Use the user's configured sans font-family by default.
  86. */
  87.  
  88. html {
  89. line-height: 1.5;
  90. /* 1 */
  91. -webkit-text-size-adjust: 100%;
  92. /* 2 */
  93. -moz-tab-size: 4;
  94. /* 3 */
  95. -o-tab-size: 4;
  96. tab-size: 4;
  97. /* 3 */
  98. font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
  99. "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
  100. "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  101. /* 4 */
  102. }
  103.  
  104. /*
  105. 1. Remove the margin in all browsers.
  106. 2. Inherit line-height from html so users can set them as a class directly on the html element.
  107. */
  108.  
  109. body {
  110. margin: 0;
  111. /* 1 */
  112. line-height: inherit;
  113. /* 2 */
  114. }
  115.  
  116. /*
  117. 1. Add the correct height in Firefox.
  118. 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
  119. 3. Ensure horizontal rules are visible by default.
  120. */
  121.  
  122. hr {
  123. height: 0;
  124. /* 1 */
  125. color: inherit;
  126. /* 2 */
  127. border-top-width: 1px;
  128. /* 3 */
  129. }
  130.  
  131. /*
  132. Add the correct text decoration in Chrome, Edge, and Safari.
  133. */
  134.  
  135. abbr:where([title]) {
  136. -webkit-text-decoration: underline dotted;
  137. text-decoration: underline dotted;
  138. }
  139.  
  140. /*
  141. Remove the default font size and weight for headings.
  142. */
  143.  
  144. h1,
  145. h2,
  146. h3,
  147. h4,
  148. h5,
  149. h6 {
  150. font-size: inherit;
  151. font-weight: inherit;
  152. }
  153.  
  154. /*
  155. Reset links to optimize for opt-in styling instead of opt-out.
  156. */
  157.  
  158. a {
  159. color: inherit;
  160. text-decoration: inherit;
  161. }
  162.  
  163. /*
  164. Add the correct font weight in Edge and Safari.
  165. */
  166.  
  167. b,
  168. strong {
  169. font-weight: bolder;
  170. }
  171.  
  172. /*
  173. 1. Use the user's configured mono font family by default.
  174. 2. Correct the odd em font sizing in all browsers.
  175. */
  176.  
  177. code,
  178. kbd,
  179. samp,
  180. pre {
  181. font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
  182. "Liberation Mono", "Courier New", monospace;
  183. /* 1 */
  184. font-size: 1em;
  185. /* 2 */
  186. }
  187.  
  188. /*
  189. Add the correct font size in all browsers.
  190. */
  191.  
  192. small {
  193. font-size: 80%;
  194. }
  195.  
  196. /*
  197. Prevent sub and sup elements from affecting the line height in all browsers.
  198. */
  199.  
  200. sub,
  201. sup {
  202. font-size: 75%;
  203. line-height: 0;
  204. position: relative;
  205. vertical-align: baseline;
  206. }
  207.  
  208. sub {
  209. bottom: -0.25em;
  210. }
  211.  
  212. sup {
  213. top: -0.5em;
  214. }
  215.  
  216. /*
  217. 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
  218. 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
  219. 3. Remove gaps between table borders by default.
  220. */
  221.  
  222. table {
  223. text-indent: 0;
  224. /* 1 */
  225. border-color: inherit;
  226. /* 2 */
  227. border-collapse: collapse;
  228. /* 3 */
  229. }
  230.  
  231. /*
  232. 1. Change the font styles in all browsers.
  233. 2. Remove the margin in Firefox and Safari.
  234. 3. Remove default padding in all browsers.
  235. */
  236.  
  237. button,
  238. input,
  239. optgroup,
  240. select,
  241. textarea {
  242. font-family: inherit;
  243. /* 1 */
  244. font-size: 100%;
  245. /* 1 */
  246. line-height: inherit;
  247. /* 1 */
  248. color: inherit;
  249. /* 1 */
  250. margin: 0;
  251. /* 2 */
  252. padding: 0;
  253. /* 3 */
  254. }
  255.  
  256. /*
  257. Remove the inheritance of text transform in Edge and Firefox.
  258. */
  259.  
  260. button,
  261. select {
  262. text-transform: none;
  263. }
  264.  
  265. /*
  266. 1. Correct the inability to style clickable types in iOS and Safari.
  267. 2. Remove default button styles.
  268. */
  269.  
  270. button,
  271. [type="button"],
  272. [type="reset"],
  273. [type="submit"] {
  274. -webkit-appearance: button;
  275. /* 1 */
  276. background-color: transparent;
  277. /* 2 */
  278. background-image: none;
  279. /* 2 */
  280. }
  281.  
  282. /*
  283. Use the modern Firefox focus style for all focusable elements.
  284. */
  285.  
  286. :-moz-focusring {
  287. outline: auto;
  288. }
  289.  
  290. /*
  291. Remove the additional :invalid styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
  292. */
  293.  
  294. :-moz-ui-invalid {
  295. box-shadow: none;
  296. }
  297.  
  298. /*
  299. Add the correct vertical alignment in Chrome and Firefox.
  300. */
  301.  
  302. progress {
  303. vertical-align: baseline;
  304. }
  305.  
  306. /*
  307. Correct the cursor style of increment and decrement buttons in Safari.
  308. */
  309.  
  310. ::-webkit-inner-spin-button,
  311. ::-webkit-outer-spin-button {
  312. height: auto;
  313. }
  314.  
  315. /*
  316. 1. Correct the odd appearance in Chrome and Safari.
  317. 2. Correct the outline style in Safari.
  318. */
  319.  
  320. [type="search"] {
  321. -webkit-appearance: textfield;
  322. /* 1 */
  323. outline-offset: -2px;
  324. /* 2 */
  325. }
  326.  
  327. /*
  328. Remove the inner padding in Chrome and Safari on macOS.
  329. */
  330.  
  331. ::-webkit-search-decoration {
  332. -webkit-appearance: none;
  333. }
  334.  
  335. /*
  336. 1. Correct the inability to style clickable types in iOS and Safari.
  337. 2. Change font properties to inherit in Safari.
  338. */
  339.  
  340. ::-webkit-file-upload-button {
  341. -webkit-appearance: button;
  342. /* 1 */
  343. font: inherit;
  344. /* 2 */
  345. }
  346.  
  347. /*
  348. Add the correct display in Chrome and Safari.
  349. */
  350.  
  351. summary {
  352. display: list-item;
  353. }
  354.  
  355. /*
  356. Removes the default spacing and border for appropriate elements.
  357. */
  358.  
  359. blockquote,
  360. dl,
  361. dd,
  362. h1,
  363. h2,
  364. h3,
  365. h4,
  366. h5,
  367. h6,
  368. hr,
  369. figure,
  370. p,
  371. pre {
  372. margin: 0;
  373. }
  374.  
  375. fieldset {
  376. margin: 0;
  377. padding: 0;
  378. }
  379.  
  380. legend {
  381. padding: 0;
  382. }
  383.  
  384. ol,
  385. ul,
  386. menu {
  387. list-style: none;
  388. margin: 0;
  389. padding: 0;
  390. }
  391.  
  392. /*
  393. Prevent resizing textareas horizontally by default.
  394. */
  395.  
  396. textarea {
  397. resize: vertical;
  398. }
  399.  
  400. /*
  401. 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
  402. 2. Set the default placeholder color to the user's configured gray 400 color.
  403. */
  404.  
  405. input::-moz-placeholder,
  406. textarea::-moz-placeholder {
  407. opacity: 1;
  408. /* 1 */
  409. color: #9ca3af;
  410. /* 2 */
  411. }
  412.  
  413. input:-ms-input-placeholder,
  414. textarea:-ms-input-placeholder {
  415. opacity: 1;
  416. /* 1 */
  417. color: #9ca3af;
  418. /* 2 */
  419. }
  420.  
  421. input::placeholder,
  422. textarea::placeholder {
  423. opacity: 1;
  424. /* 1 */
  425. color: #9ca3af;
  426. /* 2 */
  427. }
  428.  
  429. /*
  430. Set the default cursor for buttons.
  431. */
  432.  
  433. button,
  434. [role="button"] {
  435. cursor: pointer;
  436. }
  437.  
  438. /*
  439. Make sure disabled buttons don't get the pointer cursor.
  440. */
  441.  
  442. :disabled {
  443. cursor: default;
  444. }
  445.  
  446. /*
  447. 1. Make replaced elements display: block by default. (https://github.com/mozdevs/cssremedy/issues/14)
  448. 2. Add vertical-align: middle to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
  449. This can trigger a poorly considered lint error in some tools but is included by design.
  450. */
  451.  
  452. img,
  453. svg,
  454. video,
  455. canvas,
  456. audio,
  457. iframe,
  458. embed,
  459. object {
  460. display: block;
  461. /* 1 */
  462. vertical-align: middle;
  463. /* 2 */
  464. }
  465.  
  466. /*
  467. Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
  468. */
  469.  
  470. img,
  471. video {
  472. max-width: 100%;
  473. height: auto;
  474. }
  475.  
  476. /*
  477. Ensure the default browser behavior of the hidden attribute.
  478. */
  479.  
  480. [hidden] {
  481. display: none;
  482. }
  483.  
  484. [type="text"],
  485. [type="email"],
  486. [type="url"],
  487. [type="password"],
  488. [type="number"],
  489. [type="date"],
  490. [type="datetime-local"],
  491. [type="month"],
  492. [type="search"],
  493. [type="tel"],
  494. [type="time"],
  495. [type="week"],
  496. [multiple],
  497. textarea,
  498. select {
  499. -webkit-appearance: none;
  500. -moz-appearance: none;
  501. appearance: none;
  502. background-color: #fff;
  503. border-color: #6b7280;
  504. border-width: 1px;
  505. border-radius: 0px;
  506. padding-top: 0.5rem;
  507. padding-right: 0.75rem;
  508. padding-bottom: 0.5rem;
  509. padding-left: 0.75rem;
  510. font-size: 1rem;
  511. line-height: 1.5rem;
  512. --tw-shadow: 0 0 #0000;
  513. }
  514.  
  515. [type="text"]:focus,
  516. [type="email"]:focus,
  517. [type="url"]:focus,
  518. [type="password"]:focus,
  519. [type="number"]:focus,
  520. [type="date"]:focus,
  521. [type="datetime-local"]:focus,
  522. [type="month"]:focus,
  523. [type="search"]:focus,
  524. [type="tel"]:focus,
  525. [type="time"]:focus,
  526. [type="week"]:focus,
  527. [multiple]:focus,
  528. textarea:focus,
  529. select:focus {
  530. outline: 2px solid transparent;
  531. outline-offset: 2px;
  532. --tw-ring-inset: var(--tw-empty, /*!*/ /*!*/);
  533. --tw-ring-offset-width: 0px;
  534. --tw-ring-offset-color: #fff;
  535. --tw-ring-color: #2563eb;
  536. --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
  537. var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  538. --tw-ring-shadow: var(--tw-ring-inset) 0 0 0
  539. calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  540. box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
  541. var(--tw-shadow);
  542. border-color: #2563eb;
  543. }
  544.  
  545. input::-moz-placeholder,
  546. textarea::-moz-placeholder {
  547. color: #6b7280;
  548. opacity: 1;
  549. }
  550.  
  551. input:-ms-input-placeholder,
  552. textarea:-ms-input-placeholder {
  553. color: #6b7280;
  554. opacity: 1;
  555. }
  556.  
  557. input::placeholder,
  558. textarea::placeholder {
  559. color: #6b7280;
  560. opacity: 1;
  561. }
  562.  
  563. ::-webkit-datetime-edit-fields-wrapper {
  564. padding: 0;
  565. }
  566.  
  567. ::-webkit-date-and-time-value {
  568. min-height: 1.5em;
  569. }
  570.  
  571. ::-webkit-datetime-edit,
  572. ::-webkit-datetime-edit-year-field,
  573. ::-webkit-datetime-edit-month-field,
  574. ::-webkit-datetime-edit-day-field,
  575. ::-webkit-datetime-edit-hour-field,
  576. ::-webkit-datetime-edit-minute-field,
  577. ::-webkit-datetime-edit-second-field,
  578. ::-webkit-datetime-edit-millisecond-field,
  579. ::-webkit-datetime-edit-meridiem-field {
  580. padding-top: 0;
  581. padding-bottom: 0;
  582. }
  583.  
  584. select {
  585. background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  586. background-position: right 0.5rem center;
  587. background-repeat: no-repeat;
  588. background-size: 1.5em 1.5em;
  589. padding-right: 2.5rem;
  590. -webkit-print-color-adjust: exact;
  591. color-adjust: exact;
  592. }
  593.  
  594. [multiple] {
  595. background-image: initial;
  596. background-position: initial;
  597. background-repeat: unset;
  598. background-size: initial;
  599. padding-right: 0.75rem;
  600. -webkit-print-color-adjust: unset;
  601. color-adjust: unset;
  602. }
  603.  
  604. [type="checkbox"],
  605. [type="radio"] {
  606. -webkit-appearance: none;
  607. -moz-appearance: none;
  608. appearance: none;
  609. padding: 0;
  610. -webkit-print-color-adjust: exact;
  611. color-adjust: exact;
  612. display: inline-block;
  613. vertical-align: middle;
  614. background-origin: border-box;
  615. -webkit-user-select: none;
  616. -moz-user-select: none;
  617. -ms-user-select: none;
  618. user-select: none;
  619. flex-shrink: 0;
  620. height: 1rem;
  621. width: 1rem;
  622. color: #2563eb;
  623. background-color: #fff;
  624. border-color: #6b7280;
  625. border-width: 1px;
  626. --tw-shadow: 0 0 #0000;
  627. }
  628.  
  629. [type="checkbox"] {
  630. border-radius: 0px;
  631. }
  632.  
  633. [type="radio"] {
  634. border-radius: 100%;
  635. }
  636.  
  637. [type="checkbox"]:focus,
  638. [type="radio"]:focus {
  639. outline: 2px solid transparent;
  640. outline-offset: 2px;
  641. --tw-ring-inset: var(--tw-empty, /*!*/ /*!*/);
  642. --tw-ring-offset-width: 2px;
  643. --tw-ring-offset-color: #fff;
  644. --tw-ring-color: #2563eb;
  645. --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
  646. var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  647. --tw-ring-shadow: var(--tw-ring-inset) 0 0 0
  648. calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  649. box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
  650. var(--tw-shadow);
  651. }
  652.  
  653. [type="checkbox"]:checked,
  654. [type="radio"]:checked {
  655. border-color: transparent;
  656. background-color: currentColor;
  657. background-size: 100% 100%;
  658. background-position: center;
  659. background-repeat: no-repeat;
  660. }
  661.  
  662. [type="checkbox"]:checked {
  663. background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
  664. }
  665.  
  666. [type="radio"]:checked {
  667. background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
  668. }
  669.  
  670. [type="checkbox"]:checked:hover,
  671. [type="checkbox"]:checked:focus,
  672. [type="radio"]:checked:hover,
  673. [type="radio"]:checked:focus {
  674. border-color: transparent;
  675. background-color: currentColor;
  676. }
  677.  
  678. [type="checkbox"]:indeterminate {
  679. background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e");
  680. border-color: transparent;
  681. background-color: currentColor;
  682. background-size: 100% 100%;
  683. background-position: center;
  684. background-repeat: no-repeat;
  685. }
  686.  
  687. [type="checkbox"]:indeterminate:hover,
  688. [type="checkbox"]:indeterminate:focus {
  689. border-color: transparent;
  690. background-color: currentColor;
  691. }
  692.  
  693. [type="file"] {
  694. background: unset;
  695. border-color: inherit;
  696. border-width: 0;
  697. border-radius: 0;
  698. padding: 0;
  699. font-size: unset;
  700. line-height: inherit;
  701. }
  702.  
  703. [type="file"]:focus {
  704. outline: 1px auto -webkit-focus-ring-color;
  705. }
  706.  
  707. *,
  708. ::before,
  709. ::after {
  710. --tw-translate-x: 0;
  711. --tw-translate-y: 0;
  712. --tw-rotate: 0;
  713. --tw-skew-x: 0;
  714. --tw-skew-y: 0;
  715. --tw-scale-x: 1;
  716. --tw-scale-y: 1;
  717. --tw-pan-x: ;
  718. --tw-pan-y: ;
  719. --tw-pinch-zoom: ;
  720. --tw-scroll-snap-strictness: proximity;
  721. --tw-ordinal: ;
  722. --tw-slashed-zero: ;
  723. --tw-numeric-figure: ;
  724. --tw-numeric-spacing: ;
  725. --tw-numeric-fraction: ;
  726. --tw-ring-inset: ;
  727. --tw-ring-offset-width: 0px;
  728. --tw-ring-offset-color: #fff;
  729. --tw-ring-color: rgb(59 130 246 / 0.5);
  730. --tw-ring-offset-shadow: 0 0 #0000;
  731. --tw-ring-shadow: 0 0 #0000;
  732. --tw-shadow: 0 0 #0000;
  733. --tw-shadow-colored: 0 0 #0000;
  734. --tw-blur: ;
  735. --tw-brightness: ;
  736. --tw-contrast: ;
  737. --tw-grayscale: ;
  738. --tw-hue-rotate: ;
  739. --tw-invert: ;
  740. --tw-saturate: ;
  741. --tw-sepia: ;
  742. --tw-drop-shadow: ;
  743. --tw-backdrop-blur: ;
  744. --tw-backdrop-brightness: ;
  745. --tw-backdrop-contrast: ;
  746. --tw-backdrop-grayscale: ;
  747. --tw-backdrop-hue-rotate: ;
  748. --tw-backdrop-invert: ;
  749. --tw-backdrop-opacity: ;
  750. --tw-backdrop-saturate: ;
  751. --tw-backdrop-sepia: ;
  752. }
  753.  
  754. .container {
  755. width: 100%;
  756. }
  757.  
  758. @media (min-width: 640px) {
  759. .container {
  760. max-width: 640px;
  761. }
  762. }
  763.  
  764. @media (min-width: 768px) {
  765. .container {
  766. max-width: 768px;
  767. }
  768. }
  769.  
  770. @media (min-width: 1024px) {
  771. .container {
  772. max-width: 1024px;
  773. }
  774. }
  775.  
  776. @media (min-width: 1280px) {
  777. .container {
  778. max-width: 1280px;
  779. }
  780. }
  781.  
  782. @media (min-width: 1536px) {
  783. .container {
  784. max-width: 1536px;
  785. }
  786. }
  787.  
  788. .col-span-6 {
  789. grid-column: span 6 / span 6;
  790. }
  791.  
  792. .col-span-2 {
  793. grid-column: span 2 / span 2;
  794. }
  795.  
  796. .col-span-4 {
  797. grid-column: span 4 / span 4;
  798. }
  799.  
  800. .col-span-1 {
  801. grid-column: span 1 / span 1;
  802. }
  803.  
  804. .col-end-8 {
  805. grid-column-end: 8;
  806. }
  807.  
  808. .col-end-4 {
  809. grid-column-end: 4;
  810. }
  811.  
  812. .col-end-2 {
  813. grid-column-end: 2;
  814. }
  815.  
  816. .col-end-3 {
  817. grid-column-end: 3;
  818. }
  819.  
  820. .col-end-1 {
  821. grid-column-end: 1;
  822. }
  823.  
  824. .col-end-auto {
  825. grid-column-end: auto;
  826. }
  827.  
  828. .col-end-5 {
  829. grid-column-end: 5;
  830. }
  831.  
  832. .col-end-7 {
  833. grid-column-end: 7;
  834. }
  835.  
  836. .col-end-6 {
  837. grid-column-end: 6;
  838. }
  839.  
  840. .row-span-2 {
  841. grid-row: span 2 / span 2;
  842. }
  843.  
  844. .row-auto {
  845. grid-row: auto;
  846. }
  847.  
  848. .mt-5 {
  849. margin-top: 1.25rem;
  850. }
  851.  
  852. .mt-4 {
  853. margin-top: 1rem;
  854. }
  855.  
  856. .ml-3 {
  857. margin-left: 0.75rem;
  858. }
  859.  
  860. .mt-1 {
  861. margin-top: 0.25rem;
  862. }
  863.  
  864. .block {
  865. display: block;
  866. }
  867.  
  868. .flex {
  869. display: flex;
  870. }
  871.  
  872. .inline-flex {
  873. display: inline-flex;
  874. }
  875.  
  876. .table {
  877. display: table;
  878. }
  879.  
  880. .grid {
  881. display: grid;
  882. }
  883.  
  884. .h-screen {
  885. height: 100vh;
  886. }
  887.  
  888. .h-4 {
  889. height: 1rem;
  890. }
  891.  
  892. .w-3\/4 {
  893. width: 75%;
  894. }
  895.  
  896. .w-4 {
  897. width: 1rem;
  898. }
  899.  
  900. .w-full {
  901. width: 100%;
  902. }
  903.  
  904. .grid-cols-6 {
  905. grid-template-columns: repeat(6, minmax(0, 1fr));
  906. }
  907.  
  908. .grid-cols-1 {
  909. grid-template-columns: repeat(1, minmax(0, 1fr));
  910. }
  911.  
  912. .items-center {
  913. align-items: center;
  914. }
  915.  
  916. .justify-center {
  917. justify-content: center;
  918. }
  919.  
  920. .gap-6 {
  921. gap: 1.5rem;
  922. }
  923.  
  924. .space-y-4 > :not([hidden]) ~ :not([hidden]) {
  925. --tw-space-y-reverse: 0;
  926. margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
  927. margin-bottom: calc(1rem * var(--tw-space-y-reverse));
  928. }
  929.  
  930. .place-self-center {
  931. place-self: center;
  932. }
  933.  
  934. .self-end {
  935. align-self: flex-end;
  936. }
  937.  
  938. .overflow-hidden {
  939. overflow: hidden;
  940. }
  941.  
  942. .whitespace-nowrap {
  943. white-space: nowrap;
  944. }
  945.  
  946. .rounded-md {
  947. border-radius: 0.375rem;
  948. }
  949.  
  950. .rounded-lg {
  951. border-radius: 0.5rem;
  952. }
  953.  
  954. .border {
  955. border-width: 1px;
  956. }
  957.  
  958. .border-gray-300 {
  959. --tw-border-opacity: 1;
  960. border-color: rgb(209 213 219 / var(--tw-border-opacity));
  961. }
  962.  
  963. .border-transparent {
  964. border-color: transparent;
  965. }
  966.  
  967. .bg-white {
  968. --tw-bg-opacity: 1;
  969. background-color: rgb(255 255 255 / var(--tw-bg-opacity));
  970. }
  971.  
  972. .bg-gray-50 {
  973. --tw-bg-opacity: 1;
  974. background-color: rgb(249 250 251 / var(--tw-bg-opacity));
  975. }
  976.  
  977. .bg-indigo-600 {
  978. --tw-bg-opacity: 1;
  979. background-color: rgb(79 70 229 / var(--tw-bg-opacity));
  980. }
  981.  
  982. .p-4 {
  983. padding: 1rem;
  984. }
  985.  
  986. .px-4 {
  987. padding-left: 1rem;
  988. padding-right: 1rem;
  989. }
  990.  
  991. .py-5 {
  992. padding-top: 1.25rem;
  993. padding-bottom: 1.25rem;
  994. }
  995.  
  996. .py-2 {
  997. padding-top: 0.5rem;
  998. padding-bottom: 0.5rem;
  999. }
  1000.  
  1001. .py-3 {
  1002. padding-top: 0.75rem;
  1003. padding-bottom: 0.75rem;
  1004. }
  1005.  
  1006. .px-6 {
  1007. padding-left: 1.5rem;
  1008. padding-right: 1.5rem;
  1009. }
  1010.  
  1011. .px-60 {
  1012. padding-left: 15rem;
  1013. padding-right: 15rem;
  1014. }
  1015.  
  1016. .px-2 {
  1017. padding-left: 0.5rem;
  1018. padding-right: 0.5rem;
  1019. }
  1020.  
  1021. .px-10 {
  1022. padding-left: 2.5rem;
  1023. padding-right: 2.5rem;
  1024. }
  1025.  
  1026. .text-center {
  1027. text-align: center;
  1028. }
  1029.  
  1030. .text-right {
  1031. text-align: right;
  1032. }
  1033.  
  1034. .text-sm {
  1035. font-size: 0.875rem;
  1036. line-height: 1.25rem;
  1037. }
  1038.  
  1039. .text-lg {
  1040. font-size: 1.125rem;
  1041. line-height: 1.75rem;
  1042. }
  1043.  
  1044. .font-medium {
  1045. font-weight: 500;
  1046. }
  1047.  
  1048. .font-bold {
  1049. font-weight: 700;
  1050. }
  1051.  
  1052. .font-normal {
  1053. font-weight: 400;
  1054. }
  1055.  
  1056. .text-indigo-600 {
  1057. --tw-text-opacity: 1;
  1058. color: rgb(79 70 229 / var(--tw-text-opacity));
  1059. }
  1060.  
  1061. .text-gray-700 {
  1062. --tw-text-opacity: 1;
  1063. color: rgb(55 65 81 / var(--tw-text-opacity));
  1064. }
  1065.  
  1066. .text-black {
  1067. --tw-text-opacity: 1;
  1068. color: rgb(0 0 0 / var(--tw-text-opacity));
  1069. }
  1070.  
  1071. .text-gray-900 {
  1072. --tw-text-opacity: 1;
  1073. color: rgb(17 24 39 / var(--tw-text-opacity));
  1074. }
  1075.  
  1076. .text-white {
  1077. --tw-text-opacity: 1;
  1078. color: rgb(255 255 255 / var(--tw-text-opacity));
  1079. }
  1080.  
  1081. .shadow {
  1082. --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  1083. --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color),
  1084. 0 1px 2px -1px var(--tw-shadow-color);
  1085. box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000),
  1086. var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
  1087. }
  1088.  
  1089. .shadow-sm {
  1090. --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  1091. --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
  1092. box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000),
  1093. var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
  1094. }
  1095.  
  1096. .table-wrapper table tbody tr {
  1097. --tw-text-opacity: 1;
  1098. color: rgb(55 65 81 / var(--tw-text-opacity));
  1099. }
  1100.  
  1101. .table-wrapper table tbody tr td {
  1102. border-width: 1px;
  1103. padding: 1rem;
  1104. }
  1105.  
  1106. .hover\:bg-indigo-700:hover {
  1107. --tw-bg-opacity: 1;
  1108. background-color: rgb(67 56 202 / var(--tw-bg-opacity));
  1109. }
  1110.  
  1111. .focus\:border-indigo-500:focus {
  1112. --tw-border-opacity: 1;
  1113. border-color: rgb(99 102 241 / var(--tw-border-opacity));
  1114. }
  1115.  
  1116. .focus\:outline-none:focus {
  1117. outline: 2px solid transparent;
  1118. outline-offset: 2px;
  1119. }
  1120.  
  1121. .focus\:ring-2:focus {
  1122. --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0
  1123. var(--tw-ring-offset-width) var(--tw-ring-offset-color);
  1124. --tw-ring-shadow: var(--tw-ring-inset) 0 0 0
  1125. calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
  1126. box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow),
  1127. var(--tw-shadow, 0 0 #0000);
  1128. }
  1129.  
  1130. .focus\:ring-indigo-500:focus {
  1131. --tw-ring-opacity: 1;
  1132. --tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity));
  1133. }
  1134.  
  1135. .focus\:ring-offset-2:focus {
  1136. --tw-ring-offset-width: 2px;
  1137. }
  1138.  
  1139. @media (min-width: 640px) {
  1140. .sm\:col-span-3 {
  1141. grid-column: span 3 / span 3;
  1142. }
  1143.  
  1144. .sm\:rounded-md {
  1145. border-radius: 0.375rem;
  1146. }
  1147.  
  1148. .sm\:p-6 {
  1149. padding: 1.5rem;
  1150. }
  1151.  
  1152. .sm\:px-6 {
  1153. padding-left: 1.5rem;
  1154. padding-right: 1.5rem;
  1155. }
  1156.  
  1157. .sm\:text-sm {
  1158. font-size: 0.875rem;
  1159. line-height: 1.25rem;
  1160. }
  1161. }
  1162.  
  1163. @media (min-width: 768px) {
  1164. .md\:col-span-2 {
  1165. grid-column: span 2 / span 2;
  1166. }
  1167.  
  1168. .md\:mt-0 {
  1169. margin-top: 0px;
  1170. }
  1171.  
  1172. .md\:grid {
  1173. display: grid;
  1174. }
  1175.  
  1176. .md\:grid-cols-1 {
  1177. grid-template-columns: repeat(1, minmax(0, 1fr));
  1178. }
  1179.  
  1180. .md\:gap-6 {
  1181. gap: 1.5rem;
  1182. }
  1183. }
  1184. .shadow-md {
  1185. --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  1186. --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
  1187. box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
  1188. border-top:1px solid gainsboro;
  1189. }
  1190. body > div.page > div.fixed-bar > div > ul > li > a{
  1191. border:none
  1192. }
  1193. `;
  1194. const elemDiv = $(`
  1195. <div class="container shadow-md">
  1196. <div class="md:grid md:grid-cols-1 w-3/4 md:gap-6">
  1197. <div class="mt-5 md:mt-0 md:col-span-2">
  1198. <div class="shadow overflow-hidden sm:rounded-md">
  1199. <div class="px-4 py-5 bg-white sm:p-6 text-black">
  1200. <div class="grid grid-cols-6 gap-6">
  1201.  
  1202. <fieldset class="col-span-6 row-span-2 sm:col-span-3">
  1203. <div class="mt-4 space-y-4">
  1204. <div class="flex items-center">
  1205. <input id="push-everything" name="push-notifications" type="radio" value="text"
  1206. class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300">
  1207. <label for="push-everything" class="ml-3 block text-sm font-medium text-gray-700">单行文本
  1208. </label>
  1209. </div>
  1210. <div class="flex items-center">
  1211. <input id="push-email" name="push-notifications" type="radio" value="multitext"
  1212. class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300">
  1213. <label for="push-email" class="ml-3 block text-sm font-medium text-gray-700"> 多行文本</label>
  1214. </div>
  1215. <div class="flex items-center">
  1216. <input id="push-nothing" name="push-notifications" type="radio" value="img"
  1217. class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300">
  1218. <label for="push-nothing" class="ml-3 block text-sm font-medium text-gray-700"> 图片 </label>
  1219. </div>
  1220. <div class="flex items-center">
  1221. <input id="push-test" name="push-notifications" type="radio" value="imgs"
  1222. class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300">
  1223. <label for="push-test" class="ml-3 block text-sm font-medium text-gray-700"> 多图片 </label>
  1224. </div>
  1225. </div>
  1226. </fieldset>
  1227.  
  1228.  
  1229. <div class="col-span-6 sm:col-span-3 row-auto">
  1230. <label for="title" class="block text-sm font-medium text-gray-700">标题</label>
  1231. <input type="text" name="title" id="title" autocomplete="given-name"
  1232. class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
  1233. </div>
  1234. <div class="col-span-6 sm:col-span-3 row-auto">
  1235. <label for="field" class="block text-sm font-medium text-gray-700">字段名</label>
  1236. <input type="text" name="field" id="field" autocomplete="family-name"
  1237. class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
  1238. </div>
  1239. <div class="col-span-1 ">
  1240. <label for="pageid" class="block text-sm font-medium text-gray-700">单页ID</label>
  1241. <input type="text" name="pageid" id="pageid" autocomplete="pageid"
  1242. class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
  1243. </div>
  1244. <div class="col-span-1 ">
  1245. <label for="startIndex" class="block text-sm font-medium text-gray-700">开始下标</label>
  1246. <input type="text" name="startIndex" id="startIndex" autocomplete="startIndex"
  1247. class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
  1248. </div>
  1249. <div class="col-span-1 ">
  1250. <label for="number" class="block text-sm font-medium text-gray-700">生成数量</label>
  1251. <input type="text" name="number" id="number" autocomplete="number"
  1252. class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">
  1253. </div>
  1254. <div class="col-span-1 place-self-center self-end ">
  1255. <button type="submit" id="gen-btn"
  1256. class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">生成</button>
  1257. </div>
  1258. <div class="col-span-1 col-end-7 self-end place-self-center">
  1259. <a href="#" class="block text-sm font-medium text-indigo-600 ">显示帮助</a>
  1260. </div>
  1261.  
  1262. </div>
  1263. <div class="table-wrapper grid grid-cols-1">
  1264. <h2 class="heading text-black text-center text-lg font-bold py-2">
  1265. 将会添加...
  1266. </h2>
  1267. <table class="table p-4 bg-white shadow rounded-lg">
  1268. <thead>
  1269. <tr>
  1270. <th class="border p-4 dark:border-dark-5 whitespace-nowrap font-normal text-gray-900">
  1271. 单页ID
  1272. </th>
  1273. <th class="border p-4 dark:border-dark-5 whitespace-nowrap font-normal text-gray-900">
  1274. 标题
  1275. </th>
  1276. <th class="border p-4 dark:border-dark-5 whitespace-nowrap font-normal text-gray-900">
  1277. 字段名
  1278. </th>
  1279. <th class="border p-4 dark:border-dark-5 whitespace-nowrap font-normal text-gray-900">
  1280. 类型
  1281. </th>
  1282. </tr>
  1283. </thead>
  1284. <tbody id="tbody">
  1285. </tbody>
  1286. </table>
  1287.  
  1288. </div>
  1289. </div>
  1290. <div class="col-span-6 px-4 py-3 bg-gray-50 text-right sm:px-6">
  1291. <button type="submit" id="submit-btn"
  1292. class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">确定</button>
  1293. </div>
  1294. </div>
  1295. </div>
  1296. </div>
  1297. </div>
  1298. `)
  1299. document.head.appendChild(style);
  1300. document.querySelector("body > div.page").style.height = '100%'
  1301. const parent = $(".flexigrid");
  1302. parent.css({
  1303. height:'100%',
  1304. overflow:'scroll'
  1305. })
  1306. const contentBox = parent.children(".bDiv");
  1307. contentBox.empty()
  1308. contentBox.append(elemDiv)
  1309. const submitBtn = document.getElementById('submit-btn');
  1310. submitBtn.onclick = () => insert2Eyou(waitToPush);
  1311. parent.children(".hDiv").empty();
  1312. parent.children(".tDiv").empty();
  1313. }
  1314.  
  1315.  
  1316. function render2Table(data) {
  1317. const tbody = $('#tbody');
  1318. data.forEach(element => {
  1319. const row = $(`
  1320. <tr>
  1321. <td>
  1322. ${element.id}
  1323. </td>
  1324. <td>
  1325. ${element.title}
  1326. </td>
  1327. <td>
  1328. ${element.field}
  1329. </td>
  1330. <td>
  1331. ${element.type}
  1332. </td>
  1333. </tr>
  1334. `);
  1335. tbody.append(row);
  1336. });
  1337. }
  1338.  
  1339. const waitToPush = []
  1340. $(document).ready(function(){
  1341. if(location.href.includes("eyoucms")){
  1342. return
  1343. }
  1344. init();
  1345.  
  1346. $("#gen-btn").on("click", ()=>{
  1347. const type = $('input[name="push-notifications"]:checked').val();
  1348. const channel_id = new URLSearchParams(location.href).get("channel_id")
  1349. const page_id = [$('#pageid').val()];
  1350. const cnt =Number( $('#number').val());;
  1351. const startIndex = Number($("#startIndex").val());
  1352. // 替换变量
  1353. for (let i = startIndex; i < startIndex+cnt; i++) {
  1354. const reg = new RegExp(`\\$d`, 'g');
  1355. _titile = $("#title").val().replace(reg, i);
  1356. _fieldName = $("#field").val().replace(reg, i);
  1357.  
  1358. waitToPush.push({
  1359. title: _titile,
  1360. field: _fieldName,
  1361. page_id,
  1362. type,
  1363. channel_id
  1364. })
  1365. }
  1366.  
  1367. console.log(waitToPush);
  1368.  
  1369. render2Table(waitToPush)
  1370. })
  1371.  
  1372. })
  1373.  
  1374. function insertOne(elem) {
  1375. return new Promise((resolve, reject) => $.ajax("login.php?m=admin&c=Field&a=channel_add&_ajax=1&lang=cn", {
  1376. type: "post",
  1377. data: {
  1378. title: elem.title,
  1379. name: elem.field,
  1380. dtype: elem.type,
  1381. "region_data[region_id]": "",
  1382. "region_data[region_names]": "",
  1383. "region_data[region_ids]": '',
  1384. dfvalue: '',
  1385. dfvalue_unit: '',
  1386. IsScreening_status: 0,
  1387. remark: '',
  1388. "typeids": elem.page_id,
  1389. channel_id: elem.channel_id,
  1390. },
  1391. success(d) {
  1392. resolve(d)
  1393. },
  1394. error(e) {
  1395. reject(e)
  1396. }
  1397. }))
  1398. }
  1399.  
  1400. async function insert2Eyou(data) {
  1401. try {
  1402. for (const elem of data) {
  1403. const result = await insertOne(elem)
  1404. console.log({ elem, result })
  1405. }
  1406. } catch (error) {
  1407. console.log({ error })
  1408. }
  1409.  
  1410. }
  1411. function render2Table(data) {
  1412. const tbody = $('#tbody');
  1413. tbody.empty();
  1414. data.forEach(element => {
  1415. const row = $(`
  1416. <tr>
  1417. <td>
  1418. ${element.page_id}
  1419. </td>
  1420. <td>
  1421. ${element.title}
  1422. </td>
  1423. <td>
  1424. ${element.field}
  1425. </td>
  1426. <td>
  1427. ${element.type}
  1428. </td>
  1429. </tr>
  1430. `);
  1431. tbody.append(row);
  1432. });
  1433. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址