first commit

This commit is contained in:
Ls
2026-02-12 12:19:20 +08:00
commit 219fd9be5c
529 changed files with 169918 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
import { EventHandler } from '@/Service/Comm/EventHandler';
import { Service, ImConnectService } from '@/Service/Im/ImConnectService';
export class WebSocket {
private socketTask: any;
private heartbeat: number = 60000;
private heartbeatInterval: any;
public ConnectSocketInit() {
ImConnectService.GetConnect().then((res: any) => {
Service.SetUserClientId(res.data.websocketId);
this.socketTask = uni.connectSocket({
url: res.data.server,
header: {
'content-type': 'application/json'
},
success: () => {
// console.log('============正准备建立websocket中================');
}
});
this.socketTask.onOpen((res: any) => {
console.log('==============WebSocket连接正常=============');
this.start();
EventHandler.ConnectBus();
// 只有连接正常打开中 ,才能正常收到消息
this.socketTask.onMessage((data: any) => {
console.log('接收到消息')
EventHandler.Events(data);
});
});
this.socketTask.onClose((e: any) => {
console.log('========已经被关闭了====================', e);
// 加了flag判断是否为手动用户主动关闭
// e && e.reason == 'user' ? '' : this.reconnect();
});
});
}
private start() {
var data = {
code: 'Heart',
method: 'Heart'
};
this.heartbeatInterval = setInterval(() => {
console.log('======start====开启心跳检测====', data);
this.send(JSON.stringify(data));
}, this.heartbeat);
}
//重新连接
public reconnect() {
//停止发送心跳
clearInterval(this.heartbeatInterval);
//如果不是人为关闭的话,进行重连
uni.$emit('ImCom');
}
// 关闭 WebSocket 连接
public CloseSocket(reason: string) {
if(!this.socketTask){
return
}
this.socketTask.close({
code: 1000,
reason: reason,
success() {
clearInterval(this.heartbeatInterval);
console.log('===============关闭 WebSocket 成功===================');
},
fail() {
console.log('===================关闭 WebSocket 失败=====================');
}
});
}
//发送消息
public send(value: any) {
if(!this.socketTask){
return
}
// 连接正常打开时 ,才能正常成功发送消息
this.socketTask.send({
data: value,
success() {},
fail() {
this.reconnect();
}
});
}
}

View File

