提交 f9342aee 编写于 作者: doc_wei's avatar doc_wei

win系统锁屏界面图片操作完成

上级 8222aec3
package com.skyeye.authority.dao;
import java.util.List;
import java.util.Map;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
public interface SysEveWinLockBgPicDao {
public List<Map<String, Object>> querySysEveWinLockBgPicList(Map<String, Object> map, PageBounds pageBounds) throws Exception;
public int insertSysEveWinLockBgPicMation(Map<String, Object> map) throws Exception;
public Map<String, Object> querySysEveWinLockBgPicMationByName(Map<String, Object> map) throws Exception;
public int deleteSysEveWinLockBgPicMationById(Map<String, Object> map) throws Exception;
public Map<String, Object> querySysEveMationById(Map<String, Object> map) throws Exception;
}
package com.skyeye.authority.service;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
public interface SysEveWinLockBgPicService {
public void querySysEveWinLockBgPicList(InputObject inputObject, OutputObject outputObject) throws Exception;
public void insertSysEveWinLockBgPicMation(InputObject inputObject, OutputObject outputObject) throws Exception;
public void deleteSysEveWinLockBgPicMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
package com.skyeye.authority.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.skyeye.authority.dao.SysEveWinLockBgPicDao;
import com.skyeye.authority.service.SysEveWinLockBgPicService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.ToolUtil;
@Service
public class SysEveWinLockBgPicServiceImpl implements SysEveWinLockBgPicService{
@Autowired
private SysEveWinLockBgPicDao sysEveWinLockBgPicDao;
/**
*
* @Title: querySysEveWinLockBgPicList
* @Description: 获取win系统锁屏桌面图片列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void querySysEveWinLockBgPicList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> beans = sysEveWinLockBgPicDao.querySysEveWinLockBgPicList(map,
new PageBounds(Integer.parseInt(map.get("page").toString()), Integer.parseInt(map.get("limit").toString())));
PageList<Map<String, Object>> beansPageList = (PageList<Map<String, Object>>)beans;
int total = beansPageList.getPaginator().getTotalCount();
outputObject.setBeans(beans);
outputObject.settotal(total);
}
/**
*
* @Title: insertSysEveWinLockBgPicMation
* @Description: 添加win系统锁屏桌面图片信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void insertSysEveWinLockBgPicMation(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams();
map.put("id", ToolUtil.getSurFaceId());
map.put("createId", user.get("id"));
map.put("createTime", ToolUtil.getTimeAndToString());
sysEveWinLockBgPicDao.insertSysEveWinLockBgPicMation(map);
}
/**
*
* @Title: deleteSysEveWinLockBgPicMationById
* @Description: 删除win系统锁屏桌面图片信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@SuppressWarnings("static-access")
@Override
public void deleteSysEveWinLockBgPicMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = sysEveWinLockBgPicDao.querySysEveMationById(map);
String tPath = inputObject.getRequest().getSession().getServletContext().getRealPath("/");
String basePath = tPath + bean.get("picUrl").toString();
ToolUtil.deleteFile(basePath);
sysEveWinLockBgPicDao.deleteSysEveWinLockBgPicMationById(map);
}
}
package com.skyeye.authority.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.skyeye.authority.service.SysEveWinLockBgPicService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
@Controller
public class SysEveWinLockBgPicController {
@Autowired
private SysEveWinLockBgPicService sysEveWinLockBgPicService;
/**
*
* @Title: querySysEveWinLockBgPicList
* @Description: 获取win系统锁屏桌面图片列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveWinLockBgPicController/querySysEveWinLockBgPicList")
@ResponseBody
public void querySysEveWinLockBgPicList(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveWinLockBgPicService.querySysEveWinLockBgPicList(inputObject, outputObject);
}
/**
*
* @Title: insertSysEveWinLockBgPicMation
* @Description: 添加win系统锁屏桌面图片信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveWinLockBgPicController/insertSysEveWinLockBgPicMation")
@ResponseBody
public void insertSysEveWinLockBgPicMation(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveWinLockBgPicService.insertSysEveWinLockBgPicMation(inputObject, outputObject);
}
/**
*
* @Title: deleteSysEveWinLockBgPicMationById
* @Description: 删除win系统锁屏桌面图片信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveWinLockBgPicController/deleteSysEveWinLockBgPicMationById")
@ResponseBody
public void deleteSysEveWinLockBgPicMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveWinLockBgPicService.deleteSysEveWinLockBgPicMationById(inputObject, outputObject);
}
}
......@@ -86,7 +86,8 @@
a.pwd_num_enc pwdNum,
a.`password`,
a.user_lock userLock,
b.win_bg_pic_url winBgPicUrl
b.win_bg_pic_url winBgPicUrl,
b.win_lock_bg_pic_url winLockBgPicUrl
FROM
sys_eve_user a
LEFT JOIN sys_eve_user_install b ON a.id = b.user_id
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.skyeye.authority.dao.SysEveWinLockBgPicDao">
<select id="querySysEveWinLockBgPicList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.pic_url picUrl,
CONVERT(a.create_time, char) createTime
FROM
sys_eve_win_lock_bg_pic a
WHERE a.pic_type = '1'
ORDER BY a.create_time DESC
</select>
<insert id="insertSysEveWinLockBgPicMation" parameterType="java.util.Map">
INSERT into sys_eve_win_lock_bg_pic
(id, pic_url, pic_type, create_id, create_time)
VALUES
(#{id}, #{picUrl}, '1', #{createId}, #{createTime})
</insert>
<delete id="deleteSysEveWinLockBgPicMationById" parameterType="java.util.Map">
DELETE
FROM
sys_eve_win_lock_bg_pic
WHERE
id = #{id}
</delete>
<select id="querySysEveMationById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.pic_url picUrl
FROM
sys_eve_win_lock_bg_pic a
WHERE a.id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -162,7 +162,7 @@
</url>
<url id="redis002" path="/post/SysRedisMonitorController/queryRedisLogsList" val="获取redis日志信息" allUse="1">
</url>
<url id="redis003" path="/post/SysRedisMonitorController/queryRedisKeysList" val="获取当前数据库中key的数量" allUse="0">
<url id="redis003" path="/post/SysRedisMonitorController/queryRedisKeysList" val="获取当前数据库中key的数量" allUse="1">
</url>
<url id="sysevewinbgpic001" path="/post/SysEveWinBgPicController/querySysEveWinBgPicList" val="获取win系统桌面图片列表" allUse="1">
......@@ -175,6 +175,17 @@
<url id="sysevewinbgpic003" path="/post/SysEveWinBgPicController/deleteSysEveWinBgPicMationById" val="删除win系统桌面图片信息" allUse="1">
<property id="rowId" name="id" ref="required" var="win系统桌面图片id"/>
</url>
<url id="sysevewinlockbgpic001" path="/post/SysEveWinLockBgPicController/querySysEveWinLockBgPicList" val="获取win系统锁屏桌面图片列表" allUse="1">
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
</url>
<url id="sysevewinlockbgpic002" path="/post/SysEveWinLockBgPicController/insertSysEveWinLockBgPicMation" val="添加win系统锁屏桌面图片信息" allUse="1">
<property id="picUrl" name="picUrl" ref="required" var="图片路径"/>
</url>
<url id="sysevewinlockbgpic003" path="/post/SysEveWinLockBgPicController/deleteSysEveWinLockBgPicMationById" val="删除win系统锁屏桌面图片信息" allUse="1">
<property id="rowId" name="id" ref="required" var="win系统锁屏桌面图片id"/>
</url>
<!-- 系统角色用户管理结束 -->
<!-- 系统数据库管理开始 -->
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>基本介绍</title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<style>
ol {
padding-left: 20px;
}
ol > li {
list-style-type: decimal;
font-size: 13px;
color: #444
}
</style>
</head>
<body class="winui-window-body">
<div class="winui-tab" style="height:100%">
<div class="winui-tab-left">
<div class="winui-scroll-y" style="height:auto;position:absolute;top:0;bottom:0;">
<ul class="winui-tab-nav">
<li class="winui-this"><i class="fa fa-info-circle fa-fw"></i>模板介绍</li>
<li><i class="fa fa-clock-o fa-fw"></i>版本记录</li>
<li><i class="fa fa-bug fa-fw"></i>已知BUG</li>
</ul>
</div>
</div>
<div class="winui-tab-right">
<div class="winui-scroll-y">
<div class="winui-tab-content">
<div class="winui-tab-item layui-show">
<blockquote class="layui-elem-quote">
WinAdmin —— 基于Layui打造的一款Win10风格前端模板!
</blockquote>
<div class="layui-collapse" style="font-size:14px;">
<div class="layui-colla-item">
<h2 class="layui-colla-title">简介</h2>
<div class="layui-colla-content layui-show">
<blockquote class="layui-elem-quote">
WinAdmin是由.NET程序员打造的一个Win10风格前端模板。<br />
由作者基于Layui编写的一个winui.js模块主导。<br />
winui.js封装了一些常用Api,例如:<br />
&nbsp;&nbsp;&nbsp;&nbsp;自定义右键菜单;<br />
&nbsp;&nbsp;&nbsp;&nbsp;窗口的打开、关闭、最大化、最小化、置顶等;<br />
&nbsp;&nbsp;&nbsp;&nbsp;桌面菜单、开始菜单等数据的动态加载。<br /><br />
因此,你几乎不用写HTML代码,即可建成一个基本的Win10风格界面。<br />
</blockquote>
</div>
</div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">兼容性</h2>
<div class="layui-colla-content">
<blockquote class="layui-elem-quote">
由于WinAdmin并非职业前端人员打造,因此兼容性并不强!<br />
目前开发调试全用的Google Chrome浏览器,因此WinCMS并不兼容IE、火狐、以及一些他的浏览器!<br />
此外,WinAdmin并非响应式,不支持手机,平板等。推荐台式或者笔记本!
</blockquote>
</div>
</div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">说明</h2>
<div class="layui-colla-content">
<blockquote class="layui-elem-quote">
1、无兼容性<br />
2、非响应式<br />
3、需一定前端基础才能使用<br />
4、改套模板几乎不更新,看作者心情。<br />
5、开始菜单只支持两级。<br />
6、目前支持桌面菜单和开始菜单的动态渲染,磁贴菜单暂不支持。(你也可以直接在页面写html然后调用window.open()方法来打开窗口)<br />
7、文档可能整理不全,建议查看源码,或者直接二次开发<br />
8、请尽量看懂index.js里面的代码,然后自己模仿,不要无脑直接用。<br />
</blockquote>
</div>
</div>
<div class="layui-colla-item">
<h2 class="layui-colla-title" style="color:#ff6a00">特别注意</h2>
<div class="layui-colla-content">
<blockquote class="layui-elem-quote">
1、非独立页面(也就是非iframe)使用layer请配置参数{zIndex:layer.zIndex}<br />
2、弹窗请尽量使用iframe(type:2)<br />
3、dektop、window、start等模块请按需加载(不需要就别引入了)<br />
</blockquote>
</div>
</div>
</div>
<hr />
<blockquote class="layui-elem-quote">更多请看文档:<a style="color:#0094ff" href="http://www.win-ui.com/doc" target="_blank">点击前往</a></blockquote>
</div>
<div class="winui-tab-item">
<ul class="layui-timeline">
<li class="layui-timeline-item">
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>
<div class="layui-timeline-content layui-text">
<h3 class="layui-timeline-title">2018年04月18日</h3>
<p>
WinAdmin 1.0.0 开源于Github、码云
</p>
</div>
</li>
<li class="layui-timeline-item">
<i class="layui-icon layui-timeline-axis">&#xe63f;</i>
<div class="layui-timeline-content layui-text">
<div class="layui-timeline-title">开发阶段</div>
</div>
</li>
</ul>
</div>
<div class="winui-tab-item">
<ol>
<li>最大化后改变浏览器视口大小,窗口的位置会错乱</li>
<li>在窗口未加载完成时进行点击操作,底部任务项样式会错乱</li>
</ol>
</div>
</div>
</div>
</div>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: '../../assets/lib/winui/' //指定 winui 路径
}).use(['winui']);
window.onload = function () {
winui.init();
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div class="winui-tab" lay-filter="winuitab" style="height:80%">
<div class="winui-tab-left">
<div class="winui-tab-title">ECharts图表演示</div>
<div class="winui-scroll-y" style="height:auto;position:absolute;top:50px;bottom:0;">
<ul class="winui-tab-nav">
<li class="winui-this"><i class="fa fa-bar-chart fa-fw"></i>Bar</li>
<li><i class="fa fa-line-chart fa-fw"></i>Line</li>
<li><i class="fa fa-area-chart fa-fw"></i>Area</li>
<li><i class="fa fa-pie-chart fa-fw"></i>Pie</li>
</ul>
</div>
</div>
<div class="winui-tab-right">
<div class="winui-scroll-y">
<div class="winui-tab-content">
<div class="winui-tab-item layui-show">
<div id="bar" style="width:100%;height:400px;"></div>
</div>
<div class="winui-tab-item">
<div id="line" style="width:100%;height:400px;"></div>
</div>
<div class="winui-tab-item">
<div id="area" style="width:100%;height:400px;"></div>
</div>
<div class="winui-tab-item">
<div id="pie" style="width:100%;height:400px;"></div>
</div>
</div>
</div>
</div>
</div>
<div style="line-height:20px;padding:0 20px;" class="tips">更多示例和ECharts用法请前往:<a href="http://echarts.baidu.com" target="_blank">ECharts官网</a></div>
<script src="../../assets/lib/layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: '../../js/echarts/'
}).use('echartsdemo');
</script>
</body>
</html>
\ No newline at end of file
<style>
/* 提示页 */
.layadmin-tips {
margin-top: 30px;
text-align: center;
}
.layadmin-tips .layui-icon[face] {
display: inline-block;
font-size: 300px;
color: #393D49;
}
.layadmin-tips .layui-text {
width: 500px;
margin: 30px auto;
padding-top: 20px;
border-top: 5px solid #009688;
font-size: 16px;
}
.layadmin-tips h1 {
font-size: 100px;
line-height: 100px;
color: #009688;
}
.layadmin-tips .layui-text .layui-anim {
display: inline-block;
}
</style>
<div class="layui-fluid">
<div class="layadmin-tips">
<i class="layui-icon" face=""></i>
<div class="layui-text">
<h1>
<span class="layui-anim layui-anim-loop layui-anim-">4</span>
<span class="layui-anim layui-anim-loop layui-anim-rotate">0</span>
<span class="layui-anim layui-anim-loop layui-anim-">4</span>
</h1>
</div>
</div>
</div>
\ No newline at end of file
<style>
/* 提示页 */
.layadmin-tips {
margin-top: 30px;
text-align: center;
}
.layadmin-tips .layui-icon[face] {
display: inline-block;
font-size: 300px;
color: #393D49;
}
.layadmin-tips .layui-text {
width: 500px;
margin: 30px auto;
padding-top: 20px;
border-top: 5px solid #009688;
font-size: 16px;
}
.layadmin-tips h1 {
font-size: 100px;
line-height: 100px;
color: #009688;
}
.layadmin-tips .layui-text .layui-anim {
display: inline-block;
}
</style>
<div class="layui-fluid">
<div class="layadmin-tips">
<i class="layui-icon" face=""></i>
<div class="layui-text">
<h1>
<span class="layui-anim layui-anim-loop layui-anim-">5</span>
<span class="layui-anim layui-anim-loop layui-anim">0</span>
<span class="layui-anim layui-anim-loop layui-anim-">0</span>
</h1>
</div>
</div>
</div>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="renderer" content="webkit">
<title>天眼</title>
<link href="../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../assets/lib/animate/animate.min.css" rel="stylesheet" />
<link href="../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../assets/lib/winui/css/winui.css" rel="stylesheet" />
<script>
/^http(s*):\/\//.test(location.href) || alert('请先部署到 localhost 下再访问');
</script>
<style>
body {
/*在页面顶部加载背景最佳,如有必要这块可以从数据库读取*/
background-image: url(../assets/images/bg_01.jpg);
}
</style>
</head>
<body>
<!-- 桌面 -->
<div class="winui-desktop">
</div>
<!-- 开始菜单 -->
<div class="winui-start sp layui-hide">
<!-- 左边设置 -->
<div class="winui-start-left">
<div class="winui-start-item bottom" data-text="个人中心"><i class="fa fa-user"></i></div>
<div class="winui-start-item winui-start-individuation bottom" data-text="主题设置"><i class="fa fa-cog"></i></div>
<div class="winui-start-item bottom logout" data-text="注销登录"><i class="fa fa-power-off"></i></div>
</div>
<!-- 中间导航 -->
<div class="winui-start-center">
<div class="layui-side-scroll">
<ul class="winui-menu layui-nav layui-nav-tree" lay-filter="winuimenu"></ul>
</div>
</div>
<!-- 右边磁贴 -->
<div class="winui-start-right">
<div class="layui-side-scroll">
<div class="winui-nav-tile">
<div class="winui-tilebox">
<div class="winui-tilebox-head">组件示例</div>
<div class="winui-tilebox-body">
<div class="winui-tile winui-tile-normal">
<i class="fa fa-fw fa-adjust"></i>
<span>按钮</span>
</div>
<div class="winui-tile winui-tile-normal">
<i class="fa fa-fw fa-circle-o-notch"></i>
<span>进度条</span>
</div>
<div class="winui-tile winui-tile-normal">
<i class="fa fa-fw fa-list-alt"></i>
<span>表单</span>
</div>
<div class="winui-tile winui-tile-normal">
<i class="fa fa-fw fa-window-maximize"></i>
<span>面板</span>
</div>
<div class="winui-tile winui-tile-long">
<p style="font-size:30px;font-family:'STKaiti';">Tab</p>
<span>选项卡</span>
</div>
<div class="winui-tile winui-tile-long">
<i class="fa fa-fw fa-spin fa-spinner"></i>
<span>流加载</span>
</div>
<div class="winui-tile winui-tile-normal">
<i class="fa fa-fw fa-spin fa-refresh"></i>
<span>动画</span>
</div>
<div class="winui-tile winui-tile-normal">
<i class="fa fa-fw fa-calendar"></i>
<span>日期时间</span>
</div>
<div class="winui-tile winui-tile-long">
<i class="fa fa-fw fa-clock-o"></i>
<span>时间线</span>
</div>
</div>
</div>
<div class="winui-tilebox">
<div class="winui-tilebox-head">占位菜单</div>
<div class="winui-tilebox-body">
<div class="winui-tile winui-tile-long">
<i class="fa fa-file-text"></i>
<span>文章管理</span>
</div>
<div class="winui-tile winui-tile-normal">
<i class="fa fa-file-text"></i>
<span>文章管理</span>
</div>
<div class="winui-tile winui-tile-normal">
<img src="../assets/images/logo_100.png" />
<span>自定义图片</span>
</div>
<div class="winui-tile winui-tile-normal">
<i class="fa fa-file-text"></i>
<span>文章管理</span>
</div>
<div class="winui-tile winui-tile-normal">
<img src="../assets/images/qzone_32.png" />
<span>QQ空间</span>
</div>
<div class="winui-tile winui-tile-normal">
<i class="fa fa-photo fa-fw"></i>
<span>图片</span>
</div>
</div>
</div>
<div class="winui-tilebox">
<div class="winui-tilebox-head">占位菜单</div>
<div class="winui-tilebox-body">
<div class="winui-tile winui-tile-normal">
<i class="fa fa-file-text"></i>
<span>文章管理</span>
</div>
<div class="winui-tile winui-tile-normal">
<i class="fa fa-file-text"></i>
<span>文章管理</span>
</div>
<div class="winui-tile winui-tile-normal">
<i class="fa fa-file-text"></i>
<span>文章管理</span>
</div>
</div>
</div>
<div class="winui-tilebox">
<div class="winui-tilebox-head">占位菜单</div>
<div class="winui-tilebox-body">
<div class="winui-tile winui-tile-long">
<i class="fa fa-file-text"></i>
<span>文章管理</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 任务栏 -->
<div class="winui-taskbar">
<!-- 开始菜单触发按钮 -->
<div class="winui-taskbar-start sp"><i class="fa fa-windows"></i></div>
<!-- 任务项 -->
<ul class="winui-taskbar-task"></ul>
<!-- 任务栏时间 -->
<div class="winui-taskbar-time"></div>
<!-- 控制中心 -->
<div class="winui-taskbar-console sp">
<i class="fa fa-comment-o"></i>
</div>
<!-- 显示桌面 -->
<div class="winui-taskbar-desktop">
</div>
</div>
<!--控制中心-->
<div class="winui-console layui-hide slideOutRight sp">
<h1>最新通知</h1>
<div class="winui-message">
<div class="layui-side-scroll">
<div class="winui-message-item">
<h2>马云发来一条信息</h2>
<div class="content">
今天晚上我请客!
</div>
</div>
<div class="winui-message-item">
<h2>马化腾有问题请教</h2>
<div class="content">
QQ如何发送语音?
</div>
</div>
<div class="winui-message-item">
<h2>你有一条新留言</h2>
<div class="content">
牛逼
</div>
</div>
<div class="winui-message-item">
<h2>好友验证</h2>
<div class="content">
高圆圆请求加你为好友
</div>
</div>
<div class="winui-message-item">
<h2>群系统消息</h2>
<div class="content">
李彦宏邀请你加入百度AI技术交流群
</div>
</div>
</div>
</div>
<div class="winui-shortcut">
<h2><span class="extend-switch sp">展开</span></h2>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
<div class="winui-shortcut-item">
<i class="fa fa-cog"></i>
<span>设置</span>
</div>
</div>
</div>
<!--layui.js-->
<script src="../assets/lib/layui/layui.js" type="text/javascript"></script>
<script>
layui.config({
base: '../js/index/' //指定 index.js 路径
, version: '1.0.0-beta'
}).use('index');
</script>
</body>
</html>
\ No newline at end of file
<div style="width:600px;margin:0 auto;padding-top:20px;">
<form class="layui-form" action="">
<div class="layui-form-item">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block">
<select name="parentId">
<option value="0">请选择上级菜单</option>
<option value="1">&#x4E2A;&#x6027;&#x5316;</option>
<option value="3">&#x6253;&#x8D4F;&#x4F5C;&#x8005;</option>
<option value="4">&#x57FA;&#x672C;&#x8BF4;&#x660E;</option>
<option value="23">&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E;</option>
<option value="27">Font Awesome&#x56FE;&#x6807;&#x5C55;&#x793A;</option>
<option value="43">Font Awesome&#x7B2C;&#x4E09;&#x65B9;LOGO</option>
<option value="53">&#x81EA;&#x5B9A;&#x4E49;&#x56FE;&#x7247;&#x83DC;&#x5355;</option>
<option value="60">&#x7CFB;&#x7EDF;&#x65E5;&#x5FD7;</option>
<option value="62">&#x70B9;&#x8D5E;</option>
<option value="63">123</option>
<option value="66">&#x4F5C;&#x8005;&#x535A;&#x5BA2;</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单图标</label>
<div class="layui-input-block">
<input type="text" name="icon" win-verify="required" placeholder="请输入图标src或者class" autocomplete="off" class="layui-input" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单名称</label>
<div class="layui-input-block">
<input type="text" name="name" win-verify="required" placeholder="请输入菜单名称" autocomplete="off" class="layui-input" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">窗口标题</label>
<div class="layui-input-block">
<input type="text" name="title" placeholder="请输入菜单名称" autocomplete="off" class="layui-input" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单地址</label>
<div class="layui-input-block">
<input type="text" name="pageurl" placeholder="请输入菜单地址" autocomplete="off" class="layui-input" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单类型</label>
<div class="layui-input-block winui-radio">
<input type="radio" name="openType" value="1" title="HTML" />
<input type="radio" name="openType" value="2" title="Iframe" checked />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">系统菜单</label>
<div class="layui-input-block winui-switch">
<input name="isNecessary" lay-filter="isNecessary" type="checkbox" lay-skin="switch" lay-text="是|否" />
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" lay-submit lay-filter="formAddMenu">确定</button>
<button class="winui-btn" onclick="winui.window.close('addMenu'); return false;">取消</button>
</div>
</div>
</form>
<div class="tips">Tips:1.系统菜单不可以删除 2.窗口标题若不填则默认和菜单名称相同</div>
</div>
<script>
layui.use(['form','layer'], function (form) {
var $ = layui.$
, msg = winui.window.msg;
form.render();
form.on('switch(isNecessary)', function (data) {
$(data.elem).val(data.elem.checked);
});
form.on('submit(formAddMenu)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
layui.$.ajax({
type: 'get',
url: 'json/resfailed.json',
async: false,
data: data.field,
dataType: 'json',
success: function (json) {
if (json.isSucceed) {
msg('添加成功');
} else {
msg(json.message)
}
winui.window.close('addMenu');
},
error: function (xml) {
msg('添加失败');
console.log(xml.responseText);
}
});
}
return false;
});
});
</script>
\ No newline at end of file
<div style="width:600px;margin:0 auto;padding-top:20px;">
<form class="layui-form" action="">
<div class="layui-form-item">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block">
<select name="parentId">
<option value="0">请选择上级菜单</option>
<option value="1">&#x4E2A;&#x6027;&#x5316;</option>
<option value="3">&#x6253;&#x8D4F;&#x4F5C;&#x8005;</option>
<option value="4">&#x57FA;&#x672C;&#x8BF4;&#x660E;</option>
<option value="23" selected>&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E;</option>
<option value="27">Font Awesome&#x56FE;&#x6807;&#x5C55;&#x793A;</option>
<option value="43">Font Awesome&#x7B2C;&#x4E09;&#x65B9;LOGO</option>
<option value="53">&#x81EA;&#x5B9A;&#x4E49;&#x56FE;&#x7247;&#x83DC;&#x5355;</option>
<option value="60">&#x7CFB;&#x7EDF;&#x65E5;&#x5FD7;</option>
<option value="62">&#x70B9;&#x8D5E;</option>
<option value="63">123</option>
<option value="66">&#x4F5C;&#x8005;&#x535A;&#x5BA2;</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单图标</label>
<div class="layui-input-block">
<input type="text" name="icon" win-verify="required" placeholder="请输入图标src或者class" autocomplete="off" class="layui-input" value="fa-navicon" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单名称</label>
<div class="layui-input-block">
<input type="text" name="name" win-verify="required" placeholder="请输入菜单名称" autocomplete="off" class="layui-input" value="&#x83DC;&#x5355;&#x8BBE;&#x7F6E;" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">窗口标题</label>
<div class="layui-input-block">
<input type="text" name="title" win-verify="required" placeholder="请输入菜单名称" autocomplete="off" class="layui-input" value="&#x83DC;&#x5355;&#x8BBE;&#x7F6E;" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单地址</label>
<div class="layui-input-block">
<input type="text" name="pageurl" placeholder="请输入菜单地址" autocomplete="off" class="layui-input" value="/menu/index" />
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">菜单类型</label>
<div class="layui-input-block winui-radio">
<input type="radio" name="openType" value="1" title="HTML" />
<input type="radio" name="openType" value="2" title="Iframe" checked />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">系统菜单</label>
<div class="layui-input-block winui-switch">
<input name="isNecessary" type="checkbox" lay-filter="isNecessary" lay-skin="switch" lay-text="是|否" checked value="True ">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" lay-submit lay-filter="formEditMenu">确定</button>
<button class="winui-btn" onclick="winui.window.close('editMenu'); return false;">取消</button>
</div>
</div>
</form>
<div class="tips">Tips:演示的每个编辑页都是相同的</div>
</div>
<script>
layui.use(['form'], function (form) {
var msg = winui.window.msg,
$ = layui.$;
form.render();
form.on('switch(isNecessary)', function (data) {
//同步开关值
$(data.elem).val(data.elem.checked);
});
form.on('submit(formEditMenu)', function (data) {
console.log(data);
//表单验证
if (winui.verifyForm(data.elem)) {
layui.$.ajax({
type: 'get',
url: 'json/resok.json',
async: false,
data: data.field,
dataType: 'json',
success: function (json) {
if (json.isSucceed) {
msg('修改成功', {
icon: 1,
time: 2000
});
} else {
msg(json.message);
}
winui.window.close('editMenu');
},
error: function (xml) {
msg(xml.responseText == "" ? "获取页面失败" : xml.responseText, {
icon: 2,
time: 2000
});
}
});
}
return false;
});
});
</script>
\ No newline at end of file
<!-- 菜单列表的html页 -->
<div class="winui-toolbar">
<div class="winui-tool">
<button id="btn-reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
<button id="btn-addMenu" class="winui-toolbtn"><i class="fa fa-plus" aria-hidden="true"></i>新增菜单</button>
<button id="btn-editMenu" class="winui-toolbtn"><i class="fa fa-pencil" aria-hidden="true"></i>编辑菜单</button>
<button id="btn-deleteMenu" class="winui-toolbtn"><i class="fa fa-trash" aria-hidden="true"></i>删除选中</button>
</div>
</div>
<div style="margin:auto 10px;">
<table id="menuhtml" lay-filter="menutable"></table>
<script type="text/html" id="barMenu">
<a class="layui-btn layui-btn-xs " lay-event="setting">功能设置</a>
<a class="layui-btn layui-btn-xs " lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs " lay-event="del">删除</a>
</script>
<script type="text/html" id="openTypeTpl">
{{# if(d.openType == 1){ }}
HTML
{{# } else if(d.openType==2) { }}
Iframe
{{# } }}
</script>
<script type="text/html" id="isNecessary">
{{# if(d.isNecessary){ }}
{{# } else { }}
{{# } }}
</script>
<div class="tips">Tips:1.系统菜单不可以删除 2.修改或添加数据后暂不支持自动刷新表格 3.顺序栏可编辑 4.表格用法请移步:<a style="color:#0094ff" href="http://www.layui.com/doc/modules/table.html" target="_blank">layui文档</a></div>
</div>
<script>
layui.config({
base: 'lib/winui/js/' //指定 winui 路径
, version: '1.0.0-beta'
}).use(['table', 'winui'], function () {
winui.renderColor();
var table = layui.table,
$ = layui.$, tableId = 'tableidhtml';
//表格渲染
table.render({
id: tableId,
elem: '#menuhtml',
url: '../../assets/json/menulist.json',
//height: 'full-65', //自适应高度
//size: '', //表格尺寸,可选值sm lg
//skin: '', //边框风格,可选值line row nob
//even:true, //隔行变色
page: true,
limits: [10, 20, 30, 40, 50, 60, 70, 100],
limit: 10,
cols: [[
{ field: 'id', type: 'checkbox' },
{ field: 'icon', title: '图标', width: 120 },
{ field: 'name', title: '名称', width: 150 },
{ field: 'title', title: '标题', width: 150 },
{ field: 'pageURL', title: '页面地址', width: 200 },
{ field: 'openType', title: '页面类型', width: 120, templet: '#openTypeTpl' },
{ field: 'isNecessary', title: '系统菜单', width: 100, templet: '#isNecessary' },
{ field: 'order', title: '排序', width: 80, edit: 'text' },
{ title: '操作', fixed: 'right', align: 'center', toolbar: '#barMenu', width: 200 }
]],
done: function (res, curr, count) {
//如果是异步请求数据方式,res即为你接口返回的信息。
//如果是直接赋值的方式,res即为:{data: [], count: 99} data为当前页数据、count为数据总长度
console.log(res);
//得到当前页码
console.log(curr);
//得到数据总量
console.log(count);
winui.window.msg('演示请求的每页数据都是相同的。')
}
});
//监听工具条
table.on('tool(menutable)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值"
var data = obj.data; //获得当前行数据
var layEvent = obj.event; //获得 lay-event 对应的值
var tr = obj.tr; //获得当前行 tr 的DOM对象
var ids = ''; //选中的Id
$(data).each(function (index, item) {
ids += item.id + ',';
});
if (layEvent === 'del') { //删除
deleteMenu(ids, obj);
} else if (layEvent === 'edit') { //编辑
openEditWindow(data.id);
} else if (layEvent === 'setting') { //功能设置
$.ajax({
type: 'get',
url: 'views/menu/setting.html',
async: false,
success: function (data) {
content = data;
winui.window.open({
id: 'settingMenu',
type: 1,
title: '功能设置',
content: content,
area: ['55vw', '70vh'],
offset: ['15vh', '25vw'],
});
},
error: function (xml) {
winui.window.msg("获取页面失败", {
icon: 2,
time: 2000
});
console.log(xml.responseText);
}
});
}
});
//监听单元格编辑
table.on('edit(menutable)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值"
if (/^[0-9]+$/.test(obj.value)) {
var index = winui.window.load(1);
$.ajax({
type: 'post',
url: '/api/menu/updatemenuorder',
data: { "id": obj.data.id, "order": obj.value },
success: function (json) {
layer.close(index);
if (!json.isSucceed) {
msg(json.message);
}
},
error: function (xml) {
msg("修改失败", {
icon: 2,
time: 2000
});
console.log(xml.responseText);
}
});
}
});
//打开编辑窗口
function openEditWindow(id) {
if (!id) return;
var content;
var index = winui.window.load();
$.ajax({
type: 'get',
url: 'views/menu/edit.html?id=' + id,
async: true,
success: function (data) {
layer.close(index);
content = data;
//从桌面打开
winui.window.open({
id: 'editMenu',
type: 1,
title: '编辑菜单',
content: content,
area: ['50vw', '70vh'],
offset: ['15vh', '25vw'],
});
},
error: function (xml) {
msg("获取页面失败", {
icon: 2,
time: 2000
});
console.log(xml.responseText);
}
});
}
//删除菜单
function deleteMenu(ids, obj) {
var msg = obj ? '确认删除菜单【' + obj.data.name + '】吗?' : '确认删除选中数据吗?';
winui.window.confirm(msg, { icon: 3, title: '删除系统菜单' }, function (index) {
layer.close(index);
//向服务端发送删除指令
obj.del(); //删除对应行(tr)的DOM结构
winui.window.msg('服务器删除后,刷新表格', { time: 2000 });
setTimeout(function () {
reloadTable(); //直接刷新表格
}, 1000);
});
}
//表格刷新
function reloadTable() {
table.reload(tableId, {});
}
//绑定工具栏添加按钮事件
$('#btn-addMenu').on('click', function () {
var content;
$.ajax({
type: 'get',
url: 'views/menu/add.html',
async: false,
success: function (data) {
content = data;
//从桌面打开
winui.window.open({
id: 'addMenu',
type: 1,
title: '新增菜单',
content: content,
area: ['50vw', '70vh'],
offset: ['15vh', '25vw'],
});
}
});
});
//绑定工具栏编辑按钮事件
$('#btn-editMenu').on('click', function (e) {
var checkStatus = table.checkStatus(tableId);
var checkCount = checkStatus.data.length;
if (checkCount < 1) {
winui.window.msg('请选择一条数据', {
time: 2000
});
return false;
}
if (checkCount > 1) {
winui.window.msg('只能选择一条数据', {
time: 2000
});
return false;
}
openEditWindow(checkStatus.data[0].id);
});
//绑定工具栏删除按钮事件
$('#btn-deleteMenu').on('click', function () {
var checkStatus = table.checkStatus(tableId);
var checkCount = checkStatus.data.length;
if (checkCount < 1) {
winui.window.msg('请选择一条数据', {
time: 2000
});
return false;
}
var ids = '';
$(checkStatus.data).each(function (index, item) {
ids += item.id + ',';
});
deleteMenu(ids);
});
//绑定工具栏刷新按钮事件
$('#btn-reloadTable').on('click', reloadTable);
});
</script>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>菜单列表</title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div class="winui-toolbar">
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
<button id="addMenu" class="winui-toolbtn"><i class="fa fa-plus" aria-hidden="true"></i>新增菜单</button>
<button id="editMenu" class="winui-toolbtn"><i class="fa fa-pencil" aria-hidden="true"></i>编辑菜单</button>
<button id="deleteMenu" class="winui-toolbtn"><i class="fa fa-trash" aria-hidden="true"></i>删除选中</button>
</div>
</div>
<div style="margin:auto 10px;">
<table id="menu" lay-filter="menutable"></table>
<script type="text/html" id="barMenu">
<a class="layui-btn layui-btn-xs" lay-event="setting">权限设置</a>
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="openTypeTpl">
{{# if(d.openType == 1){ }}
HTML
{{# } else if(d.openType==2) { }}
Iframe
{{# } }}
</script>
<script type="text/html" id="isNecessary">
{{# if(d.isNecessary){ }}
{{# } else { }}
{{# } }}
</script>
<div class="tips">Tips:1.系统菜单不可以删除 2.修改或添加数据后暂不支持自动刷新表格</div>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script type="text/javascript">
layui.config({
base: '../../js/menu/'
}).use('menulist');
</script>
</body>
</html>
\ No newline at end of file
<style>
td[data-field=id],
td[data-field=menuId],
th[data-field=id],
th[data-field=menuId] {
display: none;
}
</style>
<div class="txtcenter" style="width:700px;margin:0 auto;padding-top:20px;">
<form class="layui-form layui-form-pane" action="">
<input type="hidden" name="menuId" value="2" />
<input type="hidden" name="id" value="0" />
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="name" autocomplete="off" placeholder="请输入功能名称" class="layui-input" win-verify="required" />
</div>
<label class="layui-form-label">功能描述</label>
<div class="layui-input-inline">
<input type="text" name="description" placeholder="请输入功能描述" autocomplete="off" class="layui-input" />
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">Controller</label>
<div class="layui-input-inline">
<input type="text" name="controller" placeholder="请输入控制器名称" autocomplete="off" class="layui-input" win-verify="required" />
</div>
<div class="layui-form-label">Action</div>
<div class="layui-input-inline">
<input type="text" name="action" placeholder="请输入动作方法名称" autocomplete="off" class="layui-input" win-verify="required" />
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block" style="margin:0;">
<button class="layui-btn" lay-submit lay-filter="formMenuSetting">立即提交</button>
</div>
</div>
</form>
</div>
<hr class="layui-bg-blue">
<div style="margin:auto 10px;">
<table lay-filter="menuSettingTable">
<thead>
<tr>
<th lay-data="{field:'id', width:100}">编号</th>
<th lay-data="{field:'menuId', width:100}">菜单编号</th>
<th lay-data="{field:'name', width:100}">名称</th>
<th lay-data="{field:'description', width:100}">描述</th>
<th lay-data="{field:'controller', width:150}">Controller</th>
<th lay-data="{field:'action', width:150}">Action</th>
<th lay-data="{field:'dataState', width:100}">状态</th>
<th lay-data="{ fixed: 'right', width: 150, align: 'center', toolbar: '#barMenuSetting'}">操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>3</td>
<td>2</td>
<td>新增菜单</td>
<td>新增菜单</td>
<td>Menu</td>
<td>Post</td>
<td>禁用</td>
</tr>
<tr>
<td>4</td>
<td>2</td>
<td>编辑菜单</td>
<td>编辑菜单</td>
<td>Menu</td>
<td>Put</td>
<td>禁用</td>
</tr>
<tr>
<td>5</td>
<td>2</td>
<td>删除菜单</td>
<td>删除菜单</td>
<td>Menu</td>
<td>Delete</td>
<td>启用</td>
</tr>
<tr>
<td>17</td>
<td>2</td>
<td>增改功能</td>
<td>添加或修改菜单功能</td>
<td>Function</td>
<td>Post</td>
<td>启用</td>
</tr>
<tr>
<td>18</td>
<td>2</td>
<td>删除功能</td>
<td>删除菜单包含的功能</td>
<td>Function</td>
<td>Delete</td>
<td>启用</td>
</tr>
</tbody>
</table>
<script type="text/html" id="barMenuSetting">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
</div>
<script>
layui.use(['table', 'form'], function () {
var table = layui.table,
form = layui.form,
$ = layui.$,
tableId = 'tableid';
form.render();
//转换静态表格
table.init('menuSettingTable', {
id: tableId
});
//表格刷新
function reloadTable() {
table.reload(tableId, {});
}
//监听工具条
table.on('tool(menuSettingTable)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值"
var data = obj.data; //获得当前行数据
var layEvent = obj.event; //获得 lay-event 对应的值
var tr = obj.tr; //获得当前行 tr 的DOM对象
var ids = ''; //选中的Id
$(data).each(function (index, item) {
ids += item.id + ',';
});
if (layEvent === 'del') { //删除
winui.window.confirm('确定删除吗?', { icon: 3, title: '删除菜单权限' }, function (index) {
layer.close(index);
//向服务端发送删除指令
obj.del(); //删除对应行(tr)的DOM结构
winui.window.msg('服务器删除后,刷新表格', { time: 2000 });
setTimeout(function () {
reloadTable(); //直接刷新表格
}, 1000);
});
} else if (layEvent === 'edit') { //编辑
winui.window.msg('重新获取编辑视图,替换掉当前html');
//$('#settingMenu').html(editview);
}
});
//监听表单提交
form.on('submit(formMenuSetting)', function (data) {
//表单验证
try {
if (winui.verifyForm(data.elem)) {
winui.window.msg('表单验证成功,提交数据');
}
} catch (e) {
return false;
}
return false;
});
});
</script>
......@@ -36,6 +36,11 @@
}else{
json.bean.winBgPicUrl = fileBasePath + json.bean.winBgPicUrl;
}
if(isNull(json.bean.winLockBgPicUrl)){
json.bean.winLockBgPicUrl = fileBasePath + '/assets/winbgpic/default.jpg';
}else{
json.bean.winLockBgPicUrl = fileBasePath + json.bean.winLockBgPicUrl;
}
initWinConfig(json);
}else{
location.href = "login.html";
......@@ -59,7 +64,7 @@
taskbarMode: 'bottom',
startSize: 'sm',
bgSrc: json.bean.winBgPicUrl,
lockBgSrc: '../../assets/images/bg_04.jpg'
lockBgSrc: json.bean.winLockBgPicUrl
}, //如果本地配置为空则给默认值
desktop: {//桌面菜单栏
options: {
......
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui', 'upload'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
upload = layui.upload;
//初始化数据
showGrid({
id: "showForm",
url: reqBasePath + "sysevewinlockbgpic001",
params: {},
pagination: true,
pagesize: 18,
template: getFileContent('tpl/sysevewinbgpic/bgpic-item.tpl'),
ajaxSendLoadBefore: function(hdb){
hdb.registerHelper("compare1", function(v1, options){
return fileBasePath + v1;
});
},
options: {'click .del':function(index, row){
layer.confirm('确认删除选中数据吗?', { icon: 3, title: '删除win系统锁屏桌面图片' }, function (index) {
layer.close(index);
AjaxPostUtil.request({url:reqBasePath + "sysevewinlockbgpic003", params:{rowId: row.id}, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg("删除成功", {icon: 1,time: 2000});
loadTable();
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}, 'click .sel':function(index, row){
layer.open({
type:1,
title:false,
closeBtn:0,
skin: 'demo-class',
shadeClose:true,
content:'<img src="' + fileBasePath + data.picUrl + '" style="max-height:600px;max-width:100%;">',
scrollbar:false
});
}
},
ajaxSendAfter:function(json){
}
});
//刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
var uploadInst = upload.render({
elem: '#addBean', // 绑定元素
url: reqBasePath + 'common003', // 上传接口
data: {type: 3},
done: function(json) {
// 上传完毕回调
if(json.returnCode == 0){
AjaxPostUtil.request({url:reqBasePath + "sysevewinlockbgpic002", params:{picUrl: json.bean.picUrl}, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg("上传成功", {icon: 1,time: 2000});
loadTable();
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
},
error: function(e) {
// 请求异常回调
console.log(e);
}
});
function loadTable(){
refreshGrid("showForm", {params:{}});
}
exports('sysevewinbgpiclist', {});
});
......@@ -11,12 +11,6 @@
<script>
/^http(s*):\/\//.test(location.href) || alert('请先部署到 localhost 下再访问');
</script>
<style>
body {
/*在页面顶部加载背景最佳,如有必要这块可以从数据库读取*/
background-image: url(../../assets/images/bg_01.jpg);
}
</style>
</head>
<body>
<!-- 桌面 -->
......
{{#each rows}}
<div class="layui-col-xs2 pic-item">
<div class="layui-col-xs12 pic-item-div-top">
<img class="win-bg-pic sel" src="{{#compare1 picUrl}}{{/compare1}}"/>
</div>
<div class="layui-col-xs12 pic-item-div">
<div>
<a class="layui-btn layui-btn-danger layui-btn-xs del">删除</a>
</div>
</div>
</div>
{{/each}}
\ No newline at end of file
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
......@@ -10,32 +10,19 @@
<body>
<div class="winui-toolbar">
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据1111</button>
<button id="addRole" class="winui-toolbtn"><i class="fa fa-plus" aria-hidden="true"></i>新增角色</button>
<button id="deleteRole" class="winui-toolbtn"><i class="fa fa-trash" aria-hidden="true"></i>删除选中</button>
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
<button id="addBean" class="winui-toolbtn"><i class="fa fa-cloud-upload" aria-hidden="true"></i>新增win系统锁屏桌面图片</button>
</div>
</div>
<div style="margin:auto 10px;">
<table id="role" lay-filter="roletable"></table>
<script type="text/html" id="barRole">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="stateTpl">
{{# if(d.dataState == 1){ }}
正常
{{# } else if(d.dataState==2) { }}
作废
{{# }else{ }}
未知
{{# } }}
</script>
<div class="layui-col-xs12" id="showForm">
</div>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script>
layui.config({
base: '../../js/role/'
}).use('list');
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/sysevewinlockbgpic/'}).use('sysevewinlockbgpiclist');
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册