Jacob
2026-10-14 d44cf3af14c46fc96cd94525e46d191e5f700463
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<template>
   <view>
       <view class='newsDetail'>
           <view class='title'>{{articleInfo.title}}</view>
           <view class='list acea-row row-middle'>
               <view class='label'>{{articleInfo.author}}</view>
               <view class='item'></text>{{articleInfo.createTime}}</view>
               <view class='item'><text class='iconfont icon-liulan'></text>{{articleInfo.visit}}</view>
           </view>
           <view class='conters'>
               <jyf-parser :html="content" ref="article" :tag-style="tagStyle"></jyf-parser>
           </view>
           <view class="picTxt acea-row row-between-wrapper" v-if="store_info.id">
               <view class="pictrue">
                   <image :src="store_info.image"></image>
               </view>
               <view class="text">
                   <view class="name line1">{{store_info.storeName}}</view>
                   <view class="money font-color">
                       ¥<text class="num">{{store_info.price}}</text>
                   </view>
                   <view class="y_money">¥{{store_info.otPrice}}</view>
               </view>
               <navigator :url="'/pages/goods_details/index?id='+store_info.id" hover-class="none" class="label"><text class="span">查看商品</text></navigator>
           </view>
           <!-- #ifdef H5 -->
           <button class="bnt bg-color" hover-class='none' @click="listenerActionSheet" v-if="this.$wechat.isWeixin()">和好友一起分享</button>
           <!-- #endif -->
           <!-- #ifdef MP -->
           <button class="bnt bg-color" open-type="share" hover-class='none'>和好友一起分享</button>
           <!-- #endif -->
       </view>
       <shareInfo @setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></shareInfo>
       <home></home>
   </view>
</template>
 
<script>
   import {
       getArticleDetails
   } from '@/api/api.js';
   import {
       getProductDetail
   } from '@/api/store.js';
   import shareInfo from '@/components/shareInfo';
   import home from '@/components/home';
   import parser from "@/components/jyf-parser/jyf-parser";
   export default {
       components: {
           shareInfo,
           home,
           "jyf-parser": parser
       },
       data() {
           return {
               id: 0,
               articleInfo: [],
               store_info: {},
               content:'',
               shareInfoStatus:false,
               tagStyle: {
                   img: 'width:100%;'
               },
               productId: 0
           };
       },
        /**
          * 生命周期函数--监听页面加载
          */
         onLoad: function (options) {
           if (options.hasOwnProperty('id')){
              this.id = options.id;
           }else{
             // #ifndef H5
             uni.navigateBack({delta: 1 });
             // #endif
             // #ifdef H5
             history.back();
             // #endif
           }
         },
          onShow: function () {
             this.getArticleOne();
           },
           /**
            * 用户点击右上角分享
            */
           // #ifdef MP
           onShareAppMessage: function() {
               let shareUrl='/pages/news_details/index?id=' + this.id;
               if(this.$store.getters.belong&&this.$util.setShareBelong(this.$store.getters.belong)){
                   shareUrl+='&'+this.$util.setShareBelong(this.$store.getters.belong);
               }
               let pages = getCurrentPages(), currPage  = pages[pages.length - 1];
               this.addTrack('yy_contentPageShare',{
                   'sharePosition_var':options.from=='button'?'页面分享按钮':'页面顶部',
                   'shareMethod_var':'微信好友', //保存海报
                   'pageTitle_var':'资讯',
                   'pageType_var':'资讯',
                   'pagePath_var':currPage.$page.fullPath,
                   'productID_var':'-',
                   'productName_var':'-',
                   'contentId_var':this.id,
                   'contentName_var':this.articleInfo.title,
                   'contentType_var':'文章',
                   'contentLabel_var':'-',
               });
               
               return {
                   title: this.articleInfo.title,
                   imageUrl: this.articleInfo.imageInput.length ? this.articleInfo.imageInput[0] : "",
                   desc: this.articleInfo.synopsis,
                   path: shareUrl
               };
           },
           // #endif
       methods: {
            getArticleOne:function(){
               let that = this;
               getArticleDetails({id:that.id}).then(res=>{
                   uni.setNavigationBarTitle({
                      title:res.data.title.substring(0,7) + "..."
                   });
                   that.$set(that,'articleInfo',res.data);
                   that.$set(that,'productId',res.data.productId);
                   if(res.data.productId){
                       that.goodInfo(res.data.productId);
                   }
                   that.content = res.data.content;
                   // #ifdef H5
                   if(this.$wechat.isWeixin()){
                       this.setShareInfo();
                   }
                   // #endif
               });
             },
             goodInfo(id){
                 getProductDetail(id).then(res=>{
                     this.$set(this,'store_info',res.data.storeInfo?res.data.storeInfo:{});
                 })
             },
             listenerActionSheet(){
                 this.shareInfoStatus = true
             },
             setShareInfoStatus(){
                 this.shareInfoStatus = false
             },
             setShareInfo: function() {
                 let href = location.href;
                 let configAppMessage = {
                     desc: this.articleInfo.synopsis,
                     title: this.articleInfo.title,
                     link: href,
                     imgUrl: this.articleInfo.imageInput.length ? this.articleInfo.imageInput[0] : ""
                 };
                 this.$wechat.wechatEvevt(["updateAppMessageShareData", "updateTimelineShareData"], configAppMessage);
             }
       }
   }
