Leon 1 rok temu
rodzic
commit
3e20fe5f63

+ 1 - 1
config/env.ts

@@ -1,4 +1,4 @@
 
 export const APP_VERSION = '1.0.2'
 export const ANDROID_VERSION = '1.0.0'
-export const WX_VERSION = '1.6.0'
+export const WX_VERSION = '1.6.1'

+ 12 - 3
src/_record/components/picker_card.tsx

@@ -11,7 +11,16 @@ import dayjs from "dayjs";
 import { useTranslation } from "react-i18next";
 import Taro from "@tarojs/taro";
 
-export default function PickerCard(props: { onClose: any, onConfirm: any, title: string, type: string, value: any, error?: string, onChange?: any }) {
+export default function PickerCard(props: {
+    onClose: any,
+    onConfirm: any,
+    title: string,
+    type: string,
+    value: any,
+    error?: string,
+    onChange?: any,
+    color?: string,
+}) {
     const [value, setValue] = useState(props.value)
     const [pickerError, setPickerError] = useState('')
     const { t } = useTranslation()
@@ -28,7 +37,7 @@ export default function PickerCard(props: { onClose: any, onConfirm: any, title:
                 marginBottom: rpxToPx(8),
                 color: MainColorType.error
             }}>{props.error ? props.error : pickerError}</View>
-            <View style={{ height: rpxToPx(360),width:'100%',display:'flex',alignItems:'center',flexDirection:'column' }}>
+            <View style={{ height: rpxToPx(360), width: '100%', display: 'flex', alignItems: 'center', flexDirection: 'column' }}>
                 {
                     props.type == 'duration' && <NewDurationPicker color={MainColorType.black} type={DurationPickerType.normal} value={value} onChange={(e) => {
                         setValue(e)
@@ -62,7 +71,7 @@ export default function PickerCard(props: { onClose: any, onConfirm: any, title:
                 type={NewButtonType.fill}
                 width={rpxToPx(578)}
                 height={rpxToPx(96)}
-                color={MainColorType.orange}
+                color={props.color ?? MainColorType.orange}
                 title={t('health.done')}
                 onClick={() => {
                     if (props.type == 'datetime') {

+ 8 - 8
src/_record/pages/log_record.config.ts

@@ -4,14 +4,14 @@ export default definePageConfig({
     //     "recycle-item": "../../components/miniprogram-recycle-view/recycle-item"
     // },
     "disableScroll": true,
-    "componentFramework": "glass-easel",
-    "renderer": "skyline",
-    "rendererOptions": {
-        "skyline": {
-            "disableABTest": true,
-            "defaultDisplayBlock": true
-        }
-    },
+    // "componentFramework": "glass-easel",
+    // "renderer": "skyline",
+    // "rendererOptions": {
+    //     "skyline": {
+    //         "disableABTest": true,
+    //         "defaultDisplayBlock": true
+    //     }
+    // },
     "navigationStyle": "custom",
     enablePageMeta:true
 })

+ 1 - 3
src/_record/pages/log_record.scss

@@ -18,7 +18,7 @@
 
 .operate_item {
     margin-right: 32px;
-    margin-bottom: 12px;
+    margin-bottom: 26px;
     width: 698px;
     height: 168px;
     display: flex;
@@ -34,8 +34,6 @@
     margin-left: 50px;
     margin-right: 40px;
     background-color: rgba($color: #fff, $alpha: 0.5);
-    color: rgba($color: #000, $alpha: 0.75);
-    font-weight: bold;
     width: 108px;
     height: 108px;
     border-radius: 54px;

+ 18 - 12
src/_record/pages/log_record.tsx

@@ -662,7 +662,7 @@ export default function LogRecord({ route }) {
                                     <View key={index} className="operate_item h34"
                                         style={{ backgroundColor: MainColorType.white_25 }}
                                     >
-                                        <View className="first_letter h36">{item.title.substring(0, 1).toUpperCase()}</View>
+                                        <View className="first_letter h44 g01">{item.title.substring(0, 1).toUpperCase()}</View>
                                         {item.title}
                                         <View style={{ flex: 1 }} />
                                         <IconAdd color={MainColorType.g02} width={rpxToPx(36)} />
@@ -671,18 +671,24 @@ export default function LogRecord({ route }) {
                             })
                         }
 
-                        <View className="operate_item h34"
-                            style={{ backgroundColor: MainColorType.white_25, marginBottom: rpxToPx(100) }}
-                            onClick={() => {
-                                setTitle('')
-                                setChooseTitle('')
-                                setPostCount(1)
-                                setStep(1)
-                            }}><View className="first_letter h36">
+                        <NewButton type={NewButtonType.custom} onClick={() => {
+                            setTitle('')
+                            setChooseTitle('')
+                            setPostCount(1)
+                            setStep(1)
+                        }}>
+                            <View className="operate_item h34"
+                                style={{ backgroundColor: MainColorType.white_25, marginBottom: rpxToPx(100) }}
+                            >
+                                {/* <View className="first_letter h36">
                                 <Image src={BASE_IMG_URL + 'edit.svg'} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
-                            </View>{t('health.custom')}
-                            <View style={{ flex: 1 }} />
-                            <IconAdd color={MainColorType.g02} width={rpxToPx(36)} /></View>
+                            </View> */}
+                                <View className="first_letter h44 g01">{global.language == 'en' ? 'C' : '自'}</View>
+                                {t('health.custom')}
+                                <View style={{ flex: 1 }} />
+                                <IconAdd color={MainColorType.g02} width={rpxToPx(36)} /></View>
+                        </NewButton>
+
                     </View>
                 </View>
                 {/* </Snapshot> */}

+ 3 - 0
src/_record/pages/time_record.tsx

@@ -872,6 +872,7 @@ export default function TimeRecord() {
                 type="datetime"
                 title={pickerTitle}
                 error={postError}
+                color={themeColor}
                 onConfirm={(e) => {
                     update({
                         start_timestamp: e
@@ -889,6 +890,7 @@ export default function TimeRecord() {
                 type="datetime"
                 title={pickerTitle}
                 error={postError}
+                color={themeColor}
                 onConfirm={(e) => {
                     update({
                         end_timestamp: e
@@ -905,6 +907,7 @@ export default function TimeRecord() {
                 value={info.time.duration}
                 type="duration"
                 title={pickerTitle}
+                color={themeColor}
                 onConfirm={(e) => {
                     var obj = JSON.parse(JSON.stringify(info))
                     obj.time.duration = e

+ 12 - 4
src/pages/clock/Clock.tsx

@@ -43,9 +43,17 @@ export default function Clock() {
 
     if (process.env.TARO_ENV == 'weapp') {
         useShareAppMessage((e) => {
+            var path = global.clockPath ?? 'pages/clock/Clock'
+            var title = global.clockTitle ?? t('feature.track_time_duration.common.share_title')
+            var imgUrl = global.clockCover
+
+            // global.clockPath = null
+            // global.clockTitle = null
+            // global.clockCover = null
             return {
-                title: t('feature.track_time_duration.common.share_title'),
-                path: 'pages/clock/Clock'
+                title: title,
+                path: path,
+                imageUrl: imgUrl
             }
         })
     }
@@ -57,8 +65,8 @@ export default function Clock() {
 
     useEffect(() => {
         Taro.setNavigationBarColor({
-            backgroundColor:'#ffffff',
-            frontColor:'#ffffff'
+            backgroundColor: '#ffffff',
+            frontColor: '#ffffff'
         })
         if (navigation) {
             navigation.setOptions({

+ 17 - 7
src/pages/clock/ClockIndex.tsx

@@ -28,6 +28,7 @@ import PickerCard from "@/_record/components/picker_card";
 import LogPublish from "./components/log_publish";
 import RecordTimeResult from "./components/record_time_result";
 import { setFastWithSleep, setWindows } from "@/store/health";
+import { MainColorType } from "@/context/themes/color";
 
 var timer
 let useNavigation, LinearGradient;
@@ -84,8 +85,6 @@ export default function ClockIndex() {
 
     dayjs.locale(global.language == 'en' ? 'en' : 'zh-cn');
 
-    console.log('oooooooo')
-
     let navigation;
     if (useNavigation) {
         navigation = useNavigation()
@@ -101,13 +100,13 @@ export default function ClockIndex() {
         durationPickerRef.current = showDurationPicker
     }, [showDatePicker, showDurationPicker, showEndDatePicker])
 
-    useEffect(()=>{
+    useEffect(() => {
         downloadFile()
-    },[])
+    }, [])
 
     function downloadFile() {
         Taro.downloadFile({
-            url: BASE_IMG_URL+'cp_check_f.png',
+            url: BASE_IMG_URL + 'cp_check_f.png',
             success: (res) => {
                 if (res.statusCode === 200) {
                     global.checkFastImg = res.tempFilePath
@@ -120,7 +119,7 @@ export default function ClockIndex() {
         });
 
         Taro.downloadFile({
-            url: BASE_IMG_URL+'cp_check_s.png',
+            url: BASE_IMG_URL + 'cp_check_s.png',
             success: (res) => {
                 if (res.statusCode === 200) {
                     global.checkSleepImg = res.tempFilePath
@@ -222,7 +221,7 @@ export default function ClockIndex() {
         getInfo()
 
         Taro.eventCenter.on('refreshClockIndex', getHomeData)
-        if (timer){
+        if (timer) {
             clearInterval(timer)
         }
         timer = setInterval(() => {
@@ -319,6 +318,14 @@ export default function ClockIndex() {
         return ''
     }
 
+    function pickerColor(){
+        var obj = scenarios[current]
+        if (obj.theme_color) {
+            return obj.theme_color
+        }
+        return MainColorType.orange
+    }
+
     function showPicker(type, title, value, confirm) {
         setPickerTitle(title)
         setPickerValue(value)
@@ -531,6 +538,7 @@ export default function ClockIndex() {
         <Block>
             {
                 showDurationPicker && <PickerCard onClose={() => { setShowDurationPicker(false) }}
+                    color={pickerColor()}
                     value={pickerValue}
                     type="duration"
                     title={pickerTitle}
@@ -544,6 +552,7 @@ export default function ClockIndex() {
         <Block>
             {
                 showDatePicker && <PickerCard onClose={() => { setShowDatePicker(false) }}
+                    color={pickerColor()}
                     value={pickerValue}
                     type="datetime"
                     title={pickerTitle}
@@ -557,6 +566,7 @@ export default function ClockIndex() {
         <Block>
             {
                 showEndDatePicker && <PickerCard onClose={() => { setShowEndDatePicker(false) }}
+                    color={pickerColor()}
                     value={pickerValue}
                     type="datetime"
                     title={pickerTitle}

+ 2 - 0
src/pages/clock/components/index_tab.scss

@@ -6,6 +6,7 @@
     align-items: center;
     margin-top: 12px;
     margin-bottom: 12px;
+    overflow-x: scroll;
 }
 
 .index_tabbar_item {
@@ -16,6 +17,7 @@
     // justify-content: center;
     height: 84px;
     padding: 0 44px;
+    flex-shrink: 0;
 }
 
 .tab_item_nor {

+ 2 - 3
src/pages/clock/components/log_tags.scss

@@ -10,7 +10,7 @@
 
 .tag_operate_item {
     margin-right: 32px;
-    margin-bottom: 12px;
+    margin-bottom: 26px;
     width: 698px;
     // height: 156px;
     height: 168px;
@@ -27,8 +27,7 @@
     margin-left: 50px;
     margin-right: 40px;
     background-color: rgba($color: #fff, $alpha: 0.5);
-    color: rgba($color: #000, $alpha: 0.75);
-    font-weight: bold;
+
     width: 108px;
     height: 108px;
     border-radius: 54px;

+ 38 - 29
src/pages/clock/components/log_tags.tsx

@@ -30,7 +30,7 @@ export default function LogTags(props: { tags: any, scenario: any, showPublish:
                     <View key={index} className="tag_operate_item h34"
                         style={{ backgroundColor: MainColorType.white_25 }}
                     >
-                        <View className="tag_first_letter h36">{item.title.substring(0, 1).toUpperCase()}</View>
+                        <View className="tag_first_letter h44 g01">{item.title.substring(0, 1).toUpperCase()}</View>
                         {item.title}
                         <View style={{ flex: 1 }} />
                         <IconAdd color={MainColorType.g02} width={rpxToPx(36)} />
@@ -38,38 +38,47 @@ export default function LogTags(props: { tags: any, scenario: any, showPublish:
                 </NewButton>
             })
         }
-        <View className="tag_operate_item h34"
-            style={{ backgroundColor: MainColorType.white_25, marginBottom: rpxToPx(100) }}
-            onClick={() => {
+        <NewButton type={NewButtonType.custom} onClick={() => {
+            if (!user.isLogin) {
+                jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
+                return
+            }
+            props.showPublish(props.scenario, {}, true)
+            // setTitle('')
+            // setChooseTitle('')
+            // setPostCount(1)
+            // setStep(1)
+        }}>
+            <View className="tag_operate_item h34"
+                style={{ backgroundColor: MainColorType.white_25, marginBottom: rpxToPx(100) }}
+            >
+                <View className="tag_first_letter h44 g01">{global.language == 'en' ? 'C' : '自'}</View>
+                {/* <View className="tag_first_letter h44 g01">
+                <Image src={BASE_IMG_URL + 'edit.svg'} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
+            </View> */}
+                {t('health.custom')}
+                <View style={{ flex: 1 }} />
+                <IconAdd color={MainColorType.g02} width={rpxToPx(36)} /></View>
+        </NewButton>
+
+
+        {
+            props.showMove && props.scenario == 'ACTIVITY' && <NewButton type={NewButtonType.custom} onClick={() => {
                 if (!user.isLogin) {
                     jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
                     return
                 }
-                props.showPublish(props.scenario, {}, true)
-                // setTitle('')
-                // setChooseTitle('')
-                // setPostCount(1)
-                // setStep(1)
-            }}><View className="tag_first_letter h36">
-                <Image src={BASE_IMG_URL + 'edit.svg'} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
-            </View>{t('health.custom')}
-            <View style={{ flex: 1 }} />
-            <IconAdd color={MainColorType.g02} width={rpxToPx(36)} /></View>
-        {
-            props.showMove && props.scenario == 'ACTIVITY' && <View className="tag_operate_item h34"
-                style={{ backgroundColor: MainColorType.white_25, marginBottom: rpxToPx(100), marginTop: -rpxToPx(88) }}
-                onClick={() => {
-                    if (!user.isLogin) {
-                        jumpPage('/_account/pages/ChooseAuth', 'ChooseAuth')
-                        return
-                    }
-                    jumpPage('/_health/pages/move')
-                }}><View className="tag_first_letter h36">
-                    <Image src={BASE_IMG_URL + 'walk.svg'} style={{ width: rpxToPx(36), height: rpxToPx(36) }} />
-                </View>{global.language == 'en' ? 'Steps' : '步数'}
-                <View style={{ flex: 1 }} />
-                <IconArrow color={MainColorType.g02} width={rpxToPx(36)} />
-            </View>
+                jumpPage('/_health/pages/move')
+            }}>
+                <View className="tag_operate_item h34"
+                    style={{ backgroundColor: MainColorType.white_25, marginBottom: rpxToPx(100), marginTop: -rpxToPx(74) }}
+                >
+                    <View className="tag_first_letter h44 g01">{global.language == 'en' ? 'S' : '步'}</View>
+                    {global.language == 'en' ? 'Steps' : '步数'}
+                    <View style={{ flex: 1 }} />
+                    <IconArrow color={MainColorType.g02} width={rpxToPx(36)} />
+                </View>
+            </NewButton>
         }
     </View>
 }

+ 4 - 4
src/pages/clock/components/record_time.scss

@@ -276,15 +276,15 @@
 
 .time_record_card{
     width: 692px;
-    height: 156px;
+    height: 168px;
     border-radius: 42px;
     display: flex;
     align-items: center;
     justify-content: center;
-    margin-top: 12px;
+    margin-top: 26px;
     background-color: rgba($color: #ffffff, $alpha: 0.25);
     font-size: 34px;
-    font-weight: bold;
+    // font-weight: bold;
     position: relative;
 }
 
@@ -292,7 +292,7 @@
     position: absolute;
     width: 36px;
     height: 36px;
-    top: 60px;
+    top: 66px;
     right:50px;
     display: flex;
     align-items: center;

+ 25 - 5
src/pages/clock/components/record_time.tsx

@@ -77,6 +77,7 @@ export default function RecordTime(props: {
     const [postError, setPostError] = useState('')
 
     const [pickerTitle, setPickerTitle] = useState('')
+    const [shareCoverUrl, setShareCoverUrl] = useState('')
 
     const { t } = useTranslation()
 
@@ -695,16 +696,28 @@ export default function RecordTime(props: {
                             onClick={more}
                         >
                             <View style={{ width: rpxToPx(72), height: rpxToPx(72), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
-                                <IconMore2 width={rpxToPx(36)} color="#000" />
+                                <IconMore2 width={rpxToPx(36)} color={MainColorType.black_25} />
                             </View>
 
                         </NewButton>
                         {/* <View onClick={more}>More</View> */}
                     </View>
                 }
-                {/* {
+                {
                     status == 'OG' && <View className="share_icon">
-                        <ShareBtn>
+                        <ShareBtn onClick={() => {
+                            var title = ''
+                            var shareDate = global.language == 'en' ? 'Today\'s' : '今日'
+                            if (scenario == 'FAST') {
+                                title = t('health.share_check_in', { date: shareDate, type: t('health.fasting') })
+                            }
+                            else {
+                                title = t('health.share_check_in', { date: shareDate, type: t('health.sleep') })
+                            }
+                            global.clockTitle = title
+                            global.clockPath = `/_health/pages/timeline_detail?type=recent&fast_type=IF&window_id=${info.id}&uid=${user.id}&isfastsleep=${0}&disable_edit=1&enter_type=share`
+                            global.clockCover = shareCoverUrl
+                        }}>
                             <Image onClick={() => {
                             }} src={require('@assets/_health/wechat.png')} style={{
                                 width: rpxToPx(72),
@@ -712,7 +725,7 @@ export default function RecordTime(props: {
                             }} />
                         </ShareBtn>
                     </View>
-                } */}
+                }
 
 
             </View>
@@ -892,7 +905,14 @@ export default function RecordTime(props: {
             <MomentDetailShare
                 user={user}
                 canvas_id={"time_record" + scenario}
-                btnColor={props.theme_color ?? MainColorType.orange} />
+                btnColor={props.theme_color ?? MainColorType.orange}
+                save={
+                    (url) => {
+                        debugger
+                        setShareCoverUrl(url)
+                    }
+                }
+            />
             <View style={{ height: 100 }} />
         </View>
     </ScrollView>

+ 18 - 6
src/pages/moment/moment_detail_share.tsx

@@ -6,17 +6,17 @@ import { MainColorType } from "@/context/themes/color";
 
 let Canvas
 
-if (process.env.TARO_ENV == 'weapp'){
+if (process.env.TARO_ENV == 'weapp') {
     Canvas = require("@tarojs/components").Canvas
 }
 
-export default function MomentDetailShare(props: { user: any, canvas_id?: string, cover?: string, btnColor?: string }) {
+export default function MomentDetailShare(props: { user: any, canvas_id?: string, cover?: string, btnColor?: string, save?: any }) {
     const user = props.user;
 
     const info = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync()
     const dpr = info.pixelRatio; // 获取设备的像素比
 
-    if (process.env.TARO_ENV=='rn') return <View />
+    if (process.env.TARO_ENV == 'rn') return <View />
     useEffect(() => {
         downCover()
 
@@ -130,7 +130,7 @@ export default function MomentDetailShare(props: { user: any, canvas_id?: string
                 const width = 292 * dpr; // 矩形宽度
                 const height = 72 * dpr; // 矩形高度
                 const radius = 18 * dpr; // 圆角半径
- 
+
                 // 绘制带圆角的矩形
 
                 ctx.beginPath();
@@ -184,7 +184,13 @@ export default function MomentDetailShare(props: { user: any, canvas_id?: string
                     canvas: canvas,
                     success: (res) => {
                         console.log('图片保存成功:', res.tempFilePath);
-                        global.momentdetail_share_url = res.tempFilePath
+
+                        if (props.save) {
+                            props.save(res.tempFilePath)
+                        }
+                        else {
+                            global.momentdetail_share_url = res.tempFilePath
+                        }
                     },
                     fail: (err) => {
                         console.error('转为图片失败:', err);
@@ -270,7 +276,13 @@ export default function MomentDetailShare(props: { user: any, canvas_id?: string
                 canvas: canvas,
                 success: (res) => {
                     console.log('图片保存成功:', res.tempFilePath);
-                    global.momentdetail_share_url = res.tempFilePath
+                    // global.momentdetail_share_url = res.tempFilePath
+                    if (props.save) {
+                        props.save(res.tempFilePath)
+                    }
+                    else {
+                        global.momentdetail_share_url = res.tempFilePath
+                    }
                 },
                 fail: (err) => {
                     console.error('转为图片失败:', err);

+ 1 - 1
src/services/http/api.js

@@ -1,4 +1,4 @@
-const online = process.env.TARO_ENV == 'weapp' ? false : false;
+const online = process.env.TARO_ENV == 'weapp' ? true : false;
 
 import { WX_VERSION as _WX_VERSION, APP_VERSION as _APP_VERSION, ANDROID_VERSION as _ANDROID_VERSION } from "../../../config/env";