人人商城

style.html 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. {template 'common/header'}
  2. {if $do != 'module'}
  3. <ul class="nav nav-tabs">
  4. {if $do == 'styles'}<li class="active"><a href="{php echo url('site/style/styles');}">风格管理</a></li>{/if}
  5. {if $do == 'template'}<li class="active"><a href="{php echo url('site/style/template');}">模板管理</a></li>{/if}
  6. {if $do == 'designer'}<li class="active"><a href="{php echo url('site/style/designer', array('styleid' => $_GPC['styleid']))}">设计风格</a></li>{/if}
  7. </ul>
  8. {/if}
  9. {if $do == 'module'}
  10. <div class="panel panel-default">
  11. <div class="panel-heading">覆盖模块模板HTML或是内容时,需要在当前风格目录即“app/themes/{$currentTemplate}”下,新建同名模板,即可修改此模块模板内容。</div>
  12. <div class="table-responsive panel-body">
  13. <table class="table">
  14. <thead>
  15. <tr>
  16. <th style="width:40%">源文件</th>
  17. <th style="width:40%">覆盖文件</th>
  18. <th style="width:20%"></th>
  19. </tr>
  20. </thead>
  21. {loop $templates $name $item}
  22. <tr class="active"><td colspan='3'>{$modules[$name]['title']}</td></tr>
  23. {loop $item $file}
  24. {php $targetfile = 'app/themes/' . $currentTemplate . '/' .$name.'/'.$file;}
  25. <tr>
  26. <td>/addons/{$name}/template/mobile/{$file}</td>
  27. <td style="{if file_exists(IA_ROOT . '/' .$targetfile)}color:green{else}color:red{/if}" >{$targetfile}</td>
  28. <td><a href="javascript:;" onclick="createtemplate('{$name}', '{$file}')">生成重定义模板</a></td>
  29. </tr>
  30. {/loop}
  31. {/loop}
  32. </table>
  33. </div>
  34. </div>
  35. <script type="text/javascript">
  36. function createtemplate(name, file) {
  37. if (file && confirm('此操作辅助生成您需要重定义的模板空文件,你也可以在文件目录中手动添加或是修改些文件,是否确定要生成吗?')) {
  38. $.post("{url 'site/style/createtemplate'}" + 'name=' + name + '&file=' + file).success(function(){
  39. location.reload();
  40. });
  41. }
  42. }
  43. </script>
  44. {/if}
  45. {if $do == 'designer'}
  46. <div class="clearfix">
  47. <form id="form" class="form-horizontal form" action="" method="post">
  48. <input type="hidden" name="styleid" value="{$styleid}">
  49. <div class="panel panel-default">
  50. <div class="panel-heading">微站风格</div>
  51. <div class="panel-body">
  52. <div class="form-group">
  53. <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">风格名称</label>
  54. <div class="col-sm-9 col-xs-12">
  55. <input type="text" class="form-control" name="name" value="{$style['name']}">
  56. </div>
  57. </div>
  58. <div class="form-group">
  59. <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">模板路径</label>
  60. <div class="col-sm-9 col-xs-12">
  61. <input type="text" class="form-control" disabled value="./app/themes/{$template['name']}">
  62. </div>
  63. </div>
  64. <div class="form-group">
  65. <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">基础图片目录[imgdir]</label>
  66. <div class="col-sm-9 col-xs-12">
  67. <input type="text" class="form-control" name="style[imgdir]" value="{$styles['imgdir']['content']}" />
  68. <span class="help-block">风格基础图片存放的目录,如果为空则默认为./app/themes/{$template['name']}/images目录</span>
  69. </div>
  70. </div>
  71. <div class="form-group">
  72. <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">首页背景 [indexbgcolor] [indexbgextra] [indexbgimg]</label>
  73. <div class="col-sm-9 col-xs-12">
  74. {php echo tpl_form_field_color('style[indexbgcolor]', $styles['indexbgcolor']['content'])}
  75. <span class="help-block">背景颜色 [indexbgcolor]</span>
  76. <input class="form-control" type="text" name="style[indexbgextra]" value="{$styles['indexbgextra']['content']}" placeholder="">
  77. <span class="help-block">附加属性 [indexbgextra]</span>
  78. {php echo tpl_form_field_image('style[indexbgimg]', $styles['indexbgimg']['content'])}
  79. <span class="help-block">背景图 [indexbgimg]</span>
  80. </div>
  81. </div>
  82. <div class="form-group">
  83. <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">正常字体[fontfamily]</label>
  84. <div class="col-sm-9 col-xs-12">
  85. <input type="text" class="form-control" name="style[fontfamily]" value="{$styles['fontfamily']['content']}" />
  86. <span class="help-block"></span>
  87. </div>
  88. </div>
  89. <div class="form-group">
  90. <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">正常字体大小[fontsize]</label>
  91. <div class="col-sm-9 col-xs-12">
  92. <input type="text" class="form-control" name="style[fontsize]" value="{$styles['fontsize']['content']}" />
  93. <span class="help-block"></span>
  94. </div>
  95. </div>
  96. <div class="form-group">
  97. <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">普通文本颜色[fontcolor]</label>
  98. <div class="col-sm-9 col-xs-12">
  99. {php echo tpl_form_field_color('style[fontcolor]', $styles['fontcolor']['content'])}
  100. </div>
  101. </div>
  102. <div class="form-group">
  103. <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">菜单文本颜色[fontnavcolor]</label>
  104. <div class="col-sm-9 col-xs-12">
  105. {php echo tpl_form_field_color('style[fontnavcolor]', $styles['fontnavcolor']['content'])}
  106. </div>
  107. </div>
  108. <div class="form-group">
  109. <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">链接文字颜色[linkcolor]</label>
  110. <div class="col-sm-9 col-xs-12">
  111. {php echo tpl_form_field_color('style[linkcolor]', $styles['linkcolor']['content'])}
  112. </div>
  113. </div>
  114. <div class="form-group">
  115. <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">扩展CSS</label>
  116. <div class="col-sm-9 col-xs-12">
  117. <textarea name="style[css]" class="form-control" cols="120" rows="16">{$styles['css']['content']}</textarea>
  118. <span class="help-block">附加一些CSS样式</span>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. <div class="panel panel-default">
  124. <div class="panel-heading">自定义属性</div>
  125. <div class="panel-body">
  126. <div class="alert alert-danger">
  127. (说明:变量名用于设置不同的变量,只能是字母数字组成.变量描述可方便用户识别对应变量的作用,不能为空)<br>
  128. (注意:这里定义的变量,变量值不能为空,否则将视为无效)
  129. </div>
  130. <div id="customForm">
  131. {loop $styles $style}
  132. {if !in_array($style['variable'], $systemtags)}
  133. <div class="form-group">
  134. <div class="col-sm-10">
  135. <div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
  136. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  137. <span class="input-group-addon">变量名</span>
  138. <input class="form-control" name="custom[name][]" value="{$style['variable']}" type="text" placeholder="请输入配置变量">
  139. </div>
  140. </div>
  141. <div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
  142. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  143. <span class="input-group-addon">变量描述</span>
  144. <input class="form-control" name="custom[desc][]" value="{$style['description']}" type="text" placeholder="请输入变量描述">
  145. </div>
  146. </div>
  147. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
  148. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  149. <span class="input-group-addon">值</span>
  150. <input class="form-control" name="custom[value][]" value="{$style['content']}" type="text" placeholder="请输入配置值">
  151. </div>
  152. </div>
  153. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-1">
  154. <label class="checkbox-inline">
  155. <a href="javascript:;" onclick="deleteOption(this)" class="fa fa-times-circle" title="删除此操作"></a>
  156. </label>
  157. </div>
  158. </div>
  159. </div>
  160. {/if}
  161. {/loop}
  162. </div>
  163. <a href="javascript:;" onclick="addFormItem()"><i class="fa fa-plus-square"></i> 添加新变量</a>
  164. </div>
  165. </div>
  166. <div class="form-group">
  167. <div class="col-sm-12">
  168. <input name="token" type="hidden" value="{$_W['token']}" />
  169. <input type="submit" class="btn btn-primary col-lg-1" name="submit" id="submit" value="提交" />
  170. </div>
  171. </div>
  172. </form>
  173. </div>
  174. <script type="text/html" id="item-form-html">
  175. <div class="form-group">
  176. <div class="col-sm-10">
  177. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
  178. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  179. <span class="input-group-addon">变量名</span>
  180. <input class="form-control" name="custom[name][]" type="text" placeholder="请输入配置变量">
  181. </div>
  182. </div>
  183. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
  184. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  185. <span class="input-group-addon">变量描述</span>
  186. <input class="form-control" name="custom[desc][]" type="text" placeholder="请输入变量描述">
  187. </div>
  188. </div>
  189. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
  190. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  191. <span class="input-group-addon">值</span>
  192. <input class="form-control" name="custom[value][]" type="text" placeholder="请输入配置值">
  193. </div>
  194. </div>
  195. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-1">
  196. <label class="checkbox-inline">
  197. <a href="javascript:;" onclick="deleteOption(this)" class="fa fa-times-circle" title="删除此操作"></a>
  198. </label>
  199. </div>
  200. </div>
  201. </div>
  202. </script>
  203. <script type="text/javascript">
  204. function addFormItem() {
  205. $('#customForm').append($('#item-form-html').html());
  206. }
  207. function deleteOption(o) {
  208. $(o).parent().parent().parent().parent().remove();
  209. }
  210. </script>
  211. {/if}
  212. {if $do == 'template'}
  213. <style>
  214. .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;}
  215. .template .title{margin:5px auto;line-height:2em;}
  216. .template .title a{text-decoration:none;}
  217. .template .item img{width:178px;height:270px; cursor:pointer;}
  218. .template .active.item-style img, .template .item-style:hover img{width:178px;height:270px;border:3px #009cd6 solid;padding:1px; }
  219. .template .title .fa{display:none}
  220. .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;}
  221. .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;}
  222. .template .fa.fa-times:hover{color:red;}
  223. .template .item-bg{width:100%; height:342px; background:#000; position:absolute; z-index:1; opacity:0.5; margin:-5px 0 0 -5px;}
  224. .template .item-build-div1{position:absolute; z-index:2; margin:-5px 10px 0 5px; width:168px;}
  225. .template .item-build-div2{text-align:center; line-height:30px; padding-top:150px;}
  226. </style>
  227. <div class="clearfix template">
  228. <div class="panel panel-default">
  229. <nav role="navigation" class="navbar navbar-default navbar-static-top" style="margin-bottom:0;">
  230. <div class="container-fluid">
  231. <div class="navbar-header">
  232. <a href="javascript:;" class="navbar-brand">微站风格类型</a>
  233. </div>
  234. <ul class="nav navbar-nav nav-btns">
  235. <li {if empty($_GPC['type']) || $_GPC['type'] == 'all'} class="active" {/if}>
  236. <a href="{php echo url('site/style/template', array('type' => 'all'));}">全部</a>
  237. </li>
  238. {loop $temtypes $type}
  239. <li {if $_GPC['type'] == $type['name']} class="active" {/if}>
  240. <a href="{php echo url('site/style/template', array('type' => $type['name']));}">{$type['title']}</a>
  241. </li>
  242. {/loop}
  243. </ul>
  244. </div>
  245. </nav>
  246. <div class="panel-body">
  247. {loop $stylesResult $item}
  248. {if !empty($item['styleid'])}
  249. <div class="item item-style{if $setting['styleid'] == $item['styleid']} active{/if}">
  250. <a class="fa fa-times" onclick="if(!confirm('删除后将不可恢复,确定删除吗?')) return false;" title="删除风格" href="{php echo url('site/style/del', array('styleid' => $item['styleid']))}"></a>
  251. <div class="title">
  252. <div style="overflow:hidden; height:28px;">{$item['title']} ({$item['name']})</div>
  253. <a href="{php echo url('site/style/default', array('styleid' => $item['styleid']))}">
  254. <img src="../app/themes/{$item['name']}/preview.jpg" class="img-rounded" />
  255. </a>
  256. <span class="fa fa-check"></span>
  257. </div>
  258. <div class="btn-group btn-group-justified">
  259. <a href="{php echo url('site/style/designer', array('styleid' => $item['styleid']))}" class="btn btn-default btn-xs">设计风格</a>
  260. <a href="{php echo url('site/style/copy', array('styleid' => $item['styleid']))}" class="btn btn-default btn-xs">复制风格</a>
  261. <a href="javascript:;" onclick="preview('{$item['styleid']}');return false;" class="btn btn-default btn-xs">预览</a>
  262. </div>
  263. </div>
  264. {else}
  265. <div class="item" style="border-color:#FFF;">
  266. <div class="item-bg"></div>
  267. <div class="item-build-div1">
  268. <div class="item-build-div2">
  269. <a href="{php echo url('site/style/build', array('templateid' => $item['templateid']))}" class="btn btn-warning item-build-btn" role="button" data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="该模板尚未激活,激活后可正常使用!">点击激活</a>
  270. </div>
  271. </div>
  272. <div class="title">
  273. <div style="overflow:hidden; height:28px;">{$item['title']}</div>
  274. <img src="../app/themes/{$item['name']}/preview.jpg" class="img-rounded" />
  275. </div>
  276. <div class="btn-group btn-group-justified">
  277. <a href="#" class="btn btn-default btn-xs">设计风格</a>
  278. <a href="#" class="btn btn-default btn-xs">复制风格</a>
  279. <a href="#" class="btn btn-default btn-xs">预览</a>
  280. </div>
  281. </div>
  282. {/if}
  283. {/loop}
  284. </div>
  285. </div>
  286. </div>
  287. <script type="text/javascript">
  288. require(['bootstrap'],function($){
  289. $('.item .item-build-btn').popover();
  290. });
  291. //预览风格时,预览的是默认微站的导航链接和快捷操作
  292. function preview(styleid) {
  293. var content = '<iframe width="320" scrolling="yes" height="480" frameborder="0" src="about:blank"></iframe>';
  294. var footer =
  295. ' <a href="{url 'site/style/default'}styleid=' + styleid + '" class="btn btn-primary">设为默认模板</a>' +
  296. ' <a href="{url 'site/style/designer'}styleid=' + styleid + '" class="btn btn-primary">设计风格</a>' +
  297. ' <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>';
  298. var dialog = util.dialog('预览模板', content, footer);
  299. dialog.find('iframe').on('load', function(){
  300. $('a', this.contentWindow.document.body).each(function(){
  301. var href = $(this).attr('href');
  302. if(href && href[0] != '#') {
  303. var arr = href.split(/#/g);
  304. var url = arr[0];
  305. if(url.slice(-1) != '&') {
  306. url += '&';
  307. }
  308. if(url.indexOf('?') != -1) {
  309. url += ('s=' + styleid);
  310. }
  311. if(arr[1]) {
  312. url += ('#' + arr[1]);
  313. }
  314. if (url.substr(0, 10) == 'javascript' || url.indexOf('?') == -1) {
  315. url = url.substr(0, url.lastIndexOf('&'));
  316. }
  317. $(this).attr('href', url);
  318. }
  319. });
  320. });
  321. var url = '{php echo murl('home', array(), true, true)}&s=' + styleid;
  322. dialog.find('iframe').attr('src', url);
  323. dialog.find('.modal-dialog').css({'width': '322px'});
  324. dialog.find('.modal-body').css({'padding': '0', 'height': '480px'});
  325. dialog.modal('show');
  326. }
  327. </script>
  328. {/if}
  329. {template 'common/footer'}