customerService.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view style="touch-action: none;">
  3. <!-- #ifdef H5 || APP-PLUS -->
  4. <view class="customerService" :style="'top:'+topConfig" @touchmove.stop.prevent="setTouchMove" v-if="isShow && logoConfig && !isIframe">
  5. <navigator class="pictrue" url="/pages/extension/customer_list/chat" hover-class="none">
  6. <image :src="logoConfig"></image>
  7. </navigator>
  8. </view>
  9. <view class="customerService borderService" :style="'top:'+topConfig" v-if="logoConfig && isIframe">
  10. <view class="pictrue">
  11. <image :src="logoConfig"></image>
  12. </view>
  13. </view>
  14. <view class="customerService borderService" :style="'top:'+topConfig" v-if="!logoConfig && isIframe">
  15. <view class="pictrue">{{$t(`客服`)}}</view>
  16. </view>
  17. <!-- #endif -->
  18. <!-- #ifdef MP -->
  19. <view class="customerService" :style="'top:'+topConfig" @touchmove.stop.prevent="setTouchMove" v-if="routineContact === '0' && logoConfig">
  20. <navigator class="pictrue" url="/pages/extension/customer_list/chat" hover-class="none">
  21. <image :src="logoConfig"></image>
  22. </navigator>
  23. </view>
  24. <button class="customerService-sty" :style="'top:'+topConfig" @touchmove.stop.prevent="setTouchMove" open-type='contact' v-if="routineContact === '1' && logoConfig">
  25. <image class="pictrue" :src="logoConfig"></image>
  26. </button>
  27. <!-- #endif -->
  28. </view>
  29. </template>
  30. <script>
  31. let app = getApp();
  32. export default {
  33. name: 'customerService',
  34. props: {
  35. dataConfig: {
  36. type: Object,
  37. default: () => {}
  38. },
  39. },
  40. watch: {
  41. dataConfig: {
  42. immediate: true,
  43. handler(nVal, oVal) {
  44. if(nVal){
  45. this.logoConfig = nVal.imgUrl.url;
  46. this.isShow = nVal.isShow.val;
  47. this.routineContact = nVal.routine_contact_type;
  48. }
  49. }
  50. }
  51. },
  52. data() {
  53. return {
  54. logoConfig: '',
  55. topConfig: '200px',
  56. name: this.$options.name,
  57. isIframe: false,
  58. isShow: true,
  59. routineContact:'0'
  60. }
  61. },
  62. created() {
  63. this.isIframe = app.globalData.isIframe;
  64. },
  65. methods: {
  66. setTouchMove(e) {
  67. var that = this;
  68. if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
  69. that.topConfig = e.touches[0].clientY+'px'
  70. }
  71. }
  72. }
  73. }
  74. </script>
  75. <style lang="scss">
  76. .borderShow{
  77. position: fixed;
  78. }
  79. .borderShow .borderService::after{
  80. content: ' ';
  81. position: absolute;
  82. left: 0;
  83. top: 0;
  84. width: 100%;
  85. height: 100%;
  86. border:1px dashed #007AFF;
  87. box-sizing: border-box;
  88. }
  89. .customerService,.customerService-sty {
  90. position: fixed !important;
  91. right: 20rpx;
  92. z-index: 40;
  93. .pictrue {
  94. width: 86rpx;
  95. height: 86rpx;
  96. text-align: center;
  97. line-height: 86rpx;
  98. color: #fff;
  99. border-radius: 50%;
  100. background-color: #ccc;
  101. image {
  102. width: 100%;
  103. height: 100%;
  104. border-radius: 50%;
  105. }
  106. }
  107. }
  108. .customerService-sty{
  109. background-color: rgba(0,0,0,0) !important;
  110. }
  111. </style>