Blame view

pages/ArticleDetails/ArticleDetails.vue 1.32 KB
c7add6cf   “wangming”   初始版本开发完毕
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
  <template>

  	<view class="page">

  		<!-- 文章内容 -->

  		<view class="article-data">

  			<view class="article-title">

  				<text>{{data.title}}</text>

  			</view>

  			<view class="article-content">

  				<p v-html="SetContent(data.content)"></p>

  			</view>

  			<view class="article-img">

  				<image v-for="item in data.images" :src="BASE_URL+item.url" mode="widthFix"></image>

  			</view>

  		</view>

  		<!-- 底部 -->

  		<view class="my-phone">

  			<view>客服电话:654564</view>

  			<view>彭州市人社局监督电话:541516</view>

  			<view>备案号:6556121212</view>

  		</view>

  	</view>

  </template>

  

  <script>

  	import BASE_URL from '@/common/config.js'

  	export default {

  		data() {

  			return {

  				BASE_URL,

  				id: 0,

  				data: {},

  			};

  		},

  		onLoad(e) {

  			this.id = e.id;

  			console.log(this.id);

  			this.GetTbpolicyById(this.id);

  		},

  		methods: {

  			SetContent(res) {

  				const regex = new RegExp('<img', 'gi');

  				return res.replace(regex, '<img style="max-width:100%;height:auto" ')

  			},

  			GetTbpolicyById(id) {

  				this.API.GetTbpolicyById(id).then(res => {

  					if (res.code == 200) {

  						this.data = res.data;

  						this.data.images = JSON.parse(this.data.images);

  					}

  				})

  			}

  		}

  

  

  

  	}

  </script>

  

  <style scoped lang="scss">

  	@import 'ArticleDetails.scss';

  </style>