@@ -0,0 +1,322 @@
<template>
<view v-if="loading" style="margin: 20rpx;">
<!-- 用户信息骨架屏 -->
<view class="skeleton-user-card">
<view class="skeleton-avatar"></view>
<view class="skeleton-user-info">
<view class="skeleton-line skeleton-name"></view>
<view class="skeleton-line skeleton-id"></view>
<view class="skeleton-line skeleton-status"></view>
</view>
</view>
<!-- 服务列表骨架屏 -->
<view class="skeleton-section-title"></view>
<view class="skeleton-service-list">
<view class="skeleton-service-item" v-for="i in 4" :key="i">
<view class="skeleton-icon"></view>
<view class="skeleton-line skeleton-service-name"></view>
<view class="skeleton-arrow"></view>
</view>
</view>
<!-- 退出登录按钮骨架屏 -->
<view class="skeleton-logout-btn"></view>
</view>
<view v-else style="margin: 20rpx ;">
<view class=""
style="background: linear-gradient(to bottom,#E6F7FF,#FFFFFF) ; border-radius: 20rpx; display: flex; align-items: center; padding: 40rpx 20rpx; ">
<image :src="Service.GetMateUrlByImg(riderInfo.headImg)"
style="width: 110rpx; height: 110rpx; border-radius: 50%; border: 1rpx solid var(--nav-mian); " mode="">
</image>
<view class="" style="flex: 1; margin-left: 30rpx;">
<view class="" style="display: flex; align-items: center; gap: 20rpx;">
<view class="" style="font-size: 34rpx; font-weight: 600; color: var(--nav-mian); ">
{{riderInfo.nick}}
</view>
<!-- <view class=""
style="background-color: var(--nav-vice); color: #fff; padding: 4rpx 10rpx; border-radius: 4rpx; font-size: 24rpx; display: flex; align-items: baseline; justify-content: center; ">
4.9
</view> -->
</view>
<view class="" style="margin: 10rpx 0; font-size: 28rpx; ">
riderNo: {{ riderInfo.riderNo }}
</view>
<view class="" style="color: var(--nav-vice); font-weight: bold; ">
{{ riderInfo.isOnline==0?'已下线':'已上线' }}
</view>
</view>
<view @click="Service.GoPage('/pages/my/edit')" class="">
<u-icon name="setting" size="20"></u-icon>
</view>
</view>
<view class="" style="margin: 20rpx 0;">
<text style="font-size: 34rpx; font-weight: 600; ">我的服务</text>
</view>
<view class="" style=" background-color: #fff; border-radius: 20rpx; ">
<view class="" @click="gopage(funcItem,funcIndex)" v-for="(funcItem,funcIndex) in funcList" :key="funcIndex"
style=" border-bottom: 1rpx solid #e2e2e2; display: flex; align-items: center; padding: 24rpx 30rpx; ">
<image :src="Service.GetIconImg(funcItem.icon)" style="width: 50rpx; height: 50rpx; " mode=""></image>
<view class="" style="flex: 1; font-size: 28rpx; margin-left: 20rpx; ">
{{funcItem.name}}
</view>
<view class="">
<up-icon name="arrow-right"></up-icon>
</view>
</view>
</view>
<button @click="Service.GoPage('/pages/my/login')" class="confirm-button">退出登录</button>
<view class="" style="width: 100vw; height: 100rpx; ">
</view>
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app";
import { Service } from "@/Service/Service";
import { ref } from 'vue'
import { CNRiderDataService } from "@/Service/CN/CNRiderDataService"
let loading = ref(true)
let funcList = ref([
{
name: '联系客服',
icon: '/static/index/user/phone.png',
path: '/pages/my/myKF'
},
{
name: '异常订单',
icon: '/static/index/user/warming.png',
path: '/pages/my/AbnormalList'
},
// {
// name: '签到与奖励',
// icon: '/static/index/user/check.png',
// path: '/pages/my/check'
// },
{
name: '账号与安全',
icon: '/static/index/user/security.png',
path: '/pages/my/security'
},
{
name: '评价中心',
icon: '/static/index/user/security.png',
path: '/pages/my/evaluate'
}
])
let riderInfo=ref<any>({})
onLoad(() => {
});
onShow(() => {
getData()
});
const getData = () => {
CNRiderDataService.GetRiderInfo().then(res => {
loading.value = false
if(res.data){
riderInfo.value=res.data.riderInfo
}
})
}
const gopage = (item : any, index : number) => {
if (index == 0 || index == 1) {
Service.GoPageTab(item.path)
} else {
Service.GoPage(item.path)
}
}
</script>
<style lang="scss">
.confirm-button {
width: 100%;
height: 90rpx;
background-color: #1677ff;
color: #fff;
font-size: 34rpx;
font-weight: 600;
border-radius: 45rpx;
display: flex;
align-items: center;
justify-content: center;
border: none;
margin-top: 20rpx;
}
.confirm-button:active {
background-color: #0958d9;
}
// 骨架屏基础样式和动画
.skeleton-loading {
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
animation: skeleton-loading 1.5s infinite;
border-radius: 8rpx;
}
@keyframes skeleton-loading {
0% {
background-position: 200% 0;
}
100% {
background-position: -200% 0;
}
}
// 骨架屏公共样式
.skeleton-line {
height: 32rpx;
background-color: #f0f0f0;
border-radius: 8rpx;
}
// 用户信息卡片骨架
.skeleton-user-card {
display: flex;
align-items: center;
padding: 40rpx 20rpx;
background: linear-gradient(to bottom, #f0f0f0, #fafafa);
border-radius: 20rpx;
margin-bottom: 20rpx;
}
.skeleton-avatar {
width: 110rpx;
height: 110rpx;
border-radius: 50%;
background-color: #f0f0f0;
}
.skeleton-user-info {
flex: 1;
margin-left: 30rpx;
}
.skeleton-name {
width: 40%;
height: 36rpx;
margin-bottom: 16rpx;
}
.skeleton-id {
width: 60%;
height: 30rpx;
margin-bottom: 16rpx;
}
.skeleton-status {
width: 50%;
height: 28rpx;
}
// 数据统计卡片骨架
.skeleton-stats-card {
display: flex;
justify-content: space-around;
background-color: #fff;
border-radius: 20rpx;
padding: 20rpx;
}
.skeleton-stat-item {
display: flex;
flex-direction: column;
align-items: center;
width: 30%;
}
.skeleton-stat-value {
width: 80%;
height: 40rpx;
margin-bottom: 12rpx;
}
.skeleton-stat-label {
width: 60%;
height: 28rpx;
}
// 服务列表骨架
.skeleton-section-title {
height: 40rpx;
background-color: #fff;
width: 30%;
margin: 20rpx 0;
.skeleton-loading {}
}
.skeleton-service-list {
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
margin-bottom: 20rpx;
}
.skeleton-service-item {
display: flex;
align-items: center;
padding: 24rpx 30rpx;
border-bottom: 1rpx solid #f5f5f5;
}
.skeleton-service-item:last-child {
border-bottom: none;
}
.skeleton-icon {
width: 50rpx;
height: 50rpx;
background-color: #f0f0f0;
border-radius: 8rpx;
margin-right: 20rpx;
}
.skeleton-service-name {
flex: 1;
height: 30rpx;
}
.skeleton-arrow {
width: 20rpx;
height: 20rpx;
background-color: #f0f0f0;
border-radius: 4rpx;
}
// 退出登录按钮骨架
.skeleton-logout-btn {
height: 90rpx;
background-color: #fff;
border-radius: 45rpx;
margin-bottom: 20rpx;
}
// 底部占位
.skeleton-bottom-space {
height: 100rpx;
}
</style>