index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <scroll-view scroll-y class="content">
  3. <div class="user">
  4. <van-cell
  5. center
  6. :value="userInfo.nickName ? userInfo.nickName : '新用户'"
  7. >
  8. <view slot="title">
  9. <image
  10. class="user-headImg"
  11. v-if="userInfo.headImage"
  12. :src="userInfo.headImage"
  13. ></image>
  14. <image class="user-headImg" v-else :src="unLoginHead"></image>
  15. </view>
  16. </van-cell>
  17. <van-cell
  18. title="资料下载"
  19. is-link
  20. @click="goVipPath('/otherPages/pdfList/index')"
  21. center
  22. >
  23. <template #icon>
  24. <m-icon type="fkbz" class="cell-icon" />
  25. </template>
  26. </van-cell>
  27. <!-- <van-cell title="我要提现" value="" is-link center @click="goCashOut">
  28. </van-cell> -->
  29. <!-- <van-cell title="我的下级" value="" is-link center @click="goMyBranch">
  30. <template #icon>
  31. <m-icon type="hyyxq" class="cell-icon" />
  32. </template>
  33. </van-cell> -->
  34. <!-- <van-cell
  35. title="我的推广积分"
  36. value=""
  37. is-link
  38. center
  39. @click="goMyIntegral"
  40. >
  41. </van-cell> -->
  42. <!-- #ifdef MP-WEIXIN -->
  43. <!-- <van-cell
  44. title="会员有效期"
  45. :value="expireTime ? expireTime : '开通会员'"
  46. is-link
  47. center
  48. url="/otherPages/buyVip/index"
  49. >
  50. </van-cell> -->
  51. <!-- #endif -->
  52. <!-- #ifdef MP-TOUTIAO -->
  53. <van-cell
  54. v-if="!isVip"
  55. title="会员有效期"
  56. :value="'开通会员'"
  57. is-link
  58. center
  59. url="/otherPages/buyVip/index"
  60. >
  61. </van-cell>
  62. <van-cell
  63. v-if="isVip"
  64. title="会员有效期"
  65. :value="'已开通'"
  66. is-link
  67. center
  68. >
  69. </van-cell>
  70. <van-cell
  71. title="资料下载"
  72. is-link
  73. @click="goVipPath('/otherPages/pdfList/index')"
  74. center
  75. >
  76. <template #icon>
  77. <m-icon type="fkbz" class="cell-icon" />
  78. </template>
  79. </van-cell>
  80. <!-- #endif -->
  81. <!-- #ifdef MP-WEIXIN -->
  82. <van-cell
  83. title="反馈帮助"
  84. is-link
  85. center
  86. url="/pages/extraWeb/index?src=https://support.qq.com/product/359609"
  87. >
  88. <template #icon>
  89. <m-icon type="fkbz" class="cell-icon" />
  90. </template>
  91. </van-cell>
  92. <!-- #endif -->
  93. </div>
  94. <!-- <view class="ad-box serviceBox">
  95. <ad unit-id="adunit-d8c1548cc9663765"></ad>
  96. </view> -->
  97. </scroll-view>
  98. </template>
  99. <script>
  100. import api from "@/api/index";
  101. import unLoginHead from "@/assets/img/unLoginHead.png";
  102. export default {
  103. computed: {
  104. unLoginHead() {
  105. return unLoginHead;
  106. },
  107. userInfo() {
  108. return this.$store.state.user.userInfo;
  109. },
  110. expireTime() {
  111. return this.$store.state.user.userInfo.expireTime &&
  112. this.$store.getters.isVip
  113. ? this.$store.state.user.userInfo.expireTime.split(" ")[0]
  114. : null;
  115. },
  116. isVip() {
  117. return this.$store.getters.isVip;
  118. },
  119. },
  120. mounted() {
  121. this.$store.dispatch("GetInfo");
  122. },
  123. methods: {
  124. goVipPath(url) {
  125. if (this.isVip) {
  126. uni.navigateTo({
  127. url,
  128. });
  129. } else {
  130. uni.showToast({
  131. title: "vip才能使用",
  132. icon:'none'
  133. });
  134. }
  135. },
  136. getUserProfile(e) {
  137. let that = this;
  138. uni.getUserProfile({
  139. desc: "业务需要",
  140. success(res) {
  141. console.log(res);
  142. api.user
  143. .userInfoUserInfo({
  144. headImage: res.userInfo.avatarUrl,
  145. nickName: res.userInfo.nickName,
  146. })
  147. .then((res) => {
  148. that.$store.dispatch("GetInfo");
  149. });
  150. },
  151. });
  152. // let updateRes = await this.$api.user.updateUserInfo({
  153. // headImage: userInfo.userInfo.avatarUrl,
  154. // nickName: userInfo.userInfo.nickName,
  155. // });
  156. // if (updateRes.code == 200) {
  157. // this.$store.state.user.userInfo.headImage = userInfo.userInfo.avatarUrl;
  158. // this.$store.state.user.userInfo.nickName = userInfo.userInfo.nickName;
  159. // }
  160. },
  161. },
  162. };
  163. </script>
  164. <style lang="scss" scoped>
  165. .user {
  166. background-color: #f2f3f5;
  167. /* height: 100vh; */
  168. .group {
  169. margin: 10px 0;
  170. }
  171. .user-avatar {
  172. width: 46px;
  173. height: 46px;
  174. margin-right: 10px;
  175. }
  176. }
  177. .user-headImg {
  178. width: 90rpx;
  179. height: 90rpx;
  180. border-radius: 50%;
  181. }
  182. .cell-icon {
  183. margin-right: 5px;
  184. }
  185. </style>