通知公告动态

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">
<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>
</div>
</div>
</template>
<script type="text/javascript">
export default {
name: 'notice',
name: "notice",
props: {
message: {
type: String,
required: true
}
required: true,
},
},
data() {
return {
};
return {};
},
mounted: function () {
//
@ -48,8 +53,8 @@ export default {
// marquee.style.transform = 'translateX(' + disx + 'px)'
marquee.style.left = disx + "px";
}, 30); //
}
}
},
},
};
// JavaScript Document
(function px2rem(doc, win) {
@ -97,12 +102,12 @@ li {
display: flex;
justify-content: center;
align-items: center;
color: #E6A23C;
color: #e6a23c;
flex: 0 0 100px;
}
.ico-horn .icon {
font-size: 24px;
color: #E6A23C;
color: #e6a23c;
}
/* 以下代码与滚动相关 */
.marquee-wrap {

View File

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

View File

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

View File

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