|
|
@@ -28,7 +28,7 @@ export default function (props: { onChanged?: Function, value?: number, edit?: b
|
|
|
}, [props.value])
|
|
|
|
|
|
const handleTouchStart = (event) => {
|
|
|
- if (!user.isLogin){
|
|
|
+ if (!user.isLogin) {
|
|
|
jumpPage('/pages/account/ChooseAuth', 'ChooseAuth')
|
|
|
return
|
|
|
}
|
|
|
@@ -38,7 +38,7 @@ export default function (props: { onChanged?: Function, value?: number, edit?: b
|
|
|
};
|
|
|
|
|
|
const handleTouchMove = (event) => {
|
|
|
- if (!user.isLogin){
|
|
|
+ if (!user.isLogin) {
|
|
|
return
|
|
|
}
|
|
|
if (isSliding) {
|
|
|
@@ -68,7 +68,7 @@ export default function (props: { onChanged?: Function, value?: number, edit?: b
|
|
|
};
|
|
|
|
|
|
const handleTouchEnd = () => {
|
|
|
- if (!user.isLogin){
|
|
|
+ if (!user.isLogin) {
|
|
|
return
|
|
|
}
|
|
|
setIsSliding(false);
|
|
|
@@ -190,6 +190,55 @@ export default function (props: { onChanged?: Function, value?: number, edit?: b
|
|
|
return obj[0].description ?? '暂无描述'
|
|
|
}
|
|
|
|
|
|
+ function getSliderTitleClass() {
|
|
|
+ if (props.isPostMeal) {
|
|
|
+ if (showArrow) {
|
|
|
+ return 'slider-tip-title-post'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return value < 5 ? 'slider-tip-title' : 'slider-tip-title-post'
|
|
|
+ }
|
|
|
+
|
|
|
+ function getSliderDescClass() {
|
|
|
+ if (props.isPostMeal) {
|
|
|
+ if (showArrow) {
|
|
|
+ return 'slider-tip-desc-post'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return value < 5 ? 'slider-tip-desc' : 'slider-tip-desc-post'
|
|
|
+ }
|
|
|
+
|
|
|
+ function getSliderTitle() {
|
|
|
+ if (props.isPostMeal) {
|
|
|
+ if (showArrow) {
|
|
|
+ return t('feature.food.slider_tip_post_meal_title')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return value < 5 ?
|
|
|
+ t('feature.food.slider_tip_pre_meal_title') :
|
|
|
+ t('feature.food.slider_tip_post_meal_title')
|
|
|
+ }
|
|
|
+
|
|
|
+ function getSliderDesc() {
|
|
|
+ if (props.isPostMeal) {
|
|
|
+ if (showArrow) {
|
|
|
+ return t('feature.food.slider_tip_post_meal_desc')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return value < 5 ?
|
|
|
+ t('feature.food.slider_tip_pre_meal_desc') :
|
|
|
+ t('feature.food.slider_tip_post_meal_desc')
|
|
|
+ }
|
|
|
+
|
|
|
+ function getSliderBgColor() {
|
|
|
+ if (props.isPostMeal) {
|
|
|
+ if (showArrow) {
|
|
|
+ return ColorType.food
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return value == 5 ? '#fff' : value < 5 ? ColorType.fast : ColorType.food
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
return <View style={{ display: 'flex', flexDirection: 'column', position: 'relative', width: rpxToPx(578) }}>
|
|
|
<View className='slider-container'
|
|
|
@@ -198,17 +247,13 @@ export default function (props: { onChanged?: Function, value?: number, edit?: b
|
|
|
onTouchMove={handleTouchMove}
|
|
|
onTouchEnd={handleTouchEnd}>
|
|
|
<View className='slider-tip-bg' style={{ width: (100 - brightness) * 0.01 * rpxToPx(sliderWidth) - brightness * 0.01 * rpxToPx(120) + brightness * 0.01 * rpxToPx(28) }}>
|
|
|
- <Text className={value < 5 ? 'slider-tip-title' : 'slider-tip-title-post'}>{value < 5 ?
|
|
|
- t('feature.food.slider_tip_pre_meal_title') :
|
|
|
- t('feature.food.slider_tip_post_meal_title')}</Text>
|
|
|
- <Text className={value < 5 ? 'slider-tip-desc' : 'slider-tip-desc-post'}>{value < 5 ?
|
|
|
- t('feature.food.slider_tip_pre_meal_desc') :
|
|
|
- t('feature.food.slider_tip_post_meal_desc')}</Text>
|
|
|
+ <Text className={getSliderTitleClass()}>{getSliderTitle()}</Text>
|
|
|
+ <Text className={getSliderDescClass()}>{getSliderDesc()}</Text>
|
|
|
</View>
|
|
|
<View className='slider-item-content'>
|
|
|
<View className='slider-item-bg' style={{
|
|
|
- width: brightness * 0.01 * rpxToPx(sliderWidth - 126) + rpxToPx(112+2),
|
|
|
- backgroundColor: value == 5 ? '#fff' : value < 5 ? ColorType.fast : ColorType.food
|
|
|
+ width: brightness * 0.01 * rpxToPx(sliderWidth - 126) + rpxToPx(112 + 2),
|
|
|
+ backgroundColor: getSliderBgColor()//value == 5 ? '#fff' : value < 5 ? ColorType.fast : ColorType.food
|
|
|
}}>
|
|
|
{/* <View className='slider-item' style={{
|
|
|
width: brightness * 0.01 * rpxToPx(sliderWidth - 126) + rpxToPx(112) + 1,
|