follow.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <uni-popup ref="addFollow" type="center" class="center_popup" :mask-click="false">
  4. <view class="add_follow">
  5. <view class="close_area"> </view>
  6. <view class="qr_code_area" @click="followLinkurl">
  7. <image v-if="followQrcode" :src="followQrcode" class="qr_code" mode="" show-menu-by-longpress></image>
  8. </view>
  9. <view class="info_alter">
  10. <text v-if="follow_linkurl">点击二维码添加客服</text>
  11. <text v-if="!follow_linkurl">长按二维码添加客服</text>
  12. </view>
  13. <view class="rule_info">
  14. <view class="">规则:</view>
  15. <view class="">1、预约报单需要添加客服人员</view>
  16. <view class="">2、添加完客服人员后填写小程序当前登录手机号以绑定账号</view>
  17. <view class="">3、开始预约报单</view>
  18. </view>
  19. </view>
  20. </uni-popup>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. followQrcode: "",
  28. follow_linkurl: "",
  29. };
  30. },
  31. onShow() {
  32. // 登录提示
  33. if (!this.$checkAccess.alterLogin()) return;
  34. // 判断数据
  35. this.$http.request("api/custom/get_info").then((callback) => {
  36. if (callback.code == "success") {
  37. if (!callback.data.userpic) callback.data.userpic = "https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png";
  38. // 存储登录标识
  39. uni.setStorageSync("userInfo", callback.data);
  40. }
  41. });
  42. this.openAddFollow();
  43. },
  44. methods: {
  45. // 客服显示
  46. openAddFollow() {
  47. // 返回结果
  48. this.followQrcode = this.$checkAccess.getFollowQrcode();
  49. // 返回结果
  50. this.follow_linkurl = this.$checkAccess.getFollowLinkUrl();
  51. // 有图才展示
  52. if (this.followQrcode) this.$refs.addFollow.open("center");
  53. },
  54. closeAddFollow() {
  55. this.$refs.addFollow.close();
  56. },
  57. // 去往webview
  58. followLinkurl() {
  59. // 获取登录标识
  60. let userInfo = uni.getStorageSync("userInfo");
  61. // 如果不存在的话
  62. if (!userInfo) return "";
  63. // 未添加好友
  64. if (!userInfo.follow_linkurl) return "";
  65. // 获取Url
  66. let url = userInfo.follow_linkurl;
  67. // 没有路径,不跳转
  68. if (!url) return;
  69. // 判断是不是小程序链接
  70. if (url.includes("http")) {
  71. // 转码
  72. let link_url = encodeURIComponent(url);
  73. // 跳转到webview
  74. uni.redirectTo({
  75. url: `/pages/webview/index?link_url=${link_url}`,
  76. });
  77. } else {
  78. // 跳转到webview
  79. uni.navigateTo({ url: url });
  80. }
  81. },
  82. },
  83. };
  84. </script>
  85. <style lang="less">
  86. // 添加客服
  87. .center_popup {
  88. .add_follow {
  89. display: block;
  90. color: #ffffff;
  91. width: 700rpx;
  92. height: 900rpx;
  93. margin: 0 auto;
  94. font-size: 26rpx;
  95. border-radius: 40rpx;
  96. background: linear-gradient(to bottom, #ff0091 0%, #2c82ff 100%);
  97. .close_area {
  98. height: 30rpx;
  99. display: block;
  100. line-height: 30rpx;
  101. }
  102. .info_alter {
  103. display: block;
  104. height: 100rpx;
  105. font-size: 42rpx;
  106. font-weight: bold;
  107. text-align: center;
  108. line-height: 100rpx;
  109. }
  110. .qr_code_area {
  111. display: block;
  112. width: 300rpx;
  113. height: 300rpx;
  114. margin: 60rpx auto;
  115. .qr_code {
  116. float: left;
  117. width: 300rpx;
  118. height: 300rpx;
  119. }
  120. }
  121. .save_btn {
  122. color: #333333;
  123. display: block;
  124. width: 260rpx;
  125. height: 80rpx;
  126. font-size: 26rpx;
  127. text-align: center;
  128. line-height: 80rpx;
  129. padding: 0rpx 0rpx;
  130. margin: 40rpx auto;
  131. border-radius: 40rpx;
  132. background-color: #ffffff;
  133. border: 0rpx solid transparent;
  134. }
  135. .rule_info {
  136. width: 600rpx;
  137. display: block;
  138. font-size: 26rpx;
  139. margin: 20rpx auto;
  140. overflow: hidden;
  141. line-height: 60rpx;
  142. }
  143. }
  144. }
  145. </style>