Răsfoiți Sursa

mingsu page

邹能昇 1 săptămână în urmă
părinte
comite
4b8b8721c4
1 a modificat fișierele cu 23 adăugiri și 2 ștergeri
  1. 23 2
      nova-tourism/pages/homestay/homestay-detail/index.js

+ 23 - 2
nova-tourism/pages/homestay/homestay-detail/index.js

@@ -14,7 +14,7 @@ Page({
         bottomNavHeight: 0, // 底部导航栏高度
         contentHeight: 0, // 可用内容高度
         //  轮播图数组
-        imageUrls: ['https://tse4-mm.cn.bing.net/th/id/OIP-C.3r1vguZyWFUJ80A2Nf2k3AHaEK?rs=1&pid=ImgDetMain', 'https://ts1.cn.mm.bing.net/th/id/R-C.9881613a29f26488b40938427aa585e4?rik=fim4XvDejjHE%2fQ&riu=http%3a%2f%2fn.sinaimg.cn%2fsinakd20220516ac%2f797%2fw2048h1149%2f20220516%2fb0aa-5aca29fe2dfa69c385118bbc74d039de.jpg&ehk=tzq%2bJP6uMipI0aIHY3bMSVO7lS7ZQM6TKMlwZ5CFP4s%3d&risl=&pid=ImgRaw&r=0', 'https://pic3.zhimg.com/v2-5fb13110e1de13d4c11e6e7f5b8026da_r.jpg', 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/02/04/ChMkJ1bKyEyIMaKUAAhskHwWGqUAALIAAM2KsIACGyo249.jpg'],
+        imageUrls: [],
         index: 1,
         //
         decodedDateStart: '',
@@ -78,6 +78,7 @@ Page({
         console.log('istoday',this.data.istoday);
         this.gethomestay()
         this.getroom()
+        this.getpic()
     },
 
     /**
@@ -177,5 +178,25 @@ Page({
             roomList
         })
         console.log('房间', this.data.roomList);
-    }
+    },
+    //获取轮播图
+    async getpic() {
+        let Banner = new Parse.Query('Banner');
+        Banner.equalTo('company', company);
+        Banner.equalTo('store', this.data.objectId);
+        Banner.equalTo('isEnabled', 'true');
+        Banner.notEqualTo('isDeleted', 'true');
+        Banner.select('image');
+    
+        let Banner2 = await Banner.find();
+        
+        // 提取 image 属性并存储到 imageUrls 中
+        let imageUrls = Banner2.map(item => item.get('image')); // 使用 get() 方法获取 image 属性
+    
+        this.setData({
+            imageUrls // 将提取的 imageUrls 存储到组件状态中
+        });
+    
+        console.log(this.data.imageUrls); // 输出 imageUrls
+    },
 })