index.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <style>
  2. .form-body {
  3. padding: 20px 50% 20px 20px;
  4. background-color: #fff;
  5. margin-bottom: 20px;
  6. min-width: 1000px
  7. }
  8. .form-button {
  9. margin: 0;
  10. }
  11. .form-button .el-form-item__content {
  12. margin-left: 0 !important;
  13. }
  14. .button-item {
  15. padding: 9px 25px;
  16. }
  17. .red {
  18. color: #ff4544
  19. }
  20. .id-card {
  21. position: relative;
  22. /*height: 170px;*/
  23. width: 190px;
  24. float: left;
  25. text-align: center;
  26. /*margin-bottom: 20px;*/
  27. font-size: 12px;
  28. color: #666;
  29. margin-right: 30px;
  30. }
  31. .id-card img {
  32. max-height: 134px;
  33. max-width: 190px;
  34. background-color: #EEEFF3;
  35. }
  36. .card-upload .el-button {
  37. position: absolute;
  38. left: 50%;
  39. top: 50%;
  40. margin-top: -16px;
  41. margin-left: -16px;
  42. z-index: 1;
  43. }
  44. .com-attachment .card-upload{
  45. width: 100%;
  46. height: 100%;
  47. }
  48. .background-box{
  49. width:100%;
  50. background-size: cover;
  51. background-repeat: no-repeat;
  52. background-position: center;
  53. padding-top: 100px;
  54. }
  55. .background-box .title{
  56. width: 280px;
  57. height: 138px;
  58. margin: auto;
  59. background-size: contain;
  60. background-repeat: no-repeat;
  61. margin-bottom: 50px;
  62. }
  63. .all-components {
  64. background: #fff;
  65. padding: 20px;
  66. }
  67. .all-components .component-group {
  68. border: 1px solid #eeeeee;
  69. width: 300px;
  70. margin-bottom: 20px;
  71. }
  72. .all-components .component-group:last-child {
  73. margin-bottom: 0;
  74. }
  75. .all-components .component-group-name {
  76. height: 35px;
  77. line-height: 35px;
  78. background: #f7f7f7;
  79. padding: 0 20px;
  80. border-bottom: 1px solid #eeeeee;
  81. }
  82. .all-components .component-list {
  83. margin-right: -2px;
  84. margin-top: -2px;
  85. flex-wrap: wrap;
  86. }
  87. .all-components .component-list .component-item {
  88. width: 100px;
  89. height: 100px;
  90. border: 0 solid #eeeeee;
  91. border-width: 0 1px 1px 0;
  92. text-align: center;
  93. padding: 15px 0 0;
  94. cursor: pointer;
  95. }
  96. .all-components .component-list .component-icon {
  97. width: 40px;
  98. height: 40px;
  99. /*border: 1px solid #eee;*/
  100. }
  101. .all-components .component-list .component-name {
  102. }
  103. #diy-list {
  104. width: 95%;
  105. padding: 20px;
  106. float: left;
  107. margin: 20px;
  108. border: 1px solid #eeeeee;
  109. }
  110. .all-components {
  111. background: #fff;
  112. padding: 20px;
  113. }
  114. .all-components .component-group {
  115. border: 1px solid #eeeeee;
  116. width: 300px;
  117. margin-bottom: 20px;
  118. }
  119. .all-components .component-group:last-child {
  120. margin-bottom: 0;
  121. }
  122. .all-components .component-group-name {
  123. height: 35px;
  124. line-height: 35px;
  125. background: #f7f7f7;
  126. padding: 0 20px;
  127. border-bottom: 1px solid #eeeeee;
  128. }
  129. .all-components .component-list {
  130. margin-right: -2px;
  131. margin-top: -2px;
  132. flex-wrap: wrap;
  133. }
  134. .all-components .component-list .component-item {
  135. width: 100px;
  136. height: 100px;
  137. border: 0 solid #eeeeee;
  138. border-width: 0 1px 1px 0;
  139. text-align: center;
  140. padding: 15px 0 0;
  141. cursor: pointer;
  142. }
  143. .all-components .component-list .component-icon {
  144. width: 40px;
  145. height: 40px;
  146. /*border: 1px solid #eee;*/
  147. }
  148. .all-components .component-list .component-name {
  149. }
  150. .mobile-framework {
  151. width: 375px;
  152. height: 100%;
  153. }
  154. .mobile-framework-header {
  155. height: 60px;
  156. line-height: 60px;
  157. background: #333;
  158. color: #fff;
  159. text-align: center;
  160. background: url('resources/img/mall/head.png') no-repeat;
  161. }
  162. .mobile-framework-body {
  163. min-height: 645px;
  164. border: 1px solid #e2e2e2;
  165. background: #f5f7f9;
  166. }
  167. .mobile-framework .diy-component-preview {
  168. cursor: pointer;
  169. position: relative;
  170. zoom: 0.5;
  171. -moz-transform: scale(0.5);
  172. -moz-transform-origin: top left;
  173. font-size: 28px;
  174. }
  175. @-moz-document url-prefix() {
  176. .mobile-framework .diy-component-preview {
  177. cursor: pointer;
  178. position: relative;
  179. -moz-transform: scale(0.5);
  180. -moz-transform-origin: top left;
  181. font-size: 28px;
  182. width: 200% !important;
  183. height: 100%;
  184. margin-bottom: auto;
  185. }
  186. .mobile-framework .active .diy-component-preview {
  187. border: 2px dashed #409EFF;
  188. left: -2px;
  189. right: -2px;
  190. width: calc(200% + 4px) !important;
  191. }
  192. }
  193. .mobile-framework .diy-component-preview:hover {
  194. box-shadow: inset 0 0 10000px rgba(0, 0, 0, .03);
  195. }
  196. .mobile-framework .diy-component-edit {
  197. width: 100%;
  198. position: absolute;
  199. top: 0;
  200. bottom: 0;
  201. left: 465px;
  202. right: 0;
  203. background: #fff;
  204. padding: 20px;
  205. display: none;
  206. overflow: auto;
  207. }
  208. .diy-component-options {
  209. position: relative;
  210. }
  211. .diy-component-options .el-button {
  212. height: 25px;
  213. line-height: 25px;
  214. width: 25px;
  215. padding: 0;
  216. text-align: center;
  217. border: none;
  218. border-radius: 0;
  219. position: absolute;
  220. margin-left: 0;
  221. }
  222. .mobile-framework .active .diy-component-preview {
  223. border: 2px dashed #409EFF;
  224. left: -2px;
  225. right: -2px;
  226. width: calc(100% + 4px);
  227. }
  228. .mobile-framework .active .diy-component-edit {
  229. display: block;
  230. padding-right: 20%;
  231. min-width: 650px;
  232. }
  233. .all-components {
  234. max-height: 725px;
  235. overflow-y: auto;
  236. }
  237. .bottom-menu {
  238. text-align: center;
  239. height: 54px;
  240. width: 100%;
  241. }
  242. .bottom-menu .el-card__body {
  243. padding-top: 10px;
  244. }
  245. .el-dialog {
  246. min-width: 800px;
  247. }
  248. /* 公共样式 */
  249. .flex {
  250. display: -webkit-box;
  251. display: -webkit-flex;
  252. /* #ifndef APP-NVUE */
  253. display: flex;
  254. /* #endif */
  255. }
  256. .flex-x-center {
  257. display: -webkit-box;
  258. display: -webkit-flex;
  259. /* #ifndef APP-NVUE */
  260. display: flex;
  261. /* #endif */
  262. -webkit-box-pack: center;
  263. -webkit-justify-content: center;
  264. -ms-flex-pack: center;
  265. justify-content: center;
  266. }
  267. .flex-x-between {
  268. display: -webkit-box;
  269. display: -webkit-flex;
  270. /* #ifndef APP-NVUE */
  271. display: flex;
  272. /* #endif */
  273. -webkit-box-pack: space-between;
  274. -webkit-justify-content: space-between;
  275. -ms-flex-pack: space-between;
  276. justify-content: space-between;
  277. }
  278. .flex-y-center {
  279. display: -webkit-box;
  280. display: -webkit-flex;
  281. /* #ifndef APP-NVUE */
  282. display: flex;
  283. /* #endif */
  284. -webkit-box-align: center;
  285. -webkit-align-items: center;
  286. -ms-flex-align: center;
  287. -ms-grid-row-align: center;
  288. align-items: center;
  289. }
  290. /* 溢出隐藏 */
  291. .over1 {
  292. text-overflow: -o-ellipsis-lastline;
  293. overflow: hidden;
  294. text-overflow: ellipsis;
  295. display: -webkit-box;
  296. -webkit-line-clamp: 1;
  297. -webkit-box-orient: vertical;
  298. }
  299. .over2 {
  300. text-overflow: -o-ellipsis-lastline;
  301. overflow: hidden;
  302. text-overflow: ellipsis;
  303. display: -webkit-box;
  304. -webkit-line-clamp: 2;
  305. -webkit-box-orient: vertical;
  306. }
  307. .sava_btn .el-button {
  308. width: 150px;
  309. height: 40px;
  310. border-radius: 5px;
  311. }
  312. .page_msg_box {
  313. padding: 22px 23px;
  314. border-radius: 5px 5px 0 0;
  315. }
  316. </style>
  317. <?php
  318. use common\helpers\ComponentHelper;
  319. ComponentHelper::loadComponentView('com-rich-text');
  320. ?>
  321. <div id="app" v-cloak>
  322. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  323. <div slot="header">
  324. <span>pk设置</span>
  325. </div>
  326. <el-tabs type="border-card">
  327. <el-tab-pane label="基础设置">
  328. <div class="form-body">
  329. <el-form :model="form" label-width="120px" ref="form" size="small" v-loading="loading" :rules="FormRules">
  330. <el-form-item label="PK排行榜开关:" >
  331. <el-switch v-model="form.is_enable" :active-value="1" :inactive-value="0" active-text="开" inactive-text="关">
  332. </el-switch>
  333. </el-form-item>
  334. <el-form-item label="PK聚合页:" >
  335. <el-input placeholder="请输入内容" v-model="form.web_url" style="width: 450px; cursor: pointer" id="urlId">
  336. <el-button slot="append" type="primary" @click.stop="copyFun">复制</el-button>
  337. </el-input>
  338. </el-form-item>
  339. <!-- <el-form-item label="禁止时间" >-->
  340. <!-- <el-input type="number" placeholder="请输入时间" style="width: 300px;margin-right: 20px;" v-model="form.not_allow_apply_hour">-->
  341. <!-- <template slot="append">小时</template>-->
  342. <!-- </el-input>-->
  343. <!-- <div style="color: #999">距离活动结束前几个小时禁止报名</div>-->
  344. <!-- <el-checkbox v-model="form.is_no_restrictions">不限制</el-checkbox>-->
  345. <!-- </el-form-item>-->
  346. <el-form-item label="规则说明" >
  347. <com-rich-text style="width: 750px" :simple-attachment="true" v-model="form.person"></com-rich-text>
  348. </el-form-item>
  349. <el-form-item label="背景图" prop="id_card_reverse">
  350. <div class="id-card">
  351. <com-attachment v-model="form.bg_img" :simple="false">
  352. <div class="card-upload">
  353. <img v-if="form.bg_img"
  354. :src="form.bg_img">
  355. <img v-else :src="diy_img_prefix+'/static/addons/pk/pk_head.jpg'">
  356. <el-button icon="el-icon-plus" circle type="primary" title="建议上传750*100"></el-button>
  357. </div>
  358. </com-attachment>
  359. </div>
  360. </el-form-item>
  361. </el-form>
  362. </div>
  363. <el-button type="primary" class="button-item" size="small" :loading=btnLoading @click="onSubmit">提交</el-button>
  364. </el-tab-pane>
  365. </el-tabs>
  366. </el-card>
  367. </div>
  368. <style>
  369. .el-textarea__inner {
  370. padding: 0 15px;
  371. }
  372. </style>
  373. <script>
  374. const app = new Vue({
  375. el: '#app',
  376. data() {
  377. return {
  378. loading: false,
  379. time: null,
  380. btnLoading: false,
  381. form: {
  382. bg_img: "",
  383. is_enable: 1,
  384. page: '',
  385. type: '',
  386. not_allow_apply_hour: '',
  387. is_no_restrictions: '',
  388. person: '',
  389. },
  390. diy_img_prefix: '<?= Yii::getAlias('@attachurl') ?>',
  391. form1: {},
  392. FormRules: {}
  393. }
  394. },
  395. methods: {
  396. copyFun(){
  397. let url = document.querySelector('#urlId');
  398. url.select(); // 选择对象
  399. document.execCommand("Copy");
  400. this.$message.success('复制成功');
  401. },
  402. onSubmit() {
  403. this.$refs.form.validate((valid) => {
  404. if (valid) {
  405. this.btnLoading = true;
  406. let para = Object.assign(this.form);
  407. console.log(para);
  408. request({
  409. params: {
  410. r: 'pk/setting/index',
  411. },
  412. data: para,
  413. method: 'post'
  414. }).then(e => {
  415. this.btnLoading = false;
  416. if (e.data.code === 0) {
  417. this.$message({
  418. message: e.data.msg,
  419. type: 'success'
  420. });
  421. } else {
  422. this.$message.error(e.data.msg);
  423. }
  424. }).catch(e => {
  425. this.btnLoading = false;
  426. this.$message.error(e.data.msg);
  427. });
  428. }
  429. });
  430. },
  431. getList() {
  432. this.loading = true;
  433. request({
  434. params: {
  435. r: 'pk/setting/index',
  436. },
  437. }).then(e => {
  438. this.loading = false;
  439. if (e.data.code === 0) {
  440. let data = e.data.data
  441. if(e.data.data.length>0|| e.data.data.length == undefined) this.form = e.data.data;
  442. if(this.form.start_at && this.form.end_at) this.$set(this.form, 'open_time', [data.start_at, data.end_at]);
  443. this.form.bg_img = this.form.bg_img?this.form.bg_img : this.diy_img_prefix + '/static/addons/pk/pk_head.jpg';
  444. } else {
  445. this.$message.error(e.data.msg);
  446. }
  447. }).catch(e => {
  448. this.loading = false;
  449. });
  450. },
  451. },
  452. mounted: function () {
  453. this.getList();
  454. }
  455. })
  456. </script>