index.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view>
  3. <view class="list" v-if="pageList.length>0">
  4. <view class="li ddflex" v-for="(item,index) in pageList" :key="index" @click="jumpUrl(opt.isBusiness ? '/product/home/home?userId='+item.uid : '/topics/home/home?userId='+item.uid)">
  5. <image :src="item.avatar" mode="aspectFill" class="userimg"></image>
  6. <view class="name fflex">{{item.userName}}</view>
  7. <view class="time">{{item.followDate}}</view>
  8. <image src="../../static/pages/images/more.png" class="rico"></image>
  9. </view>
  10. </view>
  11. <view class="nodata" v-else>
  12. <image :src="picUrlss+'empty_jl.png'"></image>
  13. <text>暂无记录</text>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. const app = getApp();
  19. const req = require("../../utils/request.js");
  20. const api = require("../../utils/api.js");
  21. export default {
  22. data() {
  23. return {
  24. picUrlss: req.public.picUrls,
  25. opt: {},
  26. form: {
  27. page: 1,
  28. limit: 10
  29. },
  30. isLoad: true,
  31. pageList: [],
  32. };
  33. },
  34. props: {},
  35. onLoad: async function(options) {
  36. this.opt = options;
  37. this.getPageList();
  38. },
  39. onReachBottom() {
  40. this.form.page++
  41. this.getPageList();
  42. },
  43. methods: {
  44. getPageList(){
  45. if (!this.isLoad) return false;
  46. this.isLoad = false;
  47. let form = this.form;
  48. form.behavior = 1;
  49. form.type = 11;
  50. if(this.opt.userId) form.uid = this.opt.userId;
  51. req.getRequest(api.follow_user_list,form,data=>{
  52. if ( data && data.length >= 10) this.isLoad = true;
  53. if (this.form.page > 1) data = this.pageList.concat(data);
  54. this.pageList = data;
  55. })
  56. },
  57. jumpUrl(url){
  58. uni.navigateTo({
  59. url: url
  60. })
  61. }
  62. }
  63. };
  64. </script>
  65. <style>
  66. @import "./index.css";
  67. </style>