cardList.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="cardList">
  3. <uni-menubar title="名片夹" />
  4. <view>
  5. <tm-search v-model="params.keyword" placeholder="请输入名称或手机号" insert-color="blue" @confirm="searchCardList"
  6. color="white" :show-right="false" :round="20">
  7. </tm-search>
  8. </view>
  9. <view>
  10. <tm-translate animation-name="fadeUp">
  11. <view v-for="(item,index) in cardList" :key="index">
  12. <tm-sheet color="bg-gradient-blue-accent">
  13. <view class="cardRow">
  14. <view class="flexLeft">
  15. <tm-avatar size="120" titl :round="5" :src="item.picture">
  16. </tm-avatar>
  17. </view>
  18. <view class="flexRight">
  19. <view class="nameRow">
  20. <view class="name">{{item.name}}</view>
  21. <view @click="goCardDetail(item.id)">进入名片主页 <tm-icons color="gray"
  22. name="icon-angle-right" :size="20"></tm-icons>
  23. </view>
  24. </view>
  25. <view class="post">{{item.title}}</view>
  26. </view>
  27. </view>
  28. <view style="margin-top: 15px;">
  29. <view class="span">
  30. 公司:{{item.company}}
  31. </view>
  32. <view class="span">
  33. 微信号:{{item.wx}}
  34. </view>
  35. <view class="span">
  36. 手机号:{{item.mobile}}
  37. </view>
  38. </view>
  39. </tm-sheet>
  40. </view>
  41. </tm-translate>
  42. </view>
  43. <uni-tabBar />
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. params: {
  51. page: 1,
  52. keyword: ""
  53. },
  54. cardList: []
  55. }
  56. },
  57. onLoad() {
  58. this.getCardList()
  59. },
  60. onReachBottom(e) {
  61. this.params.page++
  62. this.$tm.request.post('card/addressbook', this.params).then(res => {
  63. if (res.data.length > 0) {
  64. res.data.forEach(val => {
  65. this.cardList.push(val)
  66. })
  67. }
  68. })
  69. },
  70. methods: {
  71. searchCardList() {
  72. this.params.page = 1
  73. this.getCardList()
  74. },
  75. getCardList() {
  76. this.$tm.request.post('card/addressbook', this.params).then(res => {
  77. this.cardList = res.data
  78. })
  79. },
  80. goCardDetail(card_id) {
  81. uni.navigateTo({
  82. url: '/pages/cardList/cardDetail?card_id=' + card_id
  83. })
  84. }
  85. }
  86. }
  87. </script>
  88. <style lang="scss">
  89. .cardRow {
  90. display: flex;
  91. flex-direction: row;
  92. // justify-content: center;
  93. // align-items: center;
  94. .flexLeft {
  95. margin-right: 15px;
  96. }
  97. .flexRight {
  98. flex: 1;
  99. .nameRow {
  100. display: flex;
  101. flex-direction: row;
  102. justify-content: space-between;
  103. align-items: center;
  104. font-size: 22rpx;
  105. // color: #9E9E9E;
  106. .name {
  107. // color: #000;
  108. font-size: 34rpx;
  109. // font-weight: bold;
  110. }
  111. }
  112. .post {
  113. font-size: 32rpx;
  114. // color: #9E9E9E;
  115. margin-top: 20rpx;
  116. }
  117. }
  118. }
  119. .span {
  120. // color: #2196F3;
  121. font-size: 28rpx;
  122. margin-top: 10rpx;
  123. }
  124. </style>