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