index.vue 4.4 KB

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