提交 de7655e9 编写于 作者: M m0_74163447

健走记录详情

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