index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="page">
  3. <view class="content" :style="{'height':height}">
  4. <view class="outView flex-col">
  5. <view class="member-head-img flex-row justify-center">
  6. <image class="imageLogo" v-if="selfPhotoUrl" :src="selfPhotoUrl" mode=""></image> <!-- 用户头像 -->
  7. <image class="imageLogo" v-else src="../../static/logo.png" mode=""></image> <!-- 用户头像 -->
  8. </view>
  9. <view class="member-content flex-col">
  10. <view class="user-name flex-row justify-center">
  11. <text>hi.亲爱的{{userInfo.ncikName}}</text>
  12. </view> <!-- 用户名 -->
  13. <!-- <view @click="perfectUserInfo()" class="flex-row justify-center">-->
  14. <!-- <text>你前资料尚不完善,</text>-->
  15. <!-- <text>立即完善</text>-->
  16. <!-- </view>-->
  17. <view class="qrcode flex-row justify-center">
  18. <image class="qrcodeImage" v-if="qrCodeImg" :src="qrCodeImg" mode=""></image> <!-- 二维码图片 -->
  19. <image class="qrcodeImage" v-else src="../../static/index/u41.png" mode=""></image> <!-- 二维码图片 -->
  20. </view>
  21. <view class="qrcode-desc flex-row justify-center">
  22. <text>会员码,分享邀请好友加入</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="tabBarLineHeight"></view>
  28. <view class="tabBarView">
  29. <tab-bar :tabIndex="tabIndex"></tab-bar>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import tabBar from "../../components/tabBar/tabBar";
  35. export default {
  36. components:{
  37. tabBar
  38. },
  39. data() {
  40. return {
  41. height: '',
  42. tabIndex:2,
  43. userInfo:{},
  44. qrCodeImg:'',
  45. selfPhotoUrl:'',
  46. }
  47. },
  48. onLoad() {
  49. // 用户信息
  50. this.userInfo = uni.getStorageSync('userInfo');
  51. let sysInfo = uni.getSystemInfoSync()
  52. this.height = sysInfo.screenHeight - (sysInfo.screenWidth/750)*138 + 'px'
  53. this.getImgUrlByOssId(this.userInfo.selfPhoto, 1)
  54. this.getImgUrlByOssId(this.userInfo.wxQrCode, 2)
  55. },
  56. methods: {
  57. getImgUrlByOssId(ossId, type) {
  58. if (ossId===null){
  59. return
  60. }
  61. this.$api.getImgUrlByOssId({
  62. ossId:ossId,
  63. auth:true
  64. }).then(res=>{
  65. console.log(res)
  66. if (type === 1) {
  67. this.selfPhotoUrl = res.data.data[0].url.replace(/^http:/, "https:");
  68. } else if (type === 2) {
  69. this.qrCodeImg = res.data.data[0].url.replace(/^http:/, "https:");
  70. }
  71. })
  72. },
  73. /* 用户信息 */
  74. perfectUserInfo() {
  75. uni.navigateTo({
  76. url: '/pages/me/user-info',
  77. })
  78. },
  79. }
  80. }
  81. </script>
  82. <style>
  83. @import '/common/css/common.css';
  84. @import './index.rpx.css';
  85. </style>