Răsfoiți Sursa

Merge remote-tracking branch 'origin/v3' into v3

wukai 2 ani în urmă
părinte
comite
1b16e8032f

BIN
src/assets/images/issystem.png


BIN
src/assets/images/system.png


+ 30 - 21
src/components/forwordTree/index.vue

@@ -21,7 +21,7 @@
         </div>
         <el-tree-v2
           ref="treeRef"
-          :data="treeData.data"
+          :data="treeData"
           :highlight-current="true"
           :default-expanded-keys="[spaceId]"
           :show-checkbox="false"
@@ -62,7 +62,16 @@
   </el-dialog>
 </template>
     <script setup>
-import { reactive, ref, toRaw, toRefs, watch, nextTick, onMounted } from "vue";
+import {
+  reactive,
+  ref,
+  toRaw,
+  toRefs,
+  watch,
+  nextTick,
+  onMounted,
+  getCurrentInstance,
+} from "vue";
 import { ElMessage } from "element-plus";
 import fileImg from "@/assets/images/file-img.png";
 import direction from "@/assets/images/direction.png";
@@ -95,28 +104,27 @@ const dirName = ref(""); //新建文件夹名称
 const dirBulidNow = ref(false);
 const treeRef = ref(null);
 const isOpen = ref(props.openForwardFile);
+const instance = getCurrentInstance();
 watch(
   () => props.openForwardFile,
   (newValue) => {
     isOpen.value = newValue;
   }
 );
-const treeData = reactive({ data: [] });
+const treeData = ref([]);
 const defaultExpandedKeys = ref([]);
 watchEffect(() => {
-  treeData.data[0] = props.forwardTreeData;
-//   //默认展开第二级
-//   treeData.data.forEach((node) => {
-//     if (node.children) {
-//       // 如果节点有子节点
-//       const childKeys = node.children.map((child) => child.id); // 获取子节点的 key 数组
-//       defaultExpandedKeys.value= [... defaultExpandedKeys.value, ...childKeys]; // 将子节点的 key 数组合并到 defaultExpandedKeys 中
-//     }
-//   });
-});
-watchEffect(() => {
-  console.log("props.docId", props.docId);
+  treeData.value =[ props.forwardTreeData];
+  //   //默认展开第二级
+  //   treeData.data.forEach((node) => {
+  //     if (node.children) {
+  //       // 如果节点有子节点
+  //       const childKeys = node.children.map((child) => child.id); // 获取子节点的 key 数组
+  //       defaultExpandedKeys.value= [... defaultExpandedKeys.value, ...childKeys]; // 将子节点的 key 数组合并到 defaultExpandedKeys 中
+  //     }
+  //   });
 });
+
 //树
 const clickData = ref({});
 const handleNodeClick = (data) => {
@@ -145,6 +153,11 @@ const buildFile = async () => {
   }
   dirBulidNow.value = true;
 };
+const newTree = async () => {
+    //重新获取树结构
+    const resDir = await dirTree(3);
+    treeData.value=[resDir]
+  };
 //确认新建目录--点击勾选
 const sureDir = async () => {
   const dirRes = await builtDir({
@@ -152,17 +165,13 @@ const sureDir = async () => {
     spaceId: props.spaceId,
     parentId: clickData.value.id,
   });
-  if (dirRes.code === 200) {
+  if (dirRes.code == 200) {
     ElMessage({ message: "创建成功", type: "success" });
     dirBulidNow.value = false;
     clickId.value = "";
     dirName.value = "";
-    //重新获取树结构
-    const resDir = await dirTree(3);
-    treeData.data[0] = resDir;
-    // treeRef.value.setCurrentKey(clickData.value.id)
+    newTree();
   }
-
 };
 </script>
   <style lang="scss" scoped>

+ 8 - 0
src/layout/indexCommon.vue

@@ -91,6 +91,8 @@ import zuijin from "@/assets/images/zuijin.png";
 import bezuijin from "@/assets/images/bezuijin.png";
 import colloect from "@/assets/images/colloect.png";
 import becolloect from "@/assets/images/becolloect.png";
+import system from "@/assets/images/system.png";
+import issystem from "@/assets/images/issystem.png";
 import my from "@/assets/images/my.png";
 import bemy from "@/assets/images/bemy.png";
 import bumen from "@/assets/images/bumen.png";
@@ -253,6 +255,12 @@ const menuList = reactive({
       imgs: chuanshu,
       beimgs: bechuanshu,
     },
+    {
+      label: "系统管理",
+      path: "/admin",
+      imgs: system,
+      beimgs: issystem,
+    },
   ],
 });
 

