Member.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <div class="container">
  3. <!-- 导航栏 -->
  4. <div class="nav-bar">
  5. <div class="back-btn" @click="$router.back()">
  6. <i class="arrow-left"></i>
  7. </div>
  8. <div class="title">我的团队</div>
  9. </div>
  10. <!-- 用户信息卡片 -->
  11. <div class="header-info">
  12. <div class="user-info">
  13. <div class="avatar">
  14. <img src="@/assets/hongqi.png" alt="红旗">
  15. </div>
  16. <div class="account-info">
  17. <div>账号:{{ userInfo.mobile }}</div>
  18. <div class="invite-code">
  19. <span>邀请码:{{ userInfo.salt }}</span>
  20. <button class="copy-btn" @click="copyInviteCode">复制</button>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="title-text">我的团队</div>
  25. <!-- 团队数据 -->
  26. <div class="team-stats">
  27. <div class="stat-item">
  28. <div class="stat-num">{{ userInfo.totleone || 0 }}</div>
  29. <div class="stat-label">一级人数</div>
  30. </div>
  31. <div class="stat-item">
  32. <div class="stat-num">{{ userInfo.totletwo || 0 }}</div>
  33. <div class="stat-label">二级人数</div>
  34. </div>
  35. <div class="stat-item">
  36. <div class="stat-num">{{ userInfo.totlethree || 0 }}</div>
  37. <div class="stat-label">三级人数</div>
  38. </div>
  39. </div>
  40. <!-- 功能列表 -->
  41. <div class="function-list">
  42. <div class="function-item" @click="$router.push('/share')">
  43. <span>邀请好友</span>
  44. </div>
  45. <div class="function-item" @click="$router.push('/team-detail')">
  46. <span>团队明细</span>
  47. </div>
  48. <div class="function-item" @click="$router.push('/asset-center')">
  49. <span>收益记录</span>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import { getUserInfo } from '@/api/home';
  57. import { getBankInfo } from '@/api/profile';
  58. export default {
  59. name: 'Member',
  60. data() {
  61. return {
  62. userInfo: {},
  63. bankInfo: {}
  64. }
  65. },
  66. created() {
  67. this.getUserInfo();
  68. // this.getBankInfo();
  69. },
  70. methods: {
  71. async getUserInfo() {
  72. try {
  73. const res = await getUserInfo();
  74. this.userInfo = res.data;
  75. } catch (error) {
  76. console.error('获取用户信息失败:', error);
  77. }
  78. },
  79. async getBankInfo() {
  80. try {
  81. const res = await getBankInfo();
  82. this.bankInfo = res.data;
  83. } catch (error) {
  84. console.error('获取银行卡信息失败:', error);
  85. }
  86. },
  87. copyInviteCode() {
  88. if (this.userInfo.salt) {
  89. navigator.clipboard.writeText(this.userInfo.salt)
  90. .then(() => {
  91. alert('邀请码已复制');
  92. })
  93. .catch(() => {
  94. alert('复制失败,请手动复制');
  95. });
  96. }
  97. }
  98. }
  99. }
  100. </script>
  101. <style scoped>
  102. .container {
  103. min-height: 100vh;
  104. /* background: url('../assets/dabag.png') no-repeat; */
  105. background-color: #b43a39;
  106. background-size: cover;
  107. background-position: center;
  108. }
  109. .nav-bar {
  110. height: 44px;
  111. background-color: transparent;
  112. color: #fff;
  113. display: flex;
  114. align-items: center;
  115. position: relative;
  116. padding: 0 15px;
  117. }
  118. .back-btn {
  119. width: 24px;
  120. height: 44px;
  121. display: flex;
  122. align-items: center;
  123. cursor: pointer;
  124. }
  125. .arrow-left {
  126. width: 12px;
  127. height: 12px;
  128. border-left: 2px solid #fff;
  129. border-bottom: 2px solid #fff;
  130. transform: rotate(45deg);
  131. }
  132. .title {
  133. position: absolute;
  134. left: 50%;
  135. transform: translateX(-50%);
  136. font-size: 16px;
  137. font-weight: 500;
  138. }
  139. .header-info {
  140. padding: 20px;
  141. color: #fff;
  142. }
  143. .user-info {
  144. display: flex;
  145. align-items: center;
  146. margin-bottom: 30px;
  147. }
  148. .avatar {
  149. width: 60px;
  150. height: 60px;
  151. background: #fff;
  152. border-radius: 50%;
  153. display: flex;
  154. align-items: center;
  155. justify-content: center;
  156. margin-right: 15px;
  157. }
  158. .avatar img {
  159. width: 40px;
  160. height: 40px;
  161. object-fit: contain;
  162. }
  163. .account-info {
  164. flex: 1;
  165. font-size: 14px;
  166. }
  167. .invite-code {
  168. display: flex;
  169. align-items: center;
  170. margin-top: 10px;
  171. justify-content: space-between;
  172. }
  173. .copy-btn {
  174. margin-left: 15px;
  175. padding: 2px 15px;
  176. background: #fff;
  177. border: none;
  178. font-size: 12px;
  179. cursor: pointer;
  180. color: #bb2d5c;
  181. font-weight: bold;
  182. }
  183. .title-text {
  184. font-size: 20px;
  185. font-weight: bold;
  186. text-align: center;
  187. margin: 30px 0;
  188. }
  189. .team-stats {
  190. background: #fff;
  191. border-radius: 8px;
  192. display: flex;
  193. margin-bottom: 20px;
  194. }
  195. .stat-item {
  196. flex: 1;
  197. text-align: center;
  198. padding: 15px 0;
  199. color: #333;
  200. }
  201. .stat-num {
  202. font-size: 20px;
  203. font-weight: bold;
  204. margin-bottom: 5px;
  205. }
  206. .stat-label {
  207. font-size: 14px;
  208. color: #666;
  209. }
  210. .function-list {
  211. background: #fff;
  212. border-radius: 8px;
  213. }
  214. .function-item {
  215. padding: 15px;
  216. border-bottom: 1px solid #eee;
  217. color: #333;
  218. font-size: 14px;
  219. }
  220. .function-item:last-child {
  221. border-bottom: none;
  222. }
  223. </style>