leon vor 1 Jahr
Ursprung
Commit
84100920a4

+ 1 - 1
src/_health/base/new_button.tsx

@@ -89,7 +89,7 @@ export default function NewButton(props: {
             style = {
                 height: props.height ?? rpxToPx(72),
                 width: props.width ?? rpxToPx(198),
-                borderRadius: props.height ? props.height / 4 : rpxToPx(72 / 4),
+                borderRadius: props.height ? props.height / 2 : rpxToPx(72 / 2),
                 backgroundColor: isTouched ? hexToHSL(props.color) : props.disable ? '#B2B2B2' : props.color,
                 color: '#fff',
                 fontSize: props.fontSize ?? rpxToPx(30),

+ 186 - 0
src/_record/components/ring_progress.tsx

@@ -0,0 +1,186 @@
+import { Canvas } from "@tarojs/components";
+import Taro, { useReady } from "@tarojs/taro";
+import { useEffect, useRef, useState } from "react";
+
+export default function RingProgress(props: {
+    canvasId?: string;
+    bgRing: any;
+    target?: any;
+    real?: any;
+    scale?: number;
+    radius: number;
+    width?: number;
+    height?: number;
+    extra?: any;
+    count?: number;
+}) {
+    const canvasId = props.canvasId ?? new Date().getTime() + ''
+    const info = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync()
+    const dpr = info.pixelRatio; // 获取设备的像素比
+    const [ctx, setCtx] = useState<any>(null)
+    const [canvas, setCanvas] = useState<any>(null)
+    const canvasRef = useRef(null);
+
+
+    const canvasWidth = props.width ?? 200
+    const canvasHeight = props.height ?? 200
+    const scale = props.scale ?? 1
+
+    useEffect(() => {
+        if (ctx) {
+            drawContent(ctx)
+        }
+        else {
+            initCanvas()
+        }
+
+    }, [props.canvasId, props.count])
+
+    useReady(() => {
+        initCanvas()
+    })
+
+    var retryCount = 0;
+    function initCanvas() {
+        const query = Taro.createSelectorQuery();
+        query.select(`#${canvasId}`).fields({ node: true, size: true });
+        query.exec((res) => {
+            if (res[0] == null) {
+                retryCount++;
+                if (retryCount > 5) {
+                    return;
+                }
+                initCanvas()
+                return
+            }
+            const _canvas = res[0].node;
+            _canvas.width = res[0].width * dpr;
+            _canvas.height = res[0].height * dpr;
+            const ctx = _canvas.getContext('2d');
+            ctx.scale(dpr, dpr)
+            ctx.translate(0, 0)
+            ctx.scale(scale, scale);
+            ctx.translate(0, 0);
+
+            drawContent(ctx)
+            setCtx(ctx)
+            setCanvas(_canvas)
+        })
+    }
+
+    function drawContent(ctx) {
+        ctx.clearRect(0, 0, canvasWidth, canvasHeight); // 清除画布
+        // 设置画布尺寸
+
+
+
+
+        // const grd = ctx.createLinearGradient(0, 0, 0, canvasHeight);
+        // grd.addColorStop(0, '#F0CABF')
+        // grd.addColorStop(1, '#E1CDEE')
+        // ctx.fillStyle = grd;
+        // ctx.fillRect(0, 0, canvasWidth, canvasHeight)
+
+        ctx.beginPath();
+        ctx.arc(canvasWidth / 2.0, canvasHeight / 2.0, props.radius, 0, 2 * Math.PI);
+        ctx.lineWidth = props.bgRing.width;
+        ctx.strokeStyle = props.bgRing.color;
+        ctx.lineCap = 'round'; // 设置为圆角
+        ctx.stroke();
+
+        if (props.target) {
+            ctx.beginPath();
+            ctx.arc(canvasWidth / 2.0, canvasHeight / 2.0, props.radius, props.target.start, props.target.duration);
+            ctx.lineWidth = props.target.width;
+            ctx.strokeStyle = props.target.color;
+            ctx.lineCap = 'round'; // 设置为圆角
+            ctx.stroke();
+        }
+
+        if (props.real) {
+            ctx.beginPath();
+            ctx.arc(canvasWidth / 2.0, canvasHeight / 2.0, props.radius, props.real.start, props.real.duration);
+            ctx.lineWidth = props.real.width;
+            ctx.strokeStyle = props.real.color;
+            ctx.lineCap = 'round'; // 设置为圆角
+            ctx.stroke();
+        }
+
+        // ctx.beginPath()
+        // ctx.arc(100, 100, 30, 0, 2 * Math.PI, false);
+        // ctx.clip();
+        // ctx.beginPath();
+        // ctx.arc(100, 100, 30, 0, 2 * Math.PI, true);
+        // ctx.fill();
+        // 设置混合模式为擦除
+        // ctx.globalCompositeOperation = 'destination-out'
+
+        // // 绘制透明环
+        // ctx.beginPath()
+        // ctx.arc(100, 100, 50, 0, 2 * Math.PI)
+        // ctx.lineWidth = 10
+        // ctx.stroke()
+
+        // // 重置混合模式
+        // ctx.globalCompositeOperation = 'source-over'
+
+        if (true) {
+            var time = new Date();
+            var seconds = time.getHours() * 3600 + time.getMinutes() * 60 + time.getSeconds();
+            // seconds += props.currentDot.offset! * 60
+            if (seconds > 24 * 3600) {
+                seconds -= 24 * 3600
+            }
+            else if (seconds < 0) {
+                seconds += 24 * 3600
+            }
+            var arc = seconds / 86400 * 2 * Math.PI - Math.PI / 2.0;
+            const radians = arc;//angle * Math.PI / 180; // 将角度转换为弧度
+            const xPrime = canvasWidth / 2.0 + props.radius * Math.cos(radians);
+            const yPrime = canvasHeight / 2.0 + props.radius * Math.sin(radians);
+            ctx.globalCompositeOperation = 'destination-out'
+            ctx.beginPath();
+            var dotLineWidth = 4
+            // if (lineWidth == 28) {
+            //     dotLineWidth = 4
+
+            // }
+            ctx.arc(xPrime, yPrime, props.target.width / 2.0, 0, 2 * Math.PI);
+            ctx.lineWidth = dotLineWidth;
+            ctx.fillStyle = 'transparent'
+            ctx.fill()
+            ctx.strokeStyle = '#1C1C1C';
+            ctx.lineCap = 'round'; // 设置为圆角
+            ctx.stroke();
+            ctx.globalCompositeOperation = 'source-over'
+        }
+
+        if (props.extra) {
+            const { header, value, footer, color } = props.extra
+            if (header) {
+                ctx.font = `bold ${12}px sans-serif`
+                ctx.fillStyle = '#000'
+                ctx.textAlign = 'center'
+                ctx.fillText(header, 200, 110);
+            }
+            if (value) {
+                ctx.font = `bold ${36}px sans-serif`
+                ctx.fillStyle = '#000'
+                ctx.textAlign = 'center'
+                ctx.fillText(value, 200, 164);
+            }
+            if (footer) {
+                ctx.font = `bold ${15}px sans-serif`
+                ctx.fillStyle = color
+                ctx.textAlign = 'center'
+                ctx.fillText(footer, 200, 195);
+            }
+        }
+
+    }
+
+    return <Canvas canvasId={canvasId} id={canvasId} className="canvas" type="2d"
+        style={{ width: canvasWidth, height: canvasHeight, zIndex: 0 }}
+        ref={canvasRef}
+    />
+}

+ 14 - 4
src/_record/pages/log_record.tsx

@@ -14,7 +14,7 @@ import NewButton, { NewButtonType } from "@/_health/base/new_button";
 import dayjs from "dayjs";
 import { TimeFormatter } from "@/utils/time_format";
 import { useSelector } from "react-redux";
-import { createMoment, updateMoment } from "@/services/health";
+import { addUserTag, createMoment, updateMoment, userTags } from "@/services/health";
 import PostMomentTime from "@/_health/components/post_moment_time";
 
 let useRoute;
@@ -66,11 +66,21 @@ export default function LogRecord() {
 
     useEffect(() => {
         console.log('sss')
-        // Taro.setBackgroundColor({
-        //     backgroundColor:'red'
-        // })
+        getTags()
     }, [])
 
+    function getTags(){
+        userTags({scenario:'EAT'}).then(res=>{
+
+        })
+    }
+
+    function addTag(){
+        addUserTag({scenario:'EAT',title:title}).then(res=>{
+
+        })
+    }
+
     function tapPic() {
         //, t('health.delete')
         showActionSheet({

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

@@ -29,4 +29,39 @@ page {
     display: flex;
     flex-direction: column;
     align-items: center;
+}
+
+.progress_card {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    overflow: hidden;
+    width: 698px;
+    padding-bottom: 60px;
+    border-radius: 84px;
+    background-color: rgba($color: #ffffff, $alpha: 0.25);
+    position: relative;
+}
+
+.eat_card {
+    width: 698px;
+    height: 168px;
+    background-color: rgba($color: #ffffff, $alpha: 0.25);
+    position: relative;
+    border-radius: 42px;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+    margin-top: 26px;
+}
+
+.eat_card_arrow{
+    position: absolute;
+    right: 30px;
+    top: 0;
+    bottom: 0;
+    display: flex;
+    align-items: center;
+    justify-content: center;
 }

+ 68 - 57
src/_record/pages/time_record.tsx

@@ -2,13 +2,16 @@ import { View, Image } from "@tarojs/components";
 import './time_record.scss'
 import Taro from "@tarojs/taro";
 import { rpxToPx } from "@/utils/tools";
-import Rings, { RingCommon, BgRing, TargetRing, CurrentDot } from "@/features/trackTimeDuration/components/Rings";
 import { MainColorType } from "@/context/themes/color";
 import NewButton, { NewButtonType } from "@/_health/base/new_button";
-import { useState } from "react";
+import { useEffect, useState } from "react";
 import NewDateTimePicker from "@/_health/base/new_date_time_picker";
 import dayjs from "dayjs";
+import RingProgress from "../components/ring_progress";
+import NewDurationPicker, { DurationPickerType } from "@/_health/base/new_durationpicker";
+import { IconArrow } from "@/components/basic/Icons";
 
+let timer
 export default function TimeRecord() {
     const systemInfo: any = Taro.getWindowInfo ? Taro.getWindowInfo() : Taro.getSystemInfoSync();
     const navigationBarHeight = systemInfo.statusBarHeight + 44;
@@ -17,58 +20,15 @@ export default function TimeRecord() {
 
     const [showDatePicker, setShowDatePicker] = useState(false)
     const [showDurationPicker, setShowDurationPicker] = useState(false)
+    const [count, setCount] = useState(0)
 
-    const common: RingCommon = {
-        useCase: 'ChooseScenario',
-        radius: 110,
-        lineWidth: 22,
-        isFast: true,
-        status: 'WAIT_FOR_START'
-    }
-
-    const bgRing: BgRing = {
-        color: MainColorType.ringBg
-    }
-
-    function targetRing() {
-        return {
-            color: 'pink',
-            startArc: 0,
-            durationArc: 3 / 4 * Math.PI
+    useEffect(() => {
+        timer = setInterval(() => { setCount(count => count + 1) }, 1000)
+        return () => {
+            clearInterval(timer)
         }
-    }
-
-    function realRing() {
-        return {
-            color: 'red',
-            startArc: 0,
-            durationArc: 2 / 4 * Math.PI
-        }
-    }
-
-    function currentDot() {
-
-
-        return {
-            color: MainColorType.eat,
-            lineWidth: 6,
-            borderColor: '#F5F5F5',
-            offset: 6
-        }
-
-    }
-
-    function ring() {
+    }, [])
 
-        return <Rings common={common}
-            bgRing={bgRing}
-            targetRing={targetRing()}
-            realRing={realRing()}
-            canvasId={'smal11lsss'}
-            currentDot={currentDot()}
-            scale={1.0}
-        />
-    }
 
     function tapStart() {
         setShowDatePicker(true)
@@ -105,12 +65,60 @@ export default function TimeRecord() {
             </View>
         </View>
         <View style={{ height: navigationBarHeight }} />
-        <View>
-            {
-                ring()
-            }
+        <View className="progress_card">
+            <View onClick={() => {
+                setShowDurationPicker(true)
+            }}>
+                <RingProgress width={400} height={320}
+                    radius={125} canvasId="helloworld"
+                    //scale={0.75}
+                    count={count}
+                    bgRing={{
+                        color: 'rgba(255,255,255,0.25)',
+                        width: 35
+                    }}
+                    target={{
+                        color: 'rgba(255,255,255,0.5)',
+                        width: 35,
+                        start: 0,
+                        duration: 3 / 4 * Math.PI
+                    }}
+                    real={{
+                        color: MainColorType.orange,
+                        width: 35,
+                        start: 0,
+                        duration: 2 / 4 * Math.PI
+                    }}
+                    extra={{
+                        header: 'GOAL',
+                        value: dayjs().format('HH:mm:ss'),
+                        footer: 'Edit',
+                        color: MainColorType.orange
+                    }}
+                />
+            </View>
+            <NewButton
+                type={NewButtonType.fill}
+                title="Start fasting"
+                width={rpxToPx(490)}
+                height={rpxToPx(96)}
+                color={MainColorType.orange}
+            />
+        </View>
+
+        <View className="eat_card" onClick={()=>{
+            Taro.redirectTo({
+                url:'./log_record'
+            })
+        }}>
+            <View className="h30 bold">Or share your meals</View>
+            <View className="h24 g02" style={{ marginTop: rpxToPx(12) }}>if you haven't started fasting yet</View>
+            <View className="eat_card_arrow">
+                <IconArrow width={rpxToPx(34)} color={MainColorType.g02} />
+            </View>
         </View>
 
+
         <View className="time_card_bg">
             <View className="time_card" onClick={tapStart}>
                 <View className="h30" style={{ opacity: 0.4 }}>Start</View>
@@ -131,8 +139,8 @@ export default function TimeRecord() {
         />
         {
             showDatePicker && <NewDateTimePicker date={dayjs().format('YYYY-MM-DD')} count={1} time={dayjs().format('HH:mm')}
-                minTimestamp={ new Date().getTime() - 24 * 3600 * 1000}
-                maxTimestamp={ new Date().getTime()}
+                minTimestamp={new Date().getTime() - 24 * 3600 * 1000}
+                maxTimestamp={new Date().getTime()}
                 onChange={(e) => {
                     // if (props.dateChange)
                     //     props.dateChange(e[0])
@@ -141,5 +149,8 @@ export default function TimeRecord() {
                     // props.change(e)
                 }} color={MainColorType.orange} />
         }
+        {
+            showDurationPicker && <NewDurationPicker type={DurationPickerType.normal} />
+        }
     </View>
 }

+ 0 - 2
src/features/trackTimeDuration/components/Rings.weapp.tsx

@@ -167,7 +167,6 @@ export default function Rings(props: {
 
     var retryCount = 0;
     function drawCircle() {
-
         const query = Taro.createSelectorQuery();
         query.select(`#${canvasId}`).fields({ node: true, size: true });
         query.exec((res) => {
@@ -247,7 +246,6 @@ export default function Rings(props: {
             ctx.lineCap = 'round'; // 设置为圆角
             ctx.stroke();
         }
-
         // 绘制target进度环
         if (props.targetRing) {
             // ctx.beginPath();

+ 46 - 8
src/pages/clock/ClockIndex.tsx

@@ -4,38 +4,76 @@ import './ClockIndex.scss'
 import TabBar from "@/components/navigation/TabBar";
 import { IconNext } from "@/components/basic/Icons";
 import { rpxToPx } from "@/utils/tools";
+import { useDispatch, useSelector } from "react-redux";
+import { useEffect } from "react";
+import { homeInfo } from "@/services/health";
 
 
 export default function ClockIndex() {
+    const user = useSelector((state: any) => state.user);
+    const dispatch = useDispatch();
+    global.dispatch = dispatch;
+
+    useEffect(() => {
+        homeInfo().then(res => {
+
+        })
+    }, [user.isLogin])
+
+
     return <View><View
         onClick={() => {
+            if (!user.isLogin) {
+                jumpPage('/_account/pages/ChooseAuth')
+                return
+            }
             jumpPage('/_record/pages/time_record')
         }}
         style={{ height: 100, width: 100, backgroundColor: 'pink' }}>demo</View>
-        <View className="h60 bold" style={{marginLeft:rpxToPx(52)}}>早上好</View>
-        <View className="h44 bold" style={{marginLeft:rpxToPx(52),marginTop:rpxToPx(66),marginBottom:rpxToPx(58)}}>打卡</View>
+        <View className="h60 bold" style={{ marginLeft: rpxToPx(52) }}>早上好</View>
+        <View className="h44 bold" style={{ marginLeft: rpxToPx(52), marginTop: rpxToPx(66), marginBottom: rpxToPx(58) }}>打卡</View>
         <View className="operate_panel">
-            <View className="operate_card" onClick={()=>{
+            <View className="operate_card" onClick={() => {
+                if (!user.isLogin) {
+                    jumpPage('/_account/pages/ChooseAuth')
+                    return
+                }
                 jumpPage('/_record/pages/log_record')
             }}>
                 <View className="h36 bold">饮食</View>
                 <View style={{ flex: 1 }} />
-                <View style={{display:'flex',justifyContent:'space-between',alignItems:'center'}}>
+                <View style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
                     <IconNext width={rpxToPx(36)} color="#000" />
                     <IconNext width={rpxToPx(36)} color="#000" />
                 </View>
             </View>
-            <View className="operate_card" onClick={()=>{
+            <View className="operate_card" onClick={() => {
+                if (!user.isLogin) {
+                    jumpPage('/_account/pages/ChooseAuth')
+                    return
+                }
                 jumpPage('/_record/pages/log_record')
             }}></View>
-            <View className="operate_card" onClick={()=>{
+            <View className="operate_card" onClick={() => {
+                if (!user.isLogin) {
+                    jumpPage('/_account/pages/ChooseAuth')
+                    return
+                }
                 jumpPage('/_record/pages/time_record')
             }}></View>
-            <View className="operate_card" onClick={()=>{
+            <View className="operate_card" onClick={() => {
+                if (!user.isLogin) {
+                    jumpPage('/_account/pages/ChooseAuth')
+                    return
+                }
                 jumpPage('/_record/pages/time_record')
             }}></View>
 
-            <View className="operate_card" onClick={()=>{
+            <View className="operate_card" onClick={() => {
+                if (!user.isLogin) {
+                    jumpPage('/_account/pages/ChooseAuth')
+                    return
+                }
                 jumpPage('/_record/pages/metric_record')
             }}></View>
         </View>

+ 0 - 1
src/pages/moment/moment_detail_share.tsx

@@ -271,7 +271,6 @@ export default function MomentDetailShare(props: { user: any, canvas_id?: string
             });
         }
 
-
     }
 
     function canvasId() {

+ 57 - 15
src/services/health.tsx

@@ -1,5 +1,5 @@
 import { reject } from "lodash";
-import { API_ACTIVE_MOVES, API_ACTIVE_MOVES_CURRENT, API_ACTIVE_MOVES_SCHEDULES, API_HEALTH_ARCHIVED, API_HEALTH_CLOCK, API_HEALTH_EVENTS, API_HEALTH_FAST_SLEEP, API_HEALTH_LABELS_EVENT, API_HEALTH_LABELS_TIME, API_HEALTH_MOMENT, API_HEALTH_RECORD, API_HEALTH_SCHEDULES, API_HEALTH_STREAKS, API_HEALTH_WINDOWS, API_HEALTH_FAST, API_ME_ALBUMS, API_ME_ALBUMS_STAT, API_ME_JOURNALS, API_HEALTH_SCHEDULES_ORDERS, API_LASTEST_JOURNAL } from "./http/api";
+import { API_ACTIVE_MOVES, API_ACTIVE_MOVES_CURRENT, API_ACTIVE_MOVES_SCHEDULES, API_HEALTH_ARCHIVED, API_HEALTH_CLOCK, API_HEALTH_EVENTS, API_HEALTH_FAST_SLEEP, API_HEALTH_LABELS_EVENT, API_HEALTH_LABELS_TIME, API_HEALTH_MOMENT, API_HEALTH_RECORD, API_HEALTH_SCHEDULES, API_HEALTH_STREAKS, API_HEALTH_WINDOWS, API_HEALTH_FAST, API_ME_ALBUMS, API_ME_ALBUMS_STAT, API_ME_JOURNALS, API_HEALTH_SCHEDULES_ORDERS, API_LASTEST_JOURNAL, API_USER_HOME, API_USER_TAGS, API_USER_EVENTS } from "./http/api";
 import { request } from "./http/request";
 
 export const getLabelsEvent = (params) => {
@@ -221,10 +221,10 @@ export const updateEventDuration = (id, duration) => {
     })
 }
 
-export const clockTimes = (url,params) => {
+export const clockTimes = (url, params) => {
     return new Promise((resolve, reject) => {
         request({
-            url: API_HEALTH_CLOCK+url, method: 'POST', data: { ...params }
+            url: API_HEALTH_CLOCK + url, method: 'POST', data: { ...params }
         }).then(res => {
             resolve(res);
             // dispatch(loginSuccess(res));
@@ -268,13 +268,13 @@ export const getActiveMoves = (params) => {
 }
 
 export const uploadActiveMoves = (params) => {
-    return new Promise((resolve,reject) => {
+    return new Promise((resolve, reject) => {
         request({
             url: API_ACTIVE_MOVES, method: 'POST', data: { ...params }
         }).then(res => {
             resolve(res);
             // dispatch(loginSuccess(res));
-        }).catch(e=>{
+        }).catch(e => {
             reject(e)
         })
     })
@@ -306,7 +306,7 @@ export const getJournals = (params) => {
 export const journalDetail = (date, params) => {
     return new Promise((resolve) => {
         request({
-            url: API_ME_JOURNALS + '/' + date, method: 'GET', data: {...params}
+            url: API_ME_JOURNALS + '/' + date, method: 'GET', data: { ...params }
         }).then(res => {
             resolve(res);
             // dispatch(loginSuccess(res));
@@ -359,27 +359,27 @@ export const setMoveSchedules = (params) => {
     })
 }
 
-export const getEvents = (id,params) => {
-    return new Promise((resolve,reject) => {
+export const getEvents = (id, params) => {
+    return new Promise((resolve, reject) => {
         request({
-            url: API_HEALTH_EVENTS + '/' + id, method: 'GET', data: {...params}
+            url: API_HEALTH_EVENTS + '/' + id, method: 'GET', data: { ...params }
         }).then(res => {
             resolve(res);
             // dispatch(loginSuccess(res));
-        }).catch(e=>{
+        }).catch(e => {
             reject(e)
         })
     })
 }
 
 export const getRecordDetail = (id, params) => {
-    return new Promise((resolve,reject) => {
+    return new Promise((resolve, reject) => {
         request({
             url: API_HEALTH_RECORD + '/' + id, method: 'GET', data: { ...params }
         }).then(res => {
             resolve(res);
             // dispatch(loginSuccess(res));
-        }).catch(e=>{
+        }).catch(e => {
             reject(e)
         })
     })
@@ -418,10 +418,10 @@ export const updateFast = (params) => {
     })
 }
 
-export const delRecord = ( params) => {
+export const delRecord = (params) => {
     return new Promise((resolve, reject) => {
         request({
-            url: API_HEALTH_WINDOWS + '/batch' , method: 'DELETE', data: { ...params }
+            url: API_HEALTH_WINDOWS + '/batch', method: 'DELETE', data: { ...params }
         }).then(res => {
             resolve(res)
         }).catch(e => {
@@ -439,4 +439,46 @@ export const getLatestJournal = (isGet: boolean, params: any) => {
     //         // dispatch(loginSuccess(res));
     //     })
     // })
-}
+}
+
+export const homeInfo = () => {
+    return new Promise((resolve) => {
+        request({
+            url: API_USER_HOME, method: 'GET', data: {}
+        }).then(res => {
+            resolve(res);
+            // dispatch(loginSuccess(res));
+        })
+    })
+}
+export const userTags = (params) => {
+    return new Promise((resolve) => {
+        request({
+            url: API_USER_TAGS, method: 'GET', data: { ...params }
+        }).then(res => {
+            resolve(res);
+            // dispatch(loginSuccess(res));
+        })
+    })
+}
+export const addUserTag = (params) => {
+    return new Promise((resolve) => {
+        request({
+            url: API_USER_TAGS, method: 'POST', data: { ...params }
+        }).then(res => {
+            resolve(res);
+            // dispatch(loginSuccess(res));
+        })
+    })
+}
+export const addEvents = (params) => {
+    return new Promise((resolve) => {
+        request({
+            url: API_USER_EVENTS, method: 'POST', data: { ...params }
+        }).then(res => {
+            resolve(res);
+            // dispatch(loginSuccess(res));
+        })
+    })
+}
+

+ 6 - 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";
 
@@ -133,3 +133,8 @@ export const API_USER_MESSAGES = `${baseUrl}/api/user/messages`
 
 export const API_JOIN_DETAIL = `${baseUrl}/api/join/users` //打卡接龙详情
 export const API_JOIN_HISTORY = `${baseUrl}/api/join/histories` //完整接龙历史
+
+//record
+export const API_USER_HOME = `${baseUrl}/api/user/home`
+export const API_USER_TAGS = `${baseUrl}/api/user/tags`
+export const API_USER_EVENTS = `${baseUrl}/api/user/events`