【代码】表格封装 + 高级查询 + 搜索 +分页器 (极简)
一、标题 + 查询条件+按钮(Header)
<!-- Header 标题搜索栏 -->
<template><div><div class="header"><div class="h-left"><div class="title"><div class="desc-test"><i class="el-icon-s-grid"></i><span>{{ title }}</span></div></div></div><div class="h-right"><el-inputv-if="inputType === 'input'":placeholder="inputPlaceholder"v-model="searchValue"size="small"class="search"clearable></el-input><el-selectv-else-if="inputType === 'select'":placeholder="selectPlaceholder"v-model="searchValue"size="small"class="search"clearable><!-- 添加select选项 --><el-optionv-for="(option, index) in options":key="index":label="option.label":value="option.value"></el-option></el-select><!-- 按钮组 --><slot name="button-list"> </slot></div></div></div>
</template><script>
export default {props: {title: {type: String,default: '测试管理',},inputType: {type: String,default: 'select', // 默认为下拉框类型},inputPlaceholder: {type: String,default: '请输入内容', // 默认提示内容},selectPlaceholder: {type: String,default: '请选择内容', // 默认提示内容},options: {type: Array,default: () => [],},},data() {return {searchValue: '',}},methods: {// handleSearchClick() {// this.$emit('search-clicked', this.searchValue)// },},
}
</script>
<style lang="less" scoped>
.header {display: flex;height: 35px;line-height: 35px;justify-content: space-between;width: 100%;.h-left {width: 25%;.title {line-height: 26px;.desc-test {margin-top: 5px;font-weight: bold;margin-bottom: 3px;font-size: 14px;color: #313131;white-space: nowrap;width: fit-content;border-bottom: 2px solid #646565;i {font-size: 16px;position: relative;top: 1px;margin-right: 2px;}}}}.h-right {display: flex;flex-direction: row;justify-content: flex-end;/deep/ .el-input__inner {height: 35px;line-height: 35px;}.search {margin-right: 20px;}}
}
</style>
二、高级查询 (SearchCondition)
<!--*名称:弹窗的搜索条件组件*功能:methods1.点击搜索的方法:@search2.搜索条件 props : formItemList
--><template><div class="searchBox" v-show="isShowSearch"><div class="dialog-search"><!-- inline 行内表单域 --><el-form:inline="true"ref="ruleForm":model="formInline"class="demo-form-inline"><el-form-itemv-for="(item, index) in formItemList":key="index":label="item.label.length > 7 ? item.label.slice(0, 7) + '...' : item.label"label-width="115px"><div class="icon-input"><!-- effect= light / dark --><div class="slotIcon" slot="label"><el-tooltip effect="dark" :content="item.label" placement="top"><i class="el-icon-question" /></el-tooltip></div><div class="inputBox"><!-- 普通 input 框 --><el-inputv-if="item.type == 'input'"v-model.trim="formInline[item.param]":size="getSize(item.param, item.type) || 'small'"placeholder="请输入"></el-input><div style="width: 256px;" v-if="item.type === 'interval'"><!-- 区间输入框 - 起始值 --><el-inputstyle="width:47%;"v-model.trim="formInline[item.param].start":size="getSize(item.param, item.type) || 'small'"placeholder="起始值"></el-input><span> - </span><!-- 区间输入框 - 结束值 --><el-inputstyle="width:48%;"v-model.trim="formInline[item.param].end":size="getSize(item.param, item.type) || 'small'"placeholder="结束值"></el-input></div><!-- 时间区间选择器 --><el-date-pickerstyle="width: 257px;"v-if="item.type == 'daterange'"v-model="formInline[item.param]"type="daterange"range-separator="-"start-placeholder="开始日期"end-placeholder="结束日期"format="YYYY-MM-DD"value-format="YYYY-MM-DD":size="getSize(item.param, item.type) || 'small'"></el-date-picker><!-- 单个日期 --><el-date-pickerv-if="item.type == 'date'"v-model="formInline[item.param]"type="date"placeholder="选择日期"format="YYYY-MM-DD"value-format="YYYY-MM-DD":size="getSize(item.param, item.type) || 'small'"></el-date-picker><!-- 数字输入框 --><el-inputv-if="item.type == 'inputNumber'"v-model="formInline[item.param]"type="number"placeholder="请输入数字":min="getLimit(item.param, item.type, 'min') || ''":max="getLimit(item.param, item.type, 'max') || ''":maxlength="getMaxLength(item.param, item.type) || ''":size="getSize(item.param, item.type) || 'small'"@change="handleChange(item)"@blur="handleBlur(item)"></el-input><!-- 文本输入框 --><el-inputv-if="item.type == 'inputText'"v-model="formInline[item.param]"type="text"placeholder="请输入文本":maxlength="getMaxLength(item.param, item.type) || ''":size="getSize(item.param, item.type) || 'small'"show-word-limit></el-input><!-- select 框 单选--><el-selectv-if="item.type == 'select'"v-model="formInline[item.param]"placeholder="请选择内容":size="getSize(item.param, item.type) || 'small'"><el-optionv-for="(item2, index2) in item.selectOptions":key="index2":label="item2.key":value="item2.value"></el-option></el-select><!-- 省 的 select --><el-selectv-if="item.type == 'proSelect'"v-model="formInline[item.param]"placeholder="请选择内容"@change="provChange":size="getSize(item.param, item.type) || 'small'"><el-optionv-for="(item2, index2) in item.selectOptions":key="index2":label="item2.key":value="item2.id"></el-option></el-select><!-- 市 的 select --><el-selectv-if="item.type == 'citySelect'"v-model="formInline[item.param]"placeholder="请选择内容"@change="cityChange":size="getSize(item.param, item.type) || 'small'"><el-optionv-for="(item2, index2) in cityList":key="index2":label="item2.key":value="item2.id"></el-option></el-select><!-- 区县 的 select --><el-selectv-if="item.type == 'xzqSelect'"v-model="formInline[item.param]"placeholder="请选择内容"@change="xzqChange":size="getSize(item.param, item.type) || 'small'"><el-optionv-for="(item2, index2) in quList":key="index2":label="item2.value":value="item2.id"></el-option></el-select></div></div></el-form-item><!-- 可用于显示其他按钮 --><slot></slot></el-form><div class="btn"><el-form-item><el-button type="primary" plain size="mini" @click="onSubmit">查询</el-button><el-buttontype="success"plainsize="mini"@click="resetForm('ruleForm')">重置</el-button><el-button type="warning" plain size="mini" @click="onClose">关闭</el-button></el-form-item></div></div></div>
</template><script>
import { regionData, CodeToText } from 'element-china-area-data'
export default {name: 'BaseSearch',props: {formItemList: {type: Array,default() {return [{label: '下拉框',type: 'select',selectOptions: [{ name: 111, value: 111 }],param: 'company',defaultSelect: '222', // 下拉框默认选中项},{label: '输入框',type: 'input',param: 'name',},]},},// 是否显示 弹窗的搜索条件组件isShowSearch: {type: Boolean,default: false,},},data() {// 获取父组件传过来的 paramslet formInline = {}for (const obj of this.formItemList) {if (obj.type === 'interval') {// 对于区间输入框,初始化为对象formInline[obj.param] = obj.defaultSelect || { start: '', end: '' }} else {formInline[obj.param] = obj.defaultSelect || ''}}// let a = this.formItemList.find((item) => {// console.log("@formInline", formInline);// if ("maxlength" in item) return item;// });// console.log("@aaaaa", a);// console.log("@regionData[0]", regionData[0]);// console.log("@regionData", regionData);// console.log("@this.formItemList", formInline);return {formInline,options: regionData, // 必须是数组 ==》 获取单个省 [regionData[0]]selectedOptions: [],cityList: [],quList: [],intervalParam: { start: '', end: '' }, // input 区间}},watch: {formItemList: {handler(newVal, oldVal) {for (const obj of this.formItemList) {if (obj.defaultSelect) {formInline[obj.param] = obj.defaultSelect}}},deep: true,},},mounted() {// console.log("@传过去的值", this.formItemList);},methods: {onSubmit() {// console.log("submit!", this.formInline);for (const item of this.formItemList) {// 确保将区间值设置到 formInline.intervalParam 中if (item.type === 'interval') {this.formInline[item.param] = {start: this.formInline[item.param].start,end: this.formInline[item.param].end,}}}this.$emit('search', this.formInline)// this.resetForm('ruleForm') // 查询后清空搜索条件this.$emit('isShowHSearchFn')},resetForm(formName) {// console.log('清空条件')this.$refs[formName].resetFields()let formInline = {}for (const obj of this.formItemList) {// formInline[obj.param] = obj.defaultSelect || ""; // 重置时下拉框的默认值如果要保留就选用这个if (obj.type === 'interval') {// 处理 区间 input 的清除formInline[obj.param] = { start: '', end: '' }} else {formInline[obj.param] = '' // 所有筛选条件清空}}this.formInline = formInlinethis.cityList = [] // 清空市级下拉this.quList = [] // 清空区县下拉},// 关闭 高级查询onClose() {this.resetForm('ruleForm')this.$emit('isShowHSearchFn')},// 获取输入框的最大长度getMaxLength(param, type) {let maxlength = this.formItemList.find((item) => item.param === param && item.type === type).maxlengthreturn maxlength},// 获取 输入框的 最大位数 和最小位数getLimit(param, type, limitType) {let limit = ''if (limitType === 'min') {limit = this.formItemList.find((item) => item.param === param && item.type === type).min} else if (limitType === 'max') {limit = this.formItemList.find((item) => item.param === param && item.type === type).max}return limit},// 获取 input的 大小 getSize、getSize(param, type) {let size = this.formItemList.find((item) => item.param === param && item.type === type).sizereturn size},// 数字输入框 值改变的事件handleChange(item) {let value = this.formInline[item.param]if (item.min && value < Number(item.min)) {this.formInline[item.param] = item.min} else if (item.max && value > Number(item.max)) {this.formInline[item.param] = item.max} else {this.formInline[item.param] = value}},// 数字输入框 失去焦点的事件handleBlur(item) {let value = this.formInline[item.param]if (item.min && value < Number(item.min)) {this.formInline[item.param] = item.min} else if (item.max && value > Number(item.max)) {this.formInline[item.param] = item.max} else {this.formInline[item.param] = value}},provChange(val) {this.cityList = []this.quList = []this.formInline.City = ''this.formInline.AreaCounty = ''this.cityList = this.formItemList[3].selectOptions.filter((item) => {if (val === item.parentId) {return item}})},cityChange(val) {this.quList = []// console.log("@市", val);this.formInline.AreaCounty = ''this.quList = this.formItemList[4].selectOptions.filter((item) => {if (val === item.parentId) {return item}})},xzqChange(val) {// console.log("@区", val);},},
}
</script><style lang="less" scoped>
.searchBox {// height: 300px;width: 100%;// width: calc(100% - 32px);box-sizing: border-box;background: #fefefe;// margin-top: 45px;border: 1px solid #ececec;position: absolute;z-index: 999;// left: 10%;// right: 10%;padding: 25px 20px;// padding-bottom: 0;box-shadow: 0 7px 18px -12px #bdc0bb;
}
.dialog-search {margin: 0 1rem;text-align: left;// position: relative;// input 框 label的内边距.icon-input {display: flex;}/deep/ .el-form-item__label {padding: 0;}/deep/ .el-form-item__content {// width: 16rem;// 插槽里面的图标// border: 1px solid green;.slotIcon {// border: 1px solid green;margin-right: 0.3125rem /* 5px -> .3125rem */;}// input 框.el-input {width: 16rem;}// select 框.el-select {// border: 1px solid green;.el-input__inner {// width: 16rem;}}}.btn {display: flex;justify-content: flex-end;width: 100%;height: 1.875rem /* 30px -> 1.875rem */;// border: 1px solid red;}
}
</style>
三、表格组件 (Tables2)
<!-- Tables2 表格组件 -->
<template><div><!-- tableData.slice((currentPage - 1) * pageSize,currentPage * pageSize) --><div class="tables"><el-tableref="multipleTable":data="displayedData":max-height="tableHeight"borderrow-key="id"style="width: 100%"tooltip-effect="dark"@selection-change="handleSelectionChange"><el-table-columntype="selection"width="55"align="center":reserve-selection="true"></el-table-column><el-table-column:align="item.align"v-for="(item, index) in columns":key="item.prop":prop="item.prop":label="item.label":fixed="item.fixed":width="item.width":formatter="item.formatter":sortable="item.prop !== 'index' ? false : true":filters="item.prop !== 'index' ? dateFilters(item.prop) : ''":filter-method="item.prop !== 'index' ? filterHandler : ''"></el-table-column><el-table-column fixed="right" label="操作" width="210" align="center"><template #default="{ scope }"><!-- 使用插槽来展示自定义的操作按钮 --><slot name="action-buttons" :scope="scope" /></template></el-table-column></el-table></div><!-- 分页器 --><div class="footer"><span class="demonstration">当前选中<el-tag>{{ multipleSelection.length }}</el-tag> 条</span><!-- computed --><el-paginationalign="center"@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="currentPage":page-sizes="[5, 10, 20, 50]":page-size="pageSize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination></div></div>
</template><script>
export default {props: {tableData: {type: Array,default: () => [],required: true,},columns: {type: Array,default: () => [],},currentPage: {type: Number,default: 1,}, // 当前页码total: {type: Number,default: 20,}, // 总条数pageSize: {type: Number,default: 10,}, // 每页的数据条数tableHeight: {type: Number,default: 600,},},data() {return {multipleSelection: [], // 选中的值,用于以后操作}},components: {},computed: {displayedData() {return this.tableData},displayedColumns() {return this.columns},displayedCurrentPage: {get() {return this.currentPage},set(newValue) {this.$emit('update:currentPage', newValue)},},displayedPageSize: {get() {return this.pageSize},set(newValue) {this.$emit('update:pageSize', newValue)},},dateFilters() {return (columnName) => {const values = new Set(this.tableData.map((item) => item[columnName]))return Array.from(values).map((value) => ({text: value,value: value,}))}},},mounted() {},watch: {},methods: {// 获取选中的值handleSelectionChange(val) {console.log('@选中的值', val)this.multipleSelection = val},/****** computed *******/handleSizeChange(val) {console.log(`每页 ${val} 条`)this.$emit('update:currentPage', 1) // 修改依赖的值,会触发 displayedCurrentPage 的 set 方法this.$emit('update:pageSize', val) // 修改依赖的值,会触发 displayedPageSize 的 set 方法this.$emit('getDataList')},handleCurrentChange(val) {console.log(`当前页: ${val}`)this.$emit('update:currentPage', val) // 修改依赖的值,会触发 displayedCurrentPage 的 set 方法this.$emit('getDataList')},// 根据该列 对应的选项 返回对应的行filterHandler(value, row, column) {const property = column['property']return row[property] === value},},
}
</script>
<style lang="less" scoped>
.footer {position: absolute;// bottom: 0;right: 0;padding-top: 15px;font-size: 14px;width: 100%;// border-top: 1px solid #a29696;line-height: 2.25rem /* 36px -> 2.25rem */;display: flex;justify-content: flex-end;.demonstration {margin-right: 0.625rem /* 10px -> .625rem */;}/deep/ .el-pagination {padding-top: 5px;line-height: 30px;}
}
</style>
四、配置项
/******* 表格列的配置 (字段) ********/
const columns = [{prop: 'index',label: '序号',width: '80',fixed: 'left',align: 'center',},{prop: 'name',label: '姓名',// width: '180',align: 'center',},{prop: 'issue',label: '期次',// width: '180',align: 'center',formatter: function(row, column, cellValue, index) {if (row.issue === '6') {return <el-tag style="backgroundColor: #bf933f;">{row.issue}</el-tag>} else {return <el-tag type="success">{row.issue}</el-tag>}},},{prop: 'creator',label: '上传人',// width: '180',align: 'center',},{prop: 'createDate',label: '上传时间',// width: '180',align: 'center',},{prop: 'size',label: '文件大小',// width: '180',align: 'center',},
]
export { columns }
/******* 高级查询的配置 ********/
const formItemList = [{label: '单位名称:',type: 'input',param: 'unit_name',},{label: '省:',type: 'proSelect',selectOptions: [],param: 'prov',},{label: '市:',type: 'citySelect',selectOptions: [],param: 'city',},{label: '区县:',type: 'xzqSelect',selectOptions: [],param: 'xzqdm',},{label: '联系人:',type: 'input',param: 'linkman',},
]
export { formItemList }
五、父页面
<!-- 测试页面 -->
<template><div><div class="wrap"><Headerref="Header":title="title":input-type="inputType":input-placeholder="inputPlaceholder":select-placeholder="selectPlaceholder":options="options"><template v-slot:button-list><!-- 按钮列表 --><el-buttontype="primary"size="small"icon="el-icon-search"@click="search">查询</el-button><el-buttontype="primary"size="small"icon="el-icon-search"plain@click="showHsearch">高级查询</el-button><el-button type="primary" size="small" icon="el-icon-search" plain>添加</el-button></template></Header><div class="content"><!-- 高级查询 --><SearchCondition:formItemList="formItemList":emitSearch="emitSearch"@search="hSearch"@isShowHSearchFn="isShowHSearchFn":isShowSearch="isShowHSearch"/><!-- 表格 v-model 对应 computed --><Tablesv-model:tableData="tableData"v-model:currentPage="currentPage"v-model:pageSize="pageSize":total="total":columns="columns":tableHeight="tableHeight"@getDataList="getWeekList"><!-- 使用插槽来配置自定义的操作按钮 --><template #action-buttons="scope"><el-buttonlinktype="primary"size="mini"@click.prevent="viewRow(scope)">查看</el-button><el-buttonlinktype="primary"size="mini"@click.prevent="editRow(scope)">编辑</el-button><el-buttonlinktype="primary"size="mini"@click.prevent="deleteRow(scope)">删除</el-button></template></Tables></div></div></div>
</template><script>
import SearchCondition from '@/Tcomponents/SearchCondition.vue'
import Header from '@/Tcomponents/Header.vue'
import Tables from '@/Tcomponents/Tables2.vue'
import { WeeklyReportReq } from '@/api/methods'
import { columns } from './options/column'
import { formItemList } from './options/formItemList'
export default {data() {return {/********* Header 组件 - start ***********/title: '测试页面',inputType: 'input',inputPlaceholder: '请输入内容',selectPlaceholder: '请选择内容',// inputType 是 select 的时候需要配置options: [{ label: '选项11', value: 'value11' },{ label: '选项22', value: 'value22' },{ label: '选项33', value: 'value33' },// 添加更多选项...],/********* Header 组件 - end ***********//********* 高级查询组件 - start *********/// 是否显示高级查询isShowHSearch: false,emitSearch: false,// 查询组件的配置项formItemList: formItemList,/********* 高级查询组件 - end *********//********* 表格组件 - start *********/tableData: [{createDate: '2023-08-08 15:22:25',createID: 1,creator: '超级管理员',id: '868191e5-df45-446a-b759-2e38e1cac95c',issue: '2',name: '20230726153935新建 DOCX 文档',size: '9KB',},{createDate: '2023-08-08 15:22:25',createID: 1,creator: '超级管理员',id: '868191e5-df45-446a-b759-2e38e1cac95c',issue: '2',name: '20230726153935新建 DOCX 文档',size: '9KB',},{createDate: '2023-08-08 15:22:25',createID: 1,creator: '超级管理员',id: '868191e5-df45-446a-b759-2e38e1cac95c',issue: '2',name: '20230726153935新建 DOCX 文档',size: '9KB',},{createDate: '2023-08-08 15:22:25',createID: 1,creator: '超级管理员',id: '868191e5-df45-446a-b759-2e38e1cac95c',issue: '2',name: '20230726153935新建 DOCX 文档',size: '9KB',},],columns: columns,// multipleSelection: [],currentPage: 1, // 当前页码total: 20, // 总条数pageSize: 10, // 每页的数据条数tableHeight: null,/********* 表格组件 - end *********/}},components: { SearchCondition, Header, Tables },computed: {},mounted() {this.getDomHeight()this.getWeekList()},methods: {// 查询search() {console.log('@点击查询=获取参数', this.$refs.Header.searchValue)this.getWeekList()},// 高级查询(打开高级查询)showHsearch() {this.$refs.Header.searchValue = ''this.isShowHSearch = !this.isShowHSearch},// 获取高级查询参数hSearch(params) {console.log('高级查询的参数', params)},// 高级查询里面的关闭isShowHSearchFn() {this.isShowHSearch = !this.isShowHSearch},// 动态获取表格的高度getDomHeight() {setTimeout(() => {const content = document.querySelector('.content').offsetHeightconst footer = document.querySelector('.footer').offsetHeightthis.tableHeight = content - footer}, 200)},viewRow(row) {console.log('@viewRow', row)},editRow(row) {console.log('@editRow', row)},deleteRow(row) {console.log('@deleteRow', row)},// 测试 调用数据async getWeekList() {let params = {pageindex: this.currentPage,pagesize: this.pageSize,name: this.$refs.Header.searchValue,}let res = await WeeklyReportReq(params)res.data.data.forEach((item, index) => {item.index = ++index})// this.tableData = res.data.data// console.log('@this.tableData', this.tableData)this.total = res.data.total},},
}
</script>
<style lang="less" scoped>// @import '@/assets/css/page.less';/* page.less */.wrap {height: calc(100vh - 95px);width: 100%;padding: 15px;.content {margin-top: 15px;height: calc(100% - 50px);position: relative;.footer {position: absolute;right: 0;padding-top: 15px;font-size: 14px;width: 100%;line-height: 2.25rem;display: flex;justify-content: flex-end;.demonstration {margin-right: 0.625rem;}/deep/ .el-pagination {padding-top: 5px;line-height: 30px;}}}}
</style>
相关文章:

【代码】表格封装 + 高级查询 + 搜索 +分页器 (极简)
一、标题 查询条件按钮(Header) <!-- Header 标题搜索栏 --> <template><div><div class"header"><div class"h-left"><div class"title"><div class"desc-test">…...

ant.design 组件库中的 Tree 组件实现可搜索的树: React+and+ts
ant.design 组件库中的 Tree 组件实现可搜索的树,在这里我会详细介绍每个方法,以及容易踩坑的点。 效果图: 首先是要导入的文件 // React 自带的属性 import React, { useMemo, useState } from react; // antd 组件库中的,输入…...

Linux系统编程之信号(上)
一、信号概念 信号就是软件中断。每当程序收到一个信号,都需要按指定的方法去处理。以下是UNIX系统的信号表。 其中core表示产生一个复制了该进程内存映像的core文件,它保存了程序现场,可以使用gdb来调试。 二、signal() signal()函数用于改…...
23.Netty源码之内置解码器
highlight: arduino-light Netty内置的解码器 在前两节课我们介绍了 TCP 拆包/粘包的问题,以及如何使用 Netty 实现自定义协议的编解码。可以看到,网络通信的底层实现,Netty 都已经帮我们封装好了,我们只需要扩展 ChannelHandler …...

sigmoid ReLU 等激活函数总结
sigmoid ReLU sigoid和ReLU对比 1.sigmoid有梯度消失问题:当sigmoid的输出非常接近0或者1时,区域的梯度几乎为0,而ReLU在正区间的梯度总为1。如果Sigmoid没有正确初始化,它可能在正区间得到几乎为0的梯度。使模型无法有效训练。 …...

RabbitMQ 消息队列
文章目录 🍰有几个原因可以解释为什么要选择 RabbitMQ:🥩mq之间的对比🌽RabbitMQ vs Apache Kafka🌽RabbitMQ vs ActiveMQ🌽RabbitMQ vs RocketMQ🌽RabbitMQ vs Redis 🥩linux docke…...

PHP实现在线进制转换器,10进制,2、4、8、16、32进制转换
1.接口文档 2.laravel实现代码 /*** 进制转换计算器* return \Illuminate\Http\JsonResponse*/public function binaryConvertCal(){$ten $this->request(ten);$two $this->request(two);$four $this->request(four);$eight $this->request(eight);$sixteen …...

报错 | Spring报错详解
Spring报错详解 一、前言二、报错提示三、分层解读1.最下面一层Caused by2.上一层Caused by3.最上层Caused by 四、总结五、解决方案 一、前言 本文主要是记录在初次学习Spring时遇到报错后的解读以及解决方案 二、报错提示 三、分层解读 遇到报错的时候,我们需要…...

PHP最简单自定义自己的框架数据库封装调用(五)
1、实现效果调用实现数据增删改查封装 2、index.php 入口定义数据库账号密码 <?php//定义当前请求模块 define("MODULE",index);//定义数据库 define(DB_HOST,localhost);//数据库地址 define(DB_DATABASE,aaa);//数据库 define(DB_USER,root);//数据库账号 def…...
使用Redis来实现点赞功能的基本思路
使用Redis来实现点赞功能是一种高效的选择,因为Redis是一个内存数据库,适用于处理高并发的数据操作。以下是一个基本的点赞功能在Redis中的设计示例: 假设我们有一个文章或帖子,用户可以对其进行点赞,取消点赞&#x…...

【黑马头条之app端文章搜索ES-MongoDB】
本笔记内容为黑马头条项目的app端文章搜索部分 目录 一、今日内容介绍 1、App端搜索-效果图 2、今日内容 二、搭建ElasticSearch环境 1、拉取镜像 2、创建容器 3、配置中文分词器 ik 4、使用postman测试 三、app端文章搜索 1、需求分析 2、思路分析 3、创建索引和…...

Nginx安装以及LVS-DR集群搭建
Nginx安装 1.环境准备 yum insatall -y make gcc gcc-c pcre-devel #pcre-devel -- pcre库 #安装openssl-devel yum install -y openssl-devel 2.tar安装包 3.解压软件包并创建软连接 tar -xf nginx-1.22.0.tar.gz -C /usr/local/ ln -s /usr/local/nginx-1.22.0/ /usr/local…...

后端开发9.商品类型模块
概述 简介 商品类型我设计的复杂了点,设计了多级类型 效果图 数据库设计...
spring框架自带的http工具RestTemplate用法
1. RestTemplate是什么? RestTemplate是由Spring框架提供的一个可用于应用中调用rest服务的类它简化了与http服务的通信方式。 RestTemplate是一个执行HTTP请求的同步阻塞式工具类,它仅仅只是在 HTTP 客户端库(例如 JDK HttpURLConnection&a…...

【flink】Checkpoint expired before completing.
使用flink同步数据出现错误Checkpoint expired before completing. 11:32:34,455 WARN org.apache.flink.runtime.checkpoint.CheckpointFailureManager [Checkpoint Timer] - Failed to trigger or complete checkpoint 4 for job 1b1d41031ea45d15bdb3324004c2d749. (2 con…...

【论文阅读】NoDoze:使用自动来源分类对抗威胁警报疲劳(NDSS-2019)
NODOZE: Combatting Threat Alert Fatigue with Automated Provenance Triage 伊利诺伊大学芝加哥分校 Hassan W U, Guo S, Li D, et al. Nodoze: Combatting threat alert fatigue with automated provenance triage[C]//network and distributed systems security symposium.…...
【ARM64 常见汇编指令学习 16 -- ARM64 SMC 指令】
文章目录 ARMv8 同步异常同步异常指令SMC TYPE 上篇文章:ARM64 常见汇编指令学习 15 – ARM64 标志位的学习 下篇文章:ARM64 常见汇编指令学习 17 – ARM64 BFI 指令 ARMv8 同步异常 在ARMv8架构中,同步异常主要包括以下几种: Un…...

uprobe trace多线程mutex等待耗时
问题背景环境 ubuntu2204 服务器支持debugfs uprobe,为了提升应用程序的性能,需要量化不同参数下多线程主程序等待在mutex上的耗时区别 linux document中对uprobe events的说明如下 uprobetracer.rst - Documentation/trace/uprobetracer.rst - Linux…...
Linux 和 MacOS 中的 profile 文件详解(一)
什么是 profile 文件? profile 文件是 Linux、MacOS 等(unix、类 unix 系统)系统中的一种配置文件,主要用于设置系统和用户的环境变量。 在 shell 中,可以通过执行 profile 文件来设置用户的环境变量。shell 有两种运…...

不用技术代码,如何制作成绩查询系统?
为了解决学校无力承担传统学生考试成绩查询平台的高昂费用,老师们可以考虑使用易查分这样的工具来免费制作一个学生考试成绩查询平台。易查分是一种简单易用的在线成绩查询系统,可以帮助老师们快速创建一个个性化的学生考试成绩查询平台。 使用易查分制作…...

(十)学生端搭建
本次旨在将之前的已完成的部分功能进行拼装到学生端,同时完善学生端的构建。本次工作主要包括: 1.学生端整体界面布局 2.模拟考场与部分个人画像流程的串联 3.整体学生端逻辑 一、学生端 在主界面可以选择自己的用户角色 选择学生则进入学生登录界面…...

【力扣数据库知识手册笔记】索引
索引 索引的优缺点 优点1. 通过创建唯一性索引,可以保证数据库表中每一行数据的唯一性。2. 可以加快数据的检索速度(创建索引的主要原因)。3. 可以加速表和表之间的连接,实现数据的参考完整性。4. 可以在查询过程中,…...
DeepSeek 技术赋能无人农场协同作业:用 AI 重构农田管理 “神经网”
目录 一、引言二、DeepSeek 技术大揭秘2.1 核心架构解析2.2 关键技术剖析 三、智能农业无人农场协同作业现状3.1 发展现状概述3.2 协同作业模式介绍 四、DeepSeek 的 “农场奇妙游”4.1 数据处理与分析4.2 作物生长监测与预测4.3 病虫害防治4.4 农机协同作业调度 五、实际案例大…...

Unity | AmplifyShaderEditor插件基础(第七集:平面波动shader)
目录 一、👋🏻前言 二、😈sinx波动的基本原理 三、😈波动起来 1.sinx节点介绍 2.vertexPosition 3.集成Vector3 a.节点Append b.连起来 4.波动起来 a.波动的原理 b.时间节点 c.sinx的处理 四、🌊波动优化…...

论文阅读:LLM4Drive: A Survey of Large Language Models for Autonomous Driving
地址:LLM4Drive: A Survey of Large Language Models for Autonomous Driving 摘要翻译 自动驾驶技术作为推动交通和城市出行变革的催化剂,正从基于规则的系统向数据驱动策略转变。传统的模块化系统受限于级联模块间的累积误差和缺乏灵活性的预设规则。…...

macOS 终端智能代理检测
🧠 终端智能代理检测:自动判断是否需要设置代理访问 GitHub 在开发中,使用 GitHub 是非常常见的需求。但有时候我们会发现某些命令失败、插件无法更新,例如: fatal: unable to access https://github.com/ohmyzsh/oh…...
鸿蒙HarmonyOS 5军旗小游戏实现指南
1. 项目概述 本军旗小游戏基于鸿蒙HarmonyOS 5开发,采用DevEco Studio实现,包含完整的游戏逻辑和UI界面。 2. 项目结构 /src/main/java/com/example/militarychess/├── MainAbilitySlice.java // 主界面├── GameView.java // 游戏核…...
Django RBAC项目后端实战 - 03 DRF权限控制实现
项目背景 在上一篇文章中,我们完成了JWT认证系统的集成。本篇文章将实现基于Redis的RBAC权限控制系统,为系统提供细粒度的权限控制。 开发目标 实现基于Redis的权限缓存机制开发DRF权限控制类实现权限管理API配置权限白名单 前置配置 在开始开发权限…...

动态规划-1035.不相交的线-力扣(LeetCode)
一、题目解析 光看题目要求和例图,感觉这题好麻烦,直线不能相交啊,每个数字只属于一条连线啊等等,但我们结合题目所给的信息和例图的内容,这不就是最长公共子序列吗?,我们把最长公共子序列连线起…...

Win系统权限提升篇UAC绕过DLL劫持未引号路径可控服务全检项目
应用场景: 1、常规某个机器被钓鱼后门攻击后,我们需要做更高权限操作或权限维持等。 2、内网域中某个机器被钓鱼后门攻击后,我们需要对后续内网域做安全测试。 #Win10&11-BypassUAC自动提权-MSF&UACME 为了远程执行目标的exe或者b…...