邹能昇 3 сар өмнө
parent
commit
7db2b909f4

+ 16 - 1
nova-werun/components/home/index.js

@@ -21,6 +21,7 @@ Component({
         contentHeight: 0, // 可用内容高度
         contentpadding: 0, //顶部padding高度
         navheight: 0,
+        percentage:0,
         //选择
         rows: [{
                 image: 'https://file-cloud.fmode.cn/qpFbRRSZrO/20241225/r5j1uc041211788.png',
@@ -114,6 +115,7 @@ Component({
             // this.order()
             this.Getlocation()
             this.gettoday()
+            
         },
     },
 
@@ -197,6 +199,7 @@ Component({
             this.setData({
                 sharList
             });
+            this.getBackgroundColor()
             console.log(this.data.sharList);
         },
         //获取当前位置信息
@@ -298,7 +301,7 @@ Component({
             //         }
             //     });
             // });
-            const steps = 33456
+            const steps = 1200
             return steps
         },
         //更新今日步数
@@ -467,5 +470,17 @@ Component({
                 }
             }
         },
+        getBackgroundColor() {
+            const steps = this.data.sharList[0].steps || 0;
+
+            let percentage = (steps / this.data.target) * 100;
+            if (percentage > 100) {
+                percentage = 100;
+            }
+            this.setData({
+                percentage:`conic-gradient(from 0deg, #015EEA ${percentage}%, white 0%)`,
+            })
+            console.log('百分比',this.data.percentage);
+        }
     }
 })

+ 1 - 1
nova-werun/components/home/index.wxml

@@ -23,7 +23,7 @@
         </view>
         <view class="clockinbox">
             <view class="clockinbox2">
-                <view class="runbox">
+                <view class="runbox" style="background:{{percentage}}">
                     <view class="run">
                         <view class="step-num">{{sharList[0].steps||0}}</view>
                         <view class="tody-steps">今日步数</view>