From ee74764435721e5949802918ff419d194a95bff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E4=B8=B9ab?= <1421553879@qq.com> Date: Thu, 13 Oct 2022 21:42:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/plugins/jquery.cookie.js | 89 +++++++ .../jlw/web/query/UniversityFacultyQuery.java | 8 +- .../static/js/jlw/courseInfo/index.js | 81 ++++--- .../jlw/resourcesApplicationCourse/index.js | 225 ++++++++++++++---- .../jlw/resourcesApplicationCourse/add.html | 69 +++++- .../templates/jlw/universitySystem/index.html | 13 + 6 files changed, 383 insertions(+), 102 deletions(-) create mode 100644 admin-core/src/main/resources/static/plugins/jquery.cookie.js diff --git a/admin-core/src/main/resources/static/plugins/jquery.cookie.js b/admin-core/src/main/resources/static/plugins/jquery.cookie.js new file mode 100644 index 00000000..7b3e7012 --- /dev/null +++ b/admin-core/src/main/resources/static/plugins/jquery.cookie.js @@ -0,0 +1,89 @@ +/*jslint browser: true */ /*global jQuery: true */ + +/** + * jQuery Cookie plugin + * + * Copyright (c) 2010 Klaus Hartl (stilbuero.de) + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + */ + +// TODO JsDoc + +/** + * Create a cookie with the given key and value and other optional parameters. + * + * @example $.cookie('the_cookie', 'the_value'); + * @desc Set the value of a cookie. + * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); + * @desc Create a cookie with all available options. + * @example $.cookie('the_cookie', 'the_value'); + * @desc Create a session cookie. + * @example $.cookie('the_cookie', null); + * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain + * used when the cookie was set. + * + * @param String key The key of the cookie. + * @param String value The value of the cookie. + * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. + * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. + * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. + * If set to null or omitted, the cookie will be a session cookie and will not be retained + * when the the browser exits. + * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). + * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). + * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will + * require a secure protocol (like HTTPS). + * @type undefined + * + * @name $.cookie + * @cat Plugins/Cookie + * @author Klaus Hartl/klaus.hartl@stilbuero.de + */ + +/** + * Get the value of a cookie with the given key. + * + * @example $.cookie('the_cookie'); + * @desc Get the value of a cookie. + * + * @param String key The key of the cookie. + * @return The value of the cookie. + * @type String + * + * @name $.cookie + * @cat Plugins/Cookie + * @author Klaus Hartl/klaus.hartl@stilbuero.de + */ +jQuery.cookie = function (key, value, options) { + + // key and value given, set cookie... + if (arguments.length > 1 && (value === null || typeof value !== "object")) { + options = jQuery.extend({}, options); + + if (value === null) { + options.expires = -1; + } + + if (typeof options.expires === 'number') { + var days = options.expires, t = options.expires = new Date(); + t.setDate(t.getDate() + days); + } + + return (document.cookie = [ + encodeURIComponent(key), '=', + options.raw ? String(value) : encodeURIComponent(String(value)), + options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE + options.path ? '; path=' + options.path : '', + options.domain ? '; domain=' + options.domain : '', + options.secure ? '; secure' : '' + ].join('')); + } + + // key and possibly options given, get cookie... + options = value || {}; + var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent; + return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; +}; diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/UniversityFacultyQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/UniversityFacultyQuery.java index 06fe59fa..6d14590b 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/UniversityFacultyQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/UniversityFacultyQuery.java @@ -20,17 +20,17 @@ public class UniversityFacultyQuery extends PageParam { private Long universityFacultyId; @Query(name = "院系名称", display = true) private String universityFacultyName; - @Query(name = "联系人", display = true) + @Query(name = "联系人", display = false) private String universityFacultyContact; - @Query(name = "联系人电话", display = true) + @Query(name = "联系人电话", display = false) private String universityFacultyContactTel; @Query(name = "联系人地址", display = false) private String universityFacultyContactAddress; // @Query(name = "院校ID (院系的上一级)", display = true) - @Query(name = "院校ID", display = true) + @Query(name = "院校ID", display = false) private Long universitiesCollegesId; // @Query(name = "状态( 1 正常 2删除)", display = true,type=Query.TYPE_DICT,dict="global_status") - @Query(name = "状态", display = true,type=Query.TYPE_DICT,dict=GLOBAL_STATUS) + @Query(name = "状态", display = false,type=Query.TYPE_DICT,dict=GLOBAL_STATUS) private Integer universityFacultyStatus; @Query(name = "创建时间", display = false) private Date universityFacultyAddTime; diff --git a/web/src/main/resources/static/js/jlw/courseInfo/index.js b/web/src/main/resources/static/js/jlw/courseInfo/index.js index 2af8cdcb..2750e727 100644 --- a/web/src/main/resources/static/js/jlw/courseInfo/index.js +++ b/web/src/main/resources/static/js/jlw/courseInfo/index.js @@ -24,49 +24,49 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { ,page : Lib.tablePage // 开启分页 ,limit : 10, cols : [ [ // 表头 - { - field : 'courseInfoName', + { + field : 'courseInfoName', title : '课程名称',align:"center" - }, - { - field : 'courseLabelType', + }, + { + field : 'courseLabelType', title : '课程类别',align:"center" //类型(1课程 2章 3节) - }, - { - field : 'courseLabelName', + }, + { + field : 'courseLabelName', title : '课程标签',align:"center" - }, - { - field : 'userName', - title : '创建人',align:"center" - }, - { - field : 'addTime', - title : '创建时间',align:"center" - }, - { - field : 'courseInfoStatus',title : '状态',align:"center", templet: function (d) { - if(d.courseInfoStatus == 1){ - return "启用"; - }else if(d.courseInfoStatus == 2){ - return "禁用"; - }else { - return "-"; + }, + { + field : 'userName', + title : '创建人',align:"center" + }, + { + field : 'addTime', + title : '创建时间',align:"center" + }, + { + field : 'courseInfoStatus',title : '状态',align:"center", templet: function (d) { + if(d.courseInfoStatus == 1){ + return "启用"; + }else if(d.courseInfoStatus == 2){ + return "禁用"; + }else { + return "-"; + } + } + }, + { + field : 'userId',width:300,title : '操作',align:"center", templet: function (d) { + var htm = '编辑'; + htm += '课程配置'; + htm += ''+(d.courseInfoStatus == 1?"停用":"启用")+''; + htm += '删除'; + return htm; } } - }, - { - field : 'userId',width:300,title : '操作',align:"center", templet: function (d) { - var htm = ''; - htm += ''; - htm += ''; - htm += ''; - return htm; - } - } - ] ] + ] ] - }); + }); table.on('checkbox(courseInfoTable)', function(obj){ var courseInfo = obj.data; @@ -94,7 +94,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { search:function () { Lib.doSearchForm($("#searchForm"), courseInfoTable, 1); } - }; + }; $('.ext-toolbar').on('click', function() { var type = $(this).data('type'); toolbar[type] ? toolbar[type].call(this) : ''; @@ -118,6 +118,10 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { }); }); }else if(obj.event === "courseConfigure"){ //跳转至课程配置 + if(data.courseInfoStatus == 1){ + Common.info("课程配置时,请先停用课程。配置完成后再启用课程") + return; + } var url = "/jlw/courseInfo/courseConfigurePage.do?courseInfoId="+data.courseInfoId; Common.openDlg(url,""); }else if(obj.event === "editStatus"){ //启用 @@ -138,6 +142,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { layer.msg(ret.code == 0?"操作成功!":ret.msg, { offset: ['50%'], icon: ret.code == 0?1:2, + shade:0.3, time: 1500 //2秒关闭(如果不配置,默认是3秒) },function (){ if(ret.code == 0){ diff --git a/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js b/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js index 63e772e5..2c4cc7b2 100644 --- a/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesApplicationCourse/index.js @@ -1,93 +1,214 @@ -layui.define([ 'form', 'laydate', 'table' ], function(exports) { +layui.define(['form', 'laydate', 'table'], function (exports) { var form = layui.form; var laydate = layui.laydate; var table = layui.table; var resourcesApplicationCourseTable = null; - var view ={ - init:function(){ + var view = { + init: function () { this.initTable(); this.initSearchForm(); this.initToolBar(); - window.dataReload = function(){ - Lib.doSearchForm($("#searchForm"),resourcesApplicationCourseTable) + window.dataReload = function () { + Lib.doSearchForm($("#searchForm"), resourcesApplicationCourseTable) } }, - initTable:function(){ + initTable: function () { resourcesApplicationCourseTable = table.render({ - elem : '#resourcesApplicationCourseTable', - height : Lib.getTableHeight(1), + elem: '#resourcesApplicationCourseTable', + height: Lib.getTableHeight(1), cellMinWidth: 100, - method : 'post', - url : Common.ctxPath + '/jlw/resourcesApplicationCourse/list.json' // 数据接口 - ,page : Lib.tablePage // 开启分页 - ,limit : 10, - cols : [ [ // 表头 - { + method: 'post', + url: Common.ctxPath + '/jlw/resourcesApplicationCourse/list.json' // 数据接口 + , page: Lib.tablePage // 开启分页 + , limit: 10, + size: 'lg', + cols: [[ // 表头 + /*{ type : 'checkbox', fixed:'left', + },*/ + /*{ + + field: 'resourcesApplicationCourseId', + title: 'ID', + fixed: 'left', + width: 60, + },*/ + { + field: 'courseInfoName', + align:"center", + title: '课程名称', }, - { + { - field : 'resourcesApplicationCourseId', - title : 'ID', - fixed:'left', - width : 60, - }, - { + field: 'courseLabelType', + title: '课程类别', + align:"center", + templet: function (d) { + var html = "
\n" + + " \n" + + "
\n"; + return html; + } + }, + { - field : 'resourcesApplicationId', - title : '应用管理ID', - }, - { + field: 'undefinedYD', + title: '绑定模块', + align:"center", + templet: function (d) { + var html = "
\n" + + " \n" + + "
\n"; + return html; + } + }, + { - field : 'courseInfoId', - title : '课程配置ID', - } + field: 'resourcesApplicationId', + title: '绑定应用', + align:"center", + templet: function (d) { + var html = "
\n" + + " \n" + + "
\n"; + return html; + } + }, + { - ] ] + field: 'courseInfoId', + title: '课程配置ID', + align:"center", + templet: function (d) { + var htm = '绑定'; + htm += '编辑'; + htm += '删除'; + return htm; + } + } + ]] - }); + }); - table.on('checkbox(resourcesApplicationCourseTable)', function(obj){ + table.on('checkbox(resourcesApplicationCourseTable)', function (obj) { var resourcesApplicationCourse = obj.data; - if(obj.checked){ + if (obj.checked) { //按钮逻辑Lib.buttonEnable() - }else{ + } else { } - }) + }); + table.on('edit(resourcesApplicationCourseTable)', function(obj){ //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值" + console.log(obj.value); //得到修改后的值 + console.log(obj.field); //当前编辑的字段名 + console.log(obj.data); //所在行的所有相关数据 + }); }, - initSearchForm:function(){ - Lib.initSearchForm( $("#searchForm"),resourcesApplicationCourseTable,form); + initSearchForm: function () { + Lib.initSearchForm($("#searchForm"), resourcesApplicationCourseTable, form); }, - initToolBar:function(){ + initToolBar: function () { toolbar = { - add : function() { // 获取选中数据 + add: function () { // 获取选中数据 var url = "/jlw/resourcesApplicationCourse/add.do"; - Common.openDlg(url,"ResourcesApplicationCourse管理>新增"); + Common.openDlg(url, "ResourcesApplicationCourse管理>新增"); }, - edit : function() { // 获取选中数目 - var data = Common.getOneFromTable(table,"resourcesApplicationCourseTable"); - if(data==null){ - return ; + edit: function () { // 获取选中数目 + var data = Common.getOneFromTable(table, "resourcesApplicationCourseTable"); + if (data == null) { + return; } - var url = "/jlw/resourcesApplicationCourse/edit.do?resourcesApplicationCourseId="+data.resourcesApplicationCourseId; - Common.openDlg(url,"ResourcesApplicationCourse管理>"+data.resourcesApplicationCourseId+">编辑"); + var url = "/jlw/resourcesApplicationCourse/edit.do?resourcesApplicationCourseId=" + data.resourcesApplicationCourseId; + Common.openDlg(url, "ResourcesApplicationCourse管理>" + data.resourcesApplicationCourseId + ">编辑"); }, - del : function() { - layui.use(['del'], function(){ + del: function () { + layui.use(['del'], function () { var delView = layui.del delView.delBatch(); }); } - }; - $('.ext-toolbar').on('click', function() { + }; + $('.ext-toolbar').on('click', function () { var type = $(this).data('type'); toolbar[type] ? toolbar[type].call(this) : ''; }); - } - } - exports('index',view); + }, initTableTool: table.on('tool(resourcesApplicationCourseTable)', function (obj) { + var data = obj.data; + if (obj.event === 'edit') { + console.log(data.resourcesApplicationCourseId) + var url = "/jlw/resourcesApplicationCourse/add.do?resourcesApplicationCourseId="+data.resourcesApplicationCourseId; + Common.openDlg(url,""); + }else if(obj.event === "del"){ + layer.confirm('是否确定删除该课程?', function (index) { //courseInfoStatus:状态(1启用 2禁用 3删除) + var ret = Common.postAjax("/jlw/resourcesApplicationCourse/delete.json", {ids: data.resourcesApplicationCourseId}); + layer.msg(ret.code == 0 ? "删除成功!" : ret.msg, { + offset: ['50%'], + icon: ret.code == 0 ? 1 : 2, + time: 1500 //2秒关闭(如果不配置,默认是3秒) + }, function () { + if (ret.code == 0) { + Lib.tableRefresh(); + } + }); + }); + }else if(obj.event === "binding"){ + layer.confirm('是否确定绑定?', function (index) { + var ret = Common.postAjax("/jlw/xxx/xx.json", {ids: data.resourcesApplicationCourseId}); + layer.msg(ret.code == 0 ? "绑定成功!" : ret.msg, { + offset: ['50%'], + icon: ret.code == 0 ? 1 : 2, + time: 1500 //2秒关闭(如果不配置,默认是3秒) + }, function () { + if (ret.code == 0) { + Lib.tableRefresh(); + } + }); + }); + } + }) + }; + form.on('select(courseLabelType)', function (data) { + console.log("data->>>>>>>>>>>>>>>>", data); + var selectElem = $(data.elem); + var tdElem = selectElem.closest('td'); + var trElem = tdElem.closest('tr'); + var tableView = trElem.closest('.layui-table-view'); + table.cache[tableView.attr('lay-id')][trElem.data('index')][tdElem.data('field')] = data.value; + }); + form.on('select(resourcesApplicationId)', function (data) { + console.log("data->>>>>>>>>>>>>>>>", data); + var selectElem = $(data.elem); + var tdElem = selectElem.closest('td'); + var trElem = tdElem.closest('tr'); + var tableView = trElem.closest('.layui-table-view'); + table.cache[tableView.attr('lay-id')][trElem.data('index')][tdElem.data('field')] = data.value; + }); + form.on('select(undefinedYD)', function (data) { + console.log("data->>>>>>>>>>>>>>>>", data); + var selectElem = $(data.elem); + var tdElem = selectElem.closest('td'); + var trElem = tdElem.closest('tr'); + var tableView = trElem.closest('.layui-table-view'); + table.cache[tableView.attr('lay-id')][trElem.data('index')][tdElem.data('field')] = data.value; + }); + exports('index', view); + }); \ No newline at end of file diff --git a/web/src/main/resources/templates/jlw/resourcesApplicationCourse/add.html b/web/src/main/resources/templates/jlw/resourcesApplicationCourse/add.html index b5ec6eb4..202668f5 100644 --- a/web/src/main/resources/templates/jlw/resourcesApplicationCourse/add.html +++ b/web/src/main/resources/templates/jlw/resourcesApplicationCourse/add.html @@ -1,7 +1,10 @@ - -
-
+ + +
+ +
+ +
+
+ +
+ +
+
+
+
+
+ +
+ + +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
- + diff --git a/web/src/main/resources/templates/jlw/universitySystem/index.html b/web/src/main/resources/templates/jlw/universitySystem/index.html index 211aa2e7..73161159 100644 --- a/web/src/main/resources/templates/jlw/universitySystem/index.html +++ b/web/src/main/resources/templates/jlw/universitySystem/index.html @@ -19,6 +19,19 @@
+