index.vue 2.2 KB

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