|
|
@@ -26,6 +26,7 @@ if (process.env.TARO_ENV == 'rn') {
|
|
|
export default function ChooseScenario() {
|
|
|
const [selected, setSelected] = useState(-1);
|
|
|
const ring = useSelector((state: any) => state.ring);
|
|
|
+ const user = useSelector((state: any) => state.user);
|
|
|
const [access, setAccess] = useState<any>(null);
|
|
|
const { t } = useTranslation();
|
|
|
const [count, setCount] = useState(0)
|
|
|
@@ -92,17 +93,20 @@ export default function ChooseScenario() {
|
|
|
}
|
|
|
|
|
|
function chooseType(index: number) {
|
|
|
- const { qualification } = access.current
|
|
|
- if (qualification.status != "PROVISIONAL_QUALIFIED" && index == 1) {
|
|
|
- const { streak_fast_min_required } = qualification.condition;
|
|
|
- showAlert({
|
|
|
- title: t('feature.choose_scenario.alert_title'),
|
|
|
- content: t('feature.choose_scenario.alert_content', { day: streak_fast_min_required, day_unit: streak_fast_min_required == 1 ? 'day' : 'days' }),
|
|
|
- showCancel: false,
|
|
|
- confirmText: t('feature.choose_scenario.alert_btn'),
|
|
|
- })
|
|
|
- return;
|
|
|
+ if (user.test_user) {
|
|
|
+ const { qualification } = access.current
|
|
|
+ if (qualification.status != "PROVISIONAL_QUALIFIED" && index == 1) {
|
|
|
+ const { streak_fast_min_required } = qualification.condition;
|
|
|
+ showAlert({
|
|
|
+ title: t('feature.choose_scenario.alert_title'),
|
|
|
+ content: t('feature.choose_scenario.alert_content', { day: streak_fast_min_required, day_unit: streak_fast_min_required == 1 ? 'day' : 'days' }),
|
|
|
+ showCancel: false,
|
|
|
+ confirmText: t('feature.choose_scenario.alert_btn'),
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
setSelected(index)
|
|
|
dispatch(chooseMode({ isMixed: index == 1 }))
|
|
|
}
|
|
|
@@ -175,42 +179,42 @@ export default function ChooseScenario() {
|
|
|
}}>
|
|
|
<Rings2 common={common} bgRing={bgRing} targetRing={selected == 0 ? targetRing : null} canvasId={new Date().getTime()} />
|
|
|
</View>
|
|
|
- <View style={{ display: 'flex', flexDirection: 'column',marginTop:rpxToPx(8) }}>
|
|
|
- <Text className="choose_item_title" style={{color:ColorType.fast}}>{t('feature.choose_scenario.fasting')}</Text>
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'column', marginTop: rpxToPx(8) }}>
|
|
|
+ <Text className="choose_item_title" style={{ color: ColorType.fast }}>{t('feature.choose_scenario.fasting')}</Text>
|
|
|
<Text className="choose_item_desc">{t('feature.choose_scenario.fast_desc')}</Text>
|
|
|
</View>
|
|
|
- <View className="choose_corner_tag" style={{fontWeight:'bold'}}>{t('feature.choose_scenario.free')}</View>
|
|
|
+ <View className="choose_corner_tag" style={{ fontWeight: 'bold' }}>{t('feature.choose_scenario.free')}</View>
|
|
|
{
|
|
|
selected == 0 && <View className="choose_item_check_bg">
|
|
|
<IconCheck color={ColorType.fast} width={24} height={24} />
|
|
|
</View>
|
|
|
}
|
|
|
</View>
|
|
|
- <View className={selected == 1 ? 'item1 item_sel1' : 'item1'} style={{borderColor:selected==1?ColorType.sleep:'transparent'}} onClick={() => chooseType(1)}>
|
|
|
+ <View className={selected == 1 ? 'item1 item_sel1' : 'item1'} style={{ borderColor: selected == 1 ? ColorType.sleep : 'transparent' }} onClick={() => chooseType(1)}>
|
|
|
<View style={{
|
|
|
flexShrink: 0, display: 'flex', width: 74, height: 74, marginRight: rpxToPx(24),
|
|
|
position: 'relative', zIndex: 1, alignItems: 'center', justifyContent: 'center',
|
|
|
-
|
|
|
+
|
|
|
}}>
|
|
|
<Rings2 common={common} bgRing={bgRing} targetRing={selected == 1 ? targetRing : null} canvasId={new Date().getTime() + 2} />
|
|
|
<View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
|
|
|
<Rings2 common={common2} bgRing={bgRing} targetRing={selected == 1 ? targetRing2 : null} canvasId={new Date().getTime() + 4} />
|
|
|
</View>
|
|
|
</View>
|
|
|
- <View style={{ display: 'flex', flexDirection: 'column', flex: 1,marginTop:rpxToPx(8) }}>
|
|
|
+ <View style={{ display: 'flex', flexDirection: 'column', flex: 1, marginTop: rpxToPx(8) }}>
|
|
|
<Text className="choose_item_title fast_sleep_item_text">{t('feature.choose_scenario.fast_sleep')}</Text>
|
|
|
<Text className="choose_item_desc">{t('feature.choose_scenario.fast_sleep_desc')}</Text>
|
|
|
|
|
|
|
|
|
</View>
|
|
|
{
|
|
|
- process.env.TARO_ENV == 'weapp' ? <View className="choose_corner_tag limit_offer" style={{fontWeight:'bold'}}>{t('feature.choose_scenario.limit_time_offer')}</View> :
|
|
|
+ process.env.TARO_ENV == 'weapp' ? <View className="choose_corner_tag limit_offer" style={{ fontWeight: 'bold' }}>{t('feature.choose_scenario.limit_time_offer')}</View> :
|
|
|
<LinearGradient className="choose_corner_tag"
|
|
|
colors={[ColorType.fast, ColorType.sleep]}
|
|
|
start={{ x: 0, y: 0 }}
|
|
|
end={{ x: 1, y: 0 }}
|
|
|
>
|
|
|
- <Text style={{ fontSize: rpxToPx(20),fontWeight:'bold',color:ColorType.black }}>{t('feature.choose_scenario.limit_time_offer')}</Text>
|
|
|
+ <Text style={{ fontSize: rpxToPx(20), fontWeight: 'bold', color: ColorType.black }}>{t('feature.choose_scenario.limit_time_offer')}</Text>
|
|
|
</LinearGradient>
|
|
|
}
|
|
|
{
|
|
|
@@ -223,12 +227,12 @@ export default function ChooseScenario() {
|
|
|
<View style={{ flex: 1 }} />
|
|
|
<Footer>
|
|
|
<View style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
|
- <ChooseScenarioBtn
|
|
|
- onClick={goSuggestion}
|
|
|
- title={t('feature.choose_scenario.next')}
|
|
|
- background={background}
|
|
|
- />
|
|
|
-
|
|
|
+ <ChooseScenarioBtn
|
|
|
+ onClick={goSuggestion}
|
|
|
+ title={t('feature.choose_scenario.next')}
|
|
|
+ background={background}
|
|
|
+ />
|
|
|
+
|
|
|
{/* {
|
|
|
process.env.TARO_ENV == 'rn' && selected == 1 && <View onClick={goSuggestion}>
|
|
|
<LinearGradient
|