1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
| <template>
| <view class="mobile-item-container">
| <Navbar title="公告管理" bgColor="#fff" :h5Show="false"></Navbar>
| <Tabs :tabs="tabs" @change="tabChange" style="margin-bottom: 16px;"></Tabs>
| <Record v-if="activeKey == 'draft'" :list="list" @click="navigateTo"></Record>
| <Record v-if="activeKey == 'published'" :list="list" @click="navigateTo"></Record>
| <FloatButton type="primary" icon="plus" @click="navigateTo"></FloatButton>
| </view>
| </template>
|
| <script>
| import * as NoticeApi from '@/api/work/notice'
| import Navbar from '@/components/navbar/Navbar'
| import FloatButton from '@/components/button/FloatButton'
| import Tabs from '@/components/tabs/Tabs'
| import Record from './record'
|
| export default {
| components: {
| Navbar,
| FloatButton,
| Tabs,
| Record,
| },
| data () {
| return {
| activeKey: 'draft',
| tabs: [{
| name: '草稿',
| key: 'draft',
| }, {
| name: '已发布',
| key: 'published'
| }],
| params: {
| pageNum: 0,
| pageSize: 10
| },
| list: []
| }
| },
| created () {
| this.loadData()
| },
| methods: {
| // 加载通知公告数据
| loadData () {
| const app = this
| this.params.pageNum += 1;
| NoticeApi.noticeList(this.params).then(res => {
| app.list = res.rows;
| })
| },
| // 滚动分页加载数据
| scrolltolower () {
| this.loadData();
| },
| tabChange (tab) {
| this.activeKey = tab.key;
| this.params.pageNum = 0;
| this.loadData();
| },
| navigateTo (notice) {
| if (notice) {
| uni.navigateTo({ url: '/pages/work/notice/edit?id=' + notice.noticeId })
| } else {
| uni.navigateTo({ url: '/pages/work/notice/edit' })
| }
| }
| }
| }
| </script>
|
| <style lang="scss" scoped>
| .list-item {
| padding: 20rpx 0;
| border-bottom: 0.5px solid #ccc;
| }
| </style>
|
|