follow.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <!-- 关注公众号 -->
  3. <view v-show="!isSortType">
  4. <!-- #ifdef H5 -->
  5. <view class="follow acea-row row-between-wrapper" :style="'background:' + bgColor + ';margin-top:' + mbConfig + 'rpx;'" v-if='subscribe === false'>
  6. <view class="picTxt acea-row row-middle">
  7. <view class="pictrue"><image :src="imgConfig"></image></view>
  8. <view class="name line1">{{ titleConfig }}<slot name="left"></slot></view>
  9. </view>
  10. <view class="notes acea-row row-center-wrapper" :style="'color:' + themeColor + ';border-color:' + themeColor + ';'" @click="followTap">关注</view>
  11. </view>
  12. <view class="followCode" v-if="followCode">
  13. <view class="pictrue">
  14. <view class="code-bg"><img class="imgs" :src="followUrl" /></view>
  15. </view>
  16. <view class="mask" @click="closeFollowCode"></view>
  17. </view>
  18. <!-- #endif -->
  19. </view>
  20. </template>
  21. <script>
  22. // #ifdef H5
  23. import {
  24. follow
  25. } from '@/api/api.js';
  26. import {
  27. getSubscribe
  28. } from '@/api/public';
  29. export default {
  30. name: 'follow',
  31. props: {
  32. dataConfig: {
  33. type: Object,
  34. default: () => {}
  35. },
  36. isSortType:{
  37. type: String | Number,
  38. default:0
  39. }
  40. },
  41. data() {
  42. return {
  43. followCode: false,
  44. followUrl:this.dataConfig.codeConfig?this.dataConfig.codeConfig.url : '',
  45. bgColor:this.dataConfig.bgColor.color[0].item,
  46. imgConfig:this.dataConfig.imgConfig.url,
  47. mbConfig:this.dataConfig.mbConfig.val,
  48. themeColor:this.dataConfig.themeColor.color[0].item,
  49. titleConfig:this.dataConfig.titleConfig.value,
  50. subscribe:false
  51. };
  52. },
  53. created() {},
  54. mounted() {
  55. getSubscribe().then(res => {
  56. this.subscribe = res.data.subscribe || false;
  57. }).catch(() => {})
  58. },
  59. methods: {
  60. followTap(){
  61. this.followCode = true;
  62. // this.getFollow();
  63. },
  64. closeFollowCode(){
  65. this.followCode = false
  66. },
  67. }
  68. }
  69. // #endif
  70. </script>
  71. <style lang="scss">
  72. .follow {
  73. padding: 0 20rpx;
  74. height: 140rpx;
  75. background: rgba(0, 0, 0, 0.02);
  76. .picTxt {
  77. .pictrue {
  78. width: 92rpx;
  79. height: 92rpx;
  80. border-radius: 50%;
  81. image {
  82. width: 100%;
  83. height: 100%;
  84. border-radius: 50%;
  85. }
  86. }
  87. .name {
  88. font-size: 32rpx;
  89. color: #000;
  90. margin-left: 32rpx;
  91. width: 400rpx;
  92. }
  93. }
  94. .notes {
  95. font-size: 28rpx;
  96. color: #02a0e8;
  97. width: 120rpx;
  98. height: 52rpx;
  99. border: 2rpx solid rgba(2, 160, 232, 1);
  100. opacity: 1;
  101. border-radius: 6rpx;
  102. }
  103. }
  104. .followCode {
  105. .pictrue {
  106. width: 500rpx;
  107. height: 530rpx;
  108. border-radius: 12px;
  109. left: 50%;
  110. top: 50%;
  111. margin-left: -250rpx;
  112. margin-top: -360rpx;
  113. position: fixed;
  114. z-index: 10000;
  115. .code-bg {
  116. display: flex;
  117. justify-content: center;
  118. width: 100%;
  119. height: 100%;
  120. background-image: url('~@/static/images/code-bg.png');
  121. background-size: 100% 100%;
  122. }
  123. .imgs {
  124. width: 310rpx;
  125. height: 310rpx;
  126. margin-top: 92rpx;
  127. }
  128. }
  129. .mask {
  130. z-index: 9999;
  131. }
  132. }
  133. </style>