Pārlūkot izejas kodu

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

lxf 3 nedēļas atpakaļ
vecāks
revīzija
7449243b08

+ 21 - 7
src/components/chatWindow.vue

@@ -689,17 +689,31 @@ const route = useRoute();
 
 // 获取农场列表
 function getFarmList() {
-    return VE_API.farm.userFarmSelectOption({ agriculturalQuery: curRole.value == 2 ? true : false }).then(({ data }) => {
-        options.value = data || [];
-        if (data && data.length > 0) {
-            const defaultOption = data.find((item) => item.defaultOption === true);
+    if(curRole.value == 2) {
+        return VE_API.user.userList().then(({ data }) => {
+            options.value = data.map(item => ({
+                id: item.farmId,
+                name: item.farmName,
+            }));
             if(route.query.farmId) {
                 farmVal.value = Number(route.query.farmId);
             }else{
-                farmVal.value = defaultOption ? defaultOption.id : data[0].id;
+                farmVal.value = data[0].farmId;
             }
-        }
-    });
+        });
+    }else{
+        return VE_API.farm.userFarmSelectOption({ agriculturalQuery: false }).then(({ data }) => {
+            options.value = data || [];
+            if (data && data.length > 0) {
+                const defaultOption = data.find((item) => item.defaultOption === true);
+                if(route.query.farmId) {
+                    farmVal.value = Number(route.query.farmId);
+                }else{
+                    farmVal.value = defaultOption ? defaultOption.id : data[0].id;
+                }
+            }
+        });
+    }
 }
 
 const curRole = ref(null);

+ 1 - 1
src/views/old_mini/chat_frame/index.vue

@@ -15,7 +15,7 @@ import eventBus from "@/api/eventBus";
 const route = useRoute();
 const router = useRouter();
 const desc = ref("");
-const nameVal = ref("韦帮稳 (15913130869)");
+const nameVal = ref("");
 const userIdVal = ref(null);
 const imgVal = ref("");
 onActivated(() => {

+ 2 - 2
src/views/old_mini/mine/pages/serviceDetail.vue

@@ -111,8 +111,8 @@ const handleClick = (section) => {
 };
 
 const handleChatFarm = () => {
-    if(farmDetail.value.receiveUserId != 'null'){
-        router.push(`/chat_frame?userId=${farmDetail.value.receiveUserId}&farmId=${farmIdVal.value}`);
+    if(farmDetail.value.farmersMiniUserId != null){
+        router.push(`/chat_frame?userId=${farmDetail.value.farmersMiniUserId}&farmId=${farmIdVal.value}`);
     }else{
         ElMessage.warning('尚未绑定用户,暂时无法沟通');
     }