follow.vue 3.6 KB

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