commit | author | age
|
e3ba12
|
1 |
<template> |
Z |
2 |
<view class="mobile-item-container"> |
|
3 |
<Navbar title="通知公告" bgColor="#fff" :h5Show="false"></Navbar> |
|
4 |
<u-tabs :activeStyle="activeStyle" :list="tabs" @change="tabChange"></u-tabs> |
|
5 |
<!-- 未读 --> |
|
6 |
<view v-if="activeKey == 'unread'"> |
|
7 |
<view style="padding: 16px 0 10px;"> |
|
8 |
<view class="notice-item-tips"> |
|
9 |
<text>通知</text> |
|
10 |
<u-tag text="1" size="mini" type="primary" style="margin: 0 8px;"></u-tag> |
|
11 |
<text>条,公告</text> |
|
12 |
<u-tag text="1" size="mini" type="success" style="margin: 0 8px;"></u-tag> |
|
13 |
<text>条,共 2 条。</text> |
|
14 |
</view> |
|
15 |
</view> |
|
16 |
<Record :list="list" @click="toDetail"></Record> |
|
17 |
</view> |
|
18 |
<!-- 已读 --> |
|
19 |
<view v-if="activeKey == 'read'"> |
|
20 |
<view style="padding: 16px 0 10px;"> |
|
21 |
<u-search :show-action="true" actionText="搜索" :animation="true" shape="square" height="40px"></u-search> |
|
22 |
</view> |
|
23 |
<Record :list="[]" @click="toDetail"></Record> |
|
24 |
</view> |
|
25 |
<!-- 全部 --> |
|
26 |
<view v-if="activeKey == 'all'"> |
|
27 |
<view style="padding: 16px 0 10px;"> |
|
28 |
<u-search :show-action="true" actionText="搜索" :animation="true" shape="square" height="40px"></u-search> |
|
29 |
</view> |
|
30 |
<Record :list="list" @click="toDetail"></Record> |
|
31 |
</view> |
|
32 |
</view> |
|
33 |
</template> |
|
34 |
|
|
35 |
<script> |
|
36 |
import * as NoticeApi from '@/api/work/notice' |
|
37 |
import Navbar from '@/components/navbar/Navbar' |
|
38 |
import Record from './record' |
|
39 |
|
|
40 |
export default { |
|
41 |
components: { |
|
42 |
Navbar, |
|
43 |
Record, |
|
44 |
}, |
|
45 |
data () { |
|
46 |
return { |
|
47 |
activeKey: 'unread', |
|
48 |
tabs: [{ |
|
49 |
name: '未读', |
|
50 |
key: 'unread', |
|
51 |
badge: { |
|
52 |
value: 2, |
|
53 |
} |
|
54 |
}, { |
|
55 |
name: '已读', |
|
56 |
key: 'read' |
|
57 |
}, { |
|
58 |
name: '全部', |
|
59 |
key: 'all' |
|
60 |
}], |
|
61 |
params: { |
|
62 |
pageNum: 0, |
|
63 |
pageSize: 10 |
|
64 |
}, |
|
65 |
list: [], |
|
66 |
activeStyle: { |
|
67 |
color: '#303133', |
|
68 |
fontSize: '20px', |
|
69 |
fontWeight: 'bold', |
|
70 |
transform: 'scale(1.05)' |
|
71 |
} |
|
72 |
} |
|
73 |
}, |
|
74 |
created () { |
|
75 |
this.loadData() |
|
76 |
}, |
|
77 |
methods: { |
|
78 |
// 加载通知公告数据 |
|
79 |
loadData () { |
|
80 |
const app = this |
|
81 |
this.params.pageNum += 1; |
|
82 |
NoticeApi.noticeList(this.params).then(res => { |
|
83 |
app.list = res.rows; |
|
84 |
}) |
|
85 |
}, |
|
86 |
tabChange (item) { |
|
87 |
this.activeKey = item.key; |
|
88 |
this.params.pageNum = 0; |
|
89 |
this.loadData(); |
|
90 |
}, |
|
91 |
// 滚动分页加载数据 |
|
92 |
scrolltolower () { |
|
93 |
this.loadData(); |
|
94 |
}, |
|
95 |
toDetail (notice) { |
|
96 |
uni.navigateTo({ url: '/pages/work/notice/detail?id=' + notice.noticeId }) |
|
97 |
} |
|
98 |
} |
|
99 |
} |
|
100 |
</script> |
|
101 |
|
|
102 |
<style lang="scss" scoped> |
|
103 |
.notice-item-tips { |
|
104 |
border-radius: 8px; |
|
105 |
background-color: #f4f4f5; |
|
106 |
padding: 9px 16px; |
|
107 |
display: flex; |
|
108 |
flex-direction: row; |
|
109 |
flex-wrap: wrap; |
|
110 |
align-items: center; |
|
111 |
} |
|
112 |
</style> |