uniapp【新增】: 首页添加悬浮在线客服按钮

This commit is contained in:
15093570141
2024-11-06 21:44:00 +08:00
parent fb69bce530
commit 022291200c
2 changed files with 30 additions and 2 deletions

View File

@@ -18,4 +18,19 @@
.content-box { .content-box {
position: relative; position: relative;
} }
.kufu-button {
position: fixed;
right: 40rpx;
bottom: 100rpx;
width: 80rpx;
height: 80rpx;
background-color: #fff;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 0 15rpx #ccc;
padding: 0;
z-index: 99;
}
} }

View File

@@ -1,6 +1,6 @@
<template> <template>
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom needSkeleton :skeleton="skeleton" <coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom needSkeleton
:skeletonLoading="loading"> :skeleton="skeleton" :skeletonLoading="loading">
<view class="layout-home-page page-bg"> <view class="layout-home-page page-bg">
<image class="home-bg" :src="handleStaticResources('/static/images/home-bg.jpg')"></image> <image class="home-bg" :src="handleStaticResources('/static/images/home-bg.jpg')"></image>
<uv-navbar :title="shopConfigStore.config?.shopName" <uv-navbar :title="shopConfigStore.config?.shopName"
@@ -22,6 +22,13 @@
<!-- 弹框广告 --> <!-- 弹框广告 -->
<HomeAdpop></HomeAdpop> <HomeAdpop></HomeAdpop>
<!-- #ifdef MP-WEIXIN -->
<button class="kufu-button" hover-class="none" open-type="contact" bindcontact="showChat"
:session-from="state.kufuData">
<uv-icon name="server-man" color="#d33123" :size="40"></uv-icon>
</button>
<!-- #endif -->
</view> </view>
</coreshop-page> </coreshop-page>
</template> </template>
@@ -55,11 +62,13 @@
isScrollTop : boolean; isScrollTop : boolean;
showPage : boolean; showPage : boolean;
shareUrl : string; shareUrl : string;
kufuData : string;
}>({ }>({
coreshopData: [], coreshopData: [],
isScrollTop: false, isScrollTop: false,
showPage: false, showPage: false,
shareUrl: "", shareUrl: "",
kufuData: ""
}) })
onShow(() => { onShow(() => {
@@ -104,6 +113,10 @@
const userInfo : Response<UserInfoType> = await queryUserInfo(); const userInfo : Response<UserInfoType> = await queryUserInfo();
if (userInfo.status) { if (userInfo.status) {
userInfoStore.setUserInfo(userInfo?.data); userInfoStore.setUserInfo(userInfo?.data);
state.kufuData = JSON.stringify({
nickName: userInfo?.data?.nickName,
tel: userInfo?.data?.mobile
})
} }
} }