Browse Source

开始适配app

Leon 2 years ago
parent
commit
7ee64fc464

+ 4 - 4
src/app.config.ts

@@ -1,8 +1,8 @@
 const appConfig = defineAppConfig({
   pages: [
-    //'pages/demo',
-    'pages/clock/Clock',
     
+    'pages/clock/Clock',
+    'pages/demo',
     
     
     'pages/index/index',
@@ -85,9 +85,9 @@ process.env.TARO_ENV === 'weapp' && (appConfig.tabBar = {
   ]
 })
 
-
+//src/pages/rn/RNMain.tsx
 process.env.TARO_ENV === 'rn' && (appConfig.pages = [
-  'pages/RNMain'
+  'pages/rn/RNMain'
 ])
 
 export default appConfig;

+ 22 - 26
src/app.scss

@@ -93,10 +93,6 @@ page {
     width: 90px;
 }
 
-wx-scroll-view {
-    -webkit-overflow-scrolling: auto !important;
-}
-
 ::-webkit-scrollbar {
     display: none;
     width: 0;
@@ -126,25 +122,25 @@ wx-scroll-view {
 
 
 
-@media only screen and (-webkit-min-device-pixel-ratio: 2.0) {
-    .px1Width::after {
-        -webkit-transform: scaleX(0.5);
-        transform: scaleX(0.5);
-    }
-    .px1Height::after {
-        -webkit-transform: scaleY(0.5);
-        transform: scaleY(0.5);
-    }
-}
-/* 3倍屏 */
-@media only screen and (-webkit-min-device-pixel-ratio: 3.0) {
-    .px1Width::after {
-        -webkit-transform: scaleX(0.33);
-        transform: scaleX(0.33);
-    }
-
-    .px1Height::after {
-        -webkit-transform: scaleY(0.33);
-        transform: scaleY(0.33);
-    }
-}
+// @media only screen and (-webkit-min-device-pixel-ratio: 2.0) {
+//     .px1Width::after {
+//         -webkit-transform: scaleX(0.5);
+//         transform: scaleX(0.5);
+//     }
+//     .px1Height::after {
+//         -webkit-transform: scaleY(0.5);
+//         transform: scaleY(0.5);
+//     }
+// }
+// /* 3倍屏 */
+// @media only screen and (-webkit-min-device-pixel-ratio: 3.0) {
+//     .px1Width::after {
+//         -webkit-transform: scaleX(0.33);
+//         transform: scaleX(0.33);
+//     }
+
+//     .px1Height::after {
+//         -webkit-transform: scaleY(0.33);
+//         transform: scaleY(0.33);
+//     }
+// }

+ 13 - 4
src/app.tsx

@@ -11,14 +11,23 @@ import Taro from '@tarojs/taro'
 
 
 const App: React.FC<PropsWithChildren> = ({ children }) => {
-  global.isDebug = Taro.getStorageSync('isDebug')
+  if (process.env.TARO_ENV == 'weapp') {
+    global.isDebug = Taro.getStorageSync('isDebug')
+  }
+  else {
+    // Taro.getStorage({
+    //   key:'isDebug',
+    //   success:res=>{
+    //     // global.isDebug = res
+    //   }
+    // })
+  }
+
   return <Provider store={store}>
-    <View style={{position:'absolute',left:0,right:0,top:0,height:300,backgroundColor:'red'}}/>
     {children}
-    <GlobalModal />
-    <View style={{position:'absolute',left:0,right:0,top:0,height:300,backgroundColor:'red'}}/>
   </Provider>
 }
+
 // class App extends Component<PropsWithChildren> {
 
 //   componentDidMount () {}

+ 11 - 0
src/components/basic/Buttons.scss

@@ -51,12 +51,23 @@
 
 }
 
+/* #ifdef weapp */
 .mixed {
     background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
     -webkit-background-clip: text;
     background-clip: text;
     color: transparent;
 }
+/* #endif */
+
+/* #ifdef rn */
+.mixed {
+    -webkit-background-clip: text;
+    background-clip: text;
+    color: transparent;
+}
+/* #endif */
+
 
 
 .elevated {

+ 12 - 5
src/components/input/Switch.tsx

@@ -1,7 +1,14 @@
-import { View,Image } from "@tarojs/components";
+import { View, Image } from "@tarojs/components";
+
+export default function Component(props: { isOn: boolean, onClick: Function }) {
+
+    if (process.env.TARO_ENV == 'weapp') {
+        return <View onClick={() => props.onClick()}>
+            <Image style={{ width: 42, height: 26 }}
+                src={require(props.isOn ? '@/assets/images/notice_switch_select.png' : '@/assets/images/notice_switch_unselect.png')} />
+        </View>
+    }
+    return <View onClick={() => props.onClick()}></View>
+
 
-export default function Component(props:{isOn:boolean,onClick:Function}){
-    return <View onClick={()=>props.onClick()}>
-        <Image style={{width:42,height:26}} src={require(props.isOn?'@/assets/images/notice_switch_select.png':'@/assets/images/notice_switch_unselect.png')}/>
-    </View>
 }

+ 9 - 4
src/context/locales/index.ts

@@ -5,10 +5,15 @@ import zh from './zh'
 import en from './en'
 import { initReactI18next } from 'react-i18next';
 
-function getLanguageSetting(){
-  var key = Taro.getStorageSync('language')
-  if (key){
-    initLocale(key)
+function getLanguageSetting() {
+  if (process.env.TARO_ENV == 'weapp') {
+    var key = Taro.getStorageSync('language')
+    if (key) {
+      initLocale(key)
+    }
+    else {
+      initLocale('zh')
+    }
   }
   else {
     initLocale('zh')

+ 1 - 1
src/features/trackTimeDuration/components/ChooseScenario.tsx

@@ -2,7 +2,7 @@ import { View, Text } from "@tarojs/components";
 import Buttons from '@/components/basic/Buttons';
 import Texts from '@/components/basic/Texts';
 import Rings from '@components/view/Rings';
-import Rings2, { BgRing, RingCommon, TargetRing } from './Rings';
+import Rings2, { BgRing, RingCommon, TargetRing } from './Rings.weapp';
 import Footer from '@/components/layout/Footer';
 import SingleSelect from '../../../components/input/SingleSelect';
 import { ComponentStatus, NaviBarTitleShowType, TemplateType, TextType } from "@utils/types";

+ 1 - 1
src/features/trackTimeDuration/components/Clock.tsx

@@ -2,7 +2,7 @@ import trackTimeService, { machine } from "@/store/trackTimeMachine";
 import { View, Text } from "@tarojs/components";
 import { useEffect, useState } from "react";
 import { TimeFormatter } from "@/utils/time_format";
-import Rings, { BgRing, CurrentDot, RealRing, RingCommon } from './Rings';
+import Rings, { BgRing, CurrentDot, RealRing, RingCommon } from './Rings.weapp';
 import { getBgRing, getCommon, getDot, getReal, getTarget } from "../hooks/RingData";
 import './Clock.scss'
 import { ColorType } from "@/context/themes/color";

+ 23 - 5
src/features/trackTimeDuration/components/Console.scss

@@ -82,14 +82,15 @@
     line-height: 20px;
 }
 
-.normal_fast_color{
-    color:  $fastColor;
+.normal_fast_color {
+    color: $fastColor;
 }
 
-.normal_sleep_color{
-    color:  $sleepColor;
+.normal_sleep_color {
+    color: $sleepColor;
 }
 
+/* #ifdef weapp */
 .timeout_fast_linear_color {
     background: linear-gradient(90deg, $alertFastColor 0%, $alertColor 100%);
     -webkit-background-clip: text;
@@ -102,4 +103,21 @@
     -webkit-background-clip: text;
     background-clip: text;
     color: transparent;
-}
+}
+
+/* #endif */
+
+/* #ifdef rn */
+.timeout_fast_linear_color {
+    -webkit-background-clip: text;
+    background-clip: text;
+    color: transparent;
+}
+
+.timeout_sleep_linear_color {
+    -webkit-background-clip: text;
+    background-clip: text;
+    color: transparent;
+}
+
+/* #endif */

+ 1 - 1
src/features/trackTimeDuration/components/RecordFastSleep.tsx

@@ -11,7 +11,7 @@ import TimelineFastSleep from "./TimelineFastSleep";
 import { TimeFormatter } from "@/utils/time_format";
 import './RecordFastSleep.scss'
 import { getBgRing, getCommon, getDot, getReal, getTarget } from "../hooks/RingData";
-import Rings from "./Rings";
+import Rings from "./Rings.weapp";
 import Segment from "@/components/navigation/Segment";
 import Stage from "./Stage";
 import CenterContentTitleModal from "@/features/common/CenterContentTitleModal";

+ 5 - 0
src/features/trackTimeDuration/components/Rings.rn.tsx

@@ -0,0 +1,5 @@
+import { View } from "@tarojs/components";
+
+export default function Component(){
+    return <View />
+}

+ 0 - 0
src/features/trackTimeDuration/components/Rings.tsx → src/features/trackTimeDuration/components/Rings.weapp.tsx


+ 12 - 8
src/pages/account/Profile.tsx

@@ -20,16 +20,20 @@ export default function Page() {
     const [switchOn, setSwitchOn] = useState(false)
 
     useEffect(() => {
-        var status = Taro.getStorageSync('isDebug')
-        setSwitchOn(status)
+        if (process.env.TARO_ENV == 'weapp') {
+            var status = Taro.getStorageSync('isDebug')
+            setSwitchOn(status)
+        }
     }, [])
 
-    useShareAppMessage((e)=>{
-        return {
-          title:t('share.title'),
-          path:'pages/clock/Clock'
-        }
-      })
+    if (process.env.TARO_ENV == 'weapp') {
+        useShareAppMessage((e) => {
+            return {
+                title: t('share.title'),
+                path: 'pages/clock/Clock'
+            }
+        })
+    }
 
     function switchChanged(e) {
         setSwitchOn(e.detail.value)

+ 1 - 2
src/pages/account/Setting.tsx

@@ -47,8 +47,7 @@ export default function Page() {
 
     return <View style={{ color: '#fff',display:'flex',flexDirection:'column' }}>
         <View style={{height:20}}/>
-        <TableCell title="版本" ><Text style={{ opacity: 0.8 }}>1.2.2</Text></TableCell>
-        <View style={{height:'80vh'}}/>
+        <TableCell title="版本" ><Text style={{ opacity: 0.8 }}>1.2.3</Text></TableCell>
         {/* <Text style={{color:'#9E9E9E',textAlign:'center',fontSize:14}}>v1.2.2</Text> */}
         
         <Footer>

+ 67 - 52
src/pages/clock/Clock.tsx

@@ -6,7 +6,7 @@ import './Clock.scss'
 import '@/context/locales/index'
 import Taro, { useDidShow, usePageScroll, useReady, useRouter, useShareAppMessage } from '@tarojs/taro'
 // import ComponentA from './component'
-import Rings from '@components/view/Rings';
+
 
 import { useDispatch, useSelector } from 'react-redux';
 import { getInfoSuccess, logoutSuccess } from '@/store/user';
@@ -42,6 +42,9 @@ import NoData from '@/components/view/NoData'
 import { ColorType } from '@/context/themes/color'
 // import TabBar from '../../components/Tabbar';
 
+// import Rings from '@components/view/Rings';
+
+
 export default function IndexPage() {
   const dispatch = useDispatch();
   const { t } = useTranslation()
@@ -191,10 +194,10 @@ export default function IndexPage() {
     }
   })
 
-  useShareAppMessage((e)=>{
+  useShareAppMessage((e) => {
     return {
-      title:t('share.title'),
-      path:'pages/clock/Clock'
+      title: t('share.title'),
+      path: 'pages/clock/Clock'
     }
   })
 
@@ -281,17 +284,22 @@ export default function IndexPage() {
       }
 
     }).catch(e => {
+      console.log('aaa')
       if (!checkData) {
+        console.log('this is a test')
         setErrorPage(true)
       }
+      else {
+        console.log('sss')
+      }
     })
   }
 
   function checkWXPubFollow() {
     wxPubFollow().then(res => {
       dispatch(setWXFollow((res as any).wx_pub_followed));
-      console.log('当前的关注状态'+(res as any).wx_pub_followed);
-      
+      console.log('当前的关注状态' + (res as any).wx_pub_followed);
+
     })
   }
 
@@ -340,7 +348,7 @@ export default function IndexPage() {
 
   function errorView() {
     if (showErrorPage) {
-      <NoData refresh={() => { getCheckData() }} />
+      return <NoData refresh={() => { getCheckData() }} />
     }
     return <View />
   }
@@ -383,55 +391,62 @@ export default function IndexPage() {
   }
 
 
-  return (
-    <Layout type={TemplateType.customHeader} header={headerView()} title={t('page.clock.title')} titleShowStyle={NaviBarTitleShowType.scrollToShow}>
-      <View style={{ flex: 1, flexDirection: 'column', display: 'flex', backgroundColor: '#000', color: '#fff' }}>
-        {
-          needShowAddTip && <Tooltip title="添加到我的小程序" closeTip={() => { setNeedShowAddTip(false) }} />
-        }
+  function detail() {
+    return (
+      <Layout type={TemplateType.customHeader} header={headerView()} title={t('page.clock.title')} titleShowStyle={NaviBarTitleShowType.scrollToShow}>
+        <View style={{ flex: 1, flexDirection: 'column', display: 'flex', backgroundColor: '#000', color: '#fff' }}>
+          {
+            needShowAddTip && <Tooltip title="添加到我的小程序" closeTip={() => { setNeedShowAddTip(false) }} />
+          }
+
+          <Box>
+            <View className='clock_bg' onClick={tapClock}>
+              <Clocks />
+            </View>
+          </Box>
+          {
+            errorView()
+          }
+          {
+            user.isLogin && consoleView()
+          }
+          {
+            user.isLogin && checkData && schedule()
+          }
+          {
+            user.isLogin && <View style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
+              {
+                checkData && (checkData as any).latest_record &&
+                <SectionHeader top={48} bottom={24} title={t('feature.track_time_duration.record_fast_sleep.header.latest_record')}>
+                  <Header title='' action={() => {
+                    Taro.navigateTo({
+                      url: '/pages/common/RecordsHistory?type=time&title=time'
+                    })
+                  }} />
+                </SectionHeader>
+              }
+            </View>
+          }
+          {
+            user.isLogin && checkData && (checkData as any).latest_record &&
+            <RecordFastSleep type='latest' data={(checkData as any).latest_record} delSuccess={getCheckData} />
+          }
+          <View style={{ height: 100 }} />
+        </View>
 
-        <Box>
-          <View className='clock_bg' onClick={tapClock}>
-            <Clocks />
-          </View>
-        </Box>
-        {
-          errorView()
-        }
-        {
-          user.isLogin && consoleView()
-        }
-        {
-          user.isLogin && checkData && schedule()
-        }
         {
-          user.isLogin && <View style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
-            {
-              checkData && (checkData as any).latest_record &&
-              <SectionHeader top={48} bottom={24} title={t('feature.track_time_duration.record_fast_sleep.header.latest_record')}>
-                <Header title='' action={() => {
-                  Taro.navigateTo({
-                    url: '/pages/common/RecordsHistory?type=time&title=time'
-                  })
-                }} />
-              </SectionHeader>
-            }
-          </View>
+          showModal && modalDetail
         }
         {
-          user.isLogin && checkData && (checkData as any).latest_record &&
-          <RecordFastSleep type='latest' data={(checkData as any).latest_record} delSuccess={getCheckData} />
+          showModal2 && modalDetail2
         }
-        <View style={{ height: 100 }} />
-      </View>
 
-      {
-        showModal && modalDetail
-      }
-      {
-        showModal2 && modalDetail2
-      }
+      </Layout>
+    )
+  }
+
+  if (process.env.TARO_ENV == 'rn')
+    return <View />
 
-    </Layout>
-  )
-}
+  return detail()
+}

+ 8 - 274
src/pages/demo.tsx

@@ -1,278 +1,12 @@
-import Taro from '@tarojs/taro';
 import { Canvas, View,Text } from '@tarojs/components';
-import { useEffect, useRef } from 'react';
-import Timeline from '@/components/view/Timeline';
-import RecordItem from '@/features/common/RecordItem';
-
 export default function Demo() {
-  const canvasRef = useRef<any>(null);
-  const canvasWidth: number = 200;
-  const canvasHeight: number = 200;
-  const circleRadius: number = 100;
-  const ringWidth: number = 30;
-  const dotRadius: number = 10;
-  const dpr = Taro.getSystemInfoSync().pixelRatio; // 获取设备的像素比
-
-  const canvasId = 'canvasId';
-
-  var canDrag = false;
-  var canStartDrag = false;
-  var canEndDrag = false;
-  var canRingDrag = false;
-
-  var currentContext;
-
-  var startAngle = 45 * Math.PI / 180;
-  var endAngle = 120 * Math.PI / 180;
-  var lastAngle;
-  var lastDuration = 0;
-
-  useEffect(() => {
-
-    const query = Taro.createSelectorQuery();
-    query.select(`.${canvasId}`).fields({ node: true, size: true });
-    query.exec((res) => {
-      if (res[0] == null) return;
-      const _canvas = res[0].node;
-      _canvas.width = res[0].width * dpr;
-      _canvas.height = res[0].height * dpr;
-      const ctx = _canvas.getContext('2d');
-      currentContext = ctx;
-
-      // 设置画布尺寸
-      ctx.scale(dpr, dpr);
-
-
-      drawCanvas(ctx);
-    });
-  }, []);
-
-  const drawCanvas = (ctx: any) => {
-    ctx.clearRect(0, 0, canvasWidth, canvasHeight);
-
-    // 绘制圆环
-    const centerX = canvasWidth / 2;
-    const centerY = canvasHeight / 2;
-    const radius = Math.min(centerX, centerY) - 10;
-
-
-
-    ctx.clearRect(0, 0, canvasWidth, canvasHeight);
-
-
-    ctx.beginPath();
-    ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
-    ctx.strokeStyle = "rgba(0,0,0,0.5)";
-    ctx.lineWidth = 10;
-    ctx.stroke();
-
-    ctx.beginPath();
-    ctx.arc(centerX, centerY, radius, startAngle, endAngle);
-    ctx.strokeStyle = canRingDrag ? "red" : "rgba(255,0,0,0.5)";
-    ctx.lineWidth = 10;
-    ctx.stroke();
-
-    const pointX = centerX + Math.cos(startAngle) * radius;
-    const pointY = centerY + Math.sin(startAngle) * radius;
-
-    ctx.beginPath();
-    ctx.arc(pointX, pointY, 5, 0, 2 * Math.PI);
-    ctx.fillStyle = '#00ff00';
-    ctx.fill();
-
-
-
-    // 绘制蓝色终点圆点
-    const pointX2 = centerX + Math.cos(endAngle) * radius;
-    const pointY2 = centerY + Math.sin(endAngle) * radius;
-
-    ctx.beginPath();
-    ctx.arc(pointX2, pointY2, 5, 0, 2 * Math.PI);
-    ctx.fillStyle = 'blue';
-    ctx.fill();
-  };
-
-  function twoPointDistance(p1, p2) {
-    let dep = Math.sqrt(Math.pow((p1.x - p2.x), 2) + Math.pow((p1.y - p2.y), 2));
-    return dep;
-  }
-
-  function limitAngle(start, end) {
-    var angle1 = start < 0 ? start + 2 * Math.PI : start;
-    var angle2 = end < 0 ? end + 2 * Math.PI : end;
-    if (angle2 < angle1) {
-      angle2 = angle2 + 2 * Math.PI;
-    }
-
-    var leftAngle = angle2 - angle1;
-    if (leftAngle > Math.PI * 23 / 12) {
-      return 1;
-    }
-    else if (leftAngle < Math.PI / 12) {
-      return 2;
-    }
-    return 0;
-  }
-
-  function durationAngle(end, start) {
-    var angle1 = start < 0 ? start + 2 * Math.PI : start;
-    var angle2 = end < 0 ? end + 2 * Math.PI : end;
-    if (angle2 < angle1) {
-      angle2 = angle2 + 2 * Math.PI;
-    }
-
-    return angle2 - angle1;
-  }
-
-  const handleTouchMove = (e: any) => {
-    const ctx = currentContext;//canvasRef.current.getContext('2d');
-    if (!canStartDrag && !canEndDrag && !canRingDrag) {
-      drawCanvas(ctx);
-      return;
-    }
-
-    const { x, y } = e.touches[0];
-
-    let angle = Math.atan2(y - canvasWidth / 2.0, x - canvasWidth / 2.0)
-
-    if (canStartDrag) {
-      if (Math.abs(durationAngle(endAngle, angle) - lastDuration) > Math.PI) {
-        //禁止跨越
-        return;
-      }
-
-      var result = limitAngle(angle, endAngle);
-      switch (result) {
-        case 0:
-          startAngle = angle;
-          break;
-        case 1:
-          startAngle = endAngle - 23 * Math.PI / 12;
-          break;
-        case 2:
-          startAngle = endAngle - Math.PI / 12;
-          break;
-      }
-
-    }
-
-    if (canEndDrag) {
-      if (Math.abs(durationAngle(angle, startAngle) - lastDuration) > Math.PI) {
-        //禁止跨越
-        return;
-      }
-
-      var result = limitAngle(startAngle, angle);
-      switch (result) {
-        case 0:
-          endAngle = angle;
-          break;
-        case 1:
-          endAngle = startAngle + 23 * Math.PI / 12;
-          break;
-        case 2:
-          endAngle = startAngle + Math.PI / 12;
-          break;
-      }
-
-    }
-
-    if (canRingDrag) {
-      let delta = angle - lastAngle;
-      startAngle += delta;
-      endAngle += delta;
-      lastAngle = angle;
-    }
-
-    drawCanvas(ctx);
-
-    lastDuration = durationAngle(endAngle, startAngle);
-  };
-
-  const handleClick = (e) => {
-
-    const scaleX = 1//dpr//canvasRect.width / canvasRect.width;
-    const scaleY = 1//dpr//canvasRect.height / canvasRect.height;
-    const canvasX = (e.touches[0].x - 0) * scaleX;
-    const canvasY = (e.touches[0].y - 0) * scaleY;
-
-    // 判断点击位置是否在圆点范围内
-    const centerX = canvasWidth / 2;
-    const centerY = canvasWidth / 2;
-    const radius = Math.min(centerX, centerY) - 10;
-
-
-    const pointX = centerX + Math.cos(startAngle) * radius;
-    const pointY = centerY + Math.sin(startAngle) * radius;
-    const distance = Math.sqrt(Math.pow(canvasX - pointX, 2) + Math.pow(canvasY - pointY, 2));
-
-    if (distance <= 8) {
-      canStartDrag = true;
-    } else {
-      canStartDrag = false;
-    }
-
-    const pointX2 = centerX + Math.cos(endAngle) * radius;
-    const pointY2 = centerY + Math.sin(endAngle) * radius;
-    const distance2 = Math.sqrt(Math.pow(canvasX - pointX2, 2) + Math.pow(canvasY - pointY2, 2));
-
-    if (distance2 <= 8) {
-      canEndDrag = true;
-    } else {
-      canEndDrag = false;
-    }
-
-    if (canStartDrag || canEndDrag) {
-      canRingDrag = false;
-      return;
-    }
-
-    const distance3 = twoPointDistance({ x: canvasX, y: canvasY }, { x: centerX, y: centerY });
-    let angle = Math.atan2(canvasY - canvasWidth / 2.0, canvasX - canvasWidth / 2.0)
-    if (distance3 > 80 && distance3 < 105 && startAngle < angle && angle < endAngle) {
-      canRingDrag = true;
-    }
-    lastAngle = angle;
-
-    drawCanvas(currentContext);
-  };
-
-  const handleTouchEnd = (e) => {
-    canStartDrag = false;
-    canEndDrag = false;
-    canRingDrag = false;
-    handleTouchMove(e)
-  }
-
-  const timelineItems = [
-    {
-      status: 'padding',
-      content: 'Item 1',
-      time: '10:00 AM',
-    },
-    {
-      status: 'done',
-      content: 'Item 2',
-      time: '11:00 AM',
-    },
-    {
-      status: 'un_done',
-      content: 'Item 3',
-      time: '12:00 PM',
-    },
-  ];
-
-  return <View style={{ width: '100%', height: 600, backgroundColor: 'white',display:'flex',flexDirection:'column' }}>
-    <Canvas canvasId={canvasId} id={canvasId} className={canvasId} type="2d"
-      style={{ width: 300, height: 300, zIndex: 0, backgroundColor: 'yellow' }}
-      onTouchMove={handleTouchMove}
-      onTouchEnd={handleTouchEnd}
-      onTouchStart={handleClick}
-      ref={canvasRef} />
-    <Timeline items={timelineItems} />
-    <RecordItem>
-      <Text>sldifjgsdgpsg</Text>
-    </RecordItem>
-
+  return <View style={{width:'100vw',height:'100vh',backgroundColor:'#000'}}>
+    <View style={{
+      width:200,
+      height:200,
+      marginTop:200,
+      borderRadius:32,
+      backgroundColor:'#1c1c1c'
+    }}></View>
   </View>
 }

+ 4 - 2
src/pages/rn/RNMain.tsx

@@ -3,8 +3,10 @@ import { NavigationContainer } from '@react-navigation/native';
 import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
 import { createStackNavigator } from '@react-navigation/stack';
 
-import Clock from '../clock/Clock'
+// import Clock from '../clock/Clock'
+import Login from '../account/Setting'
 import Profile from '../account/Profile'
+import { View } from '@tarojs/components';
 
 // 创建底部 Tab 导航器
 const Tab = createBottomTabNavigator();
@@ -49,7 +51,7 @@ export default function RNMain() {
     return (
         <NavigationContainer>
             <Tab.Navigator>
-                <Tab.Screen name="Clock" component={Clock} />
+                <Tab.Screen name="Clock" component={Login} />
                 <Tab.Screen name="Profile" component={Profile} />
             </Tab.Navigator>
         </NavigationContainer>

+ 1 - 1
src/services/http/api.js

@@ -1,4 +1,4 @@
-let online = true;
+let online = false;
 export let baseUrl = online ? 'https://api2.fast.liveplus.fun' : 'https://api.fast.dev.liveplus.fun';
 export let imgUrl = online
     ? 'https://api.fast.liveplus.fun/static/image/'

+ 1 - 1
src/services/http/request.ts

@@ -40,7 +40,7 @@ async function getStorage(key: string) {
 
 
 export async function request<T>(param: RequestParam): Promise<T> {
-    const kTimeout = 10000;
+    const kTimeout = 4000;
     const kRetryCount = 2;
 
     let retryCount = 0;

+ 3 - 1
src/services/trackTimeDuration.tsx

@@ -37,11 +37,13 @@ export const getChecks = () => {
 }
 
 export const getClocks = () => {
-    return new Promise((resolve) => {
+    return new Promise((resolve,reject) => {
         request({
             url: API_FAST_CLOCKS, method: 'GET', data: {}
         }).then(res => {
             resolve(res);
+        }).catch(e=>{
+            reject(e)
         })
     })
 }

+ 13 - 2
src/utils/common.scss

@@ -17,10 +17,21 @@ $boxPadding:40px;
 $historyItemMarginBottom:16px;
 
 
-
+/* #ifdef weapp */
 .fast_sleep_text {
     background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
     -webkit-background-clip: text;
     background-clip: text;
     color: transparent;
-}
+}
+
+/* #endif */
+
+/* #ifdef rn */
+.fast_sleep_text {
+    // background: linear-gradient(90deg, $fastColor 0%, $sleepColor 100%);
+    -webkit-background-clip: text;
+    background-clip: text;
+    color: transparent;
+}
+/* #endif */