人人商城

multi.html 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. {template 'common/header'}
  2. {if $do == 'post'}
  3. <ul class="nav nav-tabs">
  4. <li><a href="{php echo url('site/multi/display');}">微站管理</a></li>
  5. {if $do == 'post' && !$id}<li class="active"><a href="{php echo url('multi/post');}">添加微站</a></li>{/if}
  6. {if $do == 'post' && $id}<li class="active"><a href="{php echo url('multi/post', array('id' => $id));}">编辑微站</a></li>{/if}
  7. </ul>
  8. <style>
  9. .template .item{position:relative;display:block;float:left;border:1px #ddd solid;border-radius:5px;background-color:#fff;padding:5px;width:190px;margin:0 20px 20px 0; overflow:hidden;}
  10. .template .title{margin:5px auto;line-height:2em;}
  11. .template .title a{text-decoration:none;}
  12. .template .item img{width:178px;height:270px; cursor:pointer;}
  13. .template .active.item-style img, .template .item-style:hover img{width:178px;height:270px;border:3px #009cd6 solid;padding:1px; }
  14. .template .title .fa{display:none}
  15. .template .active .fa.fa-check{display:inline-block;position:absolute;bottom:33px;right:6px;color:#FFF;background:#009CD6;padding:5px;font-size:14px;border-radius:0 0 6px 0;}
  16. .template .fa.fa-times{cursor:pointer;display:inline-block;position:absolute;top:10px;right:6px;color:#D9534F;background:#ffffff;padding:5px;font-size:14px;text-decoration:none;}
  17. .template .fa.fa-times:hover{color:red;}
  18. .template .item-bg{width:100%; height:342px; background:#000; position:absolute; z-index:1; opacity:0.5; margin:-5px 0 0 -5px;}
  19. .template .item-build-div1{position:absolute; z-index:2; margin:-5px 10px 0 5px; width:168px;}
  20. .template .item-build-div2{text-align:center; line-height:30px; padding-top:150px;}
  21. /*@media screen and (min-width:992px){#ListStyle{width:890px; margin:100px auto;}}*/
  22. </style>
  23. <form class="form-horizontal form" action="" method="post">
  24. <div class="clearfix">
  25. <div class="panel panel-default">
  26. <div class="panel-heading">
  27. 站点信息
  28. </div>
  29. <div class="panel-body">
  30. <div class="form-group">
  31. <label class="col-xs-12 col-sm-3 col-md-2 control-label">微站名称</label>
  32. <div class="col-sm-9 col-xs-12">
  33. <input type="text" name="title" class="form-control" value="{$multi['title']}" />
  34. </div>
  35. </div>
  36. <div class="form-group">
  37. <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否启用</label>
  38. <div class="col-sm-9 col-xs-12">
  39. <label class="radio-inline"><input type="radio" name="status" value="1" {if !$multi['id'] || $multi['status'] == 1}checked{/if}>是</label>
  40. <label class="radio-inline"><input type="radio" name="status" value="0" {if $multi['status'] == 0 && $multi['id']}checked{/if}>否</label>
  41. </div>
  42. </div>
  43. <div class="form-group">
  44. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">选择微站风格</label>
  45. <div class="col-sm-8 col-xs-12">
  46. <button type="button" class="btn btn-success" data-toggle="modal" data-target="#ListStyle">选择风格</button>
  47. <input type="hidden" name="styleid" id="styleid" value="{$multi['styleid']}" />
  48. </div>
  49. </div>
  50. <div class="form-group" id="preview-style" {if empty($multi['style']['tname'])}style="display:none;"{/if}>
  51. <label class="col-xs-12 col-sm-4 col-md-3 col-lg-2 control-label">当前微站风格</label>
  52. <div class="col-sm-8 col-xs-12">
  53. <div class="template">
  54. <div class="item item-style">
  55. <div class="title">
  56. <div style="overflow:hidden; height:28px;" id="current-title">{$multi['style']['name']}</div>
  57. <a href="javascript:;">
  58. <img src="{$_W['siteroot']}app/themes/{$multi['style']['tname']}/preview.jpg" id="current-preview" class="img-rounded">
  59. </a>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <!-- 风格列表 -->
  66. <div class="modal fade bs-example-modal-lg" id="ListStyle" aria-hidden="false" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  67. <div class="modal-dialog modal-lg">
  68. <div class="modal-content">
  69. <div class="modal-header">
  70. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
  71. <h4 class="modal-title">微站模板风格列表</h4>
  72. </div>
  73. <div class="modal-body template clearfix">
  74. {loop $styles $style}
  75. <div class="item item-style {if $multi['styleid'] == $style['id']} active {/if}">
  76. <div class="title">
  77. <div class="title-{$style['id']}" style="overflow:hidden; height:28px;">{$style['name']}</div>
  78. <a href="javascript:;" class="change-style" data-styleid="{$style['id']}">
  79. <img src="{$_W['siteroot']}app/themes/{$style['tname']}/preview.jpg" class="img-rounded preview-{$style['id']}">
  80. </a>
  81. <span class="fa fa-check"></span>
  82. </div>
  83. <div class="btn-group btn-group-justified">
  84. <a href="javascript:;" class="btn btn-default btn-xs change-style" data-styleid="{$style['id']}">选择风格</a>
  85. </div>
  86. </div>
  87. {/loop}
  88. </div>
  89. <div class="modal-footer">
  90. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="form-group">
  96. <label class="col-xs-12 col-sm-3 col-md-2 control-label">触发关键字</label>
  97. <div class="col-sm-9 col-xs-12">
  98. <input type="text" name="keyword" class="form-control" value="{$multi['site_info']['keyword']}" />
  99. <div class="help-block">用户触发关键字,系统回复此页面的图文链接</div>
  100. </div>
  101. </div>
  102. <div class="form-group">
  103. <label class="col-xs-12 col-sm-3 col-md-2 control-label">封面</label>
  104. <div class="col-sm-9 col-xs-12">
  105. {php echo tpl_form_field_image('thumb', $multi['site_info']['thumb'])}
  106. <div class="help-block">用于用户触发关键字后,系统回复时的封面图片</div>
  107. </div>
  108. </div>
  109. <div class="form-group">
  110. <label class="col-xs-12 col-sm-3 col-md-2 control-label">页面描述</label>
  111. <div class="col-sm-9 col-xs-12">
  112. <input type="text" name="description" class="form-control" value="{$multi['site_info']['description']}" />
  113. <div class="help-block">用户通过微信分享给朋友时,会自动显示页面描述</div>
  114. </div>
  115. </div>
  116. <div class="form-group">
  117. <label class="col-xs-12 col-sm-3 col-md-2 control-label">绑定域名</label>
  118. <div class="col-sm-9 col-xs-12">
  119. <input type="text" name="bindhost" class="form-control" value="{$multi['bindhost']}" />
  120. <span class="help-block">绑定时请先将域名解析指向到本服务器,请只填写host部分,不允许为当前系统域名。例如:www.baidu.com</span>
  121. </div>
  122. </div>
  123. <div class="form-group">
  124. <label class="col-xs-12 col-sm-3 col-md-2 control-label">底部自定义</label>
  125. <div class="col-sm-9 col-xs-12">
  126. <textarea style="height:150px;" class="form-control" cols="70" name="footer" autocomplete="off">{$multi['site_info']['footer']}</textarea>
  127. <span class="help-block">自定义底部信息,支持HTML</span>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <div class="form-group">
  133. <div class="col-sm-12">
  134. <input name="submit" type="submit" value="提交" class="btn btn-primary col-lg-1" />
  135. <input type="hidden" name="token" value="{$_W['token']}" />
  136. </div>
  137. </div>
  138. </div>
  139. </form>
  140. <script type="text/javascript">
  141. $('.change-style').click(function() {
  142. var styleId = parseInt($(this).data('styleid'));
  143. var title = $('.title-' + styleId).text();
  144. var preview = $('.preview-' + styleId).attr('src');
  145. $('.item-style').removeClass('active');
  146. $('#styleid').val(styleId);
  147. $('#current-title').text(title);
  148. $('#current-preview').attr('src', preview);
  149. $(this).parent().parent().addClass('active');
  150. $('#preview-style').show();
  151. $('#ListStyle').modal('hide');
  152. });
  153. </script>
  154. {elseif $do == 'display'}
  155. <ul class="nav nav-tabs">
  156. <li class="active"><a href="{php echo url('site/multi/display');}">微站管理</a></li>
  157. <li><a href="{php echo url('site/multi/post')}">添加微站</a></li>
  158. </ul>
  159. <div class="clearfix template">
  160. <div class="panel panel-default">
  161. <div class="panel-heading">
  162. 可用的微站
  163. </div>
  164. <div class="table-responsive panel-body">
  165. <table class="table table-hover">
  166. <thead class="navbar-inner">
  167. <tr>
  168. <th>微站名称</th>
  169. <th style="width:100px;">关键字</th>
  170. <th style="width:200px;">风格</th>
  171. <th style="width:200px;">模板</th>
  172. <th class="manage-menu" style="width:420px">操作</th>
  173. </tr>
  174. </thead>
  175. <tbody>
  176. {loop $multis $item}
  177. <tr>
  178. <td style="vertical-align:middle;">{$item['title']}{if $default_site == $item['id']}<span class="label label-success">默认微站</span>{/if}</td>
  179. <td>{$item['site_info']['keyword']}</td>
  180. <td style="vertical-align:middle;">
  181. {if $item['styleid']}{$item['style']['name']}{else}<span class="label label-danger">未设置</span>{/if}
  182. </td>
  183. <td>app/themes/{$item['template']['name']}</td>
  184. <td class="manage-menu" style="position:relative;">
  185. <a href="{php echo url('site/multi/post', array('multiid' => $item['id']))}">编辑</a>
  186. <a href="{php echo url('site/slide/display', array('multiid' => $item['id']))}">幻灯片</a>
  187. <a href="{php echo url('site/nav/home', array('multiid' => $item['id'], 'f' => 'multi'))}">导航菜单</a>
  188. <a href="{php echo url('site/editor/quickmenu', array('multiid' => $item['id'], 'type' => '2'))}">快捷菜单</a>
  189. <span><a class="js-clip" href="javascript:;" data-url="{php echo murl('home', array('t' => $item['id']), true, true)}">复制链接</a></span>
  190. <a href="{php echo url('site/multi/copy', array('multiid' => $item['id']))}">复制站点</a>
  191. <a href="javascript:;" onclick="preview('{$item['styleid']}', '{$item['id']}');return false;">预览</a>
  192. {if $default_site != $item['id']}<a href="{php echo url('site/multi/del', array('id' => $item['id']))}" onclick="if(!confirm('删除后将不可恢复,确定删除吗?')) return false;">删除</a>{/if}
  193. </td>
  194. </tr>
  195. {/loop}
  196. </tbody>
  197. </table>
  198. </div>
  199. </div>
  200. </div>
  201. <style>
  202. .template .dropdown{display:inline-block; cursor:pointer;}
  203. .template i{display:inline-block; width:15px; height:15px; font-size:15px; }
  204. .template .js-dropdown-menu span{display:inline-block; height:34px; line-height:34px; width:60px; text-align:center;}
  205. .template .dropdown-menu{margin:0;}
  206. .template .dropdown-menu i{width:20px; margin-right:10px; text-align:center;}
  207. </style>
  208. <script type="text/javascript">
  209. $(function(){
  210. $('.js-dropdown-menu').unbind('click');
  211. $('.js-dropdown-menu span').hover(function(){
  212. $(this).parent().addClass('open').find('.dropdown-menu').show();
  213. $(this).parent().find('.dropdown-menu').hover(function(){$(this).show();$(this).parent().addClass('open')},function(){$(this).hide();$(this).parent().removeClass('open');});
  214. },function(){
  215. $(this).parent().removeClass('open').find('.dropdown-menu').hide();
  216. });
  217. });
  218. function preview(styleid, $multiid) {
  219. var content = '<iframe width="320" scrolling="yes" height="480" frameborder="0" src="about:blank"></iframe>';
  220. var footer =
  221. '<a href="{url 'site/style/designer'}styleid=' + styleid + '" class="btn btn-primary">设计风格</a>' +
  222. '<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>';
  223. var dialog = util.dialog('预览模板', content, footer);
  224. dialog.find('iframe').on('load', function(){
  225. $('a', this.contentWindow.document.body).each(function(){
  226. var href = $(this).attr('href');
  227. if(href && href[0] != '#') {
  228. var arr = href.split(/#/g);
  229. var url = arr[0];
  230. if (url.substr(0, 3) == 'www') {
  231. url = 'http://' + url;
  232. }
  233. if(arr[1]) {
  234. url += ('#' + arr[1]);
  235. }
  236. if (url.substr(0, 10) == 'javascript') {
  237. url = url.substr(0, url.lastIndexOf('&'));
  238. }
  239. $(this).attr('href', url);
  240. }
  241. });
  242. });
  243. var url = '../app/{php echo murl('home')}&s=' + styleid + '&t=' + $multiid;
  244. dialog.find('iframe').attr('src', url);
  245. dialog.find('.modal-dialog').css({'width': '322px'});
  246. dialog.find('.modal-body').css({'padding': '0', 'height': '480px'});
  247. dialog.modal('show');
  248. }
  249. </script>
  250. {/if}
  251. {template 'common/footer'}