This repository has been archived by the owner on Mar 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 121
/
article.vue
106 lines (103 loc) · 2.31 KB
/
article.vue
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
<template>
<view>
<scroll-view class="scontent" scroll-x>
<!-- #ifndef H5 -->
<uParse :content="content" />
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="content" v-html="content">
</view>
<!-- #endif -->
</scroll-view>
<!-- #ifdef MP-WEIXIN -->
<ad unit-id="adunit-492721b6adcf46a0"></ad>
<!-- #endif -->
<!-- #ifndef MP -->
<!-- 广告 -->
<view class="iron-contact">
<view class="info-text">感觉价格不合理? 欢迎联系我们议价</view>
<view class="info-text">联系电话(点击即可拨打)</view>
<view class="phone"><view @click="call('17625456779')">17625456779</view><view @click="call('13856262575')">13856262575</view></view>
</view>
<view class="qrcodes">
<image class="qrcode" src="https://s1.ax1x.com/2018/12/02/FuDQVP.jpg"></image>
<image class="qrcode" src="https://s1.ax1x.com/2018/12/02/FuDKbt.md.jpg"></image>
</view>
<!-- #endif -->
</view>
</template>
<script>
import marked from '../../components/marked'
// #ifndef H5
import uParse from '../../components/uParse/src/wxParse.vue'
// #endif
export default {
name: 'articlePage',
components: {
// #ifndef H5
uParse
// #endif
},
data() {
return {
title: '',
content: '',
articleId: null
};
},
// onShareAppMessage() {
// return {
// title: '钢材信息文章',
// path: `/pages/home/home?page=/pages/article/article?id=${this.articleId}`
// }
// },
onLoad(option) {
this.articleId = option.id
try {
const value = uni.getStorageSync('article');
if(option.type === 'news') {
this.content = value
return
}
if (value) {
const result = JSON.parse(value)
this.title = result.title
uni.setNavigationBarTitle({
title: this.title
})
// #ifndef H5
this.content = marked(result.content)
// #endif
// #ifdef H5
this.content = marked(result.content)
// #endif
}
} catch (e) {
console.log(e)
}
},
destroyed(){
try {
uni.removeStorageSync('article');
} catch (e) {
// error
}
}
}
</script>
<style>
@import url("../../components/uParse/src/wxParse.css");
.header {
height: 100px;
}
.iron-contact {
text-align: center;
}
.qrcodes {
text-align: center;
}
.qrcodes .qrcode {
width: 200rpx;
height: 200rpx;
}
</style>