Leon vor 2 Jahren
Ursprung
Commit
a878639a41
3 geänderte Dateien mit 16 neuen und 5 gelöschten Zeilen
  1. 2 2
      src/components/input/Slider.scss
  2. 13 2
      src/components/input/Slider.tsx
  3. 1 1
      src/context/locales/zh.js

+ 2 - 2
src/components/input/Slider.scss

@@ -123,8 +123,8 @@
     width: 578px;
     padding-left: 40px;
     padding-right: 40px;
-    padding-top: 20px;
-    padding-bottom: 20px;
+    padding-top: 40px;
+    padding-bottom: 40px;
     box-sizing: border-box;
     border-radius: 16px;
     background-color: $tipBgColor;

+ 13 - 2
src/components/input/Slider.tsx

@@ -6,6 +6,7 @@ import { rpxToPx } from '@/utils/tools';
 import Taro from '@tarojs/taro';
 import { useSelector } from 'react-redux';
 import { useTranslation } from 'react-i18next';
+import { jumpPage } from '@/features/trackTimeDuration/hooks/Common';
 
 var currentValue = 0;
 var lastValue = 0;
@@ -16,6 +17,7 @@ export default function (props: { onChanged?: Function, value?: number, edit?: b
     const [value, setValue] = useState(props.value ? props.value : 0)
     const [startX, setStartX] = useState(0);
     const common = useSelector((state: any) => state.common);
+    const user = useSelector((state: any) => state.user);
     const [showArrow, setShowArrow] = useState(true)
     const { t } = useTranslation()
 
@@ -26,12 +28,19 @@ export default function (props: { onChanged?: Function, value?: number, edit?: b
     }, [props.value])
 
     const handleTouchStart = (event) => {
+        if (!user.isLogin){
+            jumpPage('/pages/account/ChooseAuth', 'ChooseAuth')
+            return
+        }
         setIsSliding(true);
         setShowArrow(false);
         setStartX(event.touches[0].clientX);
     };
 
     const handleTouchMove = (event) => {
+        if (!user.isLogin){
+            return
+        }
         if (isSliding) {
             const { touches } = event;
             const touchX = touches[0].clientX;
@@ -59,7 +68,9 @@ export default function (props: { onChanged?: Function, value?: number, edit?: b
     };
 
     const handleTouchEnd = () => {
-
+        if (!user.isLogin){
+            return
+        }
         setIsSliding(false);
         Taro.vibrateShort({
             type: 'light'
@@ -196,7 +207,7 @@ export default function (props: { onChanged?: Function, value?: number, edit?: b
             </View>
             <View className='slider-item-content'>
                 <View className='slider-item-bg' style={{
-                    width: brightness * 0.01 * rpxToPx(sliderWidth - 126) + rpxToPx(112),
+                    width: brightness * 0.01 * rpxToPx(sliderWidth - 126) + rpxToPx(112+2),
                     backgroundColor: value == 5 ? '#fff' : value < 5 ? ColorType.fast : ColorType.food
                 }}>
                     {/* <View className='slider-item' style={{

+ 1 - 1
src/context/locales/zh.js

@@ -305,7 +305,7 @@ export default {
             slider_tip_pre_meal_title: '饥饿感',
             slider_tip_post_meal_title: '饱足感',
             slider_tip_pre_meal_desc: '极度饥饿到不饿',
-            slider_tip_post_meal_desc: '不饱到十分饱',
+            slider_tip_post_meal_desc: '不饱到极度撑胀',
             disable_switch_modal_title:'请先完成当前记录',
             disable_switch_modal_btn:'我知道了'
         },