%%09^092^09291799%%setPage_article.html.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963
  1. <?php /* Smarty version 2.6.17, created on 2018-04-18 10:18:23
  2. compiled from admin/activity/setPage_article.html */ ?>
  3. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  4. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/header.html", 'smarty_include_vars' => array()));
  5. $this->_tpl_vars = $_smarty_tpl_vars;
  6. unset($_smarty_tpl_vars);
  7. ?>
  8. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  9. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/left.html", 'smarty_include_vars' => array()));
  10. $this->_tpl_vars = $_smarty_tpl_vars;
  11. unset($_smarty_tpl_vars);
  12. ?>
  13. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  14. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/nav.html", 'smarty_include_vars' => array()));
  15. $this->_tpl_vars = $_smarty_tpl_vars;
  16. unset($_smarty_tpl_vars);
  17. ?>
  18. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  19. $this->_smarty_include(array('smarty_include_tpl_file' => "get_kindeditor.html", 'smarty_include_vars' => array()));
  20. $this->_tpl_vars = $_smarty_tpl_vars;
  21. unset($_smarty_tpl_vars);
  22. ?>
  23. <script type="text/javascript" src="<?php echo $this->_tpl_vars['web_cfg']['cdn']; ?>
  24. /public/static/js/jquery-1.7.2.min.js"></script>
  25. <link rel="stylesheet" type="text/css" href="<?php echo $this->_tpl_vars['web_cfg']['cdn']; ?>
  26. /public/static/css/swiper.min.css" />
  27. <link rel="stylesheet" type="text/css" href="<?php echo $this->_tpl_vars['web_cfg']['cdn']; ?>
  28. /public/static/css/swiper.animate.min.css" />
  29. <script src="<?php echo $this->_tpl_vars['web_cfg']['cdn']; ?>
  30. /public/static/js/swiper.jquery.min.js"></script>
  31. <script src="<?php echo $this->_tpl_vars['web_cfg']['cdn']; ?>
  32. /public/static/js/swiper.animate.min.js"></script>
  33. <style>
  34. .set-nav {
  35. margin: 0 auto;
  36. }
  37. .set-nav-hr {
  38. background-color: #ddd;
  39. height: 1px;
  40. position: relative;
  41. }
  42. .form-group label {
  43. font-weight: 600;
  44. }
  45. .checkbox-inline, .radio-inline {
  46. font-weight: 400!important;
  47. }
  48. .rowlabel {
  49. font-weight: 300!important;
  50. }
  51. .music_play_hide {
  52. display:none;
  53. }
  54. .create_page_box {
  55. display:none;
  56. position: relative;
  57. }
  58. .create_page_box .panel-heading {
  59. background-color: #fff;
  60. }
  61. .topic_page, .template_page, .edit_page {
  62. width: 320px;
  63. height: 570px;
  64. background-color: #fff;
  65. box-shadow: 0 0 4px #d2d2d2;
  66. position: relative;
  67. margin: 20px auto 0px auto;
  68. }
  69. .topic_page_mask {
  70. }
  71. .template_page {
  72. margin-bottom: 20px;
  73. overflow: hidden;
  74. }
  75. .num_page {
  76. color: #777;
  77. font-size: 20px;
  78. font-weight: bold;
  79. left: 10px;
  80. position: absolute;
  81. top: 10px;
  82. }
  83. .ks-layer {
  84. float: left;
  85. width: 36px;
  86. height: 50px;
  87. border: 1px solid #777;
  88. margin-bottom: 7px;
  89. margin-right: 11px;
  90. position: relative;
  91. cursor: pointer;
  92. }
  93. .ks-layer>div {
  94. background-color: #ccc;
  95. border: 1px solid #777;
  96. display: inline-block;
  97. padding: 10px;
  98. position: absolute;
  99. }
  100. .ks-layer-center>div {
  101. left: 50%;
  102. margin-left: -10px;
  103. margin-top: -10px;
  104. padding-left: 10px;
  105. padding-right: 10px;
  106. top: 50%;
  107. }
  108. .ks-layer-leftup>div {
  109. left: -1px;
  110. top: -1px;
  111. }
  112. .ks-layer-leftdown>div {
  113. bottom: -1px;
  114. left: -1px;
  115. }
  116. .ks-layer-rightup>div {
  117. right: -1px;
  118. top: -1px;
  119. }
  120. .ks-layer-down>div {
  121. bottom: 6%;
  122. left: 50%;
  123. margin-left: -10px;
  124. padding-left: 10px;
  125. padding-right: 10px;
  126. }
  127. .ks-layer-up>div {
  128. left: 50%;
  129. margin-left: -10px;
  130. margin-top: -1px;
  131. padding-left: 10px;
  132. padding-right: 10px;
  133. }
  134. .ks-layer-top>div {
  135. left: 50%;
  136. margin-left: -21px;
  137. padding-left: 20px;
  138. padding-right: 20px;
  139. top: 3px;
  140. }
  141. .ks-layer-bottom>div {
  142. left: 50%;
  143. margin-left: -21px;
  144. padding-left: 20px;
  145. padding-right: 20px;
  146. bottom: 3px;
  147. }
  148. .ks-layer-rightdown>div {
  149. bottom: -1px;
  150. right: -1px;
  151. }
  152. .ks-layer-box label {
  153. display: inline;
  154. margin: 0;
  155. padding: 0;
  156. }
  157. .ks-layer-radio label {
  158. font-size: 9px;
  159. width: 44px;
  160. }
  161. .ks-move-rest {
  162. border: 1px solid #777;
  163. height: 50px;
  164. margin-bottom: 18px;
  165. position: relative;
  166. top: 7px;
  167. width: 50px;
  168. }
  169. .ks-move-rest .black {
  170. background-color: #ccc;
  171. height: 100%;
  172. width: 100%;
  173. }
  174. .ks-move-left {
  175. border: 1px solid #777;
  176. height: 30px;
  177. left: -16px;
  178. margin-bottom: 28px;
  179. margin-top: 10px;
  180. position: relative;
  181. width: 65px;
  182. }
  183. .ks-move-left div {
  184. float: left;
  185. line-height: 28px;
  186. text-align: center;
  187. width: 31px;
  188. }
  189. .ks-move-left .black{
  190. background-color: #ccc;
  191. height: 28px;
  192. width: 32px;
  193. }
  194. .ks-move-top {
  195. border: 1px solid #777;
  196. height: 65px;
  197. width: 30px;
  198. margin-bottom: 5px;
  199. }
  200. .ks-move-top .black {
  201. background-color: #ccc;
  202. height: 32px;
  203. width: 28px;
  204. }
  205. .ks-move-top div {
  206. float: left;
  207. height: 31px;
  208. padding-top: 7px;
  209. text-align: center;
  210. width: 28px;
  211. }
  212. .topic_page a {
  213. color: #666;
  214. display: block;
  215. font-size: 80px;
  216. line-height: 480px;
  217. text-align: center;
  218. text-decoration: none;
  219. }
  220. .topic_page a:hover {
  221. color: #999;
  222. }
  223. #create_page {
  224. position: relative;
  225. top: -35px;
  226. }
  227. .times {
  228. color: #333;
  229. display: block;
  230. font-size: 16px;
  231. position: absolute;
  232. right: 10px;
  233. top: 6px;
  234. z-index: 1;
  235. }
  236. .edit {
  237. background-color: #fff;
  238. color: #777;
  239. font-size: 70px;
  240. height: 100%;
  241. opacity: 0.61;
  242. text-align: center;
  243. width: 100%;
  244. z-index: 10000;
  245. cursor: pointer;
  246. }
  247. .edit i {
  248. line-height: 480px;
  249. }
  250. .topic_button {
  251. z-index: 0;
  252. }
  253. .background_image {
  254. display: block;
  255. overflow: hidden;
  256. width: 100%;
  257. z-index: 0;
  258. position: absolute;
  259. }
  260. .ks-screen{width:220px;height:392px;background-color:#eee;float:left;margin-right:20px;position:relative;overflow:hidden;margin-bottom:20px;}
  261. .swiper-container {width:100%; height:100%; position:absolute;}
  262. .upper_image {position: absolute;}
  263. .button_image {position: absolute;}
  264. #set_screen {background-color: #fff;}
  265. .mask {background-color: #fff;height: 100%;opacity: 0.5;position: absolute;width: 100%;display:none;cursor: move;}
  266. .op {position: absolute;right: 5px;top: 5px;display:none;}
  267. .op div {border:1px solid #666;margin-bottom:5px;color:#666;cursor:pointer;font-family:arial;padding:0 5px;background-color:#fff;}
  268. .op div:hover {color:#000;}
  269. #qrcode {background-color: #fff;box-shadow: 0 0 30px #d2d2d2;color: red;left: 40%; padding: 5px;position: fixed;text-align: center;top: 10%;}
  270. #qrcode img {width: 250px;}
  271. #qrcode .closed {cursor: pointer;font-size: 14px; padding: 0 7px;position: absolute;right: 0;top: 0;}
  272. .ks-dd-dragging {position: relative;}
  273. .radio-inline + .radio-inline, .checkbox-inline + .checkbox-inline {margin-left: 0px;}
  274. .image-layer {background-color: #F1F1F1;padding: 10px;position: relative;margin-bottom:5px;box-shadow:0 0 2px #d2d2d2;}
  275. .image-layer a{display: block;position: absolute;right: 5px;top: 10px;}
  276. .image-layer-set {margin-top: 10px; display:none;}
  277. .js_add_layer {bottom: -20px;position: absolute;}
  278. .create_page_button {text-align:center;color:#999;cursor:pointer;}
  279. .create_page_button:hover {color:#000;}
  280. .create_page_button i {font-size: 30px;position: relative;top: 40%;}
  281. .ks-input-page {background-color:#ccc;}
  282. .ks-topic-bg-image {background-position: 0 0;}
  283. </style>
  284. <div id="activity_container">
  285. <div class="activity_center">
  286. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  287. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_nav.html", 'smarty_include_vars' => array()));
  288. $this->_tpl_vars = $_smarty_tpl_vars;
  289. unset($_smarty_tpl_vars);
  290. ?>
  291. <form id="activity_form">
  292. <input name="events_id" type="hidden" value="<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?>
  293. ">
  294. <div id="screens" class="panel panel-default">
  295. <div class="panel-body">
  296. <?php $_from = $this->_tpl_vars['pageData']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
  297. foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['item']):
  298. ?>
  299. <?php if (! $this->_tpl_vars['item']['input_page']): ?>
  300. <div class="ks-screen ks-screen-p">
  301. <?php if ($this->_tpl_vars['item']['bgimage_url']): ?>
  302. <img class="background_image" style="" src="<?php echo $this->_tpl_vars['item']['bgimage_url']; ?>
  303. " >
  304. <?php endif; ?>
  305. <?php $_from = $this->_tpl_vars['item']['layers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
  306. foreach ($_from as $this->_tpl_vars['layer']):
  307. ?>
  308. <?php if ($this->_tpl_vars['layer']['url']): ?>
  309. <?php if ($this->_tpl_vars['layer']['link']): ?>
  310. <a href="<?php echo $this->_tpl_vars['item']['button_link']; ?>
  311. ">
  312. <?php endif; ?>
  313. <img class="upper_image" style=
  314. "
  315. width:<?php echo $this->_tpl_vars['layer']['width']; ?>
  316. px;
  317. height:<?php echo $this->_tpl_vars['layer']['height']; ?>
  318. px;
  319. <?php echo $this->_tpl_vars['layer']['style']; ?>
  320. "
  321. src="<?php echo $this->_tpl_vars['layer']['url']; ?>
  322. "
  323. >
  324. <?php if ($this->_tpl_vars['layer']['link']): ?>
  325. </a>
  326. <?php endif; ?>
  327. <?php endif; ?>
  328. <?php if ($this->_tpl_vars['layer']['video_url']): ?>
  329. <div class="layer_anim" style="width:<?php echo $this->_tpl_vars['layer']['video_width']; ?>
  330. px;height:<?php echo $this->_tpl_vars['layer']['video_height']; ?>
  331. px;<?php echo $this->_tpl_vars['layer']['style']; ?>
  332. ;background-color:#ccc;color:#fff;font-size:20px;text-align:center;line-height:<?php echo $this->_tpl_vars['layer']['video_height']; ?>
  333. px;" >视频</div>
  334. <?php endif; ?>
  335. <?php endforeach; endif; unset($_from); ?>
  336. <input name="p[]" type="hidden" value='<?php echo $this->_tpl_vars['item']['json']; ?>
  337. ' />
  338. <div class="mask"></div>
  339. <div class="op">
  340. <div class="modify">修改</div>
  341. <div class="delete">删除</div>
  342. </div>
  343. </div>
  344. <?php else: ?>
  345. <div class="ks-screen ks-screen-p ks-input-page">
  346. <div style="position:absolute;top:45%;text-align:center;width:100%;color:#999;">表单页</div>
  347. <input name="p[]" type="hidden" value='<?php echo $this->_tpl_vars['item']['json']; ?>
  348. ' />
  349. <div class="mask"></div>
  350. <div class="op">
  351. <div class="delete">删除</div>
  352. </div>
  353. </div>
  354. <?php endif; ?>
  355. <?php endforeach; endif; unset($_from); ?>
  356. <div id="ks_create_screen" class="ks-screen create_page_button create_topic_page_button">
  357. <i class="fa fa-plus"></i>
  358. </div>
  359. </div>
  360. <div class="clear"></div>
  361. </div>
  362. <a id="save_submit" href="javascript:;" class="button button-3d button-primary button-rounded"><i class="fa fa-refresh fa-spin" style="display:none;"></i> 保存</a>
  363. </form>
  364. <div class="clear"></div>
  365. <div class="create_page_box panel panel-default" style="margin-top: 40px;">
  366. <div class="panel-body">
  367. <div class="num_page">N1</div>
  368. <a href="javascript:;" class="times create_page_closed"> x </a>
  369. <div class="row">
  370. <div class="col-md-6" style="position: sticky; top: 50px;">
  371. <!-- 可视化页面 -->
  372. <div class="template_page"></div>
  373. </div>
  374. <!-- 表单 begin -->
  375. <div class="col-md-6">
  376. <div class="block_15"></div>
  377. <div class="create_page_input_box"></div>
  378. <a href="javascript:;" class="js_add_layer">增加一个图层 +</a>
  379. </div>
  380. <!-- 表单 end -->
  381. </div>
  382. <p></p>
  383. <div style="text-align:center;margin-top:40px;">
  384. <a href="javascript:;" class="create_page_submit button button-primary button-rounded">保存</a>
  385. <a href="javascript:;" class="create_page_closed button button-rounded">取消</a>
  386. </div>
  387. </div>
  388. </div>
  389. </div>
  390. <script>
  391. var tmpPG, tmpPageData = {'layers': {}}, modify_ks_screen;
  392. KISSY.use('node, io, op_dever/topic-page-2, json, event, dom, dd, dd/plugin/scroll, dd/plugin/proxy, xtemplate', function (S, Node, IO, TopicPage, JSON, Event, DOM, DD, Scroll, Proxy, XTemplate) {
  393. var $ = S.all;
  394. var K = KindEditor;
  395. tmpPG = new TopicPage('.template_page');
  396. //创建专题页面
  397. $(".create_topic_page_button").on('click', function () {
  398. create_page_box_show();
  399. var numberPage = $("#screens .ks-screen-p").length;
  400. $(".num_page").text('N' + ++numberPage);
  401. var id = genid();
  402. var data = {'id': id};
  403. var render = getBackgroundInputTpl(data);
  404. $(".create_page_input_box").append(render);
  405. bind_upload(id);
  406. });
  407. //创建表单页面
  408. /*
  409. $(".create_input_page_button").on('click', function () {
  410. if ($(".ks-input-page").length > 0) {
  411. alert('只能创建一个表单页面');
  412. return;
  413. }
  414. var data = '{"input_page":1}';
  415. $('<div class="ks-screen ks-screen-p ks-input-page">\
  416. <div style="position:absolute;top:45%;text-align:center;width:100%;color:#999;">表单页</div>\
  417. <input name="p[]" type="hidden" value=\''+data+'\' />\
  418. <div class="mask"></div>\
  419. <div class="op">\
  420. <div class="delete">删除</div>\
  421. </div>\
  422. </div>\
  423. ').insertBefore($("#ks_create_screen"));
  424. });
  425. */
  426. //增加图层
  427. $(".js_add_layer").on('click', function () {
  428. var id = genid();
  429. var key = $(".create_page_input_box .image-layer").length - 1;
  430. var data = {'id': id, 'key': key};
  431. var render = getLayerInputTpl(data);
  432. $(".create_page_input_box").append(render);
  433. bind_upload(id, key);
  434. });
  435. //关闭创建页面
  436. $(".create_page_closed").on('click', function () {
  437. create_page_box_hide();
  438. });
  439. //显示修改、删除按钮
  440. Event.delegate(document,'mouseenter','.ks-screen-p', function (e) {
  441. $(".mask", $(e.currentTarget)).show();
  442. $(".op", $(e.currentTarget)).show();
  443. });
  444. //隐藏修改、删除按钮
  445. Event.delegate(document,'mouseleave','.ks-screen-p', function (e) {
  446. $(".mask", $(e.currentTarget)).hide();
  447. $(".op", $(e.currentTarget)).hide();
  448. });
  449. //修改页面
  450. Event.delegate(document,'click','.op .modify', function (e) {
  451. var ks_screen_p = $(e.currentTarget).parent().parent();
  452. var numberPage = DOM.index("#screens .ks-screen", ks_screen_p);
  453. $(".num_page").text('N' + ++numberPage);
  454. var data = JSON.parse($('input', ks_screen_p).val());
  455. data.modify_screen = ks_screen_p;
  456. create_page_box_show();
  457. tmpPageData = data;
  458. tmpPG.setData(tmpPageData).render();
  459. //渲染背景表单
  460. var id = genid();
  461. var render = getBackgroundInputTpl({'id': id, 'bgimage_url': tmpPageData.bgimage_url, 'bgimage_isShow': tmpPageData.bgimage_isShow});
  462. $(".create_page_input_box").append(render);
  463. bind_upload(id);
  464. //渲染图层表单
  465. for (var key in tmpPageData.layers) {
  466. var id = genid();
  467. var key = $(".create_page_input_box .image-layer").length - 1;
  468. var data = tmpPageData.layers[key];
  469. data.id = id;
  470. data.key = key;
  471. var render = getLayerInputTpl(data);
  472. $(".create_page_input_box").append(render);
  473. bind_upload(id, key);
  474. }
  475. });
  476. //删除页面
  477. Event.delegate(document,'click','.op .delete', function (e) {
  478. var ks_screen_p = $(e.currentTarget).parent().parent();
  479. ks_screen_p.remove();
  480. });
  481. // 展开图层选项卡
  482. Event.delegate(document,'click','.switch_btn', function (e) {
  483. $(e.currentTarget).parent(2).all('.image-layer-set').toggle();
  484. });
  485. //不显示背景图片
  486. Event.delegate(document,'click','.bgimage_checkbox', function (e) {
  487. var self = $(e.currentTarget);
  488. if (S.isUndefined(self.attr('checked'))) {
  489. tmpPageData.bgimage_isShow = false;
  490. tmpPG.setData(tmpPageData).render();
  491. } else {
  492. tmpPageData.bgimage_isShow = true;
  493. tmpPG.setData(tmpPageData).render();
  494. }
  495. });
  496. //不显示图层
  497. Event.delegate(document,'click','.layer_checkbox', function (e) {
  498. var self = $(e.currentTarget);
  499. var key = $(e.currentTarget).attr('data-key');
  500. if (S.isUndefined(self.attr('checked'))) {
  501. if (S.isUndefined(tmpPageData.layers[key])) {
  502. tmpPageData.layers[key] = {};
  503. }
  504. tmpPageData.layers[key].isShow = false;
  505. tmpPG.setData(tmpPageData).render();
  506. } else {
  507. tmpPageData.layers[key].isShow = true;
  508. tmpPG.setData(tmpPageData).render();
  509. }
  510. });
  511. //布局
  512. Event.delegate(document,'click','.position', function (e) {
  513. var self = $(e.currentTarget);
  514. var key = $(e.currentTarget).attr('data-key');
  515. if (S.isUndefined(tmpPageData.layers[key])) {
  516. tmpPageData.layers[key] = {};
  517. }
  518. tmpPageData.layers[key].position = self.val();
  519. tmpPG.setData(tmpPageData).render();
  520. });
  521. //视频
  522. Event.delegate(document,'focusout','.video_url,.video_width,.video_height', function (e) {
  523. var self = $(e.currentTarget);
  524. var key = $(e.currentTarget).attr('data-key');
  525. if (S.isUndefined(tmpPageData.layers[key])) {
  526. tmpPageData.layers[key] = {};
  527. }
  528. var parent = self.parent(2);
  529. var image_layer = self.parent('.image-layer');
  530. var video_url = parent.all('.video_url').val();
  531. if (!video_url) {
  532. delete tmpPageData.layers[key].video_url;
  533. delete tmpPageData.layers[key].video_width;
  534. delete tmpPageData.layers[key].video_height;
  535. tmpPG.setData(tmpPageData).render();
  536. // 标识下图片图层
  537. image_layer.all('img').show();
  538. image_layer.all('.ke-inline-block').show();
  539. image_layer.all('small').show();
  540. image_layer.all('.span-video').remove();
  541. return ;
  542. }
  543. //清空图片信息
  544. delete tmpPageData.layers[key].url;
  545. delete tmpPageData.layers[key].width;
  546. delete tmpPageData.layers[key].height;
  547. //添加视频信息
  548. tmpPageData.layers[key].video_url = video_url;
  549. tmpPageData.layers[key].video_width = parent.all('.video_width').val();
  550. tmpPageData.layers[key].video_height = parent.all('.video_height').val();
  551. //标识下视频图层
  552. if (image_layer.all('.span-video').length <= 0) {
  553. image_layer.all('img').hide().attr('src', '');
  554. image_layer.all('.ke-inline-block').hide();
  555. image_layer.all('small').hide();
  556. $('<span class="span-video">视频</span>').insertBefore(image_layer.all('img'));
  557. }
  558. tmpPG.setData(tmpPageData).render();
  559. });
  560. //动作
  561. Event.delegate(document,'click','.action', function (e) {
  562. var self = $(e.currentTarget);
  563. var key = $(e.currentTarget).attr('data-key');
  564. if (S.isUndefined(tmpPageData.layers[key])) {
  565. tmpPageData.layers[key] = {};
  566. }
  567. tmpPageData.layers[key].action = self.val();
  568. tmpPG.setData(tmpPageData).render();
  569. });
  570. //链接
  571. Event.delegate(document,'focusout','.link', function (e) {
  572. var self = $(e.currentTarget);
  573. var key = $(e.currentTarget).attr('data-key');
  574. if (S.isUndefined(tmpPageData.layers[key])) {
  575. tmpPageData.layers[key] = {};
  576. }
  577. tmpPageData.layers[key].link = self.val();
  578. tmpPG.setData(tmpPageData).render();
  579. });
  580. //使用表单
  581. Event.delegate(document,'click','.input_btn', function (e) {
  582. var self = $(e.currentTarget);
  583. var key = $(e.currentTarget).attr('data-key');
  584. if (S.isUndefined(tmpPageData.layers[key])) {
  585. tmpPageData.layers[key] = {};
  586. }
  587. if (self.attr('checked')) {
  588. tmpPageData.layers[key].input_btn = 'yes';
  589. } else {
  590. tmpPageData.layers[key].input_btn = 0;
  591. }
  592. tmpPG.setData(tmpPageData).render();
  593. });
  594. /** 提交单页面 **/
  595. $(".create_page_submit").on('click', function () {
  596. var data = tmpPG.getData();
  597. if (S.isEmptyObject(data)) {
  598. alert('请先设置页面内容!');
  599. return false;
  600. }
  601. //修改的页面
  602. var modify_screen = {};
  603. if (!S.isUndefined(data.modify_screen) && !S.isEmptyObject(data.modify_screen)) {
  604. modify_screen = data.modify_screen;
  605. delete data.modify_screen;
  606. }
  607. new IO({
  608. type: "post"
  609. , url: VG.conf.root_domain + '/?c=Admin_Activity_SetPage&a=GetPreviewPage'
  610. , data: {'pageData': JSON.stringify(data)}
  611. , success: function (data) {
  612. if (data.ok) { //ok
  613. var preview_page_html = data.msg;
  614. if (!S.isEmptyObject(modify_screen)) { //修改
  615. modify_screen.replaceWith(preview_page_html);
  616. } else { //创建
  617. $(preview_page_html).insertBefore($("#ks_create_screen"));
  618. }
  619. closed_create_page();
  620. } else {
  621. alert('操作失败,原因:'+data.msg);
  622. }
  623. return false;
  624. }
  625. , error: function (NULL, textStatus) {
  626. alert("请求服务器失败,原因:"+textStatus);
  627. }
  628. , dataType: "json"
  629. });
  630. });
  631. /** 保存 **/
  632. var save_submit_status = false;
  633. function save_submit_active() {
  634. save_submit_status = true;
  635. $("#save_submit").addClass('active').all('i').show();
  636. }
  637. function save_submit_default() {
  638. save_submit_status = false;
  639. $("#save_submit").removeClass('active').all('i').hide();
  640. }
  641. $("#save_submit").on('click', function () {
  642. if (save_submit_status) {
  643. return false;
  644. }
  645. save_submit_active();
  646. var pageData = IO.serialize("#activity_form");
  647. new IO({
  648. type: "post"
  649. , url: VG.conf.root_domain + '/?c=Admin_Activity_SetPage&a=ReqUpCutScreen'
  650. , data: pageData
  651. , success: function (data) {
  652. if (data.ok) { //ok
  653. alert('保存成功');
  654. window.location.reload();
  655. } else {
  656. alert('操作失败,原因:'+data.msg);
  657. save_submit_default();
  658. }
  659. return false;
  660. }
  661. , error: function (NULL, textStatus) {
  662. alert("请求服务器失败,原因:"+textStatus);
  663. save_submit_default();
  664. }
  665. , dataType: "json"
  666. });
  667. });
  668. function closed_create_page() {
  669. create_page_box_hide();
  670. }
  671. // 显示创建页面
  672. function create_page_box_show() {
  673. $('.create_page_box').show().attr('data-status', 'show');
  674. $(".create_page_input_box").empty();
  675. tmpPageData = {'layers': {}};
  676. tmpPG.setData(tmpPageData).render();
  677. $(window).animate({
  678. scrollTop:$(".create_page_box").offset().top
  679. }, 0.3, "easeOut");
  680. }
  681. // 隐藏创建页面
  682. function create_page_box_hide() {
  683. $(".create_page_box").hide().attr('data-status', 'hide');
  684. $(".create_page_input_box").empty();
  685. tmpPageData = {'layers': {}};
  686. tmpPG.setData(tmpPageData).render();
  687. }
  688. // 获取背景表单模板 !!!data中必须要有的字段 id
  689. function getBackgroundInputTpl(data) {
  690. var tpl = $("#background_input_tpl").val();
  691. var render = new XTemplate(tpl).render(data);
  692. return render;
  693. }
  694. // 获取图层表单模板 !!!data中必须要有的字段 id、key
  695. function getLayerInputTpl(data) {
  696. var tpl = $("#layer_input_tpl").val();
  697. var render = new XTemplate(tpl).render(data);
  698. return render;
  699. }
  700. // 生成唯一串
  701. function genid() {
  702. return Math.floor(2147483648 * Math.random()).toString(36);
  703. }
  704. /**
  705. * 绑定上传按钮
  706. * @param string id 选择器唯一标示
  707. * @param int key 图片的key(第几个图层)
  708. */
  709. function bind_upload(id, key) {
  710. var image_checkbox_selector = '.image_'+id+'_checkbox',
  711. image_imgtag_selector = '.image_'+id+'_imgtag',
  712. upload_btn_selector = '.image_'+id+'_upload';
  713. var uploadbutton = K.uploadbutton({
  714. button : K(upload_btn_selector)[0],
  715. fieldName : 'imgFile',
  716. url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image&size=1',
  717. afterUpload : function(data) {
  718. if (data.error === 0) {
  719. $(image_imgtag_selector).attr('src', data.url);
  720. $(image_checkbox_selector).attr('checked', true);
  721. if ($(image_checkbox_selector).attr('data-type') == 'bgimage') {
  722. tmpPageData.bgimage_url = data.url;
  723. } else {
  724. if (S.isUndefined(tmpPageData.layers[key])) {
  725. tmpPageData.layers[key] = {};
  726. }
  727. tmpPageData.layers[key].url = data.url;
  728. tmpPageData.layers[key].width = data.width;
  729. tmpPageData.layers[key].height = data.height;
  730. }
  731. tmpPG.setData(tmpPageData).render();
  732. } else {
  733. alert(data.message);
  734. }
  735. },
  736. afterError : function(str) {
  737. alert('自定义错误信息: ' + str);
  738. }
  739. });
  740. uploadbutton.fileBox.change(function(e) {
  741. uploadbutton.submit();
  742. });
  743. }
  744. /*拖拽产品*/
  745. var DraggableDelegate = DD.DraggableDelegate, //拖拽
  746. DroppableDelegate = DD.DroppableDelegate; //放置
  747. //拖拽节点
  748. var dragDelegate = new DraggableDelegate({
  749. container:"#screens .panel-body",
  750. move: true,
  751. selector:'.ks-screen-p',
  752. plugins: [
  753. new Proxy({
  754. moveOnEnd: false,
  755. destroyOnEnd: true
  756. }),
  757. new Scroll()
  758. ]
  759. });
  760. //放置节点
  761. var dropDelegate = new DroppableDelegate({
  762. container:"#screens .panel-body",
  763. selector:'.ks-screen-p'
  764. });
  765. //在droppable实例上移动时触发
  766. dragDelegate.on("dragover", function (ev) {
  767. var drag = ev.drag;
  768. var drop = ev.drop;
  769. var dragNode = drag.get("dragNode"),
  770. dropNode = drop.get("node");
  771. //横轴中线位置
  772. var middleDropX = (dropNode.offset().left * 2 + dropNode.width()) / 2;
  773. //当前鼠标位置
  774. if (ev.pageX > middleDropX) {
  775. var next = dropNode.next();
  776. if (next && next[0] == dragNode[0]) {
  777. } else {
  778. dragNode.insertAfter(dropNode);
  779. }
  780. } else {
  781. var prev = dropNode.prev();
  782. if (prev && prev[0] == dragNode[0]) {
  783. } else {
  784. dragNode.insertBefore(dropNode);
  785. }
  786. }
  787. });
  788. });
  789. </script>
  790. <!-- 背景表单模板 -->
  791. <textarea id="background_input_tpl" style="display:none;">
  792. <div class="image-layer">
  793. <div class="form-group" style="margin-bottom:0px;">
  794. <input class="image_{{id}}_checkbox bgimage_checkbox" type="checkbox" data-type="bgimage" {{#if isShow!==false}}checked{{/if}} >
  795. <img class="image_{{id}}_imgtag" src="{{bgimage_url}}" style="width:30px;height:20px;background-color:#ccc;">
  796. <input class="image_{{id}}_upload" type="button" value="选择背景图片" />
  797. <small class="text-danger">JPG、PNG,640*1140,小于100k</small>
  798. </div>
  799. </div>
  800. </textarea>
  801. <!-- 图层表单模板 -->
  802. <textarea id="layer_input_tpl" style="display:none;">
  803. <div class="image-layer">
  804. <div class="form-group" style="margin-bottom:0px;">
  805. <input class="image_{{id}}_checkbox layer_checkbox" type="checkbox" data-type="layer" data-key="{{key}}" {{#if isShow!==false}}checked{{/if}} >
  806. {{#if video_url}}
  807. <span class="span-video">视频</span>
  808. {{/if}}
  809. <img class="image_{{id}}_imgtag" src="{{url}}" style="width:30px;height:20px;background-color:#ccc;{{#if video_url}}display:none;{{/if}}">
  810. <input class="image_{{id}}_upload" type="button" value="选择图片" />
  811. <small class="text-danger" {{#if video_url}}style="display:none;"{{/if}}>仅支持PNG透明图片,小于30k</small>
  812. <a class="switch_btn" href="javascript:;">设置</a>
  813. </div>
  814. <div class="image-layer-set">
  815. <div class="form-group"><label class="control-label rowlabel">或填写视频地址:</label>
  816. <div class="form-inline">
  817. <div class="form-group">
  818. <input class="video_url form-control" type="text" style="width:200px;" data-key="{{key}}" value="{{video_url}}" placeholder="填写视频flash地址">
  819. </div>
  820. <div class="form-group">
  821. <input class="video_width form-control" type="text" style="width:57px;" data-key="{{key}}" value="{{#if video_width}}{{video_width}}{{else}}300{{/if}}" placeholder="宽(px)">
  822. </div>
  823. <div class="form-group">
  824. <input class="video_height form-control" type="text" style="width:57px;" data-key="{{key}}" value="{{#if video_height}}{{video_height}}{{else}}250{{/if}}" placeholder="高(px)">
  825. </div>
  826. </div>
  827. </div>
  828. <div class="form-group">
  829. <label class="control-label rowlabel">布局:</label>
  830. <div class="ks-layer-box">
  831. <label for="layer_center_{{id}}"><div class="ks-layer ks-layer-center"><div></div></div></label>
  832. <label for="layer_up_{{id}}"><div class="ks-layer ks-layer-up"><div></div></div></label>
  833. <label for="layer_down_{{id}}"><div class="ks-layer ks-layer-down"><div></div></div></label>
  834. <label for="layer_leftup_{{id}}"><div class="ks-layer ks-layer-leftup"><div></div></div></label>
  835. <label for="layer_leftdown_{{id}}"><div class="ks-layer ks-layer-leftdown"><div></div></div></label>
  836. <label for="layer_rightup_{{id}}"><div class="ks-layer ks-layer-rightup"><div></div></div></label>
  837. <label for="layer_rightbottom_{{id}}"><div class="ks-layer ks-layer-rightdown"><div></div></div></label>
  838. </div>
  839. <div class="ks-layer-radio clear">
  840. <label class="radio-inline">
  841. <input class="position" name="position_{{key}}" type="radio" id="layer_center_{{id}}" value="center" data-key="{{key}}" {{#if position==='center'}}checked{{/if}} > 居中
  842. </label>
  843. <label class="radio-inline">
  844. <input class="position" name="position_{{key}}" type="radio" id="layer_up_{{id}}" value="up" data-key="{{key}}" {{#if position==='up'}}checked{{/if}} > 居上
  845. </label>
  846. <label class="radio-inline">
  847. <input class="position" name="position_{{key}}" type="radio" id="layer_down_{{id}}" value="down" data-key="{{key}}" {{#if position==='down'}}checked{{/if}} > 居下
  848. </label>
  849. <label class="radio-inline">
  850. <input class="position" name="position_{{key}}" type="radio" id="layer_leftup_{{id}}" value="leftup" data-key="{{key}}" {{#if position==='leftup'}}checked{{/if}} > 左上
  851. </label>
  852. <label class="radio-inline">
  853. <input class="position" name="position_{{key}}" type="radio" id="layer_leftdown_{{id}}" value="leftdown" data-key="{{key}}" {{#if position==='leftdown'}}checked{{/if}} > 左下
  854. </label>
  855. <label class="radio-inline">
  856. <input class="position" name="position_{{key}}" type="radio" id="layer_rightup_{{id}}" value="rightup" data-key="{{key}}" {{#if position==='rightup'}}checked{{/if}} > 右上
  857. </label>
  858. <label class="radio-inline">
  859. <input class="position" name="position_{{key}}" type="radio" id="layer_rightbottom_{{id}}" value="rightdown" data-key="{{key}}" {{#if position==='rightdown'}}checked{{/if}} > 右下
  860. </label>
  861. </div>
  862. </div>
  863. <div class="form-group">
  864. <label class="control-label rowlabel">动作:</label>
  865. <div class="ks-action-radio clear" style="font-size:9px;">
  866. <label class="radio-inline">
  867. <div>•</div>
  868. <input name="action_{{key}}" class="action" type="radio" value="rest" data-key="{{key}}" {{#if action==='rest'}}checked{{/if}} > 静止
  869. </label>
  870. <label class="radio-inline">
  871. <div>←</div>
  872. <input name="action_{{key}}" class="action" type="radio" value="left" data-key="{{key}}" {{#if action==='left'}}checked{{/if}} > 水平移动
  873. </label>
  874. <label class="radio-inline">
  875. <div>↑</div>
  876. <input name="action_{{key}}" class="action" type="radio" value="up" data-key="{{key}}" {{#if action==='up'}}checked{{/if}} > 纵向移动
  877. </label>
  878. </div>
  879. </div>
  880. <div class="form-group">
  881. <div class="row">
  882. <div class="col-md-6">
  883. <label class="control-label rowlabel">使用图片链接:</label>
  884. <input class="link form-control" type="text" style="width:300px;" data-key="{{key}}" value="{{link}}">
  885. </div>
  886. </div>
  887. </div>
  888. <div class="form-group">
  889. <div class="checkbox">
  890. <label class="control-label rowlabel">使用表单浮层(使用互动设置中的表单)<input class="input_btn" type="checkbox" data-key="{{key}}" value="yes" {{#if input_btn==='yes'}}checked{{/if}}></label>
  891. </div>
  892. </div>
  893. </div>
  894. </div>
  895. </textarea>
  896. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  897. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_right.html", 'smarty_include_vars' => array()));
  898. $this->_tpl_vars = $_smarty_tpl_vars;
  899. unset($_smarty_tpl_vars);
  900. ?>
  901. <div style="clear:both;"></div>
  902. </div>
  903. <?php $_smarty_tpl_vars = $this->_tpl_vars;
  904. $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/bottom.html", 'smarty_include_vars' => array()));
  905. $this->_tpl_vars = $_smarty_tpl_vars;
  906. unset($_smarty_tpl_vars);
  907. ?>