From a90f416070debc8024e26e2e804079858c5f708d Mon Sep 17 00:00:00 2001 From: yangjun <1173114630@qq.com> Date: Tue, 4 Jun 2024 08:40:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BD=91=E7=AB=99=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/encodings.xml | 4 + .idea/runConfigurations.xml | 10 - .idea/vcs.xml | 6 + .../back/controller/NdNewController.java | 28 +++ .../com/ruoyi/portal/back/domain/NdNew.java | 23 +- .../controller/system/SysLoginController.java | 136 +++++++++++ .../src/main/resources/application-druid.yml | 2 +- .../main/resources/static/portal/js/page.js | 77 ++++++ .../resources/templates/news/news/add.html | 75 +++--- .../resources/templates/news/news/edit.html | 100 +++++--- .../templates/news/news/editGly.html | 217 +++++++++++++++++ .../resources/templates/news/news/list.html | 26 +- .../resources/templates/portal/details.html | 44 +++- .../templates/portal/headerAndFooter.html | 170 +++++++------ .../resources/templates/portal/index.html | 226 +++--------------- .../main/resources/templates/portal/list.html | 199 +++++++-------- .../templates/portal/searchList.html | 102 ++++++++ .../resources/templates/system/user/add.html | 24 +- .../resources/templates/system/user/edit.html | 44 ++-- .../target/classes/application-druid.yml | 2 +- .../back/controller/NdNewController.class | Bin 6642 -> 7348 bytes .../com/ruoyi/portal/back/domain/NdNew.class | Bin 5474 -> 5900 bytes .../system/SysLoginController.class | Bin 4122 -> 8979 bytes .../target/classes/static/portal/js/page.js | 77 ++++++ .../classes/templates/news/news/add.html | 75 +++--- .../classes/templates/news/news/edit.html | 100 +++++--- .../classes/templates/news/news/editGly.html | 217 +++++++++++++++++ .../classes/templates/news/news/list.html | 26 +- .../classes/templates/portal/details.html | 44 +++- .../templates/portal/headerAndFooter.html | 170 +++++++------ .../classes/templates/portal/index.html | 226 +++--------------- .../target/classes/templates/portal/list.html | 199 +++++++-------- .../classes/templates/portal/searchList.html | 102 ++++++++ .../classes/templates/system/user/add.html | 24 +- .../classes/templates/system/user/edit.html | 44 ++-- .../ruoyi/framework/config/ShiroConfig.java | 1 + .../ruoyi/framework/config/ShiroConfig.class | Bin 13450 -> 13487 bytes .../mapper/portal/back/NdNewMapper.xml | 9 +- .../mapper/portal/back/NdNewMapper.xml | 9 +- 39 files changed, 1835 insertions(+), 1003 deletions(-) delete mode 100644 .idea/runConfigurations.xml create mode 100644 .idea/vcs.xml create mode 100644 blxc-admin/src/main/resources/static/portal/js/page.js create mode 100644 blxc-admin/src/main/resources/templates/news/news/editGly.html create mode 100644 blxc-admin/src/main/resources/templates/portal/searchList.html create mode 100644 blxc-admin/target/classes/static/portal/js/page.js create mode 100644 blxc-admin/target/classes/templates/news/news/editGly.html create mode 100644 blxc-admin/target/classes/templates/portal/searchList.html diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 9dd240f..5ab9894 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -4,12 +4,16 @@ + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/blxc-admin/src/main/java/com/ruoyi/portal/back/controller/NdNewController.java b/blxc-admin/src/main/java/com/ruoyi/portal/back/controller/NdNewController.java index f6e8500..a0d281f 100644 --- a/blxc-admin/src/main/java/com/ruoyi/portal/back/controller/NdNewController.java +++ b/blxc-admin/src/main/java/com/ruoyi/portal/back/controller/NdNewController.java @@ -125,9 +125,18 @@ public class NdNewController extends BaseController if(StringUtils.isNull(ndNew.getPublishTime())){ ndNew.setPublishTime(new Date()); } +// ndNew.setAbstracts(stripHtml(ndNew.getContent())); return toAjax(ndNewService.insertNdNew(ndNew)); } + public static String stripHtml(String input) { + // 定义HTML标签的正则表达式 + String htmlRegex = "<[^>]*>"; + // 使用正则表达式去除HTML标签 + String output = input.replaceAll(htmlRegex, ""); + return output; + } + /** * 修改新闻 */ @@ -149,6 +158,24 @@ public class NdNewController extends BaseController return prefix + "/edit"; } + + @GetMapping("/editGly/{id}") + public String editGly(@PathVariable("id") Long id, ModelMap mmap) + { + List cxList = new ArrayList(); + List firstItems = ndNewService.getNewsTypes(0L); + for(int i=0;i< firstItems.size();i++){ + CxSelect child = firstItems.get(i); + List secondItems = ndNewService.getNewsTypes(Long.valueOf(child.getV())); + child.setS(secondItems); + cxList.add(child); + } + mmap.put("data", JSON.toJSON(cxList)); + NdNew ndNew = ndNewService.selectNdNewById(id); + mmap.put("ndNew", ndNew); + return prefix + "/editGly"; + } + /** * 修改保存新闻 */ @@ -170,6 +197,7 @@ public class NdNewController extends BaseController if(StringUtils.isNull(ndNew.getPublishTime())){ ndNew.setPublishTime(new Date()); } +// ndNew.setAbstracts(stripHtml(ndNew.getContent())); return toAjax(ndNewService.updateNdNew(ndNew)); } diff --git a/blxc-admin/src/main/java/com/ruoyi/portal/back/domain/NdNew.java b/blxc-admin/src/main/java/com/ruoyi/portal/back/domain/NdNew.java index 1a752e9..317e17f 100644 --- a/blxc-admin/src/main/java/com/ruoyi/portal/back/domain/NdNew.java +++ b/blxc-admin/src/main/java/com/ruoyi/portal/back/domain/NdNew.java @@ -80,7 +80,27 @@ public class NdNew extends BaseEntity /** 删除标志(0代表存在 1代表删除) */ private String delFlag; - public void setId(Long id) + private String filePath; + + private String paramLimitno; + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getParamLimitno() { + return paramLimitno; + } + + public void setParamLimitno(String paramLimitno) { + this.paramLimitno = paramLimitno; + } + + public void setId(Long id) { this.id = id; } @@ -246,6 +266,7 @@ public class NdNew extends BaseEntity .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .append("remark", getRemark()) + .append("filePath", getFilePath()) .toString(); } } diff --git a/blxc-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/blxc-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 9f120ba..27e5f8c 100644 --- a/blxc-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/blxc-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -2,6 +2,12 @@ package com.ruoyi.web.controller.system; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.portal.back.domain.NdNew; +import com.ruoyi.portal.back.domain.NdNewType; +import com.ruoyi.portal.back.service.INdNewService; +import com.ruoyi.portal.back.service.INdNewTypeService; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.UsernamePasswordToken; @@ -20,6 +26,10 @@ import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.web.service.ConfigService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 登录验证 * @@ -37,21 +47,147 @@ public class SysLoginController extends BaseController @Autowired private ConfigService configService; + @Autowired + private INdNewService ndNewService; + + @Autowired + private INdNewTypeService ndNewTypeService; + @GetMapping("/") public String index(HttpServletRequest request, HttpServletResponse response, ModelMap mmap) { + + //新闻动态 5条 newType = 10 + NdNew ndNew = new NdNew(); + ndNew.setNewType("10"); + ndNew.setParamLimitno("5"); + List xwdtList = ndNewService.selectNdNewList(ndNew); + //通知公告 6条 + ndNew = new NdNew(); + ndNew.setNewType("11"); + ndNew.setParamLimitno("6"); + List tztgList = ndNewService.selectNdNewList(ndNew); + //活动预告 5条 + ndNew = new NdNew(); + ndNew.setNewType("12"); + ndNew.setParamLimitno("5"); + List hdygList = ndNewService.selectNdNewList(ndNew); + + //友情链接 + ndNew = new NdNew(); + ndNew.setNewType("13"); + List yqljList = ndNewService.selectNdNewList(ndNew); + mmap.put("yqljList", yqljList); + + mmap.put("xwdtList", xwdtList); + mmap.put("tztgList", tztgList); + mmap.put("hdygList", hdygList); + return "portal/index"; } @GetMapping("/portal/list") public String list(HttpServletRequest request, HttpServletResponse response, ModelMap mmap) { + String newType = request.getParameter("newType"); + String pageNo = request.getParameter("pageNo"); + String pageSize = request.getParameter("pageSize"); + + System.out.println("newType=" + newType); + System.out.println("pageNo=" + pageNo); + System.out.println("pageSize=" + pageSize); + + + NdNewType oneType = ndNewTypeService.selectNdNewTypeById(Long.parseLong(newType)); + NdNewType twoType = ndNewTypeService.selectNdNewTypeById(oneType.getParentId()); + String twoCode = twoType.getId()+""; + String twoName = twoType.getName(); + String threeCode = oneType.getId()+""; + String threeName = oneType.getName(); + if(!StringUtils.equals("1",twoCode)){ + mmap.put("twoName",twoName); + mmap.put("twoCode",twoCode); + }else{ + mmap.put("twoName",twoName); + mmap.put("twoCode","-1"); + } + mmap.put("threeName",threeName); + mmap.put("threeCode",threeCode); + NdNewType ndNewType = new NdNewType(); + ndNewType.setParentId(Long.parseLong(twoCode)); + List list = ndNewTypeService.selectNdNewTypeList(ndNewType); + mmap.put("menuList",list); + + //友情链接 + NdNew ndNew = new NdNew(); + ndNew.setNewType("13"); + List yqljList = ndNewService.selectNdNewList(ndNew); + mmap.put("yqljList", yqljList); return "portal/list"; } + + @GetMapping("/portal/searchList") + public String searchList(NdNew ndNew,HttpServletRequest request, HttpServletResponse response, ModelMap mmap) + { +// NdNew ndNew = new NdNew(); + ndNew.setTitle(request.getParameter("title")); + List list = ndNewService.selectNdNewList(ndNew); + mmap.put("list",list); + //友情链接 + ndNew = new NdNew(); + ndNew.setNewType("13"); + List yqljList = ndNewService.selectNdNewList(ndNew); + mmap.put("yqljList", yqljList); + return "portal/searchList"; + } + + + @PostMapping("/portal/dataList") + @ResponseBody + public TableDataInfo dataList(NdNew ndNew) + { + startPage(); + List list = ndNewService.selectNdNewList(ndNew); + return getDataTable(list); + } + @GetMapping("/portal/details") public String details(HttpServletRequest request, HttpServletResponse response, ModelMap mmap) { + String id = request.getParameter("id"); + NdNew ndNew = ndNewService.selectNdNewById(Long.parseLong(id)); + + ndNew.setClickRate(ndNew.getClickRate()+1); + ndNewService.updateNdNew(ndNew); + + String newType = ndNew.getNewType(); + + NdNewType oneType = ndNewTypeService.selectNdNewTypeById(Long.parseLong(newType)); + + NdNewType twoType = ndNewTypeService.selectNdNewTypeById(oneType.getParentId()); + + String twoCode = twoType.getId()+""; + String twoName = twoType.getName(); + String threeCode = oneType.getId()+""; + String threeName = oneType.getName(); + + if(!StringUtils.equals("1",twoCode)){ + mmap.put("twoName",twoName); + mmap.put("twoCode",twoCode); + }else{ + mmap.put("twoName","-1"); + mmap.put("twoCode","-1"); + } + mmap.put("threeName",threeName); + mmap.put("threeCode",threeCode); + mmap.put("info", ndNew); + + //友情链接 + NdNew ndNew2 = new NdNew(); + ndNew2.setNewType("13"); + List yqljList = ndNewService.selectNdNewList(ndNew2); + mmap.put("yqljList", yqljList); return "portal/details"; } diff --git a/blxc-admin/src/main/resources/application-druid.yml b/blxc-admin/src/main/resources/application-druid.yml index 7da2589..bec3373 100644 --- a/blxc-admin/src/main/resources/application-druid.yml +++ b/blxc-admin/src/main/resources/application-druid.yml @@ -6,7 +6,7 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://localhost:3306/nd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/nd_cbsy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: root # 从库数据源 diff --git a/blxc-admin/src/main/resources/static/portal/js/page.js b/blxc-admin/src/main/resources/static/portal/js/page.js new file mode 100644 index 0000000..53f3289 --- /dev/null +++ b/blxc-admin/src/main/resources/static/portal/js/page.js @@ -0,0 +1,77 @@ +var page = 1 +var size = 15 +var totalCount = 1 +var values =1 + +function generPage(total, dom_page_class) { + totalCount = total % 10 == 0 ? Math.floor(total / 10) : Math.floor(total / 10) + 1 + + + + let domStr = ` + + 共${total}条 + 首页 + ` + for (let i = 1; i <= totalCount; i++) { + + if(values==i){ + domStr += `` + (i ) + `` + }else{ + domStr += `` + (i ) + `` + } + } + + domStr += ` 尾页`; + console.log('domStr-->',domStr); + document.querySelector('.' + dom_page_class).innerHTML = domStr +} + +function pageChange(currentPage,e) { + // let jsijg = e.innerText + page = currentPage + values = page + mainListChange(page) + + console.log(page) + // 去第一页 +// if(page===1) { +// console.log('123123123') +// document.querySelector('.active')?.classList.remove('active') +// document.querySelector('.first').classList.add('active') +// } +// document.querySelector('.current').addEventListener('click',function (e) { +// if(e.target.tagName ==='DIV') { +// console.log('点击了按钮') +// document.querySelector('.active').classList.remove('active') +// e.target.classList.add('active') +// } +// }) +// if(e.className === 'pageEnd') { +// const pages = document.querySelector('.current').children +// document.querySelector('.active').classList.remove('active') +// pages[1].classList.add('active') +// } +} + +function page_go() { + let content = document.querySelector('#page_input').value + let reg = /^\d$/ + if(reg.test(content)&&content>0&&content<=totalCount){ + page = content + values = page + mainListChange() + } +} + +function prePage() { + if (page != 1) page = page - 1 + values = page + mainListChange() +} + +function nextPage(count) { + if (page != count) page = page + 1 + values = page + mainListChange() +} \ No newline at end of file diff --git a/blxc-admin/src/main/resources/templates/news/news/add.html b/blxc-admin/src/main/resources/templates/news/news/add.html index 58db448..76a208b 100644 --- a/blxc-admin/src/main/resources/templates/news/news/add.html +++ b/blxc-admin/src/main/resources/templates/news/news/add.html @@ -43,13 +43,26 @@ - - 发布时间: + + + + + + + + + + + 内容: - - - - + + + + + + 超链接: + + @@ -62,30 +75,26 @@ - 摘要: + 附件: - - - - - 内容: - - - - - - - 超链接: - - - - - - 点击率: - - + + + + + + + + + + + + + + + + @@ -130,10 +139,22 @@ $("input[name='" + event.currentTarget.id + "']").val('') }) + $(".file-uploadb").fileinput({ + uploadUrl: ctx + 'common/upload', + maxFileCount: 10, + autoReplace: true + }).on('fileuploaded', function (event, data, previewId, index) { + var inputaaa = $("input[name='" + event.currentTarget.id + "']").val(); + $("input[name='" + event.currentTarget.id + "']").val(inputaaa+"|"+data.response.url) + }).on('fileremoved', function (event, id, index) { + $("input[name='" + event.currentTarget.id + "']").val('') + }) + $(function() { $('.summernote').summernote({ lang: 'zh-CN', dialogsInBody: true, + height: '300px', callbacks: { onChange: function(contents, $edittable) { $("input[name='" + this.id + "']").val(contents); diff --git a/blxc-admin/src/main/resources/templates/news/news/edit.html b/blxc-admin/src/main/resources/templates/news/news/edit.html index 03b0a95..99d3982 100644 --- a/blxc-admin/src/main/resources/templates/news/news/edit.html +++ b/blxc-admin/src/main/resources/templates/news/news/edit.html @@ -10,15 +10,15 @@ - - 状态: - - - - - - - + + + + + + + + + 栏目类型: @@ -26,6 +26,8 @@ [[*{firstTypeStr}]] + + [[*{newTypeStr}]] @@ -53,30 +55,15 @@ - - 发布时间: - - - - - - - - - 缩略图: - - - - - - - - - 摘要: - - [[*{abstracts}]] - - + + + + + + + + + 内容: @@ -91,11 +78,35 @@ - 点击率: + 缩略图: - + + + + + + 附件: + + + + + + + + + + + + + + + + + + + @@ -152,11 +163,30 @@ $(this).fileinput('_initFileActions'); }); + + $(".file-uploadb").each(function (i) { + var val = $("input[name='" + this.id + "']").val() + $(this).fileinput({ + 'uploadUrl': ctx + 'common/upload', + initialPreviewAsData: true, + initialPreview: [val], + maxFileCount: 10, + autoReplace: true + }).on('fileuploaded', function (event, data, previewId, index) { + var inputaaa = $("input[name='" + event.currentTarget.id + "']").val(); + $("input[name='" + event.currentTarget.id + "']").val(inputaaa+"|"+data.response.url) + }).on('fileremoved', function (event, id, index) { + $("input[name='" + event.currentTarget.id + "']").val('') + }) + $(this).fileinput('_initFileActions'); + }); + $(function() { $('.summernote').each(function(i) { $('#' + this.id).summernote({ lang: 'zh-CN', dialogsInBody: true, + height: '300px', callbacks: { onChange: function(contents, $edittable) { $("input[name='" + this.id + "']").val(contents); diff --git a/blxc-admin/src/main/resources/templates/news/news/editGly.html b/blxc-admin/src/main/resources/templates/news/news/editGly.html new file mode 100644 index 0000000..7662671 --- /dev/null +++ b/blxc-admin/src/main/resources/templates/news/news/editGly.html @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + 栏目类型: + + + [[*{firstTypeStr}]] + + + + + + + [[*{newTypeStr}]] + + + + + 内容类型: + + + + + + + + + 标题: + + + + + + 来源或作者: + + + + + + 发布时间: + + + + + + + + + 内容: + + + + + + + 超链接: + + [[*{linkUrl}]] + + + + 缩略图: + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/blxc-admin/src/main/resources/templates/news/news/list.html b/blxc-admin/src/main/resources/templates/news/news/list.html index e42f410..b2a170b 100644 --- a/blxc-admin/src/main/resources/templates/news/news/list.html +++ b/blxc-admin/src/main/resources/templates/news/news/list.html @@ -14,13 +14,13 @@ 栏目类型: 所有 - 首页 + 所有 - 新闻动态 + @@ -102,6 +102,7 @@ url: prefix + "/list", createUrl: prefix + "/add", updateUrl: prefix + "/edit/{id}", + updateGlyUrl: prefix + "/editGly/{id}", removeUrl: prefix + "/remove", exportUrl: prefix + "/export", modalName: "新闻", @@ -146,18 +147,19 @@ return ''; } }, - { - field: 'delFlag', - title: '状态', - formatter: function(value, row, index) { - return $.table.selectDictLabel(datas, value); - } - }, +// { +// field: 'delFlag', +// title: '状态', +// formatter: function(value, row, index) { +// return $.table.selectDictLabel(datas, value); +// } +// }, { title: '操作', align: 'center', formatter: function(value, row, index) { var actions = []; + actions.push(' '); actions.push('编辑 '); actions.push('删除'); return actions.join(''); @@ -166,6 +168,12 @@ }; $.table.init(options); }); + + /* 用户管理-重置密码 */ + function edit2(id) { + var url = prefix+'/editGly/' + id; + $.modal.open("修改", url, '900', '700'); + }