“yueshang” 1 سال پیش
والد
کامیت
d5b4397d06
5فایلهای تغییر یافته به همراه53 افزوده شده و 39 حذف شده
  1. 4 12
      src/layout/indexCommon.vue
  2. 24 15
      src/router/index.js
  3. 2 2
      src/store/modules/websocket.js
  4. 9 5
      src/views/liveChat/index.vue
  5. 14 5
      src/views/system/user/profile/index.vue

+ 4 - 12
src/layout/indexCommon.vue

@@ -27,9 +27,9 @@
               </div>
               <template #dropdown>
                 <el-dropdown-menu>
-                  <!-- <router-link to="/user/profile">
+                  <router-link to="/user/profile">
                     <el-dropdown-item>个人中心</el-dropdown-item>
-                  </router-link> -->
+                  </router-link>
                   <el-dropdown-item divided command="logout">
                     <span>退出登录</span>
                   </el-dropdown-item>
@@ -76,7 +76,7 @@
                 <template #label>
                   <div class="tab_pane" @click="paneClick(item)">
                     <div class="tab_text">{{ item.label }}</div>
-                    <img v-if="item.label != '首页' && item.label != '个人中心'" src="@/assets/images/close.png" @click="closeTab(item, index, $event)"
+                    <img v-if="item.label != '首页'" src="@/assets/images/close.png" @click="closeTab(item, index, $event)"
                       alt="" />
                   </div>
                   <!-- <router-link
