Leon 2 лет назад
Родитель
Сommit
13ac4c8544

+ 1 - 0
src/app.scss

@@ -189,6 +189,7 @@ page {
     flex-direction: column;
     align-items: center;
     justify-content: center;
+    border-radius: 36px;
     // border-radius: $boxBorderRadius;
     padding-left: 36px;
     padding-right: 36px;

+ 8 - 6
src/features/workout/Result.tsx

@@ -87,7 +87,9 @@ export default function Component() {
 
     function delData() {
         deleteWorkoutRecord({ id: (record as any).id }).then(res => {
-            global.delWorkoutRecord()
+            if (global.delWorkoutRecord) {
+                global.delWorkoutRecord()
+            }
             global.refreshWorkout()
             Taro.navigateBack()
         })
@@ -95,18 +97,18 @@ export default function Component() {
 
     return <View style={{ color: '#fff', display: 'flex', flexDirection: 'column' }}>
         <Text className="result_detail_text" style={{ color: router.params.themeColor }}>{router.params.title}</Text>
-        <Text className="result_detail_text" style={{color:'#fff',opacity:0.4,marginTop:rpxToPx(10),marginBottom:rpxToPx(20)}}>计时训练</Text>
+        <Text className="result_detail_text" style={{ color: '#fff', opacity: 0.4, marginTop: rpxToPx(10), marginBottom: rpxToPx(20) }}>计时训练</Text>
         <Text className="result_detail_text">训练统计</Text>
-        <View style={{marginLeft:rpxToPx(32),display:'flex',flexDirection:'column'}}>
+        <View style={{ marginLeft: rpxToPx(32), display: 'flex', flexDirection: 'column' }}>
             <Text>总量</Text>
             <Text style={{ color: router.params.themeColor }}>111</Text>
             <Text>用时</Text>
-            <View style={{flexDirection:'row',display:'flex',width:'100%'}}>
-                <View style={{display:'flex',flexDirection:'column',alignItems:'center',flex:1}}>
+            <View style={{ flexDirection: 'row', display: 'flex', width: '100%' }}>
+                <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', flex: 1 }}>
                     <Text style={{ color: router.params.themeColor }}>111</Text>
                     <Text>实际</Text>
                 </View>
-                <View style={{display:'flex',flexDirection:'column',alignItems:'center',flex:1}}>
+                <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', flex: 1 }}>
                     <Text style={{ color: router.params.themeColor }}>111</Text>
                     <Text>计划</Text>
                 </View>

+ 32 - 19
src/features/workout/WorkoutStopWatch.tsx

@@ -42,10 +42,12 @@ export default function Component(props: { targetCount: any, end: Function }) {
             Taro.getStorage({
                 key: 'lastWorkout', success: function (res) {
                     var workouts = JSON.parse(res.data)
+                    debugger
                     setGroups(workouts)
                     var workObj = workouts[workouts.length - 1]
+                    setIndex(workObj.index)
                     setStartTime(workObj.time)
-                    if (workObj.type=='REST'){
+                    if (workObj.type == 'REST') {
                         setIsDoing(false)
                     }
                 }, fail: function (err) {
@@ -236,9 +238,20 @@ export default function Component(props: { targetCount: any, end: Function }) {
             var obj = groups[i]
             var values: any = []
             if (obj.type == 'GROUP') {
-                values.push({
-                    value: getValue(obj.value, units[0].unit)
-                })
+                if (obj.value) {
+                    if (units) {
+                        values.push({
+                            value: getValue(obj.value, units[0].unit)
+                        })
+                    }
+                    else {
+                        values.push({
+                            value: obj.value
+                        })
+                    }
+
+                }
+
                 if (obj.value2) {
                     values.push({
                         value: getValue(obj.value2, units[1].unit)
@@ -355,32 +368,32 @@ export default function Component(props: { targetCount: any, end: Function }) {
         resume()
     }
 
-    function total(){
+    function total() {
         var count = 0
-        for (var i =0;i<groups.length;i++){
+        for (var i = 0; i < groups.length; i++) {
             var obj = groups[i]
-            if (obj.type=='REST'){
+            if (obj.type == 'REST') {
                 var temp = 0
-                if (obj.value){
-                    temp = parseInt(obj.value+'')
+                if (obj.value) {
+                    temp = parseInt(obj.value + '')
                 }
-                if (obj.value2){
-                    temp *=parseInt(obj.value2+'')
+                if (obj.value2) {
+                    temp *= parseInt(obj.value2 + '')
                 }
-                if (obj.value3){
-                    temp *= parseInt(obj.value3+'')
+                if (obj.value3) {
+                    temp *= parseInt(obj.value3 + '')
                 }
-                count+=temp
+                count += temp
             }
         }
         var unit = ''
         var array = workout.item.schemas[0].values
-        
-        for (var i=0;i<array.length;i++){
-            unit += array[i].unit+'·'
+
+        for (var i = 0; i < array.length; i++) {
+            unit += array[i].unit + '·'
         }
         debugger
-        return count+unit.substring(0,unit.length-1)
+        return count + unit.substring(0, unit.length - 1)
     }
 
     function pickerContent() {
@@ -411,7 +424,7 @@ export default function Component(props: { targetCount: any, end: Function }) {
                 if (index == 0) {
                     return <View />
                 }
-                return <View key={index} className={item.type == 'REST' ?'item_group':'item_group item_rest'} style={{  justifyContent: 'space-between', color: '#fff' }}>
+                return <View key={index} className={item.type == 'REST' ? 'item_group' : 'item_group item_rest'} style={{ justifyContent: 'space-between', color: '#fff' }}>
                     <Text>{item.type == 'REST' ? `第${item.index}组` : '组间休息'}</Text>
                     {item.type == 'REST' && <Text style={{ color: workout.item.theme_color }}>{item.value}{item.value2 ? 'x' + item.value2 : ''}{item.value3 ? 'x' + item.value3 : ''}</Text>}
                     <Text>{twoTimeDuration(groups[index - 1].time, item.time)}</Text>

+ 1 - 1
src/features/workout/WorkoutTimer.tsx

@@ -111,7 +111,7 @@ export default function Component() {
         str += (minutes > 10 ? minutes : '0' + minutes) + ''
         str += ':'
         str += (seconds > 10 ? seconds : '0' + seconds) + ''
-        setCountdown(str)
+        setCountdown(str+'')
         // console.log(left,str)
         // return str
     }