leon 1 éve
szülő
commit
c17e2d9bde

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

+ 1 - 1
src/_account/pages/PhotoWall.tsx

@@ -20,7 +20,7 @@ if (process.env.TARO_ENV == 'rn') {
 }
 
 // const scale = '?x-oss-process=image/resize,w_150,limit_0'
-const scale = '?x-oss-process=image/format,webp/resize,w_200'
+const scale = '?x-oss-process=image/format,jpg/resize,w_400'
 
 export default function PhotoWall() {
     const info = Taro.getWindowInfo?Taro.getWindowInfo():Taro.getSystemInfoSync()

+ 46 - 0
src/_common/pages/map.tsx

@@ -0,0 +1,46 @@
+import { Map, View } from "@tarojs/components";
+import Taro from "@tarojs/taro";
+import { useEffect, useState } from "react";
+
+export default function MapPage() {
+    const [latitude, setLatitude] = useState(23.099994);
+    const [longitude, setLongitude] = useState(113.324520);
+    const [markers, setMarkers] = useState([]);
+
+    useEffect(() => {
+        Taro.getLocation({
+            type: 'wgs84',
+            success: function (res) {
+                const { latitude, longitude } = res;
+                setLatitude(latitude);
+                setLongitude(longitude);
+                // setMarkers([{ id: 1, latitude, longitude }]); // 设置当前位置的标记
+            },
+            fail: function () {
+                Taro.showToast({
+                    title: '获取位置失败',
+                    icon: 'none',
+                });
+            }
+        });
+    }, []);
+    return <View>
+        <Map style="width: 100%; height: 90vh;"
+            longitude={longitude}
+            latitude={latitude}
+            showLocation
+            scale={14}
+            onError={e => {
+                console.log(e)
+            }}
+            onRegionChange={e => {
+                console.log(e)
+                if (e.type === 'end') {
+                    setLatitude((e as any).detail.centerLocation.latitude);
+                    setLongitude((e as any).detail.centerLocation.longitude);
+                }
+            }}
+        />
+        <View >中心点位置{latitude},{longitude}</View>
+    </View>
+}

+ 1 - 0
src/_health/components/cover_list.scss

@@ -12,4 +12,5 @@
     height: 155px;
     margin-right: 4px;
     margin-bottom: 4px;
+    flex-shrink: 0;
 }

+ 1 - 1
src/_health/components/cover_list.tsx

@@ -3,7 +3,7 @@ import Taro from "@tarojs/taro";
 import './cover_list.scss'
 
 export default function CoverList(props: { imgs: any, count: number }) {
-    const scale = '?x-oss-process=image/format,webp/resize,w_400'
+    const scale = '?x-oss-process=image/format,jpg/resize,w_400'
     return <View className="media" style={{ marginRight: props.count == 4 ? 80 : 0 }}>
         {
             props.imgs.map((obj, j) => {

+ 5 - 2
src/_health/components/single_img.tsx

@@ -7,7 +7,7 @@ export default function SingleImage(props: { url: string }) {
     const [loaded, setLoaded] = useState(false)
     const [width, setWidth] = useState(346)
     const [height, setHeight] = useState(346)
-    const scale = '?x-oss-process=image/format,webp'
+    const scale = '?x-oss-process=image/format,jpg'
     const kMax = 346
     // const 
     //346
@@ -29,7 +29,10 @@ export default function SingleImage(props: { url: string }) {
                             setWidth(kMax * res.width / res.height)
                         }
                         setLoaded(true)
-                    }
+                    },
+                    fail(res) {
+                        setLoaded(true)
+                    },
                 })
             }
         })

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

@@ -23,6 +23,7 @@ import StatusIndicator, { StatusType } from "../base/status_indicator";
 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";
 
 
 let useRoute;
@@ -53,7 +54,7 @@ export default function AddMoment() {
     const [posting, setPosting] = useState(false)
 
     // const scale = '?x-oss-process=image/resize,webp,w_200,limit_0'
-    const scale = '?x-oss-process=image/format,webp/resize,w_400'
+    const scale = '?x-oss-process=image/format,jpg/resize,w_400'
 
 
     let router
@@ -523,6 +524,18 @@ export default function AddMoment() {
         })
     }
 
