index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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" :src="selfPhotoUrl || '/static/logo.png'" mode=""></image> <!-- 用户头像 -->
  7. </view>
  8. <view class="member-content flex-col">
  9. <view class="user-name flex-row justify-center">
  10. <text>hi.亲爱的{{userInfo.ncikName}}</text>
  11. </view> <!-- 用户名 -->
  12. <!-- <view @click="perfectUserInfo()" class="flex-row justify-center">-->
  13. <!-- <text>你前资料尚不完善,</text>-->
  14. <!-- <text>立即完善</text>-->
  15. <!-- </view>-->
  16. <view class="qrcode flex-row justify-center">
  17. <!-- <image class="qrcodeImage" v-if="qrCodeImg" :src="qrCodeImg" mode=""></image> &lt;!&ndash; 二维码图片 &ndash;&gt;-->
  18. <!-- <image class="qrcodeImage" v-else src="../../static/index/u41.png" mode=""></image> &lt;!&ndash; 二维码图片 &ndash;&gt;-->
  19. <uv-qrcode ref="qrcode" size="400rpx" :value="qrcodeUrl" :options="options"></uv-qrcode>
  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. qrcodeUrl: 'https://jje.admin.xinyuekj.com.cn/recharge/recharge?scene={shareUserId}',
  47. options: {
  48. // 指定二维码前景,一般可在中间放logo
  49. foregroundImagePadding: 2,
  50. foregroundImageBorderRadius: 5,
  51. foregroundImageSrc: '/static/logo.png'
  52. }
  53. }
  54. },
  55. onLoad() {
  56. // 用户信息
  57. let sysInfo = uni.getSystemInfoSync()
  58. this.height = sysInfo.screenHeight - (sysInfo.screenWidth/750)*138 + 'px'
  59. },
  60. onShow(){
  61. this.userInfo = uni.getStorageSync('userInfo');
  62. // this.getImgUrlByOssId(this.userInfo.selfPhoto, 1)
  63. // this.getImgUrlByOssId(this.userInfo.wxQrCode, 2)
  64. this.createQrCodeUrl()
  65. },
  66. methods: {
  67. createQrCodeUrl(){
  68. let data = {
  69. shareUserId: this.userInfo.id,
  70. };
  71. for (let key in data) {
  72. let regexp = new RegExp("{" + key + "}"); // 构造正则表达式
  73. this.qrcodeUrl = this.qrcodeUrl.replace(regexp, data[key]); // 执行替换操作
  74. }
  75. },
  76. getImgUrlByOssId(ossId, type) {
  77. if (ossId===null){
  78. return
  79. }
  80. this.$api.getImgUrlByOssId({
  81. ossId:ossId,
  82. auth:true
  83. }).then(res=>{
  84. console.log(res)
  85. if (type === 1) {
  86. this.selfPhotoUrl = res.data.data[0].url.replace(/^http:/, "https:");
  87. } else if (type === 2) {
  88. this.qrCodeImg = res.data.data[0].url.replace(/^http:/, "https:");
  89. }
  90. })
  91. },
  92. /* 用户信息 */
  93. perfectUserInfo() {
  94. uni.navigateTo({
  95. url: '/pages/me/user-info',
  96. })
  97. },
  98. }
  99. }
  100. </script>
  101. <style>
  102. @import '/common/css/common.css';
  103. @import './index.rpx.css';
  104. </style>