liuyg
2021-07-03 43b0c9ec4a73faafce3b3cbf323fecb7284cd91c
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
<template>
    <view>
        <view class="banner">
            <image class="banner-img" :src="article.url"></image>
            <view class="banner-title">{{article.title}}</view>
        </view>
        
        <view class="article-meta">
            <view class="article-author">{{article.sourceName}}</view>
            <text class="article-text">发表于</text>
            <text class="article-time">{{article.createTime}}</text>
        </view>
        
        
        <view class="article-content">
            <!-- <video id="myVideo" class="video" v-if="video" :src="article.videoUrl" muted="false" @error="videoErrorCallback"></video> -->
            <u-parse :content="content" @navigate="navigate"></u-parse>
        </view>
        
    </view>
</template>
 
<script>
    import uParse from "@/components/feng-parse/parse.vue"
    
    export default {
            components:{
                uParse
            },
            data() {
                return {
                    content:"",
                    article:{},
                    video:false,
                    pathUrl:"http://s16s652780.51mypc.cn/api",
                }
            },
            onLoad(event) {
                var that = this;
                this.article = JSON.parse(decodeURIComponent(event.detailData));
                //获取资讯详信息
                uni.request({
                    url: that.pathUrl+'/article/article/detail?id='+this.article.id,
                    method:'GET',
                    success: (res) => {
                        that.article = res.data.data;
                        that.content = that.article.content;
                        if(that.article.videoUrl){
                            that.video = true;
                        }
                        console.log(that.article,121);
                        console.log(that.article.videoUrl,123);
                        //详情标题
                        uni.setNavigationBarTitle({
                            title: that.article.title
                        });
                    }
                });
                
            },
            //创建视频
            onReady: function () {
                this.videoContext = uni.createVideoContext("myVideo");
            },
            methods: {
                videoErrorCallback: function(e) {
                                console.log(e)
                            },
            }
        }
</script>
 
<style lang="scss" scoped>
     .banner {
            height: 360upx;
            overflow: hidden;
            position: relative;
            background-color: #ccc;
        }
        .banner-img {
            width: 100%;
        }
        .banner-title {
            max-height: 84upx;
            overflow: hidden;
            position: absolute;
            left: 30upx;
            bottom: 30upx;
            width: 90%;
            font-size: 32upx;
            font-weight: 400;
            line-height: 42upx;
            color: white;
            z-index: 11;
        }
        
    .article-meta{
        // background-color: #007AFF;
        width: 100%;
        height: 80rpx;
        font-size: 24rpx;
        color: #808080;
        display: flex;
        flex-direction: row;
        align-items: center;
        position: relative;
        left: 20rpx;
        // justify-content: center;
        // font-weight: 550;
        
        
        .article-author{
            letter-spacing: 1px;
            float: left;
        }
        
        .article-text{
            position: relative;
            left: 15px;
        }
        
        .article-time{
            position: relative;
            left: 30px;
        }
    }
    
    .article-content{
        position: relative;
        left: 3%;
        bottom: 2%;
        width: 94%;
        margin-bottom: 20px;
        // border-bottom: 1px solid rgba(128,128,128,0.1);
        
        // .video{
        //     width: 100%;
        // }
    }
</style>