通知公告动态

This commit is contained in:
zhanglipeng 2021-05-31 09:27:14 +08:00
parent 678ad365ae
commit ea3a1cfbe5
4 changed files with 163 additions and 70 deletions

View File

@ -7,24 +7,29 @@
<!-- 滚动文字区域 --> <!-- 滚动文字区域 -->
<div class="marquee-wrap"> <div class="marquee-wrap">
<ul class="marquee-box" id="marquee-box"> <ul class="marquee-box" id="marquee-box">
<li class="marquee-list" :key="i" v-for="i in 3" v-html="message" :id="i==1?'marquee':''"></li> <li
class="marquee-list"
:key="i"
v-for="i in 1"
v-html="message"
:id="i == 1 ? 'marquee' : ''"
></li>
</ul> </ul>
</div> </div>
</div> </div>
</template> </template>
<script type="text/javascript"> <script type="text/javascript">
export default { export default {
name: 'notice', name: "notice",
props: { props: {
message: { message: {
type: String, type: String,
required: true required: true,
} },
}, },
data() { data() {
return { return {};
};
}, },
mounted: function () { mounted: function () {
// //
@ -48,8 +53,8 @@ export default {
// marquee.style.transform = 'translateX(' + disx + 'px)' // marquee.style.transform = 'translateX(' + disx + 'px)'
marquee.style.left = disx + "px"; marquee.style.left = disx + "px";
}, 30); // }, 30); //
} },
} },
}; };
// JavaScript Document // JavaScript Document
(function px2rem(doc, win) { (function px2rem(doc, win) {
@ -97,12 +102,12 @@ li {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color: #E6A23C; color: #e6a23c;
flex: 0 0 100px; flex: 0 0 100px;
} }
.ico-horn .icon { .ico-horn .icon {
font-size: 24px; font-size: 24px;
color: #E6A23C; color: #e6a23c;
} }
/* 以下代码与滚动相关 */ /* 以下代码与滚动相关 */
.marquee-wrap { .marquee-wrap {

View File

@ -58,6 +58,7 @@ import PieChart from "./dashboard/PieChart";
import BarChart from "./dashboard/BarChart"; import BarChart from "./dashboard/BarChart";
import LineChart from "./dashboard/LineChart"; import LineChart from "./dashboard/LineChart";
import { bindwx, isbindwx, wxlogin } from "@/api/system/user"; import { bindwx, isbindwx, wxlogin } from "@/api/system/user";
import { listNotice, getNotice } from "@/api/system/notice";
//import { getSchoolCalendars } from "@/api/benyi/schoolcalendar"; //import { getSchoolCalendars } from "@/api/benyi/schoolcalendar";
//import { getSchoolCalendarsClass } from "@/api/benyi/schoolcalendarclass"; //import { getSchoolCalendarsClass } from "@/api/benyi/schoolcalendarclass";
@ -73,22 +74,42 @@ export default {
}, },
data() { data() {
return { return {
message: `本一智慧平台可用手机微信登录啦关注“本一智慧平台”公众号点击左下角菜单“智慧平台”进入2.0平台入口。首次登录输入账号密码,根据提示绑定微信号码!以后登录,可以使用手机直接微信登录,无需再输入账号密码,方便快捷!`, message: ``,
code: "", code: "",
calendarData: [], calendarData: [],
value: new Date(), value: new Date(),
// //
queryParams: {}, queryParams: {},
//
queryParams_note: {
status: "0",
},
// lineChartData: lineChartData.newVisitis, // lineChartData: lineChartData.newVisitis,
}; };
}, },
created() { created() {
this.getList();
this.code = this.$route.query.code; this.code = this.$route.query.code;
//console.log(this.code); //console.log(this.code);
this.bindWxInfo(); this.bindWxInfo();
//this.getSchoolCalendarList(); //this.getSchoolCalendarList();
}, },
methods: { methods: {
/** 查询公告列表 */
getList() {
listNotice(this.queryParams_note).then((response) => {
console.log(response.rows);
if (response.rows.length > 0) {
var msg = "";
response.rows.forEach((element) => {
msg = msg + element.noticeContent;
});
this.message = msg;
} else {
this.message = "暂无公告";
}
});
},
async bindWxInfo() { async bindWxInfo() {
await isbindwx().then((res) => { await isbindwx().then((res) => {
if (this.code != "" && this.code != null && res.msg == "1") { if (this.code != "" && this.code != null && res.msg == "1") {

View File

@ -1,6 +1,11 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="68px"
>
<el-form-item label="公告标题" prop="noticeTitle"> <el-form-item label="公告标题" prop="noticeTitle">
<el-input <el-input
v-model="queryParams.noticeTitle" v-model="queryParams.noticeTitle"
@ -20,7 +25,12 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="类型" prop="noticeType"> <el-form-item label="类型" prop="noticeType">
<el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small"> <el-select
v-model="queryParams.noticeType"
placeholder="公告类型"
clearable
size="small"
>
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in typeOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -30,8 +40,16 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -43,7 +61,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:notice:add']" v-hasPermi="['system:notice:add']"
>新增</el-button> >新增</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -53,7 +72,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:notice:edit']" v-hasPermi="['system:notice:edit']"
>修改</el-button> >修改</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -63,13 +83,23 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:notice:remove']" v-hasPermi="['system:notice:remove']"
>删除</el-button> >删除</el-button
>
</el-col> </el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="noticeList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="noticeId" width="100" /> <el-table-column
label="序号"
align="center"
prop="noticeId"
width="100"
/>
<el-table-column <el-table-column
label="公告标题" label="公告标题"
align="center" align="center"
@ -90,13 +120,27 @@
:formatter="statusFormat" :formatter="statusFormat"
width="100" width="100"
/> />
<el-table-column label="创建者" align="center" prop="createBy" width="100" /> <el-table-column
<el-table-column label="创建时间" align="center" prop="createTime" width="100"> label="创建者"
align="center"
prop="createBy"
width="100"
/>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="100"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -104,14 +148,16 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:notice:edit']" v-hasPermi="['system:notice:edit']"
>修改</el-button> >修改</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:notice:remove']" v-hasPermi="['system:notice:remove']"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -130,7 +176,10 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="公告标题" prop="noticeTitle"> <el-form-item label="公告标题" prop="noticeTitle">
<el-input v-model="form.noticeTitle" placeholder="请输入公告标题" /> <el-input
v-model="form.noticeTitle"
placeholder="请输入公告标题"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -152,13 +201,14 @@
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictValue" :label="dict.dictValue"
>{{dict.dictLabel}}</el-radio> >{{ dict.dictLabel }}</el-radio
>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="内容"> <el-form-item label="内容">
<Editor v-model="form.noticeContent" /> <el-input type="textarea" v-model="form.noticeContent" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -172,14 +222,21 @@
</template> </template>
<script> <script>
import { listNotice, getNotice, delNotice, addNotice, updateNotice, exportNotice } from "@/api/system/notice"; import {
import Editor from '@/components/Editor'; listNotice,
getNotice,
delNotice,
addNotice,
updateNotice,
exportNotice,
} from "@/api/system/notice";
//import Editor from '@/components/Editor';
export default { export default {
name: "Notice", name: "Notice",
components: { // components: {
Editor // Editor
}, // },
data() { data() {
return { return {
// //
@ -208,27 +265,27 @@ export default {
pageSize: 10, pageSize: 10,
noticeTitle: undefined, noticeTitle: undefined,
createBy: undefined, createBy: undefined,
status: undefined status: undefined,
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
noticeTitle: [ noticeTitle: [
{ required: true, message: "公告标题不能为空", trigger: "blur" } { required: true, message: "公告标题不能为空", trigger: "blur" },
], ],
noticeType: [ noticeType: [
{ required: true, message: "公告类型不能为空", trigger: "blur" } { required: true, message: "公告类型不能为空", trigger: "blur" },
] ],
} },
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("sys_notice_status").then(response => { this.getDicts("sys_notice_status").then((response) => {
this.statusOptions = response.data; this.statusOptions = response.data;
}); });
this.getDicts("sys_notice_type").then(response => { this.getDicts("sys_notice_type").then((response) => {
this.typeOptions = response.data; this.typeOptions = response.data;
}); });
}, },
@ -236,7 +293,7 @@ export default {
/** 查询公告列表 */ /** 查询公告列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listNotice(this.queryParams).then(response => { listNotice(this.queryParams).then((response) => {
this.noticeList = response.rows; this.noticeList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -262,7 +319,7 @@ export default {
noticeTitle: undefined, noticeTitle: undefined,
noticeType: undefined, noticeType: undefined,
noticeContent: undefined, noticeContent: undefined,
status: "0" status: "0",
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -278,9 +335,9 @@ export default {
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.noticeId) this.ids = selection.map((item) => item.noticeId);
this.single = selection.length!=1 this.single = selection.length != 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
@ -291,8 +348,8 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const noticeId = row.noticeId || this.ids const noticeId = row.noticeId || this.ids;
getNotice(noticeId).then(response => { getNotice(noticeId).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改公告"; this.title = "修改公告";
@ -300,10 +357,10 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.noticeId != undefined) { if (this.form.noticeId != undefined) {
updateNotice(this.form).then(response => { updateNotice(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
@ -313,7 +370,7 @@ export default {
} }
}); });
} else { } else {
addNotice(this.form).then(response => { addNotice(this.form).then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
@ -328,18 +385,25 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const noticeIds = row.noticeId || this.ids const noticeIds = row.noticeId || this.ids;
this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', "警告", { this.$confirm(
'是否确认删除公告编号为"' + noticeIds + '"的数据项?',
"警告",
{
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning",
}).then(function() { }
)
.then(function () {
return delNotice(noticeIds); return delNotice(noticeIds);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(function() {}); })
} .catch(function () {});
} },
},
}; };
</script> </script>

View File

@ -36,6 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="noticeType != null and noticeType != ''"> <if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType} AND notice_type = #{noticeType}
</if> </if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="createBy != null and createBy != ''"> <if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%') AND create_by like concat('%', #{createBy}, '%')
</if> </if>