Leon 1 vuosi sitten
vanhempi
commit
80bfefa270

+ 59 - 3
src/_health/pages/move_schedule.tsx

@@ -17,6 +17,7 @@ import Card from "../components/card";
 import { useTranslation } from "react-i18next";
 import { useSelector } from "react-redux";
 import showAlert from "@/components/basic/Alert";
+import NewSwitch from "@/components/basic/NewSwitch";
 
 let useRoute;
 let useNavigation;
@@ -180,8 +181,27 @@ export default function MoveSchedule() {
                                         item.reminder && permission.wxPubFollow ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
                                     }
                                     <View style={{ width: rpxToPx(12) }} />
-                                    {
-                                        !global.hideRingIcon && <Switch checked={item.reminder && permission.wxPubFollow} color={getThemeColor('ACTIVE')} onChange={e => {
+                                    <NewSwitch
+                                        disable={!permission.wxPubFollow}
+                                        onClick={() => {
+                                            if (!permission.wxPubFollow) {
+                                                showAlert({
+                                                    title: t('health.reminder_alert_title'),
+                                                    content: '',
+                                                    cancelText: t('health.reminder_cancel'),
+                                                    confirmText: t('health.reminder_confirm'),
+                                                    showCancel: true,
+                                                    cancel: () => {
+                                                    },
+                                                    confirm: () => {
+                                                        global.followWxPub()
+                                                        // checkNotification()
+                                                    }
+                                                })
+                                                return
+                                            }
+                                        }}
+                                        checked={item.reminder && permission.wxPubFollow} color={getThemeColor('ACTIVE')} onChange={e => {
                                             console.log(item)
                                             if (!permission.wxPubFollow) {
                                                 showAlert({
@@ -216,7 +236,43 @@ export default function MoveSchedule() {
                                                     global.updateMove()
                                                 }
                                             })
-                                        }} />}
+                                        }} />
+                                    {/* <Switch checked={item.reminder && permission.wxPubFollow} color={getThemeColor('ACTIVE')} onChange={e => {
+                                        console.log(item)
+                                        if (!permission.wxPubFollow) {
+                                            showAlert({
+                                                title: t('health.reminder_alert_title'),
+                                                content: '',
+                                                cancelText: t('health.reminder_cancel'),
+                                                confirmText: t('health.reminder_confirm'),
+                                                showCancel: true,
+                                                cancel: () => {
+                                                },
+                                                confirm: () => {
+                                                    global.followWxPub()
+                                                    // checkNotification()
+                                                }
+                                            })
+                                            return
+                                        }
+                                        createSchedule({
+                                            schedules: [{
+                                                id: item.schedule_id,
+                                                reminder: e.detail.value
+                                            }],
+                                        }).then(res => {
+                                            getData()
+                                            if (global.refreshWindow) {
+                                                global.refreshWindow()
+                                            }
+                                            if (global.refreshSchedules) {
+                                                global.refreshSchedules()
+                                            }
+                                            if (global.updateMove) {
+                                                global.updateMove()
+                                            }
+                                        })
+                                    }} /> */}
                                     <View style={{ marginRight: -rpxToPx(14) }} />
                                 </View>}
                                 disable={true}

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

@@ -17,6 +17,7 @@ import ConsoleCell from "../components/console_cell";
 import { useTranslation } from "react-i18next";
 import { useSelector } from "react-redux";
 import showAlert from "@/components/basic/Alert";
