zhaojs
2023-06-10 69ea24e8fdfb41fc48c3fdb8c444645c13b1bbc4
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
164
165
166
167
168
<template>
    <view class="officialNotice wrapperLayer">
        <titleBar :titleText='"官方通知"' :pageForm='"officialNotice"'></titleBar>
        <view class="pageContent-container colCen" v-if='noticeList.length>0'>
            <block v-for="(items,index) in noticeList" :key="index">
                <view class="notice-items-container rowSta">
                    <view class="leftsettingbox defIcon">
                        <image src="../../static/images/home/setting.png" mode="aspectFill"></image>
                    </view>
                    <view class="rightcontentbox colCen">
                        <view class="titlebar">
                            {{items.title}}
                        </view>
                        <view class="time">
                            {{items.create_time}}
                        </view>
                        
                        <view class="content-box" @click="goUrl(items)">
                            <view class="box" v-html="items.content">
                                
                            </view>
                        </view>
                    </view>
                </view>
            </block>
            
            <aLoadMore :status="loadstatus" mode="loading3" :showTitle='true' color="#999999" ></aLoadMore>
        </view>
        <view v-else>
            暂无通知
        </view>
    </view>
</template>
 
<script>
    import indexPage from '../../components/indexPage.vue';
    import titleBar from '../../components/backTitlebar.vue';
    export default {
        components: {
            titleBar,
            indexPage
        },
        data(){
            return{
                noticeList:[],
                pageCurrent:'0',
                canloadmore:false,
                loadstatus: 'loading',
            }
        },
        onLoad() {
            this.getList()
        },
        onReachBottom(){
            if(this.canloadmore){
                this.getList()
            }
        },
        methods:{
            goUrl(item){
                if(item.type == 1){
                    uni.navigateTo({
                        url: '/pages/webView/webView?url=' + item.murl
                    })
                }else if(item.type == 2){
                    uni.navigateTo({
                        url:item.murl
                    })
                }
            },
            getList(){
                var that = this;
                this.$u.api.getMessageList({
                    limit: 20,
                    offset: this.pageCurrent
                }).then(e => {
                    if(e.code != 0) return that.$alert(e.msg)
                    var res = e.data.list;
                    if(that.pageCurrent == 0 && res.length > 0){
                        uni.setStorageSync('topMessageId',res[0].id);
                    }
                    if(res.length > 0){
                        if(res.length<20){
                            that.canloadmore = false
                            that.loadstatus = 'nomal'
                        }else{
                            that.canloadmore = true
                            that.loadstatus = 'loading'
                        }
                        that.pageCurrent += 20;
                        this.noticeList = this.noticeList.concat(res)
                    }
                }).catch(function (err) {
                })
            }
            
        }
    }
</script>
 
<style lang="scss">
    .officialNotice{
        width: 100%;
        .pageContent-container{
            width: 100%;
            margin-top: 20rpx;
            background-color: #FFFFFF;
            padding: 40rpx 32rpx;
            .notice-items-container{
                width: 100%;
                margin-bottom: 20rpx;
                .leftsettingbox{
                    width: 60rpx;
                    height: 60rpx;
                }
                .rightcontentbox{
                    width: 605rpx;
                    margin-left: 20rpx;
                    .titlebar{
                        width: 100%;
                        font-size: 28rpx;
                        font-weight: 500;
                        color: #444444;
                        line-height: 34rpx;
                    }
                    .time{
                        width: 100%;
                        font-size: 28rpx;
                        font-weight: 400;
                        color: #999999;
                        line-height: 34rpx;
                        margin-top: 5rpx;
                    }
                    
                    .content-box{
                        width: 100%;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        box-sizing: border-box;
                        border-bottom: 1rpx solid #E6E7ED;
                        /deep/.box{
                            width: 100%;
                            padding: 18rpx 20rpx;
                            box-sizing: border-box;
                            background: #F0F1F7;
                            border-radius: 10rpx;
                            margin: 30rpx;
                            display: flex;
                            flex-direction: column;
                            justify-content: center;
                            align-items: center;
                            p{
                                width: 100%;
                                word-wrap: break-word;
                                word-break: break-all;
                            }
                        }
                    }
                }
            }
        }
    }
    
    p{
        display: inline;
    }
</style>