<template>
<div class="receivable">
<div class="application-header flex-betweenCenter" @click="goBack">
<img
class="prod-header-navImg"
src="../../assets/images/icon_back.png"
alt=""
/>
<div class="font18 hy_color weightBold">登录日志</div>
<div></div>
</div>
<div class="receivable-main">
       <ul class="scroll-box" :style="{ height: clientHeight + 'px' }" v-if="is_number==1" @scroll="handleScroll($event)">
        <li class="log-ul-li" v-for="item in list" :key="item.id">
<div>
<div>{{ item.type }}</div>
<div class="log-color">{{ item.create_time }}</div>
</div>
<div>{{ item.operate }}</div>
</li>
<div class="bottom-tishi">{{loadingText}}</div>
</ul>
<div v-if="is_number == 2">
<div class="emptaype-box">
<img src="../../assets/images/empty_order.png" alt="" />
<p>暂无数据哦!~</p>
</div>
</div>
</div>
<div class="receivable-footer"></div>
</div>
</template>
<script>
import { storage } from "@/utils/storage";
export default {
name: "Receivable",
data() {
return {
is_number: 1,
p: 1,
list: [],
timer: null,
loadingText:'',
clientHeight: null
};
},
created() {this._getUserLoginLog();
this.clientHeight = +document.documentElement.clientHeight -60
},
methods: {
goBack() {
this.$router.go(-1);
},
_getUserLoginLog() {
let data = {
token: this.token,
p: 1,
};
this.$api.getUserLoginLog(data).then((res) => {
if (res.data.length > 0) {
this.list = res.data;
this.is_number = 1;
this.p++
} else {
this.is_number = 2;
}
});
},
handleScroll(e) {
//这里使用个延时加载,不然滑动屏幕的时候会不断触发方法,去计算高度,浪费性能
let that = this
clearTimeout(this.timer)
that.timer = setTimeout(function () {
let clientHeight = e.target.clientHeight;
let scrollTop = e.target.scrollTop;
let scrollHeight = e.target.scrollHeight;
console.log(clientHeight,scrollTop,scrollHeight)
if (clientHeight + scrollTop >= scrollHeight - 10) {
that.getUserLoginLogMeuns()
}
}, 500);
},
getUserLoginLogMeuns() {
this.loadingText = '加载更多'
let data = {
token: this.token,
p: this.p,
};
this.loadingText = '加载中...'
this.$api.getUserLoginLog(data).then((res) => {
if (res.data.length > 0) {
this.list = this.list.concat(res.data)
this.is_number = 1
} else if(res.data.length==0){
this.loadingText = '没有更多了'
}
this.p++
});
},
},
};
</script>

最新文章

  1. VMware的三种网络连接方式区别
  2. Learning Roadmap of Deep Reinforcement Learning
  3. 【原创】开发Kafka通用数据平台中间件
  4. hadoop拾遗(二)---- 文件模式
  5. ArcGIS Engine Style文件操作
  6. AndroidStudio字体主题样式分享
  7. Android短信拦截和电话拦截
  8. opencv在arm和x86在移植
  9. MessageBoxButtons.OKCancel的选择事件
  10. angular $compiler
  11. python用户管理系统
  12. 【webpack系列】从零搭建 webpack4+react 脚手架(一)
  13. c++的虚继承
  14. 【机器学习】主成分分析法 PCA (II)
  15. lombok的使用和原理
  16. 检测三种不同操作系统的Bash脚本
  17. 命令行 设置redis 时间
  18. App爬虫神器mitmproxy和mitmdump的使用
  19. [Machine Learning &amp; Algorithm] 随机森林(Random Forest)-转载
  20. 线性判别分析LDA详解

热门文章

  1. 《Go 精进之路》 读书笔记 (第一次更新)
  2. 中国数字化是怎么转型成新范式TOP 50的?
  3. HDU2196 Computer (树形DP-换根)
  4. 备份 MySQL 的 shell 脚本(mysqldump版本) shell脚本
  5. c语言KMP匹配算法与字符串替换算法
  6. Docker之介绍与安装
  7. 部署redis-cluster
  8. 【Bluetooth|蓝牙开发】二、蓝牙开发入门
  9. 华为开发者大会HDC2022:HMS Core 持续创新,与开发者共创美好数智生活
  10. Codeforces Global Round 23 D.Paths on the Tree(记忆化搜索)