移动端
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

102 lignes
2.5 KiB

  1. <template>
  2. <div class="app-container">
  3. <van-list
  4. v-model="loading"
  5. :finished="finished"
  6. finished-text="没有更多了"
  7. @load="getList"
  8. >
  9. <van-cell v-for="item in phonesList" :key="item.phone">
  10. <span class="nameTit">{{item.name.substr(-2)}}</span>
  11. <p class="nameSize">{{item.name}}{{item.phone}}</p>
  12. <van-icon name="phone-circle" size="30" color="#00BC20" class="icon" @click="callPhone(item.phone)"/>
  13. </van-cell>
  14. </van-list>
  15. <!-- <van-index-bar :index-list="indexList" highlight-color="#1989fa">-->
  16. <!-- <div v-for="(item, index) in indexList" :key="index">-->
  17. <!-- <van-index-anchor :index="item" />-->
  18. <!-- <van-cell v-for="phone in phonesList">-->
  19. <!-- <span class="nameTit">东旭</span>-->
  20. <!-- <p class="nameSize">{{phone.name}}{{phone.phone}}</p>-->
  21. <!-- <van-icon name="phone-circle" size="30" color="#00BC20" class="icon"/>-->
  22. <!-- </van-cell>-->
  23. <!-- </div>-->
  24. <!-- </van-index-bar>-->
  25. </div>
  26. </template>
  27. <script>
  28. import { ListPhones } from "@/api/addressBook/phoneList";
  29. export default {
  30. name: "addressBook",
  31. data() {
  32. return {
  33. // 查询参数
  34. queryParams: {
  35. pageNum: 1,
  36. pageSize: 10,
  37. },
  38. //是否显示加载
  39. loading: false,
  40. //是否滚动到底部
  41. finished: false,
  42. //通讯录列表
  43. phonesList:[],
  44. };
  45. },
  46. created(){
  47. this.getList();
  48. },
  49. methods: {
  50. /** 查询通讯录列表 */
  51. getList(){
  52. this.loading = true;
  53. ListPhones(this.queryParams).then(response => {
  54. console.log(response)
  55. response.rows.forEach(element => {
  56. this.phonesList.push(element);
  57. })
  58. console.log(this.phonesList)
  59. if(this.phonesList.length >= response.total){
  60. this.finished = true;
  61. return;
  62. }
  63. this.queryParams.pageNum += 1 ;
  64. this.loading = false;
  65. });
  66. },
  67. callPhone(phoneNumber){
  68. window.location.href = 'tel://' + phoneNumber;
  69. }
  70. },
  71. };
  72. </script>
  73. <style scoped lang="scss">
  74. .app-container {
  75. }
  76. .van-tag--medium{
  77. padding: 18px 10px;
  78. }
  79. .icon{
  80. position: absolute;
  81. right: 0;
  82. top: 0.05rem;
  83. }
  84. .nameTit{
  85. background: #1989fa;
  86. color: #fff;
  87. width: 1rem;
  88. height: 1rem;
  89. display: inline-block;
  90. text-align: center;
  91. line-height: 1rem;
  92. border-radius: 0.1rem;
  93. margin-right: 0.1rem;
  94. }
  95. .nameSize{
  96. display: inline-block;
  97. line-height: 0.5rem;
  98. }
  99. </style>