Leon 2 anos atrás
pai
commit
fcdf819e52

+ 7 - 1
ios/Podfile.lock

@@ -18,6 +18,8 @@ PODS:
     - ExpoModulesCore
   - EXConstants (14.0.2):
     - ExpoModulesCore
+  - EXErrorRecovery (4.0.1):
+    - ExpoModulesCore
   - EXFileSystem (15.1.1):
     - ExpoModulesCore
   - EXFont (11.0.1):
@@ -468,6 +470,7 @@ DEPENDENCIES:
   - EXBrightness (from `../node_modules/expo-brightness/ios`)
   - EXCamera (from `../node_modules/expo-camera/ios`)
   - EXConstants (from `../node_modules/expo-constants/ios`)
+  - EXErrorRecovery (from `../node_modules/expo-error-recovery/ios`)
   - EXFileSystem (from `../node_modules/expo-file-system/ios`)
   - EXFont (from `../node_modules/expo-font/ios`)
   - EXImageLoader (from `../node_modules/expo-image-loader/ios`)
@@ -589,6 +592,8 @@ EXTERNAL SOURCES:
     :path: "../node_modules/expo-camera/ios"
   EXConstants:
     :path: "../node_modules/expo-constants/ios"
+  EXErrorRecovery:
+    :path: "../node_modules/expo-error-recovery/ios"
   EXFileSystem:
     :path: "../node_modules/expo-file-system/ios"
   EXFont:
@@ -716,6 +721,7 @@ SPEC CHECKSUMS:
   EXBrightness: 1725afacfdaeb4724bb949c44384cff0ef0d7d18
   EXCamera: d7e91d5857faee493ca3cf8dafd42572db61849e
   EXConstants: 3c86653c422dd77e40d10cbbabb3025003977415
+  EXErrorRecovery: ae43433feb0608a64dc5b1c8363b3e7769a9ea24
   EXFileSystem: 60602b6eefa6873f97172c684b7537c9760b50d6
   EXFont: 319606bfe48c33b5b5063fb0994afdc496befe80
   EXImageLoader: 84b65e6bd9d3345d6fbb3ab936a546c54496a64d
@@ -793,4 +799,4 @@ SPEC CHECKSUMS:
 
 PODFILE CHECKSUM: c500841d0cd00b84fdb1d6b4c1b8833eab606c22
 
-COCOAPODS: 1.14.3
+COCOAPODS: 1.14.2

+ 15 - 4
src/app.scss

@@ -100,14 +100,25 @@ page {
     color: transparent;
 }
 
