phone.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="phone-box">
  3. <block v-for="(item ,index) in telList">
  4. <view class="phone-item-box">
  5. <view class="pnone-headline">
  6. {{item.name}}
  7. </view>
  8. <block v-for="(subItem ,subIndex ) in item.list">
  9. <view class="sub-item">
  10. <view class="sub-item-label">{{subItem.label}}</view>
  11. <view class="sub-item-phone">
  12. <block v-for="(telItem ,telIndex ) in subItem.tel_list">
  13. <view class="phone-item" @click.stop="makingCall(telItem.tel)">
  14. <view class="phone-info">
  15. <text class="phone-num">{{telItem.tel}}</text>
  16. <text class="phone-hint" v-if="telItem.hint">{{telItem.hint}}</text>
  17. </view>
  18. <image v-if="telItem.tel" class="phone-icon" src="../static/phone.png"
  19. mode="aspectFit" />
  20. </view>
  21. </block>
  22. </view>
  23. </view>
  24. </block>
  25. </view>
  26. </block>
  27. </view>
  28. </template>
  29. <script>
  30. import phoneList from "./../json/phone.json"
  31. export default {
  32. data() {
  33. return {
  34. telList: []
  35. }
  36. },
  37. onLoad() {
  38. this.telList = phoneList.pnone || []
  39. console.log('phoneList = ', this.telList)
  40. },
  41. methods: {
  42. makingCall(tel) {
  43. uni.makePhoneCall({
  44. phoneNumber: tel
  45. });
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. $h_num: 50rpx;
  52. .phone-box {
  53. padding: 30rpx;
  54. .phone-item-box {
  55. border-bottom: 1rpx solid #f9f7f7;
  56. padding: 30rpx 0;
  57. }
  58. .pnone-headline {
  59. line-height: 1.2;
  60. padding: 20rpx 0 20rpx 20rpx;
  61. // border-left: 10rpx solid skyblue;
  62. position: relative;
  63. display: flex;
  64. align-items: center;
  65. font-size: 36rpx;
  66. font-weight: 600;
  67. color: #1a1a1a;
  68. &::before {
  69. position: absolute;
  70. left: 0;
  71. top: 50%;
  72. transform: translateY(-50%);
  73. content: '';
  74. width: 10rpx;
  75. height: 60%;
  76. background-color: #3CBACF;
  77. }
  78. }
  79. .sub-item {
  80. width: 100%;
  81. font-size: 28rpx;
  82. padding: 10rpx 0;
  83. display: flex;
  84. .sub-item-label {
  85. flex-shrink: 0;
  86. width: 150rpx;
  87. height: $h_num;
  88. line-height: $h_num;
  89. color: #999999;
  90. }
  91. .sub-item-phone {
  92. width: calc(100% - 150rpx);
  93. color: #3CBACF;
  94. .phone-item {
  95. flex-shrink: 0;
  96. min-width: 51%;
  97. max-width: 100%;
  98. line-height: $h_num;
  99. display: inline-flex;
  100. align-items: center;
  101. flex-wrap: wrap;
  102. .phone-info {
  103. max-width: calc(100% - 40rpx);
  104. text {
  105. margin-right: 20rpx;
  106. }
  107. }
  108. .phone-icon {
  109. width: 40rpx;
  110. height: 40rpx;
  111. }
  112. }
  113. // <view class="phone-item">
  114. // <text class="phone-num">{{telItem.tel}}</text>
  115. // <text class="phone-hint"></text>
  116. // </view>
  117. // <image class="phone-icon" src="../static/phone.png" mode="aspectFit"></image>
  118. }
  119. }
  120. }
  121. </style>