leon 1 年間 前
コミット
91d4854f52

+ 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.5.5'
+export const WX_VERSION = '1.5.6'

+ 11 - 9
src/_health/components/schedule_item.tsx

@@ -5,7 +5,7 @@ import { View, Text, Switch, ScrollView, Input } from "@tarojs/components";
 import { AtSwipeAction } from "taro-ui";
 import StatusIndicator, { StatusType } from "../base/status_indicator";
 import { MainColorType } from "@/context/themes/color";
-import { IconError, IconNotificationOff } from "@/components/basic/Icons";
+import { IconError, IconNotification, IconNotificationOff } from "@/components/basic/Icons";
 import { useState } from "react";
 import NewModal from "../base/new_modal";
 import Card from "./card";
@@ -13,6 +13,7 @@ import NewTimePicker from "../base/new_timepicker";
 import './schedule_item.scss'
 import dayjs from "dayjs";
 import { useTranslation } from "react-i18next";
+import { useSelector } from "react-redux";
 
 export default function ScheduleItem(props: {
     key: any,
@@ -32,6 +33,7 @@ export default function ScheduleItem(props: {
     index: number,
     count: number
 }) {
+    const permission = useSelector((state: any) => state.permission);
     const [showTimePicker, setShowTimePicker] = useState(false)
     const [time, setTime] = useState(props.obj.time)
 
@@ -133,7 +135,7 @@ export default function ScheduleItem(props: {
                                     return <View className="label"
                                         style={{
                                             backgroundColor: item.title == strLabel ? getThemeColor('ACTIVE') : '#B2B2B21A',
-                                            color:item.title == strLabel ?'#fff':'#000'
+                                            color: item.title == strLabel ? '#fff' : '#000'
                                         }}
                                         key={index} onClick={() => setStrLabel(item.title)}>{item.title}</View>
                                 })
@@ -172,12 +174,12 @@ export default function ScheduleItem(props: {
         </View>
     }
 
-    function disableDelete(){
-        if (props.obj.window == 'FAST' || props.obj.window == 'SLEEP'){
+    function disableDelete() {
+        if (props.obj.window == 'FAST' || props.obj.window == 'SLEEP') {
             return true;
         }
         if (props.disable) return true;
-        if (props.obj.window == 'EAT' || props.obj.window == 'ACTIVE'){
+        if (props.obj.window == 'EAT' || props.obj.window == 'ACTIVE') {
             return false
         }
         return true;
@@ -215,8 +217,8 @@ export default function ScheduleItem(props: {
                     showAlert({
                         title: t('health.del_title'),
                         content: '',
-                        cancelText:t('health.del_cancel'),
-                        confirmText:t('health.del_confirm'),
+                        cancelText: t('health.del_cancel'),
+                        confirmText: t('health.del_confirm'),
                         showCancel: true,
                         cancel: () => {
                             console.log('cancel')
@@ -251,7 +253,7 @@ export default function ScheduleItem(props: {
                             props.days && <View className="h30" style={{ color: MainColorType.g02 }}>+{props.days} day</View>
                         }
                         {
-                            !props.hideReminderIcon && props.obj.specific_time && !props.obj.reminder && <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
+                            props.obj.specific_time && (permission.wxPubFollow && props.obj.reminder ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />)
                         }
                         <View style={{ width: rpxToPx(12) }} />
                         {
@@ -275,7 +277,7 @@ export default function ScheduleItem(props: {
                             </View>
                         }
                         {
-                            props.obj.specific_time &&props.disable && <View className="schedule_border" style={{ borderColor: 'transparent' }}>
+                            props.obj.specific_time && props.disable && <View className="schedule_border" style={{ borderColor: 'transparent' }}>
                                 <View className="edit_item_time" style={{ backgroundColor: 'transparent', color: props.gray ? MainColorType.g02 : '#000' }}>{props.obj.time}</View>
                             </View>
                         }

+ 44 - 19
src/_health/pages/add_moment.tsx

@@ -131,6 +131,29 @@ export default function AddMoment() {
         })
     })
 
+    const getImageInfo = (src) => {
+        const { tempFilePath } = src
+        return new Promise((resolve) => {
+            Taro.getImageInfo({
+                src: tempFilePath,
+                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'
+                }),
+            });
+        });
+    };
+
     function addImage(isCamera) {
         var source: any = isCamera ? ['camera'] : ['album']
         console.log(source)
@@ -139,26 +162,28 @@ export default function AddMoment() {
             sizeType: ['compressed'],
             mediaType: ['image'],
             sourceType: source,
-            success: function (res) {
+            success: async function (res) {
+                const results = await Promise.all(res.tempFiles.map(getImageInfo));
+                debugger
+
+                // Taro.downloadFile({
+                //     url: 'https://fast-prod.oss-cn-beijing.aliyuncs.com/users/832f82c2bf616063fcf5619063a060c9/food-journal/2024/64efc6fe-5fca-49a3-9828-497e87ad9582_20241216120746_684.jpg',
+                //     success(result) {
+                //         Taro.getImageInfo({
+                //             src: result.tempFilePath,
+                //             success(result2) {
+                //                 console.log(result2)
+                //                 debugger
+                //             },
+                //             fail(res) {
+                //                 console.log(res)
+                //                 debugger
+                //             },
+                //         })
+                //     },
+                // })
 
-                Taro.downloadFile({
-                    url:'https://fast-prod.oss-cn-beijing.aliyuncs.com/users/832f82c2bf616063fcf5619063a060c9/food-journal/2024/64efc6fe-5fca-49a3-9828-497e87ad9582_20241216120746_684.jpg',
-                    success(result) {
-                        Taro.getImageInfo({
-                            src:result.tempFilePath,
-                            success(result2) {
-                                console.log(result2)
-                                debugger
-                            },
-                            fail(res) {
-                                console.log(res)
-                                debugger
-                            },
-                        })
-                    },
-                })
 
-                
                 chooseSuccess(res, true)
                 checkAuthorized()
             },
@@ -341,7 +366,7 @@ export default function AddMoment() {
     }
 
     async function chooseSuccess(res, isAlbum, isFilePath = false) {
-        console.log('选择图片',res)
+        console.log('选择图片', res)
         const filePaths = res.tempFiles.map(file =>
             process.env.TARO_ENV === 'rn' || isFilePath ? file.path : file.tempFilePath
         )

+ 4 - 0
src/_health/pages/move_schedule.tsx

@@ -72,6 +72,10 @@ export default function MoveSchedule() {
         }
     }, [])
 
+    global.upcomingSchedule = ()=>{
+        getData()
+    }
+
     function getData() {
         getActiveMovesCurrent().then(res => {
             setLoaded(true)

+ 3 - 0
src/_health/pages/move_setting_reminder.tsx

@@ -121,6 +121,9 @@ export default function MoveSettingReminder() {
                                                 if (global.updateMove) {
                                                     global.updateMove()
                                                 }
+                                                if (global.upcomingSchedule){
+                                                    global.upcomingSchedule()
+                                                }
                                             })
                                         }}
                                     />

+ 2 - 2
src/_health/pages/post_result.tsx

@@ -50,7 +50,7 @@ export default function PostResult() {
     const dispatch = useDispatch()
     const { t } = useTranslation()
 
-    if (process.env.TARO_ENV == 'weapp') {
+    if (process.env.TARO_ENV == 'weapp' && global.allowShare) {
 
         useShareAppMessage((e) => {
             var title = ''
@@ -295,7 +295,7 @@ export default function PostResult() {
 
         <View style={{ flex: 1 }} />
         {
-            (data.window_id || data.event_id) && <View className="share_btn_bg2">
+            global.allowShare && (data.window_id || data.event_id) && <View className="share_btn_bg2">
 
                 <View className="share_icon_bg2">
                     <View className="h26" style={{ color: MainColorType.link }}>{t('health.share_moment')}</View>

+ 33 - 5
src/_health/pages/recent.tsx

@@ -1,13 +1,14 @@
 import HistoryItem from "@/features/health/HistoryItem";
 import { records } from "@/services/health";
 import { rpxToPx } from "@/utils/tools";
-import { View, Text } from "@tarojs/components";
+import { View, Text, Image } from "@tarojs/components";
 import VirtualList from "@tarojs/components/virtual-list";
 import Taro from "@tarojs/taro";
 import dayjs from "dayjs";
 import { useEffect, useState } from "react";
 import { useSelector } from "react-redux";
 import ListFooter from "../components/list_footer";
+import JournalCover from "@/features/journal/components/journal_cover";
 
 export default function Recent(props: { type?: string, fast_type?: string, children: any }) {
     const [list, setList] = useState<any>([])
@@ -19,7 +20,7 @@ export default function Recent(props: { type?: string, fast_type?: string, child
     const [loaded, setLoaded] = useState(false)
     const [total, setTotal] = useState(0)
     const systemInfo = Taro.getSystemInfoSync();
-    const pageHeight = systemInfo.screenHeight-(systemInfo.statusBarHeight??0)-(systemInfo.platform === 'ios' ? 44 : 48)
+    const pageHeight = systemInfo.screenHeight - (systemInfo.statusBarHeight ?? 0) - (systemInfo.platform === 'ios' ? 44 : 48)
 
     useEffect(() => {
         loadData(1)
@@ -109,6 +110,7 @@ export default function Recent(props: { type?: string, fast_type?: string, child
                                             title: moment.title,
                                             description: moment.description,
                                             url: moment.media[0].url,
+                                            urls: moment.media,
                                             event_id: event.id
                                         }
                                     ]
@@ -174,6 +176,8 @@ export default function Recent(props: { type?: string, fast_type?: string, child
             else {
                 console.log('ssss', list.length, array.length)
                 setList([...list, ...array])
+
+                
                 // if (index>=5){
                 //     return
                 // }
@@ -212,21 +216,39 @@ export default function Recent(props: { type?: string, fast_type?: string, child
         }
         return <View />
     }
-    return <View style={{height:'100vh',overflow:'hidden'}}>
+    return <View style={{ height: '100vh', overflow: 'hidden' }}>
         <recycle-view batch={true} id="recycleId"
             // style="height:500"
             height={pageHeight}
             onScrolltolower={more}
-            // onScrolltolower={refresh}
+        // onScrolltolower={refresh}
         >
             <view slot="before">{props.children}</view>
             {
                 list.map((item, index) => {
+                    // var urlArray: any = []
+                    // if (item.pics.length > 0) {
+                    //     debugger
+                    //     urlArray = item.pics.map(obj => obj.url);
+                    // }
+                    debugger
                     return <recycle-item key={index}>
-                        <View style={{backgroundColor:'#fff'}}>
+                        <View style={{ backgroundColor: '#fff', display: 'flex', flexDirection: 'column', width: rpxToPx(750) }}>
                             {
                                 historyMonth(index)
                             }
+                            {/* {
+                                item.dataArray && item.dataArray[0].type == 'PIC_TEXT' && <Text>{item.dataArray[0].data[0].description}</Text>
+                            }
+                            {
+                                item.dataArray && item.dataArray[0].type == 'PIC_TEXT' && <JournalCover imgs={[item.dataArray[0].data[0].url,item.dataArray[0].data[0].url,item.dataArray[0].data[0].url,item.dataArray[0].data[0].url,item.dataArray[0].data[0].url]}/>
+                            } */}
+                            {/* {
+                                item.texts.length > 0 && <Text>{item.texts[0].description}</Text>
+                            }
+                            {
+                                item.pics.length > 0 && <JournalCover imgs={item.pics}/>
+                            } */}
                             <HistoryItem
                                 data={item}
                                 preData={index > 0 ? list[index - 1] : null}
@@ -238,6 +260,12 @@ export default function Recent(props: { type?: string, fast_type?: string, child
                                 onClick={() => {
 
                                 }} />
+                            {/* <Image src="https://fast-prod.oss-cn-beijing.aliyuncs.com/users/832f82c2bf616063fcf5619063a060c9/food-journal/2024/64efc6fe-5fca-49a3-9828-497e87ad9582_20241216120746_684.jpg?x-oss-process=image/format,webp"
+                                style={{
+                                    width: 100,
+                                    height: 100
+                                }}
+                            /> */}
                         </View>
                     </recycle-item>
                 })

+ 9 - 6
src/_health/pages/timeline_detail.tsx

@@ -85,18 +85,18 @@ export default function TimelineDetail() {
     console.log(router.params)
 
     const launchObj = Taro.getLaunchOptionsSync()
-    console.log('launchObj',launchObj)
+    console.log('launchObj', launchObj)
 
-    if (launchObj.shareTicket){
+    if (launchObj.shareTicket) {
         Taro.getShareInfo({
-            shareTicket:launchObj.shareTicket,
+            shareTicket: launchObj.shareTicket,
             success(result) {
-                console.log('share info',result)
+                console.log('share info', result)
             },
         })
     }
 
-    if (process.env.TARO_ENV == 'weapp') {
+    if (process.env.TARO_ENV == 'weapp' && global.allowShare) {
         Taro.updateShareMenu({
             withShareTicket: true,
             success() { }
@@ -889,13 +889,16 @@ export default function TimelineDetail() {
                             {/* <Text className="h24 g02">{publish.edited ? '编辑于' : '发布于'}{dayjs(publish.timestamp).format('M月D日 HH:mm')}</Text> */}
                             <Text className="h24 g02">{footerTime(publish)}</Text>
                             <View style={{ flex: 1 }} />
-                            <View className="share_btn_bg">
+                            {global.allowShare && <View className="share_btn_bg">
 
                                 <View className="share_icon_bg">
                                     <IconShare color={MainColorType.link + 'cc'} width={rpxToPx(32)} />
                                 </View>
                                 <Button className="share_btn" openType="share">1</Button>
                             </View>
+
+                            }
+
                             {!router.params.uid && <NewButton
                                 type={NewButtonType.more}
                                 onClick={tapMore}

+ 8 - 1
src/features/health/HistoryItem.tsx

@@ -23,6 +23,7 @@ import Cell from "@/_health/base/cell";
 import { setFirstActiveId, setFirstEatId } from "@/store/health";
 import JournalCover from "../journal/components/journal_cover";
 import TimelineDate from "@/_health/components/timeline_date";
+import { useEffect } from "react";
 
 export default function HistoryItem(props: {
     data: any,
@@ -39,6 +40,11 @@ export default function HistoryItem(props: {
     const health = useSelector((state: any) => state.health);
     const scale = '?x-oss-process=image/format,webp/resize,w_400'
 
+    useEffect(()=>{
+        return ()=>{
+            console.log('dealloc history item')
+        }
+    },[])
 
     function goDetail(event_id?: any) {
         // debugger
@@ -126,6 +132,7 @@ export default function HistoryItem(props: {
                 //         })
                 //     }}
                 //     mode="aspectFill" />
+
             }
             {
                 type == 'PIC_TEXT' && <View style={{
@@ -134,7 +141,7 @@ export default function HistoryItem(props: {
                     flexShrink: 0,
                     flexDirection: 'column',
                     backgroundColor: 'transparent',
-                    paddingLeft: rpxToPx(17),
+                    // paddingLeft: rpxToPx(17),
                     paddingRight: 0,
                     paddingTop: 0,
                     paddingBottom: 0

+ 6 - 3
src/features/health/MainConsole.tsx

@@ -45,6 +45,7 @@ if (process.env.TARO_ENV == 'rn') {
 
 export default function MainConsole(props: { type: WindowType }) {
     const health = useSelector((state: any) => state.health);
+    const permission = useSelector((state: any) => state.permission);
     const user = useSelector((state: any) => state.user);
     const [durationPicker, setDurationPicker] = useState(false)
     const [btnDisable, setBtnDisable] = useState(false)
@@ -385,9 +386,11 @@ export default function MainConsole(props: { type: WindowType }) {
                 >{
                         (item.real || (health.mode == 'DAY' || health.mode == 'NIGHT')) ? processIcon(index) : <IconCircle width={rpxToPx(32)} color={MainColorType.g02} />
                     }</StatusIndicator>
-                {
-                    item.reminder ? <IconNotification color={MainColorType.g02} width={rpxToPx(24)} /> : <IconNotificationOff color={MainColorType.g02} width={rpxToPx(24)} />
-                }
+                <View style={{marginTop:rpxToPx(4),marginLeft:rpxToPx(4)}}>
+                    {
+                        item.specific_time && (permission.wxPubFollow && item.reminder ? <IconNotification color={MainColorType.g03} width={rpxToPx(24)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(24)} />)
+                    }
+                </View>
             </View>
 
         }

+ 0 - 7
src/features/health/MainHistory.tsx

@@ -755,13 +755,6 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
                 {
                     list.map((item, index) => {
                         if (itemLayouts.length >= index + 1 && pageTop > 0) {
-                            // if (Math.abs(itemLayouts[index] - pageTop) > 2500) {
-                            //     return <View style={{ height: itemHeights[index] }} id={`history-${index}`} key={index}>
-                            //         {
-                            //             historyMonth(index)
-                            //         }
-                            //     </View>
-                            // }
                             if (Math.abs(itemLayouts[index] - pageTop) > 3000) {
                                 return <View style={{ height: itemHeights[index] }} id={`history-${index}`}>
                                     {/* {index} */}

+ 50 - 34
src/pages/account/Journal.tsx

@@ -48,6 +48,8 @@ export default function Journal() {
     const { t } = useTranslation()
     const [pageTop, setPageTop] = useState(0)
 
+    const query = Taro.createSelectorQuery()
+
     let router
     let navigation;
     if (useNavigation) {
@@ -66,11 +68,11 @@ export default function Journal() {
 
     const [showTip, setShowTip] = useState(router.params.show_tip == '1')
 
-    useEffect(()=>{
-        return ()=>{
+    useEffect(() => {
+        return () => {
             myScrollTop = 0
         }
-    },[])
+    }, [])
 
 
     useEffect(() => {
@@ -82,7 +84,7 @@ export default function Journal() {
             setTimeout(() => {
                 // console.log('journals length', journals.length)
                 measureItemLayouts()
-            }, 500)
+            }, 300)
         }
     }, [journals])
 
@@ -140,28 +142,43 @@ export default function Journal() {
     }
 
     function measureItemLayouts() {
-        const query = Taro.createSelectorQuery()
-        journals.forEach((item, index) => {
-            // if (index >= itemLayouts.length) {
-            query.select(`#history-${index}`).boundingClientRect()
-            // }
-
-        });
-        query.exec((res) => {
-
-            var layouts: any = []
-            var heights: any = []
-            res.forEach((rect, index) => {
-                if (rect) {
-                    layouts[index] = rect.top + myScrollTop
-                    heights[index] = rect.height
+
+        if (journals.length <= 10) {
+            journals.forEach((item, index) => {
+                query.select(`#history-${index}`).boundingClientRect()
+            });
+            query.exec((res) => {
+                var layouts: any = []
+                var heights: any = []
+                res.forEach((rect, index) => {
+                    if (rect) {
+                        layouts[index] = rect.top + myScrollTop
+                        heights[index] = rect.height
+                    }
+                });
+                setItemHeights(heights)
+                setItemLayouts(layouts)
+            })
+        }
+        else {
+            journals.forEach((item, index) => {
+                if (index >= itemLayouts.length) {
+                    query.select(`#history-${index}`).boundingClientRect()
                 }
             });
-            setItemHeights(heights)
-            setItemLayouts(layouts)
-            // setItemLayouts([...itemLayouts, ...layouts])
-            // setItemHeights([...itemHeights, ...heights])
-        })
+            query.exec((res) => {
+                var layouts: any = []
+                var heights: any = []
+                res.forEach((rect, index) => {
+                    if (rect) {
+                        layouts[index] = rect.top + myScrollTop
+                        heights[index] = rect.height
+                    }
+                });
+                setItemLayouts([...itemLayouts, ...layouts])
+                setItemHeights([...itemHeights, ...heights])
+            })
+        }
     }
 
     function onScroll(e) {
@@ -407,19 +424,18 @@ export default function Journal() {
 
     function itemData(index, item) {
         if (itemLayouts.length >= index + 1 && pageTop > 0) {
-            if (Math.abs(itemLayouts[index] - pageTop) > 3000) {
-                return <View style={{ height: itemHeights[index] }} id={`history-${index}`}>
-                    {/* {index} */}
+            if (Math.abs(itemLayouts[index] - pageTop) > 1500) {
+                return <View style={{ height: itemHeights[index] }} id={`history-empty-${index}`}>
                 </View>
             }
-            if (Math.abs(itemLayouts[index] - pageTop) > 1500) {
+            if (Math.abs(itemLayouts[index] - pageTop) > 1000) {
                 return <View style={{
                     height: itemHeights[index], display: 'flex',
                     paddingLeft: rpxToPx(40),
                     paddingRight: rpxToPx(40),
                     boxSizing: 'border-box',
                     flexDirection: 'row'
-                }} id={`history-${index}`}>
+                }} id={`history-empty-${index}`}>
                     <TimelineDate
                         timestamp={item.timestamp}
                         pre_timestamp={index > 0 ? journals[index - 1].timestamp : null}
@@ -456,11 +472,11 @@ export default function Journal() {
     // console.log(journals.length, itemLayouts, pageTop)
 
 
-    return <StickyDateList 
-    // onRefresherRefresh={() => {
-    //     setIsPulling(true)
-    //     getJounalsData(1)
-    // }} isPulling={isPulling}
+    return <StickyDateList
+        // onRefresherRefresh={() => {
+        //     setIsPulling(true)
+        //     getJounalsData(1)
+        // }} isPulling={isPulling}
         onScroll={onScroll}
         showDate={showDate}
         date={date}

+ 24 - 22
src/pages/account/JournalDetail.tsx

@@ -81,43 +81,43 @@ export default function JournalDetail() {
 
     }, [])
 
-    if (process.env.TARO_ENV == 'weapp') {
+    if (process.env.TARO_ENV == 'weapp' && global.allowShare) {
         useShareAppMessage((e) => {
-            var {timestamp} = data
+            var { timestamp } = data
             var shareDate = ''
-            if (TimeFormatter.isToday(timestamp)){
-                shareDate = global.language == 'en'?'Today\'s':'今日'
+            if (TimeFormatter.isToday(timestamp)) {
+                shareDate = global.language == 'en' ? 'Today\'s' : '今日'
             }
-            else if (TimeFormatter.isYesterday(timestamp)){
-                shareDate = global.language == 'en'?'Yesterday\'s':'昨日'
+            else if (TimeFormatter.isYesterday(timestamp)) {
+                shareDate = global.language == 'en' ? 'Yesterday\'s' : '昨日'
             }
-            else if (TimeFormatter.isTimestampInThisWeek(timestamp)){
-                shareDate = global.language == 'en'?(dayjs(timestamp).format('dddd')+'\'s'):dayjs(timestamp).format('dddd')
+            else if (TimeFormatter.isTimestampInThisWeek(timestamp)) {
+                shareDate = global.language == 'en' ? (dayjs(timestamp).format('dddd') + '\'s') : dayjs(timestamp).format('dddd')
             }
             else {
-                shareDate = global.language == 'en'?dayjs(timestamp).format('MMMM D'):dayjs(timestamp).format('MMMD日')
+                shareDate = global.language == 'en' ? dayjs(timestamp).format('MMMM D') : dayjs(timestamp).format('MMMD日')
             }
-            var title = t('health.share_all_journal',{date:shareDate})
+            var title = t('health.share_all_journal', { date: shareDate })
             var defaultImg = SHARE_COVER_URL + 'my_journal.jpg'
             if (router.params.window == 'EAT') {
-                title = t('health.share_food_journal',{date:shareDate})
+                title = t('health.share_food_journal', { date: shareDate })
                 defaultImg = SHARE_COVER_URL + 'my_meal_journal.jpg'
             }
             else if (router.params.window == 'ACTIVE') {
-                title = t('health.share_activity_journal',{date:shareDate})
+                title = t('health.share_activity_journal', { date: shareDate })
                 defaultImg = SHARE_COVER_URL + 'my_activity_journal.jpg'
             }
 
             const uid = router.params.uid
 
             var imageUrl = imgs.length > 0 ? imgs[0] : defaultImg
-            var nickname = shareUser?shareUser.nickname:user.nickname
-            if (nickname.length>10){
-                nickname.substring(0,10)+'...'
+            var nickname = shareUser ? shareUser.nickname : user.nickname
+            if (nickname.length > 10) {
+                nickname.substring(0, 10) + '...'
             }
 
             return {
-                title: nickname+': '+title,
+                title: nickname + ': ' + title,
                 path: `pages/account/JournalDetail?date=${date}&uid=${uid ?? user.id}&window=${router.params.window}`,
                 imageUrl: imageUrl
                 // imageUrl:'/src/assets/_health/share_01.jpg'
@@ -338,13 +338,15 @@ export default function JournalDetail() {
                             dayjs(data.publish.timestamp).format('MMM D HH:mm') :
                             dayjs(data.publish.timestamp).format('M月D日 HH:mm')
                     })}</Text>
-                    <View className="share_btn_bg">
-
-                        <View className="share_icon_bg">
-                            <IconShare color={MainColorType.link + 'cc'} width={rpxToPx(32)} />
+                    {
+                        global.allowShare && <View className="share_btn_bg">
+                            <View className="share_icon_bg">
+                                <IconShare color={MainColorType.link + 'cc'} width={rpxToPx(32)} />
+                            </View>
+                            <Button className="share_btn" openType="share">1</Button>
                         </View>
-                        <Button className="share_btn" openType="share">1</Button>
-                    </View>
+                    }
+
                 </View>
                 {/* <Text className="h24" style={{ color: MainColorType.g02, marginTop: rpxToPx(17), lineHeight: rpxToPx(60) + 'px' }}>发布于{dayjs(data.publish_timestamp).format('M月D日 HH:mm')}</Text> */}
             </View>

+ 24 - 9
src/pages/clock/Clock.tsx

@@ -17,6 +17,7 @@ import AddLabel from "@/_health/components/add_label";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import showAlert from "@/components/basic/Alert";
 import { setTitle } from "@/store/health";
+import { globalSetting } from "@/services/common";
 
 let useNavigation;
 
@@ -35,7 +36,7 @@ export default function Clock() {
     const [showCalendar, setShowCalendar] = useState(false)
     const [showStreak, setShowStreak] = useState(true)
 
-    const systemInfo: any = Taro.getWindowInfo?Taro.getWindowInfo():Taro.getSystemInfoSync();
+    const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
     const navigationBarHeight = systemInfo.statusBarHeight + 44;
     const [showModal, setShowModal] = useState(false)
     const [labels, setLabels] = useState<any>([])
@@ -75,8 +76,22 @@ export default function Clock() {
         else {
             loadRNCache()
         }
+        getSetting()
     }, [])
 
+    function getSetting() {
+        globalSetting({
+            keys: 'mp_status'
+        }).then(res => {
+            if ((res as any).data && (res as any).data[0].value.status == 'PENDING') {
+                global.allowShare = false
+            }
+            else {
+                global.allowShare = true
+            }
+        })
+    }
+
     function loadWXCache() {
         var gps = Taro.getStorageSync('gps')
         if (gps) {
@@ -138,7 +153,7 @@ export default function Clock() {
     function haveStreaks() {
 
 
-        if (user.isLogin && health.windows && health.mode.length>0) {
+        if (user.isLogin && health.windows && health.mode.length > 0) {
             const scenario = getScenario(health.windows, health.mode)
             if (scenario.current_streak) {
                 return true
@@ -299,7 +314,7 @@ export default function Clock() {
                 // onlyCheck={true}
                 // schedules={[]}
                 confirm={(res) => {
-                    
+
                     if ((res as any).result) {
                         global.refreshWindow()
                         setShowModal(false)
@@ -315,18 +330,18 @@ export default function Clock() {
                             showCancel: false,
                             confirmText: t('health.check_conflict'),
                             confirm: () => {
-                                setTimeout(()=>{
+                                setTimeout(() => {
                                     setShowModal(false)
-                                },1000)
+                                }, 1000)
 
-                                if ((res as any).show_conflict_dialog){
-                                    jumpPage('/_health/pages/schedules?mode='+ '&error=' + JSON.stringify(res))
+                                if ((res as any).show_conflict_dialog) {
+                                    jumpPage('/_health/pages/schedules?mode=' + '&error=' + JSON.stringify(res))
                                 }
                                 else {
                                     jumpPage('/_health/pages/schedules?mode=' + health.mode + '&error=' + JSON.stringify(res))
                                 }
-                                
-                                
+
+
                                 // jumpPage(`./schedules?mode=&schedules=${JSON.stringify((res as any).schedules)}&errors=${JSON.stringify((res as any).error_messages)}`)
                             }
                         })

+ 17 - 5
src/services/common.tsx

@@ -14,14 +14,14 @@ export const staticResources = () => (dispatch: any) => {
     })
 }
 
-export const systemVersion = (sys:string) => {
+export const systemVersion = (sys: string) => {
     return new Promise((resolve, reject) => {
-        var platform = kIsIOS?'IOS':'ANDROID'
-        
+        var platform = kIsIOS ? 'IOS' : 'ANDROID'
+
         request({
             url: API_SYSTEM_VERSION, method: 'GET', data: {
-                sys:sys,
-                platform:platform
+                sys: sys,
+                platform: platform
             }
         }).then(res => {
             resolve(res)
@@ -43,6 +43,18 @@ export const gobalConfigs = () => (dispatch: any) => {
     })
 }
 
+export const globalSetting = (params) => {
+    return new Promise((resolve, reject) => {
+        request({
+            url: API_GLOBAL_CONFIGS, method: 'GET', data: {
+                ...params
+            }
+        }).then(res => {
+            resolve(res)
+        })
+    })
+}
+
 export const clientInfo = (params) => {
     request({
         url: API_USER_CLIENT, method: 'POST', data: {

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

@@ -1,9 +1,9 @@
-const online = process.env.TARO_ENV == 'weapp' ? true : false;
+const online = process.env.TARO_ENV == 'weapp' ? false : false;
 
 import { WX_VERSION as _WX_VERSION, APP_VERSION as _APP_VERSION, ANDROID_VERSION as _ANDROID_VERSION } from "../../../config/env";
 
 // export const baseUrl = online ? 'https://api.fast.liveplus.fun' : 'https://api.fast.dev.liveplus.fun';
-export const baseUrl = online ? process.env.TARO_ENV == 'rn' ? 'https://api.app.fast.liveplus.fun' : 'https://api.pre.fast.liveplus.fun' : 'https://api.fast.dev.liveplus.fun';//'https://api.pre.fast.liveplus.fun'//'https://api.fast.dev.liveplus.fun';
+export const baseUrl = online ? process.env.TARO_ENV == 'rn' ? 'https://api.app.fast.liveplus.fun' : 'https://api.fast.liveplus.fun' : 'https://api.fast.dev.liveplus.fun';//'https://api.pre.fast.liveplus.fun'//'https://api.fast.dev.liveplus.fun';
 
 export const APP_VERSION = _APP_VERSION
 export const WX_VERSION = _WX_VERSION