|
@@ -19,6 +19,8 @@ import DurationPicker from "@/_health/components/duration_picker";
|
|
|
import Taro from "@tarojs/taro";
|
|
import Taro from "@tarojs/taro";
|
|
|
import { systemLocation } from "@/services/common";
|
|
import { systemLocation } from "@/services/common";
|
|
|
import { TimeFormatter } from "@/utils/time_format";
|
|
import { TimeFormatter } from "@/utils/time_format";
|
|
|
|
|
+import { clearLocation } from "@/services/user";
|
|
|
|
|
+import OnBoard from "@/_health/components/onboard";
|
|
|
|
|
|
|
|
let useNavigation;
|
|
let useNavigation;
|
|
|
let min = 0
|
|
let min = 0
|
|
@@ -383,7 +385,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
date: dayjs(t1).format('YYYYMMDD'),
|
|
date: dayjs(t1).format('YYYYMMDD'),
|
|
|
timestamp: t1,
|
|
timestamp: t1,
|
|
|
extra: {
|
|
extra: {
|
|
|
- set_time: global.set_time?global.set_time:new Date().getTime(),
|
|
|
|
|
|
|
+ set_time: global.set_time ? global.set_time : new Date().getTime(),
|
|
|
confirm_time: new Date().getTime()
|
|
confirm_time: new Date().getTime()
|
|
|
}
|
|
}
|
|
|
}]
|
|
}]
|
|
@@ -544,9 +546,23 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
switch (health.mode) {
|
|
switch (health.mode) {
|
|
|
case 'DAY':
|
|
case 'DAY':
|
|
|
list = day.timeline
|
|
list = day.timeline
|
|
|
|
|
+ if (active.onboard == false) {
|
|
|
|
|
+ return <OnBoard title='你还没有开启位置授权'
|
|
|
|
|
+ desc="获取准确的日出日落信息需要您开启微信运动授权,点击下方按钮进行授权"
|
|
|
|
|
+ btnTitle="去开启"
|
|
|
|
|
+ onClick={chooseLocation}
|
|
|
|
|
+ />
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
case 'NIGHT':
|
|
case 'NIGHT':
|
|
|
list = night.timeline
|
|
list = night.timeline
|
|
|
|
|
+ if (active.onboard == false) {
|
|
|
|
|
+ return <OnBoard title='你还没有开启位置授权'
|
|
|
|
|
+ desc='获取准确的日出日落信息需要您开启微信运动授权,点击下方按钮进行授权'
|
|
|
|
|
+ btnTitle="去开启"
|
|
|
|
|
+ onClick={chooseLocation}
|
|
|
|
|
+ />
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
case 'FAST':
|
|
case 'FAST':
|
|
|
list = fast.timeline
|
|
list = fast.timeline
|
|
@@ -560,28 +576,13 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
case 'ACTIVE':
|
|
case 'ACTIVE':
|
|
|
list = active.timeline
|
|
list = active.timeline
|
|
|
if (active.onboard == false) {
|
|
if (active.onboard == false) {
|
|
|
- return <View style={{
|
|
|
|
|
- display: 'flex',
|
|
|
|
|
- flexDirection: 'column',
|
|
|
|
|
- alignItems: 'center',
|
|
|
|
|
- justifyContent: 'center',
|
|
|
|
|
- }}>
|
|
|
|
|
- <Text>{list[0].title}</Text>
|
|
|
|
|
- <Text>Subtitle</Text>
|
|
|
|
|
- <View onClick={() => {
|
|
|
|
|
|
|
+ return <OnBoard title={list[0].title}
|
|
|
|
|
+ desc="Subtitle"
|
|
|
|
|
+ btnTitle="Action"
|
|
|
|
|
+ onClick={() => {
|
|
|
jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
|
|
jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
|
|
|
- }} style={{
|
|
|
|
|
- display: 'flex',
|
|
|
|
|
- flexDirection: 'column',
|
|
|
|
|
- alignItems: 'center',
|
|
|
|
|
- justifyContent: 'center',
|
|
|
|
|
- color: getThemeColor(health.mode),
|
|
|
|
|
- backgroundColor: getThemeColor(health.mode) + '1A',
|
|
|
|
|
- width: rpxToPx(347),
|
|
|
|
|
- height: rpxToPx(72),
|
|
|
|
|
- borderRadius: 9
|
|
|
|
|
- }}>Action</View>
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -651,6 +652,22 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
return ''
|
|
return ''
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function tapClearLocation() {
|
|
|
|
|
+ Taro.showModal({
|
|
|
|
|
+ title: '提示',
|
|
|
|
|
+ content: '确认清除位置数据?',
|
|
|
|
|
+ success: function (res) {
|
|
|
|
|
+ if (res.confirm) {
|
|
|
|
|
+ clearLocation().then(res => {
|
|
|
|
|
+ global.refreshWindow()
|
|
|
|
|
+ })
|
|
|
|
|
+ } else if (res.cancel) {
|
|
|
|
|
+ console.log('用户点击取消')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function chooseLocation() {
|
|
function chooseLocation() {
|
|
|
Taro.chooseLocation({
|
|
Taro.chooseLocation({
|
|
|
// latitude: authInfo && authInfo.lat ? authInfo.lat : undefined,
|
|
// latitude: authInfo && authInfo.lat ? authInfo.lat : undefined,
|
|
@@ -721,7 +738,7 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
}
|
|
}
|
|
|
{
|
|
{
|
|
|
health.mode == 'ACTIVE' && <View onClick={() => {
|
|
health.mode == 'ACTIVE' && <View onClick={() => {
|
|
|
- var list = getScenario(health.windows,health.mode).timeline
|
|
|
|
|
|
|
+ var list = getScenario(health.windows, health.mode).timeline
|
|
|
jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
|
|
jumpPage('/_health/pages/active_plan?schedule=' + JSON.stringify(list.length > 0 ? list[0] : '{}'))
|
|
|
}}>测试</View>
|
|
}}>测试</View>
|
|
|
}
|
|
}
|
|
@@ -731,8 +748,11 @@ export default function MainConsole(props: { type: WindowType }) {
|
|
|
{/* {
|
|
{/* {
|
|
|
(health.mode == 'EAT' || health.mode == 'ACTIVE') && <Text style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }} onClick={more}>更多</Text>
|
|
(health.mode == 'EAT' || health.mode == 'ACTIVE') && <Text style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }} onClick={more}>更多</Text>
|
|
|
} */}
|
|
} */}
|
|
|
- {
|
|
|
|
|
|
|
+ {/* {
|
|
|
(health.mode == 'DAY' || health.mode == 'NIGHT') && <Text onClick={chooseLocation}>选择位置</Text>
|
|
(health.mode == 'DAY' || health.mode == 'NIGHT') && <Text onClick={chooseLocation}>选择位置</Text>
|
|
|
|
|
+ } */}
|
|
|
|
|
+ {
|
|
|
|
|
+ (health.mode == 'DAY' || health.mode == 'NIGHT') && <Text onClick={tapClearLocation}>清除位置</Text>
|
|
|
}
|
|
}
|
|
|
<View className="main_footer_more" onClick={more}>
|
|
<View className="main_footer_more" onClick={more}>
|
|
|
<IconMore color="#b2b2b2" width={17} />
|
|
<IconMore color="#b2b2b2" width={17} />
|