+import NewSwitch from "@/components/basic/NewSwitch";
 
 export default function MoveSettingReminder() {
     const [selIndex, setSelIndex] = useState(-1)
@@ -65,8 +66,27 @@ export default function MoveSettingReminder() {
                                         (item.reminder && permission.wxPubFollow) ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
                                     }
                                     <View style={{ width: rpxToPx(12) }} />
-                                    {
-                                        !global.hideRingIcon && <Switch checked={(item.reminder && permission.wxPubFollow)} color={getThemeColor('ACTIVE')} onChange={e => {
+                                    <NewSwitch
+                                        disable={!permission.wxPubFollow}
+                                        onClick={()=>{
+                                            if (!permission.wxPubFollow) {
+                                                showAlert({
+                                                    title: t('health.reminder_alert_title'),
+                                                    content: '',
+                                                    cancelText: t('health.reminder_cancel'),
+                                                    confirmText: t('health.reminder_confirm'),
+                                                    showCancel: true,
+                                                    cancel: () => {
+                                                    },
+                                                    confirm: () => {
+                                                        global.followWxPub()
+                                                        // checkNotification()
+                                                    }
+                                                })
+                                                return
+                                            }
+                                        }}
+                                        checked={(item.reminder && permission.wxPubFollow)} color={getThemeColor('ACTIVE')} onChange={e => {
                                             console.log(item)
                                             if (!permission.wxPubFollow) {
                                                 showAlert({
@@ -102,7 +122,45 @@ export default function MoveSettingReminder() {
                                                     global.updateMove()
                                                 }
                                             })
-                                        }} />}
+                                        }}
+                                    />
+                                    {/* <Switch checked={(item.reminder && permission.wxPubFollow)} color={getThemeColor('ACTIVE')} onChange={e => {
+                                        console.log(item)
+                                        if (!permission.wxPubFollow) {
+                                            showAlert({
+                                                title: t('health.reminder_alert_title'),
+                                                content: '',
+                                                cancelText: t('health.reminder_cancel'),
+                                                confirmText: t('health.reminder_confirm'),
+                                                showCancel: true,
+                                                cancel: () => {
+                                                },
+                                                confirm: () => {
+                                                    global.followWxPub()
+                                                    // checkNotification()
+                                                }
+                                            })
+                                            return
+                                        }
+
+                                        createSchedule({
+                                            schedules: [{
+                                                id: item.id,
+                                                reminder: e.detail.value
+                                            }],
+                                        }).then(res => {
+                                            getData()
+                                            if (global.refreshWindow) {
+                                                global.refreshWindow()
+                                            }
+                                            if (global.refreshSchedules) {
+                                                global.refreshSchedules()
+                                            }
+                                            if (global.updateMove) {
+                                                global.updateMove()
+                                            }
+                                        })
+                                    }} /> */}
                                     <View style={{ marginRight: -rpxToPx(14) }} />
                                 </View>}
                                 disable={true}

+ 31 - 6
src/_health/pages/post_result.tsx

@@ -17,6 +17,8 @@ import StatusIndicator, { StatusType } from "../base/status_indicator";
 import { useTranslation } from "react-i18next";
 import { SHARE_COVER_URL } from "@/services/http/api";
 import { TimeFormatter } from "@/utils/time_format";
+import NewSwitch from "@/components/basic/NewSwitch";
+import showAlert from "@/components/basic/Alert";
 
 let useRoute;
 let useNavigation;
@@ -43,6 +45,7 @@ export default function PostResult() {
     }
 
     const [data, setData] = useState(JSON.parse(router.params.data))
+    const permission = useSelector((state: any) => state.permission);
     const [showSetting, setShowSetting] = useState(false)
     const dispatch = useDispatch()
     const { t } = useTranslation()
@@ -201,7 +204,7 @@ export default function PostResult() {
                 alignItems: 'center',
                 justifyContent: 'center'
             }}>
