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

+ 2 - 1
app.json

@@ -19,7 +19,8 @@
                 "pages/home/sport/sport-start/index",
                 "pages/home/sport/sport-start/index",
                 "pages/home/statistics/index",
                 "pages/home/statistics/index",
                 "pages/home/integral/index",
                 "pages/home/integral/index",
-                "pages/my/my-profile/index"
+                "pages/my/my-profile/index",
+                "pages/home/step/index"
             ]
             ]
         },
         },
         {
         {

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

@@ -470,6 +470,7 @@ Component({
                 }
                 }
             }
             }
         },
         },
+        //修改进度条
         getBackgroundColor() {
         getBackgroundColor() {
             const steps = this.data.sharList[0].steps || 0;
             const steps = this.data.sharList[0].steps || 0;
 
 
@@ -481,6 +482,6 @@ Component({
                 percentage:`conic-gradient(from 0deg, #015EEA ${percentage}%, white 0%)`,
                 percentage:`conic-gradient(from 0deg, #015EEA ${percentage}%, white 0%)`,
             })
             })
             console.log('百分比',this.data.percentage);
             console.log('百分比',this.data.percentage);
-        }
+        },
     }
     }
 })
 })

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

@@ -31,7 +31,7 @@
                 </view>
                 </view>
                 <!--    目标 -->
                 <!--    目标 -->
                 <view class="objbox">
                 <view class="objbox">
-                    <view class="obj1">
+                    <view class="obj1" bindtap="gourl" data-url="../../pages/home/step/index">
                         <view class="boj1-ti">目标步数</view>
                         <view class="boj1-ti">目标步数</view>
                         <view class="obj1-numbox">
                         <view class="obj1-numbox">
                             <image src="https://file-cloud.fmode.cn/qpFbRRSZrO/20241225/s519td033232206.png"></image>
                             <image src="https://file-cloud.fmode.cn/qpFbRRSZrO/20241225/s519td033232206.png"></image>

+ 133 - 0
nova-werun/pages/home/step/index.js

@@ -0,0 +1,133 @@
+// nova-werun/pages/home/step/index.js
+const Parse = getApp().Parse;
+const company = getApp().globalData.company;
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        //屏幕高度
+        statusBarHeight: 0, // 状态栏高度
+        screenHeight: 0, // 屏幕高度
+        customHeight: 0, // 自定义导航栏高度(如小程序右上角胶囊按钮)
+        bottomNavHeight: 0, // 底部导航栏高度
+        contentHeight: 0, // 可用内容高度
+        navheight: 0,
+        radio: '5000',
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        const systemInfo = wx.getSystemInfoSync();
+        const statusBarHeight = systemInfo.statusBarHeight || 0;
+        const screenHeight = systemInfo.screenHeight || 0;
+        const custom = wx.getMenuButtonBoundingClientRect();
+        const customHeight = custom.height + 10 + 2 || 0;
+        const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
+        const navheight = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
+        const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
+        this.setData({
+            statusBarHeight,
+            screenHeight,
+            customHeight,
+            bottomNavHeight,
+            contentHeight,
+            navheight
+        });
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    },
+    //点击返回
+    goback() {
+        // if(!this.data.saveimage){
+        //     let pages = getCurrentPages(); //页面对象
+        //     console.log(pages);
+        //     let prevpage = pages[pages.length - 2]; //上一个页面对象
+        //     console.log(prevpage);
+        //     await prevpage.updateCom()
+        // }
+        wx.navigateBack({
+            delta: 1
+        });
+    },
+    onChange(event) {
+        this.setData({
+            radio: event.detail,
+        });
+        console.log(this.data.radio);
+    },
+    async submit() {
+        const currentUser2 = Parse.User.current();
+        let userquery2 = new Parse.Query('_User');
+        userquery2.equalTo('company', company);
+        userquery2.equalTo('objectId', currentUser2.id);
+        userquery2.notEqualTo('isDeleted', true)
+        let user2 = await userquery2.first();
+        user2.set('num', Number(this.data.radio))
+        try {
+            let saveDate2 = await user2.save();
+            console.log(saveDate2);
+            let pages = getCurrentPages(); //页面对象
+            console.log(pages);
+            let prevpage = pages[pages.length - 2]; //上一个页面对象
+            console.log(prevpage);
+            await prevpage.updateCom2()
+            wx.navigateBack({
+                delta: 1
+            });
+            console.log("目标步数更改成功");
+        } catch (error) {
+            console.error("保存数据时出现错误:", error);
+        }
+    }
+})

+ 7 - 0
nova-werun/pages/home/step/index.json

@@ -0,0 +1,7 @@
+{
+  "usingComponents": {
+    "van-radio": "@vant/weapp/radio/index",
+    "van-radio-group": "@vant/weapp/radio-group/index",
+    "van-divider": "@vant/weapp/divider/index"
+  }
+}

