Leon 2 rokov pred
rodič
commit
6ecaa80d46

+ 3 - 0
src/app.config.ts

@@ -27,6 +27,9 @@ const appConfig = defineAppConfig({
       ]
     }
   ],
+  usingComponents:{
+    'mysvg':'./components/basic/svg'
+  },
   // tabBar: {
   //   custom: true,
   //   list:[

+ 25 - 0
src/app.scss

@@ -122,4 +122,29 @@ wx-scroll-view {
     opacity: 0.4;
     color: #fff;
     // background-color: pink;
+}
+
+
+
+@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);
+    }
 }

+ 37 - 0
src/components/basic/svg.js

@@ -0,0 +1,37 @@
+Component({
+  properties: {
+    src: String,
+    colors: Array
+  },
+  observers: {
+    'src, colors': function(src, colors) {
+      // 读取 src 链接资源
+      // wx.getFileSystemManager().readFile({
+      //   filePath: src,
+      //   encoding: 'binary',
+      //   success: res => {
+          let basestr
+          if (colors && colors.length) {
+            let a = 0
+            // 匹配 Hex 数值,并进行替换
+            basestr = src.replace(/#[a-zA-Z0-9]{3,6}/g, (word) => {
+              const newColor = colors[a]
+              a = a + 1
+              return newColor ? newColor : word
+            })
+          } else {
+            basestr = src
+          }
+          debugger
+          // 将 svg 数据进行 URL 编码
+          basestr = encodeURIComponent(basestr)
+          this.setData({
+            svgStyle: `background-image: url("data:image/svg+xml,${basestr}");`
+          })
+        },
+      //   fail:res=>{
+      //   }
+      // })
+    // }
+  }
+})

+ 4 - 0
src/components/basic/svg.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 3 - 0
src/components/basic/svg.wxml

@@ -0,0 +1,3 @@
+<block wx:if="{{svgStyle}}">
+    <view class="svg" style='{{svgStyle}}' />
+</block>

+ 7 - 0
src/components/basic/svg.wxss

@@ -0,0 +1,7 @@
+/* pages/component/svg.wxss */
+.svg {
+  background-repeat: no-repeat;
+  background-size: contain;
+  width: 100%;
+  height: 100%;
+}

+ 1 - 1
src/components/view/Timeline.config.ts

@@ -1,7 +1,7 @@
 export default definePageConfig({
     usingComponents: {
         // 'ec-canvas': '../../lib/ec-canvas/ec-canvas',
-        // 'MySVG':'../basic/svg'
+        'MySVG':'../basic/svg'
     },
     // "navigationBarTitleText": ""
 })

+ 11 - 9
src/components/view/Timeline.scss

@@ -88,7 +88,7 @@
   background-color: #FFFFFF66;
   position: absolute;
   top: 44px;
-  left: 14px;
+  left: 15px;
   bottom: 13px;
 
 }
@@ -101,7 +101,7 @@
 }
 
 
