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

+ 46 - 11
nova-werun/pages/home/sport/sport-start/index.js

@@ -13,18 +13,21 @@ Page({
         contentHeight: 0, // 可用内容高度
         contentHeight2: 0,
         contentpadding: 0, //顶部padding高度
+        navheight: 0,
         //地图
         longitude: 0,
         latitude: 0,
         markers: [],
         //是否暂停
-        isstop:false,
+        isstop: false,
         //标题
-        title:'',
+        title: '',
 
         percentage: '',
         timer: null,
         startTime: 0,
+
+        show: false,
     },
 
     /**
@@ -38,19 +41,19 @@ Page({
         const custom = wx.getMenuButtonBoundingClientRect();
         const customHeight = custom.height + 10 + 2 || 0;
         const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
-
-        const contentpadding = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
-        const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
+        const navheight = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
+        const contentHeight = (screenHeight - bottomNavHeight) * 750 / systemInfo.windowWidth;
         this.setData({
             statusBarHeight,
             screenHeight,
             customHeight,
             bottomNavHeight,
-            contentpadding,
-            contentHeight
+            contentHeight,
+            navheight,
         });
+        console.log(navheight);
         this.setData({
-            title:options.id
+            title: options.id
         })
         //地图
         this.Getlocation()
@@ -169,13 +172,14 @@ Page({
             }
         });
     },
-    stop(){
-       
+    stop() {
+
         this.setData({
-            isstop:!this.data.isstop
+            isstop: !this.data.isstop
         })
         console.log(this.data.isstop);
     },
+    //结束光环展示
     startIncrease() {
         // 记录开始时间
         this.setData({
@@ -198,6 +202,17 @@ Page({
                     percentage: `conic-gradient(from 0deg, #015EEA ${percentage}%, white 0%)`,
                 });
 
+                if(percentage >= 100){
+                    setTimeout(()=>{
+                        wx.showToast({
+                            title: '运动已结束',
+                            icon: 'success',
+                            duration: 500
+                        });
+                    },500)
+                     this.onConfirm()
+                }
+
                 // 如果达到 100%,清除定时器
                 if (percentage >= 100) {
                     clearInterval(this.data.timer);
@@ -226,5 +241,25 @@ Page({
             }
         }
     },
+    //点击返回按钮
+    goback() {
+        this.setData({
+            show: true,
+            isstop: false,
+        })
+    },
+    //取消弹窗
+    onClose() {
+        this.setData({
+            show: false
+        });
+    },
+    //确认返回
+    onConfirm(){
+        wx.navigateBack({
+            delta: 1 // 返回的页面层数,1 表示返回上一页
+          });
+    }
+
 
 })

+ 3 - 1
nova-werun/pages/home/sport/sport-start/index.json

@@ -1,3 +1,5 @@
 {
-  "usingComponents": {}
+  "usingComponents": {
+    "van-dialog": "@vant/weapp/dialog/index"
+  }
 }

+ 35 - 0
nova-werun/pages/home/sport/sport-start/index.less

@@ -3,6 +3,41 @@
     width: 100vw;
     background: linear-gradient(to bottom, #4F9AF7, #FFFFFF); 
     color: #015EEA;
+    .navbox{
+        width: 100vw;
+        display: flex;
+        align-items: flex-end;
+            .nav{
+                width: 100%;
+                display: flex;
+                justify-content: center;
+                position: relative;
+                margin-bottom: 30rpx;
+                height: 40rpx;
+                .nav-addbox{
+                    position: absolute;
+                    left: 0rpx;
+                    top: 8rpx;
+                    font-size: 28rpx;
+                    height: 40rpx;
+                    color: white;
+                    display: flex;
+                    .nav-add{
+                        margin-left: 4rpx;
+    
+                    }
+                }
+                .nav-title{
+                    height: 36rpx;
+                    font-family: MicrosoftYaHei;
+                    font-size: 36rpx;
+                    color: #333333;
+                    line-height: 40rpx;
+                    text-align: center;
+                    font-weight: 600;
+                }
+            }
+        }
     .map{
         width: 100%;
         height: 600rpx;

+ 11 - 1
nova-werun/pages/home/sport/sport-start/index.wxml

@@ -1,6 +1,16 @@
 <!--nova-werun/pages/home/sport/sport-start/index.wxml-->
-<nav type="back" title="{{title}}" background-color="{{'#4F9AF7'}}" front-color="{{'#333333'}}"></nav>
 <view class="all" style="height: {{contentHeight}}rpx;">
+    <view class="navbox" style="height: {{navheight}}rpx;">
+        <view class="nav">
+            <view class="nav-title">{{title}}</view>
+            <view class="nav-addbox" bindtap="goback">
+                <van-icon name="arrow-left" size='44rpx' color='white' />
+            </view>
+        </view>
+    </view>
+    <!-- 确认退出运动 -->
+    <van-dialog title="取消运动" message="确定要退出运动吗?" show="{{ show }}" show-cancel-button bind:close="onClose" bind:confirm='onConfirm'>
+    </van-dialog>
     <view class="map">
         <map class="map" enable-zoom="ture" enable-scroll="ture" id="map" longitude="{{longitude}}" latitude="{{latitude}}" scale="18" markers="{{markers}}"></map>
     </view>

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 1
nova-werun/pages/home/sport/sport-start/index.wxss


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно