record_log.tsx 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. import { View, Image, PageMeta, NavigationBar, Input, Textarea, ScrollView, Snapshot, PickerView, PickerViewColumn, Text } from "@tarojs/components";
  2. import './record_log.scss'
  3. import { useEffect, useState } from "react";
  4. import Taro, { useRouter, useShareAppMessage } from "@tarojs/taro";
  5. import { rpxToPx } from "@/utils/tools";
  6. import { IconAdd, IconArrow, IconCheck, IconClose } from "@/components/basic/Icons";
  7. import { MainColorType } from "@/context/themes/color";
  8. import { useTranslation } from "react-i18next";
  9. import showAlert from "@/components/basic/Alert";
  10. import showActionSheet from "@/components/basic/ActionSheet";
  11. import { BASE_IMG_URL, baseUrl } from "@/services/http/api";
  12. import { checkAuthorized } from "@/utils/check_authorized";
  13. import NewButton, { NewButtonType } from "@/_health/base/new_button";
  14. import dayjs from "dayjs";
  15. import { TimeFormatter } from "@/utils/time_format";
  16. import { useSelector } from "react-redux";
  17. import { addEvents, addUserTag, createMoment, eventDetail, updateMoment, userTags } from "@/services/health";
  18. import PostMomentTime from "@/_health/components/post_moment_time";
  19. import ShareBtn from "@/components/basic/ShareBtn";
  20. import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
  21. import ChooseActions from "@/pages/clock/components/choose_actions";
  22. import FollowInfo from "@/_moment/components/follow_info";
  23. import NewDateTimePicker from "@/_health/base/new_date_time_picker";
  24. import { IconCamera, IconClock } from "@/_record/components/record_icon";
  25. import PickerCard from "@/_record/components/picker_card";
  26. import LogTags from "./log_tags";
  27. let useRoute;
  28. let useNavigation;
  29. let LinearGradient;
  30. if (process.env.TARO_ENV == 'rn') {
  31. useRoute = require("@react-navigation/native").useRoute
  32. useNavigation = require("@react-navigation/native").useNavigation
  33. LinearGradient = require('react-native-linear-gradient').default
  34. }
  35. let useActionSheet;
  36. if (process.env.TARO_ENV == 'rn') {
  37. useActionSheet = require('@expo/react-native-action-sheet').useActionSheet
  38. }
  39. export default function RecordLog(props: {
  40. scenario,
  41. showPublish: any,
  42. contentHeight: number, imgs?: any, only_text?: any, quick?: any, join_id?: any,
  43. id?: any,
  44. edit?: any,
  45. check_in?: any,
  46. tags: any,
  47. }) {
  48. const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
  49. const navigationBarHeight = systemInfo.statusBarHeight + 44;
  50. const screenHeight = systemInfo.screenHeight
  51. const scale = '?x-oss-process=image/format,jpg/resize,w_400'
  52. const long = useSelector((state: any) => state.long);
  53. const health = useSelector((state: any) => state.health);
  54. const record = useSelector((state: any) => state.record);
  55. const user = useSelector((state: any) => state.user);
  56. const [title, setTitle] = useState('')
  57. const [chooseTitle, setChooseTitle] = useState('')
  58. const [desc, setDesc] = useState('')
  59. const [step, setStep] = useState(0)
  60. const { t } = useTranslation()
  61. const [time, setTime] = useState(dayjs().format('HH:mm'))
  62. const [selDate, setSelDate] = useState(dayjs().format('YYYY-MM-DD'))
  63. const [enterTimestmap] = useState(new Date().getTime())
  64. const [posting, setPosting] = useState(false)
  65. const [showTimePicker, setShowTimePicker] = useState(false)
  66. const [result, setResult] = useState<any>(null)
  67. const [showResult, setShowResult] = useState(false)
  68. const [tags, setTags] = useState<any>([])
  69. const [selPostCount, setPostCount] = useState(1)
  70. const [showChoose, setShowChoose] = useState(false)
  71. const [selTag, setSelTag] = useState<any>(null)
  72. const [loading, setLoading] = useState(false)
  73. let showActionSheetWithOptions;
  74. if (process.env.TARO_ENV == 'rn') {
  75. showActionSheetWithOptions = useActionSheet()
  76. }
  77. let router
  78. let navigation;
  79. if (useNavigation) {
  80. navigation = useNavigation()
  81. }
  82. if (process.env.TARO_ENV == 'rn') {
  83. router = useRoute()
  84. }
  85. else {
  86. router = useRouter()
  87. }
  88. const { scenario, imgs, only_text, quick, join_id } = props
  89. const [pics, setPics] = useState<any>(imgs ? JSON.parse(imgs) : [])
  90. const [focus, setFocus] = useState(only_text ? true : false)
  91. const [inputFocus, setInputFocus] = useState(false)
  92. if (process.env.TARO_ENV == 'weapp') {
  93. useShareAppMessage((e) => {
  94. var path;
  95. if (result && result.event_id) {
  96. var sharePath = `/_health/pages/timeline_detail?type=recent&fast_type=IF&event_id=${result.event_id}&uid=${user.id}&isfastsleep=${0}&disable_edit=1&enter_type=share`
  97. if (user.isLogin) {
  98. sharePath += `&share_uid=${user.id}`
  99. }
  100. path = sharePath
  101. }
  102. else {
  103. path = 'pages/clock/Clock'
  104. }
  105. return {
  106. title: '分享标题',
  107. path: path,
  108. // imageUrl: shareUrl
  109. }
  110. })
  111. }
  112. useEffect(() => {
  113. global.set_time = new Date().getTime()
  114. getTags()
  115. if (props.check_in == 1) {
  116. setStep(0)
  117. }
  118. // if (router.params.quick) {
  119. // quickSave()
  120. // }
  121. if (props.edit) {
  122. eventDetail(props.id).then(res => {
  123. setTitle((res as any).title)
  124. setChooseTitle((res as any).title)
  125. if ((res as any).moment) {
  126. setDesc((res as any).moment.description)
  127. if ((res as any).moment.media && (res as any).moment.media.length > 0) {
  128. setPics((res as any).moment.media)
  129. }
  130. }
  131. if ((res as any).time) {
  132. setSelDate(dayjs((res as any).time.start_timestamp).format('YYYY-MM-DD'))
  133. setTime(dayjs((res as any).time.start_timestamp).format('HH:mm'))
  134. }
  135. })
  136. }
  137. }, [])
  138. useEffect(() => {
  139. if (step == 1) {
  140. setTimeout(() => {
  141. setInputFocus(true)
  142. }, 300)
  143. }
  144. }, [step])
  145. function getTags() {
  146. setTags(props.tags)
  147. // userTags({ scenario: scenario }).then(res => {
  148. // if (chooseTitle == '' && !props.edit) {
  149. // var current = dayjs().format('HH:mm');
  150. // var isFind = false;
  151. // (res as any).tags.map(item => {
  152. // if (item.time_from && item.time_to) {
  153. // if (isInTimeRange(current, item.time_from, item.time_to)) {
  154. // isFind = true;
  155. // setTitle(item.title)
  156. // setChooseTitle(item.title)
  157. // setPostCount(item.log_count + 1)
  158. // }
  159. // }
  160. // })
  161. // if (!isFind) {
  162. // setTitle((res as any).tags[0].title)
  163. // setChooseTitle((res as any).tags[0].title)
  164. // setPostCount((res as any).tags[0].log_count + 1)
  165. // }
  166. // }
  167. // setTags((res as any).tags)
  168. // })
  169. }
  170. function isInTimeRange(currentTime, startTime, endTime) {
  171. // 将时间字符串转换为 Date 对象
  172. const current = new Date(`1970-01-01T${currentTime}:00`);
  173. const start = new Date(`1970-01-01T${startTime}:00`);
  174. const end = new Date(`1970-01-01T${endTime}:00`);
  175. // 如果结束时间小于开始时间,说明时间段跨越了午夜
  176. if (end < start) {
  177. end.setDate(end.getDate() + 1); // 将结束时间加一天
  178. if (current < start) {
  179. current.setDate(current.getDate() + 1); // 如果当前时间在午夜之前,加一天
  180. }
  181. }
  182. // 判断当前时间是否在时间段内
  183. return current >= start && current < end;
  184. }
  185. function addTag() {
  186. addUserTag({ scenario: scenario, title: title }).then(res => {
  187. getTags()
  188. })
  189. }
  190. function tapPic() {
  191. //, t('health.delete')
  192. var list = process.env.TARO_ENV == 'weapp' ? [t('health.add_photos'), t('health.camera2'), t('health.import_chat')] :
  193. [t('health.add_photos'), t('health.camera2')]
  194. showActionSheet({
  195. title: '',
  196. showActionSheetWithOptions: showActionSheetWithOptions,
  197. itemList: list,
  198. success: function (res) {
  199. switch (res) {
  200. case 0:
  201. addImage(false)
  202. break;
  203. case 1:
  204. addImage(true)
  205. break;
  206. case 2:
  207. Taro.chooseMessageFile({
  208. count: 9 - pics.length,
  209. type: 'image',
  210. success: async function (res) {
  211. const results = await Promise.all(res.tempFiles.map(getImageInfo));
  212. chooseSuccess(results, true)
  213. },
  214. fail(res) {
  215. },
  216. })
  217. break;
  218. case 3:
  219. // setImgUrl('')
  220. break;
  221. }
  222. }
  223. })
  224. }
  225. function addImage(isCamera) {
  226. var source: any = isCamera ? ['camera'] : ['album']
  227. Taro.chooseImage({
  228. count: 9 - pics.length,
  229. sizeType: ['compressed'],
  230. // mediaType: ['image'],
  231. sourceType: source,
  232. success: async function (res) {
  233. const results = await Promise.all(res.tempFiles.map(getImageInfo));
  234. chooseSuccess(results, true)
  235. // checkAuthorized()
  236. },
  237. fail: function (res) {
  238. }
  239. })
  240. }
  241. async function chooseSuccess(res, isAlbum) {
  242. // const filePaths = res.map(file => file.path
  243. // // process.env.TARO_ENV === 'rn' || isFilePath ? file.path : file.tempFilePath
  244. // )
  245. Taro.showLoading({
  246. title: t('health.uploading')
  247. })
  248. try {
  249. const uploadedUrls = await Promise.all(res.map(path => uploadFile2(path, isAlbum ? 'album' : 'camera')))
  250. setPics([...pics, ...uploadedUrls])
  251. Taro.hideLoading()
  252. } catch (error) {
  253. console.error('Error uploading files:', error)
  254. Taro.hideLoading()
  255. }
  256. }
  257. function uploadFile2(obj: any, source: string): Promise<string> {
  258. return new Promise((resolve, reject) => {
  259. var path = obj.path
  260. const dot = path.lastIndexOf('.')
  261. const fileExt = dot > 0 ? path.substring(dot) : ''
  262. Taro.request({
  263. method: 'GET',
  264. timeout: 30000,
  265. url: `${baseUrl}/api/thirdparty/aliyun/oss-form-upload`,
  266. header: {
  267. 'Authorization': 'bearer ' + global.token
  268. },
  269. data: {
  270. type: 'FOOD_JOURNAL',
  271. file_ext: fileExt
  272. },
  273. success: (rsp) => {
  274. if (rsp.statusCode !== 200) {
  275. reject(new Error(t('health.networkError')))
  276. return
  277. }
  278. Taro.uploadFile({
  279. timeout: 30000,
  280. url: rsp.data.upload_url,
  281. filePath: path,
  282. name: 'file',
  283. formData: rsp.data.fields,
  284. success: () => {
  285. var temp = JSON.parse(JSON.stringify(obj))
  286. temp.url = rsp.data.view_url
  287. // resolve(rsp.data.view_url)
  288. resolve(temp)
  289. },
  290. fail: (error) => {
  291. reject(error)
  292. }
  293. })
  294. },
  295. fail: reject
  296. })
  297. })
  298. }
  299. const getImageInfo = (src) => {
  300. const { tempFilePath, path } = src
  301. return new Promise((resolve) => {
  302. Taro.getImageInfo({
  303. src: tempFilePath ? tempFilePath : path,
  304. success: (result) => resolve({
  305. height: result.height,
  306. width: result.width,
  307. orientation: result.orientation,
  308. path: result.path,
  309. type: result.type
  310. }),
  311. fail: (error) => resolve({
  312. height: 1024,
  313. width: 1024,
  314. orientation: 'up',
  315. path: tempFilePath,
  316. type: 'unknown'
  317. }),
  318. });
  319. });
  320. };
  321. function quickSave() {
  322. }
  323. function save() {
  324. if (props.edit) {
  325. edit()
  326. return
  327. }
  328. var date = TimeFormatter.stringToDate(selDate, time)
  329. date.setMilliseconds(new Date(enterTimestmap).getMilliseconds())
  330. var params: any = {
  331. scenario: scenario, //ACTIVITY
  332. type: 'POINT',
  333. sub_type: scenario,
  334. title: chooseTitle,
  335. time: {
  336. start_timestamp: date.getTime()
  337. }
  338. }
  339. if (join_id) {
  340. params.join_key = join_id
  341. }
  342. var moment: any = {
  343. description: desc,
  344. }
  345. if (pics.length > 0) {
  346. var picList: any = []
  347. pics.map((item) => {
  348. picList.push({
  349. url: item.url,
  350. type: item.url.indexOf('mp4') != -1 ? 'video' : 'image',
  351. source: 'album',
  352. width: item.width,
  353. height: item.height,
  354. format: item.format
  355. })
  356. })
  357. moment.media = picList
  358. }
  359. params.moment = moment
  360. // if (event_id && event_id != 'undefined') {
  361. // params.event_id = event_id
  362. // }
  363. // if (is_temp) {
  364. // params.event = window == 'EAT' ? 'EAT_CUSTOM' : 'ACTIVE_CUSTOM'
  365. // }
  366. // params.op_page = window == 'EAT' ? 'HOME_EAT' : 'HOME_ACTIVE'
  367. params.extra = {
  368. set_time: global.set_time ? global.set_time : new Date().getTime(),
  369. confirm_time: new Date().getTime()
  370. }
  371. if (posting) return
  372. setPosting(true)
  373. // Taro.showLoading({
  374. // title: t('health.uploading')
  375. // })
  376. addEvents(params).then(res => {
  377. setShowResult(true)
  378. setResult(res)
  379. setPosting(false)
  380. // Taro.hideLoading()
  381. Taro.reLaunch({
  382. url: '/pages/moment/moment'
  383. })
  384. }).catch(e => {
  385. setPosting(false)
  386. // Taro.hideLoading()
  387. })
  388. // createMoment(params).then(res => {
  389. // // setTimeout(() => {
  390. // setPosting(false)
  391. // Taro.eventCenter.trigger('refreshMoments', '')
  392. // // }, 1000)
  393. // if (process.env.TARO_ENV == 'weapp') {
  394. // // Taro.navigateBack();
  395. // Taro.redirectTo({
  396. // url: '/_health/pages/post_result?data=' + JSON.stringify(res)
  397. // })
  398. // // Taro.navigateTo({
  399. // // url:'/_health/pages/post_result?data=' + JSON.stringify(res)
  400. // // })
  401. // }
  402. // // global.refreshWindow()
  403. // // global.refreshHistory()
  404. // // if (global.postMomentSuccess) {
  405. // // global.postMomentSuccess()
  406. // // }
  407. // }).catch(e => {
  408. // setPosting(false)
  409. // })
  410. }
  411. function edit() {
  412. var date = TimeFormatter.stringToDate(selDate, time)
  413. date.setMilliseconds(new Date(enterTimestmap).getMilliseconds())
  414. var params: any = {
  415. id: router.params.id,
  416. scenario: scenario, //ACTIVITY
  417. type: 'POINT',
  418. sub_type: scenario,
  419. title: chooseTitle,
  420. time: {
  421. start_timestamp: date.getTime()
  422. }
  423. }
  424. if (join_id) {
  425. params.join_key = join_id
  426. }
  427. var moment: any = {
  428. description: desc,
  429. }
  430. if (pics.length > 0) {
  431. var picList: any = []
  432. pics.map((item) => {
  433. picList.push({
  434. url: item.url,
  435. type: item.url.indexOf('mp4') != -1 ? 'video' : 'image',
  436. source: 'album',
  437. width: item.width,
  438. height: item.height,
  439. format: item.format
  440. })
  441. })
  442. moment.media = picList
  443. }
  444. else {
  445. moment.media = []
  446. }
  447. params.moment = moment
  448. params.extra = {
  449. set_time: global.set_time ? global.set_time : new Date().getTime(),
  450. confirm_time: new Date().getTime()
  451. }
  452. if (posting) return
  453. setPosting(true)
  454. // Taro.showLoading({
  455. // title: t('health.uploading')
  456. // })
  457. addEvents(params).then(res => {
  458. setShowResult(true)
  459. setResult(res)
  460. setPosting(false)
  461. Taro.eventCenter.trigger('refresh_timeline', (res as any).feed_item)
  462. if (global.refreshHistory) {
  463. global.refreshHistory()
  464. }
  465. process.env.TARO_ENV == 'weapp' ? Taro.navigateBack() : navigation.goBack()
  466. // Taro.hideLoading()
  467. // Taro.reLaunch({
  468. // url: '/pages/moment/moment'
  469. // })
  470. }).catch(e => {
  471. setPosting(false)
  472. // Taro.hideLoading()
  473. })
  474. }
  475. function getDate() {
  476. var sel = dayjs(selDate)
  477. var now = dayjs().format('YYYY-MM-DD')
  478. const yesterday = dayjs().subtract(1, 'day');
  479. if (sel.format('YYYY-MM-DD') == now) {
  480. return ''
  481. }
  482. if (yesterday.format('YYYY-MM-DD') == sel.format('YYYY-MM-DD')) {
  483. return global.language == 'en' ? 'Yesterday ' : '昨天 '
  484. }
  485. else {
  486. return global.language == 'en' ? sel.format('MMM D ') : sel.format('MMMD日 ')
  487. }
  488. }
  489. function getBackground() {
  490. var time = record.time
  491. if (!time) return '#fff'
  492. const { background_colors } = time
  493. if (!background_colors) {
  494. return '#fff'
  495. }
  496. else if (background_colors.length == 1) {
  497. return background_colors[0]
  498. }
  499. return `linear-gradient(to bottom, ${background_colors[0]}, ${background_colors[1]})`
  500. }
  501. if (quick) {
  502. // return <QuickLog tag={chooseTitle} scenario={scenario} updateTag={() => {
  503. // }} />
  504. }
  505. return <ScrollView style={{ position: 'relative', zIndex: 1000, height: props.contentHeight }} scrollY>
  506. <View style={{ position: 'relative', overflow: showChoose ? 'hidden' : 'visible' }}>
  507. {
  508. step == 0 && <LogTags tags={tags} scenario={scenario} showPublish={
  509. (scenario, item, addTag) => {
  510. props.showPublish(scenario, item, tags, addTag)
  511. }
  512. } />
  513. }
  514. {
  515. step == 1 && <View className="cardShowAni" style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', marginTop: rpxToPx(300) }}>
  516. <View className="input_form">
  517. <Input className="input_content h36" placeholder={t('health.custom_name')} value={title}
  518. placeholderClass="input_content_placeholder"
  519. focus={inputFocus}
  520. autoFocus={inputFocus}
  521. maxlength={30}
  522. onBlur={() => {
  523. setInputFocus(false)
  524. }}
  525. onInput={(e: any) => {
  526. setTitle(e.target.value)
  527. setChooseTitle(e.target.value)
  528. }} />
  529. <View className="form_btns">
  530. <View className="form_cancel">
  531. <NewButton btnStyle={{ flex: 1 }} type={NewButtonType.img}
  532. onClick={() => {
  533. if (!user.isLogin) {
  534. jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
  535. return
  536. }
  537. setStep(0)
  538. }}
  539. >
  540. <View className="h30 bold">{t('health.cancel')}</View>
  541. </NewButton>
  542. </View>
  543. <View className="form_cancel">
  544. <NewButton btnStyle={{ flex: 1 }} type={NewButtonType.img}
  545. onClick={() => {
  546. if (title.length == 0) return
  547. if (!user.isLogin) {
  548. jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
  549. return
  550. }
  551. props.showPublish(props.scenario, { title: title }, tags, false)
  552. setStep(0)
  553. // setChooseTitle(title)
  554. // setPostCount(1)
  555. // setStep(2)
  556. // addTag()
  557. }}
  558. >
  559. <View className={title.length == 0 ? 'form_cancel form_confirm h30 bold' : 'form_cancel h30 bold'}
  560. >{t('health.confirm')}</View>
  561. </NewButton>
  562. </View>
  563. </View>
  564. </View>
  565. </View>
  566. }
  567. {
  568. step == 2 && <View className="cardShowAni" style={{ paddingTop: rpxToPx(26) }}>
  569. <View className="content_card">
  570. <View style={{ display: 'flex', flexDirection: 'row' }} >
  571. <NewButton type={NewButtonType.custom}
  572. onClick={() => {
  573. if (!user.isLogin) {
  574. jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
  575. return
  576. }
  577. setStep(0)
  578. setFocus(false)
  579. }}>
  580. <View className="sel_tag">
  581. <View className="h34 bold">{chooseTitle}</View>
  582. <View style={{ width: rpxToPx(6) }} />
  583. <IconArrow width={rpxToPx(34)} color='#000' />
  584. </View>
  585. </NewButton>
  586. </View>
  587. <Textarea placeholder={t('health.add_text')} className="textarea2 h44"
  588. placeholder-style="color:rgba(0,0,0,0.2)"
  589. value={desc}
  590. focus={focus}
  591. onBlur={() => {
  592. setFocus(false)
  593. }}
  594. onInput={e => {
  595. setDesc(e.detail.value)
  596. }} />
  597. <View className="form2">
  598. {
  599. pics.map((item, index) => {
  600. return <View className="cover1" key={index}>
  601. <Image src={item.url + scale} mode="aspectFill" className="cover2" key={index} onClick={() => {
  602. Taro.previewImage({
  603. current: pics[index].url,
  604. urls: pics.map(file => file.url)
  605. })
  606. }} />
  607. <View className="cover_del" onClick={() => {
  608. if (!user.isLogin) {
  609. jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
  610. return
  611. }
  612. showAlert({
  613. title: t('health.del_title'),
  614. content: '',
  615. cancelText: t('health.del_cancel'),
  616. confirmText: t('health.del_confirm'),
  617. showCancel: true,
  618. confirm: () => {
  619. var array = JSON.parse(JSON.stringify(pics))
  620. array.splice(index, 1)
  621. setPics(array)
  622. }
  623. })
  624. }}>
  625. <View className="cover_del_btn">
  626. <IconClose width={10} height={10} color="#fff" />
  627. </View>
  628. </View>
  629. </View>
  630. })
  631. }
  632. {
  633. pics.length < 9 && <NewButton
  634. type={NewButtonType.custom}
  635. onClick={tapPic}>
  636. <View className="cover1" style={{}}><IconCamera color="#000" width={rpxToPx(48)} /></View>
  637. </NewButton>
  638. }
  639. </View>
  640. </View>
  641. <View className="time_view" onClick={() => {
  642. if (!user.isLogin) {
  643. jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth', navigation)
  644. return
  645. }
  646. setShowTimePicker(true)
  647. }}>
  648. <IconClock width={rpxToPx(36)} color={MainColorType.black_25} />
  649. <View className="h30" style={{ opacity: 0.25, marginLeft: rpxToPx(12) }}>{t('health.time')}</View>
  650. <View style={{ flex: 1 }} />
  651. <View className="h30" style={{ opacity: 0.25 }}>{getDate() + time}</View>
  652. <IconArrow width={rpxToPx(34)} color={MainColorType.black_25} />
  653. <View className="border_footer_line" style={{ left: rpxToPx(48) }} />
  654. </View>
  655. {
  656. join_id && <FollowInfo user={long.follow} />
  657. }
  658. <View style={{ width: 300 }}>
  659. </View>
  660. </View>
  661. }
  662. {
  663. step == 2 && <View className="main_footer" style={{ backgroundColor: 'transparent' }}>
  664. <NewButton
  665. type={NewButtonType.fill}
  666. color={MainColorType.orange}
  667. width={rpxToPx(646)}
  668. height={rpxToPx(108)}
  669. title={t('health.share_to_moment')}
  670. onClick={save}
  671. />
  672. </View>
  673. }
  674. {
  675. showTimePicker && <PickerCard onClose={() => { setShowTimePicker(false) }}
  676. value={new Date(selDate + 'T' + time + ':00').getTime()}
  677. title={global.language == 'en' ? 'Choose Time' : "选择时间"}
  678. type="datetime"
  679. onConfirm={(e) => {
  680. setSelDate(dayjs(e).format('YYYY-MM-DD'))
  681. setTime(dayjs(e).format('HH:mm'))
  682. setShowTimePicker(false)
  683. }}
  684. />
  685. }
  686. </View >
  687. </ScrollView>
  688. }