月木学途开发 6.网址模块

概述

效果图

 

数据库设计

网站类型表
DROP TABLE IF EXISTS `website`;
CREATE TABLE `website` (`websiteId` int(11) NOT NULL AUTO_INCREMENT,`websiteImg` longtext,`websiteName` varchar(255) DEFAULT NULL,`websiteUrl` longtext,`websiteDesc` varchar(255) DEFAULT NULL,`websiteTypeId` int(11) DEFAULT NULL,PRIMARY KEY (`websiteId`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4;

网站表
DROP TABLE IF EXISTS `website_type`;
CREATE TABLE `website_type` (`websiteTypeId` int(11) NOT NULL AUTO_INCREMENT,`websiteTypeName` varchar(255) DEFAULT NULL,PRIMARY KEY (`websiteTypeId`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4;

实体类设计

WebsiteType
package jkw.pojo;import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;import java.io.Serializable;
import java.util.List;/*** 网站类型*/
@Data
public class WebsiteType implements Serializable {@TableIdprivate Integer websiteTypeId;private String websiteTypeName;//类型名@TableField(exist = false)private List<Website> websites;
}

Website
package jkw.pojo;import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;import java.io.Serializable;/*** 网站*/
@Data
public class Website implements Serializable {@TableIdprivate Integer websiteId;private String websiteImg;//图片private String websiteName;//名称private String websiteUrl;//urlprivate String websiteDesc;//描述private Integer websiteTypeId;//类型
}

Mapper层开发

WebsiteTypeMapper
package jkw.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jkw.pojo.WebsiteType;public interface WebsiteTypeMapper extends BaseMapper<WebsiteType> {
}

WebsiteMapper
package jkw.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jkw.pojo.Website;public interface WebsiteMapper extends BaseMapper<Website> {
}

Service层开发

WebsiteTypeService
package jkw.service;import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jkw.pojo.WebsiteType;import java.util.List;public interface WebsiteTypeService {void add(WebsiteType WebsiteType);void update(WebsiteType WebsiteType);void delete(Integer id);WebsiteType findById(Integer id);List<WebsiteType> findAll();Page<WebsiteType> search(String search, int page, int size);
}

WebsiteTypeServiceImpl
package jkw.service.impl;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jkw.mapper.WebsiteTypeMapper;
import jkw.pojo.WebsiteType;
import jkw.service.WebsiteTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;import java.util.List;@Service
@Transactional
public class WebsiteTypeServiceImpl implements WebsiteTypeService {@Autowiredprivate WebsiteTypeMapper WebsiteTypeMapper;@Overridepublic void add(WebsiteType WebsiteType) {WebsiteTypeMapper.insert(WebsiteType);}@Overridepublic void update(WebsiteType WebsiteType) {WebsiteTypeMapper.updateById(WebsiteType);}@Overridepublic void delete(Integer id) {WebsiteTypeMapper.deleteById(id);}@Overridepublic WebsiteType findById(Integer id) {return WebsiteTypeMapper.selectById(id);}@Overridepublic List<WebsiteType> findAll() {return WebsiteTypeMapper.selectList(null);}@Overridepublic Page<WebsiteType> search(String search, int page, int size) {QueryWrapper queryWrapper = new QueryWrapper();if (search != null) {}return WebsiteTypeMapper.selectPage(new Page<>(page, size), queryWrapper);}
}

WebsiteService
package jkw.service;import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jkw.pojo.Website;import java.util.List;public interface WebsiteService {void add(Website Website);void update(Website Website);void delete(Integer id);Website findById(Integer id);List<Website> findAll();Page<Website> search(String search, int page, int size);//根据typeId查询List<Website> findAllByWebsiteTypeId(Integer id);
}

WebsiteServiceImpl
package jkw.service.impl;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jkw.pojo.Website;
import jkw.service.WebsiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;import java.util.List;@Service
@Transactional
public class WebsiteServiceImpl implements WebsiteService {@Autowiredprivate jkw.mapper.WebsiteMapper WebsiteMapper;@Overridepublic void add(Website Website) {WebsiteMapper.insert(Website);}@Overridepublic void update(Website Website) {WebsiteMapper.updateById(Website);}@Overridepublic void delete(Integer id) {WebsiteMapper.deleteById(id);}@Overridepublic Website findById(Integer id) {return WebsiteMapper.selectById(id);}@Overridepublic List<Website> findAll() {return WebsiteMapper.selectList(null);}@Overridepublic Page<Website> search(String search, int page, int size) {QueryWrapper queryWrapper = new QueryWrapper();if (search != null) {}return WebsiteMapper.selectPage(new Page<>(page, size), queryWrapper);}@Overridepublic List<Website> findAllByWebsiteTypeId(Integer id) {QueryWrapper<Website> queryWrapper = new QueryWrapper<>();queryWrapper.eq("websiteTypeId", id);return WebsiteMapper.selectList(queryWrapper);}
}

控制层开发

WebsiteTypeCon
package jkw.controller.back;import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jkw.pojo.WebsiteType;
import jkw.service.WebsiteTypeService;
import jkw.vo.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;import java.util.List;@RequestMapping("/back/websiteType")
@RestController
@CrossOrigin
public class WebsiteTypeCon {@Autowiredprivate WebsiteTypeService WebsiteTypeService;/*** 新增** @param WebsiteType* @return*/@PostMapping("/add")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult add(WebsiteType WebsiteType) {WebsiteTypeService.add(WebsiteType);return BaseResult.ok();}/*** 修改** @param WebsiteType* @return*/@PostMapping("/update")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult update(WebsiteType WebsiteType) {WebsiteTypeService.update(WebsiteType);return BaseResult.ok();}/*** 删除** @param websiteTypeId* @return*/@DeleteMapping("/delete")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult delete(Integer websiteTypeId) {WebsiteTypeService.delete(websiteTypeId);return BaseResult.ok();}/*** 根据id查询** @param websiteTypeId* @return*/@GetMapping("/findById")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult findById(Integer websiteTypeId) {WebsiteType WebsiteType = WebsiteTypeService.findById(websiteTypeId);return BaseResult.ok(WebsiteType);}/*** 查询所有** @return*/@GetMapping("/findAll")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult findAll() {List<WebsiteType> all = WebsiteTypeService.findAll();return BaseResult.ok(all);}/*** 分页查询** @param page* @param size* @return*/@GetMapping("/search")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult search(String search, int page, int size) {Page<WebsiteType> brandPage = WebsiteTypeService.search(search, page, size);return BaseResult.ok(brandPage);}
}

WebsiteCon
package jkw.controller.back;import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jkw.pojo.Website;
import jkw.vo.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;import java.util.List;@RestController
@RequestMapping("/back/website")
@CrossOrigin
public class WebsiteCon {@Autowiredprivate jkw.service.WebsiteService WebsiteService;/*** 新增** @param Website* @return*/@PostMapping("/add")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult add(Website Website) {WebsiteService.add(Website);return BaseResult.ok();}/*** 修改** @param Website* @return*/@PostMapping("/update")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult update(Website Website) {WebsiteService.update(Website);return BaseResult.ok();}/*** 删除** @param websiteId* @return*/@DeleteMapping("/delete")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult delete(Integer websiteId) {WebsiteService.delete(websiteId);return BaseResult.ok();}/*** 根据id查询** @param websiteId* @return*/@GetMapping("/findById")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult findById(Integer websiteId) {Website Website = WebsiteService.findById(websiteId);return BaseResult.ok(Website);}/*** 查询所有** @return*/@GetMapping("/findAll")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult findAll() {List<Website> all = WebsiteService.findAll();return BaseResult.ok(all);}/*** 分页查询** @param page* @param size* @return*/@GetMapping("/search")@PreAuthorize("hasAnyAuthority('/website/website')")public BaseResult search(String search, int page, int size) {Page<Website> brandPage = WebsiteService.search(search, page, size);return BaseResult.ok(brandPage);}
}

FrontWebsiteCon
package jkw.controller.front;import jkw.pojo.Website;
import jkw.pojo.WebsiteType;
import jkw.service.WebsiteService;
import jkw.service.WebsiteTypeService;
import jkw.vo.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.List;@RequestMapping("/front/website")
@RestController
@CrossOrigin
public class FrontWebsiteCon {@Autowiredprivate WebsiteService websiteService;@Autowiredprivate WebsiteTypeService websiteTypeService;/*** 查询所有网站类型以及对应的网站** @return*/@GetMapping("/findAllTypes")public BaseResult findAllTypeWithWebsite() {List<WebsiteType> websiteTypeList = websiteTypeService.findAll();for (WebsiteType websiteType : websiteTypeList) {List<Website> websiteList = websiteService.findAllByWebsiteTypeId(websiteType.getWebsiteTypeId());websiteType.setWebsites(websiteList);}return BaseResult.ok(websiteTypeList);}}

后台ui设计

WebsiteType.vue
<template><div class="data-container"><!--添加 start--><div class="data-header"><el-input class="input" @keyup.enter="searchHandle" v-model="searchInfo" size="large"placeholder="请输入关键字"></el-input><el-button @click="searchHandle" class="button" size="large" type="primary" plain>搜索</el-button><el-button round @click="addHander" size="large" type="primary"><el-icon><DocumentAdd/></el-icon><span>新增</span></el-button></div><!--添加 end--><!--表格数据展示 start--><div class="data-table"><el-table :data="dataList.list" style="width: 550px;"><el-table-column show-overflow-tooltip label="类型名" prop="websiteTypeName" align="center" width="300"></el-table-column><el-table-column label="操作" align="center" width="220"><template #default="scope"><el-button size="small" type="primary" @click="handleEdit(scope.$index, scope.row)">编辑</el-button><el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button></template></el-table-column></el-table><!--分页 start--><div class="page"><el-pagination backgroundlayout="prev,pager,next,jumper":default-page-size="defaultPageSize":total="totalData"@current-change="currentChangeHaddler"></el-pagination></div><!--分页 end--></div><!--表格数据展示 end--><!--添加对话框 start--><el-dialog draggable destroy-on-close v-model="dialogAddVisible" title="添加" width="35%" center><el-form inline :model="addFormInfo" label-width="150px"><el-form-item label="类型名"><el-input v-model="addFormInfo.websiteTypeName"></el-input></el-form-item></el-form><template #footer><span class="dialog-footer"><el-button @click="dialogAddVisible = false">取消</el-button><el-button type="primary" @click="sureHandler">确定</el-button></span></template></el-dialog><!--添加对话框 end--><!--编辑对话框 start--><!--destroy-on-close:每次关闭对话框时直接销毁对话框,没有缓存--><el-dialogdraggabledestroy-on-closev-model="dialogEditorVisible"title="编辑"width="35%"center><el-form inline :model="editorFormInfo" label-width="150px"><el-form-item label="类型名"><el-input v-model="editorFormInfo.websiteTypeName"></el-input></el-form-item></el-form><template #footer><span class="dialog-footer"><el-button @click="dialogEditorVisible = false">取消</el-button><el-button type="primary" @click="sureEditorHandler">确定</el-button></span></template></el-dialog><!--编辑对话框 end--></div>
</template><script setup>
import axios from "../../api/index.js"
import {onMounted, reactive, ref} from "vue";
import {ElMessage} from "element-plus";
//初始化分页查询数据
const dataList = reactive({list: []
})
//初始化总条数
const totalData = ref(0)
//当前页
const currentPage = ref(1)
//初始化分页显示条数
const defaultPageSize = ref(10)
//搜索初始化状态
const searchInfo = ref("")
//添加添加对话框控制器
const dialogAddVisible = ref(false)
//初始化添加对话框状态
const addFormInfo = reactive({websiteTypeName: "",
})
//编辑对话框控制器
const dialogEditorVisible = ref(false)
//初始化编辑对话框状态
const editorFormInfo = reactive({websiteTypeId: '',websiteTypeName: "",
})
/*** 网路请求:分页查询*  */
const http = (search, page, size) => {axios.website_type_search({search: search,page: page,size: size}).then(res => {if (res.data.code == 200) {dataList.list = res.data.data.recordstotalData.value = res.data.data.total} else {ElMessage.error(res.data.message)}})
}
onMounted(() => {http(searchInfo.value, currentPage.value, defaultPageSize.value)
})
/*** 分页*/
const currentChangeHaddler = (nowPage) => {http(searchInfo.value, nowPage, defaultPageSize.value)currentPage.value = nowPage
}
/*** 搜索按钮*/
const searchHandle = () => {http(searchInfo.value, currentPage.value, defaultPageSize.value)
}
/*** 添加对话框弹出事件*/
const addHander = () => {dialogAddVisible.value = true
}
/*** 添加对话框 确定事件*/
const sureHandler = () => {axios.website_type_add({websiteTypeName: addFormInfo.websiteTypeName,}).then(res => {if (res.data.code == 200) {dialogAddVisible.value = falsehttp(searchInfo.value, currentPage.value, defaultPageSize.value)} else {ElMessage.error(res.data.message)}})
}
/*** 编辑对话框 弹出事件*  */
const handleEdit = (index, row) => {dialogEditorVisible.value = trueaxios.website_type_findById({websiteTypeId: row.websiteTypeId}).then(res => {if (res.data.code == 200) {editorFormInfo.websiteTypeId = res.data.data.websiteTypeId;editorFormInfo.websiteTypeName = res.data.data.websiteTypeName;} else {ElMessage.error(res.data.data.message)}})}
/*** 编辑对话框 确定事件*/
const sureEditorHandler = () => {axios.website_type_update({websiteTypeId: editorFormInfo.websiteTypeId,websiteTypeName: editorFormInfo.websiteTypeName,}).then(res => {if (res.data.code == 200) {dialogEditorVisible.value = falsehttp(searchInfo.value, currentPage.value, defaultPageSize.value)} else {ElMessage.error(res.data.message)}})
}
/**删除 */
const handleDelete = (index, row) => {ElMessageBox.confirm('确定删除么','删除',{confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning',}).then(() => {//确认删除axios.website_type_delete({websiteTypeId: row.websiteTypeId}).then(res => {if (res.data.code == 200) {ElMessage({type: 'success',message: "删除成功!!!",})//刷新http(searchInfo.value, currentPage.value, defaultPageSize.value)} else {ElMessage({type: 'error',message: res.data.message,})}})}).catch(error => {ElMessage({type: 'info',message: "取消删除",})})}
</script>
<style scoped>
.data-container {background: linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);background: -o-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);background: -ms-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);background: -moz-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);background: -webkit-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);height: 800px;
}.data-header {padding: 20px;
}.data-header .input {width: 300px;
}.data-table {padding: 20px;
}.page {position: fixed;right: 10px;bottom: 10px;
}
</style>

Website.vue
<template><div class="data-container"><!--添加 start--><div class="data-header"><el-input class="input" @keyup.enter="searchHandle" v-model="searchInfo" size="large"placeholder="请输入关键字"></el-input><el-button @click="searchHandle" class="button" size="large" type="primary" plain>搜索</el-button><el-button round @click="addHander" size="large" type="primary"><el-icon><DocumentAdd/></el-icon><span>新增</span></el-button></div><!--添加 end--><!--表格数据展示 start--><div class="data-table"><el-table :data="dataList.list" style="width: 1100px;"><el-table-column label="图片" prop="websiteImg" align="center"><template #default="scope"><img :src="scope.row.websiteImg" style="height:60px"/></template></el-table-column><el-table-column label="类型" prop="websiteTypeId" align="center"><template #default="scope"><span v-for="item in typeList.list" :key="item.websiteTypeId">{{ scope.row.websiteTypeId == item.websiteTypeId ? item.websiteTypeName : '' }}</span></template></el-table-column><el-table-column show-overflow-tooltip label="名称" prop="websiteName" align="center"></el-table-column><el-table-column show-overflow-tooltip label="url" prop="websiteUrl" align="center"></el-table-column><el-table-column show-overflow-tooltip label="描述" prop="websiteDesc" align="center"></el-table-column><el-table-column label="操作" align="center" width="220"><template #default="scope"><el-button size="small" type="primary" @click="handleEdit(scope.$index, scope.row)">编辑</el-button><el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button></template></el-table-column></el-table><!--分页 start--><div class="page"><el-pagination backgroundlayout="prev,pager,next,jumper":default-page-size="defaultPageSize":total="totalData"@current-change="currentChangeHaddler"></el-pagination></div><!--分页 end--></div><!--表格数据展示 end--><!--添加对话框 start--><el-dialog draggable destroy-on-close v-model="dialogAddVisible" title="添加" width="35%" center><el-form inline :model="addFormInfo" label-width="150px"><el-form-item label="图片"><el-upload list-type="picture-card":action="uploadStore.fastdfsUploadUrl":on-success="onHeadImageAddSuccess":on-remove="onHeadImageAddRemove"><el-icon></el-icon></el-upload></el-form-item><el-form-item label="类型"><el-select v-model="addFormInfo.websiteTypeId" placeholder="请选择类型" size="large"><el-option v-for="item in typeList.list" :key="item.websiteTypeId":label="item.websiteTypeName":value="item.websiteTypeId"></el-option></el-select></el-form-item><el-form-item label="名称"><el-input v-model="addFormInfo.websiteName"></el-input></el-form-item><el-form-item label="url"><el-input v-model="addFormInfo.websiteUrl"></el-input></el-form-item><el-form-item label="描述"><el-input type="textarea" rows="6" style="width: 200px" v-model="addFormInfo.websiteDesc"></el-input></el-form-item></el-form><template #footer><span class="dialog-footer"><el-button @click="dialogAddVisible = false">取消</el-button><el-button type="primary" @click="sureHandler">确定</el-button></span></template></el-dialog><!--添加对话框 end--><!--编辑对话框 start--><!--destroy-on-close:每次关闭对话框时直接销毁对话框,没有缓存--><el-dialogdraggabledestroy-on-closev-model="dialogEditorVisible"title="编辑"width="35%"center><el-form inline :model="editorFormInfo" label-width="150px"><el-form-item label="头图"><el-upload list-type="picture-card":action="uploadStore.fastdfsUploadUrl":on-success="onHeadImageEditSuccess"><el-image :src="editorFormInfo.websiteImg"/></el-upload></el-form-item><el-form-item label="类型"><el-select v-model="editorFormInfo.websiteTypeId" placeholder="请选择类型" size="large"><el-option v-for="item in typeList.list" :key="item.websiteTypeId":label="item.websiteTypeName":value="item.websiteTypeId"></el-option></el-select></el-form-item><el-form-item label="名称"><el-input v-model="editorFormInfo.websiteName"></el-input></el-form-item><el-form-item label="url"><el-input v-model="editorFormInfo.websiteUrl"></el-input></el-form-item><el-form-item label="描述"><el-input type="textarea" rows="6" style="width: 200px" v-model="editorFormInfo.websiteDesc"></el-input></el-form-item></el-form><template #footer><span class="dialog-footer"><el-button @click="dialogEditorVisible = false">取消</el-button><el-button type="primary" @click="sureEditorHandler">确定</el-button></span></template></el-dialog><!--编辑对话框 end--></div>
</template><script setup>
import axios from "../../api/index.js"
import {onMounted, reactive, ref} from "vue";
import {ElMessage} from "element-plus";
import {useUploadStore} from "../../stores/uploadStore.js"const uploadStore = useUploadStore()
//初始化分页查询数据
const dataList = reactive({list: []
})
//初始化类型列表
const typeList = reactive({list: []
})
//初始化总条数
const totalData = ref(0)
//当前页
const currentPage = ref(1)
//初始化分页显示条数
const defaultPageSize = ref(5)
//搜索初始化状态
const searchInfo = ref("")
//添加添加对话框控制器
const dialogAddVisible = ref(false)
//初始化添加对话框状态
const addFormInfo = reactive({websiteImg: "",websiteName: "",websiteUrl: "",websiteDesc: "",websiteTypeId: ''
})
//编辑对话框控制器
const dialogEditorVisible = ref(false)
//初始化编辑对话框状态
const editorFormInfo = reactive({websiteId: '',websiteImg: "",websiteName: "",websiteUrl: "",websiteDesc: "",websiteTypeId: ''
})
/*** 网路请求:分页查询*  */
const http = (search, page, size) => {axios.website_search({search: search,page: page,size: size}).then(res => {if (res.data.code == 200) {dataList.list = res.data.data.recordstotalData.value = res.data.data.total} else {ElMessage.error(res.data.message)}})
}
onMounted(() => {http(searchInfo.value, currentPage.value, defaultPageSize.value)axios.website_type_findAll().then(res => {if (res.data.code == 200) {typeList.list = res.data.data}})
})
/*** 分页*/
const currentChangeHaddler = (nowPage) => {http(searchInfo.value, nowPage, defaultPageSize.value)currentPage.value = nowPage
}
/*** 搜索按钮*/
const searchHandle = () => {http(searchInfo.value, currentPage.value, defaultPageSize.value)
}
/*** 添加对话框弹出事件*/
const addHander = () => {dialogAddVisible.value = true
}
//上传成功的钩子
const onHeadImageAddSuccess = (response, uploadFile) => {addFormInfo.websiteImg = response.dataElMessage.success("上传成功")
}
//移除图片的钩子
const onHeadImageAddRemove = (response, uploadFile) => {axios.fastdfs_delete({filePath: addFormInfo.websiteImg}).then(res => {if (res.data.code == 200) {ElMessage.success("移除成功")}})
}
/*** 添加对话框 确定事件*/
const sureHandler = () => {axios.website_add({websiteImg: addFormInfo.websiteImg,websiteName: addFormInfo.websiteName,websiteUrl: addFormInfo.websiteUrl,websiteDesc: addFormInfo.websiteDesc,websiteTypeId: addFormInfo.websiteTypeId,}).then(res => {if (res.data.code == 200) {dialogAddVisible.value = falsehttp(searchInfo.value, currentPage.value, defaultPageSize.value)} else {ElMessage.error(res.data.message)}})
}
/*** 编辑对话框 弹出事件*  */
const handleEdit = (index, row) => {dialogEditorVisible.value = trueaxios.website_findById({websiteId: row.websiteId}).then(res => {if (res.data.code == 200) {editorFormInfo.websiteId = res.data.data.websiteId;editorFormInfo.websiteImg = res.data.data.websiteImg;editorFormInfo.websiteName = res.data.data.websiteName;editorFormInfo.websiteUrl = res.data.data.websiteUrl;editorFormInfo.websiteDesc = res.data.data.websiteDesc;editorFormInfo.websiteTypeId = res.data.data.websiteTypeId;} else {ElMessage.error(res.data.data.message)}})}
/*** 编辑对话框 头图修改时图片上传成功事件*///上传成功的钩子
const onHeadImageEditSuccess = (response, uploadFile) => {//删除以前图片axios.fastdfs_delete({filePath: editorFormInfo.websiteImg}).then(res => {if (res.data.code == 200) {ElMessage.success("fastdfs移除原图片成功")}})//替换为现在的图片editorFormInfo.websiteImg = response.dataElMessage.success("上传成功")}
/*** 编辑对话框 确定事件*/
const sureEditorHandler = () => {axios.website_update({websiteId: editorFormInfo.websiteId,websiteImg: editorFormInfo.websiteImg,websiteName: editorFormInfo.websiteName,websiteUrl: editorFormInfo.websiteUrl,websiteDesc: editorFormInfo.websiteDesc,websiteTypeId: editorFormInfo.websiteTypeId,}).then(res => {if (res.data.code == 200) {dialogEditorVisible.value = falsehttp(searchInfo.value, currentPage.value, defaultPageSize.value)} else {ElMessage.error(res.data.message)}})
}
/**删除 */
const handleDelete = (index, row) => {ElMessageBox.confirm('确定删除么','删除',{confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning',}).then(() => {//确认删除axios.website_delete({websiteId: row.websiteId}).then(res => {if (res.data.code == 200) {ElMessage({type: 'success',message: "删除成功!!!",})//刷新http(searchInfo.value, currentPage.value, defaultPageSize.value)} else {ElMessage({type: 'error',message: res.data.message,})}})}).catch(error => {ElMessage({type: 'info',message: "取消删除",})})}
</script>
<style scoped>
.data-container {background: linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);background: -o-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);background: -ms-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);background: -moz-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);background: -webkit-linear-gradient(left, rgb(89, 234, 233) 27%, rgb(131, 231, 218) 44%, rgb(69, 150, 216) 88%);height: 800px;
}.data-header {padding: 20px;
}.data-header .input {width: 300px;
}.data-table {padding: 20px;
}.page {position: fixed;right: 10px;bottom: 10px;
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/84926.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Python经典练习题(一)

文章目录 &#x1f340;第一题&#x1f340;第二题&#x1f340;第三题&#x1f340;第四题&#x1f340;第五题 &#x1f340;第一题 有四个数字&#xff1a;1、2、3、4&#xff0c;能组成多少个互不相同且无重复数字的三位数&#xff1f;各是多少&#xff1f; 这里我们使用…

HTTP 错误 401.3 - Unauthorized 由于 Web 服务器上此资源的访问控制列表(ACL)配置或加密设置,您无权查看此目录或页面。

用IIS 发布网站&#xff0c;不能访问且出现错误&#xff1a;HTTP 错误 401.3 - Unauthorized 由于Web服务器上此资源的访问控制列表(ACL)配置或加密设置。您无权查看此目录或页面 问题截图&#xff1a; 问题描述&#xff1a;HTTP 错误 401.3 - 未经授权&#xff1a;访问由于 A…

[RF学习记录][参数读取]从yaml文件读取参数变量

robotframework支持从yaml文件读取变量&#xff0c;对于比较多的参数&#xff0c;可以在yaml文件中定义好&#xff0c;在robot脚本中引用 1、定义yaml文件 文件内容如下&#xff0c;注意&#xff0c;变量和变量值之间要以4个字符分开 yaml_demo_name: tester traing_gpt_…

RabbitMQ 消息应答

每日一句 物是人非事事休,欲语泪先流。 概述 为了保证消息在发送过程中不丢失,RabbitMQ引入了消息应答机制, 消费者在接收到消息并且处理该消息后,告诉RabbitMQ它已经处理了,RabbitMQ可以把消息删除了。 自动应答 消息发送后立即被认为已经传送成功,这种模式需要在…

Python150题day08

2.基础语法篇 2.1 if 条件句 ①单个条件分支 使用input函数接收用户的输入&#xff0c;如果用户输入的整数是偶数&#xff0c;则使用print函数输出"你输入的整数是:{value],它是偶数”&#xff0c;[value]部分要替换成用户的输入。 解答: value input("请输⼊⼀…

Guava Cache介绍-面试用

一、Guava Cache简介 1、简介 Guava Cache是本地缓存&#xff0c;数据读写都在一个进程内&#xff0c;相对于分布式缓存redis&#xff0c;不需要网络传输的过程&#xff0c;访问速度很快&#xff0c;同时也受到 JVM 内存的制约&#xff0c;无法在数据量较多的场景下使用。 基…

苹果开发者账号注册及证书生成方法详解

转载&#xff1a;注册苹果开发者账号的方法 在2020年以前&#xff0c;注册苹果开发者账号后&#xff0c;就可以生成证书。 但2020年后&#xff0c;因为注册苹果开发者账号需要使用Apple Developer app注册开发者账号&#xff0c;所以需要缴费才能创建ios证书了。 所以新政策…

什么是葡萄酒结构,结构型葡萄酒好吗?

葡萄酒爱好者使用许多复杂的术语来描述葡萄酒的味道&#xff0c;有些是不言自明的&#xff0c;有些则有点模糊。如果你不是葡萄酒专家&#xff0c;你可能很难理解这个葡萄酒术语的全部含义。其中一个术语是葡萄酒结构&#xff0c;那么葡萄酒结构是什么意思呢&#xff1f;而结构…

电路的基本定律——基尔霍夫定律

基尔霍夫定律 &#x1f391;预备知识&#x1f391;基尔霍夫电流定律(KCL)&#x1f383;基尔霍夫电流定律的本质&#xff1a;节点上电荷具有连续性(不会突变)&#x1f383;基尔霍夫电流定律的推广&#xff1a; &#x1f391;基尔霍夫的电压定律(KVL)&#x1f383;基尔霍夫电压定…

在Windos 10专业版搭建Fyne(Go 跨平台GUI)开发环境

目录 在Windos 10专业版搭建Fyne&#xff08;Go 跨平台GUI&#xff09;开发环境一 Fyne 和 MSYS2简介1.1 Fyne1.2 MSYS2 二 安装 MSYS22.1 下载MSYS22.2 安装2.3 环境变量设置2.4 检测安装环境 三 参考文档 在Windos 10专业版搭建Fyne&#xff08;Go 跨平台GUI&#xff09;开发…

zabbix学习2--zabbix6.x高可用

文章目录 1. server高可用-默认HA2. 访问高可用 1. server高可用-默认HA 1.部署zabbix单节点后&#xff0c;配置添加HANodeName和NodeAddress即为HA架构 2.zabbix1故障后切换zabbix2使用 3.浏览器访问主机1&#xff0c;使用主机1php前端连接mysql后zabbix2提供后台服务--------…

算法-单词搜索 II

算法-单词搜索 II 1 题目概述 1.1 题目出处 https://leetcode.cn/problems/word-search-ii/description/?envTypestudy-plan-v2&envIdtop-interview-150 1.2 题目描述 2 DFS 2.1 解题思路 每个格子往上下左右四个方向DFS&#xff0c;拼接后的单词如果在答案集中&…

【若依框架2】前后端分离版本添加功能页

在VSCode的src/views下新建个文件平example,在example下创建test文件夹&#xff0c;在test里创建index.vue文件 <template> <h1>Hello world</h1> </template><script> export default {name: "index" } </script><style s…

2023/9/20总结

maven maven本质是 一个项目管理工具 将项目开发 和 管理过程 抽象成 一个项目对象模型&#xff08;POM&#xff09; POM &#xff08;Project Object Model&#xff09; 项目对象模型 作用 项目构建 提供标准的自动化 项目构建 方式依赖管理 方便快捷的管理项目依赖的资源…

C++【个人笔记1】

1.C的初识 1.1 简单入门 #include<iostream> using namespace std; int main() {cout << "hello world" << endl;return 0; } #include<iostream>; 预编译指令&#xff0c;引入头文件iostream.using namespace std; 使用标准命名空间cout …

springboot整合返回数据统一封装

1、MagCode&#xff0c;错误码枚举类 package com.mgx.common.enums;import lombok.*; import lombok.extern.slf4j.Slf4j;/*** 错误码* author mgx*/ Slf4j NoArgsConstructor AllArgsConstructor public enum MsgCode {/*** 枚举标识&#xff0c;根据业务类型进行添加*/Code…

PostgreSQL 数据库实现公网远程连接

文章目录 前言1. 安装postgreSQL2. 本地连接postgreSQL3. Windows 安装 cpolar4. 配置postgreSQL公网地址5. 公网postgreSQL访问6. 固定连接公网地址7. postgreSQL固定地址连接测试 前言 PostgreSQL是一个功能非常强大的关系型数据库管理系统&#xff08;RDBMS&#xff09;,下…

建议收藏《Verilog代码规范笔记_华为》(附下载)

华为verilog编程规范是坊间流传出来华为内部的资料&#xff0c;其贴合实际工作需要&#xff0c;是非常宝贵的资料&#xff0c;希望大家善存。至于其介绍&#xff0c;在此不再赘述&#xff0c;大家可看下图详细了解&#xff0c;感兴趣的可私信领取《Verilog代码规范笔记_华为》。…

IDEA开发工具技巧

1.1 IDEA相关插件 idea插件下载地址&#xff1a;https://plugins.jetbrains.com/ 开发必装插件&#xff1a; &#xff08;1&#xff09; 快速查找api接口 RestfulTool 插件&#xff0c;推荐指数⭐⭐⭐⭐⭐ [RestfulTool搜索插件使用详解](https://blog.csdn.net/weixin_450147…

Spring学习笔记2 Spring的入门程序

Spring学习笔记1 启示录_biubiubiu0706的博客-CSDN博客 Spring官网地址:https://spring.io 进入github往下拉 用maven引入spring-context依赖 写spring的第一个程序 引入下面依赖,好比引入Spring的基本依赖 <dependency><groupId>org.springframework</groupId&…