|
|
@@ -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={{
|