RecordFastSleep.tsx 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. import Box from "@/components/layout/Box";
  2. import Header from "@/components/layout/Header";
  3. import Modal from "@/components/layout/Modal";
  4. import RecordItem from "@/features/common/RecordItem";
  5. import { delRecord } from "@/services/trackTimeDuration";
  6. import { ModalType } from "@/utils/types";
  7. import { View, Text, Image, PageContainer } from "@tarojs/components";
  8. import Taro from "@tarojs/taro";
  9. import { useEffect, useState, memo } from "react";
  10. import TimelineFastSleep from "./TimelineFastSleep";
  11. import { TimeFormatter } from "@/utils/time_format";
  12. import './RecordFastSleep.scss'
  13. import { bigRingRadius, getBgRing, getCommon, getDot, getReal, getTarget, ringWidth, smallRingRadius } from "../hooks/RingData";
  14. import Rings from "./Rings";
  15. import Segment from "@/components/navigation/Segment";
  16. import Stage from "./Stage";
  17. import CenterContentTitleModal from "@/features/common/CenterContentTitleModal";
  18. import { useTranslation } from "react-i18next";
  19. import { ColorType } from "@/context/themes/color";
  20. import TimelineStage from "./TimelineStage";
  21. import { jumpPage } from "../hooks/Common";
  22. import { RealRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
  23. import { rpxToPx } from "@/utils/tools";
  24. import { useDispatch, useSelector } from "react-redux";
  25. import { setSelID } from "@/store/common";
  26. import CircadianDetailPopup from "./CircadianDetailPopup";
  27. // import { sqrt } from 'mathjs'
  28. let AppState;
  29. if (process.env.TARO_ENV == 'rn') {
  30. AppState = require("react-native").AppState
  31. }
  32. let stageCanvasId = new Date().getTime()
  33. let startX = 0
  34. let startY = 0
  35. //https://www.php.cn/faq/629819.html
  36. // export default function RecordFastSleep(props: { data: any, type: string, delSuccess?: Function, index: any }) {
  37. const RecordFastSleep = memo((props: { data: any, type: string, index: number }) => {
  38. const [count, setCount] = useState(0)
  39. const [showDetailModal, setShowDetailModal] = useState(false)
  40. const [segmentIndex, setSegmentIndex] = useState(0)
  41. const [diffTimeZone, setDiffTimeZone] = useState(false)
  42. const [multiTimeZone, setMultiTimeZone] = useState(false)
  43. const [showMore, setShowMore] = useState(false)
  44. const [selIndex, setSelIndex] = useState(0)
  45. const [showMoreModal, setShowMoreModal] = useState(false)
  46. const [showDel, setShowDel] = useState(false)
  47. const { t } = useTranslation()
  48. var canvasId = props.data.id
  49. const record = props.data;
  50. const common = useSelector((state: any) => state.common);
  51. const dispatch = useDispatch();
  52. const handleAppStateChange = (nextAppState) => {
  53. checkTimezone()
  54. };
  55. useEffect(() => {
  56. checkTimezone()
  57. if (process.env.TARO_ENV == 'rn') {
  58. AppState.addEventListener('change', handleAppStateChange);
  59. }
  60. if (record.scenario != 'FAST_SLEEP') {
  61. setShowMore(false)
  62. setSelIndex(0)
  63. }
  64. if (props.index==-20000){
  65. global.refreshRecent = ()=>{
  66. setCount((index)=>index+1)
  67. }
  68. setTimeout(()=>{
  69. setCount((index)=>index+1)
  70. },100)
  71. }
  72. // console.log(sqrt(-4).toString())
  73. }, [props.data])
  74. useEffect(() => {
  75. if (common.recordSelID != props.data.id) {
  76. setShowDel(false)
  77. }
  78. }, [common.recordSelID])
  79. function checkTimezone() {
  80. var split = new Date().toString().split(' ');
  81. var currentTZ = split[split.length - 2];
  82. var isDiff = false;
  83. var isMulti = false;
  84. var tempTZ = '';
  85. if (props.data.fast) {
  86. if (props.data.fast.real_start_time_zone) {
  87. tempTZ = props.data.fast.real_start_time_zone
  88. if (props.data.fast.real_start_time_zone != currentTZ) {
  89. isDiff = true
  90. }
  91. }
  92. if (props.data.fast.real_end_time_zone) {
  93. if (tempTZ != props.data.fast.real_end_time_zone) {
  94. isMulti = true
  95. }
  96. if (props.data.fast.real_end_time_zone != currentTZ) {
  97. isDiff = true
  98. }
  99. }
  100. }
  101. if (props.data.sleep) {
  102. if (props.data.sleep.real_start_time_zone) {
  103. if (tempTZ == '') {
  104. tempTZ = props.data.sleep.real_start_time_zone
  105. }
  106. else if (tempTZ != props.data.sleep.real_start_time_zone) {
  107. isMulti = true
  108. }
  109. if (props.data.sleep.real_start_time_zone != currentTZ) {
  110. isDiff = true
  111. }
  112. }
  113. if (props.data.sleep.real_end_time_zone) {
  114. if (tempTZ != props.data.sleep.real_end_time_zone) {
  115. isMulti = true
  116. }
  117. if (props.data.sleep.real_end_time_zone != currentTZ) {
  118. isDiff = true
  119. }
  120. }
  121. }
  122. setDiffTimeZone(isDiff)
  123. setMultiTimeZone(isMulti)
  124. }
  125. function del() {
  126. var id = props.data.id
  127. delRecord(id
  128. ).then(res => {
  129. // global.refreshTime()
  130. global.indexPageRefresh()
  131. Taro.showToast({
  132. title: t('page.records_history.del_success')
  133. })
  134. dispatch(setSelID(-1))
  135. if (global.delFastSleep)
  136. global.delFastSleep(props.data)
  137. // props.delSuccess && props.delSuccess(props.data)
  138. // Taro.navigateBack()
  139. })
  140. }
  141. function subTitle(timestamp) {
  142. if (multiTimeZone) {
  143. return t('feature.common.multi_timezones')
  144. }
  145. if (diffTimeZone) {
  146. return t('feature.common.different_timezone')
  147. }
  148. return TimeFormatter.getDateAndWeek(timestamp)
  149. }
  150. function schedules() {
  151. var timestamp = props.data.first_real_check_time
  152. return <View style={{ display: 'flex', flexDirection: 'column' }}>
  153. <TimelineStage data={props.data} title={t('feature.track_time_duration.record_fast_sleep.pop_title')}
  154. subTitle={subTitle(timestamp)} first_real_check_time={timestamp} diffTimeZone={diffTimeZone} multiTimeZone={multiTimeZone} />
  155. </View>
  156. }
  157. function showDetail(e) {
  158. setShowDel(false);
  159. if (props.type == 'latest') {
  160. setSegmentIndex(0)
  161. global.segmentIndex = 0
  162. setShowDetailModal(true)
  163. return;
  164. }
  165. setShowDetailModal(true)
  166. }
  167. function getDuration(obj) {
  168. if (obj.status == 'NOT_STARTED' || obj.status == 'NOT_COMPLETED') {
  169. return ''
  170. }
  171. var start = obj.real_start_time
  172. var end = obj.real_end_time
  173. if (!end) {
  174. end = (new Date()).getTime()
  175. }
  176. return TimeFormatter.durationFormate(start, end)
  177. // return TimeFormatter.calculateTimeDifference(start, end)
  178. }
  179. function getStageDuration() {
  180. var start, end;
  181. switch (selIndex) {
  182. case 0:
  183. start = record.fast.real_start_time
  184. end = record.sleep.real_start_time
  185. break
  186. case 1:
  187. start = record.sleep.real_start_time
  188. end = record.sleep.real_end_time
  189. break
  190. case 2:
  191. start = record.sleep.real_end_time
  192. end = record.fast.real_end_time
  193. break
  194. }
  195. return TimeFormatter.durationFormate(start, end)
  196. }
  197. function durationArc(start_time: number, end_time: number) {
  198. var duration = (end_time - start_time) / 1000;
  199. return duration / (24 * 3600) * 2 * Math.PI;
  200. }
  201. function bigRing() {
  202. var common = getCommon(null, true)
  203. common.radius = bigRingRadius;
  204. common.lineWidth = ringWidth;
  205. var bgRing = getBgRing()
  206. if (props.type == 'record' || props.type == 'latest') {
  207. var realRing = getReal(record, true, true)
  208. if (props.data.status == 'ONGOING3') {
  209. realRing.color = 'rgba(0,0,0,0)'
  210. }
  211. if ((props.data.scenario == 'FAST' && props.data.fast.status == "NOT_COMPLETED") ||
  212. (props.data.scenario == 'SLEEP' && props.data.sleep.status == "NOT_COMPLETED")) {
  213. realRing.durationArc = 0.01
  214. }
  215. if (props.data.scenario=='FAST_SLEEP' && props.data.fast.status == "NOT_COMPLETED"){
  216. realRing.durationArc = 0.01
  217. }
  218. return <Rings common={common} bgRing={bgRing} canvasId={canvasId} realRing={realRing} />
  219. }
  220. else {
  221. var currentDot1 = getDot(record, true)
  222. var targetBigRing1 = getTarget(record, true)
  223. if (record.status == 'ONGOING') {
  224. var realRing1 = getReal(record, true, false)
  225. return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} realRing={realRing1} targetRing={targetBigRing1} canvasId={canvasId} />
  226. }
  227. if (record.status == 'WAIT_FOR_START') {
  228. return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} canvasId={canvasId} />
  229. }
  230. if (record.status == 'NOT_COMPLETED') {
  231. return <Rings common={common} bgRing={bgRing} currentDot={currentDot1} canvasId={canvasId} />
  232. }
  233. var realRing1 = getReal(record, true, false)
  234. return <Rings common={common} bgRing={bgRing} realRing={realRing1} currentDot={currentDot1} targetRing={targetBigRing1} canvasId={canvasId} />
  235. }
  236. }
  237. function bigMoreRing() {
  238. var common = getCommon(null, true)
  239. common.radius = bigRingRadius;
  240. common.lineWidth = ringWidth;
  241. var bgRing = getBgRing()
  242. var realRing = getReal(record, true, true)
  243. realRing.color = ColorType.fast + '66'
  244. var list: any = []
  245. if (record.scenario == 'FAST_SLEEP') {
  246. if (selIndex == 0) {
  247. const realRingBig: RealRing = {
  248. color: global.fastColor ? global.fastColor : ColorType.fast,
  249. startArc: startArc(record.fast.real_start_time),
  250. durationArc: durationArc(record.fast.real_start_time, record.sleep.real_start_time)
  251. }
  252. list.push(realRingBig)
  253. }
  254. if (selIndex == 1) {
  255. const realRingBig: RealRing = {
  256. color: global.fastColor ? global.fastColor : ColorType.fast,
  257. startArc: startArc(record.sleep.real_start_time),
  258. durationArc: durationArc(record.sleep.real_start_time, record.sleep.real_end_time)
  259. }
  260. list.push(realRingBig)
  261. }
  262. if (selIndex == 2) {
  263. const realRingBig: RealRing = {
  264. color: global.fastColor ? global.fastColor : ColorType.fast,
  265. startArc: startArc(record.sleep.real_end_time),
  266. durationArc: durationArc(record.sleep.real_end_time, record.fast.real_end_time)
  267. }
  268. list.push(realRingBig)
  269. }
  270. }
  271. return <Rings common={common} bgRing={bgRing} canvasId={stageCanvasId} stageList={list} realRing={realRing} />
  272. }
  273. const startArc = (time: number) => {
  274. var date = new Date(time);
  275. var hour = date.getHours();
  276. var minute = date.getMinutes();
  277. var second = date.getSeconds();
  278. return (hour * 3600 + minute * 60 + second) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
  279. }
  280. function smallRing() {
  281. if (record.scenario == 'FAST_SLEEP') {
  282. var common = getCommon(null, false)
  283. common.radius = smallRingRadius;
  284. common.lineWidth = ringWidth;
  285. var bgRing = getBgRing()
  286. var realRing = getReal(record, false, false)
  287. if (props.type == 'record' || props.type == 'latest') {
  288. var showReal = false;
  289. if (record.sleep.status == 'WAIT_FOR_END') {
  290. realRing.durationArc = durationArc(record.sleep.target_start_time, (new Date()).getTime())
  291. showReal = true
  292. // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
  293. }
  294. else if (record.sleep.status == 'NOT_COMPLETED') {
  295. realRing.durationArc = 0.01
  296. showReal = true
  297. // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
  298. }
  299. else if (record.sleep.status == 'COMPLETED') {
  300. realRing = getReal(record, false, true)
  301. showReal = true
  302. // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
  303. }
  304. return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={showReal ? realRing : null} />
  305. // if (record.sleep.status == 'WAIT_FOR_END') {
  306. // realRing.durationArc = durationArc(record.sleep.target_start_time, (new Date()).getTime())
  307. // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
  308. // }
  309. // else if (record.sleep.status == 'NOT_COMPLETED') {
  310. // realRing.durationArc = 0.01
  311. // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
  312. // }
  313. // else if (record.sleep.status == 'COMPLETED') {
  314. // realRing = getReal(record, false, true)
  315. // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} realRing={realRing} />
  316. // }
  317. // return <Rings common={common} bgRing={bgRing} canvasId={canvasId + 'small'} />
  318. }
  319. else {
  320. var currentDot = getDot(record, false)
  321. var targetRing = getTarget(record, false)
  322. if (record.status == 'ONGOING2') {
  323. var realRing = getReal(record, false, false)
  324. return <Rings common={common} bgRing={bgRing} realRing={realRing} currentDot={currentDot} targetRing={targetRing} canvasId={canvasId + 'small'} />
  325. }
  326. if (record.status == 'ONGOING3') {
  327. currentDot.color = 'rgba(0, 255, 255, 0.5)'
  328. }
  329. return <Rings common={common} bgRing={bgRing} currentDot={currentDot} canvasId={canvasId + 'small'} />
  330. }
  331. }
  332. return null
  333. }
  334. function rings() {
  335. return <View style={{ position: 'relative', zIndex: 1 }}>
  336. {
  337. bigRing()
  338. }
  339. <View style={{ display: 'flex', position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, alignItems: 'center', justifyContent: 'center' }}>
  340. {
  341. smallRing()
  342. }
  343. </View>
  344. </View>
  345. }
  346. function recordTime() {
  347. var timestamp = props.data.first_real_check_time
  348. if (props.data.first_time_zone) {
  349. timestamp = TimeFormatter.transferTimestamp(timestamp, props.data.first_time_zone)
  350. }
  351. return TimeFormatter.dateDescription(timestamp, true)
  352. }
  353. function getArrowText() {
  354. if (multiTimeZone) {
  355. return t('feature.common.multi_timezones')
  356. }
  357. if (diffTimeZone) {
  358. return t('feature.common.different_timezone')
  359. }
  360. return recordTime()
  361. }
  362. function tapStage(e, index) {
  363. stageCanvasId = new Date().getTime()
  364. setSelIndex(index);
  365. // setCount(pre=>pre+1);
  366. e.stopPropagation()
  367. }
  368. function moreStage() {
  369. var common = getCommon(null, false)
  370. common.radius = smallRingRadius;
  371. common.lineWidth = ringWidth;
  372. var bgRing = getBgRing()
  373. var realRing = getReal(record, false, true)
  374. return <View style={{ zIndex: 10000 }}>
  375. <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', position: 'relative' }}>
  376. {bigMoreRing()}
  377. <View style={{ display: 'flex', position: 'absolute', left: 0, width: 99, top: 0, height: 99, alignItems: 'center', justifyContent: 'center', zIndex: 10000 }}>
  378. <Rings common={common} bgRing={bgRing} canvasId={stageCanvasId + 'small'} realRing={realRing} />
  379. </View>
  380. <View className="duration_bg">
  381. {
  382. <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
  383. }
  384. {
  385. <Text className="duration_value" style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{getStageDuration()}</Text>
  386. }
  387. {
  388. <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
  389. }
  390. {
  391. <Text className="duration_value" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep }}>{getDuration(record.sleep)}</Text>
  392. }
  393. </View>
  394. </View>
  395. <View style={{ flex: 1, marginLeft: -rpxToPx(46), marginRight: -rpxToPx(46), marginTop: 20 }}>
  396. <View className={selIndex == 0 ? "single_check_sel" : "single_check_nor"} onClick={(e) => { tapStage(e, 0) }}>
  397. <Text className={selIndex == 0 ? "single_check_text_sel" : "single_check_text_nor"}>{t('feature.track_time_duration.stage.a')}</Text>
  398. {
  399. selIndex == 0 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
  400. }
  401. </View>
  402. <View className={selIndex == 1 ? "single_check_sel" : "single_check_nor"} onClick={(e) => { tapStage(e, 1) }}>
  403. <Text className={selIndex == 1 ? "single_check_text_sel" : "single_check_text_nor"}>{t('feature.track_time_duration.stage.b')}</Text>
  404. {
  405. selIndex == 1 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
  406. }
  407. </View>
  408. <View className={selIndex == 2 ? "single_check_sel" : "single_check_nor"} onClick={(e) => { tapStage(e, 2) }}>
  409. <Text className={selIndex == 2 ? "single_check_text_sel" : "single_check_text_nor"}>{t('feature.track_time_duration.stage.c')}</Text>
  410. {
  411. selIndex == 2 && <Image src={require('@assets/images/check_black.png')} className="single_checked" />
  412. }
  413. </View>
  414. </View>
  415. </View>
  416. }
  417. function recordDetail() {
  418. var fastDuration = ''
  419. var sleepDuration = ''
  420. var showFast = false;
  421. var showSleep = false;
  422. if (record.scenario == 'FAST_SLEEP') {
  423. fastDuration = getDuration(record.fast)
  424. sleepDuration = getDuration(record.sleep)
  425. if (record.status == 'ONGOING3') {
  426. fastDuration = t('feature.common.wait_for_end')
  427. }
  428. if (record.status == 'COMPLETED' && record.fast.status=='NOT_COMPLETED'){
  429. fastDuration = t('feature.common.not_completed')
  430. }
  431. if (record.sleep.status == "NOT_STARTED") {
  432. sleepDuration = t('feature.common.not_started')
  433. }
  434. else if (record.sleep.status == 'NOT_COMPLETED') {
  435. sleepDuration = t('feature.common.not_completed')
  436. }
  437. showFast = true
  438. showSleep = true
  439. }
  440. else if (record.scenario == 'FAST') {
  441. fastDuration = getDuration(record.fast)
  442. if (record.fast.status == 'NOT_COMPLETED') {
  443. fastDuration = t('feature.common.not_completed')
  444. }
  445. showFast = true
  446. }
  447. else {
  448. sleepDuration = getDuration(record.sleep)
  449. if (record.sleep.status == 'NOT_COMPLETED') {
  450. sleepDuration = t('feature.common.not_completed')
  451. }
  452. showSleep = true
  453. }
  454. return <View style={{ display: 'flex', flexDirection: 'column', margin: rpxToPx(8), boxSizing: 'border-box' }}>
  455. <View className="fast_sleep_item1">
  456. {
  457. rings()
  458. }
  459. <View className="duration_bg">
  460. {
  461. showFast && <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.fast')}</Text>
  462. }
  463. {
  464. showFast && <Text className="duration_value" style={{ color: global.fastColor ? global.fastColor : ColorType.fast }}>{fastDuration}</Text>
  465. }
  466. {
  467. showSleep && <Text className="duration_title">{t('feature.track_time_duration.record_fast_sleep.item.sleep')}</Text>
  468. }
  469. {
  470. showSleep && <Text className="duration_value" style={{ color: global.sleepColor ? global.sleepColor : ColorType.sleep }}>{sleepDuration}</Text>
  471. }
  472. </View>
  473. <View className="record_arrow_bg" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>
  474. <View style={{ flex: 1 }} />
  475. <Text className='recordTime'>{getArrowText()}</Text>
  476. <Image className="arrow2" src={require('@/assets/images/arrow3.png')} />
  477. </View>
  478. </View>
  479. </View>
  480. }
  481. function touchStart(e) {
  482. startX = e.touches[0].clientX
  483. startY = e.touches[0].clientY
  484. }
  485. function touchMove(e) {
  486. let x = startX
  487. let y = startY
  488. let deltaX = e.touches[0].clientX - x
  489. let deltaY = e.touches[0].clientY - y
  490. if (Math.abs(deltaX) > Math.abs(deltaY)) {
  491. if (deltaX < -60) {
  492. setShowDel(true)
  493. dispatch(setSelID(props.data.id))
  494. global.selId = props.data.id
  495. }
  496. else if (deltaX > 60) {
  497. setShowDel(false)
  498. // global.selId = -1
  499. }
  500. }
  501. }
  502. function touchEnd(e) {
  503. startX = 0
  504. }
  505. function modalContent() {
  506. if (process.env.TARO_ENV == 'weapp') {
  507. return <Modal
  508. testInfo={null}
  509. dismiss={() => {
  510. setShowDetailModal(false)
  511. }}
  512. confirm={() => { }}>
  513. {
  514. <CircadianDetailPopup
  515. record={record}
  516. onClose={() => setShowDetailModal(false)} />
  517. }
  518. </Modal>
  519. }
  520. else if (process.env.TARO_ENV == 'rn') {
  521. return <PageContainer style={{ backgroundColor: '#1c1c1c' }}
  522. // overlayStyle='background-color:rgba(0,0,0,0.9)'
  523. // custom-style='background-color:#1c1c1c'
  524. overlayStyle={{ backgroundColor: 'rgba(0,0,0,0.9)' }}
  525. customStyle={{ backgroundColor: '#1c1c1c' }}
  526. closeOnSlideDown={false}
  527. onBeforeEnter={() => {
  528. }}
  529. onBeforeLeave={() => {
  530. }}
  531. onClick={() => { alert('b') }}
  532. onClickOverlay={() => { alert('a') }}
  533. onAfterLeave={() => { setShowDetailModal(false) }}
  534. show={showDetailModal} round={true} overlay={true} position='bottom'
  535. >
  536. {
  537. <CircadianDetailPopup
  538. record={record}
  539. onClose={() => setShowDetailModal(false)} />
  540. }
  541. </PageContainer>
  542. }
  543. }
  544. return <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
  545. <View style={{ position: 'absolute', left: 0, top: 0, width: 0, height: 0, opacity: 0 }}>{count}</View>
  546. <View className='time_operate_item'
  547. onTouchStart={touchStart}
  548. onTouchMove={touchMove}
  549. onTouchEnd={touchEnd}
  550. >
  551. <RecordItem canDel={record.status == 'COMPLETED'} delete={del}
  552. onClick={showDetail}
  553. >{recordDetail()}
  554. </RecordItem>
  555. <View className={showDel ? 'btnDelete btnDeleteAni' : 'btnDelete'} onClick={del}>{t('feature.track_time_duration.record_fast_sleep.delete')}</View>
  556. </View>
  557. {/* {
  558. (props.type == 'record' || props.type == 'latest') &&
  559. record.scenario == 'FAST_SLEEP' &&
  560. record.sleep.status == 'COMPLETED' &&
  561. <View className="more_stage" onClick={(e) => {
  562. e.stopPropagation()
  563. setShowMoreModal(true)
  564. }}>
  565. <Text className="more_stage_text">{showMore ? '隐藏更多' : '显示更多'}</Text>
  566. </View>
  567. } */}
  568. {
  569. showDetailModal && modalContent()
  570. // showDetailModal && <Modal children={schedules()}
  571. // modalType={ModalType.center}
  572. // dismiss={() => setShowDetailModal(false)}
  573. // confirm={() => { }} />
  574. }
  575. {
  576. showMoreModal && <Modal children={moreStage()}
  577. modalType={ModalType.center}
  578. dismiss={() => setShowMoreModal(false)}
  579. confirm={() => { }} />
  580. }
  581. </View>
  582. })
  583. export default RecordFastSleep;