index.vue
2.89 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
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
<template>
<div>
<div v-if="!code || !code.actualQRCode">
<van-empty :description="message" />
</div>
<div v-else class="code-wrapper">
<div class="header">
{{ code.activityName }}
</div>
<div class="welcome">
{{ code.guide }}
</div>
<div class="code-name">
{{ code.groupName }}
</div>
<div class="code-image">
<van-image width="300" :src="code.actualQRCode"></van-image>
</div>
<div class="service" v-if="code.isOpenTip === '1'">
<van-button type="danger" @click="dialog = true">无法加群?</van-button>
</div>
<van-dialog v-model="dialog" class="service-dialog" :showConfirmButton="false" :closeOnClickOverlay="true">
<div>
<van-image :src="code.serviceQrCode" width="200"> </van-image>
<div class="service-message">
{{ code.tipMsg }}
</div>
<div class="tip">
请长按二维码添加客服微信
</div>
</div>
<van-icon name="cross" class="close" @click="dialog = false" />
</van-dialog>
</div>
</div>
</template>
<script>
import { getDetail } from '@/api/groupCode'
export default {
data() {
return {
groupCodeUUID: '', // 群活码ID
code: {
activityName: '', // 活码名称
guide: '', // 加群引导语
actualQRCode: '', // 实际群码
isOpenTip: '', // 是否显示无法加群提示
tipMsg: '', // 无法加群提示语
serviceQrCode: '', // 客服二维码
groupName: '' // 实际群名称
},
dialog: false,
message: '抱歉,暂无可用实际群码'
}
},
methods: {
// 获取群活码详情
getDetail() {
if (!this.groupCodeUUID) return
getDetail(this.groupCodeUUID)
.then(({ data, msg }) => {
this.code = Object.assign(this.code, data)
if (msg) this.message = msg
})
.catch(() => {})
}
},
created() {
document.title = '群活码'
this.groupCodeUUID = this.$route.query.id
this.getDetail()
}
}
</script>
<style lang="less" scoped>
.code-wrapper {
margin: 20px 10px;
.header {
font-size: 18px;
margin: 20px 10px;
text-align: center;
}
.welcome {
font-size: 16px;
color: #aaaaaa;
margin: 20px 10px 60px;
}
.code-name {
font-size: 20px;
margin: 20px 10px 2px;
font-weight: bold;
text-align: center;
}
.code-image {
text-align: center;
margin-bottom: 100px;
}
.service {
text-align: center;
.van-button {
border-radius: 4px;
height: 36px;
}
}
}
.service-dialog {
text-align: center;
border-radius: 0;
padding: 20px;
.service-message {
margin-bottom: 30px;
}
.tip {
font-size: 12px;
color: #aaaaaa;
}
.close {
position: absolute;
top: 10px;
right: 10px;
}
}
</style>