提交 6f1c12bb 编写于 作者: M m0_74163447

我的界面

上级 0f517b73
......@@ -9,9 +9,9 @@
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"statusbar": {
"immersed": false
},
"statusbar" : {
"immersed" : false
},
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
......@@ -57,6 +57,9 @@
}
}
}
},
"uniStatistics" : {
"enable" : true
}
},
/* 快应用特有相关 */
......@@ -79,8 +82,8 @@
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
"enable" : false,
"version" : "2"
},
"vueVersion" : "2"
}
<template>
<view class="main">
<view class="top">
<image @click="goBack" class="back" :src="'/static/my/exit-icon.png'"></image>
<view class="title">健走记录</view>
<span class="empty"></span>
</view>
<view class="record" v-for="walkingrecord in walkingrecordList">
<view class="icon">
</view>
<view class="content">
<view class="content1">
<view class="distance">
{{walkingrecord.distance.toFixed(2)}}公里
</view>
<image class="type-icon" :src="'/static/my/my-record/walking.png/'"></image>
</view>
<view class="content2">
<view class="duration">
{{walkingrecord.duration}}
</view>
<image class="duration-icon" :src="'/static/my/my-record/duration.png'"></image>
<view class="pace">
{{parseInt(walkingrecord.pace/60).toString().padStart(2,0)}}'{{parseInt(walkingrecord.pace%60).toString().padStart(2,0)}}''
</view>
<image class="pace-icon" :src="'/static/my/my-record/pace.png'"></image>
<view class="date">
{{walkingrecord.startDatetime}}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
walkingrecordList: [],
}
},
methods: {
goBack() {
uni.navigateBack({
delta: 1, //返回层数,2则上上页
})
},
getData() {
uniCloud.callFunction({
name: 'fe-my-walkingList',
data: {
userId: '644a643a0c801ca878983559'
}
})
.then(res => {
console.log(res);
this.walkingrecordList = res.result.data.walkingList;
this.walkingrecordList.forEach((item, index) => {
item.duration = this.formatSeconds(item.duration);
//item.pace = this.formatPace(item.pace);
item.startDatetime = this.formatDate(item.startDatetime);
});
});
},
formatDate(value){
const str = value + ''; //转成字符串
let arr = str.split(' ');
return arr[0];
},
formatSeconds(value) {
var secondTime = parseInt(value); // 秒
var minuteTime = 0; // 分
var hourTime = 0; // 小时
var result = "";
if (secondTime > 60) { //如果秒数大于60,将秒数转换成整数
//获取分钟,除以60取整数,得到整数分钟
minuteTime = parseInt(secondTime / 60);
//获取秒数,秒数取佘,得到整数秒数
secondTime = parseInt(secondTime % 60);
//如果分钟大于60,将分钟转换成小时
if (minuteTime > 60) {
//获取小时,获取分钟除以60,得到整数小时
hourTime = parseInt(minuteTime / 60);
//获取小时后取佘的分,获取分钟除以60取佘的分
minuteTime = parseInt(minuteTime % 60);
}
}
//var result = "" + parseInt(secondTime) + "";
if (secondTime >= 10) {
result = "" + parseInt(secondTime) + "";
} else {
result = "0" + parseInt(secondTime) + "";
}
if (minuteTime >= 10) {
result = "" + parseInt(minuteTime) + ":" + result;
} else {
result = "0" + parseInt(minuteTime) + ":" + result;
}
if (hourTime >= 10) {
result = "" + parseInt(hourTime) + ":" + result;
} else {
result = "0" + parseInt(hourTime) + ":" + result;
}
return result;
},
onLoad() {
plus.navigator.setStatusBarBackground('#EDEEF0');
this.getData();
}
}
}
</script>
<style>
.main {
position: absolute;
width: 100%;
height: 100%;
/* background-color: #EDEEF0; */
}
.top {
width: 100%;
height: 50px;
background-color: #EDEEF0;
text-align: center;
}
.back {
width: 40px;
height: 30px;
margin-top: 10px;
margin-bottom: 10px;
float: left;
margin-left: 10px;
}
.empty {
width: 40px;
height: 30px;
margin-top: 10px;
margin-bottom: 10px;
float: right;
margin-right: 10px;
}
.title {
font-size: 20px;
margin-top: 10px;
font-weight: bold;
color: #f1992d;
display: inline-block;
}
.record {
border-bottom: 2rpx solid #EDEEF0;
width: 100%;
height: 200rpx;
/* display: flex;
flex-direction: row; */
}
.icon {
border: 2rpx solid #EDEEF0;
width: 150rpx;
height: 150rpx;
margin-top: 20rpx;
margin-left: 30rpx;
float: left;
}
.content {
width: 72%;
height: 100%;
/* margin: 10rpx 0 10rpx 30rpx; */
float: right;
}
.content1 {
height: 50%;
}
.distance {
width: 70%;
font-weight: bold;
font-size: 65rpx;
margin-top: 15rpx;
float: left;
}
.type-icon {
float: right;
margin-top: 50rpx;
margin-right: 70rpx;
width: 50rpx;
height: 50rpx;
}
.content2 {
margin-top: 20rpx;
display: flex;
flex-direction: row;
font-size: 25rpx;
}
.duration {}
.duration-icon {
width: 35rpx;
height: 35rpx;
}
.pace {
margin-left: 60rpx;
}
.pace-icon {
width: 35rpx;
height: 35rpx;
}
.date {
margin-left: 90rpx;
}
</style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册