-.timelineItem{
+.timelineItem {
   position: relative;
   display: flex;
   flex-direction: column;
@@ -109,13 +109,13 @@
 }
 
 
-.timelineContentView{
+.timelineContentView {
   display: flex;
   flex-direction: row;
   align-items: center;
 }
 
-.timelineContentDetail{
+.timelineContentDetail {
   display: flex;
   flex-direction: row;
   align-items: center;
@@ -125,17 +125,19 @@
   width: 406px;
 }
 
-.timeline_line1{
+.timeline_line1 {
   width: 406px;
-  height: 1px;
+  height: 2px;
+  -webkit-transform: scaleY(0.5);
+  transform: scaleY(0.5);
   background-color: rgba(255, 255, 255, 0.1);
   margin-top: 20px;
 }
 
-.line1_bottom_space{
+.line1_bottom_space {
   margin-bottom: 24px;
 }
 
-.line1_bottom_zero{
+.line1_bottom_zero {
   margin-bottom: 20px;
-}
+}

+ 10 - 4
src/components/view/Timeline.tsx

@@ -6,20 +6,26 @@ import CheckBox from '../basic/CheckBox'
 
 export default function Component(props: { items: any[], title?: string, type?: TimelineType }) {
     function paddingIcon() {
-        // return <MySVG src='../../assets/svg/check.svg'/>
-        // return <svg  p-id="3547" width="200" height="200"><path d="M509.92 843.84C325.504 843.84 176 694.32 176 509.92 176 325.504 325.504 176 509.92 176c184.416 0 333.92 149.504 333.92 333.92 0 184.416-149.504 333.92-333.92 333.92z m0-48c157.904 0 285.92-128.016 285.92-285.92C795.84 352 667.808 224 509.92 224 352 224 224 352 224 509.92c0 157.904 128 285.92 285.92 285.92z" fill="#5A626A" p-id="3548"></path></svg>
+        return `<svg t="1701751531644" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3687" width="200" height="200">
+        <path d="M509.92 843.84C325.504 843.84 176 694.32 176 509.92 176 325.504 325.504 176 509.92 176c184.416 0 333.92 149.504 333.92 333.92 0 184.416-149.504 333.92-333.92 333.92z m0-48c157.904 0 285.92-128.016 285.92-285.92C795.84 352 667.808 224 509.92 224 352 224 224 352 224 509.92c0 157.904 128 285.92 285.92 285.92z" fill="#5A626A" p-id="3548">
+            </path></svg>`
     }
     function checkIcon() {
-        //<svg t="1701751531639" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3686" width="200" height="200"><path d="M682.928 402.992l11.312 11.328a16 16 0 0 1 0 22.624L484.96 646.24a16 16 0 0 1-22.624 0l-99.008-98.992a16 16 0 0 1 0-22.624l11.312-11.328a16 16 0 0 1 22.624 0l76.384 76.384 186.672-186.688a16 16 0 0 1 22.624 0zM512 800c159.056 0 288-128.944 288-288s-128.944-288-288-288-288 128.944-288 288 128.944 288 288 288z m0 48c-185.568 0-336-150.432-336-336s150.432-336 336-336 336 150.432 336 336-150.432 336-336 336z" fill="#000000" p-id="3687"></path></svg>
+        return `<svg t="1701751531639" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3686" width="200" height="200">
+        <path d="M682.928 402.992l11.312 11.328a16 16 0 0 1 0 22.624L484.96 646.24a16 16 0 0 1-22.624 0l-99.008-98.992a16 16 0 0 1 0-22.624l11.312-11.328a16 16 0 0 1 22.624 0l76.384 76.384 186.672-186.688a16 16 0 0 1 22.624 0zM512 800c159.056 0 288-128.944 288-288s-128.944-288-288-288-288 128.944-288 288 128.944 288 288 288z m0 48c-185.568 0-336-150.432-336-336s150.432-336 336-336 336 150.432 336 336-150.432 336-336 336z" fill="#000000" p-id="3687">
+            </path></svg>`
     }
 
     function cancelIcon() {
-        //<svg t="1701751580527" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3825" width="200" height="200"><path d="M553.936 504l79.2 79.2a16 16 0 0 1 0 22.624l-11.312 11.312a16 16 0 0 1-22.624 0l-79.2-79.2-79.2 79.2a16 16 0 0 1-22.624 0l-11.312-11.312a16 16 0 0 1 0-22.624l79.2-79.2-79.2-79.2a16 16 0 0 1 0-22.624l11.312-11.312a16 16 0 0 1 22.624 0l79.2 79.2 79.2-79.2a16 16 0 0 1 22.624 0l11.312 11.312a16 16 0 0 1 0 22.624l-79.2 79.2zM512 800c159.056 0 288-128.944 288-288s-128.944-288-288-288-288 128.944-288 288 128.944 288 288 288z m0 48c-185.568 0-336-150.432-336-336s150.432-336 336-336 336 150.432 336 336-150.432 336-336 336z" fill="#000000" p-id="3826"></path></svg>
+        return `<svg t="1701751580527" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3825" width="200" height="200">
+        <path d="M553.936 504l79.2 79.2a16 16 0 0 1 0 22.624l-11.312 11.312a16 16 0 0 1-22.624 0l-79.2-79.2-79.2 79.2a16 16 0 0 1-22.624 0l-11.312-11.312a16 16 0 0 1 0-22.624l79.2-79.2-79.2-79.2a16 16 0 0 1 0-22.624l11.312-11.312a16 16 0 0 1 22.624 0l79.2 79.2 79.2-79.2a16 16 0 0 1 22.624 0l11.312 11.312a16 16 0 0 1 0 22.624l-79.2 79.2zM512 800c159.056 0 288-128.944 288-288s-128.944-288-288-288-288 128.944-288 288 128.944 288 288 288z m0 48c-185.568 0-336-150.432-336-336s150.432-336 336-336 336 150.432 336 336-150.432 336-336 336z" fill="#000000" p-id="3826">
+            </path></svg>`
     }
     return <View className="timeline">
         {
             props.title && <Text className='timeline_title'>{props.title}</Text>
         }
+        {/* <MySVG src="../../assets/svg/check.svg"/> */}
         {
             props.items.map((item, index) => (
                 <View className='timelineItem'>

+ 3 - 1
src/features/trackTimeDuration/components/RecordFastSleep.scss

@@ -58,7 +58,7 @@
     margin-bottom: 12px;
 }
 
-.arrow1 {
+.arrow2 {
     width: 40px;
     height: 40px;
     opacity: 0.2;
@@ -82,4 +82,6 @@
     display: flex;
     flex-direction: row;
     align-items: center;
+    height: 40px;
+    width: 300px;
 }

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

@@ -264,8 +264,9 @@ export default function RecordFastSleep(props: { data: any, type: string, delSuc
             </View>
             {/* <Image className="arrow1" src={require('@/assets/images/arrow.png')} /> */}
             <View className="record_arrow_bg" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>
+                <View style={{flex:1}}/>
                 <Text className='recordTime'>{TimeFormatter.dateDescription(props.data.first_real_check_time, true)}</Text>
-                <Image className="arrow1" src={require('@/assets/images/arrow3.png')} />
+                <Image className="arrow2" src={require('@/assets/images/arrow3.png')} />
             </View>
 
         </View>

+ 4 - 2
src/features/trackTimeDuration/components/Schedule.scss

@@ -14,7 +14,7 @@
     font-weight: 400;
 }
 
-.duration_value{
+.duration_value2{
     font-size: 36px;
     line-height: 36px;
     font-weight: 500;
@@ -67,7 +67,9 @@
 
 .schedule_line{
     margin-bottom: 30px;
-    height: 1px;
+    height: 2px;
+    -webkit-transform: scaleY(0.5);
+        transform: scaleY(0.5);
     background-color: #fff;
     opacity: 0.1;
 }

+ 45 - 0
src/pages/account/Profile.scss

@@ -72,4 +72,49 @@
     font-size: 24px;
     line-height: 32px;
 
+}
+
+.px2Width {
+    width: 1px;
+    height: 50px;
+    background-color: #fff;
+    margin-left: 100px;
+}
+
+.px2Height {
+    display: flex;
+    width: 100px;
+    height: 1px;
+    background-color: #fff;
+
+}
+
+.px1Width {
+    width: 2px;
+    height: 50px;
+    background-color: #fff;
+    margin-left: 100px;
+
+    -webkit-transform: scaleX(0.5);
+    transform: scaleX(0.5);
+}
+
+.px1Height {
+    display: flex;
+    width: 100px;
+    height: 2px;
+    background-color: #fff;
+
+    -webkit-transform: scaleY(0.5);
+    transform: scaleY(0.5);
+}
+
+.px1Width::after {
+    -webkit-transform: scaleX(0.5);
+    transform: scaleX(0.5);
+}
+
+.px1Height::after {
+    -webkit-transform: scaleY(0.5);
+    transform: scaleY(0.5);
 }

+ 56 - 7
src/pages/account/Profile.tsx

@@ -1,7 +1,7 @@
 import Buttons from "@/components/basic/Buttons";
 import { delSession } from "@/services/common";
 import { clear, logout } from "@/services/user";
-import { View, Text, Image,Switch } from "@tarojs/components";
+import { View, Text, Image, Switch } from "@tarojs/components";
 import Taro, { useDidShow } from "@tarojs/taro";
 import { useDispatch, useSelector } from "react-redux";
 import './Profile.scss'
@@ -12,20 +12,21 @@ import { useTranslation } from "react-i18next";
 import TableCell from "@/components/layout/TableCell";
 import { useEffect, useState } from "react";
 
+
 export default function Page() {
     const dispatch = useDispatch();
     const { t } = useTranslation()
     const user = useSelector((state: any) => state.user);
-    const [switchOn,setSwitchOn] = useState(false)
+    const [switchOn, setSwitchOn] = useState(false)
 
-    useEffect(()=>{
+    useEffect(() => {
         var status = Taro.getStorageSync('isDebug')
         setSwitchOn(status)
-    },[])
+    }, [])
 
-    function switchChanged(e){
+    function switchChanged(e) {
         setSwitchOn(e.detail.value)
-        Taro.setStorageSync('isDebug',e.detail.value)
+        Taro.setStorageSync('isDebug', e.detail.value)
         global.isDebug = e.detail.value
     }
 
@@ -147,10 +148,58 @@ export default function Page() {
             }
             {
                 user.isLogin && user.test_user && <TableCell title="走查模式" >
-                    <Switch checked={switchOn} onChange={switchChanged}/>
+                    <Switch checked={switchOn} onChange={switchChanged} />
                 </TableCell>
             }
 
+            {/* <Text>未更改前的1px线</Text>
+            <View style={{ marginLeft: 100 }}>
+                <View className="px2Height" />
+                <View className="px2Width" />
+                <View className="px2Height" />
+                <View className="px2Width" />
+                <View className="px2Height" />
+                <View className="px2Width" />
+                <View className="px2Height" />
+                <View className="px2Width" />
+                <View className="px2Height" />
+                <View className="px2Width" />
+                <View className="px2Height" />
+                <View className="px2Width" />
+            </View>
+            <Text>更改后的1px线</Text>
+            <View style={{ marginLeft: 100 }}>
+                <View className="px1Height" />
+                <View className="px1Width" />
+                <View className="px1Height" />
+                <View className="px1Width" />
+                <View className="px1Height" />
+                <View className="px1Width" />
+                <View className="px1Height" />
+                <View className="px1Width" />
+                <View className="px1Height" />
+                <View className="px1Width" />
+                <View className="px1Height" />
+                <View className="px1Width" />
+            </View>
+            <Text>Svg Demo</Text>
+            <View style={{ background: 'red', width: 30, height: 30 }}>
+                
+                <mysvg src='<svg  t="1701751531644" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3687" width="200" height="200"><path d="M509.92 843.84C325.504 843.84 176 694.32 176 509.92 176 325.504 325.504 176 509.92 176c184.416 0 333.92 149.504 333.92 333.92 0 184.416-149.504 333.92-333.92 333.92z m0-48c157.904 0 285.92-128.016 285.92-285.92C795.84 352 667.808 224 509.92 224 352 224 224 352 224 509.92c0 157.904 128 285.92 285.92 285.92z" fill="#5A626A" p-id="3548"></path></svg>
+' colors={['blue']} />
+            </View>
+            <View style={{ background: 'red', width: 30, height: 30 }}>
+                
+                <mysvg src='<svg  t="1701751531644" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3687" width="200" height="200"><path d="M509.92 843.84C325.504 843.84 176 694.32 176 509.92 176 325.504 325.504 176 509.92 176c184.416 0 333.92 149.504 333.92 333.92 0 184.416-149.504 333.92-333.92 333.92z m0-48c157.904 0 285.92-128.016 285.92-285.92C795.84 352 667.808 224 509.92 224 352 224 224 352 224 509.92c0 157.904 128 285.92 285.92 285.92z" fill="#5A626A" p-id="3548"></path></svg>
+' colors={['yellow']} />
+            </View>
+            <View style={{ background: 'red', width: 30, height: 30 }}>
+                
+                <mysvg src='<svg  t="1701751531644" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3687" width="200" height="200"><path d="M509.92 843.84C325.504 843.84 176 694.32 176 509.92 176 325.504 325.504 176 509.92 176c184.416 0 333.92 149.504 333.92 333.92 0 184.416-149.504 333.92-333.92 333.92z m0-48c157.904 0 285.92-128.016 285.92-285.92C795.84 352 667.808 224 509.92 224 352 224 224 352 224 509.92c0 157.904 128 285.92 285.92 285.92z" fill="#5A626A" p-id="3548"></path></svg>
+' colors={['gray']} />
+            </View>
+            <View style={{ height: 200,display:'flex',flexShrink:0 }} /> */}
+
         </View>
     }
 

+ 1 - 0
src/pages/clock/Clock.config.ts

@@ -2,6 +2,7 @@ export default definePageConfig({
     usingComponents: {
         // 'ec-canvas': '../../lib/ec-canvas/ec-canvas',
         // 'demo':'../../components/demo'
+        'MySVG':'../../components/basic/svg'
     },
     "navigationBarTitleText": ""
 })

+ 4 - 1
src/pages/clock/Clock.tsx

@@ -372,7 +372,8 @@ export default function IndexPage() {
       }
     </View>
   }
-  //, 'search', 'clear'
+
+
   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' }}>
@@ -405,6 +406,8 @@ export default function IndexPage() {
             checkData && <TableCellHeader title={TimeFormatter.getDateAndWeek(new Date().getTime(),true)}></TableCellHeader>
           }
         </View> */}
+        
+
         {
           user.isLogin && checkData && schedule()
         }

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

@@ -1,5 +1,5 @@
-let online = false;
-export let baseUrl = online ? 'https://api.fast.liveplus.fun' : 'https://api.fast.dev.liveplus.fun';
+let online = true;
+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/'
     : 'https://api.fast.dev.liveplus.fun/static/image/';

+ 3 - 0
src/utils/time_format.ts

@@ -58,6 +58,9 @@ export class TimeFormatter {
   }
   //2.基于日期显示日期,省略今天描述
   static dateDescription(timestamp: number, showToday?: boolean): string {
+    if (!timestamp){
+      return ''
+    }
     const currentDate = new Date();
     const inputDate = new Date(timestamp);