开发消息通知功能

This commit is contained in:
wangxulei
2025-01-15 10:28:21 +08:00
parent 14050af858
commit 3ba2d600c2
37 changed files with 2887 additions and 8 deletions

View File

@@ -0,0 +1,48 @@
import request from '@/utils/request'
export function getNoticePage(params) {
return request({
url: '/admin/notice/page',
method: 'get',
params
})
}
export function getNoticeList(params) {
return request({
url: '/admin/notice/list',
method: 'get',
params
})
}
export function addNotice(data) {
return request({
url: '/admin/notice/add',
method: 'post',
data: data
})
}
export function editNotice(data) {
return request({
url: '/admin/notice/update',
method: 'post',
data: data
})
}
export function deleteNotice(noticeId) {
return request({
url: '/admin/notice/delete/' + noticeId,
method: 'get'
})
}
export function sendNotice(data) {
return request({
url: '/admin/notice/sendNotice',
method: 'post',
data: data
})
}

View File

@@ -0,0 +1,41 @@
import request from '@/utils/request'
export function getReceivePage(params) {
return request({
url: '/admin/receive/page',
method: 'get',
params
})
}
export function getReceiveList(params) {
return request({
url: '/admin/receive/list',
method: 'get',
params
})
}
export function addReceive(data) {
return request({
url: '/admin/receive/add',
method: 'post',
data: data
})
}
export function editReceive(data) {
return request({
url: '/admin/receive/update',
method: 'post',
data: data
})
}
export function deleteReceive(receiveId) {
return request({
url: '/admin/receive/delete/' + receiveId,
method: 'get'
})
}

View File

@@ -35,7 +35,7 @@ export default {
pageSizes: {
type: Array,
default() {
return [10, 20, 30, 50]
return [10, 20, 30, 50,200]
}
},
layout: {

View File

@@ -32,6 +32,13 @@ import '@/permission' // permission control
import LemonIMUI from 'lemon-imui';
import 'lemon-imui/dist/index.css';
Vue.use(LemonIMUI);
//引入markdown
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
// use markdown
Vue.use(mavonEditor)
// set ElementUI lang to EN
Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui按如下方式声明

View File

@@ -0,0 +1,142 @@
<template>
<div>
<el-dialog
:close-on-click-modal="false"
top="8vh"
width="40%"
:visible.sync="dialogVisible"
center
@close="handleCancel"
>
<div class="el-dialog-div">
<el-form
:rules="rules"
ref="dataForm"
:model="temp"
label-position="right"
label-width="120px"
style="height: 90%;"
>
<el-form-item label="通知标题" prop="noticeTitle" class="is-required">
<el-input v-model="temp.noticeTitle" placeholder="通知标题" />
</el-form-item>
<el-form-item label="通知内容" prop="noticeContent" class="is-required">
<mavon-editor
ref="md"
placeholder="请输入文档内容..."
:boxShadow="false"
style="z-index:1;border: 1px solid #d9d9d9;height:50vh"
v-model="temp.noticeContent"
:toolbars="toolbars"
/>
</el-form-item>
<el-form-item label="跳转url" prop="redirectUrl" class="is-required">
<el-input v-model="temp.redirectUrl" placeholder="跳转url" />
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {addNotice} from "@/api/business/notice/notice";
import {setRequiredFields} from "@/utils";
const requiredFields = []
export default {
name: "addForm",
data() {
return {
rules: setRequiredFields(requiredFields),
dialogVisible: false,
temp: {
noticeId:'',
noticeTitle:'',
noticeContent:'',
redirectUrl:'',
version:'',
deleted:'',
shopId:'',
shopName:'',
createName:'',
createTime:'',
createId:'',
updateTime:'',
updateName:'',
updateId:'',
},
toolbars: {
bold: true, // 粗体
italic: true, // 斜体
header: true, // 标题
underline: true, // 下划线
strikethrough: true, // 中划线
mark: true, // 标记
superscript: true, // 上角标
subscript: true, // 下角标
quote: true, // 引用
ol: true, // 有序列表
ul: true, // 无序列表
link: true, // 链接
// imagelink: true, // 图片链接
code: true, // code
table: true, // 表格
fullscreen: true, // 全屏编辑
readmodel: true, // 沉浸式阅读
htmlcode: true, // 展示html源码
help: true, // 帮助
/* 1.3.5 */
undo: true, // 上一步
redo: true, // 下一步
trash: true, // 清空
save: false, // 保存触发events中的save事件
/* 1.4.2 */
navigation: true, // 导航目录
/* 2.1.8 */
alignleft: true, // 左对齐
aligncenter: true, // 居中
alignright: true, // 右对齐
/* 2.2.1 */
subfield: true, // 单双栏模式
preview: true // 预览
},
}
},
methods: {
open() {
this.dialogVisible = true
},
submit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
addNotice(this.temp).then(response =>{
this.handleCancel()
this.$emit('ok', response.data)
})
} else {
console.log('error submit!!');
return false;
}
});
},
handleCancel() {
//初始化
this.temp = this.$options.data().temp
this.dialogVisible = false
this.$refs['dataForm'].resetFields();
}
},
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,467 @@
<template>
<div class="app" style="height: 80vh">
<div class="filter-container">
<el-input
v-model="listQuery.keyword"
size="small"
placeholder="请输入关键词"
clearable
class="filter-item"
style="width: 200px;margin-left: 10px;"
/>
<el-button-group style="margin-left: 10px;">
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-search"
@click="search"
>
搜索
</el-button>
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-refresh"
@click="refresh"
>
重置
</el-button>
</el-button-group>
</div>
<el-table
:row-class-name="rowClassName"
@row-click="handleRowClick"
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
height="70%"
class="table-container"
highlight-current-row
>
          <el-table-column label="选择" width="60px" align="center" header-align="center">
                  <template slot-scope="scope">
                      <el-radio
