|
@@ -32,6 +32,21 @@
|
|
<div class="main">
|
|
<div class="main">
|
|
<router-view></router-view>
|
|
<router-view></router-view>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div class="card_callingSystem" v-show="entranceRight" :class="entranceRight ? 'slide-left' : ''">
|
|
|
|
+ <div class="center_in " :class="entranceRight ? 'shake-lr' : ''" id="card_system">
|
|
|
|
+ <img class="calling_img" src="../../assets/image/incoming.png" alt="" />
|
|
|
|
+ </div>
|
|
|
|
+ <div class="card_ad_phone">
|
|
|
|
+ <div class="ad_title">客户来电</div>
|
|
|
|
+ <div class="phone_title">{{ phone }}</div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="bottom_btn_add">
|
|
|
|
+ <div class="btn_add_card center_in" @click="addOrder">
|
|
|
|
+ 添加订单
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- <audio ref="alarmAudio" loop src="@/assets/entertained.mp3"></audio> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -60,6 +75,9 @@
|
|
timer: undefined,
|
|
timer: undefined,
|
|
hourMinuteSecond: null,
|
|
hourMinuteSecond: null,
|
|
firmName: '',
|
|
firmName: '',
|
|
|
|
+ phone: '17673255548',
|
|
|
|
+ entranceRight: false,
|
|
|
|
+ errNumber: 0,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -83,6 +101,17 @@
|
|
})
|
|
})
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.sse();
|
|
|
|
+ let testDom = document.getElementById('card_system')
|
|
|
|
+ testDom.addEventListener('animationend', function(event) {
|
|
|
|
+ // 移除再添加动画样式 重新触发动画
|
|
|
|
+ testDom.classList.remove('shake-lr')
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ testDom.classList.add('shake-lr')
|
|
|
|
+ }, 1000)
|
|
|
|
+ });
|
|
|
|
+ })
|
|
Bus.$on('collapse', isCollapse => {
|
|
Bus.$on('collapse', isCollapse => {
|
|
this.collapse = isCollapse;
|
|
this.collapse = isCollapse;
|
|
});
|
|
});
|
|
@@ -126,6 +155,58 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return result
|
|
return result
|
|
|
|
+ },
|
|
|
|
+ sse() {
|
|
|
|
+ let that = this
|
|
|
|
+ // 创建EventSource实例
|
|
|
|
+ const eventSource = new EventSource('http://127.0.0.1:8990/ees');
|
|
|
|
+ // 订阅事件
|
|
|
|
+ eventSource.addEventListener('message', function(event) {
|
|
|
|
+ // 处理收到的消息
|
|
|
|
+ let arr = event.data
|
|
|
|
+
|
|
|
|
+ function getContentBetween(source, start, end) {
|
|
|
|
+ const pattern = new RegExp(start + '(.*?)' + end, 's');
|
|
|
|
+ const match = source.match(pattern);
|
|
|
|
+ return match ? match[1] : '';
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 示例使用
|
|
|
|
+ const start = 'local=sip:';
|
|
|
|
+ const end = '@';
|
|
|
|
+ const content = getContentBetween(arr, start, end);
|
|
|
|
+ if (content) {
|
|
|
|
+ that.entranceRight = true
|
|
|
|
+ // const audio = that.$refs.alarmAudio;
|
|
|
|
+ // audio.play();
|
|
|
|
+ // audio.addEventListener('ended', () => {
|
|
|
|
+ // audio.pause();
|
|
|
|
+ // audio.currentTime = 0;
|
|
|
|
+ // });
|
|
|
|
+ }
|
|
|
|
+ that.phone = content
|
|
|
|
+ });
|
|
|
|
+ eventSource.addEventListener('error', function(event) {
|
|
|
|
+ // 处理错误
|
|
|
|
+ if (that.errNumber == 3) {
|
|
|
|
+ console.error('SSE Error', event);
|
|
|
|
+ eventSource.close()
|
|
|
|
+ } else {
|
|
|
|
+ that.errNumber++
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // 添加订单
|
|
|
|
+ addOrder() {
|
|
|
|
+ let that = this
|
|
|
|
+ that.$router.push({
|
|
|
|
+ name: 'agentOrdering',
|
|
|
|
+ query: {
|
|
|
|
+ flag: true,
|
|
|
|
+ phone: that.phone,
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ that.entranceRight = false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
@@ -150,6 +231,145 @@
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ .card_callingSystem {
|
|
|
|
+ z-index: 999;
|
|
|
|
+ position: absolute;
|
|
|
|
+ bottom: 20px;
|
|
|
|
+ right: 20px;
|
|
|
|
+ width: 250px;
|
|
|
|
+ height: 180px;
|
|
|
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ border: 2px solid rgba(255, 255, 255, 0.3);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .shake-lr {
|
|
|
|
+ -webkit-animation: shake-lr 1s cubic-bezier(0.455, 0.030, 0.515, 0.955) both;
|
|
|
|
+ animation: shake-lr 1s cubic-bezier(0.455, 0.030, 0.515, 0.955) both;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @-webkit-keyframes shake-lr {
|
|
|
|
+
|
|
|
|
+ 0%,
|
|
|
|
+ 100% {
|
|
|
|
+ -webkit-transform: rotate(0deg);
|
|
|
|
+ transform: rotate(0deg);
|
|
|
|
+ -webkit-transform-origin: 50% 50%;
|
|
|
|
+ transform-origin: 50% 50%;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 10% {
|
|
|
|
+ -webkit-transform: rotate(8deg);
|
|
|
|
+ transform: rotate(8deg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 20%,
|
|
|
|
+ 40%,
|
|
|
|
+ 60% {
|
|
|
|
+ -webkit-transform: rotate(-10deg);
|
|
|
|
+ transform: rotate(-10deg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 30%,
|
|
|
|
+ 50%,
|
|
|
|
+ 70% {
|
|
|
|
+ -webkit-transform: rotate(10deg);
|
|
|
|
+ transform: rotate(10deg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 80% {
|
|
|
|
+ -webkit-transform: rotate(-8deg);
|
|
|
|
+ transform: rotate(-8deg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 90% {
|
|
|
|
+ -webkit-transform: rotate(8deg);
|
|
|
|
+ transform: rotate(8deg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @keyframes shake-lr {
|
|
|
|
+
|
|
|
|
+ 0%,
|
|
|
|
+ 100% {
|
|
|
|
+ -webkit-transform: rotate(0deg);
|
|
|
|
+ transform: rotate(0deg);
|
|
|
|
+ -webkit-transform-origin: 50% 50%;
|
|
|
|
+ transform-origin: 50% 50%;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 10% {
|
|
|
|
+ -webkit-transform: rotate(8deg);
|
|
|
|
+ transform: rotate(8deg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 20%,
|
|
|
|
+ 40%,
|
|
|
|
+ 60% {
|
|
|
|
+ -webkit-transform: rotate(-10deg);
|
|
|
|
+ transform: rotate(-10deg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 30%,
|
|
|
|
+ 50%,
|
|
|
|
+ 70% {
|
|
|
|
+ -webkit-transform: rotate(10deg);
|
|
|
|
+ transform: rotate(10deg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 80% {
|
|
|
|
+ -webkit-transform: rotate(-8deg);
|
|
|
|
+ transform: rotate(-8deg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 90% {
|
|
|
|
+ -webkit-transform: rotate(8deg);
|
|
|
|
+ transform: rotate(8deg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .calling_img {
|
|
|
|
+ width: 60px;
|
|
|
|
+ height: 60px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .card_ad_phone {
|
|
|
|
+ margin-top: 10px;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ flex-direction: column;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .ad_title {
|
|
|
|
+ font-size: 20px;
|
|
|
|
+ color: #fff;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .phone_title {
|
|
|
|
+ color: #fff;
|
|
|
|
+ font-size: 30px;
|
|
|
|
+ font: 600 35px mFont;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .bottom_btn_add {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .btn_add_card {
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ margin-top: 10px;
|
|
|
|
+ color: #fff;
|
|
|
|
+ width: 100px;
|
|
|
|
+ height: 30px;
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ border-radius: 40px;
|
|
|
|
+ background-color: #67C23A;
|
|
|
|
+ }
|
|
|
|
+
|
|
.container {
|
|
.container {
|
|
width: 100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
height: 100%;
|
|
@@ -243,4 +463,34 @@
|
|
position: absolute;
|
|
position: absolute;
|
|
margin-top: 10px;
|
|
margin-top: 10px;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ .slide-left {
|
|
|
|
+ -webkit-animation: slide-left 1s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
|
|
|
|
+ animation: slide-left 1s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @-webkit-keyframes slide-left {
|
|
|
|
+ 0% {
|
|
|
|
+ -webkit-transform: translateX(0);
|
|
|
|
+ transform: translateX(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 100% {
|
|
|
|
+ -webkit-transform: translateX(-20px);
|
|
|
|
+ transform: translateX(-20px);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @keyframes slide-left {
|
|
|
|
+ 0% {
|
|
|
|
+ -webkit-transform: translateX(0);
|
|
|
|
+ transform: translateX(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 100% {
|
|
|
|
+ -webkit-transform: translateX(-20px);
|
|
|
|
+ transform: translateX(-20px);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
</style>
|
|
</style>
|