+    function chooseLocation(){
+        Taro.choosePoi({
+            success(result) {
+                console.log('choose poi',result)
+            },
+            fail(res) {
+                console.log('choose poi failed',res)
+            },
+        })
+        // jumpPage('/_common/pages/map')
+    }
+
     return <View>
         <View style={{
             display: 'flex',
@@ -639,6 +652,8 @@ export default function AddMoment() {
                 }
             </View>
 
+            <View onClick={chooseLocation} style={{color:MainColorType.link}}>Choose Location</View>
+
             {/* <View className="form">
                 {
                     imgUrl.length > 0 && <View className="cover" ><NewButton type={NewButtonType.img} onClick={() => tapPic()}><Image src={imgUrl} mode="aspectFill" className="cover" /></NewButton></View>

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

@@ -28,7 +28,7 @@ if (process.env.TARO_ENV == 'rn') {
 }
 export default function PostResult() {
 
-    const scale = '?x-oss-process=image/format,webp/resize,w_200'
+    const scale = '?x-oss-process=image/format,jpg/resize,w_200'
     const user = useSelector((state: any) => state.user);
 
     let router

+ 59 - 8
src/_health/pages/timeline_detail.tsx

@@ -757,7 +757,7 @@ export default function TimelineDetail() {
 
     function goHome() {
         // jumpPage('/_moment/pages/message')
-        if (!user.isLogin){
+        if (!user.isLogin) {
             jumpPage('/_account/pages/ChooseAuth')
             return
         }
@@ -768,7 +768,53 @@ export default function TimelineDetail() {
         jumpPage('/_moment/pages/home?uid=' + (shareUser ? shareUser.id : detail.share_user ? detail.share_user.id : user.id))
     }
 
-    return <View style={{ display: 'flex', flex: 1, flexDirection: 'column', backgroundColor: '#fff', height: '101vh' }}>
+    function moreBtn() {
+        if (!detail.share_user || user.id == detail.share_user.id) {
+            return <NewButton
+                type={NewButtonType.more}
+                onClick={tapMore}
+            />
+        }
+    }
+
+    function addNoteBtn() {
+        if (!uid && (detail.share_user && user.id != detail.share_user.id)) {
+            return null
+        }
+        if (detail.windows && detail.windows[0].status != 'DONE' && ((health.mode != 'ACTIVE' && health.mode != 'EAT') || fast_type == 'LF'))
+
+            return <View className="add_note"><NewButton type={NewButtonType.link} title={t('health.add_note')} onClick={() => {
+                setShowPop(true)
+
+            }} /></View>
+
+    }
+
+    return <View style={{ display: 'flex', flex: 1, flexDirection: 'column', backgroundColor: '#fff', minHeight: '101vh' }}>
+        {/* <View>测试图片原图</View>
+        <Image src="https://fast-prod.oss-cn-beijing.aliyuncs.com/users/6b3dd3ee205561e227e9e3a6dd30a8d4/food-journal/2024/e5631780-a045-4384-8837-3f34a91f37e1_20241227144547_701.jpg"
+            style={{width:100,height:100}}
+        />
+        <View>测试图片压缩</View>
+        <Image src="https://fast-prod.oss-cn-beijing.aliyuncs.com/users/6b3dd3ee205561e227e9e3a6dd30a8d4/food-journal/2024/e5631780-a045-4384-8837-3f34a91f37e1_20241227144547_701.jpg?x-oss-process=image/resize,w_400"
+            style={{width:100,height:100}}
+        />
+        <View>测试图片webp</View>
+        <Image src="https://fast-prod.oss-cn-beijing.aliyuncs.com/users/6b3dd3ee205561e227e9e3a6dd30a8d4/food-journal/2024/e5631780-a045-4384-8837-3f34a91f37e1_20241227144547_701.jpg?x-oss-process=image/format,webp"
+            style={{width:100,height:100}}
+        />
+        <View>测试图片png</View>
+        <Image src="https://fast-prod.oss-cn-beijing.aliyuncs.com/users/6b3dd3ee205561e227e9e3a6dd30a8d4/food-journal/2024/e5631780-a045-4384-8837-3f34a91f37e1_20241227144547_701.jpg?x-oss-process=image/format,png"
+            style={{width:100,height:100}}
+        />
+        <View>测试图片jpg</View>
+        <Image src="https://fast-prod.oss-cn-beijing.aliyuncs.com/users/6b3dd3ee205561e227e9e3a6dd30a8d4/food-journal/2024/e5631780-a045-4384-8837-3f34a91f37e1_20241227144547_701.jpg?x-oss-process=image/format,jpg"
+            style={{width:100,height:100}}
+        />
+        <View>测试图片jpg+压缩</View>
+        <Image src="https://fast-prod.oss-cn-beijing.aliyuncs.com/users/6b3dd3ee205561e227e9e3a6dd30a8d4/food-journal/2024/e5631780-a045-4384-8837-3f34a91f37e1_20241227144547_701.jpg?x-oss-process=image/format,jpg/resize,w_400"
+            style={{width:100,height:100}}
+        /> */}
         {
             !showEmpty && <View className="detail_header">
                 <Image className="detail_header_header"
@@ -929,11 +975,11 @@ export default function TimelineDetail() {
                             </View>
 
                             }
+                            {
+                                moreBtn()
+                            }
+
 
-                            {!router.params.uid && <NewButton
-                                type={NewButtonType.more}
-                                onClick={tapMore}
-                            />}
                         </View>
                     }
                 </View>
@@ -959,13 +1005,18 @@ export default function TimelineDetail() {
         <Text style={{ opacity: 0 }}>{count}</Text>
         <ListFooter />
         {
+            uid && <View style={{ height: 100 }} />
+        }
+        {/* {
             !uid && detail.windows && detail.windows[0].status != 'DONE' && ((health.mode != 'ACTIVE' && health.mode != 'EAT') || fast_type == 'LF') && <View className="add_note"><NewButton type={NewButtonType.link} title={t('health.add_note')} onClick={() => {
-                // timestamp = new Date().getTime()
                 setShowPop(true)
 
             }} /></View>
-        }
+        } */}
 
+        {
+            addNoteBtn()
+        }
         {
             uid && <View className="main_footer" style={{ backgroundColor: '#fff' }}>
                 <NewButton

+ 0 - 0
src/_moment/pages/long_detail.config.ts


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


+ 6 - 0
src/_moment/pages/long_detail.tsx

@@ -0,0 +1,6 @@
+import { View } from "@tarojs/components";
+import './long_detail.scss'
+
+export default function LongDetail(){
+    return <View></View>
+}

+ 0 - 0
src/_moment/pages/long_full.config.ts


+ 0 - 0
src/_moment/pages/long_full.scss


+ 5 - 0
src/_moment/pages/long_full.tsx

@@ -0,0 +1,5 @@
+import { View } from "@tarojs/components";
+
+export default function LongFull(){
+    return <View></View>
+}

+ 12 - 2
src/app.config.ts

@@ -74,7 +74,15 @@ const appConfig = defineAppConfig({
       pages: [
         'pages/home',
         'pages/message',
-        'pages/relation'
+        'pages/relation',
+        'pages/long_full',
+        'pages/long_detail'
+      ]
+    },
+    {
+      root: '_common',
+      pages: [
+        'pages/map'
       ]
     }
   ],
@@ -83,7 +91,9 @@ const appConfig = defineAppConfig({
     // 't-popup':'tdesgin-miniprogram/popup/popup'
   },
   "requiredPrivateInfos": [
-    "chooseLocation"
+    "chooseLocation",
+    "getLocation",
+    "choosePoi"
   ],
   // "componentFramework": "glass-easel",
   // "lazyCodeLoading": "requiredComponents",

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

@@ -38,7 +38,7 @@ export default function HistoryItem(props: {
     type?: string
 }) {
     const health = useSelector((state: any) => state.health);
-    const scale = '?x-oss-process=image/format,webp/resize,w_400'
+    const scale = '?x-oss-process=image/format,jpg/resize,w_400'
 
     useEffect(() => {
         return () => {

+ 2 - 1
src/features/health/MainConsole.tsx

@@ -62,7 +62,7 @@ export default function MainConsole(props: { type: WindowType }) {
     const [hideSleepTip, setHideSleepTip] = useState(false)
     const { t } = useTranslation()
     const dispatch = useDispatch()
-    const scale = '?x-oss-process=image/format,webp/resize,w_200'//'?x-oss-process=image/resize,webp,w_200,limit_0'
+    const scale = '?x-oss-process=image/format,jpg/resize,w_200'//'?x-oss-process=image/resize,webp,w_200,limit_0'
 
     let navigation, showActionSheetWithOptions;
     if (useNavigation) {
@@ -822,6 +822,7 @@ export default function MainConsole(props: { type: WindowType }) {
             latitude: scenario.extra.choose_location ? parseFloat(scenario.extra.lat + '') : undefined,
             longitude: scenario.extra.choose_location ? parseFloat(scenario.extra.lng + '') : undefined,
             success: function (res) {
+                console.log('choose location,',res)
                 uploadLocation(res)
             },
             fail(res) {

+ 1 - 1
src/features/journal/components/journal_cover.tsx

@@ -8,7 +8,7 @@ import Taro from '@tarojs/taro'
 export default function JournalCover(props: { imgs: any }) {
 
     // const scale = '?x-oss-process=image/resize,w_200,limit_0'
-    const scale = '?x-oss-process=image/format,webp/resize,w_200'
+    const scale = '?x-oss-process=image/format,jpg/resize,w_200'
 
     function content() {
         switch (props.imgs.length) {

+ 5 - 2
src/pages/moment/moment.tsx

@@ -32,6 +32,9 @@ export default function Friend() {
 
 
     useEffect(() => {
+        Taro.showLoading({
+            title:t('health.loading')
+        })
         if (process.env.TARO_ENV == 'weapp') {
             loadWXCache()
         }
@@ -80,11 +83,11 @@ export default function Friend() {
                         defaultImg = SHARE_COVER_URL + 'my_fast.jpg'
                         break;
                     case 'EAT':
-                        title = t('health.share_check_in', { date: shareDate, type: detail.title })
+                        title = t('health.share_check_in', { date: shareDate, type: detail.moment.title })
                         defaultImg = SHARE_COVER_URL + 'my_meal.jpg'
                         break;
                     case 'ACTIVE':
-                        title = t('health.share_check_in', { date: shareDate, type: detail.title })
+                        title = t('health.share_check_in', { date: shareDate, type: detail.moment.title })
                         defaultImg = SHARE_COVER_URL + 'my_activity.jpg'
                         break;
                     case 'SLEEP':

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

@@ -23,7 +23,7 @@ dayjs.extend(isYesterday);
 
 
 export default function MomentItem(props: { data: any }) {
-    const scale = '?x-oss-process=image/format,webp/resize,w_400'
+    const scale = '?x-oss-process=image/format,jpg/resize,w_400'
     const { link, moment, user } = props.data
 
     const formatImages = (list) => {

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

@@ -207,7 +207,7 @@ export default function MomentMain() {
     function myFriends() {
         if (!user.isLogin) {
             setLoaded(true)
-
+            Taro.hideLoading()
             return
         }
         setItemHeights([])
@@ -251,6 +251,7 @@ export default function MomentMain() {
             setIsPulling(false)
             setLoading(false)
             setLoaded(true)
+            Taro.hideLoading()
         })
     }
 
@@ -259,8 +260,10 @@ export default function MomentMain() {
             setLoaded(true)
             setHomeType((res as any).homepage_type)
             setDashBoard(res)
+            Taro.hideLoading()
         }).catch(e=>{
             setLoaded(true)
+            Taro.hideLoading()
         })
     }
 

+ 45 - 1
src/pages/moment/moment_share.tsx

@@ -1,7 +1,7 @@
 import { useDispatch, useSelector } from "react-redux";
 import { useEffect, useState } from "react";
 import { View, Canvas } from "@tarojs/components";
-import Taro from "@tarojs/taro";
+import Taro, { useDidShow } from "@tarojs/taro";
 
 export default function MomentShare() {
     const user = useSelector((state: any) => state.user);
@@ -17,6 +17,13 @@ export default function MomentShare() {
         }
     }, [user])
 
+    useDidShow(() => {
+        if (user.isLogin) {
+            // beginDraw()
+            downCover()
+        }
+    })
+
     async function downCover() {
         const urls = ['https://background-pictures.oss-cn-beijing.aliyuncs.com/share_cover/invite.png', user.avatar]
         try {
@@ -61,6 +68,43 @@ export default function MomentShare() {
     }
 
     function drawDetail(ctx, imagePaths, canvas) {
+        const img = canvas.createImage(); // 创建图像对象
+        img.src = imagePaths[0]
+        img.onload = () => {
+            ctx.drawImage(img, 0, 0, 420 * dpr, 336 * dpr);
+            ctx.stroke();
+            const img1 = canvas.createImage(); // 创建图像对象
+            img1.src = imagePaths[1]
+            img1.onload = () => {
+                ctx.font = `bold ${24 * dpr}px sans-serif`
+                ctx.fillStyle = '#E0B152'
+                ctx.textAlign = 'center'
+                var name = user.nickname.length > 8 ? user.nickname.substring(0, 8) + '...' : user.nickname
+                ctx.fillText(name, 210 * dpr, 182 * dpr);
+
+                ctx.beginPath()
+                ctx.arc(210 * dpr, 82 * dpr, 70 * dpr, 0, Math.PI * 2)
+                ctx.clip()
+                ctx.drawImage(img1, 140 * dpr, 12 * dpr, 140 * dpr, 140 * dpr);
+                ctx.restore()
+                ctx.stroke();
+
+                Taro.canvasToTempFilePath({
+                    canvas: canvas,
+                    success: (res) => {
+                        console.log('图片保存成功:', res.tempFilePath);
+                        global.moment_share_url = res.tempFilePath
+                    },
+                    fail: (err) => {
+                        console.error('转为图片失败:', err);
+                    }
+                });
+            }
+        };
+
+    }
+
+    function drawDetail2(ctx, imagePaths, canvas) {
         const promises = imagePaths.map((path, index) => {
             return new Promise((resolve) => {
                 const img = canvas.createImage(); // 创建图像对象