follow.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. <!-- <button class="close_btn" @click="closeAddFollow()">关闭</button> -->
  7. </view>
  8. <view class="qr_code_area">
  9. <image v-if="followQrcode" :src="followQrcode" class="qr_code" mode="" show-menu-by-longpress></image>
  10. </view>
  11. <view class="info_alter">长按识别二维码添加客服</view>
  12. <!-- <button class="save_btn" @click="saveImage()">保存图片添加客服</button> -->
  13. </view>
  14. </uni-popup>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. followQrcode:"",
  22. }
  23. },
  24. onShow() {
  25. // 登录提示
  26. if( !this.$checkAccess.alterLogin() ) return ;
  27. // 判断数据
  28. this.$http.request('api/custom/get_info').then((callback)=>{
  29. if( callback.code == 'success' ){
  30. if( !callback.data.userpic ) callback.data.userpic = "../../static/icon/doctor.png";
  31. // 存储登录标识
  32. uni.setStorageSync('userInfo',callback.data);
  33. }
  34. });
  35. this.openAddFollow();
  36. },
  37. methods: {
  38. // 客服显示
  39. openAddFollow(){
  40. // 返回结果
  41. this.followQrcode = this.$checkAccess.getFollowQrcode();
  42. // 有图才展示
  43. if( this.followQrcode ) this.$refs.addFollow.open('center');
  44. },
  45. closeAddFollow(){
  46. this.$refs.addFollow.close();
  47. },
  48. // 保存图片
  49. saveImage(){
  50. var that = this;
  51. // 下载远程图片后保存到相册
  52. uni.downloadFile({
  53. url: this.followQrcode,
  54. success:function(res) {
  55. if(res.statusCode == 200){
  56. uni.saveImageToPhotosAlbum({
  57. filePath: res.tempFilePath,
  58. success:function(res) {
  59. uni.showToast({title:"保存成功",icon:'none'});
  60. that.$refs.addFollow.close();
  61. },
  62. fail:function(err){
  63. }
  64. });
  65. }
  66. },
  67. })
  68. },
  69. }
  70. }
  71. </script>
  72. <style lang="less">
  73. // 添加客服
  74. .center_popup{
  75. .add_follow{
  76. display: block;
  77. color: #FFFFFF;
  78. width: 700rpx;
  79. height: 800rpx;
  80. margin: 0 auto;
  81. font-size: 26rpx;
  82. border-radius: 40rpx;
  83. background: linear-gradient(to bottom, #ff0091 0%, #2c82ff 100%);
  84. .close_area{
  85. height: 100rpx;
  86. display: block;
  87. line-height: 100rpx;
  88. .close_btn{
  89. color: #FFFFFF;
  90. float: right;
  91. width: 100rpx;
  92. height: 100rpx;
  93. font-size: 26rpx;
  94. text-align: center;
  95. line-height: 100rpx;
  96. padding: 0rpx 0rpx;
  97. border: 0rpx solid transparent;
  98. background-color: transparent;
  99. }
  100. .close_btn::after{
  101. border: 0rpx solid transparent;
  102. }
  103. }
  104. .info_alter{
  105. display: block;
  106. height: 100rpx;
  107. font-size: 42rpx;
  108. font-weight: bold;
  109. text-align: center;
  110. line-height: 100rpx;
  111. }
  112. .qr_code_area{
  113. display: block;
  114. width: 300rpx;
  115. height: 300rpx;
  116. margin: 60rpx auto;
  117. .qr_code{
  118. float: left;
  119. width: 300rpx;
  120. height: 300rpx;
  121. }
  122. }
  123. .save_btn{
  124. color: #333333;
  125. display: block;
  126. width: 260rpx;
  127. height: 80rpx;
  128. font-size: 26rpx;
  129. text-align: center;
  130. line-height: 80rpx;
  131. padding: 0rpx 0rpx;
  132. margin: 40rpx auto;
  133. border-radius: 40rpx;
  134. background-color: #FFFFFF;
  135. border: 0rpx solid transparent;
  136. }
  137. .rule_info{
  138. width: 600rpx;
  139. display: block;
  140. font-size: 26rpx;
  141. margin: 20rpx auto;
  142. overflow: hidden;
  143. line-height: 60rpx;
  144. }
  145. }
  146. }
  147. </style>