若依常用功能-公告
2026-04-02 11:41:06 81浏览
若依常用功能-公告
notice.vue
<template>
<div class="notice-container">
<!-- Banner区域 -->
<div class="notice-banner">
<div class="banner-mask">
<div class="banner-content">
<h1 class="banner-title">网站公告</h1>
<p class="banner-subtitle">实时了解网站动态</p>
</div>
</div>
</div>
<!-- 筛选区域 -->
<div class="filter-container">
<div class="filter-section">
<div class="filter-label">搜索:</div>
<div class="filter-items">
<el-input
v-model="queryParams.noticeTitle"
placeholder="标题"
clearable
size="small"
style="width: 240px;"
@keyup.enter.native="handleQuery"
>
<el-button slot="append" icon="el-icon-search" @click="handleQuery"></el-button>
</el-input>
</div>
</div>
</div>
<!-- 职位列表 -->
<div class="notice-list-container">
<div v-loading="loading" class="notice-list">
<div v-for="(item, index) in noticeList" :key="index" class="notice-item" >
<div class="notice-header">
<h3 class="notice-title">{{ item.noticeTitle }}</h3>
</div>
<div class="notice-notice">
<span class="notice-name notice-desc">{{ parseTime(item.createTime) }}发布</span>
</div>
<div class="notice-footer">
<el-button type="primary" size="small" @click="handleDetail(item)">查看详情</el-button>
</div>
</div>
</div>
<!-- 分页 -->
<div v-if="total>0" class="pagination-container">
<el-pagination
background
layout="total, prev, pager, next"
:total="total"
:page-size="queryParams.pageSize"
:current-page="queryParams.pageNum"
@current-change="handlePageChange"
/>
</div>
<el-empty v-if="total==0" description="暂无数据"></el-empty>
</div>
<el-dialog title=" 详情" :visible.sync="detailOpen" width="800px" append-to-body>
<h2 style="text-align: center;">{{dobj.noticeTitle}}</h2>
<el-divider>{{parseTime(dobj.createTime)}}</el-divider>
<div v-html="dobj.noticeContent"></div>
</el-dialog>
</div>
</template>
<script>
import { frontlistNotice } from "@/api/front/fnotice";
export default {
name: 'notice',
data() {
return {
detailOpen:false,
dobj:{},
total: 0,
loading: false,
queryParams: {
pageNum: 1,
pageSize: 10,
noticeTitle: null,
},
noticeList:[],
}
},
methods: {
getList() {
this.loading = true
frontlistNotice(this.queryParams).then(response => {
this.noticeList = response.rows
this.total = response.total
this.loading = false
})
},
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
handlePageChange(val) {
this.queryParams.pageNum = val
this.getList()
},
handleDetail(item){
this.dobj=item;
this.detailOpen=true;
if(this.dobj.noticeContent)this.dobj.noticeContent=this.dobj.noticeContent.replace(/<img/g,"<img style='max-width:100%;'");
}
},
created() {
this.getList()
}
}
</script>
<style scoped>
.notice-container {
width: 100%;
background-color: #f5f7fa;
}
.notice-banner {
position: relative;
width: 100%;
height: 400px;
background-image: url('../../assets/images/job-banner.jpg');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.banner-mask {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
display: flex;
justify-content: center;
align-items: center;
}
.banner-content {
text-align: center;
color: #fff;
}
.banner-title {
font-size: 48px;
font-weight: bold;
margin-bottom: 20px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
letter-spacing: 2px;
}
.banner-subtitle {
font-size: 20px;
font-weight: 300;
max-width: 800px;
margin: 0 auto;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
line-height: 1.6;
}
.filter-container {
background-color: #fff;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
margin: 20px auto;
max-width: 1200px;
padding: 20px;
border-radius: 4px;
}
.filter-section {
display: flex;
margin-bottom: 15px;
align-items: center;
}
.filter-section:last-child {
margin-bottom: 0;
}
.filter-label {
font-weight: bold;
color: #303133;
min-width: 100px;
}
.filter-items {
flex: 1;
}
.notice-list-container {
max-width: 1200px;
margin: 0 auto 30px;
}
.notice-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(550px, 1fr));
gap: 20px;
}
.notice-item {
background-color: #fff;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
transition: all 0.3s;
display: flex;
flex-direction: column;
}
.notice-item:hover {
transform: translateY(-5px);
box-shadow: 0 8px 20px 0 rgba(0, 0, 0, 0.15);
}
.notice-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.notice-title {
font-size: 18px;
font-weight: bold;
color: #303133;
margin: 0;
flex: 1;
}
.notice-desc {
display: inline-block;
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.notice-notice {
display: flex;
justify-content: space-between;
margin-bottom: 12px;
color: #606266;
font-size: 14px;
}
.notice-name {
font-weight: 500;
}
.notice-footer {
margin-top: auto;
display: flex;
justify-content: flex-end;
}
.pagination-container {
display: flex;
justify-content: center;
margin-top: 30px;
}
</style>
contrl
package com.ruoyi.system.controller.front;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.JfCompany;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.IJfCompanyService;
import com.ruoyi.system.service.ISysNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 招聘岗位信息Controller
*
* @author ruoyi
* @date 2026-03-24
*/
@RestController
@RequestMapping("/front/notice")
public class FSysNoticeController extends BaseController
{
@Autowired
private ISysNoticeService SysNoticeService;
/**
* 查询招聘岗位信息列表
*/
@GetMapping("/list")
public TableDataInfo list(SysNotice o)
{
o.setStatus("0");
startPageOrderBy("notice_id desc");
List<SysNotice> list = SysNoticeService.selectNoticeList(o);
return getDataTable(list);
}
}
js
import request from '@/utils/request'
// 查询企业信息列表
export function frontlistNotice(query) {
return request({
url: '/front/notice/list',
method: 'get',
params: query
})
}
好博客就要一起分享哦!分享海报
此处可发布评论
评论(0)展开评论
暂无评论,快来写一下吧
展开评论
您可能感兴趣的博客
他的专栏
他感兴趣的技术


java
vue
springboot
Mysql
ssm
小程序
uniapp
js和jquery