feat: 客服

This commit is contained in:
2026-07-20 15:31:52 +08:00
parent 0099ccaa60
commit 82a8043578
23 changed files with 5071 additions and 360 deletions
+113 -74
View File
@@ -1,87 +1,126 @@
<template>
<view class="content">
<TopSafe></TopSafe>
<view class="setting-view" v-if="h5Url">
<iframe :src="h5Url" frameborder="no" border="0" class="web-view">
</iframe>
</view>
<!-- 腾讯电子签H5 → 集成到UniApp -->
</view>
<view class="customer-service-page">
<TopSafe />
<view class="customer-service-nav">
<button class="nav-back" aria-label="返回" @click="goBack">
<u-icon name="arrow-left" size="25" color="#2f3037" />
</button>
<text class="nav-title">全媒体智能客服</text>
<view class="nav-placeholder" />
</view>
<button class="history-entry" @click="showHistory">点击查询聊天记录</button>
<view class="customer-service-body">
<hashmall-customer-service v-if="optionsReady" ref="customerService" :entry-options="entryOptions" />
</view>
</view>
</template>
<script>
import { getUserInfo,uploadAvatar } from '@/api/auth.js';
import { uploadImage, uploadImg } from '@/api/common.js';
import { IMG_TYPE } from '@/utils/enumUtils.js';
import { BASE_URL, Authorization } from '@/utils/config.js';
import { getStorageFun, TOKEN_NAME,clear } from '@/utils/auth.js';
import Header from '@/components/common/header.vue';
import TopSafe from '@/components/common/top-safe.nvue'
import MyBtn from '@/components/common/my-btn.vue'
import func from '@/utils/func.js';
import HashmallCustomerService from '@/uni_modules/hashmall-customer-service/components/hashmall-customer-service/hashmall-customer-service.vue'
export default {
components: { Header, TopSafe,MyBtn },
data() {
return {
h5Url:'',
};
},
onShow() {
},
onLoad(option) {
if(option.type ){
this.init(option.type);
}
},
methods: {
init(type) {
this.getUserInfo(type)
},
async getUserInfo(type) {
const result = await getUserInfo();
if (result && result.bizcode === 100) {
const data = result.data;
this.currentUserData = result.data || {};
let url = `https://www.aigcyun.cn/uniChat/#/?skillGroupId=${type}&enterpriseId=1435&extraData=`;
let addHyExtraData = {
customerId:data.id,
customerName:data.nickname,
};
this.h5Url = url + encodeURIComponent(JSON.stringify(addHyExtraData))
}
},
}
components: {
TopSafe,
HashmallCustomerService
},
data() {
return {
entryOptions: {},
optionsReady: false
}
},
onLoad(options) {
this.entryOptions = options || {}
this.optionsReady = true
},
onShow() {
this.$nextTick(() => {
if (this.$refs.customerService) this.$refs.customerService.resume()
})
},
onHide() {
if (this.$refs.customerService) this.$refs.customerService.suspend()
},
onUnload() {
if (this.$refs.customerService) this.$refs.customerService.suspend()
},
methods: {
goBack() {
uni.navigateBack()
},
showHistory() {
if (this.$refs.customerService) this.$refs.customerService.showHistory()
}
}
}
</script>
<style lang="scss" scoped>
.web-view{
height:100%;
width:100%;
position: relative;
}
.setting-view {
width: 100%;
height: calc(100% - var(--status-bar-height));
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
box-sizing: border-box;
position: relative;
<style scoped lang="scss">
.customer-service-page {
display: flex;
width: 100%;
height: 100vh;
height: 100dvh;
box-sizing: border-box;
flex-direction: column;
overflow: hidden;
background: #f4f5fa;
}
</style>
<style>
.chatModel{
height:calc(100% - var(--status-bar-height));
margin-top:var(--status-bar-height);
}
.customer-service-nav {
display: flex;
height: 92rpx;
align-items: center;
justify-content: space-between;
padding: 0 28rpx;
background: #f4f5fa;
}
.nav-back,
.nav-placeholder {
width: 72rpx;
height: 72rpx;
flex: 0 0 72rpx;
}
.nav-back {
display: flex;
align-items: center;
justify-content: flex-start;
margin: 0;
padding: 0;
background: transparent;
}
.nav-title {
color: #101116;
font-size: 38rpx;
font-weight: 500;
line-height: 1.2;
}
.history-entry {
width: 100%;
height: 72rpx;
margin: 0;
padding: 0;
background: transparent;
color: #a2a3aa;
font-size: 27rpx;
font-weight: 400;
line-height: 72rpx;
}
.nav-back::after,
.history-entry::after {
border: 0;
}
.customer-service-body {
width: 100%;
min-height: 0;
flex: 1;
overflow: hidden;
}
</style>