message.vue
3.2 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<template>
<view class="page" :style="vuex_theme">
<view class="cell" @click="jump('1')">
<!-- <view style="display: flex; width: 100%;"> -->
<img class="icon" :src="vuex_baseImgUrl && `${vuex_baseImgUrl}msg2.png`" alt="">
<view class="cell-c">
<view class="t1">
系统公告
</view>
<view class="t2">
{{systemNotice.noticeTitle?systemNotice.noticeTitle:'暂无公告'}}
</view>
</view>
<!-- </view> -->
<view class="time" v-if="systemNotice.sendTime">
{{$u.timeFrom(systemNotice.sendTime)}}
</view>
<view v-if="systemNotice.ifRead == 'unread'" class="red"></view>
</view>
<view class="cell" style="margin-top: 30px;" @click="jump('2')">
<!-- <view style="display: flex; width: 100%;"> -->
<img class="icon" src="/static/img/message/msg1.png" alt="">
<view class="cell-c">
<view class="t1">
学校公告
</view>
<view class="t2">
{{schoolNotice.noticeTitle?schoolNotice.noticeTitle:'暂无公告'}}
</view>
</view>
<!-- </view> -->
<view class="time" v-if="schoolNotice.sendTime">
{{$u.timeFrom(schoolNotice.sendTime)}}
</view>
<view v-if="schoolNotice.ifRead == 'unread'" class="red"></view>
</view>
<custom-tabbar></custom-tabbar>
</view>
</template>
<script>
import {
mapGetters,
mapState,
mapActions
} from 'vuex'
import {
msginfoUrl,
} from '@/config/api.js';
export default {
data() {
return {
systemNotice: {},
schoolNotice: {}
}
},
onShow() {
if (this.hasLogin) {
msginfoUrl().then(res => {
if (res) {
this.systemNotice = res.systemNotice
this.schoolNotice = res.schoolNotice
}
})
}
},
computed: {
...mapState({
hasLogin: 'hasLogin',
vuex_user: 'vuex_user',
teacher: (state) => state.vuex_user.teacher,
}),
},
methods: {
beforeSwitch(index) {
return true
},
jump(type) {
this.$u.route({
url: "/pages/main/message/message-list/message-list",
params: {
type: type
}
});
}
}
}
</script>
<style lang="scss" scoped>
.page {
padding: 16px;
.cell {
display: flex;
align-items: center;
justify-content: space-between;
height: 50px;
position: relative;
.icon {
width: 50px;
height: 50px;
}
.cell-c {
flex: 1;
margin-left: 20rpx;
display: flex;
flex-direction: column;
.t1 {
font-size: 16px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
}
.t2 {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
white-space: normal;
word-break: break-all;
word-wrap: break-word;
margin-top: 20rpx;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(18,18,18,0.45);
}
}
.time {
font-size: 14px;
font-family: PingFangSC-Light, PingFang SC;
font-weight: 300;
color: rgba(0,0,0,0.45);
}
.red {
position: absolute;
left: 3px;
top: -1px;
width: 12px;
height: 12px;
border-radius: 6px;
background-color: red;
}
}
}
</style>