first commit
This commit is contained in:
@@ -0,0 +1,420 @@
|
||||
<template>
|
||||
<!-- 导航栏 -->
|
||||
<view class=""
|
||||
style=" z-index: 100; padding:50rpx 20rpx 18rpx;box-sizing: border-box; position: fixed;top: 0; left: 0; width: 100vw; background-color: #fff; display: flex; align-items: center; justify-content: space-between; ">
|
||||
<view class="" @click="Service.GoPageBack()">
|
||||
<up-icon name="arrow-left" size="32rpx"></up-icon>
|
||||
</view>
|
||||
<view class="">
|
||||
客服咨询
|
||||
</view>
|
||||
<up-icon name="phone-fill" color="var(--nav-mian)" size="24"></up-icon>
|
||||
</view>
|
||||
<view class="" style="width: 100%; height: 108rpx; ">
|
||||
|
||||
</view>
|
||||
<view v-if="loading" class="" style="background-color: #fff; height: 81vh; " >
|
||||
<view class="" style="width: 100%; height: 50rpx; "></view>
|
||||
<view class="skeleton-system-message"></view>
|
||||
|
||||
<view class="" style="margin: 0 30rpx;" >
|
||||
<!-- 客服消息骨架 -->
|
||||
<view class="skeleton-message-wrapper skeleton-incoming">
|
||||
<view class="skeleton-slot skeleton-sender"></view>
|
||||
<view class="skeleton-slot skeleton-bubble incoming"></view>
|
||||
</view>
|
||||
|
||||
<!-- 用户消息骨架 -->
|
||||
<view class="skeleton-message-wrapper skeleton-outgoing">
|
||||
<view class="skeleton-slot skeleton-sender"></view>
|
||||
<view class="skeleton-slot skeleton-bubble outgoing"></view>
|
||||
</view>
|
||||
|
||||
<!-- 客服消息骨架 -->
|
||||
<view class="skeleton-message-wrapper skeleton-incoming">
|
||||
<view class="skeleton-slot skeleton-sender"></view>
|
||||
<view class="skeleton-slot skeleton-bubble incoming"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="" style="position: fixed; bottom: 0; left: 0; width: 100vw; background-color: #fff; " >
|
||||
<view class="skeleton-quick-replies" >
|
||||
<view class="skeleton-slot skeleton-title"></view>
|
||||
<view class="skeleton-tags">
|
||||
<view class="skeleton-slot skeleton-tag"></view>
|
||||
<view class="skeleton-slot skeleton-tag"></view>
|
||||
<view class="skeleton-slot skeleton-tag"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 输入区域骨架 -->
|
||||
<view class="skeleton-input-row">
|
||||
<view class="skeleton-slot skeleton-icon"></view>
|
||||
<view class="skeleton-slot skeleton-icon"></view>
|
||||
<view class="skeleton-slot skeleton-input"></view>
|
||||
<view class="skeleton-slot skeleton-send"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="chat-page">
|
||||
<!-- 页面实际内容 -->
|
||||
<view class="page-content">
|
||||
<!-- 聊天内容区域 -->
|
||||
<scroll-view class="chat-scroll-view" scroll-y>
|
||||
<view class="message-list">
|
||||
<!-- 系统消息 -->
|
||||
<view class="system-message" style="width: 100%; text-align: center; margin-bottom: 20rpx;">
|
||||
系统:正在为您接入人工客服...
|
||||
</view>
|
||||
<view class="message-wrapper" v-for="(msg, index) in messages" :key="index"
|
||||
:class="`type-${msg.type}`">
|
||||
<!-- 其他消息 -->
|
||||
<view class="bubble-wrapper">
|
||||
<text class="sender-name">{{ msg.sender }}</text>
|
||||
<view :style="{ 'color': msg.type=='outgoing'?'#fff':'' }" class="message-bubble">
|
||||
{{ msg.content }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 底部输入栏 -->
|
||||
<view class="input-bar">
|
||||
<!-- 常见问题 -->
|
||||
<view class="quick-replies">
|
||||
<view class="title">常见问题</view>
|
||||
<up-scroll-list :indicator='false'>
|
||||
<view class="tag" v-for="reply in quickReplies" :key="reply" @click="sendQuickReply(reply)">
|
||||
{{ reply }}
|
||||
</view>
|
||||
</up-scroll-list>
|
||||
</view>
|
||||
<view class="" style="display: flex; align-items: center; gap: 20rpx; ">
|
||||
<up-icon name="plus-circle" size="24" color="#666"></up-icon>
|
||||
<up-icon name="mic" size="24" color="#666"></up-icon>
|
||||
<view class="input-wrapper">
|
||||
<up-input v-model="inputValue" placeholder="输入问题描述" border="surround"></up-input>
|
||||
</view>
|
||||
<text style="color: var(--nav-mian);">发送</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { Service } from "@/Service/Service";
|
||||
|
||||
const loading = ref<boolean>(true);
|
||||
const inputValue = ref('');
|
||||
|
||||
// 聊天消息列表
|
||||
const messages = reactive([
|
||||
{ type: 'incoming', content: '您的订单已开始制作', sender: '客服小美' },
|
||||
{ type: 'outgoing', content: '好的,麻烦了', sender: '我' },
|
||||
{ type: 'incoming', content: '您的订单已完成,正在前往配送', sender: '骑手 王师傅' },
|
||||
]);
|
||||
|
||||
// 常见问题列表
|
||||
const quickReplies = reactive([
|
||||
'已到店,准备取餐',
|
||||
'餐已取,正在配送',
|
||||
'已到楼下',
|
||||
'已到楼下',
|
||||
]);
|
||||
|
||||
// 发送消息
|
||||
const sendMessage = () => {
|
||||
if (!inputValue.value.trim()) return;
|
||||
messages.push({
|
||||
type: 'outgoing',
|
||||
content: inputValue.value,
|
||||
sender: '我',
|
||||
});
|
||||
inputValue.value = '';
|
||||
};
|
||||
|
||||
// 发送快捷回复
|
||||
const sendQuickReply = (reply : string) => {
|
||||
messages.push({
|
||||
type: 'outgoing',
|
||||
content: reply,
|
||||
sender: '我',
|
||||
});
|
||||
};
|
||||
|
||||
onLoad(() => {
|
||||
setTimeout(() => { loading.value = false; }, 1000);
|
||||
});
|
||||
onShow(() => { });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.chat-page {
|
||||
background-color: #f7f7f7;
|
||||
height: 78vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.page-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.order-status-bar {
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
width: 100vw;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10rpx;
|
||||
border-radius: 20rpx;
|
||||
background-color: #E6F7FF;
|
||||
padding: 20rpx 30rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.chat-scroll-view {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.message-list {
|
||||
padding: 30rpx;
|
||||
|
||||
.message-wrapper {
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
&.type-system {
|
||||
text-align: center;
|
||||
|
||||
// .system-message {
|
||||
// display: inline-block;
|
||||
// background-color: #e5e5e5;
|
||||
// color: #fff;
|
||||
// font-size: 24rpx;
|
||||
// padding: 6rpx 20rpx;
|
||||
// border-radius: 8rpx;
|
||||
// }
|
||||
}
|
||||
|
||||
&.type-incoming {
|
||||
.bubble-wrapper {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.message-bubble {
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
&.type-outgoing {
|
||||
.bubble-wrapper {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.message-bubble {
|
||||
background-color: #1890FF;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.bubble-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.sender-name {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.message-bubble {
|
||||
max-width: 70%;
|
||||
padding: 20rpx;
|
||||
border-radius: 16rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.5;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.quick-replies {
|
||||
.title {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.tag {
|
||||
width: fit-content;
|
||||
white-space: nowrap;
|
||||
background-color: #E6F7FF;
|
||||
padding: 16rpx 24rpx;
|
||||
border-radius: 30rpx;
|
||||
font-size: 26rpx;
|
||||
color: #1890FF;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.input-bar {
|
||||
width: 100vw;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
gap: 20rpx;
|
||||
background-color: #f7f7f7;
|
||||
padding: 20rpx 30rpx;
|
||||
padding-bottom: calc(20rpx + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
||||
border-top: 1rpx solid #e5e5e5;
|
||||
|
||||
.input-wrapper {
|
||||
flex: 1;
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
|
||||
:deep(.up-input) {
|
||||
padding: 16rpx 20rpx !important;
|
||||
}
|
||||
}
|
||||
|
||||
.send-btn {
|
||||
background-color: #FFD43D;
|
||||
color: #333;
|
||||
font-size: 28rpx;
|
||||
height: 72rpx;
|
||||
line-height: 72rpx;
|
||||
padding: 0 40rpx;
|
||||
border-radius: 12rpx;
|
||||
margin: 0;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 骨架屏样式 - 纯CSS实现 */
|
||||
.skeleton-slot {
|
||||
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: skeleton-loading 1.5s infinite ease-in-out;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
/* 骨架屏动画 */
|
||||
@keyframes skeleton-loading {
|
||||
0% {
|
||||
background-position: 200% 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
background-position: -200% 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 消息骨架屏 */
|
||||
.skeleton-system-message {
|
||||
width: 50%;
|
||||
height: 32rpx;
|
||||
margin: 0 auto 40rpx;
|
||||
border-radius: 16rpx;
|
||||
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: skeleton-loading 1.5s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.skeleton-message-wrapper {
|
||||
margin-bottom: 40rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.skeleton-incoming {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.skeleton-outgoing {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.skeleton-sender {
|
||||
width: 160rpx;
|
||||
height: 30rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.skeleton-bubble {
|
||||
padding: 20rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.skeleton-bubble.incoming {
|
||||
width: 60%;
|
||||
height: 80rpx;
|
||||
}
|
||||
|
||||
.skeleton-bubble.outgoing {
|
||||
width: 50%;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
/* 输入区域骨架屏 */
|
||||
.skeleton-quick-replies {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.skeleton-title {
|
||||
width: 140rpx;
|
||||
height: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.skeleton-tags {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.skeleton-tag {
|
||||
width: 200rpx;
|
||||
height: 60rpx;
|
||||
border-radius: 30rpx;
|
||||
}
|
||||
|
||||
.skeleton-input-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.skeleton-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.skeleton-input {
|
||||
flex: 1;
|
||||
height: 72rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.skeleton-send {
|
||||
width: 80rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user