客服
This commit is contained in:
parent
cb411ddcf0
commit
07623d14e5
|
|
@ -7,8 +7,7 @@
|
|||
// npm安装方式
|
||||
// "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
|
||||
},
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "pages/index/default/default",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "white",
|
||||
|
|
@ -60,14 +59,19 @@
|
|||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "商品列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/default/kefu",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "客服"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subpackages": [
|
||||
{
|
||||
"subpackages": [{
|
||||
"root": "pages/share",
|
||||
"name": "share",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "sharePoster/sharePoster",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
|
@ -86,8 +90,7 @@
|
|||
{
|
||||
"root": "pages/serviceGoods",
|
||||
"name": "serviceGoods",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "index/index",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
|
@ -106,34 +109,29 @@
|
|||
{
|
||||
"root": "pages/map",
|
||||
"name": "map",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "map",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "地图展示"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "pages/search",
|
||||
"name": "search",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "search",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "搜索"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "pages/placeOrder",
|
||||
"name": "placeOrder",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "index/index",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
|
@ -159,8 +157,7 @@
|
|||
{
|
||||
"root": "pages/payment",
|
||||
"name": "payment",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "pay/pay",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
|
@ -186,21 +183,18 @@
|
|||
{
|
||||
"root": "pages/storeMap",
|
||||
"name": "storeMap",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "storeMap",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "门店列表"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "pages/goods",
|
||||
"name": "goods",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "goodDetails/goodDetails",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
|
@ -220,34 +214,29 @@
|
|||
{
|
||||
"root": "pages/form",
|
||||
"name": "form",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "details/details",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "万能表单"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "pages/coupon",
|
||||
"name": "coupon",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "coupon",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "优惠券列表"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
"root": "pages/article",
|
||||
"name": "article",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "details/details",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
|
@ -266,8 +255,7 @@
|
|||
{
|
||||
"root": "pages/activity",
|
||||
"name": "template",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "pinTuan/list/list",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
|
@ -314,8 +302,7 @@
|
|||
{
|
||||
"root": "pages/member",
|
||||
"name": "member",
|
||||
"pages": [
|
||||
{
|
||||
"pages": [{
|
||||
"path": "coupon/index",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
|
|
@ -769,8 +756,7 @@
|
|||
"color": "#999",
|
||||
"selectedColor": "#333",
|
||||
"backgroundColor": "#fff",
|
||||
"list": [
|
||||
{
|
||||
"list": [{
|
||||
"pagePath": "pages/index/default/default",
|
||||
"text": "首页",
|
||||
"iconPath": "static/images/indexMenus/index01.png",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<template>
|
||||
<template>
|
||||
<!-- 页面主体 -->
|
||||
<view>
|
||||
<!--提示框组件-->
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
<!--版权组件-->
|
||||
<copyright></copyright>
|
||||
<!--客服组件-->
|
||||
<button class="floatingButton" hover-class="none" open-type="contact" bindcontact="showChat" :session-from="kefupara">
|
||||
<button class="floatingButton" hover-class="none" open-type="contact" bindcontact="showChat" :session-from="kefupara" @click="kefuClick">
|
||||
<u-icon name="server-man" color="#e54d42" size="60"></u-icon>
|
||||
</button>
|
||||
<!--返回顶部组件-->
|
||||
|
|
@ -92,6 +92,19 @@
|
|||
methods: {
|
||||
about() {
|
||||
|
||||
},
|
||||
kefuClick(){
|
||||
console.log('点击客服')
|
||||
console.log(this.userInfo);
|
||||
if(this.userInfo==null){
|
||||
uni.showToast({
|
||||
title:"未登录"
|
||||
})
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/index/default/kefu'
|
||||
});
|
||||
},
|
||||
goSearch() {
|
||||
uni.navigateTo({
|
||||
|
|
|
|||
100
CoreCms.Net.Uni-App/CoreShop/pages/index/default/kefu.vue
Normal file
100
CoreCms.Net.Uni-App/CoreShop/pages/index/default/kefu.vue
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
<template>
|
||||
|
||||
<view>
|
||||
<web-view :webview-styles="webviewStyles" :src="url"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations, mapActions, mapState } from 'vuex';
|
||||
|
||||
import { goods } from '@/common/mixins/mixinsHelper.js';
|
||||
export default {
|
||||
mixins: [goods],
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
url:"",
|
||||
kefuUrlTemplate: "", // 后台传入的客服地址模板
|
||||
webviewStyles: {
|
||||
top:0,
|
||||
width:'100%',
|
||||
height:'100%'
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
hasLogin: state => state.hasLogin,
|
||||
userInfo: state => state.userInfo,
|
||||
}),
|
||||
hasLogin: {
|
||||
get() {
|
||||
return this.$store.state.hasLogin;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit('hasLogin', val);
|
||||
}
|
||||
},
|
||||
userInfo: {
|
||||
get() {
|
||||
return this.$store.state.userInfo;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit('userInfo', val);
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
onReady() {
|
||||
|
||||
},
|
||||
onLoad(e) {
|
||||
console.log(this.userInfo);
|
||||
// 后台传入的客服地址模板
|
||||
const kefuUrlTemplate = "http://kefu.zpc-xy.com/chat/mobile?noCanClose=1&token=18b7482b8b1301e9b2309522859ff8cb&openid={openid}&nickName={nickName}&phone={phone}&avatar={avatar}";
|
||||
|
||||
// 使用新的方法生成客服链接
|
||||
this.url = this.generateKefuUrl(kefuUrlTemplate);
|
||||
console.log('生成的客服链接:', this.url);
|
||||
},
|
||||
methods: {
|
||||
about() {
|
||||
|
||||
},
|
||||
|
||||
// 生成客服链接的方法
|
||||
generateKefuUrl(urlTemplate) {
|
||||
if (!this.userInfo) {
|
||||
console.error('用户信息不存在');
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!urlTemplate) {
|
||||
console.error('客服地址模板不存在');
|
||||
return '';
|
||||
}
|
||||
|
||||
// 获取用户数据并映射
|
||||
const openid = this.userInfo.id || '';
|
||||
const phone = this.userInfo.mobile || '';
|
||||
const nickName = this.userInfo.nickName || '';
|
||||
const avatar = this.userInfo.avatarImage || '';
|
||||
|
||||
// 替换URL模板中的占位符,并对每个参数进行URL编码转义
|
||||
let finalUrl = urlTemplate
|
||||
.replace('{openid}', openid)
|
||||
.replace('{phone}', phone)
|
||||
.replace('{nickName}',nickName)
|
||||
.replace('{avatar}',avatar);
|
||||
|
||||
return finalUrl;
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user