setPage_article.html 28 KB

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