-                <Image src={user.avatar+scale} mode="aspectFill" style={{
+                <Image src={user.avatar + scale} mode="aspectFill" style={{
                     background: user.isLogin ? 'transparent' : '#fff',
                     width: rpxToPx(108),
                     height: rpxToPx(108),
@@ -211,7 +214,7 @@ export default function PostResult() {
         }
         if (data.images && data.images.length > 0) {
             return <View className="result_icon_bg">
-                <Image className="result_icon_bg gray_bg" mode="aspectFill" src={data.images[0]+scale} />
+                <Image className="result_icon_bg gray_bg" mode="aspectFill" src={data.images[0] + scale} />
                 <View className="result_icon_small" style={{ backgroundColor: getMainColor() }}>
                     <IconCheck color="#fff" width={rpxToPx(32)} height={rpxToPx(32)} />
                 </View>
@@ -266,7 +269,7 @@ export default function PostResult() {
                         {
                             !global.hideRingIcon && <View style={{ marginRight: rpxToPx(8) }}>
                                 {
-                                    data.next.reminder ? <IconNotification color={MainColorType.link} width={rpxToPx(26)} /> :
+                                    permission.wxPubFollow && data.next.reminder ? <IconNotification color={MainColorType.link} width={rpxToPx(26)} /> :
                                         <IconNotificationOff color={MainColorType.link} width={rpxToPx(26)} />
                                 }
                             </View>
@@ -349,9 +352,9 @@ export default function PostResult() {
 
         </View>
         {
-            showSetting && false && <NewModal
+            showSetting && <NewModal
                 themeColor={getThemeColor(data.window)}
-                title='开启提醒'
+                title={t('health.set_reminder')}
                 dismiss={() => setShowSetting(false)}
                 confirm={() => setShowSetting(false)}
             >
@@ -365,7 +368,29 @@ export default function PostResult() {
                             </View>
 
                         </View>
-                        <Switch color={getThemeColor(data.window)} checked={data.next.reminder} onChange={changeReminder} />
+                        <NewSwitch
+                            disable={!permission.wxPubFollow}
+                            onClick={() => {
+                                if (!permission.wxPubFollow) {
+                                    showAlert({
+                                        title: t('health.reminder_alert_title'),
+                                        content: '',
+                                        cancelText: t('health.reminder_cancel'),
+                                        confirmText: t('health.reminder_confirm'),
+                                        showCancel: true,
+                                        cancel: () => {
+                                        },
+                                        confirm: () => {
+                                            global.followWxPub()
+                                            // checkNotification()
+                                        }
+                                    })
+                                    return
+                                }
+                            }}
+                            color={getThemeColor(data.window)} checked={data.next.reminder && permission.wxPubFollow} onChange={changeReminder} />
+
+                        {/* <Switch color={getThemeColor(data.window)} checked={data.next.reminder} onChange={changeReminder} /> */}
                     </View>
                 </Card>
             </NewModal>

+ 51 - 2
src/_health/pages/schedules_edit.tsx

@@ -20,6 +20,7 @@ import Card from "../components/card";
 import Layout from "@/components/layout/layout";
 import { NaviBarTitleShowType, TemplateType } from "@/utils/types";
 import { useTranslation } from "react-i18next";
+import NewSwitch from "@/components/basic/NewSwitch";
 
 let useRoute;
 let useNavigation;
@@ -224,7 +225,55 @@ export default function SchedulesEdit() {
                     obj.reminder && permission.wxPubFollow ? <IconNotification color={MainColorType.g03} width={rpxToPx(28)} /> : <IconNotificationOff color={MainColorType.g03} width={rpxToPx(28)} />
                 }
                 <View style={{ width: rpxToPx(12) }} />
-                <Switch checked={obj.reminder && permission.wxPubFollow}
+                <NewSwitch
+                    disable={!permission.wxPubFollow}
+                    checked={obj.reminder && permission.wxPubFollow}
+                    color={getThemeColor(obj.window)}
+                    onClick={e => {
+                        
+                        if (!permission.wxPubFollow) {
+                            showAlert({
+                                title: t('health.reminder_alert_title'),
+                                content: '',
+                                cancelText: t('health.reminder_cancel'),
+                                confirmText: t('health.reminder_confirm'),
+                                showCancel: true,
+                                cancel: () => {
+                                },
+                                confirm: () => {
+                                    global.followWxPub()
+                                    // checkNotification()
+                                }
+                            })
+                            return
+                        }
+                    }}
+                    onChange={e => {
+                        if (process.env.TARO_ENV == 'weapp') {
+                            e.stopPropagation()
+                        }
+                        if (!permission.wxPubFollow) {
+                            showAlert({
+                                title: t('health.reminder_alert_title'),
+                                content: '',
+                                cancelText: t('health.reminder_cancel'),
+                                confirmText: t('health.reminder_confirm'),
+                                showCancel: true,
+                                cancel: () => {
+                                },
+                                confirm: () => {
+                                    global.followWxPub()
+                                    // checkNotification()
+                                }
+                            })
+                            return
+                        }
+
+                        obj.reminder = e.detail.value;
+                        setList([...list])
+                    }}
+                />
+                {/* <Switch checked={obj.reminder && permission.wxPubFollow}
                     color={getThemeColor(obj.window)}
                     onChange={e => {
                         if (process.env.TARO_ENV == 'weapp') {
@@ -249,7 +298,7 @@ export default function SchedulesEdit() {
 
                         obj.reminder = e.detail.value;
                         setList([...list])
-                    }} />
+                    }} /> */}
             </View>
         }
         return <View />

+ 11 - 0
src/components/basic/NewSwitch.scss

@@ -0,0 +1,11 @@
+.switch_container {
+    position: relative;
+}
+
+.switch_top {
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+}

+ 28 - 0
src/components/basic/NewSwitch.tsx

@@ -0,0 +1,28 @@
+import { View, Switch } from "@tarojs/components";
+import './NewSwitch.scss'
+
+export default function NewSwitch(props: {
+    disable: boolean,
+    checked: boolean,
+    color: string,
+    onChange: any,
+    onClick?: any
+}) {
+    return <View className="switch_container">
+        <Switch checked={props.checked}
+            color={props.color}
+            onChange={props.onChange}
+        />
+        {
+            props.disable && <View className="switch_top" onClick={(e) => {
+                if (process.env.TARO_ENV == 'weapp') {
+                    e.stopPropagation()
+                }
+                if (props.onClick) {
+                    props.onClick()
+                }
+            }} />
+        }
+
+    </View>
+}

+ 61 - 30
src/features/health/HistoryItem.tsx

@@ -51,7 +51,7 @@ export default function HistoryItem(props: {
 
     }
 
-    function singleItem(type, url, obj, key) {
+    function singleItem(type, url, obj, key,urls=[]) {
         return <View
             onClick={(e) => {
                 if (process.env.TARO_ENV == 'weapp') {
@@ -100,20 +100,32 @@ export default function HistoryItem(props: {
                 type == 'PIC' && <CoverList imgs={[url]} count={1} />
             }
             {
-                type == 'PIC_TEXT' && <Image
-                    className="gray_bg"
-                    style={{ width: rpxToPx(178), height: rpxToPx(178), marginRight: rpxToPx(7), flexShrink: 0 }}
-                    src={url+scale}
-                    onClick={(e) => {
-                        if (process.env.TARO_ENV == 'weapp') {
-                            e.stopPropagation()
-                        }
-                        Taro.previewImage({
-                            current: url,
-                            urls: [url]
-                        })
-                    }}
-                    mode="aspectFill" />
+                type == 'PIC_TEXT' && <View  onClick={(e) => {
+                    if (process.env.TARO_ENV == 'weapp') {
+                        e.stopPropagation()
+                    }
+                    Taro.previewImage({
+                        current: urls[0],
+                        urls: urls
+                    })
+                }}>
+                    <JournalCover imgs={urls} />
+                </View>
+                
+                // <Image
+                //     className="gray_bg"
+                //     style={{ width: rpxToPx(178), height: rpxToPx(178), marginRight: rpxToPx(7), flexShrink: 0 }}
+                //     src={url+scale}
+                //     onClick={(e) => {
+                //         if (process.env.TARO_ENV == 'weapp') {
+                //             e.stopPropagation()
+                //         }
+                //         Taro.previewImage({
+                //             current: url,
+                //             urls: [url]
+                //         })
+                //     }}
+                //     mode="aspectFill" />
             }
             {
                 type == 'PIC_TEXT' && <View style={{
@@ -197,6 +209,12 @@ export default function HistoryItem(props: {
         <View className="history_content" style={{ paddingTop: rpxToPx(0) }}>
             {
                 props.mode != 'EAT' && props.mode != 'ACTIVE' && props.data.dataArray.map((content, i) => {
+                    var urlArray:any = []
+                    if (content.type == 'PIC_TEXT'){
+                        urlArray = content.data[0].urls.map(obj => obj.url);
+                    }
+                    
+
                     return <View style={{ display: 'flex', flexDirection: 'row', marginBottom: rpxToPx(12), flex: 1 }} key={i}>
                         {
                             content.type == 'TEXT' && <View style={{
@@ -223,20 +241,32 @@ export default function HistoryItem(props: {
                             content.type == 'PIC' && <CoverList imgs={content.data} count={content.data.length} />
                         }
                         {
-                            content.type == 'PIC_TEXT' && <Image
-                                className="gray_bg"
-                                style={{ width: rpxToPx(178), height: rpxToPx(178), marginRight: rpxToPx(7), flexShrink: 0 }}
-                                src={content.data[0].url+scale}
-                                onClick={(e) => {
-                                    if (process.env.TARO_ENV == 'weapp') {
-                                        e.stopPropagation()
-                                    }
-                                    Taro.previewImage({
-                                        current: content.data[0].url,
-                                        urls: [content.data[0].url]
-                                    })
-                                }}
-                                mode="aspectFill" />
+                            
+                            content.type == 'PIC_TEXT' && <View style={{marginRight: rpxToPx(7)}} onClick={(e) => {
+                                if (process.env.TARO_ENV == 'weapp') {
+                                    e.stopPropagation()
+                                }
+                                Taro.previewImage({
+                                    current: urlArray[0],
+                                    urls: urlArray
+                                })
+                            }}>
+                                <JournalCover imgs={urlArray} />
+                            </View>
+                            // <Image
+                            //     className="gray_bg"
+                            //     style={{ width: rpxToPx(178), height: rpxToPx(178), marginRight: rpxToPx(7), flexShrink: 0 }}
+                            //     src={content.data[0].url+scale}
+                            //     onClick={(e) => {
+                            //         if (process.env.TARO_ENV == 'weapp') {
+                            //             e.stopPropagation()
+                            //         }
+                            //         Taro.previewImage({
+                            //             current: content.data[0].url,
+                            //             urls: [content.data[0].url]
+                            //         })
+                            //     }}
+                            //     mode="aspectFill" />
                         }
                         {
                             content.type == 'PIC_TEXT' && <View style={{
@@ -285,7 +315,8 @@ export default function HistoryItem(props: {
                             }
                             break
                         case 'PIC_TEXT':
-                            return singleItem('PIC_TEXT', content.data[0].url, content.data[0], i)
+                            const urlArray = content.data[0].urls.map(obj => obj.url);
+                            return singleItem('PIC_TEXT', content.data[0].url, content.data[0], i,urlArray)
                             break
                     }
                 })

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

@@ -462,7 +462,7 @@ export default function MainConsole(props: { type: WindowType }) {
             case 'DAY':
             case 'NIGHT':
                 {
-                    list = [t('health.change_location'), t('health.clear_location')]
+                    list = [t('health.change_location'), t('health.clear_location'), t('health.set_reminder')]
                 }
                 break;
         }
@@ -563,6 +563,9 @@ export default function MainConsole(props: { type: WindowType }) {
             case t('health.edit_schedule'):
                 jumpPage('/_health/pages/schedules?mode=' + health.mode)
                 break
+            case t('health.set_reminder'):
+                jumpPage('/_health/pages/schedules_edit?type=reminder&mode=' + health.mode)
+                break
             case t('health.delete_log'):
                 {
                     const obj = getScenario(health.windows, health.mode)

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

@@ -293,6 +293,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
                                             title: moment.title,
                                             description: moment.description,
                                             url: moment.media[0].url,
+                                            urls:moment.media,
                                             event_id: event.id
                                         }
                                     ]
@@ -362,6 +363,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
         setLoading(true)
         records(params).then(res => {
             var array = (res as any).data
+            
 
             array.map(item => {
                 var temps: any = []
@@ -423,6 +425,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
                                             title: moment.title,
                                             description: moment.description,
                                             url: moment.media[0].url,
+                                            urls:moment.media,
                                             event_id: event.id
                                         }
                                     ]
@@ -449,6 +452,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
                 }
 
                 item.dataArray = temps;
+
             })
 
 

+ 2 - 0
src/features/health/MainHistory2.tsx

@@ -322,6 +322,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
                                             title: moment.title,
                                             description: moment.description,
                                             url: moment.media[0].url,
+                                            urls:moment.media,
                                             event_id: event.id
                                         }
                                     ]
@@ -442,6 +443,7 @@ export default forwardRef((props: { type?: string, fast_type?: string, updateDat
                                             title: moment.title,
                                             description: moment.description,
                                             url: moment.media[0].url,
+                                            urls:moment.media,
                                             event_id: event.id
                                         }
                                     ]

+ 10 - 7
src/pages/clock/ClockNew.tsx

@@ -87,12 +87,7 @@ export default function ClockNew(props: { children: any, onScroll: any }) {
         }
     }
 
-    global.followWxPub = () => {
-        const resource = common.resources.filter((item: any) => {
-            return item.code == 'follow_wx_pub'
-        })
-        jumpPage('/pages/common/H5?title=fast16cc 关注服务号&url=' + resource[0].url)
-    }
+
 
     function refreshData() {
         global.refreshWindow()
@@ -191,7 +186,7 @@ export default function ClockNew(props: { children: any, onScroll: any }) {
                 }
             })
             var time = new Date()
-            if (time.getSeconds() % 30 == 0) {
+            if (time.getSeconds() == 0 && time.getMinutes() % 5 == 0) {
                 getFollowStatus()
             }
         }, 1000)
@@ -207,6 +202,14 @@ export default function ClockNew(props: { children: any, onScroll: any }) {
 
     }, [])
 
+    global.followWxPub = () => {
+        const resource = common.resources.filter((item: any) => {
+            return item.code == 'follow_wx_pub'
+        })
+        jumpPage('/pages/common/H5?title=fast16cc 关注服务号&url=' + resource[0].url)
+        dispatch(setWXFollow(true))
+    }
+
     useEffect(() => {
         getWindows();
         if (global.refreshHistory) {

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

@@ -3,7 +3,7 @@ const online = process.env.TARO_ENV == 'weapp' ? true : false;
 import { WX_VERSION as _WX_VERSION, APP_VERSION as _APP_VERSION, ANDROID_VERSION as _ANDROID_VERSION } from "../../../config/env";
 
 // 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.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.pre.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