+ 16 - 1
src/router/index.js

@@ -67,7 +67,7 @@ export const constantRoutes = [{
 				component: () => import('@/views/liveChat/index.vue'),
 				name: 'index',
 				meta: {
-					title: '首页',
+					title: '返回',
 					icon: 'dashboard',
 					affix: true
 				}
@@ -149,6 +149,21 @@ export const constantRoutes = [{
 				component: () => import("@/views/highSearch/SupplierAllBack.vue"),
 				name: "allback",
 				meta: { title: "kongbaiye", icon: "department" }
+			  },{
+				path: "/admin",
+				component: Layout,
+				redirect: '/admin/index',
+				children: [{
+					path: 'index',
+					// component: () => import('@/layout/index.vue'),
+					name: 'adminIndex',
+					meta: {
+						title: '首页',
+						icon: 'dashboard',
+						affix: true
+					},
+	
+				},]
 			  }
 		]
 	},

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

@@ -19,7 +19,7 @@ const useWebsoctStore = defineStore('websoct', {
       this.socket = new WebSocket(`${window.location.origin.replace("http", "ws")}/websocket/message/${useUserStore().uid}`);
       }
       this.socket.addEventListener("open", () => {
-        console.log("WebSocket连接已打开")
+        // console.log("WebSocket连接已打开")
       })
 
       this.socket.addEventListener("message", (event) => {
@@ -31,7 +31,8 @@ const useWebsoctStore = defineStore('websoct', {
       })
 
       this.socket.addEventListener("close", () => {
-        console.log("WebSocket连接已关闭")
+        // console.log("WebSocket连接已关闭")
+        ElMessage({ message: "WebSocket连接已关闭", type: "error" });
       })
 
       this.socket.addEventListener("error", (error) => {

+ 28 - 8
src/views/liveChat/index.vue

@@ -5,6 +5,7 @@ export default {
 </script>
 <script setup>
 import { ref, reactive, toRaw, toRefs } from "vue";
+import { useRouter, useRoute } from "vue-router";
 import useUserStore from "@/store/modules/user";
 import word from "@/assets/images/word2.png";
 import chat from "@/assets/images/profile.jpg";
@@ -21,6 +22,8 @@ import forwordTree from "@/components/forwordTree/index.vue"; //选择文件发
 //websocket连接====
 import useWebsoctStore from "@/store/modules/websocket";
 import { ElMessage } from "element-plus";
+const route = useRoute();
+console.log('route===', route)
 const websoctStore = useWebsoctStore();
 //====
 const { proxy } = getCurrentInstance();
@@ -33,7 +36,9 @@ const sendId = ref(""); //选择发送的文件id
 const isForward = ref(false);
 const openFile = ref(false); //文件目录
 const openForwardFile = ref(false); //转发目录
+const showCircel=ref('')  //是否 显示圆点
 const chatRecords = reactive({ data: [] });
+const loading = ref(false)
 const sendCont = reactive({
   //发送聊天内容数据组装
   data: {
@@ -198,7 +203,8 @@ const noMes = ref(false);
 const handleScroll = (event) => {
   // 在滚动到顶部时,加载上一页的聊天记录
   const mainContainer = document.querySelector(".right-container");
-  if (event.deltaY < 0 && mainContainer.scrollTop <= 1) {
+  if (event.deltaY < 0 && mainContainer.scrollTop <= 1&&!noMes.value) {
+    loading.value=true
     loadPreviousPage();
   }
 };
@@ -209,10 +215,12 @@ const loadPreviousPage = async () => {
     pageSize: 10,
   };
   const resMsgData = await msgRecord(sendCont.data.toId, queryParams);
+  loading.value=false
   const previousPageData = resMsgData.rows.reverse();
   if (currentPageNum * 10 >= resMsgData.total && !noMes.value) {
-    noMes.value = true;
-    return ElMessage("无更多聊天记录");
+    return noMes.value = true;
+
+    // return ElMessage("无更多聊天记录");
   }
   // 将加载的上一页聊天记录插入到 chatRecords.data 的前面
   chatRecords.data = [...previousPageData, ...chatRecords.data];
@@ -238,7 +246,6 @@ const forwardClick = async (indexs,docIds) => {
   //获取最上层树的id
   const topSpaceid = await spaceInfo(3);
   spaceId.value = topSpaceid.data.spaceId.toString();
-  console.log("topSpaceid", topSpaceid);
   openForwardFile.value = true;
 };
 const forwardChangeMsg = async (val) => {};
@@ -246,7 +253,6 @@ const forwardChangeMsg = async (val) => {};
 const downClick =async (fileId) => {
   // location.href=await fileDownload(fileId)
    location.href=`${import.meta.env.VITE_APP_BASE_API}/api/download/${fileId}`;
-   console.log('downRes===', downRes)
 }
 // 滚动翻页========
 onMounted(() => {
@@ -271,8 +277,7 @@ onMounted(() => {
           @change="SearchChat"
         />
         <!-- 添加聊天人员 -->
-        <el-icon size="24" color="#505870" @click="clickNewPerson"
-          ><Plus
+        <el-icon size="24" color="#505870" @click="clickNewPerson" style=" margin-right: 8px;"><Plus
         /></el-icon>
         <!-- 新建聊天弹框 -->
         <Addperson
@@ -313,9 +318,10 @@ onMounted(() => {
               : item.toName
           }}</span
           ><span class="person-cont spill">
-            {{ item.cont ? item.cont : item.content }}</span
+            {{ item.file?.fileName ? item.file?.fileName : item.content }}</span
           >
         </div>
+        <!-- <span class="yuandian" v-if="showCircel==item.fromId&&$route.path=='/index'"></span> -->
       </div>
     </div>
     <!-- 右侧聊天 -->
@@ -334,6 +340,8 @@ onMounted(() => {
             @mousewheel="handleScroll"
             ref="mainContainer"
           >
+            <div  v-loading="loading"></div>
+            <!-- <div v-if="noMes" style="color:#9fa1a5 ;">无更多聊天记录</div> -->
             <div
               class="message-container"
               v-for="(record, index) in chatRecords.data"
@@ -454,4 +462,16 @@ onMounted(() => {
 
 <style lang="scss" scoped>
 @import "@/assets/styles/my-common.scss";
+.left-container{
+  position: relative;
+}
+.yuandian{
+  width: 8px;
+  height: 8px;
+  position: absolute;
+  right: 8px;
+  top: 6px;
+  background: #FA5151;
+  border-radius: 4px;
+}
 </style>

+ 2 - 2
vite.config.js

@@ -47,8 +47,8 @@ export default defineConfig(({
 				},
 				//websocket代理
 				'/websocket': {				
-					target:'ws://8.142.173.95:19527/websocket',
-					// target:'ws://192.168.1.18:8080/websocket',
+					// target:'ws://8.142.173.95:19527/websocket',
+					target:'ws://192.168.1.28:8080/websocket',
 					changeOrigin: true,
 					rewrite: (p) => p.replace(/^\/websocket/, '')
 				}