usercenter - 副本.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view class="pages">
  3. <view class="myinfo-wrap">
  4. <view class="myinfo">
  5. <view class="myinfo-photo">
  6. <image class="myinfo-photo-img" :src="user.icon" mode=""></image>
  7. </view>
  8. <view class="myinfo-text">
  9. <view class="myinfo-text-name">{{user.nickname || '登录/注册'}}</view>
  10. <view class="myinfo-text-identity">{{usertype}} | {{usercompany}}</view>
  11. </view>
  12. </view>
  13. <view class="myinfo-focus">
  14. <view class="myinfo-focus-item myinfo-focus-myfocus">
  15. <navigator url="/pages/usercenter/myfocus/myfocus">
  16. <view class="number">{{pre.want||0}}</view>
  17. </navigator>
  18. <view class="text">我有意向的</view>
  19. </view>
  20. <view class="myinfo-focus-item myinfo-focus-focusme">
  21. <navigator url="/pages/usercenter/focusme/focusme">
  22. <view class="number">{{pre.own}}</view>
  23. </navigator>
  24. <view class="text">有意向我的</view>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- myinfo-wrap end -->
  29. <view class="wrap">
  30. <navigator url="/pages/usercenter/mypublish/mypublish">
  31. <view class="select-bar">
  32. <svg class="icon select-bar-icon" aria-hidden="true">
  33. <use xlink:href="#iconwodedingdan"></use>
  34. </svg>
  35. <view class="select-bar-text">我的信息发布</view>
  36. <view class="select-bar-arrow"></view>
  37. </view>
  38. </navigator>
  39. <navigator url="/pages/usercenter/authentication/authentication">
  40. <view class="select-bar">
  41. <svg class="icon select-bar-icon" aria-hidden="true">
  42. <use xlink:href="#iconwodetuandui"></use>
  43. </svg>
  44. <view class="select-bar-text">企业认证</view>
  45. <view class="select-bar-arrow"></view>
  46. </view>
  47. </navigator>
  48. <navigator url="/pages/usercenter/feedback/feedback">
  49. <view class="select-bar">
  50. <svg class="icon select-bar-icon" aria-hidden="true">
  51. <use xlink:href="#iconbangzhu"></use>
  52. </svg>
  53. <view class="select-bar-text">帮助反馈</view>
  54. <view class="select-bar-arrow"></view>
  55. </view>
  56. </navigator>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import { mapState, mapMutations } from 'vuex';
  62. export default {
  63. data() {
  64. return {
  65. params:{
  66. token:'',
  67. tokenhead:'',
  68. },
  69. name:'',
  70. usertype:'',
  71. usercompany:'',
  72. myfocus:0,
  73. focusme:1,
  74. pre:[],
  75. user:[],
  76. wxuser:[],
  77. }
  78. },
  79. onShow() {
  80. let serf = this;
  81. //检查登录,获取token
  82. let loginRes = this.checkLogin('/pages/index/index', '2');
  83. // console.log(loginRes);
  84. if(!loginRes){return false;}
  85. serf.params.token=loginRes[0];
  86. },
  87. onLoad() {
  88. // let type=localStorage.getItem("type");
  89. // if(type){
  90. // this.change(type)
  91. // }
  92. // else{
  93. // localStorage.setItem("type",this.type);
  94. // };
  95. console.log('userInfo',this.userInfo,'hasLogin',this.hasLogin);
  96. let self = this;
  97. uni.getStorage({
  98. key:'token',
  99. success: function (res) {
  100. self.params.token = res.data;
  101. // console.log(res.data);
  102. }
  103. });
  104. uni.getStorage({
  105. key:'tokenhead',
  106. success: function (res) {
  107. self.params.tokenhead = res.data;
  108. // console.log(res.data);
  109. }
  110. });
  111. try {
  112. const value = uni.getStorageSync('userInfo');
  113. if (value) {
  114. console.log('this.userinfo',JSON.parse(JSON.stringify(value)));
  115. this.pre = value.pre;
  116. this.user = value.user;
  117. this.wxuser = value.wxUsers;
  118. }
  119. } catch (e) {
  120. window.location.replace(this.config.loginUrl);
  121. };
  122. uni.getStorage({
  123. key:'userInfo',
  124. success: function (res) {
  125. // this.pre = res.data.pre;
  126. // this.user = res.data.user;
  127. // this.wxuser = res.data.wxUsers;
  128. // console.log('res.data',res.data);
  129. // console.log('this.pre',this.pre);
  130. // console.log('this.user',this.user);
  131. // console.log('this.wxuser',this.wxuser);
  132. }
  133. });
  134. //获取会员信息
  135. let thetoken = this.params.tokenhead + this.params.token;
  136. // this.$api.http.get(this.config.apiBaseurl+'/sso/info',{header: {Authorization:thetoken}}).then(res => {
  137. // this.userinfo = res.data.data;
  138. // console.log('this.userinfo',JSON.parse(JSON.stringify(this.userinfo)));
  139. // }).catch(err => {
  140. // });
  141. },
  142. methods: {
  143. },
  144. // computed:{
  145. // ...mapState(['hasLogin','userInfo'])
  146. // }
  147. }
  148. </script>
  149. <style scoped>
  150. @import url("./usercenter.css");
  151. </style>