mine.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <!-- 我的 -->
  3. <view class="mine">
  4. <!-- 头部个人信息 -->
  5. <view class="mine-top">
  6. <image class="header-img" :src="userInformation.avatar" alt="" />
  7. <view class="user-info">
  8. <view class="name">{{ userInformation.nickname }}</view>
  9. <text class="user-id">ID:{{ userInformation.id }}</text>
  10. </view>
  11. <view v-if="isTeam" class="user-home" @click="toHome"
  12. >{{ i18n.homepage }} <text class="home-right"></text>
  13. </view>
  14. </view>
  15. <!-- 头部个人信息 -->
  16. <!-- 余额组件 -->
  17. <MineMoney :isTeam="isTeam" :userInformation="userInformation" />
  18. <!-- 余额组件 -->
  19. <!-- 商城订单 -->
  20. <MallOrderForm />
  21. <!-- 商城订单 -->
  22. <!-- 团长功能组件 -->
  23. <TeamFunction v-if="userInformation.merchant" />
  24. <!-- 团长功能组件 -->
  25. <!-- 非团长组件 -->
  26. <PersonalFunction v-else />
  27. <!-- 底部tab栏 -->
  28. <kj-tabbar :value1="4"></kj-tabbar>
  29. <!-- 底部tab栏 -->
  30. </view>
  31. </template>
  32. <script>
  33. import MineMoney from "./component/mineMoney.vue";
  34. import MallOrderForm from "./component/mallOrderForm.vue";
  35. import TeamFunction from "./component/teamFunction.vue";
  36. import PersonalFunction from "./component/personalFunction.vue";
  37. export default {
  38. components: {
  39. MineMoney,
  40. MallOrderForm,
  41. TeamFunction,
  42. PersonalFunction,
  43. },
  44. computed: {
  45. i18n() {
  46. return this.$t("index");
  47. },
  48. },
  49. data() {
  50. return {
  51. isTeam: true, //用来判断当前用户是不是团长
  52. userInformation: {},
  53. };
  54. },
  55. methods: {
  56. toHome() {
  57. uni.navigateTo({
  58. url: "/pageD/homepage/homepage?page=false",
  59. });
  60. },
  61. getUserInfo() {
  62. uni.$u.http.get(`/api/member/info`).then((res) => {
  63. this.userInformation = res;
  64. uni.setStorage({
  65. key: "user_info",
  66. data: this.userInformation,
  67. });
  68. });
  69. },
  70. },
  71. created() {
  72. //设置顶部标题栏颜色
  73. uni.setNavigationBarColor({
  74. frontColor: "#ffffff",
  75. backgroundColor: "#f4f4f4",
  76. });
  77. this.getUserInfo();
  78. },
  79. };
  80. </script>
  81. <style lang="scss">
  82. .mine {
  83. padding-left: 10px;
  84. background-color: #f4f4f4;
  85. padding-right: 10px;
  86. position: relative;
  87. }
  88. .mine-top {
  89. display: flex;
  90. align-items: center;
  91. .header-img {
  92. height: 54px;
  93. width: 54px;
  94. border-radius: 50%;
  95. margin-right: 10px;
  96. }
  97. .user-info {
  98. .name {
  99. margin-bottom: 4px;
  100. color: #222;
  101. font-size: 18px;
  102. font-weight: 600;
  103. }
  104. .user-id {
  105. font-size: 12px;
  106. color: #333;
  107. }
  108. }
  109. .user-home {
  110. position: absolute;
  111. right: 0;
  112. min-width: 72px;
  113. height: 28px;
  114. background-color: #eee;
  115. text-align: center;
  116. font-size: 13px;
  117. font-size: #333;
  118. line-height: 28px;
  119. border-radius: 14px 0 0 14px;
  120. .home-right {
  121. display: inline-block;
  122. width: 10px;
  123. height: 10px;
  124. background-image: url("../../static/mine/right.png");
  125. background-size: 100% 100%;
  126. background-repeat: no-repeat;
  127. // margin-right: 4px;
  128. }
  129. }
  130. }
  131. </style>