</script>
 
<style lang="scss" scoped>
   page {
       background-color: #fff !important;
   }
    .newsDetail{
       padding: 30rpx 0;
   }
   .newsDetail .title {
       padding: 0 30rpx;
       font-size: 34rpx;
       color: #282828;
       font-weight: bold;
       line-height: 1.5;
   }
 
   .newsDetail .list {
       margin: 28rpx 30rpx 0 30rpx;
       padding-bottom: 25rpx;
   }
 
   .newsDetail .list .label {
       font-size: 30rpx;
       color: #B1B2B3;
   }
 
   .newsDetail .list .item {
       margin-left: 27rpx;
       font-size: 30rpx;
       color: #B1B2B3;
   }
 
   .newsDetail .list .item .iconfont {
       font-size: 28rpx;
       margin-right: 10rpx;
   }
 
   .newsDetail .list .item .iconfont.icon-shenhezhong {
       font-size: 26rpx;
   }
 
   .newsDetail .conters {
       padding: 0 30rpx;
       font-size: 32rpx;
       color: #8A8B8C;
       line-height: 1.7;
   }
 
   .newsDetail .picTxt {
       width: 690rpx;
       height: 200rpx;
       border-radius: 20rpx;
       border: 1px solid #e1e1e1;
       position: relative;
       margin: 30rpx auto 0 auto;
   }
 
   .newsDetail .picTxt .pictrue {
       width: 200rpx;
       height: 200rpx;
   }
 
   .newsDetail .picTxt .pictrue image {
       width: 100%;
       height: 100%;
       border-radius: 20rpx 0 0 20rpx;
       display: block;
   }
 
   .newsDetail .picTxt .text {
       width: 460rpx;
   }
 
   .newsDetail .picTxt .text .name {
       font-size: 30rpx;
       color: #282828;
   }
 
   .newsDetail .picTxt .text .money {
       font-size: 24rpx;
       margin-top: 40rpx;
       font-weight: bold;
   }
 
   .newsDetail .picTxt .text .money .num {
       font-size: 36rpx;
   }
 
   .newsDetail .picTxt .text .y_money {
       font-size: 26rpx;
       color: #999;
       text-decoration: line-through;
   }
 
   .newsDetail .picTxt .label {
       position: absolute;
       background-color: #303131;
       width: 160rpx;
       height: 50rpx;
       right: -7rpx;
       border-radius: 25rpx 0 6rpx 25rpx;
       text-align: center;
       line-height: 50rpx;
       bottom: 24rpx;
   }
 
   .newsDetail .picTxt .label .span {
       background-image: linear-gradient(to right, #fff71e 0%, #f9b513 100%);
       -webkit-background-clip: text;
       -webkit-text-fill-color: transparent;
   }
 
   .newsDetail .picTxt .label:after {
       content: " ";
       position: absolute;
       width: 0;
       height: 0;
       border-bottom: 8rpx solid #303131;
       border-right: 8rpx solid transparent;
       top: -7rpx;
       right: 0;
   }
 
   .newsDetail .bnt {
       color: #fff;
       font-size: 30rpx;
       width: 690rpx;
       height: 90rpx;
       border-radius: 45rpx;
       margin: 48rpx auto;
       text-align: center;
       line-height: 90rpx;
   }
</style>