|
|
@@ -1,24 +1,71 @@
|
|
|
-import { View } from "@tarojs/components";
|
|
|
+import { View, Image } from "@tarojs/components";
|
|
|
import './PhotoWall.scss'
|
|
|
-import Taro from "@tarojs/taro";
|
|
|
-import { useState } from "react";
|
|
|
+import Taro, { useRouter } from "@tarojs/taro";
|
|
|
+import { useEffect, useState } from "react";
|
|
|
import NewTimePicker from "@/_health/base/new_timepicker";
|
|
|
+import { getAlbums } from "@/services/health";
|
|
|
+
|
|
|
+let useRoute;
|
|
|
+let useNavigation;
|
|
|
+let scenario = '';
|
|
|
+if (process.env.TARO_ENV == 'rn') {
|
|
|
+ useRoute = require("@react-navigation/native").useRoute
|
|
|
+ useNavigation = require("@react-navigation/native").useNavigation
|
|
|
+}
|
|
|
+
|
|
|
+const scale = '?x-oss-process=image/resize,w_150,limit_0'
|
|
|
|
|
|
export default function PhotoWall() {
|
|
|
const screenWidth = Taro.getSystemInfoSync().screenWidth
|
|
|
const space = 2
|
|
|
- const itemWidth = (screenWidth-space*2)/3.0
|
|
|
- const [list, setList] = useState(new Array(10).fill("aaa"))
|
|
|
- return <View style={{display:'flex',flexDirection:'column'}}>
|
|
|
- <NewTimePicker />
|
|
|
- <View className="photo_wall">
|
|
|
- {
|
|
|
- list.map((item, index) => {
|
|
|
- return <View key={index} style={{ width: itemWidth, height: itemWidth, backgroundColor: 'pink',marginBottom:space }}></View>
|
|
|
+ const itemWidth = (screenWidth - space * 2) / 3.0
|
|
|
+ const [list, setList] = useState<any>([])
|
|
|
+
|
|
|
+ let router
|
|
|
+ let navigation;
|
|
|
+ if (useNavigation) {
|
|
|
+ navigation = useNavigation()
|
|
|
+ }
|
|
|
+
|
|
|
+ if (process.env.TARO_ENV == 'rn') {
|
|
|
+ router = useRoute()
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ router = useRouter()
|
|
|
+ }
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ getAlbumsData(router.params.window)
|
|
|
+ }, [])
|
|
|
+
|
|
|
+
|
|
|
+ function getAlbumsData(str) {
|
|
|
+ getAlbums({
|
|
|
+ page: 1,
|
|
|
+ limit: 50,
|
|
|
+ window: str
|
|
|
+ }).then(res => {
|
|
|
+ var array: any = [];
|
|
|
+ (res as any).data.map(item => {
|
|
|
+ array.push(...item.images)
|
|
|
})
|
|
|
- }
|
|
|
- <View style={{ width: itemWidth, height: itemWidth }} />
|
|
|
- <View style={{ width: itemWidth, height: itemWidth }} />
|
|
|
- </View>
|
|
|
+ setList(array)
|
|
|
+ // setMedias((res as any).data)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return <View style={{ display: 'flex', flexDirection: 'column' }}>
|
|
|
+ {/* <NewTimePicker /> */}
|
|
|
+ <View className="photo_wall">
|
|
|
+ {
|
|
|
+ list.map((item, index) => {
|
|
|
+ return <Image key={index}
|
|
|
+ src={item+scale}
|
|
|
+ mode="aspectFill"
|
|
|
+ style={{ width: itemWidth, height: itemWidth, backgroundColor: 'pink', marginBottom: space }} />
|
|
|
+ })
|
|
|
+ }
|
|
|
+ <View style={{ width: itemWidth, height: itemWidth }} />
|
|
|
+ <View style={{ width: itemWidth, height: itemWidth }} />
|
|
|
+ </View>
|
|
|
</View>
|
|
|
}
|