leon 1 年之前
父節點
當前提交
c04a0d7b1e

File diff suppressed because it is too large
+ 1 - 1
android/app/src/main/assets/index.android.bundle


File diff suppressed because it is too large
+ 0 - 0
android/app/src/main/assets/index.android.map


二進制
android/app/src/main/res/drawable-mdpi/src_assets_images_center.png


二進制
android/app/src/main/res/drawable-mdpi/src_assets_images_check_white.png


二進制
android/app/src/main/res/drawable-mdpi/src_assets_images_pointer.png


二進制
src/assets/images/center.png


+ 2 - 2
src/components/input/SlidngScale.tsx

@@ -300,7 +300,7 @@ export default function Component(props: {
             <View className="shadow_right" />
             <View className="top_line" style={{ backgroundColor: props.themeColor }} />
             <ScrollView
-                style={{ zIndex: 0, position: 'relative' }} ref={scrollViewRef}
+                style={{ zIndex: 0, position: 'relative',marginTop:-40 }} ref={scrollViewRef}
                 showsHorizontalScrollIndicator={false}
                 scrollX scrollLeft={left} className="scroll"
                 enablePassive={true}
@@ -313,7 +313,7 @@ export default function Component(props: {
                 onScroll={scrollContent}
                 enhanced
             >
-                <View className="scrollContent">
+                <View className="scrollContent" style={{paddingTop:40}}>
                     <View className="scrollPadding" style={{ width: rpxToPx(372) }} />
                     <View className="content">
                         <View>

+ 3 - 3
src/features/common/PostBtn.tsx

@@ -18,10 +18,10 @@ export default function Component(props: {
 
     useEffect(() => {
         if (btnStatus == 'normal') {
-            var t = setTimeout(() => {
+            // var t = setTimeout(() => {
                 setBtnStatus('abnormal')
-            }, 500)
-            setTimer(t as any)
+            // }, 500)
+            // setTimer(t as any)
         }
         else if (btnStatus == 'idle') {
             if (timer) {

+ 9 - 2
src/features/trackSomething/components/Metric.tsx

@@ -464,9 +464,17 @@ export default function Component(props: any) {
 
         var array: any[] = [];
         result.schemas.map((item, index) => {
+            if (!item.tempValue){
+                var unit = item.chosen_unit
+                item.unit_options.map(obj=>{
+                    if (unit == obj.unit){
+                        item.tempValue = obj.default_value
+                    }
+                })
+            }
             array.push({
                 code: item.code,
-                value: item.tempValue && item.tempValue > 0 ? item.tempValue : item.default_value,
+                value: item.tempValue,
                 unit: item.tempUnit ?? ''
             })
         })
@@ -480,7 +488,6 @@ export default function Component(props: any) {
                 confirm_time: new Date().getTime()
             }
         }
-        debugger
 
         global.postBtnUpdateStatus('normal');
         uploadMetric(params).then(res => {

+ 6 - 3
src/features/trackSomething/components/MetricHistory.tsx

@@ -155,18 +155,21 @@ export default function Component(props: { records: any[] }) {
         {
             metricStandard()
         }
+
+        <View>
+        </View>
         {
             (list as any).map((item, index) => {
                 var showYear = lastYearStr != TimeFormatter.getYearByDate(item.date)
                 lastYearStr = TimeFormatter.getYearByDate(item.date)
-                return <View style={{ display: 'flex', flexDirection: 'column', paddingBottom: index < list.length - 1 ? 0 : 80,zIndex:0 }}>
+                return <View style={{ display: 'flex', flexDirection: 'column', paddingBottom: index < list.length - 1 ? 0 : 80,zIndex:index==selIndex[0]?1:0 }}>
                     {
                         showYear && <Text className="year" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{TimeFormatter.getYearByDate(item.date)}</Text>
                     }
                     <Text className="operate_day" style={{ backgroundColor: global.isDebug ? 'red' : 'transparent' }}>{TimeFormatter.getMonthAndDayByDate(item.date)}</Text>
                     {
                         item.records.map((record, j) => {
-                            return <View style={{ position: 'relative' }} key={j}><RecordItem delete={() => deleteRecord(record)}>
+                            return <View style={{ position: 'relative',zIndex:j==selIndex[1]?3:2 }} key={j}><RecordItem delete={() => deleteRecord(record)}>
                                 <View className="operate_item1" onClick={(e) => {
                                     if (process.env.TARO_ENV == 'weapp') {
                                         e.stopPropagation()
@@ -202,7 +205,7 @@ export default function Component(props: { records: any[] }) {
                             </RecordItem>
                                 {
                                     index == selIndex[0] && j == selIndex[1] && 
-                                        <View style={{ display: 'flex', flexDirection: 'column',zIndex:10000, position: 'absolute', alignItems: 'center', top: rpxToPx(125), left: 30 }}>
+                                        <View style={{ display: 'flex', flexDirection: 'column',zIndex:10, position: 'absolute', alignItems: 'center', top: rpxToPx(125), left: 30 }}>
                                             <Image src={require('@assets/images/pointer.png')} style={{ width: 32, height: 12, marginBottom: -2 }} />
                                             <View style={{
                                                 backgroundColor: '#505050',

+ 15 - 1
src/features/trackSomething/components/MetricModalAdd.tsx

@@ -27,7 +27,14 @@ export default function Component(props: { item: any, strTime: string, showPicke
 
     function addDetail() {
         return <View className='modal_content'>
-            <Text className='modal_title' style={{ color: (metricItem as any).theme_color }}>{(metricItem as any).name ? (metricItem as any).name : ''}</Text>
+            {
+                process.env.TARO_ENV == 'rn' && <View style={{position:'absolute',left:0,right:0,top:0,bottom:0}} onClick={()=>{
+                    setSelUnit(-1)
+                }}></View>
+            }
+            <Text className='modal_title' style={{ color: (metricItem as any).theme_color }} onClick={()=>{
+                    setSelUnit(-1)
+                }} suppressHighlighting>{(metricItem as any).name ? (metricItem as any).name : ''}</Text>
             <View style={{ position: 'relative' }}>
                 {
                     (metricItem as any).schemas.map((item, index) => {
@@ -85,6 +92,11 @@ export default function Component(props: { item: any, strTime: string, showPicke
                                                             var dt = JSON.parse(JSON.stringify(metricItem))
                                                             const pre_unit = dt.schemas[index].chosen_unit
                                                             const current_unit = obj.unit
+
+                                                            if (pre_unit == current_unit){
+                                                                setChangeIndex(-1)
+                                                                return
+                                                            }
                                                             var pre_obj: any;
                                                             var current_obj: any;
                                                             dt.schemas[index].unit_options.map(item => {
@@ -161,6 +173,7 @@ export default function Component(props: { item: any, strTime: string, showPicke
                                     special={obj.special ?? null}
                                     themeColor={(metricItem as any).theme_color}
                                     changed={(e) => {
+                                        debugger
                                         item.tempValue = e;
                                         item.tempUnit = obj.unit ? obj.unit : item.default_unit
                                         debugger
@@ -188,6 +201,7 @@ export default function Component(props: { item: any, strTime: string, showPicke
                 </View>
                 <View className='btn_space' />
                 <View className='modal_btn' style={{ backgroundColor: (metricItem as any).theme_color, opacity: enable ? 1 : 0.4 }} onClick={() => {
+                    debugger
                     if (enable) {
                         props.confirm(metricItem)
                     }

+ 44 - 10
src/pages/map/map.tsx

@@ -10,6 +10,7 @@ import { systemLocation } from "@/services/common";
 import { useTranslation } from "react-i18next";
 import showAlert from "@/components/basic/Alert";
 import { kIsAndroid, kIsIOS } from "@/utils/tools";
+import { AtActivityIndicator } from "taro-ui";
 
 // let LeafletView = require('react-native-leaflet-maps').LeafletView
 let location: any = null
@@ -17,15 +18,21 @@ export default function map() {
     // const [location, setLocation] = useState<any>(null)
     const navigation = useNavigation()
     const [current, setCurrent] = useState<any>(null)
-    const [centerLocation, setCenterLocation] = useState(null)
+    const [centerLocation, setCenterLocation] = useState<any>(null)
     const { t } = useTranslation()
     const [show, setShow] = useState(false)
-    const [count, setCount] = useState(0)
+    const [isLoading, setIsLoading] = useState(false)
     const router = useRoute()
 
     useEffect(() => {
-        if ((router.params! as any).lat){
-            debugger
+        if ((router.params! as any).lat) {
+            setCenterLocation({
+                latitude: (router.params! as any).lat,
+                longitude: (router.params! as any).lng
+            })
+        }
+        else {
+            getCurrent()
         }
 
         navigation.setOptions({
@@ -36,7 +43,7 @@ export default function map() {
                 </View>
             }
         });
-        getCurrent()
+        // getCurrent()
     }, [])
 
     function confirmChoose() {
@@ -73,6 +80,7 @@ export default function map() {
     }
 
     function getCurrent() {
+        setIsLoading(true)
         Taro.getLocation({
             success(res) {
                 // showAlert({
@@ -81,13 +89,16 @@ export default function map() {
                 // })
                 setShow(true)
                 setCurrent(res)
+                setCenterLocation(res)
                 location = {
                     lat: (res as any).latitude, lng: (res as any).longitude
                 }
+                setIsLoading(false)
             },
             fail(res) {
                 console.log('location update failed reason', res)
                 if (res.errMsg == 'Permissions denied!') {
+                    setIsLoading(false)
                     showAlert({
                         title: t('feature.auth_sys.location_title'),
                         content: kIsIOS ? t('feature.auth_sys.location_desc') : t('feature.auth_sys.location_android_service_desc'),
@@ -117,8 +128,14 @@ export default function map() {
                             location = {
                                 lat: (res as any).latitude, lng: (res as any).longitude
                             }
+                            setIsLoading(false)
+                        }).catch(e => {
+                            setIsLoading(false)
                         })
                     }
+                    else {
+                        setIsLoading(false)
+                    }
                 }
             }
         })
@@ -130,8 +147,8 @@ export default function map() {
     }
 
     function centerPosition() {
-        if (current) {
-            return { lat: current.latitude, lng: current.longitude }
+        if (centerLocation) {
+            return { lat: centerLocation.latitude, lng: centerLocation.longitude }
         }
         return null
     }
@@ -190,7 +207,16 @@ export default function map() {
         >
             <Image src={require('@/assets/images/center.png')} style={styles.center} />
         </View>
-        <Image src={require('@/assets/images/current_location.png')} onClick={showCurrent} style={styles.location_btn} />
+        <View style={styles.location_btn}>
+            {
+                isLoading ? <View style={{width:20,height:20,overflow:'hidden'}}>
+                    <AtActivityIndicator size={20} color="#000" content="" />
+                </View> :
+                    <Image src={require('@/assets/images/current_location.png')} onClick={showCurrent} style={styles.location_icon} />
+            }
+
+        </View>
+
         {/* <View style={styles.footer}>
             {
                 location && <Text style={{ fontSize: 14, color: '#000' }}>Center位置:lat {(location as any).lat.toFixed(4)} lng {(location as any).lng.toFixed(4)}</Text>
@@ -225,8 +251,16 @@ const styles = StyleSheet.create({
         position: 'absolute',
         left: 40,
         bottom: 80,
-        width: 40,
-        height: 40
+        width: 50,
+        height: 50,
+        alignItems: 'center',
+        justifyContent: 'center',
+        backgroundColor: '#fff',
+        borderRadius: 5
+    },
+    location_icon: {
+        width: 35,
+        height: 35
     },
     footer: {
         position: 'absolute',

Some files were not shown because too many files changed in this diff