<template>
	<view class="content p-rel" :style="{ paddingTop: statusBarHeight + 'px' }">
		<view class="p-rel w">
			<image class="w" style="height: 2800rpx;" src="/static/image/source/yundongjibu.jpg"></image>
			<view class="p-abs zindex-1 text-52 text-b w"
			@click="editNum()"
			:style="{
				top:`${ 480  }rpx`,
				left:'35vw',
			}"
			>{{ num }}</view>
			<view class="p-abs zindex-1 text-24 text-aaa text-500"
			:style="{
				top:`${ 550  }rpx`,
				left:'35vw',
			}">/{{ totalNum }}步</view>
		</view>	
		<up-popup :show="popup" mode="center" :closeOnClickOverlay="true"
		  @close="close" closeable :round="20">
			<view class="h-300 bg-white pd-30 radio-20">
				<view class="text-center text-30">设置步数</view>
				<up-input class="border mgt-30 pdy-30 pdx-20 text-28"
				 type="number" maxlength="6" v-model="inputNum" placeholder="请输入运动步数" />
				<view class="btn_s mgt-30" @click="confirm">提交</view>
			</view>
		</up-popup>
	</view>
</template>

<script setup>
import { ref, onMounted } from "vue";
import { onShow } from "@dcloudio/uni-app";
var statusBarHeight = uni.getStorageSync('statusBarHeight')
const popup = ref(false)
const num = ref(1000)
const totalNum = ref(100000)
const inputNum = ref(null)
// 修改步数
const editNum = ()=>{
	popup.value = true
	inputNum.value = num.value
}
const confirm = ()=>{
	if(num.value < 0){
		uni.showToast({
			title:'请正确输入步数',
			icon:'none'
		})
		return
	}
	num.value = inputNum.value
	close()
	uni.showToast({
		title:'修改成功',
		icon:'none'
	})
}
const close = ()=>{
	popup.value = false
}
// #ifdef MP-WEIXIN
	wx.getWeRunData({
	  success (res) {
	    // 拿 encryptedData 到开发者后台解密开放数据
	    const encryptedData = res.encryptedData
	    // 或拿 cloudID 通过云调用直接获取开放数据
	    const cloudID = res.cloudID
		console.log('encryptedData',encryptedData)
		console.log('cloudID',cloudID)
	  }
	})
// #endif
</script>

<style lang="scss" scoped>
	
</style>