index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <script setup>
  2. import { storeToRefs } from 'pinia';
  3. import useVoiceStore from "@/store/modules/voice";
  4. const voiceStore = useVoiceStore();
  5. const { callDialing, callTime, isMakingCall, telephoneNumber } = storeToRefs(voiceStore);
  6. // 切换展示窗口
  7. const handleToggle = () => {
  8. voiceStore.noiceBarVisibleState = false;
  9. voiceStore.noiceBoxVisibleState = true;
  10. }
  11. // 挂断电话
  12. const handleCallDisconnected = () => {
  13. voiceStore.onCallDisconnected();
  14. }
  15. // 接听电话
  16. const handleCallAnswered = () => {
  17. voiceStore.onCallAnswered();
  18. }
  19. </script>
  20. <template>
  21. <div class="tel-notice-bar_view flex items-center justify-between" :style="{ top: voiceStore.noiceBarVisibleState ? '10px' : '-88px' }">
  22. <div class="notice-left flex items-center justify-center">
  23. <div class="avatar-box">
  24. <div class="circle1"></div>
  25. <div class="circle2"></div>
  26. <div class="circle3"></div>
  27. <div class="circle4">
  28. <img src="@/assets/images/tools/icon-avatar-call.svg" alt="">
  29. </div>
  30. </div>
  31. <ul class="pl-[20px]">
  32. <li class="text-[14px] text-[#7B7B7D] space-x-[4px]">
  33. <span>黑龙江</span>
  34. <span>牡丹江</span>
  35. </li>
  36. <li class="text-[18px] font-bold">
  37. <span>{{ telephoneNumber }}</span>
  38. </li>
  39. </ul>
  40. </div>
  41. <div class="notice-center text-[14px]" style="color: rgba(255, 255, 255, 0.6)" v-show="callDialing">
  42. <span>通话中:</span>
  43. <span>{{ callTime }}</span>
  44. </div>
  45. <div class="notice-right flex">
  46. <ul class="flex items-center space-x-[12px]">
  47. <li class="icon-off" @click="handleCallDisconnected"></li>
  48. <li class="icon-on" @click="handleCallAnswered" v-show="!callDialing && !isMakingCall"></li>
  49. <li class="icon-toggle" @click="handleToggle"></li>
  50. </ul>
  51. </div>
  52. </div>
  53. </template>
  54. <style lang="scss" scoped>
  55. .tel-notice-bar_view {
  56. position: absolute;
  57. left: 50%;
  58. top: 10px;
  59. transform: translateX(-50%);
  60. display: flex;
  61. align-items: center;
  62. width: 600px;
  63. height: 88px;
  64. padding: 0 24px;
  65. background: #000;
  66. z-index: 1100;
  67. border-radius: 8px;
  68. color: #fff;
  69. transition: top ease-out .5s;
  70. .notice-left .avatar-box {
  71. position: relative;
  72. display: flex;
  73. align-items: center;
  74. justify-content: center;
  75. width: 48px;
  76. height: 48px;
  77. border-radius: 100% 100%;
  78. background: linear-gradient(180deg, #656565 0%, #2F2F2F 100%);
  79. .circle1,
  80. .circle2,
  81. .circle3 {
  82. position: absolute;
  83. width: 30px;
  84. height: 30px;
  85. background: rgba(137, 142, 254, 0);
  86. border: 1px solid rgba(255, 255, 255, 0.60);
  87. border-radius: 999px;
  88. }
  89. .circle1,
  90. .circle2,
  91. .circle3 {
  92. animation-name: circleChange;
  93. animation-duration: 3s;
  94. animation-iteration-count: infinite;
  95. animation-timing-function: linear;
  96. }
  97. .circle1 {
  98. animation-delay: 0.5s;
  99. }
  100. .circle2 {
  101. animation-delay: 1.5s;
  102. }
  103. .circle3 {
  104. animation-delay: 2.5s;
  105. }
  106. @keyframes circleChange {
  107. 0% {
  108. transform: scale(1.5);
  109. opacity: 0.75;
  110. }
  111. 100% {
  112. transform: scale(2.5);
  113. opacity: 0.05;
  114. }
  115. }
  116. .circle4 {
  117. position: relative;
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. z-index: 11111;
  122. width: 100%;
  123. height: 100%;
  124. border-radius: 100% 100%;
  125. background: linear-gradient(180deg, #656565 0%, #2F2F2F 100%);
  126. }
  127. }
  128. .notice-right {
  129. .icon-off,
  130. .icon-on {
  131. width: 40px;
  132. height: 40px;
  133. border-radius: 50%;
  134. cursor: pointer;
  135. }
  136. .icon-off {
  137. background: url("@/assets/images/tools/icon-phone-on.svg") center center no-repeat;
  138. }
  139. .icon-on {
  140. background: url("@/assets/images/tools/icon-phone-off.svg") center center no-repeat;
  141. }
  142. .icon-toggle {
  143. width: 24px;
  144. height: 24px;
  145. background: url("@/assets/images/tools/icon-toggle.svg") center center no-repeat;
  146. cursor: pointer;
  147. }
  148. }
  149. }
  150. </style>