Skip to content

Commit 284fc35

Browse files
committed
feat(SPA): 增加 QQ 在线咨询可选功能
1 parent d6eceed commit 284fc35

File tree

6 files changed

+80
-3
lines changed

6 files changed

+80
-3
lines changed

resources/spa/.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ VUE_APP_LBS_GAODE_KEY=
3131
# MobLink 唤起APP
3232
VUE_APP_MOBLINK_ENABLE=false
3333
VUE_APP_MOBLINK_KEY=
34+
35+
# QQ 在线咨询
36+
VUE_APP_QQ_CONSULT_ENALBE=false
37+
VUE_APP_QQ_CONSULT_UIN=
38+
VUE_APP_QQ_CONSULT_LABEL=在线咨询

resources/spa/README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,20 @@
6969
使用时请填写 `.env` 文件中的以下两行
7070

7171
``` ini
72-
VUE_APP_MOBLINK_ENABLE=true # MobLink 引导启动 APP 开关
73-
VUE_APP_MOBLINK_KEY=xxxxxxxxxxxx # MobLink APP KEY
72+
# MobLink 唤起APP
73+
VUE_APP_MOBLINK_ENABLE=true # MobLink 引导启动 APP 开关
74+
VUE_APP_MOBLINK_KEY=xxxxxxxxxxxx # MobLink APP KEY
75+
```
76+
77+
### 在线咨询 QQ
78+
79+
使用时请修改 `.env` 文件中的以下部分以唤起 QQ 在线资讯
80+
81+
``` ini
82+
# QQ 在线咨询
83+
VUE_APP_QQ_CONSULT_ENALBE=true # QQ 咨询开关
84+
VUE_APP_QQ_CONSULT_UIN=10000 # QQ 号码 (需要先开通在线状态)
85+
VUE_APP_QQ_CONSULT_LABEL=在线咨询 # 标签文本
7486
```
7587

7688
## License

resources/spa/src/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// vuex utils
22
import { mapActions, mapState } from 'vuex'
3+
import CONST from './constants/app'
34

45
// components
56
import PSWP from './components/pswp'
@@ -13,6 +14,7 @@ import Report from './components/Report.vue'
1314
import ChooseTags from './page/ChooseTags.vue'
1415
import ApplyTop from './components/ApplyForTop.vue'
1516
import PopupDialog from './components/PopupDialog.vue'
17+
import ChatWithQQ from './components/vendor/ChatWithQQ.vue'
1618

1719
export default {
1820
render () {
@@ -31,7 +33,8 @@ export default {
3133
<Report />
3234
<ChooseTags />
3335
<ApplyTop />
34-
<PopupDialog />
36+
<PopupDialog />,
37+
{CONST.ENABLE_QQ_CONSULT && <ChatWithQQ />}
3538
</div>
3639
</div>
3740
)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<template>
2+
<div class="c-chat-with-qq" @click="onChatClick">
3+
<img :src="require('@/images/ico_consult.png')" alt="">
4+
<span>{{ label }}</span>
5+
</div>
6+
</template>
7+
8+
<script>
9+
export default {
10+
name: 'ChatWithQQ',
11+
data () {
12+
return {
13+
label: process.env.VUE_APP_QQ_CONSULT_LABEL || '在线咨询',
14+
}
15+
},
16+
methods: {
17+
onChatClick () {
18+
const uin = process.env.VUE_APP_QQ_CONSULT_UIN
19+
if (!uin) return this.$Message.error('没有配置正确的UIN')
20+
window.open(`//wpa.qq.com/msgrd?v=3&uin=${uin}&site=qq&menu=yes`)
21+
},
22+
},
23+
}
24+
</script>
25+
26+
<style lang="less" scoped>
27+
@margin: 20px;
28+
@width: 90px;
29+
30+
.c-chat-with-qq {
31+
position: fixed;
32+
right: @margin;
33+
bottom: @margin+100px;
34+
display: flex;
35+
flex-direction: column;
36+
width: @width;
37+
border-radius: 6px;/*no*/
38+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09); /*no*/
39+
background-color: rgba(255,255,255,.9);
40+
overflow: hidden;
41+
42+
img {
43+
width: @width;
44+
height: @width;
45+
}
46+
47+
span {
48+
display: flex;
49+
justify-content: center;
50+
align-items: center;
51+
height: 2.3*@width;
52+
writing-mode: vertical-lr;
53+
letter-spacing: 4px;/*no*/
54+
}
55+
}
56+
</style>

resources/spa/src/constants/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export default {
44
ENABLE_SERVICE_WORKER: boolean(process.env.VUE_APP_ENABLE_SERVICE_WORKER || false),
55
ENABLE_MOBLINK: boolean(process.env.VUE_APP_MOBLINK_ENABLE || false),
66
ENABLE_GAODE: process.env.VUE_APP_LBS_GAODE_KEY || false,
7+
ENABLE_QQ_CONSULT: boolean(process.env.VUE_APP_QQ_CONSULT_ENALBE || false),
78
}
1.79 KB
Loading

0 commit comments

Comments
 (0)