index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <block>
  3. <view class="item" v-for="(item,index) in list" :key='index' @tap="toPage" :data-id='item.id' data-url='/pages/article/detail'>
  4. <image :src="item.image" mode=""></image>
  5. <view class="">
  6. {{item.title}}
  7. </view>
  8. </view>
  9. </block>
  10. </template>
  11. <script module="parse" lang="wxs">
  12. module.exports = {
  13. filterNum: function(value) {
  14. var value = value + ''
  15. console.log(value)
  16. var card = value.replace(getRegExp('(/^(\d{4})\d+(\d{4})$/)', 'g'), '$1 **** **** $2')
  17. return card
  18. }
  19. }
  20. </script>
  21. <script>
  22. // pages/tabbar/index/index.js
  23. var app = getApp();
  24. export default {
  25. data() {
  26. return {
  27. navIndex: 0,
  28. list: [
  29. // {
  30. // account: "hhD",
  31. // bank_name: "农业银行",
  32. // card_no: "6228481561378773113",
  33. // card_no_end: "3113",
  34. // create_time: "1659088920",
  35. // id: "7",
  36. // is_default: "0",
  37. // status: "1",
  38. // uniacid: "3",
  39. // update_time: "1659088920",
  40. // user_id: "1"
  41. // }
  42. ],
  43. loaded: false,
  44. page: 1,
  45. type: '',
  46. pageSize: 10
  47. };
  48. },
  49. onLoad: function(options) {
  50. },
  51. onShow() {
  52. this.init()
  53. this.getlist();
  54. },
  55. onPullDownRefresh: function() {},
  56. onReachBottom: function() {
  57. this.loaded || this.getlist();
  58. },
  59. onShareAppMessage: function() {},
  60. methods: {
  61. toPage(e) {
  62. app.globalData.toPage(e);
  63. },
  64. init() {
  65. this.page = 1
  66. this.loaded = false
  67. this.list = []
  68. },
  69. async getlist() {
  70. var that = this;
  71. let res = await this.$api.request('/article/index', 'GET', {
  72. page: this.page,
  73. pagesize: this.pageSize
  74. });
  75. console.log(res)
  76. if (res) {
  77. if (res.length > 0) {
  78. this.list = this.list.concat(res);
  79. this.page++;
  80. } else {
  81. this.loaded = true
  82. this.$api.msg('没有更多数据');
  83. }
  84. }
  85. }
  86. }
  87. };
  88. </script>
  89. <style>
  90. page {
  91. background: #F5F5F5;
  92. }
  93. .item {
  94. background: #fff;
  95. border-radius: 12rpx;
  96. overflow: hidden;
  97. margin: 30rpx;
  98. }
  99. .item>view{
  100. width: 100%;
  101. padding: 30rpx 30rpx 50rpx 30rpx;
  102. font-size: 34rpx;
  103. color: #010101;
  104. }
  105. .item>image{
  106. width: 100%;
  107. height: 400rpx;
  108. }
  109. </style>