155 lines
3.1 KiB
Vue
155 lines
3.1 KiB
Vue
<template>
|
||
<view class="common">
|
||
<!-- 头部 -->
|
||
<headerIndex :isArea="false"></headerIndex>
|
||
<!-- -->
|
||
<view class="history" v-if="ranklist.length">
|
||
<view class="list" v-for="(item, index) in ranklist" :key="index" @click="clickItemMethod(item.id)">
|
||
<view class="data">
|
||
<icon class="t-icon t-icon-shijian-mianxing-0"></icon>
|
||
{{item.create_time}}
|
||
</view>
|
||
<view class="item">
|
||
<view class="time">
|
||
{{$t("index.infoNowUser")}}{{$t("index.infoAddress")}}:{{item.address}}
|
||
</view>
|
||
<view class="number">
|
||
{{item.score}}
|
||
<uni-icons type="right"></uni-icons>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="endtext" v-if="!lastPage || page >= lastPage">—— {{$t("tips.msgBottom")}} ——</view>
|
||
</view>
|
||
<view class="nolist" v-if="!lastPage">
|
||
<image src="../../static/none.png"></image>
|
||
<text>{{$t("index.none")}}</text>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import headerIndex from "@/element/headerIndex.vue";
|
||
import {
|
||
mapState
|
||
} from "vuex";
|
||
export default {
|
||
computed: {
|
||
...mapState(['user', "appTheme"]),
|
||
},
|
||
data() {
|
||
return {
|
||
page: 1,
|
||
ranklist: [],
|
||
lastPage: "",
|
||
}
|
||
},
|
||
components: {
|
||
headerIndex
|
||
},
|
||
computed: {
|
||
...mapState(["user"]),
|
||
userId() {
|
||
return this.user.id
|
||
}
|
||
},
|
||
onLoad() {
|
||
let that = this
|
||
that.page = 1
|
||
that.getList(1)
|
||
},
|
||
watch: {
|
||
userId() {
|
||
let that = this
|
||
that.page = 1
|
||
that.ranklist = []
|
||
that.getList(1)
|
||
console.log("user变了")
|
||
},
|
||
},
|
||
onReachBottom() {
|
||
let that = this
|
||
console.log("onReachBottom", this.lastPage)
|
||
if (!this.lastPage || this.page >= this.lastPage) {
|
||
uni.showToast({
|
||
title: '没有更多数据!',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
this.page++
|
||
this.getList(this.page)
|
||
},
|
||
methods: {
|
||
clickItemMethod(id) {
|
||
uni.navigateTo({
|
||
url: "/pageTwo/score/report?id=" + id
|
||
})
|
||
},
|
||
getList(page) {
|
||
let that = this
|
||
that.$model.getSportshistory({
|
||
aud_id: uni.getStorageSync('userid'),
|
||
page: page,
|
||
}).then((res) => {
|
||
console.log("历史记录", res)
|
||
if (res.code != 0) return
|
||
this.ranklist = this.ranklist.concat(res.data.rows)
|
||
this.lastPage = res.data.totalpage
|
||
})
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
<style scoped="scoped" lang="scss">
|
||
.common {
|
||
width: 100%;
|
||
min-height: 100.5vh; // 重点
|
||
overflow-y: scroll;
|
||
background-color: #f7f7f7;
|
||
}
|
||
|
||
.history {
|
||
width: calc(100% - 30px);
|
||
height: auto;
|
||
margin: 15px 15px 0;
|
||
padding-bottom: 40px;
|
||
|
||
.list {
|
||
width: 100%;
|
||
border-radius: 10px;
|
||
margin-bottom: 12px;
|
||
|
||
.data {
|
||
width: 100%;
|
||
justify-content: center;
|
||
margin-bottom: 8px;
|
||
display: flex;
|
||
align-items: center;
|
||
font-size: 36rpx;
|
||
|
||
icon {
|
||
width: 40rpx;
|
||
height: 40rpx;
|
||
margin-right: 8px;
|
||
}
|
||
}
|
||
|
||
.item {
|
||
width: calc(100% - 40rpx);
|
||
display: flex;
|
||
justify-content: space-between;
|
||
background: #fff;
|
||
font-weight: 700;
|
||
line-height: 50rpx;
|
||
padding: 10px;
|
||
font-size: 36rpx !important;
|
||
}
|
||
|
||
.time {
|
||
font-size: 32rpx;
|
||
font-weight: 500;
|
||
}
|
||
}
|
||
}
|
||
</style> |