ann0707
2018-08-16 c9bc8ec61cff4076132f6396d99d383a2cdf5a03
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
<template>
    <div class="news-detail-page">
        <x-header
            :left-options.showBack="{backText: ''}"
            :title="'资讯'"
        ></x-header>
        <div style="margin: auto 12px">
            <div v-text="newsTitle" class="article_title"></div>
            <div class="newsInformation_List">
                <span class="new-style-test-article-publish-time" v-text="newsAuthor"></span>
                <span class="new-style-test-article-publish-time" style="margin-left: 20px" v-text="formatTime(newsCreateTime)">asdasdasd</span>
            </div>
            <div class="newsContent" style="font-size:130%;width: 100%;word-break: break-all;word-wrap: break-word;" v-html="newsContent"></div>
        </div>
    </div>
</template>
<script>
    /**
     * Created by c.y on 2018/3/31.
     * 资讯内容
     */
    import {XHeader,dateFormat} from 'vux';
    import sysApi from '../../api/api';
    import statusCodeManage from '../../api/statusCodeManage';
 
    export default {
        name: 'f-news-detail',
        components: {
            XHeader
        },
        data() {
            return {
                newsContent: '', // 资讯内容
                newsTitle: '', // 资讯标题
                newsAuthor: '', // 资讯作者
                newsCreateTime: '', // 资讯时间
            }
        },
        methods: {
            init(newsId) {
                let _this = this;
                sysApi.fetchNewsDetail({noticeId: newsId}).then((res) => {
                    _this.newsContent = res.body.detailContent;
                    _this.newsTitle = res.body.title;
                    _this.newsAuthor = res.body.writer;
                    _this.newsCreateTime = res.body.pushTime;
                }, (error) => {
                    statusCodeManage.showTipOfStatusCode(error, _this);
                });
            },
            formatTime(dt){
                return dateFormat(dt,'YYYY-MM-DD');
            }
        },
        activated: function () {
            this.newsContent = '';
            this.newsTitle = '';
            this.newsAuthor = '';
            this.newsCreateTime = '';
            this.$store.commit('UPDATE_DIRECTION', {direction: 'in'});
            // 获取资讯的内容
            let newsId = this.$route.query.id;
            this.init(newsId);
        },
        deactivated: function () {
            this.$store.commit('UPDATE_DIRECTION', {direction: 'none'});
        }
    }
</script>
<style lang="less">
    @import '../../style/mixin.less';
    .news-detail-page{
        .vux-header {
            .color-linear-gradient(@color-primary-light, @color-primary, 90deg);
            .vux-header-title {
                font-size: 18px;
            }
            .vux-header-left {
                .left-arrow:before {
                    border: solid 1px @color-white;
                    border-width: 2px 0 0 2px;
                }
            }
        }
        .newsContent *{
            margin: auto;
        }
        .article_title {
            margin-top: 12px;
            color: #000;
            font-size: 22px;
            line-height: 1.45;
            font-weight: 500;
        }
        .newsInformation_List{
            margin: 8px 0;
        }
        .new-style-test-article-publish-time {
 
            font-size: 11px;
            color: #999;
            vertical-align: top;
            display: inline-block;
        }
        .newsContent ul li,.newsContent ol li{
            list-style-position:inside;
        }
 
    }
</style>