leon пре 1 година
родитељ
комит
1d35f6213d

+ 8 - 1
src/_health/pages/add_moment.tsx

@@ -24,6 +24,7 @@ import { IconCheck, IconClose } from "@/components/basic/Icons";
 import showActionSheet from "@/components/basic/ActionSheet";
 import { TimeFormatter } from "@/utils/time_format";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
+import FollowInfo from "@/_moment/components/follow_info";
 
 
 let useRoute;
@@ -219,6 +220,10 @@ export default function AddMoment() {
             }
         }
 
+        if (router.params.join_id){
+            params.join_key = router.params.join_id
+        }
+
         if (pics.length > 0) {
             var picList: any = []
             pics.map((item) => {
@@ -622,7 +627,7 @@ export default function AddMoment() {
                                 margin: 0
                             }} key={index} onClick={() => {
                                 Taro.previewImage({
-                                    current: item.url + scale,
+                                    current: pics[index].url,
                                     urls: pics.map(file => file.url)
                                 })
                             }} />
@@ -672,6 +677,8 @@ export default function AddMoment() {
             </View> */}
         </View>
 
+        {/* <FollowInfo /> */}
+
 
         <View style={{ flex: 1 }} />
 

+ 52 - 3
src/_health/pages/log_time.tsx

@@ -21,6 +21,7 @@ import ChooseDateTime from "../components/choose_date_time";
 import { TimeFormatter } from "@/utils/time_format";
 import StatusIndicator, { StatusType } from "../base/status_indicator";
 import { t } from "i18next";
+import FollowInfo from "@/_moment/components/follow_info";
 
 let useRoute;
 let useNavigation;
@@ -60,7 +61,6 @@ export default function LogTime() {
     const [longDuration, setLongDuration] = useState(24)
 
     const [expandIndex, setExpandIndex] = useState(router.params.initIndex ? router.params.initIndex : tapIndex)
-    const [chooseDate, setChooseDate] = useState(false)
     const [array, setArray] = useState<any>([])
     const [errors, setErrors] = useState<any>([])
     const [showSuccess, setShowSuccess] = useState(false)
@@ -68,7 +68,6 @@ export default function LogTime() {
     const [loaded, setLoaded] = useState(false)
     const [autoCheck, setAutoCheck] = useState(false)
     const [initCheck, setInitCheck] = useState(router.params.initCheck == '1')
-    const [initSeconds, setInitSeconds] = useState(router.params.initCheck == '1') //初始化时,带入打卡时的秒数
     const [count, setCount] = useState(0)
 
     const [ignoreCheck, setIgnoreCheck] = useState(false)
@@ -176,7 +175,6 @@ export default function LogTime() {
         const { fast, sleep, status } = res
 
         var list: any = []
-        debugger
         if (isSingle) {
             var timeline: any;
             var time = dayjs().format('HH:mm')
@@ -599,6 +597,9 @@ export default function LogTime() {
                 confirm_time: new Date().getTime()
             }
         }
+        if (router.params.join_id) {
+            params.join_key = router.params.join_id
+        }
         if (onlyCheck) {
             var dt = new Date().getTime()
             params.requestId = dt
@@ -805,6 +806,22 @@ export default function LogTime() {
         }
     }
 
+    function cancelAlert(){
+        showAlert({
+            title:'放弃旧的,开始新的?',
+            content:'',
+            showCancel:true,
+            cancelText:'取消',
+            confirmText:'继续',
+            cancel:()=>{
+                console.log('cancel')
+            },
+            confirm:()=>{
+                console.log('confirm')
+            }
+        })
+    }
+
     function logItem(index: number, iFast: boolean, iStart: boolean, showLine: boolean) {
         const { fast, sleep, status } = data
 
@@ -1142,6 +1159,29 @@ export default function LogTime() {
         return <View />
     }
 
+    function joinContent() {
+        if (router.params.join_id) {
+            const { index, window, is_start, single, join_status } = router.params
+            if (window == 'FAST') {
+                // if (index )
+                if (join_status == 'OG' && getScenario(health.windows, 'FAST').status == 'OG') {
+                    return <View onClick={cancelAlert} className="h26" style={{ color: MainColorType.link }}>更多选项</View>
+                }
+                else if (join_status == 'DONE' && getScenario(health.windows, 'FAST').status == 'WFS') {
+                    return <View className="h26" style={{ color: MainColorType.link }}>更多选项</View>
+                }
+            }
+            else {
+                if (join_status == 'OG' && getScenario(health.windows, 'SLEEP').status == 'OG') {
+                    return <View onClick={cancelAlert} className="h26" style={{ color: MainColorType.link }}>更多选项</View>
+                } else if (join_status == 'DONE' && getScenario(health.windows, 'SLEEP').status == 'WFS') {
+                    return <View className="h26" style={{ color: MainColorType.link }}>更多选项</View>
+                }
+            }
+        }
+        return <View />
+    }
+
     if (!loaded) return <View />
 
     return <View className="page_container" style={{ minHeight: '101vh' }}>
@@ -1199,6 +1239,11 @@ export default function LogTime() {
                 justifyContent: 'center'
             }}>{expectText()}</View>
         }
+        {
+            router.params.join_id && <FollowInfo />
+        }
+
+
         <View style={{ flex: 1 }} />
         {/* <View style={{ marginBottom: rpxToPx(128), display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
             <NewButton
@@ -1211,7 +1256,11 @@ export default function LogTime() {
                 bold={true}
                 onClick={() => tapCommit(false)} />
         </View> */}
+
         <View className="main_footer">
+            {
+                joinContent()
+            }
             <NewButton
                 color={footerBtnColor()}
                 type={NewButtonType.fill}

+ 2 - 0
src/_health/pages/timeline_detail.tsx

@@ -33,6 +33,7 @@ import { StatusType } from "../base/status_indicator";
 import 'dayjs/locale/zh-cn';
 import 'dayjs/locale/en';
 import { getInfoSuccess } from "@/store/user";
+import LongCard from "@/_moment/components/long_card";
 
 let useRoute;
 let useNavigation;
@@ -961,6 +962,7 @@ export default function TimelineDetail() {
                             canvasId={`double_${detail.windows[0].window_range.start_timestamp}`}
                         />
                     }
+                    <LongCard join={{}} link={{}}/>
                     {
                         publish && <View style={{ display: 'flex', flexDirection: 'row', height: rpxToPx(60), marginTop: rpxToPx(17), alignItems: 'center' }}>
                             {/* <Text className="h24 g02">{publish.edited ? '编辑于' : '发布于'}{dayjs(publish.timestamp).format('M月D日 HH:mm')}</Text> */}

+ 0 - 0
src/_moment/components/follow_info.scss


+ 36 - 0
src/_moment/components/follow_info.tsx

@@ -0,0 +1,36 @@
+import { rpxToPx } from "@/utils/tools";
+import { View, Text, Textarea, Image, Input, ScrollView } from "@tarojs/components";
+
+export default function FollowInfo() {
+    return <View style={{
+        width: rpxToPx(698),
+        height: rpxToPx(128),
+        borderRadius: rpxToPx(24),
+        backgroundColor: '#fff',
+        display: 'flex',
+        flexDirection: 'column',
+        justifyContent: 'center',
+        // marginTop:rpxToPx(36),
+        paddingLeft:rpxToPx(30),
+        boxSizing:'border-box',
+        marginLeft:rpxToPx(26)
+    }}>
+        <View className="h20 g02">接自</View>
+        <View style={{display:'flex',
+            flexDirection:'row',
+            alignItems:'center',
+            marginTop:rpxToPx(8)
+        }}>
+            <View className="h26">用户A</View>
+            <View style={{
+                width:rpxToPx(36),
+                height:rpxToPx(36),
+                borderRadius:rpxToPx(18),
+                marginLeft:rpxToPx(8),
+                marginRight:rpxToPx(8),
+                backgroundColor:'pink'
+            }}/>
+            <View className="h26">跟卡</View>
+        </View>
+    </View>
+}

+ 27 - 0
src/_moment/components/long_card.scss

@@ -0,0 +1,27 @@
+.long_card_bg {
+    background-color: #fafafa;
+    border-radius: 12px;
+    width: 572px;
+    box-sizing: border-box;
+    padding-left: 20px;
+    padding-right: 24px;
+    display: flex;
+    margin-top: 12px;
+}
+
+.long_card_begin {
+    height: 104px;
+    
+    align-items: center;
+    flex-direction: row;
+    justify-content: space-between;
+}
+
+.long_avatar{
+    width: 40px;
+    height: 40px;
+    border-radius: 20px;
+    border: solid 2px #fff;
+    background-color: antiquewhite;
+    box-sizing: border-box;
+}

+ 98 - 0
src/_moment/components/long_card.tsx

@@ -0,0 +1,98 @@
+import { MainColorType } from "@/context/themes/color";
+import { View, Text, Image, ScrollView } from "@tarojs/components";
+import './long_card.scss'
+import { rpxToPx } from "@/utils/tools";
+import ShareBtn from "@/components/basic/ShareBtn";
+import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
+import { useSelector } from "react-redux";
+import { getScenario } from "@/features/health/hooks/health_hooks";
+
+export default function LongCard(props: { join?: any, link?: any }) {
+    const { status, key } = props.join
+    const { window } = props.link
+    const linkStatus = props.link.status
+    const health = useSelector((state: any) => state.health);
+    let type = 0
+    function join(e) {
+        if (process.env.TARO_ENV == 'weapp') {
+            e.stopPropagation()
+        }
+        console.log(health)
+        debugger
+
+        if (window == 'ACTIVE' || window == 'EAT') {
+            jumpPage(`/_health/pages/add_moment?join_id=${key}&is_temp=${true}`)
+        }
+        else {
+            if (window == 'FAST') {
+                if (getScenario(health.windows, 'FAST').status == 'WFS') {
+                    //jumpPage(`/_health/pages/log_time?index=${health.mode == 'FAST' ? 0 : 1}&single=1&is_start=1&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
+                    jumpPage(`/_health/pages/log_time?join_id=${key}&index=0&single=1&is_start=1&window=${window}&join_status=${linkStatus}`)
+                }
+                else {
+                    //jumpPage(`/_health/pages/log_time?type=home&index=${health.mode == 'FAST' ? 3 : 2}&single=${sceniaro.status == 'OG' ? 1 : 0}&is_start=0&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
+                    jumpPage(`/_health/pages/log_time?join_id=${key}&index=3&single=1&is_start=0&window=${window}&join_status=${linkStatus}`)
+                }
+
+            }
+            else {
+                if (getScenario(health.windows, 'SLEEP').status == 'WFS') {
+                    //jumpPage(`/_health/pages/log_time?index=${health.mode == 'FAST' ? 0 : 1}&single=1&is_start=1&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
+                    jumpPage(`/_health/pages/log_time?join_id=${key}&index=1&single=1&is_start=1&window=${window}&join_status=${linkStatus}`)
+                }
+                else {
+                    //jumpPage(`/_health/pages/log_time?type=home&index=${health.mode == 'FAST' ? 3 : 2}&single=${sceniaro.status == 'OG' ? 1 : 0}&is_start=0&window=${health.mode}&op_page=${health.mode == 'FAST' ? 'HOME_FAST' : 'HOME_SLEEP'}`)
+                    jumpPage(`/_health/pages/log_time?join_id=${key}&index=2&single=1&is_start=0&window=${window}&join_status=${linkStatus}`)
+                }
+            }
+
+        }
+
+
+    }
+
+    function share() {
+
+    }
+
+    function users() {
+        return <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
+            <View className="long_avatar"></View>
+            <View className="h26" style={{ marginLeft: rpxToPx(6) }}>跟卡</View>
+        </View>
+    }
+
+    if (type == 1)
+        return <View className="long_card_bg" style={{
+            flexDirection: 'column',
+            paddingTop: rpxToPx(18),
+            paddingBottom: rpxToPx(18)
+        }}>
+            <View className="h20 g02" style={{ marginBottom: rpxToPx(6) }}>接自</View>
+            <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between' }}>
+                {
+                    users()
+                }
+                <View className="h26 bold" style={{ color: MainColorType.link }} onClick={join}>立即加入</View>
+            </View>
+        </View>
+    if (status == 'JOIN')
+        return <View className="long_card_bg long_card_begin">
+            <View className="h26 g02">一起接龙打卡</View>
+            {/* {
+                users()
+            } */}
+            <View className="h26 bold" style={{ color: MainColorType.link }} onClick={join}>立即加入</View>
+        </View>
+
+    if (status == 'SHARE') {
+        return <View className="long_card_bg long_card_begin">
+            <View className="h26 g02">一起接龙打卡 </View>
+            <ShareBtn onClick={share}>
+                <View className="h26 bold" style={{ color: MainColorType.success }} >邀请好友加入</View>
+            </ShareBtn>
+        </View>
+    }
+
+    return <View />
+}

+ 23 - 0
src/_moment/pages/long_detail.scss

@@ -11,4 +11,27 @@
     padding: 0 40px;
     box-sizing: border-box;
     width: 694px;
+}
+
+.members{
+    display: flex;
+    flex-direction: row;
+    flex-wrap: wrap;
+
+}
+
+.member_item{
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+}
+
+.member_avatar{
+    width: 96px;
+    height: 96px;
+    border-radius: 48px;
+}
+
+.member_relation{
+    
 }

+ 4 - 1
src/_moment/pages/long_detail.tsx

@@ -5,6 +5,9 @@ export default function LongDetail(){
     return <View>
         <Image className="main_avatar" src=""/>
         <View className="h26 g02">累计获得 10888 次跟卡</View>
-        <View className="member_group"></View>
+        <View className="member_group">
+            <View>56人已跟卡</View>
+            <View className="members"></View>
+        </View>
     </View>
 }

+ 0 - 1
src/app.tsx

@@ -47,7 +47,6 @@ const App: React.FC<PropsWithChildren> = ({ children }) => {
     else {
       global.shareTicket = null
     }
-    console.log('global.shareTicket', global.shareTicket)
   })
 
   useLaunch((res) => {

+ 6 - 2
src/components/basic/ShareBtn.tsx

@@ -10,8 +10,12 @@ export default function ShareBtn(props: { children: any, onClick?: any }) {
             left: 0,
             right: 0,
             top: 0,
-            bottom: 0
-        }} onClick={() => {
+            bottom: 0,
+            opacity:0
+        }} onClick={(e) => {
+            if (process.env.TARO_ENV == 'weapp'){
+                e.stopPropagation()
+            }
             if (props.onClick) {
                 props.onClick()
             }

+ 6 - 1
src/pages/moment/moment_item.tsx

@@ -14,6 +14,7 @@ import CoverList from "@/_health/components/cover_list";
 import { jumpPage } from "@/features/trackTimeDuration/hooks/Common";
 import { IconActive, IconShare } from "@/components/basic/Icons";
 import Taro from "@tarojs/taro";
+import LongCard from "@/_moment/components/long_card";
 
 dayjs.extend(relativeTime);
 dayjs.extend(isToday);
@@ -24,7 +25,7 @@ dayjs.extend(isYesterday);
 
 export default function MomentItem(props: { data: any }) {
     const scale = '?x-oss-process=image/format,jpg/resize,w_400'
-    const { link, moment, user } = props.data
+    const { link, moment, user, join } = props.data
 
     const formatImages = (list) => {
         return list.map(obj => obj.url);
@@ -129,6 +130,10 @@ export default function MomentItem(props: { data: any }) {
                     }
                 />
             }
+            {
+                join && <LongCard join={join} link={link}/>
+            }
+
             <View style={{ padding: kSpace }} />
             <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', height: rpxToPx(44) }}>
                 <View className="h26 g02">{dayjs(moment.timestamp).fromNow()}</View>

+ 4 - 0
src/pages/moment/moment_main.tsx

@@ -22,6 +22,7 @@ import { MainColorType } from "@/context/themes/color";
 import dayjs from "dayjs";
 import { IconClose, IconMenu } from "@/components/basic/Icons";
 import MomentShare from "./moment_share";
+import NoRecord from "@/_health/components/no_record";
 
 
 
@@ -442,6 +443,9 @@ export default function MomentMain() {
                             </View>
                         })
                     }
+                    {
+                        moments.length == 0 && <NoRecord style={{marginTop:rpxToPx(160)}}/>
+                    }
 
                     <ListFooter noMore={noMore} loading={loading} />
                     <View id="footer" style={{ width: 1, height: 1 }}></View>

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

@@ -1,4 +1,4 @@
-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";