提交 f4be6b0b 编写于 作者: Y yyt

图标及细节修改

上级 612d360d
<template>
<view class="content">
<map id="myMap" style="width: 100%; height: 780px;" :latitude="latitude" :longitude="longitude"
:markers="markers" :polyline="polyline" show-location="true" scale="16">
:markers="markers" :polyline="polyline" show-location="true" scale="20">
<cover-image class="returnBack" src="/static/login/returnBack.png" @click="goBack()"></cover-image>
</map>
</view>
......@@ -11,7 +11,7 @@
export default {
onReady() {
//传从运动界面传数据过来
var data = uni.getStorageSync('info')
var data = uni.getStorageSync('data-to-finish')
var res = JSON.parse(data)
this.id = res.id;
this.polyline = res.polyline;
......@@ -37,18 +37,19 @@
icon: '/static/sport/icon.jpg',
longitude: 121.44820869,
latitude: 37.48330837,
scale: 16,
polyline: [],
markers: [{
id: 0,
longitude: 121.44577861,
latitude: 37.48205260,
iconPath: '/static/sport/location.png'
iconPath: '/static/sport/marker1.png'
},
{
id: 1,
longitude: 121.44820869,
latitude: 37.48330837,
iconPath: '/static/sport/location.png'
iconPath: '/static/sport/marker2.png'
}
]
}
......
<template>
<view class="content">
<view class="type-select">
<uni-data-select custom-class="type" v-model="type" :localdata="range" :clear="false"
<uni-data-select custom-class="type" v-model="info.type" :localdata="range" :clear="false"
@change="change"></uni-data-select>
</view>
<view class="accumulate">
<view class="block1">
<ul>
<li>累计{{type}}</li>
<li>累计{{info.type}}</li>
</ul>
<view class="dis">
<view class="distance">{{distance.toFixed(2)}}</view>
<view class="distance">{{info.distance.toFixed(2)}}</view>
<view class="km">公里</view>
</view>
</view>
......@@ -18,7 +18,7 @@
<ul>
<li>本校累计排名</li>
</ul>
<view class="rank">{{rank}}</view>
<view class="rank">{{info.rank}}</view>
</view>
</view>
<image class="start-button" src="/static/sport/start1.png" @click="start"></image>
......@@ -31,7 +31,11 @@
data() {
return {
userId: '644a643a0c801ca878983559',
type: '跑步',
info: {
type: '跑步',
distance: 0,
rank: 1
},
range: [{
value: '跑步',
text: '跑步'
......@@ -40,39 +44,33 @@
value: '健走',
text: '健走'
}
],
distance: 0,
rank: 1
]
};
},
methods: {
change(e) {
change() {
uniCloud.callFunction({
name: 'fe-sport-index',
data: {
userId: this.userId,
type: this.type
type: this.info.type
}
})
.then(res => {
console.log(res)
this.distance = res.result.data.totalRunningDistance
this.rank = res.result.data.totalRunningRank
this.info.distance = res.result.data.totalRunningDistance
this.info.rank = res.result.data.totalRunningRank
});
},
click() {
if (this.type === '跑步') {
uni.navigateTo({
url: './ranking?type=跑步'
})
} else {
uni.navigateTo({
url: './ranking?type=健走'
})
}
let item = JSON.stringify(this.info)
uni.setStorageSync('data-to-ranking', item)
uni.navigateTo({
url: './ranking'
})
},
start() {
if (this.type === '跑步') {
if (this.info.type === '跑步') {
uni.navigateTo({
url: './ready?type=跑步'
})
......
......@@ -10,7 +10,7 @@
<image class="icon" :src="item.icon"></image>
<view class="info">
<view class="username">{{item.username}}</view>
<view class="distance">{{item.distance}}km</view>
<view class="distance">{{item.distance.toFixed(2)}}km</view>
</view>
</view>
<view class="my">
......@@ -18,7 +18,7 @@
<image class="icon" :src="icon"></image>
<view class="info">
<view class="username">{{username}}</view>
<view class="distance">{{distance}}km</view>
<view class="distance">{{distance.toFixed(2)}}km</view>
</view>
</view>
</view>
......@@ -30,9 +30,10 @@
return {
userId: '644a643a0c801ca878983559',
rank: 1,
distance: 99.99,
type: '',
icon: '/static/sport/icon.jpg',
username: "不会取名字",
distance: 99.99,
userList: []
}
},
......@@ -45,9 +46,14 @@
});
}
},
onLoad(option) {
onReady() {
var data = uni.getStorageSync('data-to-ranking')
var res = JSON.parse(data)
this.type = res.type
this.rank = res.rank
this.distance = res.distance
var url
if (option.type === '跑步') {
if (this.type === '跑步') {
url = 'fe-sport-run-rank'
} else {
url = 'fe-sport-walk-rank'
......
<template>
<view class="content">
<map id="myMap" style="width: 100%; height: 780px;" :latitude="latitude" :longitude="longitude"
:markers="markers" show-location="true" :scale="16">
:markers="markers" show-location="true" :scale="18">
<cover-image class="returnBack" src="/static/login/returnBack.png" @click="goBack()"></cover-image>
<cover-image class="start-button" src="/static/sport/start1.png" @click="start"></cover-image>
</map>
......@@ -97,27 +97,10 @@
id: 1,
latitude: res.latitude,
longitude: res.longitude,
iconPath: '/static/sport/location.png'
iconPath: '/static/sport/marker1.png'
}]
}
});
},
toLocation: function(obj) {
// 改变地图中心位置
mapCtx.moveToLocation(obj)
// 移动标记点并添加动画效果
mapCtx.translateMarker({
markerId: 1,
autoRotate: true,
duration: 100,
destination: {
latitude: obj.latitude,
longitude: obj.longitude,
},
animationEnd() {
console.log('animation end')
}
})
}
}
}
......
......@@ -99,7 +99,7 @@
icon: 'success'
})
let item = JSON.stringify(this.info)
uni.setStorageSync('info', item)
uni.setStorageSync('data-to-finish', item)
uni.reLaunch({
url: '/pages/sport/finish',
animationType: 'pop-in',
......
......@@ -89,13 +89,24 @@
uniCloud.callFunction({
name: 'fe-sport-feeling',
data: {
userId: this.id,
id: this.id,
type: this.type,
feeling: this.feeling
}
})
.then(res => {
console.log(res)
if (res.code === 200) {
uni.showToast({
title: '运动感受保存成功',
icon: 'success'
})
} else {
uni.showToast({
title: '运动感受保存失败',
icon: 'error'
})
}
this.choose = false
})
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册