|
@@ -21,7 +21,7 @@ const tab = (props) => {
|
21
|
21
|
|
22
|
22
|
const user = useSelector(state => state.user)
|
23
|
23
|
|
24
|
|
- const { value, openType, pageState, formType, color, ...prop } = props
|
|
24
|
+ const { value, openType, pageState, formType, color, styleType='', ...prop } = props
|
25
|
25
|
|
26
|
26
|
const [state, setState] = useState(1)
|
27
|
27
|
console.log(props, openType, 'formType')
|
|
@@ -33,20 +33,34 @@ const tab = (props) => {
|
33
|
33
|
// color: #fed12f;
|
34
|
34
|
// }${props.className}
|
35
|
35
|
return <View className='tab'>
|
36
|
|
- {value.length == 1 &&
|
|
36
|
+ {
|
|
37
|
+ value.length == 1 &&
|
37
|
38
|
<>
|
38
|
|
- {openType && <button openType="share" className={`tab,tab1,${props.className}`} style={{ backgroundColor: getColor(user.role), color }} onClick={() => props.onClick('2')}>{value[0]}</button>}
|
39
|
|
- {!openType && <View className={`tab,tab1,${props.className}`} style={{ backgroundColor: getColor(user.role), color }} onClick={() => props.onClick('2')}>{value[0]}</View>}
|
|
39
|
+ {openType && <button openType="share" className={`tab,tab1,${props.className}`} style={{ backgroundColor: getColor(user.role), color }} onClick={() => props.onClick('2')}>{value[0]}</button>}
|
|
40
|
+ {!openType && <View className={`tab,tab1,${props.className}`} style={{ backgroundColor: getColor(user.role), color }} onClick={() => props.onClick('2')}>{value[0]}</View>}
|
40
|
41
|
</>
|
41
|
42
|
}
|
42
|
|
- {value.length == 2 && <View className={`tab,tab2,${props.className}`} style={{ display: 'flex', }}>
|
43
|
|
- <View style={{ width: '50%' }} style={pageState == '2' ? { color: getColor(user.role), width: '50%' } : { width: '50%' }} onClick={props.onClick[0]}>{value[0]}</View>
|
44
|
|
- {formType && <Button className='tab-btn' formType="submit" plain={true} style={pageState == '3' ? { color: getColor(user.role), width: '50%', border: 'none' } : { width: '50%', border: 'none' }}>{value[1]}</Button>}
|
45
|
|
- {openType && <button className='tab-btn' openType="share" plain={true} style={pageState == '3' ? { color: getColor(user.role), width: '50%', border: 'none' } : { width: '50%', border: 'none' }}>{value[1]}</button>}
|
46
|
|
- {!formType&&!openType &&
|
47
|
|
- <View style={{ width: '50%' }} style={pageState == '3' ? { color: getColor(user.role), width: '50%' } : { width: '50%' }} onClick={props.onClick[1]}>{value[1]}</View>
|
48
|
|
- }
|
49
|
|
- </View>}
|
|
43
|
+ {
|
|
44
|
+ value.length == 2 && <View className={`tab,tab2,${props.className}`} style={{ display: 'flex', }}>
|
|
45
|
+ <View style={{ width: '50%' }} style={pageState == '2'&&styleType!='tab' ? { color: getColor(user.role), width: '50%' } : { color:pageState != '2'&&styleType=='tab'?getColor(user.role):undefined, width: '50%' }} onClick={props.onClick[0]}>{value[0]}</View>
|
|
46
|
+ {formType &&
|
|
47
|
+ <Button className='tab-btn'
|
|
48
|
+ formType="submit"
|
|
49
|
+ plain={true}
|
|
50
|
+ style={pageState == '3' &&styleType!='tab'? { color: getColor(user.role), width: '50%', border: 'none' } : { width: '50%', border: 'none' }}
|
|
51
|
+ >{value[1]}
|
|
52
|
+ </Button>}
|
|
53
|
+ {openType &&
|
|
54
|
+ <button className='tab-btn'
|
|
55
|
+ openType="share" plain={true} style={pageState == '3'&&styleType!='tab' ? { color: getColor(user.role), width: '50%', border: 'none' } : { width: '50%', border: 'none' }}>{value[1]}</button>}
|
|
56
|
+ {!formType&&!openType &&
|
|
57
|
+ <View style={{ width: '50%' }}
|
|
58
|
+ style={pageState == '3'&&styleType!='tab' ? { color: getColor(user.role), width: '50%' } : { color:pageState != '3'&&styleType=='tab'?getColor(user.role):undefined, width: '50%' }}
|
|
59
|
+ onClick={props.onClick[1]}
|
|
60
|
+ >{value[1]}</View>
|
|
61
|
+ }
|
|
62
|
+ </View>
|
|
63
|
+ }
|
50
|
64
|
|
51
|
65
|
</View>
|
52
|
66
|
};
|