customerService.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <!-- 在线客服 -->
  3. <view class="custmer" v-show="!isSortType">
  4. <!-- #ifdef H5 || APP-PLUS -->
  5. <view class="customerService" :style="'top:'+topConfig" @touchmove.stop.prevent="setTouchMove">
  6. <navigator class="pictrue" url="/pages/extension/customer_list/chat" hover-class="none">
  7. <image :src="logoConfig"></image>
  8. </navigator>
  9. </view>
  10. <!-- #endif -->
  11. <!-- #ifdef MP -->
  12. <view class="customerService" :style="'top:'+topConfig" @touchmove.stop.prevent="setTouchMove" v-if="routineContact === '0'">
  13. <navigator class="pictrue" url="/pages/extension/customer_list/chat" hover-class="none">
  14. <image :src="logoConfig"></image>
  15. </navigator>
  16. </view>
  17. <button class="customerService-sty" :style="'top:'+topConfig" @touchmove.stop.prevent="setTouchMove" open-type='contact' v-if="routineContact === '1'">
  18. <image class="pictrue" :src="logoConfig"></image>
  19. </button>
  20. <!-- #endif -->
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. name: 'customerService',
  26. props: {
  27. dataConfig: {
  28. type: Object,
  29. default: () => {}
  30. },
  31. isSortType:{
  32. type: String | Number,
  33. default:0
  34. }
  35. },
  36. data() {
  37. return {
  38. routineContact: this.dataConfig.routine_contact_type,
  39. logoConfig: this.dataConfig.logoConfig.url,
  40. topConfig: this.dataConfig.topConfig.val?this.dataConfig.topConfig.val>=80?80+'%':this.dataConfig.topConfig.val+'%':'30%'
  41. };
  42. },
  43. created() {
  44. console.log(this.topConfig)
  45. },
  46. methods: {
  47. setTouchMove(e) {
  48. var that = this;
  49. if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
  50. that.topConfig = e.touches[0].clientY+'px'
  51. }
  52. },
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. .custmer {
  58. touch-action: none;
  59. }
  60. .customerService,.customerService-sty {
  61. position: fixed;
  62. right: 20rpx;
  63. z-index: 40;
  64. .pictrue {
  65. width: 86rpx;
  66. height: 86rpx;
  67. border-radius: 50%;
  68. image {
  69. width: 100%;
  70. height: 100%;
  71. border-radius: 50%;
  72. }
  73. }
  74. }
  75. .customerService-sty{
  76. background-color: rgba(0,0,0,0) !important;
  77. }
  78. </style>