chenjj 10 hours ago
parent
commit
e00248fda3

+ 13 - 13
App.vue

@@ -1,5 +1,5 @@
 <script>
-import WebSocketManager from '@/utils/WebSocketManager.js';
+// import WebSocketManager from '@/utils/WebSocketManager.js';
 import { watch } from 'vue';
 import store from '@/store'
 export default {
@@ -19,18 +19,18 @@ export default {
 	watch: {
         userId: {
             handler() {
-                console.log('yong---------------',this.userId);
-				const wsManager = new WebSocketManager(this.userId);
-				// 设置消息回调
-				wsManager.onMessage(data => {
-					console.log('app-接收到的消息:', data);
-					// 处理消息逻辑
-					if(data.type === 'msgUnreadCount'){
-						store.dispatch('handleMessageCount',data.data)
-					}
-				});
-				// 建立连接
-				wsManager.connect();
+                // console.log('yong---------------',this.userId);
+				// const wsManager = new WebSocketManager(this.userId);
+				// // 设置消息回调
+				// wsManager.onMessage(data => {
+				// 	console.log('app-接收到的消息:', data);
+				// 	// 处理消息逻辑
+				// 	if(data.type === 'msgUnreadCount'){
+				// 		store.dispatch('handleMessageCount',data.data)
+				// 	}
+				// });
+				// // 建立连接
+				// wsManager.connect();
             },
             immediate: true,
             deep: true

+ 2 - 140
components/Client/new_file.vue

@@ -65,145 +65,6 @@ const info = ref({
 })
 const selected = ref([])
 
-// 普通用户
-const serviceList1 = [{
-	icon: '/static/Tioimages/父母体检.png',
-	name: '老人生活',
-	key: 1,
-},
-{
-	icon: '/static/Tioimages/1 妇女儿童权益保护服务.png',
-	name: '孩子成长',
-	key: 2,
-},
-{
-	icon: '/static/Tioimages/临时帮手.png',
-	name: '临时帮手',
-	key: 3,
-},
-{
-	icon: '/static/Tioimages/家庭保洁.png',
-	name: '家庭保洁',
-	key: 4,
-},
-{
-	icon: '/static/Tioimages/家电维修.png',
-	name: '家电维护',
-	key: 5,
-},
-{
-	icon: '/static/Tioimages/专家服务.png',
-	name: '专家服务',
-	key: 6,
-},
-	// {
-	// 	icon: '/static/Tioimages/15-旅游服务-01.png',
-	// 	name: '旅游服务',
-	// 	key: 7,
-	// },
-	// {
-	// 	icon: '/static/Tioimages/交友.png',
-	// 	name: '交友专区',
-	// 	key: 8,
-	// },
-	// {
-	// 	icon: '/static/Tioimages/休闲娱乐.png',
-	// 	name: '娱乐专区',
-	// 	key: 9,
-	// },
-	// {
-	// 	icon: '/static/Tioimages/福利商城_购物车.png',
-	// 	name: '商城购物',
-	// 	key: 10,
-	// },
-	// {
-	// 	icon: '/static/Tioimages/本地生活.png',
-	// 	name: '本地生活',
-	// 	key: 11,
-	// },
-	// {
-	// 	icon: '/static/Tioimages/其他服务.png',
-	// 	name: '其他服务',
-	// 	key: 12,
-	// },
-]
-
-//志愿者
-const serviceList2 = [{
-	icon: '/static/Tioimages/父母体检.png',
-	name: '老人生活',
-	key: 1,
-},
-{
-	icon: '/static/Tioimages/1 妇女儿童权益保护服务.png',
-	name: '孩子成长',
-	key: 2,
-},
-{
-	icon: '/static/Tioimages/临时帮手.png',
-	name: '临时帮手',
-	key: 4,
-},
-{
-	icon: '/static/Tioimages/家庭保洁.png',
-	name: '家庭保洁',
-	key: 3,
-},
-{
-	icon: '/static/Tioimages/家电维修.png',
-	name: '家电维护',
-	key: 5,
-},
-{
-	icon: '/static/Tioimages/专家服务.png',
-	name: '专家服务',
-	key: 6,
-},
-// {
-// 	icon: '/static/Tioimages/15-旅游服务-01.png',
-// 	name: '旅游服务',
-// 	key: 7,
-// },
-// {
-// 	icon: '/static/Tioimages/交友.png',
-// 	name: '交友专区',
-// 	key: 8,
-// },
-// {
-// 	icon: '/static/Tioimages/休闲娱乐.png',
-// 	name: '娱乐专区',
-// 	key: 9,
-// },
-// {
-// 	icon: '/static/Tioimages/福利商城_购物车.png',
-// 	name: '商城购物',
-// 	key: 10,
-// },
-// {
-// 	icon: '/static/Tioimages/本地生活.png',
-// 	name: '本地生活',
-// 	key: 11,
-// },
-// {
-// 	icon: '/static/Tioimages/其他服务.png',
-// 	name: '其他服务',
-// 	key: 12,
-// },
-{
-	icon: '/static/serverImg/home/icon/icon8.png',
-	name: '排班管理',
-	key: 13
-},
-]
-
-// const serveiceList = computed(() => {
-// 	console.log('userType ____>', userType);
-
-// 	if (userType === 1) {
-// 		return serviceList1
-// 	}
-// 	return serviceList2
-// })
 const serveiceList = ref([]);
 
 
@@ -409,7 +270,8 @@ onMounted(() => {
 .paiban-sty {
 	display: flex;
 	align-items: center;
-	justify-content: center;
+	/* justify-content: center; */
 	margin: 20rpx 0;
+	padding: 0 20rpx;
 }
 </style>

+ 7 - 7
components/CustomTabBar/index.vue

@@ -4,13 +4,13 @@
             <view class="handleBox" v-for="(item) in tabBarList" :key="item.key + 'tab_bar'">
                 <view class="menuBox" @click="goPages(item)">
                     <view class="menuIcon">
-                        <view class="message-style" v-if="item.key === 'chat' && messageCount > 0">{{ messageCount }}
+                        <view class="message-style" v-if="item.key === 'chat' && messageCount > 0">{{  messageCount }}
                         </view>
                         <image v-if="item.key != selectIndex" class="img" :src="item.iconPath"></image>
                         <image v-else class="img" :src="item.selectedIconPath"></image>
                     </view>
                     <view class="menuName">
-                        <text :class="item.key == selectIndex ? 'TextColor' : 'Text'">{{ item.text }}</text>
+                        <text :class="item.key == selectIndex ? 'TextColor' : 'Text'">{{  item.text }}</text>
                     </view>
                 </view>
             </view>
@@ -67,11 +67,11 @@ export default {
                         key: 'class'
                     },
                     {
-                    "pagePath": "/pages/chat",
-                    "iconPath": "/static/images/tabbar/class.png",
-                    "selectedIconPath": "/static/images/tabbar/class_.png",
-                    "text": "消息",
-                    key: 'chat'
+                        "pagePath": "/pages/chat",
+                        "iconPath": "/static/images/tabbar/class.png",
+                        "selectedIconPath": "/static/images/tabbar/class_.png",
+                        "text": "消息",
+                        key: 'chat'
                     },
                     {
                         "pagePath": "/pages/classify",

+ 21 - 3
pages/chat.vue

@@ -9,8 +9,8 @@
                         <img src="/static/serverImg/mine/user.png" alt="" class="chat-img" v-else/>
                         <view class="chat-box">
                             <view class="chat-top">
-                                <text class="chat-name">{{ type?item.userName:item.volunteerName }}</text>
-                                <text class="chat-time">{{ item.createTime }}</text>
+                                <text class="chat-name">{{ item.msgType === '1'? '系统消息': type?item.userName:item.volunteerName }}</text>
+                                <text class="chat-time">{{ handlerData(item.newestMsgTime || item.createTime) }}</text>
                             </view>
                             <view class="chat-bottom">
                                 <text class="chat-text">
@@ -45,7 +45,7 @@ import { getAccountChangeList, getVolunteerChangeList } from "@/api/mine";
 import { onShow } from '@dcloudio/uni-app';
 import { useDict } from '@/utils/dict.js';
 import NoneView from '@/components/NoneView/index.vue'
-
+import dayjs from 'dayjs/esm/index'
 import { getList } from '@/api/conversation.js';
 
 const { } = useDict();
@@ -70,6 +70,24 @@ const pages = ref({
     pageSize: 10,
     total: 0,
 })
+const isToday = (date) => {
+  return dayjs(date).isSame(dayjs(), 'day');
+};
+
+const isYesterday = (date) => {
+  return dayjs(date).isSame(dayjs().subtract(1, 'day'), 'day');
+};
+const handlerData = (dates) => {
+    const date = dayjs(dates);
+    if (isToday(dates)) {
+    return date.format('HH:MM');;
+    } else if (isYesterday(dates)) {
+    return '昨天';
+    } else {
+    return date.format('YY/MM/DD'); // 或者其他格式如 'YYYY年MM月DD日'
+    }
+}
+
 const onClick = (record) => {
 	console.log("TCL: onClick -> record", record)
     uni.navigateTo({

+ 3 - 2
pages/index.vue

@@ -286,11 +286,12 @@ const addresstree = ref([]);
 onMounted(async () => {
 
 
-  const res_dara = await regionAddresstree()
-  addresstree.value = res_dara.data;
+ 
 
   const token  = getToken();
   if(token){
+    const res_dara = await regionAddresstree()
+    addresstree.value = res_dara.data;
     locateTheCurrentAddress(res_dara.data)
     .then((res) => {
       console.log('locateTheCurrentAddress', res)

+ 6 - 6
pages/mallMenu.vue

@@ -177,6 +177,12 @@ export default {
             const { id } = service;
             const key = id;
             if (this.userType == '2') {
+                // const parmas = { ...service, key,name:service.businessName,record };
+                // uni.navigateTo({
+                //     url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(parmas))}`
+                // })
+                // return;
+
                 const res = await getVolunteerInfo({
                     serviceCategory: key
                 });
@@ -189,12 +195,6 @@ export default {
                     })
                     return
                 }
-                // [1, 2] ? uni.navigateTo({
-                //     url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(parmas))}`
-                // }) : uni.showToast({
-                //     title: '敬请期待',
-                //     icon: 'none'
-                // })
                 uni.navigateTo({
                     url: `/pages_home/pages/register/index?data=${encodeURIComponent(JSON.stringify(parmas))}`
                 })

+ 5 - 4
pages/mine.vue

@@ -288,10 +288,11 @@ const handLsetTing = () => {
 
 
 const geUserInfo = () => {
-	console.log(store.state, '>>>>99');
-	store.dispatch('GetInfo').then((res) => {
-		userInfo.value = store.state.user
-	});
+	console.log(store.state.user, '>>>>99');
+	userInfo.value = store.state.user;
+	// store.dispatch('GetInfo').then((res) => {
+	// 	userInfo.value = store.state.user
+	// });
 }
 
 onShow(() => {

+ 5 - 1
pages_home/components/updata-imgs/index.vue

@@ -37,6 +37,10 @@ const props = defineProps({
         type: String,
         default: ''
 
+    },
+    fileCount: {
+        type: Number,
+        default: 1
     }
 });
 const emit = defineEmits(['onSubmit']);
@@ -50,7 +54,7 @@ const deletePic = (index) => {
     getFile();
 };
 const uploadClick = async (type) => {
-    const res = await wxUploadFile(type);
+    const res = await wxUploadFile(type,props.fileCount);
     fileList.value = [...fileList.value, ...res];
     getFile();
     console.log('xxxxres', res, fileList.value);

+ 1 - 1
pages_home/pages/details/index.vue

@@ -239,7 +239,7 @@ onLoad((options) => {
     console.log("option", option);
 
     uni.setNavigationBarTitle({
-        title: option.name + '详情'  // 根据业务逻辑调整 
+        title: option.businessName + '详情'  // 根据业务逻辑调整 
     });
 
     setTimeout(() => {

+ 8 - 5
pages_home/pages/register/index.vue

@@ -110,7 +110,7 @@
 
 
 		<view v-for="item in updata_list" :key="item.key" class="updata-imgs">
-			<UpdataImgs :fileList="file_url[item.key]" :data="item" ref="zsImg" @onSubmit="onChange" />
+			<UpdataImgs :fileList="file_url[item.key]" :data="item" :fileCount="item.fileCount" ref="zsImg" @onSubmit="onChange"  />
 		</view>
 
 
@@ -147,7 +147,8 @@ const updata_list = [
 		key: 'volunteerPicture',
 		ref: userImg,
 		// permission: [1, 2],
-		required: true
+		required: true,
+		fileCount:1
 	},
 	{
 		title: '个人身份证',
@@ -156,7 +157,8 @@ const updata_list = [
 		key: 'idCardPicture',
 		ref: zsImg,
 		// permission: [1, 2],
-		required: true
+		required: true,
+		fileCount:2
 	},
 	{
 		title: '职业、资质证书',
@@ -165,7 +167,8 @@ const updata_list = [
 		key: 'certificationPicture',
 		ref: zsImg,
 		// permission: [1, 2],
-		required: false
+		required: false,
+		fileCount:6
 	}
 ]
 
@@ -596,7 +599,7 @@ onLoad((options) => {
 	console.log("option", data.value);
 
 	uni.setNavigationBarTitle({
-		title: option.name  // 根据业务逻辑调整 
+		title: option.businessName  // 根据业务逻辑调整 
 	});
 
 	setTimeout(() => {

+ 1 - 1
pages_orderuser/pages/talk/pages/index/index.vue

@@ -9,7 +9,7 @@
 						<view v-for="(item, index) in talkList" :key="item.msgSendTime" :id="'msg-' + item.msgSendTime">
 							<view class="item flex-col" :class="item.senderId == this.userId ? 'push' : 'pull'">
 								<!-- <image :src="item.pic" mode="aspectFill" class="pic"></image> -->
-								<img v-if="item.senderId !== this.userId" :src="orderInfo.conversationAvatar" alt=""
+								<img v-if="item.senderId !== this.userId" :src="orderInfo.conversationAvatar || '/static/serverImg/mine/user.png' " alt=""
 									class="pic" mode="aspectFill" />
 								<img src="/static/serverImg/mine/user.png" alt="" class="pic" mode="aspectFill"
 									v-else />

BIN
static/Tioimages/1 妇女儿童权益保护服务.png


BIN
static/Tioimages/15-旅游服务-01.png


BIN
static/Tioimages/1v专业指导.png


BIN
static/Tioimages/专家服务.png


BIN
static/Tioimages/临时帮手.png


BIN
static/Tioimages/交友.png


BIN
static/Tioimages/休闲娱乐.png


BIN
static/Tioimages/健康管理.png


BIN
static/Tioimages/其他服务.png


BIN
static/Tioimages/发起维修.png


BIN
static/Tioimages/家庭保洁.png


BIN
static/Tioimages/家电维修.png


BIN
static/Tioimages/本地生活.png


BIN
static/Tioimages/父母体检.png


BIN
static/Tioimages/福利商城_购物车.png


+ 18 - 2
store/modules/user.ts

@@ -5,7 +5,7 @@ import { login, logout, getInfo } from '@/api/login'
 import { getToken, setToken, removeToken } from '@/utils/auth'
 import { UserState, UserForm } from '@/types/store'
 import { Module } from 'vuex'
-
+import WebSocketManager from '@/utils/WebSocketManager.js';
 const baseUrl = config.baseUrl
 
 const user: Module<UserState, UserState> = {
@@ -17,7 +17,7 @@ const user: Module<UserState, UserState> = {
     permissions: storage.get(constant.permissions),
 	  userOrWorker: storage.get(constant.userOrWorker),
     nickName:  storage.get(constant.nickName),
-    userId: null,
+    userId: storage.get(constant.userId),
     messageCount:0
   },
   mutations: {
@@ -98,6 +98,22 @@ const user: Module<UserState, UserState> = {
           commit('SET_AVATAR', avatar)
           commit('SET_NICKNAME', res.user.nickName)
           commit('SET_USERID', res.user.userId)
+
+
+
+          //获取账户时,连接soket 
+          const wsManager = new WebSocketManager(res.user.userId);
+            // 设置消息回调
+            wsManager.onMessage(data => {
+              console.log('app-接收到的消息:', data);
+              // 处理消息逻辑
+              if(data.type === 'msgUnreadCount'){
+                commit('SET_MESSAGECOUNT', data.data);
+              }
+            });
+            // 建立连接
+            wsManager.connect();
+
           resolve(res)
         }).catch(error => {
           reject(error)

+ 3 - 1
types/store.ts

@@ -5,7 +5,9 @@ export interface UserState {
     avatar: string,
     roles: Array<string>
     permissions: Array<string>
-	userOrWorker: any
+	userOrWorker: any,
+    userId:any,
+    nickName:any
 }
 
 export interface UserForm {

+ 5 - 3
utils/WebSocketManager.js

@@ -1,11 +1,13 @@
-
+import config from '@/config'
+const baseUrl = config.baseUrl
 class WebSocketManager {
     constructor(userId) {
         // 1用户 2志愿者
         this.system = uni.getStorageSync('userType') === 1 ? '1' : '2';
         this.userId = userId;
-        this.url = `ws://192.168.100.127:9527/websocket/${this.system}/${this.userId}`;
-        // this.url = `ws://192.168.100.127:9527/websocket/${this.system}/109`;
+        const url = baseUrl.split('/')[2];
+		console.log("TCL: WebSocketManager -> constructor -> url", url)
+        this.url = `ws://${url}/websocket/${this.system}/${this.userId}`;
 
         this.socketTask = null;
         this.heartbeatInterval = null;

+ 3 - 1
utils/storage.ts

@@ -9,7 +9,9 @@ let storageNodeKeys = [
 	constant.name, 
 	constant.roles,
 	constant.permissions,
-	constant.userOrWorker
+	constant.userOrWorker,
+  constant.nickName,
+  constant.userId
 ]
 
 // 存储的数据