FollowPopup.vue 3.5 KB

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