Showing
7 changed files
with
379 additions
and
399 deletions
1 | -<script> | |
2 | - import store from '@/store'; | |
3 | - // import { | |
4 | - // scene | |
5 | - // } from '@/config/common'; | |
6 | - | |
7 | - export default { | |
8 | - //设置全局变量,解绑时从这里取 | |
9 | - globalData: { | |
10 | - openId: '' | |
11 | - }, | |
12 | - onLaunch(e) { | |
13 | - //取出缓存数据 | |
14 | - // store.commit('setCacheData'); | |
15 | - //获取二维码信息 | |
16 | - // scene(e); | |
17 | - // #ifdef APP-PLUS | |
18 | - uni.reLaunch({ | |
19 | - url: '/pages/index/splash' | |
20 | - }) | |
21 | - // #endif | |
22 | - }, | |
23 | - onShow(e) { | |
24 | - // #ifdef MP | |
25 | - // mpUpData(); //检测小程序更新 | |
26 | - // #endif | |
27 | - // #ifdef APP-PLUS | |
28 | - // uni.reLaunch({ | |
29 | - // url: '/pages/index/splash' | |
30 | - // }) | |
31 | - // #endif | |
32 | - }, | |
33 | - onHide() {} | |
34 | - }; | |
35 | -</script> | |
36 | - | |
37 | -<style lang="scss"> | |
38 | - @import '@/uni_modules/uview-ui/index.scss'; | |
39 | - @import './style/iconfont.scss'; | |
40 | - @import './style/common.scss'; | |
41 | - | |
42 | - page { | |
43 | - background: #ffffff; | |
44 | - } | |
45 | - | |
46 | - ::-webkit-scrollbar { | |
47 | - display: none; | |
48 | - width: 0 !important; | |
49 | - height: 0 !important; | |
50 | - -webkit-appearance: none; | |
51 | - background: transparent; | |
52 | - } | |
53 | -</style> | |
1 | +<script> | |
2 | + import store from '@/store'; | |
3 | + | |
4 | + export default { | |
5 | + //设置全局变量,解绑时从这里取 | |
6 | + globalData: { | |
7 | + openId: '' | |
8 | + }, | |
9 | + onLaunch(e) { | |
10 | + // #ifdef APP-PLUS | |
11 | + uni.reLaunch({ | |
12 | + url: '/pages/index/splash' | |
13 | + }) | |
14 | + // #endif | |
15 | + }, | |
16 | + onShow() {}, | |
17 | + onHide() {} | |
18 | + }; | |
19 | +</script> | |
20 | + | |
21 | +<style lang="scss"> | |
22 | + @import '@/uni_modules/uview-ui/index.scss'; | |
23 | + @import './style/iconfont.scss'; | |
24 | + @import './style/common.scss'; | |
25 | + | |
26 | + page { | |
27 | + background: #ffffff; | |
28 | + } | |
29 | + | |
30 | + ::-webkit-scrollbar { | |
31 | + display: none; | |
32 | + width: 0 !important; | |
33 | + height: 0 !important; | |
34 | + -webkit-appearance: none; | |
35 | + background: transparent; | |
36 | + } | |
37 | +</style> | ... | ... |
... | ... | @@ -12,8 +12,8 @@ |
12 | 12 | {{ deviceDetail.alias? deviceDetail.alias: deviceDetail.name }} |
13 | 13 | </view> |
14 | 14 | <view style="margin-left: 20rpx; font-size: 14px;" |
15 | - :style="{ color: deviceDetail.deviceState === 'INACTIVE' ? '#666' : deviceDetail.deviceState === 'ONLINE' ? '#377DFF' : '#DE4437' }"> | |
16 | - {{ deviceDetail.deviceState === 'INACTIVE' ? '待激活' : deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线' }} | |
15 | + :style="{ color: deviceDetail.deviceState === 'INACTIVE' ? '#666' : deviceDetail.deviceState === 'ONLINE' ? '#377DFF' : '#DE4437' }"> | |
16 | + {{ deviceStatus }} | |
17 | 17 | </view> |
18 | 18 | </view> |
19 | 19 | <view style="margin-right: 20rpx;" |
... | ... | @@ -191,6 +191,9 @@ |
191 | 191 | }; |
192 | 192 | }, |
193 | 193 | computed: { |
194 | + deviceStatus(){ | |
195 | + return this.deviceDetail.deviceState === 'INACTIVE' ? '待激活' : this.deviceDetail.deviceState === 'ONLINE' ? '在线' : '离线' | |
196 | + }, | |
194 | 197 | deviceType() { |
195 | 198 | return this.deviceDetail.deviceType === 'DIRECT_CONNECTION' ? |
196 | 199 | '直连设备' : |
... | ... | @@ -218,18 +221,20 @@ |
218 | 221 | methods: { |
219 | 222 | handleCopy(value) { |
220 | 223 | uni.showModal({ |
221 | - content: JSON.stringify(value), //模板中提示的内容 | |
224 | + content: JSON.stringify(value), | |
222 | 225 | confirmText: '复制内容', |
223 | - success: () => { //点击复制内容的后调函数 | |
226 | + showCancel:false, | |
227 | + success: () => { | |
224 | 228 | uni.setClipboardData({ |
225 | - data: JSON.stringify(value), //要被复制的内容 | |
226 | - success: () => { //复制成功的回调函数 | |
227 | - uni.showToast({ //提示 | |
229 | + data: JSON.stringify(value), | |
230 | + success: () => { | |
231 | + uni.showToast({ | |
228 | 232 | title: '复制成功' |
229 | 233 | }) |
230 | 234 | } |
231 | 235 | }); |
232 | - } | |
236 | + }, | |
237 | + | |
233 | 238 | }); |
234 | 239 | }, |
235 | 240 | radioChange: function(evt) { | ... | ... |
... | ... | @@ -143,3 +143,11 @@ export const getAppLatLon = function ( |
143 | 143 | export function formatToDate(date = undefined, format = DATE_TIME_FORMAT) { |
144 | 144 | return moment(date).format(format); |
145 | 145 | } |
146 | + | |
147 | +//封装uniapp跳转 navigateTo | |
148 | +export const useNavigateTo=(path,param)=>{ | |
149 | + if (!path) return | |
150 | + uni.navigateTo({ | |
151 | + url: path + encodeURIComponent(JSON.stringify(param)) | |
152 | + }); | |
153 | +} | |
\ No newline at end of file | ... | ... |
1 | -<template> | |
2 | - <view class="notify-detail-page"> | |
3 | - <!-- 公共组件-每个页面必须引入 --> | |
4 | - <public-module></public-module> | |
5 | - <view class="notify-column"> | |
6 | - <view class="column-list"> | |
7 | - <view style="margin-left: 36rpx;position: relative;top: 21rpx;"> | |
8 | - <view class="text-clip" style="width:500rpx"> | |
9 | - <text class="notify-detail-text ">{{ notifyList.title }}</text> | |
10 | - </view> | |
11 | - </view> | |
12 | - <view style="height: 25rpx;"></view> | |
13 | - <u-list height="140rpx"> | |
14 | - <u-list-item> | |
15 | - <u-cell :value="`${notifyList.senderDate}`" :title="`${notifyList.senderName}`"> | |
16 | - <u-avatar slot="icon" shape="circle" size="35" :src="notifyList.avatar"></u-avatar> | |
17 | - </u-cell> | |
18 | - </u-list-item> | |
19 | - </u-list> | |
20 | - <view class="bottom-text"> | |
21 | - <view class="u-flex column"></view> | |
22 | - <view style="margin-top: 21rpx;"> | |
23 | - <!-- 富文本解析 --> | |
24 | - <u-parse :content="notifyList.content"></u-parse> | |
25 | - <!-- 富文本解析 --> | |
26 | - </view> | |
27 | - </view> | |
28 | - </view> | |
29 | - </view> | |
30 | - </view> | |
31 | -</template> | |
32 | - | |
33 | -<script> | |
34 | -export default { | |
35 | - data() { | |
36 | - return { | |
37 | - notifyList: {} | |
38 | - }; | |
39 | - }, | |
40 | - onLoad(e) { | |
41 | - // 隐藏原生的tabbar | |
42 | - uni.hideTabBar(); | |
43 | - if (e.data !== null) { | |
44 | - let params = JSON.parse(decodeURIComponent(e.data)); | |
45 | - if (params) this.notifyList = params; | |
46 | - uni.setStorageSync('storagePre', true); | |
47 | - } | |
48 | - }, | |
49 | - onHide() { | |
50 | - uni.setStorageSync('storagePre', false); | |
51 | - } | |
52 | -}; | |
53 | -</script> | |
54 | - | |
55 | -<style lang="scss" scoped> | |
56 | -@import './static/notifyDetail.scss'; | |
57 | -/deep/ .u-line { | |
58 | - position: relative !important; | |
59 | - width: 640rpx !important; | |
60 | - left: 31rpx !important; | |
61 | -} | |
62 | -</style> | |
1 | +<template> | |
2 | + <view class="notify-detail-page"> | |
3 | + <!-- 公共组件-每个页面必须引入 --> | |
4 | + <public-module></public-module> | |
5 | + <view class="notify-column"> | |
6 | + <view class="column-list"> | |
7 | + <view class="column-title"> | |
8 | + <view class="text-clip" style="width:500rpx"> | |
9 | + <text class="notify-detail-text ">{{ notifyList.title }}</text> | |
10 | + </view> | |
11 | + </view> | |
12 | + <view style="height: 25rpx;"></view> | |
13 | + <u-list height="140rpx"> | |
14 | + <u-list-item> | |
15 | + <u-cell :value="`${notifyList.senderDate}`" :title="`${notifyList.senderName}`"> | |
16 | + <u-avatar slot="icon" shape="circle" size="35" :src="notifyList.avatar"></u-avatar> | |
17 | + </u-cell> | |
18 | + </u-list-item> | |
19 | + </u-list> | |
20 | + <view class="bottom-text"> | |
21 | + <view class="u-flex column"></view> | |
22 | + <view style="margin-top: 21rpx;"> | |
23 | + <!-- 富文本解析 --> | |
24 | + <u-parse :content="notifyList.content"></u-parse> | |
25 | + <!-- 富文本解析 --> | |
26 | + </view> | |
27 | + </view> | |
28 | + </view> | |
29 | + </view> | |
30 | + </view> | |
31 | +</template> | |
32 | + | |
33 | +<script> | |
34 | +export default { | |
35 | + data() { | |
36 | + return { | |
37 | + notifyList: {} | |
38 | + }; | |
39 | + }, | |
40 | + onLoad(e) { | |
41 | + // 隐藏原生的tabbar | |
42 | + uni.hideTabBar(); | |
43 | + if (e.data !== null) { | |
44 | + let params = JSON.parse(decodeURIComponent(e.data)); | |
45 | + if (params) this.notifyList = params; | |
46 | + } | |
47 | + } | |
48 | +}; | |
49 | +</script> | |
50 | + | |
51 | +<style lang="scss" scoped> | |
52 | +@import './static/notifyDetail.scss'; | |
53 | +/deep/ .u-line { | |
54 | + position: relative !important; | |
55 | + width: 640rpx !important; | |
56 | + left: 31rpx !important; | |
57 | +} | |
58 | +</style> | ... | ... |
1 | -.notify-detail-page { | |
2 | - min-height: 100vh; | |
3 | - background-color: #f8f9fa; | |
4 | - padding-top: 10rpx; | |
5 | - padding-left: 27rpx; | |
6 | -} | |
7 | -.notify-column { | |
8 | - .column-list { | |
9 | - border-radius: 10px; | |
10 | - margin-top: 20rpx; | |
11 | - width: 696rpx; | |
12 | - height: 1000rpx; | |
13 | - background-color: #ffffff; | |
14 | - .bottom-text { | |
15 | - margin-left: 33rpx; | |
16 | - .text { | |
17 | - color: #2e384d; | |
18 | - font-size: 15px; | |
19 | - } | |
20 | - .column { | |
21 | - margin-top: 20rpx; | |
22 | - .text { | |
23 | - font-size: 16px; | |
24 | - font-family: PingFangSC-Medium, PingFang SC; | |
25 | - font-weight: 500; | |
26 | - color: #2e384d; | |
27 | - } | |
28 | - } | |
29 | - } | |
30 | - } | |
31 | -} | |
1 | +.notify-detail-page { | |
2 | + min-height: 100vh; | |
3 | + background-color: #f8f9fa; | |
4 | + padding-top: 10rpx; | |
5 | + padding-left: 27rpx; | |
6 | +} | |
7 | +.notify-column { | |
8 | + .column-list { | |
9 | + border-radius: 10px; | |
10 | + margin-top: 20rpx; | |
11 | + width: 696rpx; | |
12 | + height: 1000rpx; | |
13 | + background-color: #ffffff; | |
14 | + .column-title{ | |
15 | + margin-left: 36rpx; | |
16 | + position: relative; | |
17 | + top: 21rpx; | |
18 | + } | |
19 | + .bottom-text { | |
20 | + margin-left: 33rpx; | |
21 | + .text { | |
22 | + color: #2e384d; | |
23 | + font-size: 15px; | |
24 | + } | |
25 | + .column { | |
26 | + margin-top: 20rpx; | |
27 | + .text { | |
28 | + font-size: 16px; | |
29 | + font-family: PingFangSC-Medium, PingFang SC; | |
30 | + font-weight: 500; | |
31 | + color: #2e384d; | |
32 | + } | |
33 | + } | |
34 | + } | |
35 | + } | |
36 | +} | ... | ... |
1 | -.notify-page { | |
2 | - min-height: 100vh; | |
3 | - background-color: #f8f9fa; | |
4 | - padding-top: 10rpx; | |
5 | - padding-left: 27rpx; | |
6 | -} | |
7 | -/deep/.u-list-item { | |
8 | - background: #ffffff; | |
9 | - width: 695rpx; | |
10 | - border-radius: 10px; | |
11 | - margin-top: 20rpx; | |
12 | -} | |
13 | -.notify-main { | |
14 | - .main { | |
15 | - flex-direction: column; | |
16 | - margin-left: -22rpx; | |
17 | - .main-item { | |
18 | - justify-content: space-between; | |
19 | - flex-direction: row; | |
20 | - margin: 15rpx; | |
21 | - width: 700rpx; | |
22 | - height: 136rpx; | |
23 | - background: #ffffff; | |
24 | - border-radius: 10px; | |
25 | - .item { | |
26 | - justify-content: space-between; | |
27 | - flex-direction: row; | |
28 | - .item-avatar { | |
29 | - margin-left: 30rpx; | |
30 | - .avatar { | |
31 | - margin-left: 30rpx; | |
32 | - } | |
33 | - } | |
34 | - .item-content { | |
35 | - margin-left: 30rpx; | |
36 | - text-align: left; | |
37 | - justify-content: space-between; | |
38 | - flex-direction: column; | |
39 | - .text-top { | |
40 | - width: 400rpx; | |
41 | - color: #2e384d; | |
42 | - font-size: 15px; | |
43 | - } | |
44 | - .text-bottom { | |
45 | - width: 400rpx; | |
46 | - color: #999999; | |
47 | - font-size: 13px; | |
48 | - } | |
49 | - } | |
50 | - } | |
51 | - .item-right { | |
52 | - .text { | |
53 | - margin-right: 30rpx; | |
54 | - color: #999999; | |
55 | - font-size: 13px; | |
56 | - } | |
57 | - } | |
58 | - } | |
59 | - } | |
60 | -} | |
1 | +.notify-page { | |
2 | + min-height: 100vh; | |
3 | + background-color: #f8f9fa; | |
4 | + padding-top: 10rpx; | |
5 | + padding-left: 27rpx; | |
6 | + .notify-page-top-select{ | |
7 | + width: 750rpx; | |
8 | + height:53rpx; | |
9 | + background-color: #f8f9fa; | |
10 | + position:fixed; | |
11 | + top:0; | |
12 | + z-index: 99999; | |
13 | + } | |
14 | + .top-select{ | |
15 | + background-color: #f8f9fa; | |
16 | + width: 700rpx; | |
17 | + position: relative; | |
18 | + top: 35rpx; | |
19 | + } | |
20 | +} | |
21 | +/deep/.u-list-item { | |
22 | + background: #ffffff; | |
23 | + width: 695rpx; | |
24 | + border-radius: 10px; | |
25 | + margin-top: 20rpx; | |
26 | +} | |
27 | +.notify-main { | |
28 | + .main { | |
29 | + flex-direction: column; | |
30 | + margin-left: -22rpx; | |
31 | + .main-item { | |
32 | + justify-content: space-between; | |
33 | + flex-direction: row; | |
34 | + margin: 15rpx; | |
35 | + width: 700rpx; | |
36 | + height: 136rpx; | |
37 | + background: #ffffff; | |
38 | + border-radius: 10px; | |
39 | + .item { | |
40 | + justify-content: space-between; | |
41 | + flex-direction: row; | |
42 | + .item-avatar { | |
43 | + margin-left: 30rpx; | |
44 | + .avatar { | |
45 | + margin-left: 30rpx; | |
46 | + } | |
47 | + } | |
48 | + .item-content { | |
49 | + margin-left: 30rpx; | |
50 | + text-align: left; | |
51 | + justify-content: space-between; | |
52 | + flex-direction: column; | |
53 | + .text-top { | |
54 | + width: 400rpx; | |
55 | + color: #2e384d; | |
56 | + font-size: 15px; | |
57 | + } | |
58 | + .text-bottom { | |
59 | + width: 400rpx; | |
60 | + color: #999999; | |
61 | + font-size: 13px; | |
62 | + } | |
63 | + } | |
64 | + } | |
65 | + .item-right { | |
66 | + .text { | |
67 | + margin-right: 30rpx; | |
68 | + color: #999999; | |
69 | + font-size: 13px; | |
70 | + } | |
71 | + } | |
72 | + } | |
73 | + } | |
74 | +} | ... | ... |
1 | -<template> | |
2 | - <view class="notify-page"> | |
3 | - <!-- 公共组件-每个页面必须引入 --> | |
4 | - <public-module></public-module> | |
5 | - <view style="width: 750rpx;height:53rpx;background-color: #f8f9fa;position:fixed;top:0;z-index: 99999;"> | |
6 | - <view @click="openTypeClick" style="background-color: #f8f9fa;width: 700rpx;position: relative;top: 35rpx;"> | |
7 | - <u--input suffixIcon="arrow-down" shape="circle" disabled v-model="model1.userInfo.type" | |
8 | - placeholder="请选择类型" border="surround"></u--input> | |
9 | - <u-action-sheet :show="showType" :actions="actions" title="请选择类型" @close="showType = false" | |
10 | - @select="typeSelect"></u-action-sheet> | |
11 | - </view> | |
12 | - </view> | |
13 | - <view style="height: 110rpx;"></view> | |
14 | - <view class="notify-main"> | |
15 | - <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" | |
16 | - @up="upCallback"> | |
17 | - <view class="u-flex main"> | |
18 | - <view @click="clickNotifyDetail(item, index)" class="u-flex main-item" v-for="(item, index) in list" | |
19 | - :key="index"> | |
20 | - <view class="u-flex item"> | |
21 | - <view class="item-avatar"> | |
22 | - <u-avatar class="avatar" shape="circle" size="40" :src="item.sysNotice.avatar"> | |
23 | - </u-avatar> | |
24 | - </view> | |
25 | - <view class="u-flex item-content"> | |
26 | - <text class="text-top text-clip">{{ item.sysNotice.title }}</text> | |
27 | - <text class="text-bottom text-clip">{{ item.sysNotice.createTime }}</text> | |
28 | - </view> | |
29 | - </view> | |
30 | - <view class="item-right u-flex" style="justify-content: space-between;"> | |
31 | - <text class="text">{{ formatType(item.sysNotice) }}</text> | |
32 | - <u-badge style="margin-right: 10rpx;" v-if="item.readStatus == '0'" numberType="overflow" | |
33 | - isDot /> | |
34 | - </view> | |
35 | - </view> | |
36 | - </view> | |
37 | - </mescroll-body> | |
38 | - </view> | |
39 | - </view> | |
40 | -</template> | |
41 | - | |
42 | -<script> | |
43 | - import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; | |
44 | - import api from '@/api/index.js' | |
45 | - | |
46 | - export default { | |
47 | - mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件) | |
48 | - data() { | |
49 | - return { | |
50 | - model1: { | |
51 | - userInfo: { | |
52 | - type: '' | |
53 | - } | |
54 | - }, | |
55 | - showType: false, | |
56 | - actions: [{ | |
57 | - name: '全部', | |
58 | - value: '' | |
59 | - }, | |
60 | - { | |
61 | - name: '会议', | |
62 | - value: 'MEETING' | |
63 | - }, | |
64 | - { | |
65 | - name: '公告', | |
66 | - value: 'NOTICE' | |
67 | - }, | |
68 | - { | |
69 | - name: '其他', | |
70 | - value: 'OTHER' | |
71 | - } | |
72 | - ], | |
73 | - page: { | |
74 | - num: 0, | |
75 | - size: 10 | |
76 | - }, | |
77 | - downOption: { | |
78 | - auto: false //是否在初始化后,自动执行downCallback; 默认true | |
79 | - }, | |
80 | - list: [], | |
81 | - pre: false, | |
82 | - isJudgeNextPage: '', | |
83 | - distance: 0, | |
84 | - scrollDistance: 0 | |
85 | - }; | |
86 | - }, | |
87 | - onLoad(e) { | |
88 | - // 隐藏原生的tabbar | |
89 | - uni.hideTabBar(); | |
90 | - this.pre = false; | |
91 | - uni.removeStorageSync('storagePre'); | |
92 | - }, | |
93 | - onShow() { | |
94 | - this.pre = uni.getStorageSync('storagePre'); | |
95 | - if (this.pre) {} | |
96 | - }, | |
97 | - onHide() { | |
98 | - uni.removeStorageSync('storagePre'); | |
99 | - }, | |
100 | - methods: { | |
101 | - formatType(e) { | |
102 | - return e?.type == 'OTHER' ? '其他' : e?.type == 'MEETING' ? '会议' : '公告'; | |
103 | - }, | |
104 | - openTypeClick() { | |
105 | - this.showType = true; | |
106 | - uni.hideKeyboard(); | |
107 | - }, | |
108 | - typeSelect(e) { | |
109 | - this.isJudgeNextPage = e.value; | |
110 | - this.page.num = 1; | |
111 | - this.model1.userInfo.type = e.name; | |
112 | - this.loadData(1, this.isJudgeNextPage == '' ? null : this.isJudgeNextPage); | |
113 | - uni.pageScrollTo({ | |
114 | - scrollTop: this.scrollDistance + 20, | |
115 | - duration: 50 | |
116 | - }); | |
117 | - uni.pageScrollTo({ | |
118 | - scrollTop: this.scrollDistance - 20, | |
119 | - duration: 50 | |
120 | - }); | |
121 | - }, | |
122 | - onPageScroll(e) { | |
123 | - this.scrollDistance = e.scrollTop; | |
124 | - }, | |
125 | - /*下拉刷新的回调 */ | |
126 | - downCallback() { | |
127 | - //联网加载数据 | |
128 | - this.list.length = 0; | |
129 | - this.page.num = 1; | |
130 | - this.loadData(1); | |
131 | - this.isJudgeNextPage = ''; | |
132 | - this.model1.userInfo.type = ''; | |
133 | - }, | |
134 | - /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */ | |
135 | - upCallback() { | |
136 | - if (this.isJudgeNextPage != '') { | |
137 | - //联网加载数据 | |
138 | - this.page.num += 1; | |
139 | - this.loadData(this.page.num, this.isJudgeNextPage); | |
140 | - } else { | |
141 | - //联网加载数据 | |
142 | - this.page.num += 1; | |
143 | - this.loadData(this.page.num); | |
144 | - } | |
145 | - }, | |
146 | - | |
147 | - async loadData(pageNo, t) { | |
148 | - let httpData = { | |
149 | - page: pageNo, | |
150 | - pageSize: 10, | |
151 | - type: t | |
152 | - }; | |
153 | - const res = await api.notifyApi.getNotifyApi({ | |
154 | - params: httpData, | |
155 | - custom: { | |
156 | - load: false | |
157 | - } | |
158 | - }) | |
159 | - uni.stopPullDownRefresh(); | |
160 | - this.mescroll.endByPage(res.items.length, res.total); | |
161 | - if (pageNo == 1) { | |
162 | - this.list = res.items; | |
163 | - } else { | |
164 | - this.list = this.list.concat(res.items); | |
165 | - } | |
166 | - }, | |
167 | - async clickNotifyDetail(e, i) { | |
168 | - this.list[i].readStatus = 1; | |
169 | - await api.notifyApi.byNotifyIdGetDetailApi(e.sysNotice.id) | |
170 | - uni.navigateTo({ | |
171 | - url: './notifyDetail?data=' + encodeURIComponent(JSON.stringify(e.sysNotice)) | |
172 | - }); | |
173 | - } | |
174 | - } | |
175 | - }; | |
176 | -</script> | |
177 | - | |
178 | -<style lang="scss" scoped> | |
179 | - @import './static/systemNotify.scss'; | |
180 | - | |
181 | - /deep/ .u-badge--error { | |
182 | - position: relative; | |
183 | - right: 11rpx; | |
184 | - } | |
185 | -</style> | |
1 | +<template> | |
2 | + <view class="notify-page"> | |
3 | + <!-- 公共组件-每个页面必须引入 --> | |
4 | + <public-module></public-module> | |
5 | + <view class="notify-page-top-select"> | |
6 | + <view @click="handleTypeClick" class="top-select"> | |
7 | + <u--input suffixIcon="arrow-down" shape="circle" disabled v-model="notifyType" | |
8 | + placeholder="请选择类型" border="surround"></u--input> | |
9 | + <u-action-sheet safe-area-inset-bottom :show="showType" :actions="actions" title="请选择类型" @close="showType = false" | |
10 | + @select="handleTypeSelect"></u-action-sheet> | |
11 | + </view> | |
12 | + </view> | |
13 | + <view style="height: 110rpx;"></view> | |
14 | + <view class="notify-main"> | |
15 | + <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" | |
16 | + @up="upCallback"> | |
17 | + <view class="u-flex main"> | |
18 | + <view @click="handleNotifyDetail(item, index)" class="u-flex main-item" v-for="(item, index) in list" | |
19 | + :key="index"> | |
20 | + <view class="u-flex item"> | |
21 | + <view class="item-avatar"> | |
22 | + <u-avatar class="avatar" shape="circle" size="40" :src="item.sysNotice.avatar"> | |
23 | + </u-avatar> | |
24 | + </view> | |
25 | + <view class="u-flex item-content"> | |
26 | + <text class="text-top text-clip">{{ item.sysNotice.title }}</text> | |
27 | + <text class="text-bottom text-clip">{{ item.sysNotice.senderDate }}</text> | |
28 | + </view> | |
29 | + </view> | |
30 | + <view class="item-right u-flex" style="justify-content: space-between;"> | |
31 | + <text class="text">{{ formatType(item.sysNotice.type) }}</text> | |
32 | + <!-- readStatus===0则阅读状态表示未阅读 --> | |
33 | + <u-badge style="margin-right: 10rpx;" v-if="item.readStatus == '0'" numberType="overflow" | |
34 | + isDot /> | |
35 | + </view> | |
36 | + </view> | |
37 | + </view> | |
38 | + </mescroll-body> | |
39 | + </view> | |
40 | + </view> | |
41 | +</template> | |
42 | + | |
43 | +<script> | |
44 | + import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js'; | |
45 | + import api from '@/api/index.js' | |
46 | + import { useNavigateTo } from '@/plugins/utils.js' | |
47 | + | |
48 | + export default { | |
49 | + mixins: [MescrollMixin], | |
50 | + data() { | |
51 | + return { | |
52 | + notifyType:'', | |
53 | + showType: false, | |
54 | + actions: [{ | |
55 | + name: '全部', | |
56 | + value: '' | |
57 | + }, | |
58 | + { | |
59 | + name: '会议', | |
60 | + value: 'MEETING' | |
61 | + }, | |
62 | + { | |
63 | + name: '公告', | |
64 | + value: 'NOTICE' | |
65 | + }, | |
66 | + { | |
67 | + name: '其他', | |
68 | + value: 'OTHER' | |
69 | + } | |
70 | + ], | |
71 | + page: { | |
72 | + page: 0, | |
73 | + pageSize: 10 | |
74 | + }, | |
75 | + downOption: { | |
76 | + auto: false //是否在初始化后,自动执行downCallback; 默认true | |
77 | + }, | |
78 | + list: [], | |
79 | + selectType: '', | |
80 | + distance: 0, | |
81 | + }; | |
82 | + }, | |
83 | + onLoad(e) { | |
84 | + // 隐藏原生的tabbar | |
85 | + uni.hideTabBar(); | |
86 | + }, | |
87 | + methods: { | |
88 | + formatType(e) { | |
89 | + return this.actions.find((item)=>item.value===e && item.value!=='').name | |
90 | + }, | |
91 | + handleTypeClick() { | |
92 | + this.showType = true; | |
93 | + uni.hideKeyboard(); | |
94 | + }, | |
95 | + handleTypeSelect(e) { | |
96 | + this.selectType = e.value; | |
97 | + this.page.page = 1; | |
98 | + this.notifyType = e.name; | |
99 | + this.loadData(1, !this.selectType ? null : this.selectType); | |
100 | + }, | |
101 | + downCallback() { | |
102 | + this.list.length = 0; | |
103 | + this.page.page = 1; | |
104 | + this.loadData(1); | |
105 | + this.selectType = ''; | |
106 | + this.notifyType = ''; | |
107 | + }, | |
108 | + upCallback() { | |
109 | + if (this.selectType) { | |
110 | + this.page.page += 1; | |
111 | + this.loadData(this.page.page, this.selectType); | |
112 | + } else { | |
113 | + this.page.page += 1; | |
114 | + this.loadData(this.page.page); | |
115 | + } | |
116 | + }, | |
117 | + async loadData(page, type) { | |
118 | + let params = { | |
119 | + page, | |
120 | + pageSize: 10, | |
121 | + type | |
122 | + }; | |
123 | + const res = await api.notifyApi.getNotifyApi({ | |
124 | + params, | |
125 | + custom: { | |
126 | + load: false | |
127 | + } | |
128 | + }) | |
129 | + uni.stopPullDownRefresh(); | |
130 | + this.mescroll.endByPage(res.items.length, res.total); | |
131 | + if (page == 1) { | |
132 | + this.list = res.items; | |
133 | + } else { | |
134 | + this.list = this.list.concat(res.items); | |
135 | + } | |
136 | + }, | |
137 | + async handleNotifyDetail(item, index) { | |
138 | + this.list[index].readStatus = 1;//点击了则说明阅读了 | |
139 | + await api.notifyApi.byNotifyIdGetDetailApi(item.sysNotice.id) | |
140 | + useNavigateTo('./notifyDetail?data=', item.sysNotice) | |
141 | + } | |
142 | + } | |
143 | + }; | |
144 | +</script> | |
145 | + | |
146 | +<style lang="scss" scoped> | |
147 | + @import './static/systemNotify.scss'; | |
148 | + | |
149 | + /deep/ .u-badge--error { | |
150 | + position: relative; | |
151 | + right: 11rpx; | |
152 | + } | |
153 | +</style> | ... | ... |