Prechádzať zdrojové kódy

Merge branch 'master' of http://www.sysuimars.cn:3000/feiniao/feiniao-farm-h5

lxf 3 dní pred
rodič
commit
ff07b5399a

+ 4 - 0
src/api/modules/monitor.js

@@ -8,5 +8,9 @@ module.exports = {
     broadcastPage: {
         url: config.base_dev_url + "farm_broadcast/page/{limit}/{page}",
         type: "get",
+    },
+    farmWorkPlan: {
+        url: config.base_dev_url + "container_space_time/farmWorkPlan",
+        type: "get",
     }
 }

BIN
src/assets/img/monitor/arrow.png


BIN
src/assets/img/monitor/defalut-arrow.png


+ 9 - 13
src/components/chatWindow.vue

@@ -164,7 +164,7 @@
 </template>
 
 <script setup>
-import { ref, onMounted, onUnmounted, nextTick, watch, onActivated, onDeactivated } from "vue";
+import { ref, onUnmounted, nextTick, watch, onActivated, onDeactivated } from "vue";
 import { useRouter } from "vue-router";
 import { base_img_url2 } from "@/api/config";
 import { getFileExt } from "@/utils/util";
@@ -223,7 +223,7 @@ const createSession = (targetUserId,callback) =>{
     // 先保存当前的对话样式消息  要注释
     const dialogMessages = messages.value.filter(msg => msg.messageType === 'dialog');
     
-    VE_API.bbs.createSession({farmId:766,targetUserId}).then(({data,code}) => {
+    VE_API.bbs.createSession({farmId:farmVal.value,targetUserId}).then(({data,code}) => {
         if(code === 0){
             senderIcon.value = localUserInfoIcon
             receiverIcon.value = data.session.targetUserAvatar
@@ -269,7 +269,7 @@ const createSession = (targetUserId,callback) =>{
 //类型 text ,file,image
 const sendMsg = (messageType = 'text',content = '',image = {}) =>{
     const params = {
-        farmId:766,
+        farmId:farmVal.value,
         senderId:curUserId,
         receiverId:userId.value,
         content,
@@ -281,8 +281,9 @@ const sendMsg = (messageType = 'text',content = '',image = {}) =>{
 
 const userId = ref(null)
 
-watch(()=>props.userId,(newValue) =>{
+watch(()=>props.userId, async (newValue) =>{
     if(newValue){
+        await getFarmList();
         userId.value = newValue
         createSession(newValue,()=>{
             if(props.text){
@@ -346,7 +347,7 @@ const previewImage = ref(null);
 
 // 初始化 mqtt
 const initMqtt = () => {
-    const topics = [`user/chat/message/${766}/${curUserId}`]; // 订阅的主题数组
+    const topics = [`user/chat/message/${farmVal.value}/${curUserId}`]; // 订阅的主题数组
     mqttClient.value = new MqttClient(topics, (topic, message) => {
         console.log(topic,'topic')
         console.log('接收推送信息:', message);
@@ -579,20 +580,15 @@ const options = ref([])
 
 // 获取农场列表
 function getFarmList() {
-    VE_API.farm.userFarmSelectOption().then(({data}) => {
+    return VE_API.farm.userFarmSelectOption().then(({data}) => {
         options.value = data || []
         if (data && data.length > 0) {
-            farmVal.value = data[0].id
+            const defaultOption = data.find(item => item.defaultOption === true)
+            farmVal.value = defaultOption ? defaultOption.id : data[0].id
         }
     })
 }
 
-// 生命周期钩子
-onMounted(() => {
-    // scrollToBottom();
-    getFarmList();
-});
-
 onActivated(()=>{
     if(props.userId){
        scrollToBottom();

+ 6 - 2
src/views/old_mini/home/index.vue

@@ -84,7 +84,7 @@ const monitorCards = ref({
         {
             title: "专家咨询",
             content: "专业农技专家在线解答疑问",
-            route: "/chat_frame?userId=91754&name=专家1",
+            route: "/chat_frame",
         },
     ],
 });
@@ -105,7 +105,11 @@ const handleCardClick = (card) => {
             url: `/pages/subPages/new_recognize/index?gardenData=${JSON.stringify(dropdownGardenItem.value)}`,
         });
     }else{
-        router.push(card.route);
+        if(card.route === "/chat_frame"){
+            router.push(`/chat_frame?userId=91754&name=专家1`);
+        }else{
+            router.push(card.route);
+        }
     }
 };
 

+ 7 - 0
src/views/old_mini/monitor/index.vue

@@ -193,6 +193,13 @@ const onLoad = () => {
 };
 // 卡片点击事件
 const handleCardClick = (card) => {
+    if (card.route === "/plan") {
+        router.push({
+            path: card.route,
+            query: { farmId: gardenId.value },
+        });
+        return;
+    }
     router.push(card.route);
 };
 

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 698 - 259
src/views/old_mini/monitor/subPages/plan.vue


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov