team.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <view class="content">
  3. <!-- 头部 -->
  4. <view class="container">
  5. <view class="jiedianbackground">
  6. <image src="../../static/img/jiedian.png" mode=""></image>
  7. </view>
  8. <view class="number-box">
  9. <view class="number">
  10. <text>{{childList.length}}</text>
  11. </view>
  12. <view class="renshu">我的团队人数</view>
  13. </view>
  14. </view>
  15. <view class="message">
  16. <view class="back-box" @click="back()" v-if="id != userInfo.id">
  17. 返回
  18. </view>
  19. <view class="relation-box">
  20. <view class="relation">
  21. <view class="headbox">
  22. <view class="head">
  23. <view class="photo">
  24. <image v-if="avatar" :src="avatar || '/static/error/missing-face.png'"></image>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="information">
  29. <view class="name clamp">{{ name }}</view>
  30. <view class="cell clamp">{{ phone }}</view>
  31. </view>
  32. </view>
  33. <view class="sanchaji">
  34. <image src="../../static/img/sanchaji.png" mode=""></image>
  35. </view>
  36. <view class="subordinate flex">
  37. <view class="subordinate-box" v-for="(item, index) in childList" @click="findChildren(item)">
  38. <view class="head">
  39. <image :src="item.avatar || '/static/error/missing-face.png'" mode=""></image>
  40. </view>
  41. <view class="name clamp">{{ item.nickname }}</view>
  42. <view class="phone clamp">{{ item.mobile }}</view>
  43. </view>
  44. <template v-if="childList.length < 5">
  45. <view class="subordinate-box" v-for="item in (5-childList.length)">
  46. <view class="head"></view>
  47. <view class="name clamp"></view>
  48. <view class="phone clamp"></view>
  49. </view>
  50. </template>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  58. import {
  59. children
  60. } from '@/api/user.js';
  61. import {
  62. mapState,
  63. mapMutations
  64. } from 'vuex';
  65. export default {
  66. components: {
  67. uniPopup
  68. },
  69. data() {
  70. return {
  71. name: '', //当前节点姓名
  72. phone: '', //当前节点手机号
  73. avatar: '', //当前节点头像
  74. id: '',
  75. childList: [], //当前节点的下级
  76. fatherList: []
  77. };
  78. },
  79. computed: {
  80. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  81. },
  82. onLoad() {
  83. console.log(this.userInfo)
  84. this.name = this.userInfo.nickname;
  85. this.phone = this.userInfo.mobile;
  86. this.avatar = this.userInfo.avatar;
  87. this.id = this.userInfo.id
  88. this.loadData();
  89. },
  90. methods: {
  91. //返回
  92. loadData() {
  93. const obj = this;
  94. children({}, this.id).then(({
  95. data
  96. }) => {
  97. this.childList = data
  98. console.log(data)
  99. })
  100. },
  101. async findChildren(item) {
  102. //存father
  103. this.fatherList.push({
  104. name: this.name,
  105. phone: this.phone,
  106. avatar: this.avatar,
  107. id: this.id,
  108. })
  109. //设置新father
  110. this.id = item.id
  111. await this.loadData()
  112. this.name = item.nickname
  113. this.phone = item.mobile
  114. this.avatar = item.avatar
  115. },
  116. back() {
  117. let father = this.fatherList.pop()
  118. this.name = father.name
  119. this.phone = father.phone
  120. this.avatar = father.avatar
  121. this.id = father.id
  122. this.loadData()
  123. }
  124. }
  125. };
  126. </script>
  127. <style lang="scss">
  128. page {
  129. padding: 0;
  130. margin: 0;
  131. height: 100%;
  132. background-color: #000;
  133. }
  134. .container {
  135. width: 750rpx;
  136. height: 400rpx;
  137. position: relative;
  138. .jiedianbackground {
  139. position: absolute;
  140. width: 750rpx;
  141. height: 400rpx;
  142. image {
  143. width: 100%;
  144. height: 100%;
  145. }
  146. }
  147. .number-box {
  148. width: 750rpx;
  149. height: 400rpx;
  150. position: absolute;
  151. display: flex;
  152. justify-content: center;
  153. flex-direction: column;
  154. align-items: center;
  155. .number {
  156. font-size: 30rpx;
  157. font-family: PingFang SC;
  158. font-weight: 500;
  159. color: #fad6b0;
  160. text {
  161. font-size: 72rpx;
  162. font-family: PingFang SC;
  163. font-weight: bold;
  164. line-height: 86rpx;
  165. }
  166. }
  167. .renshu {
  168. font-size: 30rpx;
  169. font-family: PingFang SC;
  170. font-weight: 500;
  171. color: #fad6b0;
  172. }
  173. }
  174. }
  175. .message {
  176. padding: 0 30rpx;
  177. position: relative;
  178. .back-box {
  179. width: 100rpx;
  180. height: 50rpx;
  181. border: 1px solid #fad6b0;
  182. // background-color: red;
  183. position: absolute;
  184. top: 0;
  185. right: 20rpx;
  186. color: #fad6b0;
  187. line-height: 50rpx;
  188. text-align: center;
  189. border-radius: 10rpx;
  190. font-size: 28rpx;
  191. z-index: 9;
  192. }
  193. .relation-box {
  194. margin-top: 100rpx;
  195. display: flex;
  196. flex-direction: column;
  197. align-items: center;
  198. .relation {
  199. position: relative;
  200. display: flex;
  201. align-items: center;
  202. .headbox {
  203. position: absolute;
  204. // width: 154rpx;
  205. // height: 154rpx;
  206. .head {
  207. width: 154rpx;
  208. height: 154rpx;
  209. background: #fff;
  210. box-shadow: 5rpx 0rpx 5rpx 0rpx rgba(110, 171, 78, 0.26);
  211. border-radius: 50%;
  212. overflow: hidden;
  213. .photo {
  214. width: 154rpx;
  215. height: 154rpx;
  216. image {
  217. width: 100%;
  218. height: 100%;
  219. }
  220. }
  221. }
  222. .head-title {
  223. margin: -30rpx 30rpx 0 30rpx;
  224. width: 94rpx;
  225. height: 32rpx;
  226. image {
  227. width: 100%;
  228. height: 100%;
  229. }
  230. }
  231. // .head-name{
  232. // max-width: 100%;
  233. // font-size: 32rpx;
  234. // font-weight: bold;
  235. // color: #333333;
  236. // }
  237. // .head-phone{
  238. // font-size: 26rpx;
  239. // font-weight: 500;
  240. // color: #999999;
  241. // }
  242. }
  243. .information {
  244. margin-left: 77rpx;
  245. display: flex;
  246. padding: 20rpx 10rpx;
  247. flex-direction: column;
  248. width: 297rpx;
  249. height: 137rpx;
  250. background: linear-gradient(90deg, #393326, #27221d);
  251. border: 4rpx solid #fad6b0;
  252. border-radius: 10rpx;
  253. .name {
  254. text-align: left;
  255. margin-left: 70rpx;
  256. font-size: 32rpx;
  257. font-family: PingFang SC;
  258. font-weight: bold;
  259. color: #fad6b0;
  260. }
  261. .cell {
  262. text-align: left;
  263. margin-left: 70rpx;
  264. font-size: 26rpx;
  265. font-family: PingFang SC;
  266. font-weight: 500;
  267. color: #fad6b0;
  268. }
  269. }
  270. }
  271. .sanchaji {
  272. margin: 30rpx 0;
  273. width: 90%;
  274. height: 91rpx;
  275. image {
  276. width: 100%;
  277. height: 100%;
  278. }
  279. }
  280. .subordinate {
  281. width: 750rpx;
  282. display: flex;
  283. justify-content: flex-start;
  284. align-items: flex-start;
  285. .subordinate-box {
  286. flex: 1;
  287. display: flex;
  288. flex-direction: column;
  289. align-items: center;
  290. .head {
  291. border-radius: 50%;
  292. background: #fff;
  293. width: 120rpx;
  294. height: 120rpx;
  295. image {
  296. width: 100%;
  297. height: 100%;
  298. }
  299. }
  300. .name {
  301. max-width: 120rpx;
  302. margin-top: 10rpx;
  303. font-size: 26rpx;
  304. font-family: PingFang SC;
  305. font-weight: bold;
  306. color: #FFFFFF;
  307. }
  308. .phone {
  309. max-width: 120rpx;
  310. margin-top: 10rpx;
  311. font-size: 22rpx;
  312. font-family: PingFang SC;
  313. font-weight: 500;
  314. color: #999999;
  315. }
  316. }
  317. }
  318. }
  319. .back {
  320. float: right;
  321. margin-top: 40rpx;
  322. display: flex;
  323. align-items: center;
  324. justify-content: center;
  325. image {
  326. width: 24rpx;
  327. height: 23rpx;
  328. }
  329. width: 104rpx;
  330. height: 39rpx;
  331. border: 2rpx solid #6eab4e;
  332. border-radius: 7rpx;
  333. font-size: 24rpx;
  334. font-family: PingFang SC;
  335. font-weight: 500;
  336. color: #6eab4e;
  337. }
  338. }
  339. </style>