leon 1 ano atrás
pai
commit
735fc29011

+ 3 - 3
src/_health/base/new_date_time_picker.tsx

@@ -148,11 +148,11 @@ export default function NewDateTimePicker(props: {
     }
     if (!loaded) return <View />
 
-    const bgStyle = `background-color: ${props.color}1A !important;`
+    const bgStyle = `background-color: ${props.color}0D !important;`
     return <PickerView
         value={values}
         // itemStyle={{ color: '#000' }}
-        style={{ color: '#000', height: rpxToPx(340), width: rpxToPx(618) }}
+        style={{ color: '#000', height: rpxToPx(340), width: rpxToPx(578) }}
         onChange={onPickerChange}
         indicatorClass="pick_sel_item"
         indicatorStyle={bgStyle}//""
@@ -165,7 +165,7 @@ export default function NewDateTimePicker(props: {
                 return <PickerViewColumn key={index}>
                     {item.map((obj, j) => {
                         return (
-                            <Text key={j} style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', color: getColor(index, j) ? props.color ?? MainColorType.fast : '#000' }}>{obj}</Text>
+                            <Text key={j} style={{ display: 'flex',fontSize:rpxToPx(36), alignItems: 'center', justifyContent: 'center', color: getColor(index, j) ? props.color ?? MainColorType.fast : '#000' }}>{obj}</Text>
                         );
                     })}
                 </PickerViewColumn>

+ 3 - 3
src/_health/base/new_durationpicker.tsx

@@ -153,10 +153,10 @@ export default function NewDurationPicker(props: { value?: any, onChange?: any,
     }
     if (!loaded) return <View />
 
-    const bgStyle = `background-color: ${props.color}1A !important;`
+    const bgStyle = `background-color: ${props.color}0D !important;`
     return <PickerView
         value={values}
-        style={{ color: '#000', height: rpxToPx(340), width: rpxToPx(618) }}
+        style={{ color: '#000', height: rpxToPx(340), width: rpxToPx(578) }}
         onChange={onPickerChange}
         indicatorClass="pick_sel_item"
         indicatorStyle={bgStyle}//""
@@ -169,7 +169,7 @@ export default function NewDurationPicker(props: { value?: any, onChange?: any,
                 return <PickerViewColumn key={index}>
                     {item.map((obj, j) => {
                         return (
-                            <Text key={j} style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', color: getColor(index, j) ? props.color ?? MainColorType.fast : '#000' }}>{obj}</Text>
+                            <Text key={j} style={{ display: 'flex',fontSize:rpxToPx(36), alignItems: 'center', justifyContent: 'center', color: getColor(index, j) ? props.color ?? MainColorType.fast : '#000' }}>{obj}</Text>
                         );
                     })}
                 </PickerViewColumn>

+ 2 - 2
src/_record/components/picker_card.scss

@@ -25,8 +25,8 @@
 
 .picker_card_close {
     position: absolute;
-    left: 56px;
-    top: 56px;
+    left: 48px;
+    top: 48px;
     width: 72px;
     height: 72px;
     border-radius: 36px;

+ 22 - 18
src/_record/components/picker_card.tsx

@@ -14,30 +14,34 @@ export default function PickerCard(props: { onClose: any, onConfirm: any, type:
     return <View className="picker_card_bg">
         <View className="picker_card">
             <View className="picker_card_close" onClick={props.onClose}>
-                <IconClose color="#000" width={rpxToPx(32)} height={rpxToPx(32)} />
+                <IconClose color="#000" width={rpxToPx(56)} height={rpxToPx(56)} />
             </View>
             <View className="h50 bold" style={{ marginTop: rpxToPx(120) }}>时间</View>
-            <View style={{ height: 50 }}></View>
-            <View style={{height:rpxToPx(360)}}>
-            {
-                props.type == 'duration' && <NewDurationPicker type={DurationPickerType.normal} value={props.value} onChange={(e) => {
-                    setValue(e)
-                }} />
-            }
-            {
-                props.type == 'datetime' && <NewDateTimePicker date={dayjs(props.value).format('YYYY-MM-DD')} count={1} time={dayjs(props.value).format('HH:mm')}
-                    minTimestamp={new Date(props.value).getTime() - 24 * 3600 * 1000}
-                    maxTimestamp={new Date().getTime()}
-                    onChange={(e) => {
-                        var dt = new Date(`${e[0]}T${e[1]}:00`)
-                        setValue(dt.getTime())
-                    }} color={MainColorType.orange} />
-            }
+            <View className="h24" style={{
+                height: rpxToPx(36), marginTop: rpxToPx(16),
+                marginBottom: rpxToPx(8),
+                color: MainColorType.error
+            }}></View>
+            <View style={{ height: rpxToPx(360) }}>
+                {
+                    props.type == 'duration' && <NewDurationPicker color={MainColorType.black} type={DurationPickerType.normal} value={props.value} onChange={(e) => {
+                        setValue(e)
+                    }} />
+                }
+                {
+                    props.type == 'datetime' && <NewDateTimePicker color={MainColorType.black} date={dayjs(props.value).format('YYYY-MM-DD')} count={1} time={dayjs(props.value).format('HH:mm')}
+                        minTimestamp={new Date(props.value).getTime() - 24 * 3600 * 1000}
+                        maxTimestamp={new Date().getTime()}
+                        onChange={(e) => {
+                            var dt = new Date(`${e[0]}T${e[1]}:00`)
+                            setValue(dt.getTime())
+                        }} color={MainColorType.orange} />
+                }
             </View>
             <View style={{ height: rpxToPx(60) }} />
             <NewButton
                 type={NewButtonType.fill}
-                width={rpxToPx(678)}
+                width={rpxToPx(578)}
                 height={rpxToPx(96)}
                 color={MainColorType.orange}
                 title="确定"

+ 71 - 29
src/_record/components/ring_progress.tsx

@@ -1,3 +1,5 @@
+import { MainColorType } from "@/context/themes/color";
+import { rpxToPx } from "@/utils/tools";
 import { Canvas } from "@tarojs/components";
 import Taro, { useReady } from "@tarojs/taro";
 import { useEffect, useRef, useState } from "react";
@@ -25,13 +27,13 @@ export default function RingProgress(props: {
     const canvasRef = useRef(null);
 
 
-    const canvasWidth = props.width ?? 450
-    const canvasHeight = props.height ?? 360
+    const canvasWidth = props.width ?? rpxToPx(900)
+    const canvasHeight = props.height ?? rpxToPx(720)
     const scale = props.scale ?? 1
 
     useEffect(() => {
         if (ctx) {
-            drawContent(ctx)
+            drawContent(ctx, canvas)
         }
         else {
             initCanvas()
@@ -65,23 +67,30 @@ export default function RingProgress(props: {
             ctx.scale(scale, scale);
             ctx.translate(0, 0);
 
-            drawContent(ctx)
+            drawContent(ctx, _canvas)
             setCtx(ctx)
             setCanvas(_canvas)
         })
     }
 
-    function drawContent(ctx) {
+    function drawContent(ctx, _canvas) {
         ctx.clearRect(0, 0, canvasWidth, canvasHeight); // 清除画布
         // 设置画布尺寸
 
 
         if (props.shareBg) {
-            const grd = ctx.createLinearGradient(0, 0, 0, canvasHeight);
-            grd.addColorStop(0, props.shareBg[0])
-            grd.addColorStop(1, props.shareBg[1])
-            ctx.fillStyle = grd;
-            ctx.fillRect(0, 0, canvasWidth, canvasHeight)
+            if (props.shareBg.length == 1) {
+                ctx.fillStyle = props.shareBg[0];
+                ctx.fillRect(0, 0, canvasWidth, canvasHeight)
+            }
+            else {
+                const grd = ctx.createLinearGradient(0, 0, 0, canvasHeight);
+                grd.addColorStop(0, props.shareBg[0])
+                grd.addColorStop(1, props.shareBg[1])
+                ctx.fillStyle = grd;
+                ctx.fillRect(0, 0, canvasWidth, canvasHeight)
+            }
+
         }
 
 
@@ -103,6 +112,14 @@ export default function RingProgress(props: {
         }
 
         if (props.real) {
+            if (props.isCompleted) {
+                ctx.beginPath();
+                ctx.arc(canvasWidth / 2.0, canvasHeight / 2.0, props.radius, 0, Math.PI*2);
+                ctx.lineWidth = rpxToPx(4);
+                ctx.strokeStyle = 'rgba(0,0,0,0.05)';
+                ctx.lineCap = 'round'; // 设置为圆角
+                ctx.stroke();
+            }
             ctx.beginPath();
             ctx.arc(canvasWidth / 2.0, canvasHeight / 2.0, props.radius, props.real.start, props.real.start + Math.max(props.real.duration, 0.01));
             ctx.lineWidth = props.real.width;
@@ -161,44 +178,69 @@ export default function RingProgress(props: {
         }
 
         if (props.extra) {
-            const { header, value, footer, color } = props.extra
-            if (header) {
-                ctx.font = `bold ${12}px sans-serif`
+            const { goal, target, progress, value, footer, color, result } = props.extra
+            // if (header) {
+            //     ctx.font = `bold ${12}px sans-serif`
+            //     ctx.fillStyle = '#000'
+            //     ctx.textAlign = 'center'
+            //     ctx.fillText(header, rpxToPx(450), rpxToPx(350));
+            // }
+            if (target) {
+                ctx.font = `bold ${rpxToPx(50)}px sans-serif`
                 ctx.fillStyle = '#000'
                 ctx.textAlign = 'center'
-                ctx.fillText(header, 225, 110);
+                ctx.textBaseline = 'top';
+                ctx.fillText(target, rpxToPx(450), rpxToPx(324));
             }
-            if (value) {
-                ctx.font = `bold ${36}px sans-serif`
+            if (progress) {
+                ctx.font = `bold ${rpxToPx(72)}px sans-serif`
                 ctx.fillStyle = '#000'
                 ctx.textAlign = 'center'
-                ctx.fillText(value, 225, 164);
+                ctx.textBaseline = 'top';
+                ctx.fillText(progress, rpxToPx(450), rpxToPx(314));
             }
+            if (goal) {
+                ctx.font = `bold ${rpxToPx(30)}px sans-serif`
+                ctx.fillStyle = MainColorType.orange
+                ctx.textAlign = 'center'
+                ctx.textBaseline = 'top';
+                ctx.fillText(goal, rpxToPx(450), rpxToPx(416));
+            }
+
             if (footer) {
-                ctx.font = `bold ${15}px sans-serif`
-                ctx.fillStyle = color
+                ctx.font = `bold ${rpxToPx(24)}px sans-serif`
+                ctx.fillStyle = 'rgba(0,0,0,0.5)'
+                ctx.textAlign = 'center'
+                ctx.textBaseline = 'top';
+                ctx.fillText(footer, rpxToPx(450), rpxToPx(420));
+            }
+
+            if (result) {
+                ctx.font = `bold ${rpxToPx(44)}px sans-serif`
+                ctx.fillStyle = '#fff'
                 ctx.textAlign = 'center'
-                ctx.fillText(footer, 225, 195);
+                ctx.textBaseline = 'top';
+                ctx.fillText(result, rpxToPx(450), rpxToPx(414));
             }
         }
 
         if (props.isCompleted) {
-            if (canvas) {
-                const img1 = canvas.createImage(); // 创建图像对象
+            if (_canvas) {
+                const img1 = _canvas.createImage(); // 创建图像对象
                 img1.src = global.checkImg
                 img1.onload = () => {
-                    ctx.drawImage(img1, 162, 30, 200, 170);
+                    ctx.drawImage(img1, 162, 30, rpxToPx(400), rpxToPx(340));
                     ctx.stroke();
-                    if (props.shareCover && canvas) {
-                        save()
+                    if (props.shareCover && _canvas) {
+                        save(_canvas)
                     }
                 }
             }
 
         }
         else {
-            if (props.shareCover && canvas) {
-                save()
+            if (props.shareCover && _canvas) {
+                save(_canvas)
             }
         }
 
@@ -207,9 +249,9 @@ export default function RingProgress(props: {
 
     }
 
-    function save() {
+    function save(_canvas) {
         Taro.canvasToTempFilePath({
-            canvas: canvas,
+            canvas: _canvas,
             success: (res) => {
                 console.log('图片保存成功:', res.tempFilePath);
                 props.shareCover(res.tempFilePath)

+ 116 - 13
src/_record/pages/log_record.scss

@@ -76,28 +76,27 @@
 .sel_tag {
     height: 64px;
     border-radius: 32px;
-    background-color: rgba($color: #fff, $alpha: 0.20);
+    background-color: rgba($color: #000, $alpha: 0.05);
     padding-left: 24px;
     display: flex;
     flex-direction: row;
     align-items: center;
     padding-right: 16px;
-    margin-left: 40px;
 }
 
 .textarea2 {
-    height: 400px;
-    width: 750px;
+    height: 420px;
+    width: 570px;
     box-sizing: border-box;
-    padding: 30px 56px;
-    margin-top: 24px;
-    margin-bottom: 30px;
+    padding: 30px 0px;
+    margin-top: 48px;
+    margin-bottom: 48px;
 }
 
 .cover {
     width: 155px;
     height: 155px;
-    background-color: #F5F5F5;
+    background-color: rgba($color: #000, $alpha: 0.05);
     display: flex;
     align-items: center;
     justify-content: center;
@@ -106,6 +105,7 @@
     margin-right: 20px;
     margin-bottom: 20px;
     position: relative;
+    border-radius: 28px;
 }
 
 .cover_del {
@@ -130,22 +130,125 @@
     flex-shrink: 0;
 }
 
-.form{
+.form2 {
     display: flex;
     flex-direction: row;
     flex-wrap: wrap;
-    margin-left: 96px;
-    margin-bottom: 54px;
     width: 80%;
 }
 
-.time_view{
+.time_view {
     position: relative;
     display: flex;
     flex-direction: row;
     align-items: center;
-    margin-top: 100px;
     margin-left: 56px;
     padding-right: 28px;
     height: 108px;
+}
+
+.cardShowAni {
+    animation: showAni 0.3s linear forwards;
+}
+
+.cardHideAni {
+    animation: dismissAni 0.3s linear forwards;
+}
+
+
+
+@keyframes dismissAni {
+    0% {
+        opacity: 1;
+    }
+
+    100% {
+        opacity: 0;
+    }
+}
+
+@keyframes showAni {
+    0% {
+        opacity: 0;
+        transform: translateY(100px);
+    }
+
+    100% {
+        opacity: 1;
+        transform: translateY(0px);
+    }
+}
+
+.share_bg {
+    position: fixed;
+    left: 0;
+    top: 0;
+    width: 100vw;
+    height: 100vh;
+    z-index: 100;
+    background: linear-gradient(180deg, #000000 0%, #1A1A1A 100%);
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+}
+
+
+
+.share_card1 {
+    width: 698px;
+    height: 932px;
+    display: flex;
+    border-radius: 84px;
+    margin-bottom: 26px;
+    flex-direction: column;
+    overflow: hidden;
+    align-items: center;
+    position: relative;
+}
+
+.log_result_success {
+    margin-top: 123px;
+    width: 120px;
+    height: 120px;
+    background-color: #fff;
+    border-radius: 60px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+
+.share_card_cover {
+    width: 698px;
+    height: 932px;
+    position: absolute;
+    left: 0;
+    top: 0;
+}
+
+.share_card_layer {
+    width: 698px;
+    height: 932px;
+    position: absolute;
+    left: 0;
+    top: 0;
+    background-color: #000;
+    opacity: 0.5;
+}
+
+.share_canvas {
+    position: absolute;
+    top: -1000px;
+}
+
+.content_card {
+    margin-left: 26px;
+    background-color: rgba($color: #fff, $alpha: 0.5);
+    width: 698px;
+    min-height: 875px;
+    border-radius: 84px;
+    padding: 64px;
+    box-sizing: border-box;
+    display: flex;
+    flex-direction: column;
 }

+ 180 - 65
src/_record/pages/log_record.tsx

@@ -3,7 +3,7 @@ import './log_record.scss'
 import { useEffect, useState } from "react";
 import Taro, { useRouter } from "@tarojs/taro";
 import { rpxToPx } from "@/utils/tools";
-import { IconArrow, IconClose } from "@/components/basic/Icons";
+import { IconArrow, IconCheck, IconClose } from "@/components/basic/Icons";
 import { MainColorType } from "@/context/themes/color";
 import { useTranslation } from "react-i18next";
 import showAlert from "@/components/basic/Alert";
@@ -16,6 +16,7 @@ import { TimeFormatter } from "@/utils/time_format";
 import { useSelector } from "react-redux";
 import { addEvents, addUserTag, createMoment, updateMoment, userTags } from "@/services/health";
 import PostMomentTime from "@/_health/components/post_moment_time";
+import ShareBtn from "@/components/basic/ShareBtn";
 
 let useRoute;
 let useNavigation;
@@ -30,11 +31,11 @@ export default function LogRecord() {
     const long = useSelector((state: any) => state.long);
     const health = useSelector((state: any) => state.health);
     const record = useSelector((state: any) => state.record);
-    const [pics, setPics] = useState<any>([])
+
     const [title, setTitle] = useState('')
     const [chooseTitle, setChooseTitle] = useState('')
     const [desc, setDesc] = useState('')
-    const [step, setStep] = useState(0)
+    const [step, setStep] = useState(2)
     const { t } = useTranslation()
 
     const [time, setTime] = useState(dayjs().format('HH:mm'))
@@ -43,8 +44,11 @@ export default function LogRecord() {
     const [enterTimestmap] = useState(new Date().getTime())
     const [posting, setPosting] = useState(false)
     const [showTimePicker, setShowTimePicker] = useState(false)
+    const [result, setResult] = useState<any>(null)
+    const [showResult, setShowResult] = useState(false)
 
     const [tags, setTags] = useState<any>([])
+    const [selPostCount, setPostCount] = useState(1)
 
 
 
@@ -61,11 +65,12 @@ export default function LogRecord() {
         router = useRouter()
     }
 
-    const { event_id, is_temp, schedule_id,scenario } = router.params
+    const { event_id, is_temp, schedule_id, scenario, imgs } = router.params
 
     const moment = router.params.moment ? JSON.parse(router.params.moment) : null
 
     const window = router.params.window ?? health.mode
+    const [pics, setPics] = useState<any>(imgs ? JSON.parse(imgs) : [])
 
     useEffect(() => {
         global.set_time = new Date().getTime()
@@ -74,10 +79,45 @@ export default function LogRecord() {
 
     function getTags() {
         userTags({ scenario: scenario }).then(res => {
+            var current = dayjs().format('HH:mm');
+            var isFind = false;
+            (res as any).tags.map(item => {
+                if (item.time_from && item.time_to) {
+                    if (isInTimeRange(current, item.time_from, item.time_to)) {
+                        isFind = true;
+                        setTitle(item.title)
+                        setChooseTitle(item.title)
+                        setPostCount(item.log_count + 1)
+                    }
+                }
+            })
+            if (!isFind) {
+                setTitle((res as any).tags[0].title)
+                setChooseTitle((res as any).tags[0].title)
+                setPostCount((res as any).tags[0].log_count + 1)
+            }
             setTags((res as any).tags)
         })
     }
 
+    function isInTimeRange(currentTime, startTime, endTime) {
+        // 将时间字符串转换为 Date 对象
+        const current = new Date(`1970-01-01T${currentTime}:00`);
+        const start = new Date(`1970-01-01T${startTime}:00`);
+        const end = new Date(`1970-01-01T${endTime}:00`);
+
+        // 如果结束时间小于开始时间,说明时间段跨越了午夜
+        if (end < start) {
+            end.setDate(end.getDate() + 1); // 将结束时间加一天
+            if (current < start) {
+                current.setDate(current.getDate() + 1); // 如果当前时间在午夜之前,加一天
+            }
+        }
+
+        // 判断当前时间是否在时间段内
+        return current >= start && current < end;
+    }
+
     function addTag() {
         addUserTag({ scenario: scenario, title: title }).then(res => {
             getTags()
@@ -246,7 +286,7 @@ export default function LogRecord() {
             params.join_key = router.params.join_id
         }
 
-        var moment:any = {
+        var moment: any = {
             description: desc,
         }
         if (pics.length > 0) {
@@ -285,10 +325,8 @@ export default function LogRecord() {
         if (posting) return
         setPosting(true)
         addEvents(params).then(res => {
-            Taro.showToast({
-                title: '成功',
-                icon: 'success'
-            })
+            setShowResult(true)
+            setResult(res)
         })
         // createMoment(params).then(res => {
         //     // setTimeout(() => {
@@ -427,7 +465,19 @@ export default function LogRecord() {
                 alignItems: 'center',
                 justifyContent: 'center'
             }}>
-                <Image src={require('@assets/_health/navi_back.png')} style={{
+                <View style={{
+                    position: 'absolute',
+                    width: rpxToPx(92),
+                    height: rpxToPx(64),
+                    left: 22,
+                    top: 22 - rpxToPx(32)
+                }}
+                    onClick={() => {
+                        Taro.navigateBack()
+                    }}>
+                    <IconClose color="#000" width={rpxToPx(64)} height={rpxToPx(64)} />
+                </View>
+                {/* <Image src={require('@assets/_health/navi_back.png')} style={{
                     position: 'absolute',
                     width: rpxToPx(92),
                     height: rpxToPx(64),
@@ -437,7 +487,7 @@ export default function LogRecord() {
                     onClick={() => {
                         Taro.navigateBack()
                     }}
-                />
+                /> */}
                 {/* <View className="h36 bold">upcoming fast</View> */}
             </View>
         </View>
@@ -445,7 +495,7 @@ export default function LogRecord() {
         {
             step == 0 && <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', marginTop: rpxToPx(152) }}>
                 <Image src={require('@assets/_health/eat.png')} style={{ width: rpxToPx(96), height: rpxToPx(96) }} />
-                <View className="h50 bold">选择打卡的{scenario=='MEAL'?'餐次':'活动'}</View>
+                <View className="h50 bold">选择打卡的{scenario == 'MEAL' ? '餐次' : '活动'}</View>
                 <View className="operate_bg">
                     {
                         tags.map((item, index) => {
@@ -486,60 +536,66 @@ export default function LogRecord() {
             </View>
         }
         {
-            step == 2 && <View>
-                <View style={{ display: 'flex', flexDirection: 'row' }} onClick={() => {
-                    setStep(0)
-                }}>
-                    <View className="sel_tag h34 bold">
-                        {chooseTitle}
-                        <View style={{ width: rpxToPx(6) }} />
-                        <IconArrow width={rpxToPx(34)} color={MainColorType.g02} />
+            step == 2 && <View className="cardShowAni">
+                <View className="content_card">
+                    <View style={{ display: 'flex', flexDirection: 'row' }} onClick={() => {
+                        setStep(0)
+                    }}>
+                        <View className="sel_tag h34 bold">
+                            <View>{selPostCount}次</View>
+                            {chooseTitle}
+                            <View style={{ width: rpxToPx(6) }} />
+                            <IconArrow width={rpxToPx(34)} color={MainColorType.g02} />
+                        </View>
                     </View>
-                </View>
-
-                <Textarea placeholder={t('health.add_text')} className="textarea2 h44 bold"
-                    placeholder-style="color:rgba(0,0,0,0.2)"
-                    value={desc}
-                    onInput={e => {
-                        setDesc(e.detail.value)
-                    }} />
-                <View className="form">
-                    {
-                        pics.map((item, index) => {
-                            return <View className="cover" key={index}>
-                                <Image src={item.url + scale} mode="aspectFill" className="cover" style={{
-                                    margin: 0
-                                }} key={index} onClick={() => {
-                                    Taro.previewImage({
-                                        current: pics[index].url,
-                                        urls: pics.map(file => file.url)
-                                    })
-                                }} />
-                                <View className="cover_del" onClick={() => {
-                                    showAlert({
-                                        title: t('health.del_title'),
-                                        content: '',
-                                        cancelText: t('health.del_cancel'),
-                                        confirmText: t('health.del_confirm'),
-                                        showCancel: true,
-                                        confirm: () => {
-                                            var array = JSON.parse(JSON.stringify(pics))
-                                            array.splice(index, 1)
-                                            setPics(array)
-                                        }
-                                    })
-                                }}>
-                                    <View className="cover_del_btn">
-                                        <IconClose width={10} height={10} color="#fff" />
+                    <Textarea placeholder={t('health.add_text')} className="textarea2 h44 bold"
+                        placeholder-style="color:rgba(0,0,0,0.2)"
+                        value={desc}
+                        onInput={e => {
+                            setDesc(e.detail.value)
+                        }} />
+                    <View className="form2">
+                        {
+                            pics.map((item, index) => {
+                                return <View className="cover" key={index}>
+                                    <Image src={item.url + scale} mode="aspectFill" className="cover" style={{
+                                        margin: 0
+                                    }} key={index} onClick={() => {
+                                        Taro.previewImage({
+                                            current: pics[index].url,
+                                            urls: pics.map(file => file.url)
+                                        })
+                                    }} />
+                                    <View className="cover_del" onClick={() => {
+                                        showAlert({
+                                            title: t('health.del_title'),
+                                            content: '',
+                                            cancelText: t('health.del_cancel'),
+                                            confirmText: t('health.del_confirm'),
+                                            showCancel: true,
+                                            confirm: () => {
+                                                var array = JSON.parse(JSON.stringify(pics))
+                                                array.splice(index, 1)
+                                                setPics(array)
+                                            }
+                                        })
+                                    }}>
+                                        <View className="cover_del_btn">
+                                            <IconClose width={10} height={10} color="#fff" />
+                                        </View>
                                     </View>
                                 </View>
-                            </View>
-                        })
-                    }
-                    {
-                        pics.length < 9 && <View onClick={tapPic} className="cover" style={{}}><Image src={require('@assets/_health/camera.png')} style={{ width: 40, height: 40 }} /></View>
-                    }
+                            })
+                        }
+                        {
+                            pics.length < 9 && <View onClick={tapPic} className="cover" style={{}}><Image src={require('@assets/_health/camera.png')} style={{ width: 40, height: 40 }} /></View>
+                        }
+                    </View>
                 </View>
+
+
+
+
                 <View className="time_view" onClick={() => {
                     setShowTimePicker(true)
                 }}>
@@ -550,16 +606,17 @@ export default function LogRecord() {
                     <IconArrow width={rpxToPx(34)} color={MainColorType.g02} />
                     <View className="border_footer_line" style={{ left: rpxToPx(48) }} />
                 </View>
-                <View style={{ flex: 1 }} />
+                <View style={{ flex: 1,marginLeft:rpxToPx(52),marginTop:rpxToPx(35) }}>
 
-                <View className="main_footer" style={{ backgroundColor: 'transparent' }}><NewButton
+                <NewButton
                     type={NewButtonType.fill}
                     color={MainColorType.orange}
                     width={rpxToPx(646)}
                     height={rpxToPx(96)}
                     title={t('health.log_moment')}
                     onClick={save}
-                /></View>
+                />
+                </View>
 
             </View>
         }
@@ -581,5 +638,63 @@ export default function LogRecord() {
                     setShowTimePicker(false)
                 }} />
         }
+        {
+            showResult && <View className="share_bg">
+                <View className="navi_bar" style={{ height: navigationBarHeight }}>
+                    <View style={{
+                        position: 'absolute',
+                        left: 0,
+                        right: 0,
+                        bottom: 0,
+                        height: 44,
+                        display: 'flex',
+                        alignItems: 'center',
+                        justifyContent: 'center'
+                    }}>
+                        <View style={{
+                            position: 'absolute',
+                            width: rpxToPx(92),
+                            height: rpxToPx(64),
+                            left: 22,
+                            top: 22 - rpxToPx(32)
+                        }}
+                            onClick={() => {
+                                Taro.navigateBack()
+                                // setShowShare(false)
+                            }}>
+                            <IconClose color="#fff" width={rpxToPx(64)} height={rpxToPx(64)} />
+                        </View>
+                    </View>
+
+                </View>
+                <View className="share_card1" style={{ background: getBackground() }}>
+                    {
+                        result.images && result.images.length > 0 && <Image className="share_card_cover" mode="aspectFill" src={result.images[0]} />
+                    }
+                    {
+                        result.images && result.images.length > 0 && <View className="share_card_layer" />
+                    }
+                    <View style={{ position: 'relative', zIndex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', height: '100%' }}>
+                        <View className="log_result_success">
+                            <IconCheck color="#fff" width={rpxToPx(32)} height={rpxToPx(32)} />
+                        </View>
+                        <View className="h50 bold" style={{ color: '#fff', marginTop: rpxToPx(24), marginBottom: rpxToPx(12) }}>{result.title}</View>
+                        <View className="h30" style={{ color: '#fff' }}>{result.description}</View>
+                        <View style={{ flex: 1 }} />
+                        <View className="h28" style={{ color: '#fff', marginBottom: rpxToPx(120) }}>{result.moment_description}</View>
+                    </View>
+                </View>
+                <ShareBtn>
+                    <NewButton
+                        type={NewButtonType.fill}
+                        color={MainColorType.success}
+                        width={rpxToPx(698)}
+                        height={rpxToPx(108)}
+                        title="Send to friends"
+                    />
+                </ShareBtn>
+
+            </View>
+        }
     </View>
 }

+ 1 - 0
src/_record/pages/time_record.scss

@@ -74,6 +74,7 @@
     flex-direction: column;
     align-items: center;
     width: 320px;
+    border-radius: 28px;
 }
 
 .share_icon{

+ 96 - 25
src/_record/pages/time_record.tsx

@@ -4,7 +4,7 @@ import Taro, { useRouter, useShareAppMessage } from "@tarojs/taro";
 import { rpxToPx } from "@/utils/tools";
 import { MainColorType } from "@/context/themes/color";
 import NewButton, { NewButtonType } from "@/_health/base/new_button";
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState } from "react";
 import NewDateTimePicker from "@/_health/base/new_date_time_picker";
 import dayjs from "dayjs";
 import RingProgress from "../components/ring_progress";
@@ -12,11 +12,12 @@ import NewDurationPicker, { DurationPickerType } from "@/_health/base/new_durati
 import { IconArrow, IconClose } from "@/components/basic/Icons";
 import { useSelector } from "react-redux";
 import { TimeFormatter } from "@/utils/time_format";
-import { addEvents } from "@/services/health";
+import { addEvents, delWindowId } from "@/services/health";
 import Modal from "@/components/layout/Modal.weapp";
 import { getDurationArc, getStartArc } from "@/features/health/hooks/health_hooks";
 import ShareBtn from "@/components/basic/ShareBtn";
 import PickerCard from "../components/picker_card";
+import showActionSheet from "@/components/basic/ActionSheet";
 
 let timer
 let useRoute;
@@ -43,6 +44,11 @@ export default function TimeRecord() {
     const [showShare, setShowShare] = useState(false)
     const [shareUrl, setShareUrl] = useState('')
 
+    const statusRef = useRef(status)
+    const picker1Ref = useRef(showDatePicker)
+    const picker2Ref = useRef(showEndDatePicker)
+    const picker3Ref = useRef(showDurationPicker)
+
     let router
     let navigation;
     if (useNavigation) {
@@ -68,6 +74,13 @@ export default function TimeRecord() {
         })
     }
 
+    useEffect(() => {
+        statusRef.current = status;
+        picker1Ref.current = showDatePicker
+        picker2Ref.current = showEndDatePicker
+        picker3Ref.current = showDurationPicker
+    }, [status, showDatePicker, showEndDatePicker, showDurationPicker])
+
 
     useEffect(() => {
         const { events } = record
@@ -80,7 +93,8 @@ export default function TimeRecord() {
         })
         downloadFile()
         timer = setInterval(() => {
-            if (showDatePicker || showEndDatePicker || showDurationPicker) return
+            if (picker1Ref.current || picker2Ref.current || picker3Ref.current) return
+            if (statusRef.current == 'DONE') return
             setCount(count => count + 1)
         }, 1000)
         return () => {
@@ -150,6 +164,7 @@ export default function TimeRecord() {
         // setPosting(true)
         addEvents(params).then(res => {
             Taro.eventCenter.trigger('refreshClockIndex')
+            Taro.eventCenter.trigger('refreshMoments', '')
             setShowHighlight(true)
             setTimeout(() => {
                 setShowHighlight(false)
@@ -189,6 +204,7 @@ export default function TimeRecord() {
                 setShowHighlight(false)
             }, 3000)
             Taro.eventCenter.trigger('refreshClockIndex')
+            Taro.eventCenter.trigger('refreshMoments', '')
             setInfo((res as any).data)
             setStatus((res as any).data.status)
             setShareUrl('')
@@ -208,10 +224,34 @@ export default function TimeRecord() {
         }
         addEvents(data).then(res => {
             Taro.eventCenter.trigger('refreshClockIndex')
+            Taro.eventCenter.trigger('refreshMoments', '')
             setInfo((res as any).data)
             setShowDatePicker(false)
             setShowDurationPicker(false)
             setShowEndDatePicker(false)
+            setCount((count) => count + 1)
+        })
+    }
+
+    function more() {
+        showActionSheet({
+            title: '操作',
+            itemList: ['放弃', '重新开始'],
+            success: (res) => {
+                switch (res) {
+                    case 0:
+                        delWindowId(info.id).then(res => {
+                            setInfo((res as any).data)
+                            setStatus((res as any).data.status)
+                        })
+                        break
+                    case 1:
+                        delWindowId(info.id).then(res => {
+                            start()
+                        })
+                        break
+                }
+            }
         })
     }
 
@@ -225,22 +265,28 @@ export default function TimeRecord() {
     }
 
     function ringExtra() {
+        if (status == 'DONE') {
+            return {
+                value: '',
+                footer: '',
+                color: MainColorType.orange,
+                result: TimeFormatter.formateDurationBySeconds(info.time.end_timestamp / 1000 - info.time.start_timestamp / 1000),
+            }
+        }
         if (status == 'WFS') {
             const count = info.time.duration / 1000
             var str = TimeFormatter.formateDurationBySeconds(count)
 
             return {
-                header: '',
-                value: str,
-                footer: 'Edit',
+                target: str,
+                goal: 'Edit Goal',
                 color: MainColorType.orange
             }
         }
         var percent = 100 * (new Date().getTime() - info.time.start_timestamp) / info.time.duration
         percent = parseInt(percent + '')
         return {
-            header: '',
-            value: TimeFormatter.countdown(info.time.start_timestamp),
+            progress: TimeFormatter.countdown(info.time.start_timestamp),
             footer: `ELAPSED ${percent}%`,
             color: MainColorType.g02
         }
@@ -267,7 +313,7 @@ export default function TimeRecord() {
     function doneComponent() {
         if (status == 'DONE') {
             return <View className="share_bg" style={{ justifyContent: 'flex-start' }}>
-                {
+                {/* {
                     shareUrl.length == 0 && <View className="share_canvas"><RingProgress
                         radius={125} canvasId="helloworld_share2"
                         //scale={0.75}
@@ -290,7 +336,7 @@ export default function TimeRecord() {
                             }
                         }
                     /></View>
-                }
+                } */}
 
                 <View className="navi_bar" style={{ height: navigationBarHeight }}>
                     <View style={{
@@ -319,10 +365,33 @@ export default function TimeRecord() {
 
                 </View>
                 <View className="share_card" style={{ background: MainColorType.orange, marginTop: rpxToPx(26) + navigationBarHeight }}>
-                    {
+                    {/* {
                         shareUrl.length > 0 ? <Image src={shareUrl} style={{ width: rpxToPx(900), height: rpxToPx(720) }} /> :
                             <View style={{ width: rpxToPx(900), height: rpxToPx(720), backgroundColor: MainColorType.g02 }} />
-                    }
+                    } */}
+                    <RingProgress
+                        radius={rpxToPx(250)} canvasId="helloworld_share2"
+                        //scale={0.75}
+                        count={count}
+                        bgRing={{
+                            color: 'rgba(255,255,255,1)',
+                            width: rpxToPx(100)
+                        }}
+                        real={{
+                            color: MainColorType.orange,
+                            width: rpxToPx(16),
+                            start: getStartArc(info.time.start_timestamp),
+                            duration: getDurationArc(info.time.start_timestamp, info.time.end_timestamp)
+                        }}
+                        extra={ringExtra()}
+                        shareBg={[MainColorType.orange]}
+                        isCompleted
+                        shareCover={
+                            url => {
+                                setShareUrl(url)
+                            }
+                        }
+                    />
                     {
                         <View className="operate_content" style={{ marginTop: rpxToPx(40) }}>
                             <View className="operate_item" onClick={() => {
@@ -332,7 +401,7 @@ export default function TimeRecord() {
                                 <View className="h44 bold" style={{ marginTop: rpxToPx(8), marginBottom: rpxToPx(8) }}>{TimeFormatter.dateTimeFormate(info.time.start_timestamp, true)}</View>
                                 <View className="h30 bold" style={{ color: MainColorType.white }}>Edit Start</View>
                             </View>
-                            <View className="operate_item" onClick={() => {
+                            <View className="operate_item" style={{ backgroundColor: showHighlight ? '#ffffff80' : 'transparent' }} onClick={() => {
                                 setShowEndDatePicker(true)
                             }}>
                                 <View className="g02 h24">FINISHED</View>
@@ -382,7 +451,7 @@ export default function TimeRecord() {
                             Taro.navigateBack()
                         }}
                     />
-                    <View className="h36 bold">upcoming fast</View>
+                    <View className="h36 bold">{status == 'WFS' ? 'upcoming fast' : 'onging fast'}</View>
                 </View>
             </View>
             <View style={{ height: navigationBarHeight }} />
@@ -392,22 +461,22 @@ export default function TimeRecord() {
                     // setShowDurationPicker(true)
                 }}>
                     <RingProgress
-                        radius={125} canvasId="helloworld"
+                        radius={rpxToPx(250)} canvasId="helloworld"
                         //scale={0.75}
                         count={count}
                         bgRing={{
                             color: 'rgba(255,255,255,0.25)',
-                            width: 35
+                            width: rpxToPx(100)
                         }}
                         target={{
                             color: 'rgba(255,255,255,0.5)',
-                            width: 35,
+                            width: rpxToPx(100),
                             start: status == 'WFS' ? getStartArc(new Date().getTime()) : getStartArc(info.time.start_timestamp),
                             duration: status == 'WFS' ? getDurationArc(new Date().getTime(), new Date().getTime() + info.time.duration) : getDurationArc(info.time.start_timestamp, info.time.start_timestamp + info.time.duration)
                         }}
                         real={status == 'WFS' ? null : {
                             color: MainColorType.orange,
-                            width: 35,
+                            width: rpxToPx(100),
                             start: getStartArc(info.time.start_timestamp),
                             duration: getDurationArc(info.time.start_timestamp, new Date().getTime())
                         }}
@@ -416,7 +485,7 @@ export default function TimeRecord() {
                 </View>
                 {
                     status == 'OG' && <View className="operate_content">
-                        <View className="operate_item" onClick={() => {
+                        <View className="operate_item" style={{ backgroundColor: showHighlight ? '#ffffff80' : 'transparent' }} onClick={() => {
                             setShowDatePicker(true)
                         }}>
                             <View className="g02 h24">STARTED</View>
@@ -444,7 +513,7 @@ export default function TimeRecord() {
                 }
 
                 {
-                    status == 'OG' && <NewButton
+                    status == 'OG' && <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}><NewButton
                         type={NewButtonType.fill}
                         title="End fasting"
                         width={rpxToPx(490)}
@@ -452,6 +521,8 @@ export default function TimeRecord() {
                         color={MainColorType.orange}
                         onClick={end}
                     />
+                        <View onClick={more}>More</View>
+                    </View>
                 }
                 {
                     status == 'OG' && <View className="share_icon">
@@ -517,22 +588,22 @@ export default function TimeRecord() {
                     {
                         shareUrl == '' && <View className="share_canvas">
                             <RingProgress
-                                radius={125} canvasId="helloworld_share"
+                                radius={rpxToPx(250)} canvasId="helloworld_share"
                                 //scale={0.75}
                                 count={count}
                                 bgRing={{
                                     color: 'rgba(255,255,255,0.25)',
-                                    width: 35
+                                    width: rpxToPx(100)
                                 }}
                                 target={{
                                     color: 'rgba(255,255,255,0.5)',
-                                    width: 35,
+                                    width: rpxToPx(100),
                                     start: status == 'WFS' ? getStartArc(new Date().getTime()) : getStartArc(info.time.start_timestamp),
                                     duration: status == 'WFS' ? getDurationArc(new Date().getTime(), new Date().getTime() + info.time.duration) : getDurationArc(info.time.start_timestamp, info.time.start_timestamp + info.time.duration)
                                 }}
                                 real={status == 'WFS' ? null : {
                                     color: MainColorType.orange,
-                                    width: 35,
+                                    width: rpxToPx(100),
                                     start: getStartArc(info.time.start_timestamp),
                                     duration: getDurationArc(info.time.start_timestamp, new Date().getTime())
                                 }}
@@ -622,7 +693,7 @@ export default function TimeRecord() {
             />
         }
         {
-            showEndDatePicker && <PickerCard onClose={() => { setShowDatePicker(false) }}
+            showEndDatePicker && <PickerCard onClose={() => { setShowEndDatePicker(false) }}
                 value={info.time.end_timestamp}
                 type="datetime"
                 onConfirm={(e) => {

+ 6 - 0
src/app.config.ts

@@ -97,6 +97,12 @@ const appConfig = defineAppConfig({
       ]
     }
   ],
+  preloadRule:{
+    "pages/clock/Clock":{
+      "network":"all",
+      "packages":["_record"]
+    }
+  },
   usingComponents: {
     'mysvg': './components/basic/svg',
     // 't-popup':'tdesgin-miniprogram/popup/popup'

+ 2 - 0
src/pages/clock/Clock.tsx

@@ -78,6 +78,8 @@ export default function Clock() {
             loadRNCache()
         }
         getSetting()
+
+        // Taro.SubPackage
     }, [])
 
     function getSetting() {

+ 3 - 2
src/pages/clock/ClockIndex.scss

@@ -2,7 +2,7 @@
 //     background: linear-gradient(to bottom, #F0CABF, #E1CDEE)
 // }
 
-.main_bg{
+.main_bg {
     position: fixed;
     left: 0;
     top: 0;
@@ -30,4 +30,5 @@
     flex-direction: column;
     box-sizing: border-box;
     padding: 36px 40px;
-}
+}
+

+ 15 - 3
src/pages/clock/ClockIndex.tsx

@@ -2,7 +2,7 @@ import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import { View } from "@tarojs/components";
 import './ClockIndex.scss'
 import TabBar from "@/components/navigation/TabBar";
-import { IconNext } from "@/components/basic/Icons";
+import { IconClose, IconNext } from "@/components/basic/Icons";
 import { rpxToPx } from "@/utils/tools";
 import { useDispatch, useSelector } from "react-redux";
 import { useEffect, useState } from "react";
@@ -12,6 +12,7 @@ import { setEvents, setTimeData } from "@/store/record";
 import { TimeFormatter } from "@/utils/time_format";
 import { getInfo } from "@/services/user";
 import Taro from "@tarojs/taro";
+import ChooseActions from "./components/choose_actions";
 
 var timer
 export default function ClockIndex() {
@@ -21,6 +22,8 @@ export default function ClockIndex() {
     const [home, setHome] = useState<any>(null)
     const [count, setCount] = useState(0)
     const [currentTimeData, setCurrentTimeData] = useState<any>(null)
+    const [showChoose, setShowChoose] = useState(false)
+    const [selScenario, setSelScenario] = useState('')
     const dispatch = useDispatch();
     global.dispatch = dispatch;
 
@@ -88,7 +91,9 @@ export default function ClockIndex() {
         switch (index) {
             case 0:
             case 1:
-                jumpPage(`/_record/pages/log_record?scenario=${index == 0 ? 'MEAL' : 'ACTIVITY'}`)
+                setShowChoose(true)
+                setSelScenario(index == 0 ? 'MEAL' : 'ACTIVITY')
+                // jumpPage(`/_record/pages/log_record?scenario=${index == 0 ? 'MEAL' : 'ACTIVITY'}`)
                 break;
             case 2:
             case 3:
@@ -143,7 +148,7 @@ export default function ClockIndex() {
     if (!loaded) return <View />
 
 
-    return <View>
+    return <View style={{ position: 'relative' }}>
         <View className="main_bg" style={{ background: getBackground() }} />
         <View
             onClick={() => {
@@ -174,6 +179,13 @@ export default function ClockIndex() {
                 })
             }
         </View>
+        {
+            showChoose && <ChooseActions
+                scenario={selScenario}
+                close={() => {
+                    setShowChoose(false)
+                }} />
+        }
         {
             process.env.TARO_ENV == 'weapp' && <TabBar index={0} />
         }</View>

+ 27 - 0
src/pages/clock/components/choose_actions.scss

@@ -0,0 +1,27 @@
+.actions_bg {
+    z-index: 10000;
+    position: fixed;
+    left: 0;
+    top: 0;
+    width: 100vw;
+    height: 100vh;
+    background-color: rgba($color: #000, $alpha: 0.9);
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: flex-end;
+}
+
+.action_btn {
+    width: 698px;
+    height: 128px;
+    border-radius: 64px;
+    background-color: #fff;
+    color: #000;
+    margin-top: 26px;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    justify-content: center;
+    position: relative;
+}

+ 163 - 0
src/pages/clock/components/choose_actions.tsx

@@ -0,0 +1,163 @@
+import { View } from '@tarojs/components'
+import './choose_actions.scss'
+import { IconClose } from '@/components/basic/Icons'
+import { rpxToPx } from '@/utils/tools'
+import NewButton, { NewButtonType } from '@/_health/base/new_button'
+import Taro from '@tarojs/taro'
+import { baseUrl } from '@/services/http/api'
+import { useTranslation } from 'react-i18next'
+import { jumpPage } from '@/features/trackTimeDuration/hooks/Common'
+
+export default function ChooseActions(props: { close: any, scenario: string }) {
+    const { t } = useTranslation()
+
+    function camera() {
+        addImage(true)
+    }
+
+    function album() {
+        addImage(false)
+    }
+
+    function chat() {
+        Taro.chooseMessageFile({
+            count: 9,
+            type: 'image',
+            success: async function (res) {
+                const results = await Promise.all(res.tempFiles.map(getImageInfo));
+                chooseSuccess(results, true)
+            },
+            fail(res) {
+            },
+        })
+    }
+
+    function text() {
+        props.close()
+        jumpPage(`/_record/pages/log_record?scenario=${props.scenario}`)
+    }
+
+    function addImage(isCamera) {
+        var source: any = isCamera ? ['camera'] : ['album']
+        console.log(source)
+        Taro.chooseMedia({
+            count: 9,
+            sizeType: ['compressed'],
+            mediaType: ['image'],
+            sourceType: source,
+            success: async function (res) {
+                const results = await Promise.all(res.tempFiles.map(getImageInfo));
+
+
+                chooseSuccess(results, true)
+            },
+            fail: function (res) {
+            }
+        })
+    }
+
+    async function chooseSuccess(res, isAlbum) {
+        console.log('选择图片', res)
+        // const filePaths = res.map(file => file.path
+        //     // process.env.TARO_ENV === 'rn' || isFilePath ? file.path : file.tempFilePath
+        // )
+        Taro.showLoading({
+            title: t('health.uploading')
+        })
+
+        try {
+            const uploadedUrls = await Promise.all(res.map(path => uploadFile2(path, isAlbum ? 'album' : 'camera')))
+            // setPics([...pics, ...uploadedUrls])
+            jumpPage(`/_record/pages/log_record?imgs=${JSON.stringify(uploadedUrls)}&scenario=${props.scenario}`)
+            props.close()
+            Taro.hideLoading()
+        } catch (error) {
+            console.error('Error uploading files:', error)
+            Taro.hideLoading()
+        }
+    }
+
+    function uploadFile2(obj: any, source: string): Promise<string> {
+        return new Promise((resolve, reject) => {
+            var path = obj.path
+            const dot = path.lastIndexOf('.')
+            const fileExt = dot > 0 ? path.substring(dot) : ''
+            Taro.request({
+                method: 'GET',
+                url: `${baseUrl}/api/thirdparty/aliyun/oss-form-upload`,
+                header: {
+                    'Authorization': 'bearer ' + global.token
+                },
+                data: {
+                    type: 'FOOD_JOURNAL',
+                    file_ext: fileExt
+                },
+                success: (rsp) => {
+                    if (rsp.statusCode !== 200) {
+                        reject(new Error(t('health.networkError')))
+                        return
+                    }
+                    Taro.uploadFile({
+                        url: rsp.data.upload_url,
+                        filePath: path,
+                        name: 'file',
+                        formData: rsp.data.fields,
+                        success: () => {
+                            var temp = JSON.parse(JSON.stringify(obj))
+                            temp.url = rsp.data.view_url
+                            // resolve(rsp.data.view_url)
+                            resolve(temp)
+                        },
+                        fail: (error) => {
+
+                            reject(error)
+                        }
+                    })
+                },
+                fail: reject
+            })
+        })
+    }
+
+    const getImageInfo = (src) => {
+        const { tempFilePath, path } = src
+        return new Promise((resolve) => {
+            Taro.getImageInfo({
+                src: tempFilePath ? tempFilePath : path,
+                success: (result) => resolve({
+                    height: result.height,
+                    width: result.width,
+                    orientation: result.orientation,
+                    path: result.path,
+                    type: result.type
+                }),
+                fail: (error) => resolve({
+                    height: 1024,
+                    width: 1024,
+                    orientation: 'up',
+                    path: tempFilePath,
+                    type: 'unknown'
+                }),
+            });
+        });
+    };
+
+    return <View className="actions_bg" onClick={props.close}>
+        <NewButton type={NewButtonType.img} onClick={camera}>
+            <View className='action_btn h30 bold'>take a photo</View>
+        </NewButton>
+        <NewButton type={NewButtonType.img} onClick={album}>
+            <View className='action_btn h30 bold'>Choose from photos</View>
+        </NewButton>
+        <NewButton type={NewButtonType.img} onClick={chat}>
+            <View className='action_btn h30 bold'>Import from chats</View>
+        </NewButton>
+        <NewButton type={NewButtonType.img} onClick={text}>
+            <View className='action_btn h30 bold'>Only text</View>
+        </NewButton>
+
+        <View style={{ marginBottom: rpxToPx(84), marginTop: rpxToPx(60) }}>
+            <IconClose color="#fff" width={rpxToPx(64)} height={rpxToPx(64)} />
+        </View>
+    </View>
+}

+ 12 - 0
src/services/health.tsx

@@ -430,6 +430,18 @@ export const delRecord = (params) => {
     })
 }
 
+export const delWindowId = (id) => {
+    return new Promise((resolve, reject) => {
+        request({
+            url: API_HEALTH_WINDOWS + '/' + id, method: 'DELETE', data: {}
+        }).then(res => {
+            resolve(res)
+        }).catch(e => {
+            reject(e)
+        })
+    })
+}
+
 export const getLatestJournal = (isGet: boolean, params: any) => {
     // return new Promise((resolve) => {
     //     request({

+ 1 - 1
src/utils/time_format.ts

@@ -541,7 +541,7 @@ export class TimeFormatter {
     if (minutes > 0) {
       str = str + minutes + TimeFormatter.getMinutesUnit(minutes)
     }
-    if (seconds > 0) {
+    if (seconds > 0 && hours == 0 && minutes == 0) {
       str = str + seconds + TimeFormatter.getSecondsUnit(seconds)
     }
     return str