@@ -251,8 +251,7 @@ const iFrameData = ref(JSON.parse(sessionStorage.getItem('fileTabData')) || [
 let tabIndex = 2;
 const editableTabsValue = ref(JSON.parse(sessionStorage.getItem('editableTabsValue')) || "/index");
 // const editableTabsValue = ref("/index");
-// const editableTabs = ref(JSON.parse(sessionStorage.getItem('tabData')) || [{ label: '首页', path: '/reindex' },{ label: '个人中心', path: '/user/profile' }]);
-const editableTabs = ref([{ label: '首页', path: '/reindex' },{ label: '个人中心', path: '/user/profile' }]);
+const editableTabs = ref(JSON.parse(sessionStorage.getItem('tabData')) || [{ label: '首页', path: '/reindex' }]);
 
 // const removeTab = (targetName) => {
 //   const tabs = editableTabs.value;
@@ -499,7 +498,6 @@ const clickPath = (index, items) => {
   // editableTabs.value = arr;
   isSwitchFileIframe.value = false
   const arr = toRaw(editableTabs.value);
-  console.log('editableTabs.value', editableTabs.value)
   if (!arr.some((item) => item.label == items.label)) {
     editableTabs.value.push({
       label: items.label,
@@ -517,7 +515,6 @@ const clickPath = (index, items) => {
 const clickTab = (item) => {
   let url = toRaw(item)
   setTimeout(() => {
-    console.log("toFileData.value", toFileData.value);
     if (toFileData.value) {
       localStorage.setItem("inChat", 0)
       // 去全文搜索单独判断
@@ -525,7 +522,6 @@ const clickTab = (item) => {
         // console.log("clickRowId.value", JSON.stringify(toRaw(toFileData.value).clickRowId));
         editableTabsValue.value = toFileData.value.path
         isAlive.value = true
-        console.log('route', route.path);
         // 如果当前已经在search就跳到中转页面
         if (route.path == "/search") {
           router.push({
@@ -552,7 +548,6 @@ const clickTab = (item) => {
         // console.log("clickRowId.value", JSON.stringify(toRaw(toFileData.value).clickRowId));
         editableTabsValue.value = toFileData.value.path
         isAlive.value = true
-        console.log('route', route.path);
           router.push({
             name: toFileData.value.path,
             state: {
@@ -576,7 +571,6 @@ const clickTab = (item) => {
     let regExp = new RegExp(/^\//);
     if (!regExp.test(url)) {
       const data = JSON.parse(url);
-      console.log("data", data);
       router.push({
         // path: "/fileEdit" + data.docId,
         path: "/fileEdit",
@@ -596,7 +590,6 @@ const clickTab = (item) => {
 };
 const paneClick = (item) => {
   // 可以拿到当前的标签对象
-  console.log(item, 'pane');
   isAlive.value = true;
   isSwitchFileIframe.value = false
   // console.log("paneItem", item);
@@ -611,7 +604,6 @@ const paneClick = (item) => {
 // 点击文件标签
 const filePaneClick = (item) => {
   localStorage.setItem("inChat", 0)
-  console.log("filePaneClickitem", item);
   isSwitchFileIframe.value = true
   const row = toRaw(item);
   const arr = iFrameData.value.map((par) => {

+ 24 - 15
src/router/index.js

@@ -88,6 +88,15 @@ export const constantRoutes = [{
 		},
 	},
 	{
+	    path: '/user/profile',
+	    component: () => import('@/views/system/user/profile/index'),
+	    name: 'Profile',
+	    meta: {
+	    	title: '个人中心',
+	    	icon: 'user'
+	    }
+	},
+	{
 		path: 'reindex',
 		component: () => import('@/views/liveChat/index.vue'),
 		name: 'reindex',
@@ -364,21 +373,21 @@ export const constantRoutes = [{
 //   ]
 // },
 
-{
-	path: '/user',
-	component: Layout,
-	hidden: true,
-	redirect: 'noredirect',
-	children: [{
-		path: 'profile',
-		component: () => import('@/views/system/user/profile/index'),
-		name: 'Profile',
-		meta: {
-			title: '个人中心',
-			icon: 'user'
-		}
-	},]
-},
+// {
+// 	path: '/user',
+// 	component: Layout,
+// 	hidden: true,
+// 	redirect: 'noredirect',
+// 	children: [{
+// 		path: 'profile',
+// 		component: () => import('@/views/system/user/profile/index'),
+// 		name: 'Profile',
+// 		meta: {
+// 			title: '个人中心',
+// 			icon: 'user'
+// 		}
+// 	},]
+// },
 	// {
 	//   path: '/indexCommons',
 	//   hidden: true,

+ 2 - 2
src/store/modules/websocket.js

@@ -33,7 +33,7 @@ const useWebsoctStore = defineStore('websoct', {
       })
 
       this.socket.addEventListener("message", (event) => {
-        console.log('event发送消息', event)
+        // console.log('event发送消息', event)
         const message=event.data!='连接成功'?JSON.parse(JSON.stringify(event.data)):''
         if(message=='') return;
         this.messOne=event.data!='连接成功'?JSON.parse(event.data):{}
@@ -58,7 +58,7 @@ const useWebsoctStore = defineStore('websoct', {
       })
     },
     sendMessage(message) {
-      if(this.lastSendTime>0 && (new Date().getTime()- this.lastSendTime)<1000){
+      if(this.lastSendTime>0 && (new Date().getTime()- this.lastSendTime)<500){
         return new Promise((resolve, reject) => {
             ElMessage({ message: "消息发送频率太快", type: "error" });
             reject('发送频率太快')

+ 9 - 5
src/views/liveChat/index.vue

@@ -137,8 +137,9 @@ const msgRecordEvent = async (toIdValue) => {
   resMsgData.rows.map((i) => (i.isForward = false));
   chatRecords.data = resMsgData.rows.reverse();
   const PageNum = Math.ceil(chatRecords.data.length / 10) + 1;
-  if (PageNum * 10 >= resMsgData.total && !noMes.value) {
+  if (PageNum * 10 > resMsgData.total && !noMes.value) {
     loading.value = false;
+    console.log('333333333', PageNum * 10,resMsgData.total)
     noMes.value = false;
   }
   const nowtime = parseTime(new Date().getTime(), "{y}-{m}-{d}");
@@ -350,13 +351,14 @@ const handleNewMessage = async () => {
 watchEffect(async() => {
   let newMessages = {}
   newMessages = websoctStore.messOne  
-  console.log("===============有新消息了:",newMessages)
+  // console.log("===============有新消息了:",newMessages)
   if(router.currentRoute.value.path!='/index' || newMessages.fromId==null) return;
   //此处判断messOne是否已发生更改,如果还未发生更改则清除该消息
   if(websoctStore.messOne.fromId==newMessages.fromId){    
+    noMes.value = false;
     websoctStore.messOne={}
   }
-  console.log("clickPersonId:",clickPersonId.value)
+  // console.log("clickPersonId:",clickPersonId.value)
   if(getchatUserState){
     //会话列表还处理完成,临时缓存消息
     tmpMsgList.value.push(newMessages)
@@ -393,6 +395,7 @@ const mainContainer = ref(null);
 const handleScroll = (event) => {
   // 在滚动到顶部时,加载上一页的聊天记录
   const mainContainer2 = document.querySelector(".right-container");
+  console.log('event.deltaY', event.deltaY,mainContainer2.scrollTop,noMes.value,loading.value)
   if (
     event.deltaY < 0 &&
     mainContainer2.scrollTop <= 1 &&
@@ -418,7 +421,8 @@ const loadPreviousPage = async () => {
       i.createTime = i.createTime.substring(11);
   });
   noMes.value = false;
-  if (currentPageNum * 10 >= resMsgData.total && !noMes.value) {
+  if (currentPageNum * 10 > resMsgData.total && !noMes.value) {
+    console.log('333333333', 2222)
     loading.value = false;
     noMes.value = true;
     return;
@@ -511,7 +515,7 @@ const formatText = (text) => {
       })
   };
 const headError=(ind,item)=>{
-  console.log("头像加载失败:",ind)
+  // console.log("头像加载失败:",ind)
   // item.fromAvatar=item.toAvatar=item.avatar=null;
 };
 // 滚动翻页========

+ 14 - 5
src/views/system/user/profile/index.vue

@@ -1,5 +1,5 @@
 <template>
-   <div class="app-container">
+   <div class="app-container"  :style="'height:' + height">
       <div class="main">
          <div class="right-main">
             <el-card class="box-card">
@@ -69,7 +69,8 @@ import userAvatar from "./userAvatar";
 import userInfo from "./userInfo";
 import resetPwd from "./resetPwd";
 import { getUserProfile } from "@/api/system/user";
-
+import { onMounted } from "vue";
+let height = ref(document.documentElement.clientHeight - 16 + "px;");
 const activeTab = ref("userinfo");
 const state = reactive({
   user: {},
@@ -86,12 +87,14 @@ function getUser() {
 };
 
 getUser();
+onMounted(() => {
+   height.value = document.documentElement.clientHeight - document.getElementsByClassName("tab_box")[0].offsetHeight-8-document.getElementsByClassName("nav")[0].offsetHeight -26 + "px";
+})
 </script>
 <style lang="scss" scoped>
 
 .app-container {
-    padding: 20px;
-    height: 89vh; /* 设置高度为视口的100% */
+    padding: 0;
     display: flex;
     flex-direction: column;
   }
@@ -99,12 +102,18 @@ getUser();
    display: flex;justify-content: space-around;height: 100%;
   }
   .right-main{
-   width: 36%;margin-right: 16px;height: 100%;
+   width: 30%;
+   margin-right: 6px;
+   height: 100%;
    border: 1px solid #C1CCE3;
+   border-radius: 8px;
+   background: #fff;
   }
   .left-main{
    flex: 1;height: 100%;
    border: 1px solid #C1CCE3;
+   border-radius: 8px;
+   background: #fff;
   }
   :deep(.el-card){
    border: none !important;