|
@@ -1,22 +1,39 @@
|
|
1
|
+import Taro, { Component, render } from '@tarojs/taro'
|
1
|
2
|
import { View, Text } from "@tarojs/components";
|
2
|
3
|
import Floor from "./Floor";
|
3
|
4
|
import './unit.scss'
|
4
|
5
|
|
5
|
|
-export default function Unit(props) {
|
6
|
|
- const {termName, blockName, unitName, floorList = [] } = props.dataset || {}
|
7
|
6
|
|
8
|
|
- return (
|
9
|
|
- <View className="unit">
|
10
|
|
- <View className="head">
|
11
|
|
- <Text className="item">{termName}</Text>
|
12
|
|
- <Text className="item">{blockName}</Text>
|
13
|
|
- <Text className="item">{unitName}</Text>
|
14
|
|
- </View>
|
15
|
|
- <View className="body">
|
16
|
|
- {floorList.map((floor) => {
|
17
|
|
- return <Floor key={floor.floorId} dataset={floor} onRoomClick={props.onRoomClick} />
|
18
|
|
- })}
|
|
7
|
+export default class Unit extends Component {
|
|
8
|
+
|
|
9
|
+ onShowMoreClick = (item) => {
|
|
10
|
+
|
|
11
|
+ if (!item.noshow) {
|
|
12
|
+ item.noshow = true
|
|
13
|
+ } else {
|
|
14
|
+ item.noshow = false
|
|
15
|
+ }
|
|
16
|
+ this.setState({})
|
|
17
|
+ }
|
|
18
|
+ render() {
|
|
19
|
+ const { termName, blockName, unitName, noshow = false, floorList = [] } = this.props.dataset || {}
|
|
20
|
+ return (
|
|
21
|
+ <View className="unit">
|
|
22
|
+ <View className="head" onClick={() => this.onShowMoreClick(this.props.dataset)} >
|
|
23
|
+ <View>
|
|
24
|
+ <Text className="item">{termName}</Text>
|
|
25
|
+ <Text className="item">{blockName}</Text>
|
|
26
|
+ <Text className="item">{unitName}</Text>
|
|
27
|
+ </View>
|
|
28
|
+ <Image className="arrow" style={!noshow ? 'transform:rotate(90deg);' : ''} src={require('@/assets/person/arrow2.png')} mode="widthFix"></Image>
|
|
29
|
+ </View>
|
|
30
|
+ <View className="body" >
|
|
31
|
+ {!noshow && floorList.map((floor) => {
|
|
32
|
+ return <Floor key={floor.floorId} dataset={floor} onRoomClick={this.props.onRoomClick} />
|
|
33
|
+ })}
|
|
34
|
+ </View>
|
19
|
35
|
</View>
|
20
|
|
- </View>
|
21
|
|
- )
|
|
36
|
+ )
|
|
37
|
+ }
|
|
38
|
+
|
22
|
39
|
}
|