detail.vue
1.75 KB
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
<template>
<view class="page">
<scroll-view class="scroll" scroll-y>
<view class="detail-page">
<view class="section">
<text class="row company">{{ detail.title }}</text>
<view class="row"><text class="label">内容</text><text class="value">{{ detail.content }}</text></view>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
import { getContentApi } from '@/api/message.js'
export default {
data() {
return {
detail: { title: '', content: '' }
}
},
onLoad(options) {
const id = options && (options.id || options.code) || ''
if (!id) return
this.loadDetail(id)
},
methods: {
loadDetail(id) {
getContentApi(id)
.then(res => {
const d = res && res.data ? res.data : {}
this.detail = { title: d.title || '', content: d.content || '' }
})
.catch(() => {
this.detail = { title: '', content: '' }
uni.showToast({ title: '加载失败', icon: 'none' })
})
}
}
}
</script>
<style lang="scss" scoped>
.page { display: flex; flex-direction: column; height: 100%; }
.scroll { flex: 1; padding: 8rpx 0 0; }
.detail-page { background: #f3f3f3; }
.section { padding: 32rpx; background: #fff; }
.row {
display: flex;
margin-bottom: 28rpx;
&:last-child {
margin-bottom: 0;
}
&.company {
font-size: 36rpx;
font-weight: 600;
color: rgba(0, 0, 0, 0.9);
line-height: 50rpx;
}
.label {
max-width: 420rpx;
line-height: 32rpx;
font-size: 28rpx;
color: rgba(0, 0, 0, 0.6);
}
.value {
flex: 1;
line-height: 32rpx;
font-size: 28rpx;
color: rgba(0, 0, 0, 0.9);
text-align: right;
&.act {
color: $theme-primary;
}
}
}
</style>