FollowPopup.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="add_follow">
  3. <view class="close_area"><button class="close_btn" @click="closePopup">关闭</button></view>
  4. <view class="info_alter">
  5. <text v-show="follow_linkurl">{{ clickTitle }}</text>
  6. <text v-show="!follow_linkurl">{{ longTapTitle }}</text>
  7. </view>
  8. <view v-if="!picUrl" class="qr_code_area" @click="followLinkurl">
  9. <image :src="followQrcode" class="qr_code" mode="" show-menu-by-longpress> </image>
  10. </view>
  11. <view v-if="picUrl">
  12. <view class="qr_code_area" @click="followLinkurl">
  13. <image :src="picUrl" class="qr_code" mode="" show-menu-by-longpress> </image>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. props: {
  21. //关闭弹窗
  22. closePopup: {
  23. type: Function,
  24. required: true,
  25. },
  26. showRule: {
  27. type: Boolean,
  28. default: true,
  29. },
  30. clickTitle: {
  31. type: String,
  32. default: "点击二维码添加客服",
  33. },
  34. longTapTitle: {
  35. type: String,
  36. default: "长按二维码添加客服",
  37. },
  38. picUrl: {
  39. type: String,
  40. default: "",
  41. },
  42. },
  43. data() {
  44. return {
  45. follow_linkurl: this.$checkAccess.getFollowLinkUrl(),
  46. followQrcode: this.$checkAccess.getFollowQrcode(),
  47. };
  48. },
  49. methods: {
  50. // 去往webview
  51. followLinkurl() {
  52. // 获取登录标识
  53. let userInfo = uni.getStorageSync("userInfo");
  54. // 如果不存在的话
  55. if (!userInfo) return "";
  56. // 未添加好友
  57. if (!userInfo.follow_linkurl) return "";
  58. // 获取Url
  59. let url = userInfo.follow_linkurl;
  60. // 没有路径,不跳转
  61. if (!url) return;
  62. // 判断是不是小程序链接
  63. if (url.includes("http")) {
  64. // 转码
  65. let link_url = encodeURIComponent(url);
  66. // 跳转到webview
  67. uni.redirectTo({
  68. url: `/pages/webview/index?link_url=${link_url}`,
  69. });
  70. } else {
  71. // 跳转到webview
  72. uni.navigateTo({
  73. url: url,
  74. });
  75. }
  76. },
  77. },
  78. };
  79. </script>
  80. <style lang="less" scoped>
  81. .add_follow {
  82. display: block;
  83. color: #ffffff;
  84. width: 700rpx;
  85. height: 800rpx;
  86. margin: 0 auto;
  87. font-size: 26rpx;
  88. border-radius: 40rpx;
  89. background: linear-gradient(to bottom, #ff0091 0%, #2c82ff 100%);
  90. .close_area {
  91. height: 80rpx;
  92. display: block;
  93. line-height: 80rpx;
  94. .close_btn {
  95. color: #ffffff;
  96. float: right;
  97. width: 80rpx;
  98. height: 80rpx;
  99. font-size: 26rpx;
  100. text-align: center;
  101. line-height: 80rpx;
  102. padding: 0rpx 0rpx;
  103. border: 0rpx solid transparent;
  104. background-color: transparent;
  105. }
  106. .close_btn::after {
  107. border: 0rpx solid transparent;
  108. }
  109. }
  110. .info_alter {
  111. display: block;
  112. height: 100rpx;
  113. font-size: 42rpx;
  114. font-weight: bold;
  115. text-align: center;
  116. line-height: 100rpx;
  117. }
  118. .qr_code_area {
  119. display: block;
  120. width: 300rpx;
  121. height: 300rpx;
  122. margin: 30rpx auto;
  123. .qr_code {
  124. float: left;
  125. width: 300rpx;
  126. height: 300rpx;
  127. }
  128. }
  129. .save_btn {
  130. color: #333333;
  131. display: block;
  132. width: 260rpx;
  133. height: 80rpx;
  134. font-size: 26rpx;
  135. text-align: center;
  136. line-height: 80rpx;
  137. padding: 0rpx 0rpx;
  138. margin: 40rpx auto;
  139. border-radius: 40rpx;
  140. background-color: #ffffff;
  141. border: 0rpx solid transparent;
  142. }
  143. .rule_info {
  144. width: 600rpx;
  145. display: block;
  146. font-size: 26rpx;
  147. margin: 20rpx auto;
  148. overflow: hidden;
  149. line-height: 40rpx;
  150. }
  151. }
  152. </style>