FollowPopup.vue 3.8 KB

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