设计师网站1688,高清视频服务器,深圳的网站,简述网站开发平台及常用工具锋哥原创的SpringbootLayui python222网站实战#xff1a;
python222网站实战课程视频教程#xff08;SpringBootPython爬虫实战#xff09; ( 火爆连载更新中... )_哔哩哔哩_bilibilipython222网站实战课程视频教程#xff08;SpringBootPython爬虫实战#xff09; ( 火…锋哥原创的SpringbootLayui python222网站实战
python222网站实战课程视频教程SpringBootPython爬虫实战 ( 火爆连载更新中... )_哔哩哔哩_bilibilipython222网站实战课程视频教程SpringBootPython爬虫实战 ( 火爆连载更新中... )共计23条视频包括python222网站实战课程视频教程SpringBootPython爬虫实战 ( 火爆连载更新中... )、第2讲 架构搭建实现、第3讲 页面系统属性动态化设计实现等UP主更多精彩视频请关注UP账号。https://www.bilibili.com/video/BV1yX4y1a7qM/
后端
package com.python222.controller.admin;import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.python222.entity.Link;
import com.python222.entity.PageBean;
import com.python222.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;import java.util.HashMap;
import java.util.Map;/*** 管理员-友情链接控制器* author Administrator**/
RestController
RequestMapping(value /admin/link)
public class LinkAdminController {Autowiredprivate LinkService linkService;/*** 根据条件分页查询友情链接* param page* param limit* return* throws Exception*/RequestMapping(value /list)public MapString,Object list(RequestParam(valuepage,requiredfalse)Integer page,RequestParam(valuelimit,requiredfalse)Integer limit)throws Exception{MapString, Object resultMap new HashMap();PageBean pageBeannew PageBean(page,limit);PageLink linkPage linkService.page(new Page(pageBean.getPage(), pageBean.getPageSize()));resultMap.put(code, 0);resultMap.put(count, linkPage.getTotal());resultMap.put(data, linkPage.getRecords());return resultMap;}/*** 添加或者修改友情链接* param link* return*/RequestMapping(/save)public MapString,Object save(Link link){if(link.getId()null){linkService.save(link);}else{linkService.updateById(link);}MapString, Object resultMap new HashMap();resultMap.put(success, true);return resultMap;}/*** 删除友情链接* param id* return* throws Exception*/RequestMapping(/delete)public MapString,Object delete(Integer id)throws Exception{MapString, Object resultMap new HashMap();linkService.removeById(id);resultMap.put(success, true);return resultMap;}/*** 根据id查询友情链接实体* param id* return* throws Exception*/RequestMapping(/findById)public MapString,Object findById(Integer id)throws Exception{MapString, Object resultMap new HashMap();Link linklinkService.getById(id);resultMap.put(link, link);resultMap.put(success, true);return resultMap;}
}
前端linkManage.html
!DOCTYPE html
html
head
meta charsetUTF-8
title友情链接管理/title
link relstylesheet href/static/layui/css/layui.css/link
link relstylesheet href/static/css/css.css/link
/head
bodydiv stylepadding: 20pxspan classlayui-breadcrumba首页/aacite友情链接管理/cite/a/spandiv stylepadding-top: 20px;divdivbutton classlayui-btn layuiadmin-btn-list data-typebatchdel onclickaddLink()添加/button/div/divdivtable width100% idlinkListTable /table/div/div/divscript src/static/layui/layui.js/scriptscript src/static/js/jquery.js/scriptscript src/static/js/common.js/script
script typetext/javascriptlayui.use([element,form,table], function(){var formlayui.form;var element layui.element; //导航的hover效果、二级菜单等功能需要依赖element模块$ layui.jquery; // 使用jquerytable layui.table;table.render({elem: #linkListTable,url:/admin/link/list,cols: [[{type:checkbox},{field:id, width:100,title: 编号},{field:name, width:200,title: 友情链接名称},{field:url, width:250,title: 友情链接地址},{field:sort, width:100, title: 排列序号,align:center},{field:remark, title: 描述,align:center},{field:action, width:150, title: 操作,align:center,templet:formatAction}]],page: true});});function deleteOne(id){layer.confirm(您确定要删除这条记录吗, {title:系统提示,btn: [确定,取消] //按钮}, function(){layer.closeAll(dialog);$.post(/admin/link/delete,{id:id},function(result){if(result.success){layer.msg(删除成功);table.reload(linkListTable,{});}else{layer.msg(删除失败请联系管理员);}},json);}, function(){});}function addLink(){layer.open({type: 2,title: 添加友情链接,area: [500px, 500px],content: /admin/saveLink.html //iframe的url});}function modifyLink(id){layer.open({type: 2,title: 修改友情链接,area: [500px, 500px],content: /admin/saveLink.html?idid //iframe的url});}function formatAction(d){return button classlayui-btn layui-btn-normal layui-btn-xs onclickmodifyLink(d.id)i classlayui-icon layui-icon-edit/i编辑/buttonbutton classlayui-btn layui-btn-warm layui-btn-xs onclickdeleteOne(d.id)i classlayui-icon layui-icon-delete /i删除/button;}/script
/body
/html
saveLink.html
!DOCTYPE html
html
head
meta charsetUTF-8
title添加或者修改友情链接/title
link relstylesheet href/static/layui/css/layui.css/link
style typetext/csstable tr td{padding: 10px;}/style
/head
body
div stylepadding: 20pxform methodposttabletrtd友情链接名称/tdtdinput typetext idname namename classlayui-input stylewidth: 300px//td/trtrtd友情链接地址/tdtdinput typetext idurl nameurl classlayui-input stylewidth: 300px//td/trtrtd友情链接描述/tdtdtextarea typetext idremark nameremark classlayui-input stylewidth: 300px;height: 100px /textarea/td/trtrtd排列序号/tdtdinput typetext idsort namesort classlayui-input stylewidth: 100px;display: inline;/nbsp;nbsp;span(根据数值从小到大排序)/span/td/trtrtdbutton classlayui-btn onclicksubmitData();return false;提交/button/tdtdfont iderrorInfo colorred/font/td/tr/table/form
/div
script src/static/layui/layui.js/script
script src/static/js/jquery.js/script
script src/static/js/common.js/script
script typetext/javascriptlayui.use([form], function(){});function submitData(){var name$(#name).val().trim();var url$(#url).val().trim();var remark$(#remark).val().trim();var sort$(#sort).val().trim();if(name) {$(#errorInfo).text(请输入友情链接名称);$(#name).focus();return false;}if(url) {$(#errorInfo).text(请输入友情链接地址);$(#url).focus();return false;}if(!IsURL(url)){$(#errorInfo).text(友情链接地址格式不正确);$(#url).focus();return false;}if(sort) {$(#errorInfo).text(请输入排列序号);$(#sort).focus();return false;}if (!(/(^[1-9]\d*$)/.test(sort))) {$(#errorInfo).text(排列序号必须是正整数);$(#sort).focus();return false;}var idgetQueryVariable(id);if(id){$.post(/admin/link/save,{id:id,name:name,url:url,sort:sort,remark:remark},function(result){if(result.success){layer.alert(修改成功,function () {parent.reloadPage();});}else{$(#errorInfo).text(result.errorInfo);}},json);}else{$.post(/admin/link/save,{name:name,url:url,sort:sort,remark:remark},function(result){if(result.success){layer.alert(添加成功,function () {parent.reloadPage();});}else{$(#errorInfo).text(result.errorInfo);}},json);}}function getQueryVariable(variable){var query window.location.search.substring(1);var vars query.split();for (var i0;ivars.length;i) {var pair vars[i].split();if(pair[0] variable){return pair[1];}}return(false);}$(function(){var idgetQueryVariable(id);if(id){$.post(/admin/link/findById,{id:id},function(result){if(result.success){var linkresult.link;$(#name).val(link.name);$(#url).val(link.url);$(#sort).val(link.sort);$(#remark).val(link.remark);}else{layer.alert(服务器加载有问题请联系管理员);}},json);}});/script
/body
/html