+.box_header{
+    display: flex;
+    flex-direction: row;
+    height: 48px;
+    overflow: visible;
+    // justify-content: space-between;
+    position: relative;
+    align-items: center;
+    margin-bottom: 12px;
+}
+
 .box_title{
-    font-weight: 500;
+    display: flex;
+    height: 48px;
+    font-weight: bold;
     font-size: 48px;
     line-height: 48px;
-    margin-bottom: 12px;
-    // width: 100%;
+    flex:1;
     color: #fff;
-    // background-color: orange;
 }
 
 .box_subtitle{

+ 23 - 0
src/app.tsx

@@ -13,6 +13,29 @@ import Taro from '@tarojs/taro'
 const App: React.FC<PropsWithChildren> = ({ children }) => {
   if (process.env.TARO_ENV == 'weapp') {
     global.isDebug = Taro.getStorageSync('isDebug')
+
+    const updateManager = Taro.getUpdateManager()
+    updateManager.onUpdateReady(function () {
+      Taro.showModal({
+        title: '更新提示',
+        content: '新版本已经准备好,是否重启应用?',
+        showCancel: false,
+        success: function (res) {
+          if (res.confirm) {
+            updateManager.applyUpdate();
+          }
+        }
+      });
+    });
+    updateManager.onUpdateFailed(function () {
+      // 新版本下载失败
+      Taro.showModal({
+        title: '已经有新版本喽~',
+        content: '请您删除当前小程序,到微信 “发现-小程序” 页,重新搜索打开哦~',
+        showCancel: false,
+      });
+    });
+
   }
   else {
     // Taro.getStorage({

BIN
src/assets/images/bell.png


BIN
src/assets/images/switch_off.png


Diferenças do arquivo suprimidas por serem muito extensas
+ 3 - 0
src/components/basic/Icons.tsx


+ 13 - 0
src/components/input/Switch.scss

@@ -0,0 +1,13 @@
+.switch1{
+    height: 56px;
+    position: absolute;
+    right: 0;
+    top: -4px;
+    overflow: visible;
+    z-index: 1;
+}
+
+.switch2{
+    width: 92px;
+    height: 56px;
+}

+ 20 - 5
src/components/input/Switch.tsx

@@ -1,14 +1,29 @@
 import { View, Image } from "@tarojs/components";
-
+import './Switch.scss'
+import { IconSwitchOff } from "../basic/Icons";
+import Taro from "@tarojs/taro";
 export default function Component(props: { isOn: boolean, onClick: Function }) {
 
+    function rpxToPx(n: number) {
+        var rate = Taro.getSystemInfoSync().windowWidth / 750;
+        return n * rate;
+    }
     if (process.env.TARO_ENV == 'weapp') {
-        return <View onClick={() => props.onClick()}>
-            <Image style={{ width: 42, height: 26 }}
-                src={require(props.isOn ? '@/assets/images/notice_switch_select.png' : '@/assets/images/notice_switch_unselect.png')} />
+        return <View className="switch1" style={{ backgroundColor: global.isDebug ? 'blue' : 'transparent' }} onClick={(e) => { e.stopPropagation(); props.onClick() }}>
+
+            {
+                props.isOn ? <Image src={require('@/assets/images/bell.png')} style={{ height: rpxToPx(56), width: rpxToPx(56) }} /> :
+                    <Image src={require('@/assets/images/switch_off.png')} style={{ height: rpxToPx(56), width: rpxToPx(92) }} />
+            }
+
+            {/* <Image className="switch2" style={{ backgroundColor:'blue' }}
+                src={require(props.isOn ? '@/assets/images/switch.png' : '@/assets/images/switch.png')} /> */}
         </View>
     }
-    return <View onClick={() => props.onClick()}></View>
+    return <View onClick={(e) => {
+
+        props.onClick()
+    }}></View>
 
 
 }

+ 0 - 1
src/components/layout/layout.tsx

@@ -58,7 +58,6 @@ export default function Layout(props: {
     }
 
     usePageScroll((e) => {
-        console.log('b')
         if (props.titleShowStyle == NaviBarTitleShowType.scrollToShow) {
             if (e.scrollTop > 70) {
                 setShowTitle(true)

+ 2 - 2
src/components/view/Tooltip.scss

@@ -4,7 +4,7 @@
     flex-direction: row;
     height: 76px;
     border-radius: 38px;
-    background-color: #505050;
+    background-color: #787878;
     padding-left: 28px;
     padding-right: 28px;
     align-items: center;
@@ -26,7 +26,7 @@
     height: 0;
     border-left: 25px solid transparent;
     border-right: 25px solid transparent;
-    border-bottom: 20px solid #505050;
+    border-bottom: 20px solid #787878;
 
 }
 

+ 18 - 0
src/context/locales/zh.js

@@ -104,6 +104,24 @@ export default {
         track_time_duration: {
             status_indicator: {
 
+            },
+            follow_wx_pub:{
+                //未关注状态
+                modal_unfollowed_title:'日程提醒',
+                modal_unfollowed_content:'关注公众号\n开启我的日程提醒!',
+                modal_unfollowed_cancel_btn:'返回',
+                modal_unfollowed_confirm_btn:'去开启',
+
+                h5_unfollowed_title:'开启日程提醒',
+
+                //已关注状态
+                modal_followed_title:'日程提醒已开启',
+                modal_followed_content:'要前往公众号查看吗?',
+                modal_followed_cancel_btn:'返回',
+                modal_followed_confirm_btn:'前往查看',
+                
+                h5_followed_title:'日程提醒',
+
             },
             console: {
                 fast_start: '开始断食',

+ 35 - 26
src/features/trackTimeDuration/components/Schedule.tsx

@@ -48,14 +48,24 @@ export default function Component(props: { type?: string, data?: any, delSuccess
             return item.code == 'follow_wx_pub'
         })
 
+        const title = permission.wxPubFollow ?t('feature.track_time_duration.follow_wx_pub.h5_followed_title'):
+        t('feature.track_time_duration.follow_wx_pub.h5_unfollowed_title')
+
         Taro.showModal({
-            title: '提示',
-            content: '关注公众号后可接收提醒\n点击确定,前往关注',
+            title: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_title') :
+                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_title'),
+            content: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_content') :
+                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_content'),
             showCancel: true,
+            cancelText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_cancel_btn') :
+                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_cancel_btn'),
+            confirmText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_confirm_btn') :
+                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_confirm_btn'),
             success(result) {
                 if (result.confirm) {
+                    global.forceRefreshWXPub = true
                     Taro.navigateTo({
-                        url: '/pages/common/H5?title=fast16cc 关注服务号&url=' + resource[0].url,
+                        url: '/pages/common/H5?title=' + title + '&url=' + resource[0].url,
                     })
                 }
             },
@@ -160,11 +170,11 @@ export default function Component(props: { type?: string, data?: any, delSuccess
     }
 
     function detailCenter() {
-        if (!permission.wxPubFollow) {
-            return <View className="tip_bg2">
-                <Text className="tip_text2">{t('feature.track_time_duration.schedule.follow_tip')}</Text>
-            </View>
-        }
+        // if (!permission.wxPubFollow) {
+        //     return <View className="tip_bg2">
+        //         <Text className="tip_text2">{t('feature.track_time_duration.schedule.follow_tip')}</Text>
+        //     </View>
+        // }
 
         var nextCheckTimestamp = 0;
         if (time.status != 'WAIT_FOR_START') {
@@ -242,23 +252,17 @@ export default function Component(props: { type?: string, data?: any, delSuccess
 
     }
 
-    if (!permission.wxPubFollow) {
-        return <View className="schedule_box">
-            <Text className="box_title">{t('feature.track_time_duration.schedule.section_title')}</Text>
-            <Text className="box_subtitle">{TimeFormatter.getDateAndWeek(new Date().getTime(), true)}</Text>
-            <View className="schedule_line" />
-            <View className="schedule_row">
-                <Text>{t('feature.track_time_duration.schedule.follow_tip')}</Text>
-                <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
-            </View>
-        </View>
-        // return <TableCell title={t('feature.track_time_duration.schedule.follow_tip')} showMarginBottom={true}>
-        //     <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
-        // </TableCell>
-        // <View className="tip_bg2">
-        //     <Text className="tip_text2">{t('feature.track_time_duration.schedule.follow_tip')}</Text>
-        // </View>
-    }
+    // if (!permission.wxPubFollow) {
+    //     return <View className="schedule_box">
+    //         <Text className="box_title">{t('feature.track_time_duration.schedule.section_title')}</Text>
+    //         <Text className="box_subtitle">{TimeFormatter.getDateAndWeek(new Date().getTime(), true)}</Text>
+    //         <View className="schedule_line" />
+    //         <View className="schedule_row">
+    //             <Text>{t('feature.track_time_duration.schedule.follow_tip')}</Text>
+    //             <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
+    //         </View>
+    //     </View>
+    // }
 
     var nextCheckTimestamp = 0;
     if (time.status != 'WAIT_FOR_START') {
@@ -288,7 +292,12 @@ export default function Component(props: { type?: string, data?: any, delSuccess
 
     if (nextCheckTimestamp != 0 && today.getTime() > nextCheckTimestamp) {
         return <View className="schedule_box">
-            <Text className="box_title">{t('feature.track_time_duration.schedule.section_title')}</Text>
+            <View className="box_header" style={{ marginRight: 20, backgroundColor: global.isDebug ? 'red' : 'transparent' }}>
+                <Text className="box_title">{t('feature.track_time_duration.schedule.section_title')}</Text>
+                <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
+
+            </View>
+
             <Text className="box_subtitle">{TimeFormatter.getDateAndWeek(new Date().getTime(), true)}</Text>
             <View className="schedule_line" />
             <View className="schedule_row">

+ 48 - 6
src/features/trackTimeDuration/components/TimelineStage.tsx

@@ -5,13 +5,55 @@ import Segment from '@/components/navigation/Segment';
 import TimelineFastSleep from './TimelineFastSleep';
 import Stage from './Stage';
 import { useTranslation } from 'react-i18next';
+import Switch from '@/components/input/Switch';
+import { useSelector } from 'react-redux';
+import Taro from '@tarojs/taro';
 
 
-export default function Component(props: { data: any, title?: string, subTitle?: string,isSchedule?:boolean }) {
+export default function Component(props: { data: any, title?: string, subTitle?: string, isSchedule?: boolean }) {
     const [segmentIndex, setSegmentIndex] = useState(0)
-    const {t} = useTranslation()
+    const permission = useSelector((state: any) => state.permission);
+    const common = useSelector((state: any) => state.common);
+    const { t } = useTranslation()
+
+    function followWxPub() {
+        const resource = common.resources.filter((item: any) => {
+            return item.code == 'follow_wx_pub'
+        })
+
+        const title = permission.wxPubFollow ?t('feature.track_time_duration.follow_wx_pub.h5_followed_title'):
+        t('feature.track_time_duration.follow_wx_pub.h5_unfollowed_title')
+
+        Taro.showModal({
+            title: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_title') :
+                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_title'),
+            content: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_content') :
+                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_content'),
+            showCancel: true,
+            cancelText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_cancel_btn') :
+                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_cancel_btn'),
+            confirmText: permission.wxPubFollow ? t('feature.track_time_duration.follow_wx_pub.modal_followed_confirm_btn') :
+                t('feature.track_time_duration.follow_wx_pub.modal_unfollowed_confirm_btn'),
+            success(result) {
+                if (result.confirm) {
+                    global.forceRefreshWXPub = true
+                    Taro.navigateTo({
+                        url: '/pages/common/H5?title=' + title + '&url=' + resource[0].url,
+                    })
+                }
+            },
+        })
+    }
+
     return <View style={{ display: 'flex', flexDirection: 'column', width: '578rpx' }}>
-        <Text className='box_title'>{props.title ? props.title : 'Title'}</Text>
+        {/* <Text className='box_title'>{props.title ? props.title : 'Title'}</Text> */}
+        <View className="box_header" style={{ backgroundColor: global.isDebug ? 'pink' : 'transparent' }}>
+            <Text className="box_title" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{props.title ? props.title : 'Title'}</Text>
+            {
+                props.isSchedule &&
+                <Switch isOn={permission.wxPubFollow} onClick={() => followWxPub()} />
+            }
+        </View>
         <Text className='box_subtitle'>{props.subTitle ? props.subTitle : 'subTitle'}</Text>
         <View className="segment_detail" style={{
             display: 'flex', alignItems: 'center',
@@ -31,7 +73,7 @@ export default function Component(props: { data: any, title?: string, subTitle?:
                     <View style={{ opacity: segmentIndex == 0 ? 1 : 0 }}>
                         <TimelineFastSleep data={props.data} />
                     </View>
-                    {props.data.scenario == 'FAST_SLEEP' &&<View style={{
+                    {props.data.scenario == 'FAST_SLEEP' && <View style={{
                         opacity: segmentIndex == 1 ? 1 : 0,
                         position: 'absolute', left: 0, top: 0, right: 0, bottom: 0,
                     }}>
@@ -57,8 +99,8 @@ export default function Component(props: { data: any, title?: string, subTitle?:
         {
             props.data.scenario == 'FAST_SLEEP' &&
             <View style={{ marginBottom: 0 }}>
-                <Segment titles={[props.isSchedule?t('feature.track_time_duration.schedule.timeline'):
-                t('feature.track_time_duration.record_fast_sleep.timeline'), 
+                <Segment titles={[props.isSchedule ? t('feature.track_time_duration.schedule.timeline') :
+                    t('feature.track_time_duration.record_fast_sleep.timeline'),
                 t('feature.track_time_duration.schedule.stage')]} changed={(e) => {
                     setSegmentIndex(e);
                     global.segmentIndex = e

+ 8 - 1
src/pages/clock/Clock.weapp.tsx

@@ -298,7 +298,14 @@ export default function IndexPage() {
   }
 
   function checkWXPubFollow() {
-    wxPubFollow().then(res => {
+    var params;
+    if (global.forceRefreshWXPub){
+      params = {
+        force_refresh:true
+      }
+    }
+    global.forceRefreshWXPub = false
+    wxPubFollow(params).then(res => {
       dispatch(setWXFollow((res as any).wx_pub_followed));
       console.log('当前的关注状态' + (res as any).wx_pub_followed);
 

+ 3 - 0
src/pages/common/H5.config.ts

@@ -0,0 +1,3 @@
+export default definePageConfig({
+    "navigationBarTitleText":""
+})

+ 12 - 1
src/pages/common/H5.tsx

@@ -1,9 +1,20 @@
 import { WebView } from "@tarojs/components";
+import Taro from "@tarojs/taro";
 import { useRouter } from "@tarojs/taro";
+import { useEffect } from "react";
+import { useTranslation } from "react-i18next";
 
 export default function Page(){
+    const {t} = useTranslation()
     const router = useRouter();
-    console.log(router.params.url);
+
+    useEffect(()=>{
+        Taro.setNavigationBarTitle({
+            title:router.params.title??''
+            // title:t('feature.track_time_duration.follow_wx_pub.title')
+        })
+    },[])
+    
     return (
         <WebView style={{display:'flex',flex:1}} src={router.params.url as string} />
     )

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

@@ -1,4 +1,4 @@
-let online = false;
+let online = true;
 export let baseUrl = online ? 'https://api2.fast.liveplus.fun' : 'https://api.fast.dev.liveplus.fun';
 export let imgUrl = online
     ? 'https://api.fast.liveplus.fun/static/image/'

+ 2 - 2
src/services/permission.tsx

@@ -1,10 +1,10 @@
 import { API_WX_PUB_FOLLOWED } from './http/api'
 import { request } from './http/request';
 
-export const wxPubFollow = () => {
+export const wxPubFollow = (params:any) => {
     return new Promise((resolve) => {
         request({
-            url: API_WX_PUB_FOLLOWED, method: 'GET', data: {}
+            url: API_WX_PUB_FOLLOWED, method: 'GET', data: { ...params }
         }).then(res => {
             resolve(res);
             console.log(res);

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff