裂变星小程序-25.03.04
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
2.9 KiB

  1. <template>
  2. <view class="page">
  3. <navbar leftClick @leftClick="$utils.navigateBack" />
  4. <view class="content">
  5. <image class="avatar" :src="detail.avatarUrl"></image>
  6. <text class="nick-name">{{ detail.nickName }}</text>
  7. <template v-if="isLocked">
  8. <button class="btn" type="success" @click="openPopup">添加</button>
  9. </template>
  10. <template v-else>
  11. <image class="qr" :src="detail.qrCode" :show-menu-by-longpress="true"></image>
  12. </template>
  13. </view>
  14. <popupUnlock ref="popupUnlock" src="../static/sharing/unlock-user.png"></popupUnlock>
  15. </view>
  16. </template>
  17. <script>
  18. import popupUnlock from '../components/popupUnlock.vue'
  19. export default {
  20. components: {
  21. popupUnlock,
  22. },
  23. data() {
  24. return {
  25. detail: {
  26. id: null,
  27. avatarUrl: null,
  28. nickName: null,
  29. imageUrl: null,
  30. times: 10,
  31. qrCode: null,
  32. description: null,
  33. },
  34. isLocked: true,
  35. }
  36. },
  37. onLoad(option) {
  38. console.log('--option', option)
  39. const { id } = option
  40. this.fetchSharingDetail(id)
  41. },
  42. onShareAppMessage(res) {
  43. const {
  44. description,
  45. imageUrl,
  46. } = this.detail
  47. // todo: check
  48. let o = {
  49. title : description,
  50. imageUrl: imageUrl,
  51. // path: `/pages_order/sharing/personal?id=${this.detail.id}`
  52. query: `id=${this.detail.id}`,
  53. }
  54. // todo: check callback? settimeout?
  55. // todo: get times and check is unlocked
  56. this.isLocked = false
  57. return o
  58. },
  59. methods: {
  60. async fetchSharingDetail(id) {
  61. // todo: init data by id
  62. this.detail = {
  63. id: '001',
  64. avatarUrl: '../static/temp-avator.png',
  65. nickName: '裂变星官方指导客服',
  66. imageUrl: 'http://gips3.baidu.com/it/u=70459541,3412285454&fm=3028&app=3028&f=JPEG&fmt=auto?w=960&h=1280',
  67. times: 10,
  68. qrCode: '../static/temp-qrcode.png',
  69. // title: '裂变星轻松获客',
  70. description: '如此好用的赚钱项目,赶快加入吧!',
  71. auditStatus: 2,
  72. createTime: '2025年2月1日',
  73. state: -1,
  74. }
  75. },
  76. openPopup() {
  77. this.$refs.popupUnlock.open();
  78. },
  79. },
  80. }
  81. </script>
  82. <style scoped lang="scss">
  83. .page {
  84. position: relative;
  85. height: 100vh;
  86. }
  87. .content {
  88. display: flex;
  89. flex-direction: column;
  90. align-items: center;
  91. }
  92. .avatar {
  93. width: 180rpx;
  94. height: 180rpx;
  95. margin-top: 127rpx;
  96. }
  97. .nick-name {
  98. color: #1B1B1B;
  99. font-size: 32rpx;
  100. margin-top: 30rpx;
  101. }
  102. .btn, .qr {
  103. position: absolute;
  104. }
  105. .btn {
  106. width: calc(100% - 60rpx*2);
  107. height: auto;
  108. left: 60rpx;
  109. bottom: 292rpx;
  110. background-color: #07C160;
  111. border: none;
  112. color: #FFFFFF;
  113. font-size: 28rpx;
  114. line-height: 1;
  115. border-radius: 45rpx;
  116. padding: 25rpx 0;
  117. box-sizing: border-box;
  118. }
  119. .qr {
  120. width: 350rpx;
  121. height: 350rpx;
  122. bottom: 269rpx;
  123. }
  124. </style>