From 2622298aa28d2d2428cdf1245bb0ba3be04322c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E4=B8=B9ab?= <1421553879@qq.com> Date: Mon, 12 Dec 2022 11:31:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/js/jlw/handsOn/index.js | 10 +++--- .../js/jlw/resourcesCompetition/index.js | 31 ++++++++++++++++--- .../static/js/jlw/resourcesQuestion/index.js | 27 +++++++++++++--- .../static/js/jlw/resourcesTraining/index.js | 23 +++++++++++--- 4 files changed, 74 insertions(+), 17 deletions(-) diff --git a/web/src/main/resources/static/js/jlw/handsOn/index.js b/web/src/main/resources/static/js/jlw/handsOn/index.js index 7ead3ad9..81a69c75 100644 --- a/web/src/main/resources/static/js/jlw/handsOn/index.js +++ b/web/src/main/resources/static/js/jlw/handsOn/index.js @@ -27,7 +27,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) { cellMinWidth: 120, method: 'post', even: true, - // url: Common.ctxPath + '/jlw/handsOn/list.json' // 数据接口 + //url: Common.ctxPath + '/jlw/handsOn/list.json' // 数据接口 url: Common.ctxPath + '/jlw/handsOn/listMock.json' // 数据接口 , page: Lib.tablePage // 开启分页 /*, toolbar: '#toolbar_handsOn' //自定义头部左侧工具栏 @@ -122,7 +122,7 @@ layui.define(['form', 'laydate', 'table'], function (exports) { drown:function () { var data = Common.getMoreDataFromTable(table,"handsOnTable"); var ids = Common.concatBatchId(data, "handsOnId"); - upDrown(0,ids); + upDrown(2,ids); } } //触发事件 @@ -158,14 +158,14 @@ layui.define(['form', 'laydate', 'table'], function (exports) { }else if (obj.event === "up") { upDrown(1,data.handsOnId); } else if (obj.event === "drown") { - upDrown(0,data.handsOnId); + upDrown(2,data.handsOnId); } }) }; function upDrown(status,ids){ layer.confirm(status == 1?'是否确定上架?':'是否确定下架?', function (index) { - var ret = Common.postAjax(status == 1?"/xx.json":"/dd.json", {ids: ids}); - layer.msg(ret.code == 0 ? "下架成功!" : ret.msg, { + var ret = Common.postAjax('/jlw/handsOn/edit.json', {handsOnId: ids,handsOnStatus:status}); + layer.msg(ret.code == 0 ? "操作成功!" : ret.msg, { offset: ['50%'], icon: ret.code == 0 ? 1 : 2, time: 1500 //2秒关闭(如果不配置,默认是3秒) diff --git a/web/src/main/resources/static/js/jlw/resourcesCompetition/index.js b/web/src/main/resources/static/js/jlw/resourcesCompetition/index.js index c0eb3559..97f82c58 100644 --- a/web/src/main/resources/static/js/jlw/resourcesCompetition/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesCompetition/index.js @@ -39,9 +39,9 @@ layui.define(['form', 'laydate', 'table'], function (exports) { field: 'courseInfoName', title: '归属章节', align: "center" },{ - field: 'questionStatus', width: 80, + field: 'resourcesCompetitionStatus', width: 80, title: '状态', align: "center", templet: function (d) { - return d.questionStatus === '1' + return d.resourcesCompetitionStatus === '1' ? '已上架' : '已下架' } @@ -122,9 +122,32 @@ layui.define(['form', 'laydate', 'table'], function (exports) { var url = "/jlw/resourcesCompetitionStep/add.do?resourcesCompetitionId=" + data.resourcesCompetitionId; Common.openDlg(url, ""); } else if (obj.event === "up") { - alert('up') + + layer.confirm('是否上架该编程竞赛案例?', function (index) { + var ret = Common.postAjax("/jlw/resourcesCompetition/edit.json", {resourcesCompetitionId: data.resourcesCompetitionId,resourcesCompetitionStatu:1}); + 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 === "down") { - alert('down') + layer.confirm('是否下架该编程竞赛案例?', function (index) { + var ret = Common.postAjax("/jlw/resourcesCompetition/edit.json", {resourcesCompetitionId: data.resourcesCompetitionId,resourcesCompetitionStatu:2}); + 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(); + } + }); + }); } }) }; diff --git a/web/src/main/resources/static/js/jlw/resourcesQuestion/index.js b/web/src/main/resources/static/js/jlw/resourcesQuestion/index.js index 8559ec8d..98fd6049 100644 --- a/web/src/main/resources/static/js/jlw/resourcesQuestion/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesQuestion/index.js @@ -95,10 +95,14 @@ layui.define(['form', 'laydate', 'table'], function (exports) { Lib.doSearchForm($("#searchForm"), resourcesQuestionTable, 1); }, up: function () { - alert('up') + var data = Common.getMoreDataFromTable(table,"handsOnTable"); + var ids = Common.concatBatchId(data, "handsOnId"); + upDrown(1,data.resourcesQuestionId); }, down: function () { - alert('down') + var data = Common.getMoreDataFromTable(table,"handsOnTable"); + var ids = Common.concatBatchId(data, "handsOnId"); + upDrown(2,data.resourcesQuestionId); }, search: function () { Lib.doSearchForm($("#searchForm"), resourcesQuestionTable, 1); @@ -193,9 +197,9 @@ layui.define(['form', 'laydate', 'table'], function (exports) { } else if (obj.event === "del") { allDelete(data.resourcesQuestionId); } else if (obj.event === "up") { - alert('up') + upDrown(1,data.resourcesQuestionId); } else if (obj.event === "down") { - alert('down') + upDrown(2,data.resourcesQuestionId); } }) } @@ -216,6 +220,21 @@ layui.define(['form', 'laydate', 'table'], function (exports) { }); } + //上下架 + function upDrown(status,ids){ + layer.confirm(status == 1?'是否确定上架该试题?':'是否确定下架该试题?', function (index) { + var ret = Common.postAjax("/jlw/resourcesQuestion/edit.json", {resourcesQuestionId: ids,questionStatus:status}); + 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(); + } + }); + }); + }; //选择归属课程 并且根据选择的课程查询章节 resourcesQuestionIdsIsNotNull:查询题目不为空的章节 form.on('select(select_courseInfoIds)', function (obj) { Lib.getCourseInfo($("select[name='courseInfoId_1']"), obj.value, 1); diff --git a/web/src/main/resources/static/js/jlw/resourcesTraining/index.js b/web/src/main/resources/static/js/jlw/resourcesTraining/index.js index d0e8f06b..0370449e 100644 --- a/web/src/main/resources/static/js/jlw/resourcesTraining/index.js +++ b/web/src/main/resources/static/js/jlw/resourcesTraining/index.js @@ -41,9 +41,9 @@ layui.define(['form', 'laydate', 'table'], function (exports) { title: '归属章节', align: "center" }, { - field: 'questionStatus', width: 80, + field: 'resourcesTrainingStatus', width: 80, title: '状态', align: "center", templet: function (d) { - return d.questionStatus === '1' + return d.resourcesTrainingStatus === 1 ? '已上架' : '已下架' } @@ -125,12 +125,27 @@ layui.define(['form', 'laydate', 'table'], function (exports) { var url = "/jlw/resourcesCompetitionStep/add.do?resourcesCompetitionId=" + data.resourcesCompetitionId; Common.openDlg(url, ""); } else if (obj.event === "up") { - alert('up') + upDrown(1,data.resourcesTrainingId); } else if (obj.event === "down") { - alert('down') + upDrown(2,data.resourcesTrainingId); } }) }; + //上下架 + function upDrown(status,ids){ + layer.confirm(status == 1?'是否确定上架该编程实训案例?':'是否确定下架该编程实训案例?', function (index) { + var ret = Common.postAjax("/jlw/resourcesTraining/edit.json", {resourcesTrainingId: ids,resourcesTrainingStatus:status}); + 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(); + } + }); + }); + }; //选择归属课程 并且根据选择的课程查询章节 resourcesQuestionIdsIsNotNull:查询题目不为空的章节 form.on('select(select_courseInfoIds)', function (obj) { Lib.getCourseInfo($("select[name='courseInfoId_1']"), obj.value, 1);