+ 65 - 0
nova-werun/pages/home/step/index.less

@@ -0,0 +1,65 @@
+/* nova-werun/pages/home/step/index.wxss */
+.all{
+    width: 100vw;
+    background: linear-gradient(to bottom, #4F9AF7, #FFFFFF); 
+    .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;
+                }
+            }
+    }
+    .stepbox{
+        width: 100%;
+        height: auto;
+        padding-left: 20rpx;
+        margin-top: 20rpx;
+    }
+    .sumbitbox{
+        width: 100%;
+        height: 60rpx;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        margin-top: 85rpx;
+        .sumbit{
+            width: 200rpx;
+            height: 60rpx;
+            background-color: #4F9AF7;
+            color: white;
+            font-size: 30rpx;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            border-radius: 20rpx;
+        }
+    }
+}

+ 27 - 0
nova-werun/pages/home/step/index.wxml

@@ -0,0 +1,27 @@
+<!--nova-werun/pages/home/step/index.wxml-->
+<view class="all" style="height: {{contentHeight}}rpx;">
+    <view class="navbox" style="height: {{navheight}}rpx;">
+        <view class="nav">
+            <view class="nav-title">目标步数</view>
+            <view class="nav-addbox" bindtap="goback">
+                <van-icon name="arrow-left" size='44rpx' color='white' />
+            </view>
+        </view>
+    </view>
+    <view class="stepbox">
+        <van-radio-group value="{{ radio }}" bind:change="onChange" >
+            <van-radio name="5000">目标步数5000步</van-radio>
+            <view style="margin-top: 10rpx;margin-bottom: 10rpx;width: 100%;height: 2rpx;"></view>
+            <van-radio name="8000">目标步数8000步</van-radio>
+            <view style="margin-top: 10rpx;margin-bottom: 10rpx;width: 100%;height: 2rpx;"></view>
+            <van-radio name="10000">目标步数10000步</van-radio>
+            <view style="margin-top: 10rpx;margin-bottom: 10rpx;width: 100%;height: 2rpx;"></view>
+            <van-radio name="15000">目标步数15000步</van-radio>
+            <view style="margin-top: 10rpx;margin-bottom: 10rpx;width: 100%;height: 2rpx;"></view>
+            <van-radio name="20000">目标步数20000步</van-radio>
+        </van-radio-group>
+    </view>
+    <view class="sumbitbox">
+        <view class="sumbit" bindtap="submit">提交</view>
+    </view>
+</view>

+ 1 - 0
nova-werun/pages/home/step/index.wxss

@@ -0,0 +1 @@
+.all{width:100vw;background:linear-gradient(to bottom, #4F9AF7, #FFFFFF)}.all .navbox{width:100vw;display:flex;align-items:flex-end}.all .navbox .nav{width:100%;display:flex;justify-content:center;position:relative;margin-bottom:30rpx;height:40rpx}.all .navbox .nav .nav-addbox{position:absolute;left:0rpx;top:8rpx;font-size:28rpx;height:40rpx;color:white;display:flex}.all .navbox .nav .nav-addbox .nav-add{margin-left:4rpx}.all .navbox .nav .nav-title{height:36rpx;font-family:MicrosoftYaHei;font-size:36rpx;color:#333333;line-height:40rpx;text-align:center;font-weight:600}.all .stepbox{width:100%;height:auto;padding-left:20rpx;margin-top:20rpx}.all .sumbitbox{width:100%;height:60rpx;display:flex;justify-content:center;align-items:center;margin-top:85rpx}.all .sumbitbox .sumbit{width:200rpx;height:60rpx;background-color:#4F9AF7;color:white;font-size:30rpx;display:flex;justify-content:center;align-items:center;border-radius:20rpx}

+ 8 - 0
nova-werun/pages/index/index.js

@@ -138,6 +138,14 @@ Page({
     }
     }
     componentPage.getcircle2()
     componentPage.getcircle2()
   },
   },
+  updateCom2(){
+    let componentPage = this.selectComponent(`#comp${this.data.active}`)
+    if (!componentPage) {
+      return
+    }
+    componentPage.updatetoday()
+    componentPage.gettarget()
+  },
   /* 服务器是否需要续费 */
   /* 服务器是否需要续费 */
   async getRenew(){
   async getRenew(){
     let query = new Parse.Query("Company")
     let query = new Parse.Query("Company")

+ 6 - 0
project.private.config.json

@@ -81,6 +81,12 @@
                     "pathName": "nova-werun/pages/my/my-profile/index",
                     "pathName": "nova-werun/pages/my/my-profile/index",
                     "query": "",
                     "query": "",
                     "scene": null
                     "scene": null
+                },
+                {
+                    "name": "目标步数",
+                    "pathName": "nova-werun/pages/home/step/index",
+                    "query": "",
+                    "scene": null
                 }
                 }
             ]
             ]
         }
         }