index.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. {include file="public/header" /}
  2. <body class="layui-layout-body">
  3. <div id="LAY_app">
  4. <div class="layui-layout layui-layout-admin">
  5. <div class="layui-header">
  6. <!-- 头部区域 -->
  7. <ul class="layui-nav layui-layout-left">
  8. <li class="layui-nav-item layadmin-flexible" lay-unselect="">
  9. <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
  10. <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
  11. </a>
  12. </li>
  13. <!-- <li class="layui-nav-item layui-hide-xs" lay-unselect="">
  14. <a href="http://www.layui.com/admin/" target="_blank" title="前台">
  15. <i class="layui-icon layui-icon-website"></i>
  16. </a>
  17. </li> -->
  18. <li class="layui-nav-item" lay-unselect="">
  19. <a href="javascript:;" layadmin-event="refresh" title="刷新">
  20. <i class="layui-icon layui-icon-refresh-3"></i>
  21. </a>
  22. </li>
  23. <!-- <li class="layui-nav-item layui-hide-xs" lay-unselect="">
  24. <input type="text" placeholder="搜索..." autocomplete="off" class="layui-input layui-input-search"
  25. layadmin-event="serach" lay-action="template/search.html?keywords=">
  26. </li> -->
  27. </ul>
  28. <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right" id="view">
  29. <!-- <li class="layui-nav-item" lay-unselect="">
  30. <a lay-href="../src/views/app/message/index.html" layadmin-event="message" lay-text="消息中心">
  31. <i class="layui-icon layui-icon-notice"></i> -->
  32. <!-- 如果有新消息,则显示小圆点 -->
  33. <!-- <span class="layui-badge-dot"></span>
  34. </a>
  35. </li> -->
  36. <li class="layui-nav-item layui-hide-xs" lay-unselect="">
  37. <a href="javascript:;" layadmin-event="note" title="便签">
  38. <i class="layui-icon layui-icon-note"></i>
  39. </a>
  40. </li>
  41. <li class="layui-nav-item layui-hide-xs" lay-unselect="">
  42. <a href="javascript:;" layadmin-event="fullscreen" title="全屏">
  43. <i class="layui-icon layui-icon-screen-full"></i>
  44. </a>
  45. </li>
  46. <li class="layui-nav-item" lay-unselect="" >
  47. <img src="{$portrait}" data-original="{$portrait}" class="layui-circle layui-table-img" onerror="this.src='/static/admin/images/head_default.gif'" alt="{:session('rolename')}" title="{:session('rolename')}" >
  48. </li>
  49. <li class="layui-nav-item" lay-unselect="">
  50. <a href="javascript:;">
  51. <cite>{$username}</cite>
  52. <span class="layui-nav-more"></span></a>
  53. <dl class="layui-nav-child">
  54. <!--<dd><a href="../src/views/set/user/info.html"><i class="fa fa-user-circle"></i> 基本资料</a></dd>-->
  55. <dd><a href="javascript:;" onclick="wk.layer_show1('基本资料',$('#pInfo'),550,405)"><i class="fa fa-user-circle-o"></i> 基本资料</a></dd>
  56. <dd><a href="javascript:;" onclick="wk.layer_show1('修改头像',$('#headCrop'),700,570)"><i class="fa fa-crop"></i> 修改头像</a></dd>
  57. <dd><a href="javascript:;" onclick="wk.layer_show1('修改密码',$('#changePwd'),500,320);"><i class="fa fa-unlock-alt"></i> 修改密码</a></dd>
  58. <dd><a href="javascript:;" onclick="cache()"><i class="fa fa-history"></i> 清除缓存</a></dd>
  59. <hr>
  60. <dd style="text-align: center;"><a href="javascript:;" onclick="loginOut()"><i class="fa fa-sign-out"></i> 退出</a></dd>
  61. </dl>
  62. </li>
  63. <li class="layui-nav-item layui-hide-xs" lay-unselect="">
  64. <a href="javascript:;" layadmin-event="theme" title="皮肤">
  65. <i class="layui-icon layui-icon-theme"></i>
  66. </a>
  67. </li>
  68. <!--<li class="layui-nav-item layui-hide-xs" lay-unselect="">-->
  69. <!--<a href="javascript:;" layadmin-event="about"><i-->
  70. <!--class="layui-icon layui-icon-more-vertical"></i></a>-->
  71. <!--</li>-->
  72. <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect="">
  73. <a href="javascript:;" layadmin-event="more"><i class="layui-icon layui-icon-more-vertical"></i></a>
  74. </li>
  75. </ul>
  76. </div>
  77. <!--侧边菜单-->
  78. <div class="layui-side layui-side-menu">
  79. <div class="layui-side-scroll">
  80. <div class="layui-logo">
  81. <span>layui</span>
  82. </div>
  83. <ul class="layui-nav layui-nav-tree " id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu" lay-shrink="all">
  84. {if !empty($menu)}
  85. {foreach name="menu" item="vo"}
  86. <li data-name="home" class="layui-nav-item">
  87. {if condition="$vo.name eq '#'"}
  88. <a href="javascript:;" lay-tips="{$vo.title}" lay-direction="2">
  89. <i class="{$vo.css} layui-font"></i>
  90. <cite>{$vo.title}</cite>
  91. <span class="layui-nav-more"></span>
  92. </a>
  93. {else /}
  94. <a href="javascript:;" lay-href="{$vo.href}" lay-tips="{$vo.title}"
  95. lay-direction="2">
  96. <i class="{$vo.css} layui-font"></i>
  97. <cite>{$vo.title}</cite>
  98. </a>
  99. {/if}
  100. {if condition="$vo.name eq '#'"}
  101. <dl class="layui-nav-child">
  102. {if !empty($vo['child'])}
  103. {foreach name="$vo['child']" item="v"}
  104. {if condition="$v.name neq '##'"}
  105. <dd data-name="console">
  106. <a lay-href="{$v.href}">{$v.title}</a>
  107. </dd>
  108. {else /}
  109. <dd data-name="grid">
  110. <a href="javascript:;">{$v.title}<span class="layui-nav-more"></span></a>
  111. <dl class="layui-nav-child">
  112. {if !empty($v['child'])}
  113. {foreach name="$v['child']" item="z"}
  114. <dd data-name="list"><a lay-href="{$z.href}">{$z.title}</a></dd>
  115. {/foreach}
  116. {/if}
  117. </dl>
  118. </dd>
  119. {/if}
  120. {/foreach}
  121. {/if}
  122. </dl>
  123. {/if}
  124. </li>
  125. {/foreach}
  126. {/if}
  127. </ul>
  128. </div>
  129. </div>
  130. <!-- 页面标签 -->
  131. <div class="layadmin-pagetabs" id="LAY_app_tabs">
  132. <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
  133. <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
  134. <div class="layui-icon layadmin-tabs-control layui-icon-down">
  135. <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
  136. <li class="layui-nav-item" lay-unselect="">
  137. <a href="javascript:;"><span class="layui-nav-more"></span></a>
  138. <dl class="layui-nav-child layui-anim-fadein">
  139. <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
  140. <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
  141. <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
  142. </dl>
  143. </li>
  144. </ul>
  145. </div>
  146. <div class="layui-tab" lay-unauto="" lay-allowclose="true" lay-filter="layadmin-layout-tabs">
  147. <ul class="layui-tab-title" id="LAY_app_tabsheader">
  148. <li lay-id="../src/views/home/console.html" lay-attr="../src/views/home/console.html" class="layui-this"><i class="layui-icon layui-icon-home"></i> 首页<i class="layui-icon layui-unselect layui-tab-close">ဆ</i>
  149. </li>
  150. </ul>
  151. </div>
  152. </div>
  153. <!-- 主体内容 -->
  154. <div class="layui-body" id="LAY_app_body">
  155. <div class="layadmin-tabsbody-item layui-show">
  156. <iframe src="{:url('Index/indexPage')}" frameborder="0" class="layadmin-iframe"></iframe>
  157. </div>
  158. </div>
  159. <!-- 辅助元素,一般用于移动设备下遮罩 -->
  160. <div class="layadmin-body-shade" layadmin-event="shade"></div>
  161. </div>
  162. </div>
  163. {include file="public/footer" /}
  164. <!--修改密码-->
  165. <div id="changePwd" style="display:none;">
  166. <div class="layui-fluid layui-col-xs12">
  167. <div class="layui-card-body layui-form layui-form-pane">
  168. <div class="layui-row layui-form-item ">
  169. <div class="layui-form-item">
  170. <label class="layui-form-label">当前密码</label>
  171. <div class="layui-input-block">
  172. <input type="password" name="old_pwd" placeholder="输入当前密码" lay-verify="required|oldpwd" class="layui-input" autocomplete="off"/>
  173. </div>
  174. </div>
  175. <div class="layui-form-item">
  176. <label class="layui-form-label">新密码</label>
  177. <div class="layui-input-block">
  178. <input type="password" name="new_pwd" placeholder="输入新密码" lay-verify="required|newpwd" class="layui-input" autocomplete="off"/>
  179. </div>
  180. </div>
  181. <div class="layui-form-item">
  182. <label class="layui-form-label">确认密码</label>
  183. <div class="layui-input-block">
  184. <input type="password" name="r_pwd" placeholder="输入确认密码" lay-verify="required|rpwd" class="layui-input" autocomplete="off"/>
  185. </div>
  186. </div>
  187. <div class="layui-form-item">
  188. <div class="layui-input-block">
  189. <button class="layui-btn" lay-submit="" lay-filter="component-form-element">确认修改
  190. </button>
  191. <button class="layui-btn layui-btn-primary" onclick="layer.closeAll()">关闭</button>
  192. </div>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. <!--个人信息-->
  199. <div id="pInfo" style="display:none;">
  200. <div class="layui-fluid layui-col-xs12">
  201. <div class="layui-card-body layui-form layui-form-pane">
  202. <div class="layui-row layui-form-item ">
  203. <div class="layui-form-item">
  204. <label class="layui-form-label">用户名</label>
  205. <div class="layui-input-block">
  206. <input type="text" class="layui-input" style="cursor:not-allowed;" value="{:session('username')}" disabled/>
  207. </div>
  208. </div>
  209. <div class="layui-form-item">
  210. <label class="layui-form-label">角&nbsp;&nbsp;&nbsp;&nbsp;色</label>
  211. <div class="layui-input-block">
  212. <input type="text" class="layui-input" style="cursor:not-allowed;" value="{:session('rolename')}" disabled/>
  213. </div>
  214. </div>
  215. <div class="layui-form-item">
  216. <label class="layui-form-label">手机号</label>
  217. <div class="layui-input-block">
  218. <input type="text" class="layui-input" style="cursor:not-allowed;" value="{:session('phone')}" disabled/>
  219. </div>
  220. </div>
  221. <div class="layui-form-item layui-form-text">
  222. <label class="layui-form-label">描&nbsp;&nbsp;&nbsp;&nbsp;述</label>
  223. <div class="layui-input-block">
  224. <textarea class="layui-textarea"style="cursor:not-allowed;resize:none" disabled>{:session('describe')}</textarea>
  225. </div>
  226. </div>
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. <script type="text/javascript" src="__JS__/plugins/cropper/Crop.js"></script>
  232. <script>
  233. //裁剪后的处理
  234. $("#sureCut").on("click",function () {
  235. if ($("#tailoringImg").attr("src") == null ){
  236. layer.msg('请先选择头像',{anim:6})
  237. }else{
  238. var cas = $('#tailoringImg').cropper('getCroppedCanvas');//获取被裁剪后的canvas
  239. var base64url = cas.toDataURL('image/png'); //转换为base64地址形式
  240. //关闭裁剪框
  241. layer.closeAll();
  242. $.ajax({
  243. url : "{:url('Upload/updateFace')}",
  244. type : "post",
  245. dataType : "json",
  246. data:"base64url="+base64url+"&id={:session('uid')}",
  247. success : function(data) {
  248. if(data.code == 200){
  249. wk.success(data.msg,'window.location.reload()')
  250. }else if(data.code == 100){
  251. wk.error(data.msg);
  252. }
  253. }
  254. });
  255. }
  256. });
  257. layui.use(['form'], function() {
  258. var form = layui.form;
  259. form.verify({
  260. oldpwd:function(value,item){
  261. var checkResult = "";
  262. $.ajax({
  263. url:"{:url('User/editPwd')}",
  264. type:'post',
  265. data:"old_pwd="+value +"&type=checkPassword",
  266. async: false,//必须同步
  267. success:function(res){
  268. if(res.code == 100){
  269. checkResult = "当前密码错误";
  270. }
  271. }
  272. })
  273. return checkResult;
  274. },
  275. newpwd: [/^[\S]{6,16}$/,'密码必须6到16位,且不能出现空格'],
  276. rpwd:function(value,item){
  277. if(!/^[\S]{6,16}$/.test(value)){
  278. return '密码必须6到16位,且不能出现空格';
  279. }
  280. var newpwd = $('input[name=new_pwd]').val();
  281. if(newpwd != value){
  282. return "两次输入密码不一致";
  283. }
  284. }
  285. });
  286. form.on('submit(component-form-element)', function (data) {
  287. $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
  288. $.ajax({
  289. url:"{:url('User/editPwd')}",
  290. type:'post',
  291. dataType:'json',
  292. data:data.field,
  293. success:function(res){
  294. if (res.code == 200) {
  295. wk.success(res.msg,'',"{:url('admin/Login/loginOut')}");
  296. } else {
  297. wk.error(res.msg,'$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\')');
  298. }
  299. }
  300. })
  301. });
  302. });
  303. var loginOut = function(){
  304. layer.confirm('你确定要退出吗?', {icon: 3,title:'提示'}, function(index){
  305. layer.close(index);
  306. window.location.href="{:url('admin/login/loginOut')}";
  307. });
  308. }
  309. //清除缓存
  310. var cache = function(){
  311. layer.confirm('你确定要清除缓存吗?', {icon: 3, title:'提示'}, function(index){
  312. $.getJSON("{:url('admin/index/clear')}",function(res){
  313. if(res.code == 200){
  314. wk.success(res.msg);
  315. }else if(res.code == 100){
  316. wk.error(res.msg);
  317. }
  318. });
  319. })
  320. }
  321. </script>
  322. </body>
  323. </html>