提交 fc4684b9 编写于 作者: Skyeye云's avatar Skyeye云

用户自定义设置完成

上级 b45b625a
...@@ -30,6 +30,16 @@ public interface SysEveUserDao { ...@@ -30,6 +30,16 @@ public interface SysEveUserDao {
public List<Map<String, Object>> queryDeskTopsMenuByUserId(Map<String, Object> userMation) throws Exception; public List<Map<String, Object>> queryDeskTopsMenuByUserId(Map<String, Object> userMation) throws Exception;
public List<Map<String, Object>> queryAllMenuByUserId(Map<String, Object> userMation) throws Exception; public List<Map<String, Object>> queryAllMenuByUserId(Map<String, Object> userMation) throws Exception;
public int editUserInstallThemeColor(Map<String, Object> map) throws Exception;
public int editUserInstallWinBgPic(Map<String, Object> map) throws Exception;
public int editUserInstallWinLockBgPic(Map<String, Object> map) throws Exception;
public int editUserInstallWinStartMenuSize(Map<String, Object> map) throws Exception;
public int editUserInstallWinTaskPosition(Map<String, Object> map) throws Exception;
......
...@@ -20,4 +20,6 @@ public interface SysEveWinThemeColorDao { ...@@ -20,4 +20,6 @@ public interface SysEveWinThemeColorDao {
public int editSysEveWinThemeColorMationById(Map<String, Object> map) throws Exception; public int editSysEveWinThemeColorMationById(Map<String, Object> map) throws Exception;
public List<Map<String, Object>> querySysEveWinThemeColorListToShow(Map<String, Object> map) throws Exception;
} }
...@@ -28,6 +28,16 @@ public interface SysEveUserService { ...@@ -28,6 +28,16 @@ public interface SysEveUserService {
public void queryDeskTopMenuBySession(InputObject inputObject, OutputObject outputObject) throws Exception; public void queryDeskTopMenuBySession(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryAllMenuBySession(InputObject inputObject, OutputObject outputObject) throws Exception; public void queryAllMenuBySession(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editUserInstallThemeColor(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editUserInstallWinBgPic(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editUserInstallWinLockBgPic(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editUserInstallWinStartMenuSize(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editUserInstallWinTaskPosition(InputObject inputObject, OutputObject outputObject) throws Exception;
......
...@@ -15,4 +15,6 @@ public interface SysEveWinThemeColorService { ...@@ -15,4 +15,6 @@ public interface SysEveWinThemeColorService {
public void editSysEveWinThemeColorMationById(InputObject inputObject, OutputObject outputObject) throws Exception; public void editSysEveWinThemeColorMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void querySysEveWinThemeColorListToShow(InputObject inputObject, OutputObject outputObject) throws Exception;
} }
...@@ -281,6 +281,116 @@ public class SysEveUserServiceImpl implements SysEveUserService{ ...@@ -281,6 +281,116 @@ public class SysEveUserServiceImpl implements SysEveUserService{
List<Map<String, Object>> deskTops = inputObject.getLogAllMenuParams(); List<Map<String, Object>> deskTops = inputObject.getLogAllMenuParams();
outputObject.setBeans(deskTops); outputObject.setBeans(deskTops);
} }
/**
*
* @Title: editUserInstallThemeColor
* @Description: 自定义设置主题颜色
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editUserInstallThemeColor(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams();
map.put("userId", user.get("id"));
//修改reids中的用户信息
user.put("winThemeColor", map.get("themeColor"));
jedisClient.set("userMation:" + user.get("id").toString(), JSON.toJSONString(user));
jedisClient.expire("userMation:" + user.get("id").toString(), 1800);//时间为30分钟
sysEveUserDao.editUserInstallThemeColor(map);
}
/**
*
* @Title: editUserInstallWinBgPic
* @Description: 自定义设置win背景图片
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editUserInstallWinBgPic(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams();
map.put("userId", user.get("id"));
//修改reids中的用户信息
user.put("winBgPicUrl", map.get("winBgPicUrl"));
jedisClient.set("userMation:" + user.get("id").toString(), JSON.toJSONString(user));
jedisClient.expire("userMation:" + user.get("id").toString(), 1800);//时间为30分钟
sysEveUserDao.editUserInstallWinBgPic(map);
}
/**
*
* @Title: editUserInstallWinLockBgPic
* @Description: 自定义设置win锁屏背景图片
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editUserInstallWinLockBgPic(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams();
map.put("userId", user.get("id"));
//修改reids中的用户信息
user.put("winLockBgPicUrl", map.get("winLockBgPicUrl"));
jedisClient.set("userMation:" + user.get("id").toString(), JSON.toJSONString(user));
jedisClient.expire("userMation:" + user.get("id").toString(), 1800);//时间为30分钟
sysEveUserDao.editUserInstallWinLockBgPic(map);
}
/**
*
* @Title: editUserInstallWinStartMenuSize
* @Description: 自定义设置win开始菜单尺寸
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editUserInstallWinStartMenuSize(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams();
map.put("userId", user.get("id"));
//修改reids中的用户信息
user.put("winStartMenuSize", map.get("winStartMenuSize"));
jedisClient.set("userMation:" + user.get("id").toString(), JSON.toJSONString(user));
jedisClient.expire("userMation:" + user.get("id").toString(), 1800);//时间为30分钟
sysEveUserDao.editUserInstallWinStartMenuSize(map);
}
/**
*
* @Title: editUserInstallWinTaskPosition
* @Description: 自定义设置win任务栏在屏幕的位置
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editUserInstallWinTaskPosition(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> user = inputObject.getLogParams();
map.put("userId", user.get("id"));
//修改reids中的用户信息
user.put("winTaskPosition", map.get("winTaskPosition"));
jedisClient.set("userMation:" + user.get("id").toString(), JSON.toJSONString(user));
jedisClient.expire("userMation:" + user.get("id").toString(), 1800);//时间为30分钟
sysEveUserDao.editUserInstallWinTaskPosition(map);
}
......
...@@ -118,5 +118,25 @@ public class SysEveWinThemeColorServiceImpl implements SysEveWinThemeColorServic ...@@ -118,5 +118,25 @@ public class SysEveWinThemeColorServiceImpl implements SysEveWinThemeColorServic
outputObject.setreturnMessage("该win系统主题颜色名称已存在,不可进行二次保存"); outputObject.setreturnMessage("该win系统主题颜色名称已存在,不可进行二次保存");
} }
} }
/**
*
* @Title: querySysEveWinThemeColorListToShow
* @Description: 获取win系统主题颜色列表供展示
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void querySysEveWinThemeColorListToShow(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> beans = sysEveWinThemeColorDao.querySysEveWinThemeColorListToShow(map);
if(beans != null && !beans.isEmpty()){
outputObject.setBeans(beans);
outputObject.settotal(beans.size());
}
}
} }
...@@ -207,4 +207,84 @@ public class SysEveUserController { ...@@ -207,4 +207,84 @@ public class SysEveUserController {
sysEveUserService.queryAllMenuBySession(inputObject, outputObject); sysEveUserService.queryAllMenuBySession(inputObject, outputObject);
} }
/**
*
* @Title: editUserInstallThemeColor
* @Description: 自定义设置主题颜色
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveUserController/editUserInstallThemeColor")
@ResponseBody
public void editUserInstallThemeColor(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveUserService.editUserInstallThemeColor(inputObject, outputObject);
}
/**
*
* @Title: editUserInstallWinBgPic
* @Description: 自定义设置win背景图片
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveUserController/editUserInstallWinBgPic")
@ResponseBody
public void editUserInstallWinBgPic(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveUserService.editUserInstallWinBgPic(inputObject, outputObject);
}
/**
*
* @Title: editUserInstallWinLockBgPic
* @Description: 自定义设置win锁屏背景图片
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveUserController/editUserInstallWinLockBgPic")
@ResponseBody
public void editUserInstallWinLockBgPic(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveUserService.editUserInstallWinLockBgPic(inputObject, outputObject);
}
/**
*
* @Title: editUserInstallWinStartMenuSize
* @Description: 自定义设置win开始菜单尺寸
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveUserController/editUserInstallWinStartMenuSize")
@ResponseBody
public void editUserInstallWinStartMenuSize(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveUserService.editUserInstallWinStartMenuSize(inputObject, outputObject);
}
/**
*
* @Title: editUserInstallWinTaskPosition
* @Description: 自定义设置win任务栏在屏幕的位置
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveUserController/editUserInstallWinTaskPosition")
@ResponseBody
public void editUserInstallWinTaskPosition(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveUserService.editUserInstallWinTaskPosition(inputObject, outputObject);
}
} }
...@@ -94,4 +94,20 @@ public class SysEveWinThemeColorController { ...@@ -94,4 +94,20 @@ public class SysEveWinThemeColorController {
sysEveWinThemeColorService.editSysEveWinThemeColorMationById(inputObject, outputObject); sysEveWinThemeColorService.editSysEveWinThemeColorMationById(inputObject, outputObject);
} }
/**
*
* @Title: querySysEveWinThemeColorListToShow
* @Description: 获取win系统主题颜色列表供展示
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveWinThemeColorController/querySysEveWinThemeColorListToShow")
@ResponseBody
public void querySysEveWinThemeColorListToShow(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveWinThemeColorService.querySysEveWinThemeColorListToShow(inputObject, outputObject);
}
} }
...@@ -87,7 +87,10 @@ ...@@ -87,7 +87,10 @@
a.`password`, a.`password`,
a.user_lock userLock, a.user_lock userLock,
b.win_bg_pic_url winBgPicUrl, b.win_bg_pic_url winBgPicUrl,
b.win_lock_bg_pic_url winLockBgPicUrl b.win_lock_bg_pic_url winLockBgPicUrl,
b.win_theme_color winThemeColor,
b.win_start_menu_size winStartMenuSize,
b.win_task_position winTaskPosition
FROM FROM
sys_eve_user a sys_eve_user a
LEFT JOIN sys_eve_user_install b ON a.id = b.user_id LEFT JOIN sys_eve_user_install b ON a.id = b.user_id
...@@ -171,4 +174,44 @@ ...@@ -171,4 +174,44 @@
ORDER BY c.order_num ASC ORDER BY c.order_num ASC
</select> </select>
<update id="editUserInstallThemeColor" parameterType="java.util.Map">
UPDATE sys_eve_user_install
<set>
win_theme_color = #{themeColor}
</set>
WHERE user_id = #{userId}
</update>
<update id="editUserInstallWinBgPic" parameterType="java.util.Map">
UPDATE sys_eve_user_install
<set>
win_bg_pic_url = #{winBgPicUrl}
</set>
WHERE user_id = #{userId}
</update>
<update id="editUserInstallWinLockBgPic" parameterType="java.util.Map">
UPDATE sys_eve_user_install
<set>
win_lock_bg_pic_url = #{winLockBgPicUrl}
</set>
WHERE user_id = #{userId}
</update>
<update id="editUserInstallWinStartMenuSize" parameterType="java.util.Map">
UPDATE sys_eve_user_install
<set>
win_start_menu_size = #{winStartMenuSize}
</set>
WHERE user_id = #{userId}
</update>
<update id="editUserInstallWinTaskPosition" parameterType="java.util.Map">
UPDATE sys_eve_user_install
<set>
win_task_position = #{winTaskPosition}
</set>
WHERE user_id = #{userId}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -70,4 +70,13 @@ ...@@ -70,4 +70,13 @@
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<select id="querySysEveWinThemeColorListToShow" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.color_class colorClass
FROM
sys_eve_win_theme_color a
ORDER BY a.create_time DESC
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -135,6 +135,22 @@ ...@@ -135,6 +135,22 @@
<property id="rowId" name="id" ref="required" var="菜单ID" /> <property id="rowId" name="id" ref="required" var="菜单ID" />
</url> </url>
<url id="sys024" path="/post/SysEveUserController/editUserInstallThemeColor" val="自定义设置主题颜色" allUse="1">
<property id="themeColor" name="themeColor" ref="required,num" var="颜色的color数字" />
</url>
<url id="sys025" path="/post/SysEveUserController/editUserInstallWinBgPic" val="自定义设置win背景图片" allUse="1">
<property id="winBgPicUrl" name="winBgPicUrl" ref="required" var="图片url链接" />
</url>
<url id="sys026" path="/post/SysEveUserController/editUserInstallWinLockBgPic" val="自定义设置win锁屏背景图片" allUse="1">
<property id="winLockBgPicUrl" name="winLockBgPicUrl" ref="required" var="图片url链接" />
</url>
<url id="sys027" path="/post/SysEveUserController/editUserInstallWinStartMenuSize" val="自定义设置win开始菜单尺寸" allUse="1">
<property id="winStartMenuSize" name="winStartMenuSize" ref="required" var="尺寸size" />
</url>
<url id="sys028" path="/post/SysEveUserController/editUserInstallWinTaskPosition" val="自定义设置win任务栏在屏幕的位置" allUse="1">
<property id="winTaskPosition" name="winTaskPosition" ref="required" var="位置属性" />
</url>
<url id="icon001" path="/post/SysEveIconController/querySysIconList" val="获取ICON列表" allUse="1"> <url id="icon001" path="/post/SysEveIconController/querySysIconList" val="获取ICON列表" allUse="1">
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" /> <property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/> <property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
...@@ -225,6 +241,8 @@ ...@@ -225,6 +241,8 @@
<property id="rowId" name="id" ref="required" var="win系统主题颜色id"/> <property id="rowId" name="id" ref="required" var="win系统主题颜色id"/>
<property id="colorClass" name="colorClass" ref="required" var="win系统主题颜色属性"/> <property id="colorClass" name="colorClass" ref="required" var="win系统主题颜色属性"/>
</url> </url>
<url id="sysevewinthemecolor006" path="/post/SysEveWinThemeColorController/querySysEveWinThemeColorListToShow" val="获取win系统主题颜色列表供展示" allUse="1">
</url>
<!-- 系统角色用户管理结束 --> <!-- 系统角色用户管理结束 -->
<!-- 系统数据库管理开始 --> <!-- 系统数据库管理开始 -->
......
...@@ -4,10 +4,9 @@ ...@@ -4,10 +4,9 @@
; !function () { ; !function () {
"use strict"; "use strict";
var THIS = 'winui-this', SHOW = 'layui-show', MOVE = '.layui-layer-title', MOD_NAME = 'winui', taskbarHeight = 40 var THIS = 'winui-this', SHOW = 'layui-show', MOVE = '.layui-layer-title', MOD_NAME = 'winui', taskbarHeight = 40,
//获取winui路径 //获取winui路径
, getPath = function () { getPath = function () {
var doc = document; var doc = document;
var jsPath = doc.currentScript ? doc.currentScript.src : function () { var jsPath = doc.currentScript ? doc.currentScript.src : function () {
var js = doc.scripts, last = js.length - 1, src; var js = doc.scripts, last = js.length - 1, src;
...@@ -20,40 +19,37 @@ ...@@ -20,40 +19,37 @@
return src || js[last].src; return src || js[last].src;
}(); }();
return jsPath.substring(0, jsPath.lastIndexOf('/') + 1); return jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
}() }(),
//判断变量是否是Dom对象 //判断变量是否是Dom对象
, isDom = (typeof HTMLElement === 'object') ? function (obj) { isDom = (typeof HTMLElement === 'object') ? function (obj) {
return obj instanceof HTMLElement; return obj instanceof HTMLElement;
} : function (obj) { } : function (obj) {
return (obj && typeof obj === 'object' && obj.nodeType === 1 && typeof obj.nodeName === 'string'); return (obj && typeof obj === 'object' && obj.nodeType === 1 && typeof obj.nodeName === 'string');
} },
//判断变量是否是Jq对象 //判断变量是否是Jq对象
, isJquery = function (obj) { isJquery = function (obj) {
return obj instanceof $; return obj instanceof $;
} }
layui.define(['jquery', 'layer', 'element', 'form'], function (exports) { layui.define(['jquery', 'layer', 'element', 'form'], function (exports) {
var $ = layui.jquery, form = layui.form var $ = layui.jquery, form = layui.form,
//开始磁贴 //开始磁贴
, tile = { tile = {
data: null, data: null,
setData: function (options) { setData: function (options) {
common.setData(this, '/json/tile-item.json', options); common.setData(this, '/json/tile-item.json', options);
} }
} },
//任务栏 //任务栏
, taskItem = { taskItem = {
on: function (eventname, callback) { on: function (eventname, callback) {
call.on('taskItem(' + eventname + ')', callback); call.on('taskItem(' + eventname + ')', callback);
} }
} },
//tab //tab
, tab = { tab = {
init: function () { init: function () {
//Tab单击事件 //Tab单击事件
common.resetClick('.winui-tab-nav li', function () { common.resetClick('.winui-tab-nav li', function () {
...@@ -77,7 +73,7 @@ ...@@ -77,7 +73,7 @@
var Winui = function () { var Winui = function () {
this.v = '1.0.0'; //版本号 this.v = '1.0.0'; //版本号
this.path = getPath; this.path = getPath;
this.settings = layui.data('winui').settings || { this.settings = {
color: 31, color: 31,
taskbarMode: 'bottom', taskbarMode: 'bottom',
bgSrc: '../assets/winbgpic/default.jpg', bgSrc: '../assets/winbgpic/default.jpg',
...@@ -91,36 +87,36 @@ ...@@ -91,36 +87,36 @@
required: [ required: [
/[\S]+/ /[\S]+/
, '必填项不能为空' , '必填项不能为空'
] ],
, phone: [ phone: [
/^1\d{10}$/ /^1\d{10}$/
, '请输入正确的手机号' , '请输入正确的手机号'
] ],
, email: [ email: [
/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/ /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
, '邮箱格式不正确' , '邮箱格式不正确'
] ],
, url: [ url: [
/(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/ /(^#)|(^http(s*):\/\/[^\s]+\.[^\s]+)/
, '链接格式不正确' , '链接格式不正确'
] ],
, number: [ number: [
/^\d+$/ /^\d+$/
, '只能填写数字' , '只能填写数字'
] ],
, date: [ date: [
/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/ /^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/
, '日期格式不正确' , '日期格式不正确'
] ],
, identity: [ identity: [
/(^\d{15}$)|(^\d{17}(x|X|\d)$)/ /(^\d{15}$)|(^\d{17}(x|X|\d)$)/
, '请输入正确的身份证号' , '请输入正确的身份证号'
] ],
, double: [//验证小数点后两位,一般用于金钱验证 double: [//验证小数点后两位,一般用于金钱验证
/^[0-9]+(.[0-9]{1,2})?$/ /^[0-9]+(.[0-9]{1,2})?$/
, '请输入正确正数,小数点后最多两位' , '请输入正确正数,小数点后最多两位'
] ],
, postcode: [ postcode: [
/^\d{6}$/ /^\d{6}$/
, '请输入正确邮编' , '请输入正确邮编'
] ]
...@@ -148,10 +144,10 @@ ...@@ -148,10 +144,10 @@
this.settings[key] = settings[key]; this.settings[key] = settings[key];
} }
return this; return this;
} },
//初始化 //初始化
, init: function (options, callback) { init: function (options, callback) {
var othis = this; var othis = this;
var configs = othis.configs, var configs = othis.configs,
settings = othis.settings, settings = othis.settings,
...@@ -229,14 +225,12 @@ ...@@ -229,14 +225,12 @@
//初始化完毕回调 //初始化完毕回调
if (typeof callback === 'function') if (typeof callback === 'function')
callback.call(othis); callback.call(othis);
} },
//重置主题色 //重置主题色
, resetColor: function (color) { resetColor: function (color) {
if (color) { if (color) {
this.settings.color = color; this.settings.color = color;
//缓存数据
layui.data('winui', { key: 'settings', value: this.settings });
} }
this.renderColor(); this.renderColor();
//重置所有iframe的颜色 //重置所有iframe的颜色
...@@ -246,35 +240,33 @@ ...@@ -246,35 +240,33 @@
window.frames[i].winui.renderColor(); window.frames[i].winui.renderColor();
} }
} }
} },
//渲染主题色 //渲染主题色
, renderColor: function () { renderColor: function () {
if (this.settings.color) { if (this.settings.color) {
if ($('body').attr('class')) { if ($('body').attr('class')) {
$('body').attr('class', $('body').attr('class').replace(/\bwinui-color.*?\b/g, '').replace(/(^\s*)|(\s*$)/g, "")); $('body').attr('class', $('body').attr('class').replace(/\bwinui-color.*?\b/g, '').replace(/(^\s*)|(\s*$)/g, ""));
} }
$('body').addClass('winui-color' + this.settings.color); $('body').addClass('winui-color' + this.settings.color);
} }
} },
//重置任务栏模式 //重置任务栏模式
, resetTaskbar: function (taskbarMode) { resetTaskbar: function (taskbarMode) {
if (taskbarMode) { if (taskbarMode) {
if (this.settings.taskbarMode === taskbarMode) if (this.settings.taskbarMode === taskbarMode)
return; return;
this.settings.taskbarMode = taskbarMode; this.settings.taskbarMode = taskbarMode;
//缓存数据
layui.data('winui', { key: 'settings', value: this.settings });
} }
this.renderTaskbar(); this.renderTaskbar();
if (taskbarMode) { if (taskbarMode) {
this.taskbarChange(); this.taskbarChange();
} }
} },
//渲染任务栏模式 //渲染任务栏模式
, renderTaskbar: function () { renderTaskbar: function () {
if ($('body').attr('class')) { if ($('body').attr('class')) {
$('body').attr('class', $('body').attr('class').replace(/\btaskbarIn.*?\b/g, '').replace(/(^\s*)|(\s*$)/g, "")); $('body').attr('class', $('body').attr('class').replace(/\btaskbarIn.*?\b/g, '').replace(/(^\s*)|(\s*$)/g, ""));
} }
...@@ -292,25 +284,23 @@ ...@@ -292,25 +284,23 @@
default: default:
$('body').addClass('taskbarInBottom'); $('body').addClass('taskbarInBottom');
} }
} },
//重置开始菜单尺寸 //重置开始菜单尺寸
, resetStartSize: function (startSize) { resetStartSize: function (startSize) {
if (startSize) { if (startSize) {
if (this.settings.startSize === startSize) if (this.settings.startSize === startSize)
return; return;
this.settings.startSize = startSize; this.settings.startSize = startSize;
//缓存数据
layui.data('winui', { key: 'settings', value: this.settings });
$('.preview-start').removeClass('xs sm lg'); $('.preview-start').removeClass('xs sm lg');
$('.preview-start').addClass(startSize); $('.preview-start').addClass(startSize);
} }
this.renderStartSize(); this.renderStartSize();
} },
//渲染开始菜单尺寸 //渲染开始菜单尺寸
, renderStartSize: function () { renderStartSize: function () {
if ($('.winui-start').attr('class')) { if ($('.winui-start').attr('class')) {
$('.winui-start').attr('class', $('.winui-start').attr('class').replace(/\winui-start-size.*?\b/g, '').replace(/(^\s*)|(\s*$)/g, "")); //去掉winui-start-size的class后去除两边空格 $('.winui-start').attr('class', $('.winui-start').attr('class').replace(/\winui-start-size.*?\b/g, '').replace(/(^\s*)|(\s*$)/g, "")); //去掉winui-start-size的class后去除两边空格
} }
...@@ -323,36 +313,32 @@ ...@@ -323,36 +313,32 @@
break; break;
default: default:
} }
} },
//重置背景图 //重置背景图
, resetBg: function (bgSrc) { resetBg: function (bgSrc) {
if (bgSrc) { if (bgSrc) {
this.settings.bgSrc = bgSrc; this.settings.bgSrc = bgSrc;
//缓存数据
layui.data('winui', { key: 'settings', value: this.settings });
} }
this.renderBg(); this.renderBg();
} },
//渲染背景图 //渲染背景图
, renderBg: function () { renderBg: function () {
var bgSrc = this.settings.bgSrc; var bgSrc = this.settings.bgSrc;
if (bgSrc) if (bgSrc)
$('body').css('background-image', 'url(' + bgSrc + ')'); $('body').css('background-image', 'url(' + bgSrc + ')');
} },
//重置锁屏图 //重置锁屏图
, resetLockBg: function (bgSrc) { resetLockBg: function (bgSrc) {
if (bgSrc) { if (bgSrc) {
this.settings.lockBgSrc = bgSrc; this.settings.lockBgSrc = bgSrc;
//缓存数据
layui.data('winui', { key: 'settings', value: this.settings });
} }
} },
//全屏 //全屏
, fullScreen: function (element) { fullScreen: function (element) {
// 判断各种浏览器,找到正确的方法 // 判断各种浏览器,找到正确的方法
var requestMethod = element.requestFullScreen || //W3C var requestMethod = element.requestFullScreen || //W3C
element.webkitRequestFullScreen || //Chrome等 element.webkitRequestFullScreen || //Chrome等
...@@ -367,10 +353,10 @@ ...@@ -367,10 +353,10 @@
wscript.SendKeys("{F11}"); wscript.SendKeys("{F11}");
} }
} }
} },
//退出全屏 //退出全屏
, exitFullScreen: function () { exitFullScreen: function () {
// 判断各种浏览器,找到正确的方法 // 判断各种浏览器,找到正确的方法
var exitMethod = document.exitFullscreen || //W3C var exitMethod = document.exitFullscreen || //W3C
document.mozCancelFullScreen || //Chrome等 document.mozCancelFullScreen || //Chrome等
...@@ -385,23 +371,23 @@ ...@@ -385,23 +371,23 @@
wscript.SendKeys("{F11}"); wscript.SendKeys("{F11}");
} }
} }
} },
//隐藏开始菜单 //隐藏开始菜单
, hideStartMenu: function () { hideStartMenu: function () {
$('.winui-start').addClass('layui-hide'); $('.winui-start').addClass('layui-hide');
} },
//返回GUID //返回GUID
, guid: function () { guid: function () {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16); return v.toString(16);
}); });
} },
//验证表单 //验证表单
, verifyForm: function (button) { verifyForm: function (button) {
var button = $(button), var button = $(button),
stop = null, stop = null,
device = layui.device(), device = layui.device(),
...@@ -431,10 +417,10 @@ ...@@ -431,10 +417,10 @@
if (stop) return stop; if (stop) return stop;
}); });
return !stop; return !stop;
} },
//显示系统时间 //显示系统时间
, sysTime: function (selector, formatStr) { sysTime: function (selector, formatStr) {
return setInterval(function () { return setInterval(function () {
//获取系统时间。 //获取系统时间。
var dateTime = new Date(); var dateTime = new Date();
...@@ -477,15 +463,15 @@ ...@@ -477,15 +463,15 @@
//将时间显示到指定的位置,时间格式形如:19:18:02 //将时间显示到指定的位置,时间格式形如:19:18:02
$(selector).html(str); $(selector).html(str);
}, 1000); }, 1000);
} },
//停止显示时间 //停止显示时间
, stopSysTime: function (obj) { stopSysTime: function (obj) {
window.clearInterval(obj); window.clearInterval(obj);
} },
//任务栏自适应 //任务栏自适应
, taskAuto: function () { taskAuto: function () {
var res = true; var res = true;
$('.winui-taskbar-task').each(function () { $('.winui-taskbar-task').each(function () {
var thisWidth = parseInt($(this).prop('scrollWidth')); var thisWidth = parseInt($(this).prop('scrollWidth'));
...@@ -498,10 +484,10 @@ ...@@ -498,10 +484,10 @@
} }
}); });
return res; return res;
} },
//任务栏改变 //任务栏改变
, taskbarChange: function () { taskbarChange: function () {
//根据任务栏模式调整位置 //根据任务栏模式调整位置
switch (this.settings.taskbarMode) { switch (this.settings.taskbarMode) {
case 'top': case 'top':
...@@ -520,15 +506,15 @@ ...@@ -520,15 +506,15 @@
break; break;
default: default:
} }
} },
//获取Winui设置 //获取Winui设置
, getSetting: function (settingKey) { getSetting: function (settingKey) {
return this.settings[settingKey]; return this.settings[settingKey];
} },
//锁屏 //锁屏
, lockScreen: function (callback) { lockScreen: function (callback) {
var self = this; var self = this;
$('.winui-taskbar').css('zIndex', '0'); $('.winui-taskbar').css('zIndex', '0');
$.get(winui.path + '../../../tpl/index/lockscreen.html', {}, function (content) { $.get(winui.path + '../../../tpl/index/lockscreen.html', {}, function (content) {
...@@ -838,13 +824,9 @@ ...@@ -838,13 +824,9 @@
//阻止冒泡 //阻止冒泡
$('.sp').off('click mousedown').on('click mousedown', call.sp); $('.sp').off('click mousedown').on('click mousedown', call.sp);
window.winui = new Winui(); window.winui = new Winui();
winui.tab.init(); winui.tab.init();
exports('winui', {}); exports('winui', {});
delete layui.winui; delete layui.winui;
}); });
}(window); }(window);
......
...@@ -59,13 +59,13 @@ ...@@ -59,13 +59,13 @@
}); });
winui.config({ winui.config({
settings: layui.data('winui').settings || { settings: {
color: 32, color: json.bean.winThemeColor,
taskbarMode: 'bottom', taskbarMode: json.bean.winTaskPosition,
startSize: 'sm', startSize: json.bean.winStartMenuSize,
bgSrc: json.bean.winBgPicUrl, bgSrc: json.bean.winBgPicUrl,
lockBgSrc: json.bean.winLockBgPicUrl lockBgSrc: json.bean.winLockBgPicUrl
}, //如果本地配置为空则给默认值 },
desktop: {//桌面菜单栏 desktop: {//桌面菜单栏
options: { options: {
url: reqBasePath + 'login004', url: reqBasePath + 'login004',
......
...@@ -45,8 +45,14 @@ layui.config({ ...@@ -45,8 +45,14 @@ layui.config({
}, },
options: {'click .bgPicItem':function(index, row){ options: {'click .bgPicItem':function(index, row){
var bgSrc = row.picUrl; var bgSrc = row.picUrl;
$('.background-preview').css('background-image', 'url(' + bgSrc + ')'); AjaxPostUtil.request({url:reqBasePath + "sys025", params:{winBgPicUrl: bgSrc}, type:'json', callback:function(json){
winui.resetBg(bgSrc); if(json.returnCode == 0){
$('.background-preview').css('background-image', 'url(' + bgSrc + ')');
winui.resetBg(bgSrc);
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
} }
}, },
ajaxSendAfter:function(json){ ajaxSendAfter:function(json){
...@@ -65,12 +71,42 @@ layui.config({ ...@@ -65,12 +71,42 @@ layui.config({
}, },
options: {'click .lockBgPicItem':function(index, row){ options: {'click .lockBgPicItem':function(index, row){
var bgSrc = row.picUrl; var bgSrc = row.picUrl;
$('.lockscreen-preview').css('background-image', 'url(' + bgSrc + ')'); AjaxPostUtil.request({url:reqBasePath + "sys026", params:{winLockBgPicUrl: bgSrc}, type:'json', callback:function(json){
winui.resetLockBg(bgSrc); if(json.returnCode == 0){
$('.lockscreen-preview').css('background-image', 'url(' + bgSrc + ')');
winui.resetLockBg(bgSrc);
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
} }
}, },
ajaxSendAfter:function(json){ ajaxSendAfter:function(json){
initCustomLockBackGroundPic(); initCustomLockBackGroundPic();
//初始化主题色
showGrid({
id: "color-choose",
url: reqBasePath + "sysevewinthemecolor006",
params: {},
pagination: false,
template: getFileContent('tpl/systheme/color-choose.tpl'),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
//颜色选择
$('.color-choose>div').on('click', function () {
var color = Number($(this)[0].classList[0].replace('theme-color-', ''));
AjaxPostUtil.request({url:reqBasePath + "sys024", params:{themeColor: color}, type:'json', callback:function(json){
if(json.returnCode == 0){
winui.resetColor(color);
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
});
} }
}); });
} }
...@@ -109,8 +145,14 @@ layui.config({ ...@@ -109,8 +145,14 @@ layui.config({
}); });
}, 'click .bgPicItem1':function(index, row){ }, 'click .bgPicItem1':function(index, row){
var bgSrc = row.picUrl; var bgSrc = row.picUrl;
$('.background-preview').css('background-image', 'url(' + bgSrc + ')'); AjaxPostUtil.request({url:reqBasePath + "sys025", params:{winBgPicUrl: bgSrc}, type:'json', callback:function(json){
winui.resetBg(bgSrc); if(json.returnCode == 0){
$('.background-preview').css('background-image', 'url(' + bgSrc + ')');
winui.resetBg(bgSrc);
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
} }
}, },
ajaxSendAfter:function(json){ ajaxSendAfter:function(json){
...@@ -145,8 +187,14 @@ layui.config({ ...@@ -145,8 +187,14 @@ layui.config({
}); });
}, 'click .lockBgPicItem1':function(index, row){ }, 'click .lockBgPicItem1':function(index, row){
var bgSrc = row.picUrl; var bgSrc = row.picUrl;
$('.lockscreen-preview').css('background-image', 'url(' + bgSrc + ')'); AjaxPostUtil.request({url:reqBasePath + "sys026", params:{winLockBgPicUrl: bgSrc}, type:'json', callback:function(json){
winui.resetLockBg(bgSrc); if(json.returnCode == 0){
$('.lockscreen-preview').css('background-image', 'url(' + bgSrc + ')');
winui.resetLockBg(bgSrc);
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
} }
}, },
ajaxSendAfter:function(json){ ajaxSendAfter:function(json){
...@@ -206,49 +254,25 @@ layui.config({ ...@@ -206,49 +254,25 @@ layui.config({
} }
}); });
//颜色选择
$('.color-choose>div').on('click', function () {
var color = Number($(this)[0].classList[0].replace('theme-color-', ''));
winui.resetColor(color);
});
form.on('switch(toggleTransparent)', function (data) {
if (data.elem.checked) {
$(data.elem).siblings('span').text('');
} else {
$(data.elem).siblings('span').text('');
}
layer.msg(unfinished);
});
form.on('switch(toggleTaskbar)', function (data) {
if (data.elem.checked) {
$(data.elem).siblings('span').text('');
} else {
$(data.elem).siblings('span').text('');
}
});
//任务栏位置 //任务栏位置
form.on('radio(taskPosition)', function (data) { form.on('radio(taskPosition)', function (data) {
switch (data.value) { AjaxPostUtil.request({url:reqBasePath + "sys028", params:{winTaskPosition: data.value}, type:'json', callback:function(json){
case 'top': if(json.returnCode == 0){
winui.resetTaskbar(data.value); winui.resetTaskbar(data.value);
break; }else{
case 'bottom': top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
winui.resetTaskbar(data.value); }
break; }});
case 'left':
winui.window.msg(unfinished);
break;
case 'right':
winui.window.msg(unfinished);
break;
default:
}
}); });
//开始菜单尺寸 //开始菜单尺寸
form.on('radio(startSize)', function (data) { form.on('radio(startSize)', function (data) {
winui.resetStartSize(data.value); AjaxPostUtil.request({url:reqBasePath + "sys027", params:{winStartMenuSize: data.value}, type:'json', callback:function(json){
if(json.returnCode == 0){
winui.resetStartSize(data.value);
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}); });
}); });
}); });
\ No newline at end of file
{{#each rows}}
<div class="{{colorClass}}"></div>
{{/each}}
\ No newline at end of file
<script> <script>
layui.link(winui.path + 'css/theme.css'); layui.link(winui.path + 'css/theme.css');
</script> </script>
<div class="winui-tab" style="height:100%"> <div class="winui-tab" style="height:100%">
<div class="winui-tab-left"> <div class="winui-tab-left">
<div class="winui-tab-title">主题</div> <div class="winui-tab-title">主题</div>
...@@ -22,9 +21,7 @@ ...@@ -22,9 +21,7 @@
<div class="winui-tab-item layui-show"> <div class="winui-tab-item layui-show">
<h1>预览</h1> <h1>预览</h1>
<div class="background-preview"> <div class="background-preview">
<div class="preview-start"> <div class="preview-start"></div>
</div>
<div class="preview-window"> <div class="preview-window">
<div class="preview-window-title"><p></p></div> <div class="preview-window-title"><p></p></div>
<span>示例文本</span> <span>示例文本</span>
...@@ -44,9 +41,7 @@ ...@@ -44,9 +41,7 @@
<div class="winui-tab-item"> <div class="winui-tab-item">
<h1>预览</h1> <h1>预览</h1>
<div class="background-preview"> <div class="background-preview">
<div class="preview-start"> <div class="preview-start"></div>
</div>
<div class="preview-window"> <div class="preview-window">
<div class="preview-window-title"><p></p></div> <div class="preview-window-title"><p></p></div>
<span>示例文本</span> <span>示例文本</span>
...@@ -54,56 +49,7 @@ ...@@ -54,56 +49,7 @@
<div class="preview-taskbar"></div> <div class="preview-taskbar"></div>
</div> </div>
<h2>主题色</h2> <h2>主题色</h2>
<div class="color-choose"> <div class="color-choose" id="color-choose"></div>
<div class="theme-color-11"></div>
<div class="theme-color-12"></div>
<div class="theme-color-13"></div>
<div class="theme-color-14"></div>
<div class="theme-color-15"></div>
<div class="theme-color-16"></div>
<div class="theme-color-17"></div>
<div class="theme-color-18"></div>
<div class="theme-color-21"></div>
<div class="theme-color-22"></div>
<div class="theme-color-23"></div>
<div class="theme-color-24"></div>
<div class="theme-color-25"></div>
<div class="theme-color-26"></div>
<div class="theme-color-27"></div>
<div class="theme-color-28"></div>
<div class="theme-color-31"></div>
<div class="theme-color-32"></div>
<div class="theme-color-33"></div>
<div class="theme-color-34"></div>
<div class="theme-color-35"></div>
<div class="theme-color-36"></div>
<div class="theme-color-37"></div>
<div class="theme-color-38"></div>
<div class="theme-color-41"></div>
<div class="theme-color-42"></div>
<div class="theme-color-43"></div>
<div class="theme-color-44"></div>
<div class="theme-color-45"></div>
<div class="theme-color-46"></div>
<div class="theme-color-47"></div>
<div class="theme-color-48"></div>
<div class="theme-color-51"></div>
<div class="theme-color-52"></div>
<div class="theme-color-53"></div>
<div class="theme-color-54"></div>
<div class="theme-color-55"></div>
<div class="theme-color-56"></div>
<div class="theme-color-57"></div>
<div class="theme-color-58"></div>
</div>
<h2>显示"开始"菜单、任务栏和操作中心颜色(未实现)</h2>
<div class="layui-form winui-switch">
<input type="checkbox" lay-filter="toggleTransparent" lay-skin="switch" checked><span style="margin-left:15px; vertical-align:middle"></span>
</div>
<h2>显示标题栏颜色(未实现)</h2>
<div class="layui-form winui-switch">
<input type="checkbox" lay-filter="toggleTransparent" lay-skin="switch" checked><span style="margin-left:15px; vertical-align:middle"></span>
</div>
</div> </div>
<!-- 锁屏界面 --> <!-- 锁屏界面 -->
<div class="winui-tab-item"> <div class="winui-tab-item">
...@@ -124,9 +70,7 @@ ...@@ -124,9 +70,7 @@
<div class="winui-tab-item"> <div class="winui-tab-item">
<h1>预览</h1> <h1>预览</h1>
<div class="background-preview"> <div class="background-preview">
<div class="preview-start"> <div class="preview-start"></div>
</div>
<div class="preview-window"> <div class="preview-window">
<div class="preview-window-title"><p></p></div> <div class="preview-window-title"><p></p></div>
<span>示例文本</span> <span>示例文本</span>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册