poster_background.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_W['attachurl_remote']}',
  31. 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie' : {'pre': ''},
  33. 'account' : {:json_encode($_W['account'])},
  34. };
  35. </script>
  36. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  37. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  38. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  39. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  40. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  41. <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  42. <script type="text/javascript" src="./resource/components/colpick/colpick.js"></script>
  43. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  44. <link href="/static/css/snailfish.css" rel="stylesheet">
  45. <link href="./resource/components/colpick/colpick.css" rel="stylesheet">
  46. <style>
  47. .layadmin-name {background-color: #009688;color: #fff;width: 90px;text-align: center;height: 22px;margin-bottom:2px;}
  48. a {color: #333;text-decoration: none;cursor: pointer;}
  49. a:hover{color: #333;text-decoration: none;}
  50. a:active{color: #333;text-decoration: none;}
  51. a:focus {color:#999;text-decoration: none;}
  52. .half {width: 50%;float: left;font-size: 15px;}
  53. .back_pimu{width: 300px;text-align: center;margin: 0 auto;}
  54. .back_pimu img{width: 100%;}
  55. .resetBtn{color: #3276b1;}
  56. a.resetBtn:hover{color: #3276b1;}
  57. </style>
  58. </head>
  59. <body layadmin-themealias="default">
  60. <div class="layui-fluid" style="min-width: 1000px;">
  61. <div class="layui-card">
  62. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">邀新海报</span></div>
  63. <div class="layui-card-body" style="padding:15px;">
  64. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  65. <ul class="layui-tab-title">
  66. <li class="layui-this">背景</li>
  67. <li><a href="{:U('invitegift/poster_qrcode')}">二维码</a></li>
  68. </ul>
  69. <div class="layui-tba-content" style="height: 100%;">
  70. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data">
  71. <div class="layui-form-item" style="height: 750px;">
  72. <div class="half" style="background: #f1f1f1;padding: 5px;height: auto;min-height: 100%;">
  73. <div class="back_pimu" style="position: relative;background: #fff;width: 375px;height: auto;min-height: 100%;">
  74. <div class="phone_top" style="position: relative;width: 375px;height: 64px;">
  75. <img class="img" src="/static/images/diy/poster_1.png" style="width: 375px;height: 20px;position: absolute;top: 0px;left: 0px;z-index: 100;">
  76. <img class="img" src="/static/images/diy/poster_2.png" style="position: absolute;right: 7px;width: 87px;height: 32px;bottom: 6px;">
  77. </div>
  78. <div class="back_body" style="width:375px;height: 667px;<?php if($data['invite_poster_back_type'] == 0){?>background: <?php echo $data['invite_poster_back_color'];?>;<?php }else{ ?>background: url('<?php echo tomedia($data['invite_poster_back_img']);?>') no-repeat;background-size:100% 100%;<?php } ?>"></div>
  79. </div>
  80. </div>
  81. <div class="half">
  82. <div class="layui-form-item">
  83. <label class="layui-form-label">背景</label>
  84. <div class="layui-input-block">
  85. <label class='radio-inline'>
  86. <input type='radio' name='invite_poster_back_type' lay-filter="invite_poster_back_type" value='0' <?php if( !isset($data['invite_poster_back_type']) || $data['invite_poster_back_type'] == 0){ ?>checked<?php } ?> title="纯色背景" />
  87. </label>
  88. <label class='radio-inline'>
  89. <input type='radio' name='invite_poster_back_type' lay-filter="invite_poster_back_type" value='1' <?php if( isset($data['invite_poster_back_type']) && $data['invite_poster_back_type'] == 1){ ?>checked<?php } ?> title="背景图片" />
  90. </label>
  91. </div>
  92. </div>
  93. <div class="layui-form-item" id="invite_poster_back_type_0" <?php if( !isset($data['invite_poster_back_type']) || $data['invite_poster_back_type'] == 0){ ?>style="display:block"<?php }else{ ?>style="display:none"<?php } ?>>
  94. <label class="layui-form-label">背景颜色</label>
  95. <div class="layui-input-block">
  96. <div class="layui-input-inline" style="width: 120px;">
  97. <input type="text" name="invite_poster_back_color" value="{$data['invite_poster_back_color'] }" placeholder="请选择颜色" class="layui-input" id="invite_poster_back_color-input">
  98. </div>
  99. <div class="layui-inline" style="left: -11px;margin-right: 0px;">
  100. <div id="invitePosterBackColors" class="layui-inline">
  101. <div class="layui-unselect layui-colorpicker"><span><span class="layui-colorpicker-trigger-span" lay-type="" style="background: {$data['invite_poster_back_color']}"><i class="layui-icon layui-colorpicker-trigger-i layui-icon-down"></i></span></span></div>
  102. </div>
  103. </div>
  104. <div class="layui-inline" style="vertical-align:top;line-height: 35px;margin-right: 0px;">
  105. <a class="resetBtn resetBackColor">重置</a>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="layui-form-item" id="invite_poster_back_type_1" <?php if( isset($data['invite_poster_back_type']) && $data['invite_poster_back_type'] == 1){ ?>style="display:block"<?php }else{ ?>style="display:none"<?php } ?>>
  110. <label class="layui-form-label">背景图片</label>
  111. <div class="layui-input-block">
  112. {:tpl_form_field_image2('invite_poster_back_img', $data['invite_poster_back_img'])}
  113. <span class='layui-form-mid layui-word-aux'>建议图片尺寸为750x1334,比例为9:16</span>
  114. </div>
  115. </div>
  116. <div class="layui-form-item">
  117. <label class="layui-form-label"> </label>
  118. <div class="layui-input-block">
  119. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  120. </div>
  121. </div>
  122. </div>
  123. </form>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. <script src="/layuiadmin/layui/layui.js"></script>
  130. <script>
  131. layui.config({
  132. base: '/layuiadmin/' //静态资源所在路径
  133. }).extend({
  134. index: 'lib/index' //主入口模块
  135. }).use('index');
  136. </script>
  137. <script>
  138. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  139. var layer = layui.layer;
  140. var $;
  141. var cur_open_div;
  142. layui.use(['jquery', 'layer','form','colorpicker'], function(){
  143. $ = layui.$;
  144. var form = layui.form;
  145. var colorpicker = layui.colorpicker;
  146. form.on('radio(invite_poster_back_type)',function(data){
  147. if(data.value == 1){
  148. $('#invite_poster_back_type_1').show();
  149. $('#invite_poster_back_type_0').hide();
  150. var back_img = $('#invite_poster_back_type_1').find('.img-thumbnail').attr('src');
  151. $('.back_body').css('background', "url('"+back_img+"') no-repeat");
  152. $('.back_body').css('background-size', "100% 100%");
  153. }else if(data.value == 0){
  154. $('#invite_poster_back_type_1').hide();
  155. $('#invite_poster_back_type_0').show();
  156. var back_color = $('input[name="invite_poster_back_color"]').val();
  157. $('.back_body').css('background', back_color);
  158. }
  159. });
  160. //监听提交
  161. form.on('submit(formDemo)', function(data){
  162. $.ajax({
  163. url: data.form.action,
  164. type: data.form.method,
  165. data: data.field,
  166. dataType:'json',
  167. success: function (info) {
  168. if(info.status == 0)
  169. {
  170. layer.msg(info.result.message,{icon: 1,time: 2000});
  171. }else if(info.status == 1){
  172. var go_url = location.href;
  173. if( info.result.hasOwnProperty("url") )
  174. {
  175. go_url = info.result.url;
  176. }
  177. layer.msg('操作成功',{time: 1000,
  178. end:function(){
  179. location.href = info.result.url;
  180. }
  181. });
  182. }
  183. }
  184. });
  185. return false;
  186. });
  187. })
  188. var default_color = "#ffffff";
  189. var invite_poster_back_color = "{ $data['invite_poster_back_color'] }";
  190. $('#invitePosterBackColors').colpick({
  191. submit:true,
  192. color: invite_poster_back_color,
  193. onSubmit: function(color,color2){
  194. $('#invite_poster_back_color-input').val('#'+color2);
  195. $('#invitePosterBackColors').find('.layui-colorpicker-trigger-span').css('background','#'+color2);
  196. $('.colpick_full').hide();
  197. $('.back_body').css('background-color', '#'+color2);
  198. }
  199. });
  200. $('input[name="invite_poster_back_img"]').on('input propertychange',function(e){
  201. alert('Changed!');
  202. })
  203. $('.resetBackColor').click(function(){
  204. $('#invite_poster_back_color-input').val(default_color);
  205. $('#invitePosterBackColors').find('.layui-colorpicker-trigger-span').css('background',default_color);
  206. $('.colpick_full').hide();
  207. $('.back_body').css('background-color', default_color);
  208. });
  209. </script>
  210. </body>