:label="scope.$index"
v-model="tableRadio"
style="margin-left: 10px;">{{''}}</el-radio>
                </template>
            </el-table-column>
<el-table-column
label="序号"
width="80"
align="center"
>
<template slot-scope="scope">
{{ scope.$index+1 }}
</template>
</el-table-column>
<el-table-column
label="小红书号"
width="150"
align="center"
>
<template slot-scope="scope">
{{ scope.row.authorNo }}
</template>
</el-table-column>
<el-table-column
label="昵称"
width="120"
align="center"
>
<template slot-scope="scope">
{{ scope.row.authorName }}
</template>
</el-table-column>
<el-table-column
label="账号"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.phoneNumber }}
</template>
</el-table-column>
<el-table-column
label="头像"
width="130"
align="center"
>
<template slot-scope="scope">
<el-avatar shape="circle" :size="80" fit="cover" :src="scope.row.avatarUrl "></el-avatar>
</template>
</el-table-column>
<el-table-column
label="关注数"
width="120"
align="center"
>
<template slot-scope="scope">
{{ scope.row.follow }}
</template>
</el-table-column>
<el-table-column
label="粉丝数"
width="120"
align="center"
>
<template slot-scope="scope">
{{ scope.row.fans }}
</template>
</el-table-column>
<el-table-column
label="点赞数"
width="120"
align="center"
>
<template slot-scope="scope">
{{ scope.row.upCount }}
</template>
</el-table-column>
<el-table-column
label="收藏数"
width="120"
align="center"
>
<template slot-scope="scope">
{{ scope.row.starCount }}
</template>
</el-table-column>
<el-table-column
label="简介"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.description }}
</template>
</el-table-column>
<el-table-column
label="创建时间"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.createTime }}
</template>
</el-table-column>
<el-table-column
label="ip地址"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.ipAddress }}
</template>
</el-table-column>
<el-table-column
label="真实ip地址"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.ipRealAddress }}
</template>
</el-table-column>
<el-table-column
label="冻结状态"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.authorStatus==0?'正常':'冻结' }}
</template>
</el-table-column>
<el-table-column
label="删除状态"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.deleted==0?'正常':'删除' }}
</template>
</el-table-column>
<el-table-column
label="性别 1男 2女"
width="120"
align="center"
>
<template slot-scope="scope">
{{ scope.row.sex }}
</template>
</el-table-column>
<el-table-column
label="生日"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.birth }}
</template>
</el-table-column>
<el-table-column
label="职业"
width="120"
align="center"
>
<template slot-scope="scope">
{{ scope.row.job }}
</template>
</el-table-column>
<el-table-column
label="地区"
width="120"
align="center"
>
<template slot-scope="scope">
{{ scope.row.area }}
</template>
</el-table-column>
<el-table-column
label="学校"
width="120"
align="center"
>
<template slot-scope="scope">
{{ scope.row.school }}
</template>
</el-table-column>
<el-table-column
label="真实姓名"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.realName }}
</template>
</el-table-column>
<el-table-column
label="身份证号"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.idCard }}
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- fixed="right"-->
<!-- label="操作"-->
<!-- width="200"-->
<!-- align="center"-->
<!-- >-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-group>-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- @click="edit(scope)"-->
<!-- >-->
<!-- 修改-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- @click="del(scope)"-->
<!-- >-->
<!-- 删除-->
<!-- </el-button>-->
<!-- </el-button-group>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<pagination
:total="total"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="fetchData"
/>
<div class="div-border" style="height: 29%;margin-top:15px;">
<el-alert
type="warning"
:closable="false">
<template slot="title">
已选择的作者{{authorList.length}}
<el-button style="margin-left: 15px;"
@click="chooseDone"
icon="el-icon-check"
type="danger">选好了</el-button>
</template>
</el-alert>
<div class="tag-view">
<el-tag
v-for="(tag,index) in authorList"
:key="tag.authorId"
closable
size="medium"
effect="dark"
@close="authorList.splice(index,1)"
>
{{tag.authorName}}
</el-tag>
</div>
</div>
<add-form ref="addForm" @ok="addOk" />
<edit-form ref="editForm" @ok="editOk" />
</div>
</template>
<script>
import {getAuthorPage,deleteAuthor} from "@/api/business/author/author";
import {deepClone,success,error} from "@/utils";
import confirm from "@/utils/confirm";
import Pagination from '@/components/Pagination'
import addForm from "@/views/business/author/addAuthor";
import editForm from "@/views/business/author/editAuthor";
export default {
name: 'noticeAuthor',
components: {addForm,editForm,Pagination},
data() {
return {
total: 0,
list: [],
listLoading: true,
listQuery: {
page: 1,
limit: 50,
keyword: ''
},
temp: {},
authorList:[],
tableRadio:''
}
},
created() {
this.fetchData()
},
methods: {
//获取当前的行数
rowClassName({row, rowIndex}) {
//把每一行的索引放进row
row.rowIndex = rowIndex;
},
handleRowClick(row) {
let obj = row
let array = this.authorList;
//如果数组中不包含 则push
if (JSON.stringify(array).indexOf(obj.authorId) == -1) {
this.authorList.push(obj);
}
this.tableRadio = row.rowIndex
},
search() {
this.fetchData()
},
refresh() {
this.listQuery = this.$options.data().listQuery
this.fetchData()
},
chooseDone(){
if(this.authorList.length==0){
error('还没有作者')
return false
}
this.$emit('ok', this.authorList)
},
handleCancel() {
//初始化
this.authorList = this.$options.data().authorList
this.refresh()
},
fetchData() {
this.listLoading = true
getAuthorPage(this.listQuery).then(response => {
const { records, total } = response.data
this.list = records
this.total = total
this.listLoading = false
})
},
add(){
this.$refs.addForm.open()
},
addOk(){
this.fetchData()
},
edit(scope) {
const temp = deepClone(scope.row)
this.$refs.editForm.open(temp)
},
editOk(){
this.fetchData()
},
del(scope) {
confirm("确定要删除吗?").then(res=>{
if(res){
deleteAuthor(scope.row.authorId).then(response => {
console.log(response)
success('删除成功')
this.fetchData()
})
}
})
},
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,46 @@
<template>
<el-dialog :close-on-click-modal="false"
top="2vh"
width="90%"
:visible.sync="dialogVisible"
@close="handleCancel"
center
>
<div class="el-dialog-div" style="height: 80vh;">
<NoticeAuthor ref="authorRef" @ok="getCheckedAuthors"></NoticeAuthor>
</div>
</el-dialog>
</template>
<script>
import NoticeAuthor from "@/views/business/notice/authorList";
export default {
name: "chooseAuthor",
components: {NoticeAuthor},
data() {
return {
dialogVisible: false,
}
},
methods: {
open(id) {
this.dialogVisible = true
},
getCheckedAuthors(authorList){
this.$emit('ok', authorList)
this.handleCancel()
},
handleCancel() {
//初始化
this.dialogVisible = false
this.$refs.authorRef.handleCancel()
}
},
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,152 @@
<template>
<div>
<el-dialog
:close-on-click-modal="false"
top="8vh"
width="40%"
:visible.sync="dialogVisible"
center
@close="handleCancel"
>
<div class="el-dialog-div">
<el-form
:rules="rules"
ref="dataForm"
:model="temp"
label-position="right"
label-width="120px"
style="height: 90%;"
>
<el-form-item label="通知id" prop="noticeId" class="is-required">
<el-input v-model="temp.noticeId" placeholder="通知id" />
</el-form-item>
<el-form-item label="通知标题" prop="noticeTitle" class="is-required">
<el-input v-model="temp.noticeTitle" placeholder="通知标题" />
</el-form-item>
<el-form-item label="通知内容" prop="noticeContent" class="is-required">
<el-input v-model="temp.noticeContent" placeholder="通知内容" />
</el-form-item>
<el-form-item label="跳转url" prop="redirectUrl" class="is-required">
<el-input v-model="temp.redirectUrl" placeholder="跳转url" />
</el-form-item>
<el-form-item label="乐观锁字段" prop="version" class="is-required">
<el-input v-model="temp.version" placeholder="乐观锁字段" />
</el-form-item>
<el-form-item label="0正常 1删除" prop="deleted" class="is-required">
<el-input v-model="temp.deleted" placeholder="0正常 1删除" />
</el-form-item>
<el-form-item label="门店id" prop="shopId" class="is-required">
<el-input v-model="temp.shopId" placeholder="门店id" />
</el-form-item>
<el-form-item label="门店名" prop="shopName" class="is-required">
<el-input v-model="temp.shopName" placeholder="门店名" />
</el-form-item>
<el-form-item label="创建人" prop="createName" class="is-required">
<el-input v-model="temp.createName" placeholder="创建人" />
</el-form-item>
<el-form-item label="创建时间" prop="createTime" class="is-required">
<el-input v-model="temp.createTime" placeholder="创建时间" />
</el-form-item>
<el-form-item label="创建人id" prop="createId" class="is-required">
<el-input v-model="temp.createId" placeholder="创建人id" />
</el-form-item>
<el-form-item label="修改时间" prop="updateTime" class="is-required">
<el-input v-model="temp.updateTime" placeholder="修改时间" />
</el-form-item>
<el-form-item label="修改人" prop="updateName" class="is-required">
<el-input v-model="temp.updateName" placeholder="修改人" />
</el-form-item>
<el-form-item label="修改人id" prop="updateId" class="is-required">
<el-input v-model="temp.updateId" placeholder="修改人id" />
</el-form-item>
<el-form-item label="通知类型" prop="noticeType" class="is-required">
<el-input v-model="temp.noticeType" placeholder="通知类型" />
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { editNotice } from "@/api/business/notice/notice";
import {setRequiredFields} from "@/utils";
const requiredFields = []
export default {
name: "editForm",
data() {
return {
rules: setRequiredFields(requiredFields),
dialogVisible: false,
temp: {
noticeId:'',
noticeTitle:'',
noticeContent:'',
redirectUrl:'',
version:'',
deleted:'',
shopId:'',
shopName:'',
createName:'',
createTime:'',
createId:'',
updateTime:'',
updateName:'',
updateId:'',
noticeType:'',
},
}
},
methods: {
open(row) {
this.temp = this.$options.data().temp
this.temp = row
this.dialogVisible = true
},
submit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
editNotice(this.temp).then(response => {
this.handleCancel()
this.$emit('ok', response.data)
})
} else {
console.log('error submit!!');
return false;
}
});
},
handleCancel() {
//初始化
this.temp = this.$options.data().temp
this.dialogVisible = false
this.$refs['dataForm'].resetFields()
}
},
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,358 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-input
v-model="listQuery.keyword"
size="small"
placeholder="请输入关键词"
clearable
class="filter-item"
style="width: 200px;margin-left: 10px;"
/>
<el-button-group style="margin-left: 10px;">
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-search"
@click="search"
>
搜索
</el-button>
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-refresh"
@click="refresh"
>
重置
</el-button>
</el-button-group>
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-plus"
style="margin-left: 10px;"
@click="add"
>
新增
</el-button>
</div>
<el-table
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
height="100%"
class="table-container"
highlight-current-row
>
<el-table-column
label="序号"
width="150"
align="center"
>
<template slot-scope="scope">
{{ scope.$index+1 }}
</template>
</el-table-column>
<el-table-column
label="通知id"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.noticeId }}
</template>
</el-table-column>
<el-table-column
label="通知标题"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.noticeTitle }}
</template>
</el-table-column>
<el-table-column
label="通知内容"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.noticeContent }}
</template>
</el-table-column>
<el-table-column
label="跳转url"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.redirectUrl }}
</template>
</el-table-column>
<el-table-column
label="乐观锁字段"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.version }}
</template>
</el-table-column>
<el-table-column
label="0正常 1删除"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.deleted }}
</template>
</el-table-column>
<el-table-column
label="门店id"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.shopId }}
</template>
</el-table-column>
<el-table-column
label="门店名"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.shopName }}
</template>
</el-table-column>
<el-table-column
label="创建人"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.createName }}
</template>
</el-table-column>
<el-table-column
label="创建时间"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.createTime }}
</template>
</el-table-column>
<el-table-column
label="创建人id"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.createId }}
</template>
</el-table-column>
<el-table-column
label="修改时间"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.updateTime }}
</template>
</el-table-column>
<el-table-column
label="修改人"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.updateName }}
</template>
</el-table-column>
<el-table-column
label="修改人id"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.updateId }}
</template>
</el-table-column>
<el-table-column
label="通知类型"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.noticeType }}
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
width="300"
align="center"
>
<template slot-scope="scope">
<el-button-group>
<el-button
type="success"
icon="el-icon-edit"
size="mini"
@click="sendNotice(scope)"
>
发送消息
</el-button>
<el-button
type="primary"
icon="el-icon-edit"
size="mini"
@click="edit(scope)"
>
修改
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
@click="del(scope)"
>
删除
</el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="fetchData"
/>
<add-form ref="addForm" @ok="addOk" />
<edit-form ref="editForm" @ok="editOk" />
<choose-author ref="chooseAuthor" @ok="getCheckedAuthors" ></choose-author>
</div>
</template>
<script>
import {getNoticePage,deleteNotice,sendNotice} from "@/api/business/notice/notice";
import {deepClone,success} from "@/utils";
import confirm from "@/utils/confirm";
import Pagination from '@/components/Pagination'
import addForm from "@/views/business/notice/addNotice";
import editForm from "@/views/business/notice/editNotice";
import ChooseAuthor from "@/views/business/notice/chooseAuthor";
export default {
name: 'notice',
components: {ChooseAuthor, addForm,editForm,Pagination},
data() {
return {
total: 0,
list: [],
listLoading: true,
listQuery: {
page: 1,
limit: 50,
keyword: ''
},
temp: {},
notice: {}
}
},
created() {
this.fetchData()
},
methods: {
getCheckedAuthors(e){
console.log('发送消息')
console.log(e)
sendNotice({noticeId:this.notice.noticeId
,authorList:e}).then(res=>{
console.log(res)
})
},
search() {
this.fetchData()
},
refresh() {
this.listQuery = this.$options.data().listQuery
this.fetchData()
},
fetchData() {
this.listLoading = true
getNoticePage(this.listQuery).then(response => {
const { records, total } = response.data
this.list = records
this.total = total
this.listLoading = false
})
},
add(){
this.$refs.addForm.open()
},
addOk(){
this.fetchData()
},
sendNotice(scope){
this.notice = scope.row
this.$refs.chooseAuthor.open()
},
edit(scope) {
const temp = deepClone(scope.row)
this.$refs.editForm.open(temp)
},
editOk(){
this.fetchData()
},
del(scope) {
confirm("确定要删除吗?").then(res=>{
if(res){
deleteNotice(scope.row.noticeId).then(response => {
console.log(response)
success('删除成功')
this.fetchData()
})
}
})
},
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,121 @@
<template>
<div>
<el-dialog
:close-on-click-modal="false"
top="8vh"
width="40%"
:visible.sync="dialogVisible"
center
@close="handleCancel"
>
<div class="el-dialog-div">
<el-form
:rules="rules"
ref="dataForm"
:model="temp"
label-position="right"
label-width="120px"
style="height: 90%;"
>
<el-form-item label="接收id" prop="receiveId" class="is-required">
<el-input v-model="temp.receiveId" placeholder="接收id" />
</el-form-item>
<el-form-item label="博主id" prop="authorId" class="is-required">
<el-input v-model="temp.authorId" placeholder="博主id" />
</el-form-item>
<el-form-item label="博主名" prop="aurhorName" class="is-required">
<el-input v-model="temp.aurhorName" placeholder="博主名" />
</el-form-item>
<el-form-item label="通知id" prop="noticeId" class="is-required">
<el-input v-model="temp.noticeId" placeholder="通知id" />
</el-form-item>
<el-form-item label="通知标题" prop="noticeTitle" class="is-required">
<el-input v-model="temp.noticeTitle" placeholder="通知标题" />
</el-form-item>
<el-form-item label="0正常 1删除" prop="deleted" class="is-required">
<el-input v-model="temp.deleted" placeholder="0正常 1删除" />
</el-form-item>
<el-form-item label="创建时间" prop="createTime" class="is-required">
<el-input v-model="temp.createTime" placeholder="创建时间" />
</el-form-item>
<el-form-item label="修改时间" prop="updateTime" class="is-required">
<el-input v-model="temp.updateTime" placeholder="修改时间" />
</el-form-item>
<el-form-item label="0 发送 1已读" prop="receiveStatus" class="is-required">
<el-input v-model="temp.receiveStatus" placeholder="0 发送 1已读" />
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {addReceive} from "@/api/business/receive/receive";
import {setRequiredFields} from "@/utils";
const requiredFields = []
export default {
name: "addForm",
data() {
return {
rules: setRequiredFields(requiredFields),
dialogVisible: false,
temp: {
receiveId:'',
authorId:'',
aurhorName:'',
noticeId:'',
noticeTitle:'',
deleted:'',
createTime:'',
updateTime:'',
receiveStatus:'',
},
}
},
methods: {
open() {
this.dialogVisible = true
},
submit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
addReceive(this.temp).then(response =>{
this.handleCancel()
this.$emit('ok', response.data)
})
} else {
console.log('error submit!!');
return false;
}
});
},
handleCancel() {
//初始化
this.temp = this.$options.data().temp
this.dialogVisible = false
this.$refs['dataForm'].resetFields();
}
},
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,122 @@
<template>
<div>
<el-dialog
:close-on-click-modal="false"
top="8vh"
width="40%"
:visible.sync="dialogVisible"
center
@close="handleCancel"
>
<div class="el-dialog-div">
<el-form
:rules="rules"
ref="dataForm"
:model="temp"
label-position="right"
label-width="120px"
style="height: 90%;"
>
<el-form-item label="接收id" prop="receiveId" class="is-required">
<el-input v-model="temp.receiveId" placeholder="接收id" />
</el-form-item>
<el-form-item label="博主id" prop="authorId" class="is-required">
<el-input v-model="temp.authorId" placeholder="博主id" />
</el-form-item>
<el-form-item label="博主名" prop="aurhorName" class="is-required">
<el-input v-model="temp.aurhorName" placeholder="博主名" />
</el-form-item>
<el-form-item label="通知id" prop="noticeId" class="is-required">
<el-input v-model="temp.noticeId" placeholder="通知id" />
</el-form-item>
<el-form-item label="通知标题" prop="noticeTitle" class="is-required">
<el-input v-model="temp.noticeTitle" placeholder="通知标题" />
</el-form-item>
<el-form-item label="0正常 1删除" prop="deleted" class="is-required">
<el-input v-model="temp.deleted" placeholder="0正常 1删除" />
</el-form-item>
<el-form-item label="创建时间" prop="createTime" class="is-required">
<el-input v-model="temp.createTime" placeholder="创建时间" />
</el-form-item>
<el-form-item label="修改时间" prop="updateTime" class="is-required">
<el-input v-model="temp.updateTime" placeholder="修改时间" />
</el-form-item>
<el-form-item label="0 发送 1已读" prop="receiveStatus" class="is-required">
<el-input v-model="temp.receiveStatus" placeholder="0 发送 1已读" />
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCancel"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { editReceive } from "@/api/business/receive/receive";
import {setRequiredFields} from "@/utils";
const requiredFields = []
export default {
name: "editForm",
data() {
return {
rules: setRequiredFields(requiredFields),
dialogVisible: false,
temp: {
receiveId:'',
authorId:'',
aurhorName:'',
noticeId:'',
noticeTitle:'',
deleted:'',
createTime:'',
updateTime:'',
receiveStatus:'',
},
}
},
methods: {
open(row) {
this.temp = this.$options.data().temp
this.temp = row
this.dialogVisible = true
},
submit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
editReceive(this.temp).then(response => {
this.handleCancel()
this.$emit('ok', response.data)
})
} else {
console.log('error submit!!');
return false;
}
});
},
handleCancel() {
//初始化
this.temp = this.$options.data().temp
this.dialogVisible = false
this.$refs['dataForm'].resetFields()
}
},
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,273 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-input
v-model="listQuery.keyword"
size="small"
placeholder="请输入关键词"
clearable
class="filter-item"
style="width: 200px;margin-left: 10px;"
/>
<el-button-group style="margin-left: 10px;">
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-search"
@click="search"
>
搜索
</el-button>
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-refresh"
@click="refresh"
>
重置
</el-button>
</el-button-group>
<el-button
size="small"
class="filter-item"
type="primary"
icon="el-icon-plus"
style="margin-left: 10px;"
@click="add"
>
新增
</el-button>
</div>
<el-table
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
height="100%"
class="table-container"
highlight-current-row
>
<el-table-column
label="序号"
width="150"
align="center"
>
<template slot-scope="scope">
{{ scope.$index+1 }}
</template>
</el-table-column>
<el-table-column
label="接收id"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.receiveId }}
</template>
</el-table-column>
<el-table-column
label="博主id"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.authorId }}
</template>
</el-table-column>
<el-table-column
label="博主名"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.aurhorName }}
</template>
</el-table-column>
<el-table-column
label="通知id"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.noticeId }}
</template>
</el-table-column>
<el-table-column
label="通知标题"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.noticeTitle }}
</template>
</el-table-column>
<el-table-column
label="0正常 1删除"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.deleted }}
</template>
</el-table-column>
<el-table-column
label="创建时间"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.createTime }}
</template>
</el-table-column>
<el-table-column
label="修改时间"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.updateTime }}
</template>
</el-table-column>
<el-table-column
label="0 发送 1已读"
width="160"
align="center"
>
<template slot-scope="scope">
{{ scope.row.receiveStatus }}
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
width="200"
align="center"
>
<template slot-scope="scope">
<el-button-group>
<el-button
type="primary"
icon="el-icon-edit"
size="mini"
@click="edit(scope)"
>
修改
</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
@click="del(scope)"
>
删除
</el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
:page.sync="listQuery.page"
:limit.sync="listQuery.limit"
@pagination="fetchData"
/>
<add-form ref="addForm" @ok="addOk" />
<edit-form ref="editForm" @ok="editOk" />
</div>
</template>
<script>
import {getReceivePage,deleteReceive} from "@/api/business/receive/receive";
import {deepClone,success} from "@/utils";
import confirm from "@/utils/confirm";
import Pagination from '@/components/Pagination'
import addForm from "@/views/business/receive/addReceive";
import editForm from "@/views/business/receive/editReceive";
export default {
name: 'receive',
components: {addForm,editForm,Pagination},
data() {
return {
total: 0,
list: [],
listLoading: true,
listQuery: {
page: 1,
limit: 50,
keyword: ''
},
temp: {},
}
},
created() {
this.fetchData()
},
methods: {
search() {
this.fetchData()
},
refresh() {
this.listQuery = this.$options.data().listQuery
this.fetchData()
},
fetchData() {
this.listLoading = true
getReceivePage(this.listQuery).then(response => {
const { records, total } = response.data
this.list = records
this.total = total
this.listLoading = false
})
},
add(){
this.$refs.addForm.open()
},
addOk(){
this.fetchData()
},
edit(scope) {
const temp = deepClone(scope.row)
this.$refs.editForm.open(temp)
},
editOk(){
this.fetchData()
},
del(scope) {
confirm("确定要删除吗?").then(res=>{
if(res){
deleteReceive(scope.row.receiveId).then(response => {
console.log(response)
success('删除成功')
this.fetchData()
})
}
})
},
}
}
</script>
<style scoped>
</style>

View File

@@ -207,7 +207,7 @@
</div>
<div style="font-weight: 500;font-size: 13px;letter-spacing: 1px;">
<span>账号用户名:admin 密码111111</span><br/><br/>
<span>账号用户名:demo 密码111111</span><br/><br/>
<!-- <span>管理端账号用户名:admin 密码111111</span><br/><br/>-->
<!-- <span>商业合作qq: 7827869402 vx: MAMBA_4EVER24</span><br/><br/>-->
<!-- <span> <a target="_blank" style="text-decoration: underline;" href="http://8.146.211.120:8086/"> 完整版演示 http://8.146.211.120:8086/</a></span><br/><br/>-->
@@ -258,7 +258,7 @@ export default {
return {
loginLogo: '',
loginForm: {
username: 'admin',
username: 'demo',
password: '111111'
},
input4:'',