提交 de7655e9 编写于 作者: M m0_74163447

健走记录详情

上级 b74b81e3
......@@ -9,43 +9,37 @@
<script>
export default {
onReady(e) {
uniCloud.callFunction({
onReady() {
if (this.type=='跑步'){
uniCloud.callFunction({
name: 'fe-my-runningDetail',
data: {runningId: this.id}
})
.then(res => {
console.log(res);
uni.$emit('information', {
type: '跑步',
startTime: res.result.data.startTime,
distance: res.result.data.distance,
duration: res.result.data.duration,
pace: res.result.data.pace,
feeling:res.result.data.feeling,
id:this.id
})
.then(res => {
this.getData(res);
});
//this.id = res.result.data.id;
this.polyline[0].points = res.result.data.pathLine;
this.markers[0].latitude = res.result.data.startPoint.latitude;
this.markers[0].longitude = res.result.data.startPoint.longitude;
this.markers[1].latitude = this.polyline[0].points[this.polyline[0].points.length - 1].latitude;
this.markers[1].longitude = this.polyline[0].points[this.polyline[0].points.length - 1].longitude;
// this.markers[1].longitude = res.result.data.endPoint.longitude;
//this.markers[1].latitude = res.result.data.endPoint.latitude;
this.latitude = this.markers[1].latitude;
this.longitude = this.markers[1].longitude;
});
const subNVue = uni.getSubNVueById('popup1'); // 通过 id 获取 nvue 子窗体
subNVue.show('slide-in-top', 250); // 打开 nvue 子窗体
const subNVue = uni.getSubNVueById('popup1'); // 通过 id 获取 nvue 子窗体
subNVue.show('slide-in-top', 250); // 打开 nvue 子窗体
}
else if(this.type=='健走'){
uniCloud.callFunction({
name: 'fe-my-walkingDetail',
data: {walkingId: this.id}
})
.then(res => {
this.getData(res);
});
const subNVue = uni.getSubNVueById('popup1'); // 通过 id 获取 nvue 子窗体
subNVue.show('slide-in-top', 250); // 打开 nvue 子窗体
}
},
data() {
return {
type:',',
id: '',
icon: '/static/sport/icon.jpg',
longitude: '',
......@@ -84,10 +78,34 @@
// delta: 1, //返回层数,2则上上页
// })
},
getData(res){
console.log(res);
uni.$emit('information', {
type: this.type,
startTime: res.result.data.StartDatetime,
distance: res.result.data.distance,
duration: res.result.data.duration,
pace: res.result.data.pace,
feeling:res.result.data.feeling,
id:this.id
});
//this.id = res.result.data.id;
this.polyline[0].points = res.result.data.pathLine;
this.markers[0].latitude = res.result.data.startPoint.latitude;
this.markers[0].longitude = res.result.data.startPoint.longitude;
this.markers[1].latitude = this.polyline[0].points[this.polyline[0].points.length - 1].latitude;
this.markers[1].longitude = this.polyline[0].points[this.polyline[0].points.length - 1].longitude;
// this.markers[1].longitude = res.result.data.endPoint.longitude;
//this.markers[1].latitude = res.result.data.endPoint.latitude;
this.latitude = this.markers[1].latitude;
this.longitude = this.markers[1].longitude;
}
},
onLoad(e){
this.id=e.runningId;
this.id=e.id;
this.type=e.type;
console.log(this.type);
//console.log(this.id);
}
}
......
......@@ -89,9 +89,7 @@
})
.then(res => {
console.log(res);
this.headPortraitIcon=res.result.data.icon;
this.nickname=res.result.data.username;
this.schoolName=res.result.data.school;
this.teamName=res.result.data.team;
//this.activityList=res.result.data.activityList,
......@@ -108,12 +106,15 @@
},
onShow(){
this.headPortraitIcon=getApp().globalData.icon;
this.nickname=getApp().globalData.name;
this.schoolName=getApp().globalData.school;
this.userId=getApp().globalData.userId;
this.getData();
// this.moblie=getApp().globalData.moblie;
// this.gender=getApp().globalData.gender;
console.log(this.userId);
}
}
</script>
......
......@@ -8,7 +8,7 @@
<!-- v-for="(item,index) in allPost" :key="index" -->
<view class="record" v-for="(item,index) in runningrecordList" :key="index" @click="goToDetail(item.runningId)">
<view class="icon">
</view>
<view class="content">
<view class="content1">
......@@ -46,8 +46,13 @@
},
methods: {
goBack() {
uni.navigateBack({
delta: 1, //返回层数,2则上上页
// uni.navigateBack({
// delta: 1, //返回层数,2则上上页
// })
uni.reLaunch({
url: '/pages/my/main',
animationType: 'pop-in',
animationDuration: 300
})
},
goToDetail(runningId) {
......@@ -58,7 +63,7 @@
// })
//uni.setStorageSync('data-to-finish', item)
uni.reLaunch({
url: '/pages/my/finish?runningId=' + runningId +'&type=' + this.type,
url: '/pages/my/finish?id=' + runningId +'&type=' + this.type,
animationType: 'pop-in',
animationDuration: 300
})
......@@ -73,7 +78,7 @@
})
.then(res => {
console.log(res);
//console.log(res);
this.runningrecordList = res.result.data.runningList;
this.runningrecordList.forEach((item, index) => {
......@@ -192,6 +197,9 @@
height: 150rpx;
margin-top: 20rpx;
margin-left: 30rpx;
/* background-size:100% 100%;
background-image:url("/static/my/my-record/run.png");
background-repeat:no-repeat; */
float: left;
}
......
......@@ -44,8 +44,13 @@
showCancel: true, //是否显示取消按钮
success: function (res) {
if (res.confirm) { //confirm为ture,代表用户点击确定
uni.navigateTo({
url: '/pages/login/login'
// uni.navigateTo({
// url: '/pages/login/login'
// })
uni.reLaunch({
url: '/pages/login/login',
animationType: 'pop-in',
animationDuration: 300
})
} else if (res.cancel) { //cancel为ture,代表用户点击取消
......
......@@ -6,28 +6,28 @@
<span class="empty"></span>
</view>
<view class="record" v-for="walkingrecord in walkingrecordList">
<view class="record" v-for="(item,index) in walkingrecordList" :key="index" @click="goToDetail(item.walkingId)">
<view class="icon">
</view>
<view class="content">
<view class="content1">
<view class="distance">
{{walkingrecord.distance.toFixed(2)}}公里
{{item.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}}
{{item.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)}}''
{{parseInt(item.pace/60).toString().padStart(2,0)}}'{{parseInt(item.pace%60).toString().padStart(2,0)}}''
</view>
<image class="pace-icon" :src="'/static/my/my-record/pace.png'"></image>
<view class="date">
{{walkingrecord.startDatetime}}
{{item.startDatetime}}
</view>
</view>
</view>
......@@ -40,32 +40,41 @@
data() {
return {
walkingrecordList: [],
type:'健走',
}
},
methods: {
goBack() {
uni.navigateBack({
delta: 1, //返回层数,2则上上页
uni.reLaunch({
url: '/pages/my/main',
animationType: 'pop-in',
animationDuration: 300
})
},
goToDetail(walkingId) {
uni.reLaunch({
url: '/pages/my/finish?id=' + walkingId +'&type=' + this.type,
animationType: 'pop-in',
animationDuration: 300
})
},
getData() {
// console.log('a');
uniCloud.callFunction({
name: 'fe-my-walkingList',
data: {
userId: '64573dbde766bb00857836fc'
userId: getApp().globalData.userId
}
})
.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);
// });
//console.log(res);
this.walkingrecordList = res.result.data.walkingList;
this.walkingrecordList.forEach((item, index) => {
item.duration = this.formatSeconds(item.duration);
item.startDatetime = this.formatDate(item.startDatetime);
});
});
},
formatDate(value){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册