115 行
4.4 KiB
HTML
可执行文件
115 行
4.4 KiB
HTML
可执行文件
<!--[1.6.48]-->
|
|
<div id="noticeApp">
|
|
<div style="max-width: calc(100vw - 208px);margin-top: 10px;">
|
|
<el-table border
|
|
:data="dataList"
|
|
style="width: 100%"
|
|
size="small"
|
|
@expand-change="readeNotice"
|
|
:stripe="true" max-height="670">
|
|
<el-table-column type="expand">
|
|
<template slot-scope="scope">
|
|
<el-form label-position="left" size="small" label-width="80px">
|
|
<el-form-item label="公告标题:">
|
|
<span>{{ scope.row.title }}</span>
|
|
</el-form-item>
|
|
<el-form-item label="公告内容:">
|
|
<span>{{ scope.row.content }}</span>
|
|
</el-form-item>
|
|
<el-form-item label="时间:">
|
|
<span>{{ scope.row.addtime }}</span>
|
|
</el-form-item>
|
|
</el-form>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" type="index" label="序号" width="50"></el-table-column>
|
|
<el-table-column align="center" prop="title" label="标题" min-width="100"></el-table-column>
|
|
<el-table-column align="center" prop="content" label="内容" min-width="200"></el-table-column>
|
|
<el-table-column align="center" prop="addtime" label="公告时间" min-width="130"></el-table-column>
|
|
<el-table-column align="center" prop="state_msg" label="状态" width="60">
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.state==1" style="color: #999">已读</span>
|
|
<span v-else><strong>·</strong>未读</span>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-pagination
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
:current-page="page"
|
|
:page-sizes="[10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100]"
|
|
:page-size="10"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:total="count">
|
|
</el-pagination>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
var noticeApp = new Vue({
|
|
el: '#noticeApp',
|
|
data() {
|
|
return {
|
|
dataList: [],
|
|
page: 1,
|
|
limit: 10,
|
|
count: 0
|
|
}
|
|
},
|
|
methods: {
|
|
//阅读消息
|
|
readeNotice(item) {
|
|
if (item.state == 0) {
|
|
$.ajax({
|
|
url: '/index.php/Retail/StoreNotice/readNotice',
|
|
type: 'post',
|
|
data: {
|
|
id: item.id,
|
|
},
|
|
success: (res) => {
|
|
if (res.status == 1) {
|
|
item.state = 1;
|
|
this.$message({
|
|
message: '已阅读',
|
|
type: 'success',
|
|
duration: 1000,
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
},
|
|
//切换每页数量
|
|
handleSizeChange(val) {
|
|
this.limit = val;
|
|
this.page = 1;
|
|
this.getData();
|
|
},
|
|
//切换页数
|
|
handleCurrentChange(val) {
|
|
this.page = val;
|
|
this.getNoticeList();
|
|
},
|
|
//获取公告列表
|
|
getNoticeList() {
|
|
$.ajax({
|
|
url: '/index.php/Retail/StoreNotice/getNotice',
|
|
type: 'post',
|
|
data: {
|
|
page: this.page,
|
|
limit: this.limit,
|
|
},
|
|
success: (res) => {
|
|
if (res.status == 1) {
|
|
this.dataList = res.data;
|
|
this.count = res.count;
|
|
}
|
|
}
|
|
})
|
|
}
|
|
},
|
|
created() {
|
|
this.getNoticeList();
|
|
}
|
|
})
|
|
</script>
|