From 569e0076a58c2cedf8e22bdc66a0b60cadb9750a Mon Sep 17 00:00:00 2001 From: bobi Date: Sun, 3 Nov 2019 19:49:06 +0800 Subject: [PATCH] =?UTF-8?q?del:=E9=9D=A2=E5=8C=85=E5=B1=91=E5=AF=BC?= =?UTF-8?q?=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/common.css | 7 +- lib/layui/lay/okmodules/okLayer.js | 74 ++++---- lib/layui/lay/okmodules/okMock.js | 4 + lib/layui/lay/okmodules/okUtils.js | 52 +++--- pages/member/permission.html | 196 ++++++++++---------- pages/member/role-add.html | 150 ++++++++-------- pages/member/role-auth.html | 79 ++++----- pages/member/role-edit.html | 114 ++++++------ pages/member/role.html | 276 ++++++++++++++--------------- pages/member/user-add.html | 229 ++++++++++++------------ pages/member/user-edit.html | 240 ++++++++++++------------- pages/member/user.html | 31 ++-- 12 files changed, 694 insertions(+), 758 deletions(-) diff --git a/css/common.css b/css/common.css index f452500..a3205a3 100644 --- a/css/common.css +++ b/css/common.css @@ -3,13 +3,8 @@ [v-cloak]{display:none!important} .ok-body{padding:10px} -/*面包屑导航*/ -.ok-body-breadcrumb{position:relative;line-height:39px;height:32px;border-bottom:1px solid #e5e5e5} -.ok-body-breadcrumb .layui-btn{line-height:2.4em;margin-top:3px;float:right} -.ok-body-breadcrumb .layui-btn .layui-icon{line-height:32px} - /*多条件搜索框*/ -.ok-search{margin-top:15px} +/*.ok-search{margin-top:15px}*/ .ok-search .layui-input{width:190px;padding-left:10px;margin-left:10px;float:left} .ok-search .layui-input:first-child{margin-left:0} .ok-search .layui-btn{margin-left:10px} diff --git a/lib/layui/lay/okmodules/okLayer.js b/lib/layui/lay/okmodules/okLayer.js index 68f4f8e..a439d03 100644 --- a/lib/layui/lay/okmodules/okLayer.js +++ b/lib/layui/lay/okmodules/okLayer.js @@ -37,44 +37,42 @@ layui.define(["layer"], function (exports) { /** * msg()函数二次封装 */ - msg: { - // msg弹窗默认消失时间 - time: 1000, - // 绿色勾 - greenTick: function (content, callbackFunction) { - let options = {icon: 1, time: okLayer.msg.time, anim: okLayer.animChoose()}; - layer.msg(content, options, callbackFunction); - }, - // 红色叉 - redCross: function (content, callbackFunction) { - let options = {icon: 2, time: okLayer.msg.time, anim: okLayer.animChoose()}; - layer.msg(content, options, callbackFunction); - }, - // 黄色问号 - yellowQuestion: function (content, callbackFunction) { - let options = {icon: 3, time: okLayer.msg.time, anim: okLayer.animChoose()}; - layer.msg(content, options, callbackFunction); - }, - // 灰色锁 - grayLock: function (content, callbackFunction) { - let options = {icon: 4, time: okLayer.msg.time, anim: okLayer.animChoose()}; - layer.msg(content, options, callbackFunction); - }, - // 红色哭脸 - redCry: function (content, callbackFunction) { - let options = {icon: 5, time: okLayer.msg.time, anim: okLayer.animChoose()}; - layer.msg(content, options, callbackFunction); - }, - // 绿色笑脸 - greenLaugh: function (content, callbackFunction) { - let options = {icon: 6, time: okLayer.msg.time, anim: okLayer.animChoose()}; - layer.msg(content, options, callbackFunction); - }, - // 黄色感叹号 - yellowSigh: function (content, callbackFunction) { - let options = {icon: 7, time: okLayer.msg.time, anim: okLayer.animChoose()}; - layer.msg(content, options, callbackFunction); - } + // msg弹窗默认消失时间 + time: 1000, + // 绿色勾 + greenTickMsg: function (content, callbackFunction) { + let options = {icon: 1, time: okLayer.time, anim: okLayer.animChoose()}; + layer.msg(content, options, callbackFunction); + }, + // 红色叉 + redCrossMsg: function (content, callbackFunction) { + let options = {icon: 2, time: okLayer.time, anim: okLayer.animChoose()}; + layer.msg(content, options, callbackFunction); + }, + // 黄色问号 + yellowQuestionMsg: function (content, callbackFunction) { + let options = {icon: 3, time: okLayer.time, anim: okLayer.animChoose()}; + layer.msg(content, options, callbackFunction); + }, + // 灰色锁 + grayLockMsg: function (content, callbackFunction) { + let options = {icon: 4, time: okLayer.time, anim: okLayer.animChoose()}; + layer.msg(content, options, callbackFunction); + }, + // 红色哭脸 + redCryMsg: function (content, callbackFunction) { + let options = {icon: 5, time: okLayer.time, anim: okLayer.animChoose()}; + layer.msg(content, options, callbackFunction); + }, + // 绿色笑脸 + greenLaughMsg: function (content, callbackFunction) { + let options = {icon: 6, time: okLayer.time, anim: okLayer.animChoose()}; + layer.msg(content, options, callbackFunction); + }, + // 黄色感叹号 + yellowSighMsg: function (content, callbackFunction) { + let options = {icon: 7, time: okLayer.time, anim: okLayer.animChoose()}; + layer.msg(content, options, callbackFunction); }, /** * 皮肤选择 diff --git a/lib/layui/lay/okmodules/okMock.js b/lib/layui/lay/okmodules/okMock.js index cc34af7..c647428 100644 --- a/lib/layui/lay/okmodules/okMock.js +++ b/lib/layui/lay/okmodules/okMock.js @@ -5,6 +5,10 @@ layui.define([], function (exprots) { login: "https://www.easy-mock.com/mock/5d5d0dd46cfcbd1b8627bf1d/ok-admin-v2.0/login", bsgrid: "http://rap2api.taobao.org/app/mock/233041/bsgrid", datatables: "http://rap2api.taobao.org/app/mock/233041/datatables", + listUser: "http://rap2api.taobao.org/app/mock/233041/user/listUser", + listRole: "http://rap2api.taobao.org/app/mock/233041/role/listRole", + + menu: { list: "https://easy-mock.com/mock/5d0ce725424f15399a6c2068/okadmin/menu/list" }, diff --git a/lib/layui/lay/okmodules/okUtils.js b/lib/layui/lay/okmodules/okUtils.js index 7ba54ce..1eb46fe 100644 --- a/lib/layui/lay/okmodules/okUtils.js +++ b/lib/layui/lay/okmodules/okUtils.js @@ -74,36 +74,34 @@ layui.define(["layer"], function (exprots) { }); return deferred.promise(); }, - table: { - /** - * 主要用于针对表格批量操作操作之前的检查 - * @param table - * @returns {string} - */ - batchCheck: function (table) { - var checkStatus = table.checkStatus("tableId"); - var rows = checkStatus.data.length; - if (rows > 0) { - var idsStr = ""; - for (var i = 0; i < checkStatus.data.length; i++) { - idsStr += checkStatus.data[i].id + ","; - } - return idsStr; - } else { - layer.msg("未选择有效数据", {offset: "t", anim: 6}); + /** + * 主要用于针对表格批量操作操作之前的检查 + * @param table + * @returns {string} + */ + tableBatchCheck: function (table) { + var checkStatus = table.checkStatus("tableId"); + var rows = checkStatus.data.length; + if (rows > 0) { + var idsStr = ""; + for (var i = 0; i < checkStatus.data.length; i++) { + idsStr += checkStatus.data[i].id + ","; } - }, - /** - * 在表格页面操作成功后弹窗提示 - * @param content - */ - successMsg: function (content) { - layer.msg(content, {icon: 1, time: 1000}, function () { - // 刷新当前页table数据 - $(".layui-laypage-btn")[0].click(); - }); + return idsStr; + } else { + layer.msg("未选择有效数据", {offset: "t", anim: 6}); } }, + /** + * 在表格页面操作成功后弹窗提示 + * @param content + */ + tableSuccessMsg: function (content) { + layer.msg(content, {icon: 1, time: 1000}, function () { + // 刷新当前页table数据 + $(".layui-laypage-btn")[0].click(); + }); + }, /** * 获取父窗体的okTab * @returns {string} diff --git a/pages/member/permission.html b/pages/member/permission.html index f197133..ce10205 100644 --- a/pages/member/permission.html +++ b/pages/member/permission.html @@ -7,112 +7,112 @@ -
- - -
-
-
+
+ + +
+
+
+
+
+
+
-
- - - + + + - function initPermissionTable() { - table.render({ - elem: '#permissionTable', - url: okMock.api.permission.list, - limit: 20, - page: true, - size: "sm", - cols: [[ - {field: "id", title: "ID", width: 170, sort: true, fixed: "left"}, - {field: "name", title: "权限名称", width: 100}, - {field: "permit", title: "权限标识", width: 150}, - {field: "url", title: "权限路径", width: 150}, - {field: "parentName", title: "父菜单", width: 100}, - {field: "type", title: "类型", width: 100, templet: "#typeTpl"}, - {field: "createTime", title: "创建时间", width: 150}, - {field: "updateTime", title: "创建时间", width: 150}, - {title: "操作", width: 100, templet: "#operationTpl", align: "center", fixed: "right"} - ]], - done: function (res, curr, count) { - console.info(res, curr, count); - } - }); - } - - initPermissionTree(); - }); - - - - - + diff --git a/pages/member/role-add.html b/pages/member/role-add.html index 318c22d..0105612 100644 --- a/pages/member/role-add.html +++ b/pages/member/role-add.html @@ -7,80 +7,88 @@ -
- -
- - 首页 - 会员管理 - 角色列表 - 添加角色 - - - - +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+
+ + +
+
+
- -
-
- -
- -
-
-
- -
- -
-
-
- -
-
-
-
-
-
- - -
-
-
-
- - - + + + form.on("submit(add)", function (data) { + // TODO 权限节点校验 + + // 请求后台 + okUtils.ajax("/role/addRole", "post", data.field, true).done(function (response) { + console.log(response); + okLayer.greenTickMsg("添加成功", function () { + parent.layer.close(parent.layer.getFrameIndex(window.name)); + }); + }).fail(function (error) { + console.log(error) + }); + return false; + }); + }) + diff --git a/pages/member/role-auth.html b/pages/member/role-auth.html index 9a19b13..ae3c195 100644 --- a/pages/member/role-auth.html +++ b/pages/member/role-auth.html @@ -5,55 +5,42 @@ 角色授权 - - + -
- - - -
-
-
- - +
+ + +
+
+ + +
-
- -
- - - + + + layui.use(['element', 'jquery', 'form'], function () { + var element = layui.element; + var $ = layui.jquery; + var form = layui.form; + + form.on('submit(auth)', function (data) { + console.log(data.field); + layer.msg("授权成功!", {icon: 6, time: 1000, anim: 4}, function () { + parent.layer.close(parent.layer.getFrameIndex(window.name)); + }); + return false; + }); + }) + diff --git a/pages/member/role-edit.html b/pages/member/role-edit.html index becc909..0bd881f 100644 --- a/pages/member/role-edit.html +++ b/pages/member/role-edit.html @@ -7,70 +7,58 @@ -
- -
- - 首页 - 常用页面 - 用户列表 - 编辑角色 - - - - +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ + +
+
+
- -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
-
- - -
-
-
-
- - - + + + layui.use(['element', 'form', 'jquery'], function () { + var element = layui.element; + var form = layui.form; + var $ = layui.jquery; + + form.on('submit(edit)', function (data) { + console.log(data.field); + layer.msg("编辑成功!", {icon: 6, time: 1000, anim: 4}, function () { + parent.layer.close(parent.layer.getFrameIndex(window.name)); + }); + return false; + }); + }) + diff --git a/pages/member/role.html b/pages/member/role.html index 415046f..addf105 100644 --- a/pages/member/role.html +++ b/pages/member/role.html @@ -7,159 +7,149 @@ -
- -
- - 首页 - 常用页面 - 角色列表 - - - - +
+ +
+ +
+ +
- -
- -
- -
-
- - - + - - - - + function edit(id) { + okLayer.open("编辑角色", "role-edit.html?id=" + id, "90%", "90%", null, function () { + roleTable.reload(); + }) + } - + function del(id) { + okLayer.confirm("确定要删除吗?", function () { + okUtils.ajax("/user/batchDel", "post", {idsStr: id}, true).done(function (response) { + console.log(response); + okUtils.tableSuccessMsg(response.msg); + }).fail(function (error) { + console.log(error) + }); + }) + } + }) + + + + + + + diff --git a/pages/member/user-add.html b/pages/member/user-add.html index 0f2cd73..d084754 100644 --- a/pages/member/user-add.html +++ b/pages/member/user-add.html @@ -7,129 +7,120 @@ -
- -
- - 首页 - 会员管理 - 用户列表 - 添加用户 - - - - +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+
+ + +
+
+
- -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- - - -
-
-
- -
- -
-
-
- -
- - -
-
-
- -
- -
-
-
-
- - -
-
-
-
- - - + + diff --git a/pages/member/user-edit.html b/pages/member/user-edit.html index 2d5789d..5b15604 100644 --- a/pages/member/user-edit.html +++ b/pages/member/user-edit.html @@ -2,142 +2,130 @@ - 编辑用户 + 更新用户 -
- -
- - 首页 - 会员管理 - 用户列表 - 编辑用户 - - - - +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+
+ + +
+
+
- -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- - - -
-
-
- -
- -
-
-
- -
- - -
-
-
- -
- -
-
-
-
- - -
-
-
-
- - - + + + form.on("submit(edit)", function (data) { + okUtils.ajax("/user/updateUser", "put", data.field, true).done(function (response) { + console.log(response); + okLayer.greenTickMsg("编辑成功", function () { + parent.layer.close(parent.layer.getFrameIndex(window.name)); + }); + }).fail(function (error) { + console.log(error) + }); + return false; + }); + }) + diff --git a/pages/member/user.html b/pages/member/user.html index d151de6..8073de2 100644 --- a/pages/member/user.html +++ b/pages/member/user.html @@ -8,17 +8,6 @@
- -