index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view>
  3. <view class="leader-info">
  4. <image src="/static/bed2-bg.png"></image>
  5. <view class="leader-column">
  6. <view>
  7. <!-- <text>晚霞</text><text class="invite">我</text> -->
  8. <text>{{ selfObj.name }}</text>
  9. <text class="mySelf">我</text>
  10. </view>
  11. <view>
  12. <text style="color:#ccc">{{ selfObj.phone }}</text>
  13. <!-- <text style="color:#ccc;font-size: 28rpx;">188****2600</text> -->
  14. </view>
  15. </view>
  16. </view>
  17. <view v-for="(item, index) in teamList" :key="index" @click.stop="showChild(index)">
  18. <view class="leader-info">
  19. <image :src="!arrowFlagList[index] ? '/static/arrow-right3.png' : '/static/arrow-down.png'" class="arrow-style"></image>
  20. <image src="/static/bed2-bg.png"></image>
  21. <view class="leader-column">
  22. <view class="teamLevel-box">
  23. <view style="white-space: nowrap;">{{ item.name }}</view>
  24. <view class="invite">一级分销</view>
  25. </view>
  26. <view>
  27. <text style="color:#ccc;font-size: 28rpx;">{{ item.phone }}</text>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="leader-info" v-show="arrowFlagList[index]" v-for="childItem in item.child" :key="childItem.id">
  32. <image src="/static/arrow-right3.png" class="arrow-style" style="visibility: hidden;"></image>
  33. <image src="/static/bed2-bg.png"></image>
  34. <view class="leader-column">
  35. <view class="teamLevel-box">
  36. <view style="white-space: nowrap;">{{ childItem.name }}</view>
  37. <view class="invited">二级分销</view>
  38. </view>
  39. <view>
  40. <text style="color:#ccc;font-size: 28rpx;">{{ childItem.phone }}</text>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. title: 'selfCenter',
  52. arrowFlagList: [],
  53. selfObj: {},
  54. teamList: [
  55. {
  56. name: '晚霞',
  57. role: '我',
  58. phone: '188****2600',
  59. id: 1
  60. },
  61. {
  62. name: '午霞',
  63. role: '一级分销',
  64. phone: '158****2666',
  65. id: 2,
  66. child: [
  67. {
  68. name: '早霞',
  69. role: '二级分销',
  70. phone: '168****2688',
  71. id: 3
  72. },
  73. {
  74. name: '早霞666',
  75. role: '二级分销',
  76. phone: '168****2688',
  77. id: 656
  78. }
  79. ]
  80. },
  81. {
  82. name: '午霞2',
  83. role: '一级分销',
  84. phone: '158****2666',
  85. id: 4,
  86. child: [
  87. {
  88. name: '早霞2',
  89. role: '二级分销',
  90. phone: '168****2688',
  91. id: 5
  92. }
  93. ]
  94. }
  95. ]
  96. };
  97. },
  98. onLoad() {
  99. this.filterSelf();
  100. },
  101. methods: {
  102. filterSelf() {
  103. let that = this;
  104. let obj = that.teamList.filter((item, index) => {
  105. return item.role === '我';
  106. });
  107. that.selfObj = obj[0];
  108. that.teamList = that.teamList.filter((item, index) => {
  109. return item.role !== '我';
  110. });
  111. for (let i = 0; i < that.teamList.length; i++) {
  112. that.arrowFlagList.push(false);
  113. }
  114. },
  115. showChild(index) {
  116. this.arrowFlagList.splice(index, 1, !this.arrowFlagList[index]);
  117. }
  118. }
  119. };
  120. </script>
  121. <style>
  122. .leader-info {
  123. display: flex;
  124. align-items: center;
  125. background: #fff;
  126. padding: 20rpx;
  127. border-bottom: 1px solid #ccc;
  128. }
  129. .leader-column {
  130. display: flex;
  131. flex-direction: column;
  132. justify-content: space-between;
  133. height: 90rpx;
  134. font-size: 30rpx;
  135. }
  136. .leader-info image {
  137. height: 75rpx;
  138. width: 75rpx;
  139. border-radius: 50%;
  140. border: 1px solid #eee;
  141. margin-right: 3%;
  142. }
  143. .invite {
  144. background: red;
  145. color: #fff;
  146. font-size: 22rpx;
  147. padding: 4rpx;
  148. border-radius: 8rpx;
  149. margin-left: 5%;
  150. width: 50px;
  151. }
  152. .mySelf {
  153. background: orange;
  154. color: #fff;
  155. font-size: 22rpx;
  156. padding: 4rpx;
  157. border-radius: 8rpx;
  158. margin-left: 5%;
  159. width: 50px;
  160. }
  161. .invited {
  162. background: grey;
  163. color: #fff;
  164. font-size: 22rpx;
  165. padding: 4rpx;
  166. border-radius: 8rpx;
  167. margin-left: 5%;
  168. width: 50px;
  169. }
  170. .teamLevel-box {
  171. display: flex;
  172. align-items: center;
  173. }
  174. .arrow-style {
  175. width: 40rpx !important;
  176. height: 40rpx !important;
  177. border: none !important;
  178. }
  179. </style>