diff --git a/src/components/AudioPlayer/AudioPlayer.vue b/src/components/AudioPlayer/AudioPlayer.vue new file mode 100644 index 0000000..c7687fd --- /dev/null +++ b/src/components/AudioPlayer/AudioPlayer.vue @@ -0,0 +1,219 @@ + + + + + + diff --git a/src/components/AudioPlayer/AudioPlayer.vue b/src/components/AudioPlayer/AudioPlayer.vue new file mode 100644 index 0000000..c7687fd --- /dev/null +++ b/src/components/AudioPlayer/AudioPlayer.vue @@ -0,0 +1,219 @@ + + + + + + diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index 9bcc449..ba64d8e 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -2,15 +2,14 @@
签入 签出 - 保持 + 保持 解除保持 内呼 外呼 - 保持 挂机 会议 - 小休 - 示忙 + 退出示忙 + 示忙 @@ -37,16 +36,16 @@ - - + + - - + + - - + +
来电号码:{{ number }}
@@ -126,7 +125,7 @@ btnDialIn: true, // 内呼 btnAgentList: true, btnBusy: true, // 示忙 - btnIdle: true, // 示闲 + btnIdle: false, // 示闲 btnMeeting: true, // 会议 btnPickUp: true, btnExtenPickUp: true, @@ -145,7 +144,7 @@ btnGetNumber: true, btnInject: true }, - status: '', + status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 @@ -246,11 +245,12 @@ this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true this.btnStatus.btnBusy = false - this.btnStatus.btnIdle = false - this.btnStatus.btnIdle = false + this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = false this.btnStatus.btnHangUp = false + this.status = '已签入' this.call = '空闲' + // TODO: 通知后台已签入 // 心跳监测定时器 if (this.webVariable.web_hearbeartInterval > 0) { this.webVariable.web_hearbeartID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_hearbeartID * 1000) @@ -275,7 +275,8 @@ }, // 处理签出成功之后的操作 handleLogoutResult(object) { - if (object.success) { + if (object.success === 'true') { + this.status = '未签入' this.$message.success('签出成功') // 处理按钮状态 this.btnStatus.btnLogin = false @@ -284,23 +285,27 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = true this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true - this.btnStatus.btnIdle = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = true this.resetWs() + // TODO: 通知后台已签出 // 清除定时器 clearInterval(this.webVariable.web_hearbeartID) } }, // 外呼 dialOut() { - this.$refs.keyboard.initDialog('out') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('out') + } }, // 内呼 dialIn() { - this.$refs.keyboard.initDialog('in') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('in') + } }, // 拨号 dial(type, tel) { @@ -322,36 +327,54 @@ }, // 示忙 onbusy() { - const strSend = this.createCommand('busy') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('busy') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = true + this.btnStatus.btnIdle = false + } }, // 示闲 onidle() { - const strSend = this.createCommand('idle') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('idle') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = false + this.btnStatus.btnIdle = true + } }, // 挂机 hangup() { - const strSend = this.createCommand('hangup') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hangup') + this.webSocket.send(strSend) + } }, // 保持 hold() { - const strSend = this.createCommand('hold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { // 判断坐席状态,判断通话状态 + if (this.judgeCallStatus()) { + const strSend = this.createCommand('hold') + this.webSocket.send(strSend) + } + } }, // 解除保持 unhold() { - const strSend = this.createCommand('unhold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('unhold') + this.webSocket.send(strSend) + } }, // 三方通话 threeWay() { - const sendObj = { - dialString: this.threeWayPhone + if (this.judgeStatus()) { + const sendObj = { + dialString: this.threeWayPhone + } + const strSend = this.createCommand('threeWay', sendObj) + this.webSocket.send(strSend) } - const strSend = this.createCommand('threeWay', sendObj) - this.webSocket.send(strSend) }, // 处理接通来电事宜 incommingAnswerd(object) { @@ -361,7 +384,7 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = false @@ -374,7 +397,7 @@ } console.log(data) const that = this - setTimeout(function(){ + setTimeout(function() { that.$refs['addcase'].initData(data) }, 500) }, @@ -382,6 +405,15 @@ closeCreateDialog() { this.showAddCase = false // 关闭弹窗 }, + // 进入工作态 + goWorkState() { + // TODO:通知后台进入工作态 + + }, + // 退出工作态 + quitWorkState() { + // TODO:通知后台退出工作态 + }, // 初始化 initSapoOcx() { const { ip, port } = this @@ -531,8 +563,6 @@ if (this.statusShow === true) { // 如果有呼叫弹窗,关闭 this.statusShow = false } - } else { // 话机状态 - this.status = '话机已连接' } } if (name === 'queue status') { @@ -552,18 +582,22 @@ const command = object.command if (command === 'login') { this.handleLoginResult(object) - } - if (command === 'logout') { + } else if (command === 'logout') { this.handleLogoutResult(object) - } - if (command === 'getExtensionList') { + } else if (command === 'getExtensionList') { this.handleExtensionList(object) - } - if (command === 'dial') { + } else if (command === 'dial') { if (object.success === 'true') { this.statusDetailText = object.resultText } - } - if (object.resultText === '准备挂断' && object.success) { + } else if (object.resultText === '准备挂断' && object.success === 'true') { this.statusShow = false + } else if (object.resultText === '准备保持' && object.success === 'true') { + if (object.type === '') { // 保持成功后 + this.btnStatus.btnUnhold = false + this.btnStatus.btnHold = true + } else if (object.type === 'off') { // 解除保持成功后 + this.btnStatus.btnUnhold = true + this.btnStatus.btnHold = false + } } } }, @@ -634,6 +668,24 @@ sendStr += '\n' } return sendStr + }, + // 判断坐席状态 + judgeStatus() { + if (this.status == '已签入') { + return true + } else { + this.$message.warning('请先签入呼叫平台') + return false + } + }, + // 判断通话状态 + judgeCallStatus() { + if (this.isInCall) { + return true + } else { + this.$message.warning('未在通话中') + return false + } } } } diff --git a/src/components/AudioPlayer/AudioPlayer.vue b/src/components/AudioPlayer/AudioPlayer.vue new file mode 100644 index 0000000..c7687fd --- /dev/null +++ b/src/components/AudioPlayer/AudioPlayer.vue @@ -0,0 +1,219 @@ + + + + + + diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index 9bcc449..ba64d8e 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -2,15 +2,14 @@
签入 签出 - 保持 + 保持 解除保持 内呼 外呼 - 保持 挂机 会议 - 小休 - 示忙 + 退出示忙 + 示忙 @@ -37,16 +36,16 @@ - - + + - - + + - - + +
来电号码:{{ number }}
@@ -126,7 +125,7 @@ btnDialIn: true, // 内呼 btnAgentList: true, btnBusy: true, // 示忙 - btnIdle: true, // 示闲 + btnIdle: false, // 示闲 btnMeeting: true, // 会议 btnPickUp: true, btnExtenPickUp: true, @@ -145,7 +144,7 @@ btnGetNumber: true, btnInject: true }, - status: '', + status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 @@ -246,11 +245,12 @@ this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true this.btnStatus.btnBusy = false - this.btnStatus.btnIdle = false - this.btnStatus.btnIdle = false + this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = false this.btnStatus.btnHangUp = false + this.status = '已签入' this.call = '空闲' + // TODO: 通知后台已签入 // 心跳监测定时器 if (this.webVariable.web_hearbeartInterval > 0) { this.webVariable.web_hearbeartID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_hearbeartID * 1000) @@ -275,7 +275,8 @@ }, // 处理签出成功之后的操作 handleLogoutResult(object) { - if (object.success) { + if (object.success === 'true') { + this.status = '未签入' this.$message.success('签出成功') // 处理按钮状态 this.btnStatus.btnLogin = false @@ -284,23 +285,27 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = true this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true - this.btnStatus.btnIdle = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = true this.resetWs() + // TODO: 通知后台已签出 // 清除定时器 clearInterval(this.webVariable.web_hearbeartID) } }, // 外呼 dialOut() { - this.$refs.keyboard.initDialog('out') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('out') + } }, // 内呼 dialIn() { - this.$refs.keyboard.initDialog('in') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('in') + } }, // 拨号 dial(type, tel) { @@ -322,36 +327,54 @@ }, // 示忙 onbusy() { - const strSend = this.createCommand('busy') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('busy') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = true + this.btnStatus.btnIdle = false + } }, // 示闲 onidle() { - const strSend = this.createCommand('idle') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('idle') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = false + this.btnStatus.btnIdle = true + } }, // 挂机 hangup() { - const strSend = this.createCommand('hangup') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hangup') + this.webSocket.send(strSend) + } }, // 保持 hold() { - const strSend = this.createCommand('hold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { // 判断坐席状态,判断通话状态 + if (this.judgeCallStatus()) { + const strSend = this.createCommand('hold') + this.webSocket.send(strSend) + } + } }, // 解除保持 unhold() { - const strSend = this.createCommand('unhold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('unhold') + this.webSocket.send(strSend) + } }, // 三方通话 threeWay() { - const sendObj = { - dialString: this.threeWayPhone + if (this.judgeStatus()) { + const sendObj = { + dialString: this.threeWayPhone + } + const strSend = this.createCommand('threeWay', sendObj) + this.webSocket.send(strSend) } - const strSend = this.createCommand('threeWay', sendObj) - this.webSocket.send(strSend) }, // 处理接通来电事宜 incommingAnswerd(object) { @@ -361,7 +384,7 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = false @@ -374,7 +397,7 @@ } console.log(data) const that = this - setTimeout(function(){ + setTimeout(function() { that.$refs['addcase'].initData(data) }, 500) }, @@ -382,6 +405,15 @@ closeCreateDialog() { this.showAddCase = false // 关闭弹窗 }, + // 进入工作态 + goWorkState() { + // TODO:通知后台进入工作态 + + }, + // 退出工作态 + quitWorkState() { + // TODO:通知后台退出工作态 + }, // 初始化 initSapoOcx() { const { ip, port } = this @@ -531,8 +563,6 @@ if (this.statusShow === true) { // 如果有呼叫弹窗,关闭 this.statusShow = false } - } else { // 话机状态 - this.status = '话机已连接' } } if (name === 'queue status') { @@ -552,18 +582,22 @@ const command = object.command if (command === 'login') { this.handleLoginResult(object) - } - if (command === 'logout') { + } else if (command === 'logout') { this.handleLogoutResult(object) - } - if (command === 'getExtensionList') { + } else if (command === 'getExtensionList') { this.handleExtensionList(object) - } - if (command === 'dial') { + } else if (command === 'dial') { if (object.success === 'true') { this.statusDetailText = object.resultText } - } - if (object.resultText === '准备挂断' && object.success) { + } else if (object.resultText === '准备挂断' && object.success === 'true') { this.statusShow = false + } else if (object.resultText === '准备保持' && object.success === 'true') { + if (object.type === '') { // 保持成功后 + this.btnStatus.btnUnhold = false + this.btnStatus.btnHold = true + } else if (object.type === 'off') { // 解除保持成功后 + this.btnStatus.btnUnhold = true + this.btnStatus.btnHold = false + } } } }, @@ -634,6 +668,24 @@ sendStr += '\n' } return sendStr + }, + // 判断坐席状态 + judgeStatus() { + if (this.status == '已签入') { + return true + } else { + this.$message.warning('请先签入呼叫平台') + return false + } + }, + // 判断通话状态 + judgeCallStatus() { + if (this.isInCall) { + return true + } else { + this.$message.warning('未在通话中') + return false + } } } } diff --git a/src/main.js b/src/main.js index 5630ee7..c9df78f 100644 --- a/src/main.js +++ b/src/main.js @@ -23,8 +23,13 @@ * it will intercept your request, so you won't see the request in the network. * If you remove `../mock` it will automatically request easy-mock data. */ +// if (process.env.NODE_ENV === 'development') { // import './../mock' // simulation data // require('./../mock') +// } else { +// console.log('生产环境') +// } + // 兼容IE11 import 'babel-polyfill' @@ -61,6 +66,15 @@ import VCharts from 'v-charts' Vue.use(VCharts) +// js禁止浏览器的回退快捷键 +history.pushState(null, null, document.URL) +window.addEventListener('popstate', function() { + history.pushState(null, null, document.URL) +}) +// 引入区域级联选项 +import vRegion from 'v-region' +Vue.use(vRegion, {}) + new Vue({ el: '#app', router, diff --git a/src/components/AudioPlayer/AudioPlayer.vue b/src/components/AudioPlayer/AudioPlayer.vue new file mode 100644 index 0000000..c7687fd --- /dev/null +++ b/src/components/AudioPlayer/AudioPlayer.vue @@ -0,0 +1,219 @@ + + + + + + diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index 9bcc449..ba64d8e 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -2,15 +2,14 @@
签入 签出 - 保持 + 保持 解除保持 内呼 外呼 - 保持 挂机 会议 - 小休 - 示忙 + 退出示忙 + 示忙 @@ -37,16 +36,16 @@ - - + + - - + + - - + +
来电号码:{{ number }}
@@ -126,7 +125,7 @@ btnDialIn: true, // 内呼 btnAgentList: true, btnBusy: true, // 示忙 - btnIdle: true, // 示闲 + btnIdle: false, // 示闲 btnMeeting: true, // 会议 btnPickUp: true, btnExtenPickUp: true, @@ -145,7 +144,7 @@ btnGetNumber: true, btnInject: true }, - status: '', + status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 @@ -246,11 +245,12 @@ this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true this.btnStatus.btnBusy = false - this.btnStatus.btnIdle = false - this.btnStatus.btnIdle = false + this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = false this.btnStatus.btnHangUp = false + this.status = '已签入' this.call = '空闲' + // TODO: 通知后台已签入 // 心跳监测定时器 if (this.webVariable.web_hearbeartInterval > 0) { this.webVariable.web_hearbeartID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_hearbeartID * 1000) @@ -275,7 +275,8 @@ }, // 处理签出成功之后的操作 handleLogoutResult(object) { - if (object.success) { + if (object.success === 'true') { + this.status = '未签入' this.$message.success('签出成功') // 处理按钮状态 this.btnStatus.btnLogin = false @@ -284,23 +285,27 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = true this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true - this.btnStatus.btnIdle = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = true this.resetWs() + // TODO: 通知后台已签出 // 清除定时器 clearInterval(this.webVariable.web_hearbeartID) } }, // 外呼 dialOut() { - this.$refs.keyboard.initDialog('out') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('out') + } }, // 内呼 dialIn() { - this.$refs.keyboard.initDialog('in') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('in') + } }, // 拨号 dial(type, tel) { @@ -322,36 +327,54 @@ }, // 示忙 onbusy() { - const strSend = this.createCommand('busy') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('busy') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = true + this.btnStatus.btnIdle = false + } }, // 示闲 onidle() { - const strSend = this.createCommand('idle') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('idle') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = false + this.btnStatus.btnIdle = true + } }, // 挂机 hangup() { - const strSend = this.createCommand('hangup') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hangup') + this.webSocket.send(strSend) + } }, // 保持 hold() { - const strSend = this.createCommand('hold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { // 判断坐席状态,判断通话状态 + if (this.judgeCallStatus()) { + const strSend = this.createCommand('hold') + this.webSocket.send(strSend) + } + } }, // 解除保持 unhold() { - const strSend = this.createCommand('unhold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('unhold') + this.webSocket.send(strSend) + } }, // 三方通话 threeWay() { - const sendObj = { - dialString: this.threeWayPhone + if (this.judgeStatus()) { + const sendObj = { + dialString: this.threeWayPhone + } + const strSend = this.createCommand('threeWay', sendObj) + this.webSocket.send(strSend) } - const strSend = this.createCommand('threeWay', sendObj) - this.webSocket.send(strSend) }, // 处理接通来电事宜 incommingAnswerd(object) { @@ -361,7 +384,7 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = false @@ -374,7 +397,7 @@ } console.log(data) const that = this - setTimeout(function(){ + setTimeout(function() { that.$refs['addcase'].initData(data) }, 500) }, @@ -382,6 +405,15 @@ closeCreateDialog() { this.showAddCase = false // 关闭弹窗 }, + // 进入工作态 + goWorkState() { + // TODO:通知后台进入工作态 + + }, + // 退出工作态 + quitWorkState() { + // TODO:通知后台退出工作态 + }, // 初始化 initSapoOcx() { const { ip, port } = this @@ -531,8 +563,6 @@ if (this.statusShow === true) { // 如果有呼叫弹窗,关闭 this.statusShow = false } - } else { // 话机状态 - this.status = '话机已连接' } } if (name === 'queue status') { @@ -552,18 +582,22 @@ const command = object.command if (command === 'login') { this.handleLoginResult(object) - } - if (command === 'logout') { + } else if (command === 'logout') { this.handleLogoutResult(object) - } - if (command === 'getExtensionList') { + } else if (command === 'getExtensionList') { this.handleExtensionList(object) - } - if (command === 'dial') { + } else if (command === 'dial') { if (object.success === 'true') { this.statusDetailText = object.resultText } - } - if (object.resultText === '准备挂断' && object.success) { + } else if (object.resultText === '准备挂断' && object.success === 'true') { this.statusShow = false + } else if (object.resultText === '准备保持' && object.success === 'true') { + if (object.type === '') { // 保持成功后 + this.btnStatus.btnUnhold = false + this.btnStatus.btnHold = true + } else if (object.type === 'off') { // 解除保持成功后 + this.btnStatus.btnUnhold = true + this.btnStatus.btnHold = false + } } } }, @@ -634,6 +668,24 @@ sendStr += '\n' } return sendStr + }, + // 判断坐席状态 + judgeStatus() { + if (this.status == '已签入') { + return true + } else { + this.$message.warning('请先签入呼叫平台') + return false + } + }, + // 判断通话状态 + judgeCallStatus() { + if (this.isInCall) { + return true + } else { + this.$message.warning('未在通话中') + return false + } } } } diff --git a/src/main.js b/src/main.js index 5630ee7..c9df78f 100644 --- a/src/main.js +++ b/src/main.js @@ -23,8 +23,13 @@ * it will intercept your request, so you won't see the request in the network. * If you remove `../mock` it will automatically request easy-mock data. */ +// if (process.env.NODE_ENV === 'development') { // import './../mock' // simulation data // require('./../mock') +// } else { +// console.log('生产环境') +// } + // 兼容IE11 import 'babel-polyfill' @@ -61,6 +66,15 @@ import VCharts from 'v-charts' Vue.use(VCharts) +// js禁止浏览器的回退快捷键 +history.pushState(null, null, document.URL) +window.addEventListener('popstate', function() { + history.pushState(null, null, document.URL) +}) +// 引入区域级联选项 +import vRegion from 'v-region' +Vue.use(vRegion, {}) + new Vue({ el: '#app', router, diff --git a/src/permission.js b/src/permission.js index 7816c64..74371d4 100644 --- a/src/permission.js +++ b/src/permission.js @@ -40,10 +40,17 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { + debugger + const token = to.query.sid + console.log('==============') + console.log(to.query.sid) // 直接调用登录接口 - store.dispatch('AppLogin').then(() => { + store.dispatch('AppLogin', token).then(() => { Message.success('自动登录成功') - next() + console.log(getToken()) + alert(getToken()) + next({ path: '/' }) + // next() }).catch(() => { Message.error('自动登录失败') next(`/login`) // 否则全部重定向到登录页 diff --git a/src/components/AudioPlayer/AudioPlayer.vue b/src/components/AudioPlayer/AudioPlayer.vue new file mode 100644 index 0000000..c7687fd --- /dev/null +++ b/src/components/AudioPlayer/AudioPlayer.vue @@ -0,0 +1,219 @@ + + + + + + diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index 9bcc449..ba64d8e 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -2,15 +2,14 @@
签入 签出 - 保持 + 保持 解除保持 内呼 外呼 - 保持 挂机 会议 - 小休 - 示忙 + 退出示忙 + 示忙 @@ -37,16 +36,16 @@ - - + + - - + + - - + +
来电号码:{{ number }}
@@ -126,7 +125,7 @@ btnDialIn: true, // 内呼 btnAgentList: true, btnBusy: true, // 示忙 - btnIdle: true, // 示闲 + btnIdle: false, // 示闲 btnMeeting: true, // 会议 btnPickUp: true, btnExtenPickUp: true, @@ -145,7 +144,7 @@ btnGetNumber: true, btnInject: true }, - status: '', + status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 @@ -246,11 +245,12 @@ this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true this.btnStatus.btnBusy = false - this.btnStatus.btnIdle = false - this.btnStatus.btnIdle = false + this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = false this.btnStatus.btnHangUp = false + this.status = '已签入' this.call = '空闲' + // TODO: 通知后台已签入 // 心跳监测定时器 if (this.webVariable.web_hearbeartInterval > 0) { this.webVariable.web_hearbeartID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_hearbeartID * 1000) @@ -275,7 +275,8 @@ }, // 处理签出成功之后的操作 handleLogoutResult(object) { - if (object.success) { + if (object.success === 'true') { + this.status = '未签入' this.$message.success('签出成功') // 处理按钮状态 this.btnStatus.btnLogin = false @@ -284,23 +285,27 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = true this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true - this.btnStatus.btnIdle = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = true this.resetWs() + // TODO: 通知后台已签出 // 清除定时器 clearInterval(this.webVariable.web_hearbeartID) } }, // 外呼 dialOut() { - this.$refs.keyboard.initDialog('out') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('out') + } }, // 内呼 dialIn() { - this.$refs.keyboard.initDialog('in') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('in') + } }, // 拨号 dial(type, tel) { @@ -322,36 +327,54 @@ }, // 示忙 onbusy() { - const strSend = this.createCommand('busy') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('busy') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = true + this.btnStatus.btnIdle = false + } }, // 示闲 onidle() { - const strSend = this.createCommand('idle') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('idle') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = false + this.btnStatus.btnIdle = true + } }, // 挂机 hangup() { - const strSend = this.createCommand('hangup') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hangup') + this.webSocket.send(strSend) + } }, // 保持 hold() { - const strSend = this.createCommand('hold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { // 判断坐席状态,判断通话状态 + if (this.judgeCallStatus()) { + const strSend = this.createCommand('hold') + this.webSocket.send(strSend) + } + } }, // 解除保持 unhold() { - const strSend = this.createCommand('unhold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('unhold') + this.webSocket.send(strSend) + } }, // 三方通话 threeWay() { - const sendObj = { - dialString: this.threeWayPhone + if (this.judgeStatus()) { + const sendObj = { + dialString: this.threeWayPhone + } + const strSend = this.createCommand('threeWay', sendObj) + this.webSocket.send(strSend) } - const strSend = this.createCommand('threeWay', sendObj) - this.webSocket.send(strSend) }, // 处理接通来电事宜 incommingAnswerd(object) { @@ -361,7 +384,7 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = false @@ -374,7 +397,7 @@ } console.log(data) const that = this - setTimeout(function(){ + setTimeout(function() { that.$refs['addcase'].initData(data) }, 500) }, @@ -382,6 +405,15 @@ closeCreateDialog() { this.showAddCase = false // 关闭弹窗 }, + // 进入工作态 + goWorkState() { + // TODO:通知后台进入工作态 + + }, + // 退出工作态 + quitWorkState() { + // TODO:通知后台退出工作态 + }, // 初始化 initSapoOcx() { const { ip, port } = this @@ -531,8 +563,6 @@ if (this.statusShow === true) { // 如果有呼叫弹窗,关闭 this.statusShow = false } - } else { // 话机状态 - this.status = '话机已连接' } } if (name === 'queue status') { @@ -552,18 +582,22 @@ const command = object.command if (command === 'login') { this.handleLoginResult(object) - } - if (command === 'logout') { + } else if (command === 'logout') { this.handleLogoutResult(object) - } - if (command === 'getExtensionList') { + } else if (command === 'getExtensionList') { this.handleExtensionList(object) - } - if (command === 'dial') { + } else if (command === 'dial') { if (object.success === 'true') { this.statusDetailText = object.resultText } - } - if (object.resultText === '准备挂断' && object.success) { + } else if (object.resultText === '准备挂断' && object.success === 'true') { this.statusShow = false + } else if (object.resultText === '准备保持' && object.success === 'true') { + if (object.type === '') { // 保持成功后 + this.btnStatus.btnUnhold = false + this.btnStatus.btnHold = true + } else if (object.type === 'off') { // 解除保持成功后 + this.btnStatus.btnUnhold = true + this.btnStatus.btnHold = false + } } } }, @@ -634,6 +668,24 @@ sendStr += '\n' } return sendStr + }, + // 判断坐席状态 + judgeStatus() { + if (this.status == '已签入') { + return true + } else { + this.$message.warning('请先签入呼叫平台') + return false + } + }, + // 判断通话状态 + judgeCallStatus() { + if (this.isInCall) { + return true + } else { + this.$message.warning('未在通话中') + return false + } } } } diff --git a/src/main.js b/src/main.js index 5630ee7..c9df78f 100644 --- a/src/main.js +++ b/src/main.js @@ -23,8 +23,13 @@ * it will intercept your request, so you won't see the request in the network. * If you remove `../mock` it will automatically request easy-mock data. */ +// if (process.env.NODE_ENV === 'development') { // import './../mock' // simulation data // require('./../mock') +// } else { +// console.log('生产环境') +// } + // 兼容IE11 import 'babel-polyfill' @@ -61,6 +66,15 @@ import VCharts from 'v-charts' Vue.use(VCharts) +// js禁止浏览器的回退快捷键 +history.pushState(null, null, document.URL) +window.addEventListener('popstate', function() { + history.pushState(null, null, document.URL) +}) +// 引入区域级联选项 +import vRegion from 'v-region' +Vue.use(vRegion, {}) + new Vue({ el: '#app', router, diff --git a/src/permission.js b/src/permission.js index 7816c64..74371d4 100644 --- a/src/permission.js +++ b/src/permission.js @@ -40,10 +40,17 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { + debugger + const token = to.query.sid + console.log('==============') + console.log(to.query.sid) // 直接调用登录接口 - store.dispatch('AppLogin').then(() => { + store.dispatch('AppLogin', token).then(() => { Message.success('自动登录成功') - next() + console.log(getToken()) + alert(getToken()) + next({ path: '/' }) + // next() }).catch(() => { Message.error('自动登录失败') next(`/login`) // 否则全部重定向到登录页 diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8ff9a57..bb8eaa0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -76,20 +76,28 @@ }) }, // 登录 - AppLogin({ commit }, userInfo) { + AppLogin({ commit }, token) { return new Promise((resolve, reject) => { - applogin(userInfo).then(response => { - if (response.code === 200) { - const data = response.data - setToken(data.token) - commit('SET_TOKEN', data.token) - resolve() - } else { - reject(response.message) - } - }).catch(error => { - reject(error) - }) + if (token) { + debugger + setToken(token) + commit('SET_TOKEN', token) + resolve() + } else { + window.location.href = 'http://10.18.0.50:8086/platform-sso-server/login?service=' + process.env.BASE_API + '/app/caslogin' + // applogin().then(response => { + // if (response.code === 200) { + // const data = response.data + // setToken(data.token) + // commit('SET_TOKEN', data.token) + // resolve() + // } else { + // reject(response.message) + // } + // }).catch(error => { + // reject(error) + // }) + } }) }, // 获取用户信息 diff --git a/src/components/AudioPlayer/AudioPlayer.vue b/src/components/AudioPlayer/AudioPlayer.vue new file mode 100644 index 0000000..c7687fd --- /dev/null +++ b/src/components/AudioPlayer/AudioPlayer.vue @@ -0,0 +1,219 @@ + + + + + + diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index 9bcc449..ba64d8e 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -2,15 +2,14 @@
签入 签出 - 保持 + 保持 解除保持 内呼 外呼 - 保持 挂机 会议 - 小休 - 示忙 + 退出示忙 + 示忙 @@ -37,16 +36,16 @@ - - + + - - + + - - + +
来电号码:{{ number }}
@@ -126,7 +125,7 @@ btnDialIn: true, // 内呼 btnAgentList: true, btnBusy: true, // 示忙 - btnIdle: true, // 示闲 + btnIdle: false, // 示闲 btnMeeting: true, // 会议 btnPickUp: true, btnExtenPickUp: true, @@ -145,7 +144,7 @@ btnGetNumber: true, btnInject: true }, - status: '', + status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 @@ -246,11 +245,12 @@ this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true this.btnStatus.btnBusy = false - this.btnStatus.btnIdle = false - this.btnStatus.btnIdle = false + this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = false this.btnStatus.btnHangUp = false + this.status = '已签入' this.call = '空闲' + // TODO: 通知后台已签入 // 心跳监测定时器 if (this.webVariable.web_hearbeartInterval > 0) { this.webVariable.web_hearbeartID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_hearbeartID * 1000) @@ -275,7 +275,8 @@ }, // 处理签出成功之后的操作 handleLogoutResult(object) { - if (object.success) { + if (object.success === 'true') { + this.status = '未签入' this.$message.success('签出成功') // 处理按钮状态 this.btnStatus.btnLogin = false @@ -284,23 +285,27 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = true this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true - this.btnStatus.btnIdle = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = true this.resetWs() + // TODO: 通知后台已签出 // 清除定时器 clearInterval(this.webVariable.web_hearbeartID) } }, // 外呼 dialOut() { - this.$refs.keyboard.initDialog('out') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('out') + } }, // 内呼 dialIn() { - this.$refs.keyboard.initDialog('in') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('in') + } }, // 拨号 dial(type, tel) { @@ -322,36 +327,54 @@ }, // 示忙 onbusy() { - const strSend = this.createCommand('busy') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('busy') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = true + this.btnStatus.btnIdle = false + } }, // 示闲 onidle() { - const strSend = this.createCommand('idle') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('idle') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = false + this.btnStatus.btnIdle = true + } }, // 挂机 hangup() { - const strSend = this.createCommand('hangup') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hangup') + this.webSocket.send(strSend) + } }, // 保持 hold() { - const strSend = this.createCommand('hold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { // 判断坐席状态,判断通话状态 + if (this.judgeCallStatus()) { + const strSend = this.createCommand('hold') + this.webSocket.send(strSend) + } + } }, // 解除保持 unhold() { - const strSend = this.createCommand('unhold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('unhold') + this.webSocket.send(strSend) + } }, // 三方通话 threeWay() { - const sendObj = { - dialString: this.threeWayPhone + if (this.judgeStatus()) { + const sendObj = { + dialString: this.threeWayPhone + } + const strSend = this.createCommand('threeWay', sendObj) + this.webSocket.send(strSend) } - const strSend = this.createCommand('threeWay', sendObj) - this.webSocket.send(strSend) }, // 处理接通来电事宜 incommingAnswerd(object) { @@ -361,7 +384,7 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = false @@ -374,7 +397,7 @@ } console.log(data) const that = this - setTimeout(function(){ + setTimeout(function() { that.$refs['addcase'].initData(data) }, 500) }, @@ -382,6 +405,15 @@ closeCreateDialog() { this.showAddCase = false // 关闭弹窗 }, + // 进入工作态 + goWorkState() { + // TODO:通知后台进入工作态 + + }, + // 退出工作态 + quitWorkState() { + // TODO:通知后台退出工作态 + }, // 初始化 initSapoOcx() { const { ip, port } = this @@ -531,8 +563,6 @@ if (this.statusShow === true) { // 如果有呼叫弹窗,关闭 this.statusShow = false } - } else { // 话机状态 - this.status = '话机已连接' } } if (name === 'queue status') { @@ -552,18 +582,22 @@ const command = object.command if (command === 'login') { this.handleLoginResult(object) - } - if (command === 'logout') { + } else if (command === 'logout') { this.handleLogoutResult(object) - } - if (command === 'getExtensionList') { + } else if (command === 'getExtensionList') { this.handleExtensionList(object) - } - if (command === 'dial') { + } else if (command === 'dial') { if (object.success === 'true') { this.statusDetailText = object.resultText } - } - if (object.resultText === '准备挂断' && object.success) { + } else if (object.resultText === '准备挂断' && object.success === 'true') { this.statusShow = false + } else if (object.resultText === '准备保持' && object.success === 'true') { + if (object.type === '') { // 保持成功后 + this.btnStatus.btnUnhold = false + this.btnStatus.btnHold = true + } else if (object.type === 'off') { // 解除保持成功后 + this.btnStatus.btnUnhold = true + this.btnStatus.btnHold = false + } } } }, @@ -634,6 +668,24 @@ sendStr += '\n' } return sendStr + }, + // 判断坐席状态 + judgeStatus() { + if (this.status == '已签入') { + return true + } else { + this.$message.warning('请先签入呼叫平台') + return false + } + }, + // 判断通话状态 + judgeCallStatus() { + if (this.isInCall) { + return true + } else { + this.$message.warning('未在通话中') + return false + } } } } diff --git a/src/main.js b/src/main.js index 5630ee7..c9df78f 100644 --- a/src/main.js +++ b/src/main.js @@ -23,8 +23,13 @@ * it will intercept your request, so you won't see the request in the network. * If you remove `../mock` it will automatically request easy-mock data. */ +// if (process.env.NODE_ENV === 'development') { // import './../mock' // simulation data // require('./../mock') +// } else { +// console.log('生产环境') +// } + // 兼容IE11 import 'babel-polyfill' @@ -61,6 +66,15 @@ import VCharts from 'v-charts' Vue.use(VCharts) +// js禁止浏览器的回退快捷键 +history.pushState(null, null, document.URL) +window.addEventListener('popstate', function() { + history.pushState(null, null, document.URL) +}) +// 引入区域级联选项 +import vRegion from 'v-region' +Vue.use(vRegion, {}) + new Vue({ el: '#app', router, diff --git a/src/permission.js b/src/permission.js index 7816c64..74371d4 100644 --- a/src/permission.js +++ b/src/permission.js @@ -40,10 +40,17 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { + debugger + const token = to.query.sid + console.log('==============') + console.log(to.query.sid) // 直接调用登录接口 - store.dispatch('AppLogin').then(() => { + store.dispatch('AppLogin', token).then(() => { Message.success('自动登录成功') - next() + console.log(getToken()) + alert(getToken()) + next({ path: '/' }) + // next() }).catch(() => { Message.error('自动登录失败') next(`/login`) // 否则全部重定向到登录页 diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8ff9a57..bb8eaa0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -76,20 +76,28 @@ }) }, // 登录 - AppLogin({ commit }, userInfo) { + AppLogin({ commit }, token) { return new Promise((resolve, reject) => { - applogin(userInfo).then(response => { - if (response.code === 200) { - const data = response.data - setToken(data.token) - commit('SET_TOKEN', data.token) - resolve() - } else { - reject(response.message) - } - }).catch(error => { - reject(error) - }) + if (token) { + debugger + setToken(token) + commit('SET_TOKEN', token) + resolve() + } else { + window.location.href = 'http://10.18.0.50:8086/platform-sso-server/login?service=' + process.env.BASE_API + '/app/caslogin' + // applogin().then(response => { + // if (response.code === 200) { + // const data = response.data + // setToken(data.token) + // commit('SET_TOKEN', data.token) + // resolve() + // } else { + // reject(response.message) + // } + // }).catch(error => { + // reject(error) + // }) + } }) }, // 获取用户信息 diff --git a/src/utils/stringutils.js b/src/utils/stringutils.js new file mode 100644 index 0000000..4ff753d --- /dev/null +++ b/src/utils/stringutils.js @@ -0,0 +1,13 @@ +export function realFormatSecond(second) { + var secondType = typeof second + if (secondType === 'number' || secondType === 'string') { + second = parseInt(second) + var hours = Math.floor(second / 3600) + second = second - hours * 3600 + var mimute = Math.floor(second / 60) + second = second - mimute * 60 + return hours + ':' + ('0' + mimute).slice(-2) + ':' + ('0' + second).slice(-2) + } else { + return '0:00:00' + } +} diff --git a/src/components/AudioPlayer/AudioPlayer.vue b/src/components/AudioPlayer/AudioPlayer.vue new file mode 100644 index 0000000..c7687fd --- /dev/null +++ b/src/components/AudioPlayer/AudioPlayer.vue @@ -0,0 +1,219 @@ + + + + + + diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index 9bcc449..ba64d8e 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -2,15 +2,14 @@
签入 签出 - 保持 + 保持 解除保持 内呼 外呼 - 保持 挂机 会议 - 小休 - 示忙 + 退出示忙 + 示忙 @@ -37,16 +36,16 @@ - - + + - - + + - - + +
来电号码:{{ number }}
@@ -126,7 +125,7 @@ btnDialIn: true, // 内呼 btnAgentList: true, btnBusy: true, // 示忙 - btnIdle: true, // 示闲 + btnIdle: false, // 示闲 btnMeeting: true, // 会议 btnPickUp: true, btnExtenPickUp: true, @@ -145,7 +144,7 @@ btnGetNumber: true, btnInject: true }, - status: '', + status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 @@ -246,11 +245,12 @@ this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true this.btnStatus.btnBusy = false - this.btnStatus.btnIdle = false - this.btnStatus.btnIdle = false + this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = false this.btnStatus.btnHangUp = false + this.status = '已签入' this.call = '空闲' + // TODO: 通知后台已签入 // 心跳监测定时器 if (this.webVariable.web_hearbeartInterval > 0) { this.webVariable.web_hearbeartID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_hearbeartID * 1000) @@ -275,7 +275,8 @@ }, // 处理签出成功之后的操作 handleLogoutResult(object) { - if (object.success) { + if (object.success === 'true') { + this.status = '未签入' this.$message.success('签出成功') // 处理按钮状态 this.btnStatus.btnLogin = false @@ -284,23 +285,27 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = true this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true - this.btnStatus.btnIdle = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = true this.resetWs() + // TODO: 通知后台已签出 // 清除定时器 clearInterval(this.webVariable.web_hearbeartID) } }, // 外呼 dialOut() { - this.$refs.keyboard.initDialog('out') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('out') + } }, // 内呼 dialIn() { - this.$refs.keyboard.initDialog('in') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('in') + } }, // 拨号 dial(type, tel) { @@ -322,36 +327,54 @@ }, // 示忙 onbusy() { - const strSend = this.createCommand('busy') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('busy') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = true + this.btnStatus.btnIdle = false + } }, // 示闲 onidle() { - const strSend = this.createCommand('idle') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('idle') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = false + this.btnStatus.btnIdle = true + } }, // 挂机 hangup() { - const strSend = this.createCommand('hangup') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hangup') + this.webSocket.send(strSend) + } }, // 保持 hold() { - const strSend = this.createCommand('hold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { // 判断坐席状态,判断通话状态 + if (this.judgeCallStatus()) { + const strSend = this.createCommand('hold') + this.webSocket.send(strSend) + } + } }, // 解除保持 unhold() { - const strSend = this.createCommand('unhold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('unhold') + this.webSocket.send(strSend) + } }, // 三方通话 threeWay() { - const sendObj = { - dialString: this.threeWayPhone + if (this.judgeStatus()) { + const sendObj = { + dialString: this.threeWayPhone + } + const strSend = this.createCommand('threeWay', sendObj) + this.webSocket.send(strSend) } - const strSend = this.createCommand('threeWay', sendObj) - this.webSocket.send(strSend) }, // 处理接通来电事宜 incommingAnswerd(object) { @@ -361,7 +384,7 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = false @@ -374,7 +397,7 @@ } console.log(data) const that = this - setTimeout(function(){ + setTimeout(function() { that.$refs['addcase'].initData(data) }, 500) }, @@ -382,6 +405,15 @@ closeCreateDialog() { this.showAddCase = false // 关闭弹窗 }, + // 进入工作态 + goWorkState() { + // TODO:通知后台进入工作态 + + }, + // 退出工作态 + quitWorkState() { + // TODO:通知后台退出工作态 + }, // 初始化 initSapoOcx() { const { ip, port } = this @@ -531,8 +563,6 @@ if (this.statusShow === true) { // 如果有呼叫弹窗,关闭 this.statusShow = false } - } else { // 话机状态 - this.status = '话机已连接' } } if (name === 'queue status') { @@ -552,18 +582,22 @@ const command = object.command if (command === 'login') { this.handleLoginResult(object) - } - if (command === 'logout') { + } else if (command === 'logout') { this.handleLogoutResult(object) - } - if (command === 'getExtensionList') { + } else if (command === 'getExtensionList') { this.handleExtensionList(object) - } - if (command === 'dial') { + } else if (command === 'dial') { if (object.success === 'true') { this.statusDetailText = object.resultText } - } - if (object.resultText === '准备挂断' && object.success) { + } else if (object.resultText === '准备挂断' && object.success === 'true') { this.statusShow = false + } else if (object.resultText === '准备保持' && object.success === 'true') { + if (object.type === '') { // 保持成功后 + this.btnStatus.btnUnhold = false + this.btnStatus.btnHold = true + } else if (object.type === 'off') { // 解除保持成功后 + this.btnStatus.btnUnhold = true + this.btnStatus.btnHold = false + } } } }, @@ -634,6 +668,24 @@ sendStr += '\n' } return sendStr + }, + // 判断坐席状态 + judgeStatus() { + if (this.status == '已签入') { + return true + } else { + this.$message.warning('请先签入呼叫平台') + return false + } + }, + // 判断通话状态 + judgeCallStatus() { + if (this.isInCall) { + return true + } else { + this.$message.warning('未在通话中') + return false + } } } } diff --git a/src/main.js b/src/main.js index 5630ee7..c9df78f 100644 --- a/src/main.js +++ b/src/main.js @@ -23,8 +23,13 @@ * it will intercept your request, so you won't see the request in the network. * If you remove `../mock` it will automatically request easy-mock data. */ +// if (process.env.NODE_ENV === 'development') { // import './../mock' // simulation data // require('./../mock') +// } else { +// console.log('生产环境') +// } + // 兼容IE11 import 'babel-polyfill' @@ -61,6 +66,15 @@ import VCharts from 'v-charts' Vue.use(VCharts) +// js禁止浏览器的回退快捷键 +history.pushState(null, null, document.URL) +window.addEventListener('popstate', function() { + history.pushState(null, null, document.URL) +}) +// 引入区域级联选项 +import vRegion from 'v-region' +Vue.use(vRegion, {}) + new Vue({ el: '#app', router, diff --git a/src/permission.js b/src/permission.js index 7816c64..74371d4 100644 --- a/src/permission.js +++ b/src/permission.js @@ -40,10 +40,17 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { + debugger + const token = to.query.sid + console.log('==============') + console.log(to.query.sid) // 直接调用登录接口 - store.dispatch('AppLogin').then(() => { + store.dispatch('AppLogin', token).then(() => { Message.success('自动登录成功') - next() + console.log(getToken()) + alert(getToken()) + next({ path: '/' }) + // next() }).catch(() => { Message.error('自动登录失败') next(`/login`) // 否则全部重定向到登录页 diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8ff9a57..bb8eaa0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -76,20 +76,28 @@ }) }, // 登录 - AppLogin({ commit }, userInfo) { + AppLogin({ commit }, token) { return new Promise((resolve, reject) => { - applogin(userInfo).then(response => { - if (response.code === 200) { - const data = response.data - setToken(data.token) - commit('SET_TOKEN', data.token) - resolve() - } else { - reject(response.message) - } - }).catch(error => { - reject(error) - }) + if (token) { + debugger + setToken(token) + commit('SET_TOKEN', token) + resolve() + } else { + window.location.href = 'http://10.18.0.50:8086/platform-sso-server/login?service=' + process.env.BASE_API + '/app/caslogin' + // applogin().then(response => { + // if (response.code === 200) { + // const data = response.data + // setToken(data.token) + // commit('SET_TOKEN', data.token) + // resolve() + // } else { + // reject(response.message) + // } + // }).catch(error => { + // reject(error) + // }) + } }) }, // 获取用户信息 diff --git a/src/utils/stringutils.js b/src/utils/stringutils.js new file mode 100644 index 0000000..4ff753d --- /dev/null +++ b/src/utils/stringutils.js @@ -0,0 +1,13 @@ +export function realFormatSecond(second) { + var secondType = typeof second + if (secondType === 'number' || secondType === 'string') { + second = parseInt(second) + var hours = Math.floor(second / 3600) + second = second - hours * 3600 + var mimute = Math.floor(second / 60) + second = second - mimute * 60 + return hours + ':' + ('0' + mimute).slice(-2) + ':' + ('0' + second).slice(-2) + } else { + return '0:00:00' + } +} diff --git a/src/views/caseManage/components/knowledgeDetail.vue b/src/views/caseManage/components/knowledgeDetail.vue new file mode 100644 index 0000000..f4ec86b --- /dev/null +++ b/src/views/caseManage/components/knowledgeDetail.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/components/AudioPlayer/AudioPlayer.vue b/src/components/AudioPlayer/AudioPlayer.vue new file mode 100644 index 0000000..c7687fd --- /dev/null +++ b/src/components/AudioPlayer/AudioPlayer.vue @@ -0,0 +1,219 @@ + + + + + + diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index 9bcc449..ba64d8e 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -2,15 +2,14 @@
签入 签出 - 保持 + 保持 解除保持 内呼 外呼 - 保持 挂机 会议 - 小休 - 示忙 + 退出示忙 + 示忙 @@ -37,16 +36,16 @@ - - + + - - + + - - + +
来电号码:{{ number }}
@@ -126,7 +125,7 @@ btnDialIn: true, // 内呼 btnAgentList: true, btnBusy: true, // 示忙 - btnIdle: true, // 示闲 + btnIdle: false, // 示闲 btnMeeting: true, // 会议 btnPickUp: true, btnExtenPickUp: true, @@ -145,7 +144,7 @@ btnGetNumber: true, btnInject: true }, - status: '', + status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 @@ -246,11 +245,12 @@ this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true this.btnStatus.btnBusy = false - this.btnStatus.btnIdle = false - this.btnStatus.btnIdle = false + this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = false this.btnStatus.btnHangUp = false + this.status = '已签入' this.call = '空闲' + // TODO: 通知后台已签入 // 心跳监测定时器 if (this.webVariable.web_hearbeartInterval > 0) { this.webVariable.web_hearbeartID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_hearbeartID * 1000) @@ -275,7 +275,8 @@ }, // 处理签出成功之后的操作 handleLogoutResult(object) { - if (object.success) { + if (object.success === 'true') { + this.status = '未签入' this.$message.success('签出成功') // 处理按钮状态 this.btnStatus.btnLogin = false @@ -284,23 +285,27 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = true this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true - this.btnStatus.btnIdle = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = true this.resetWs() + // TODO: 通知后台已签出 // 清除定时器 clearInterval(this.webVariable.web_hearbeartID) } }, // 外呼 dialOut() { - this.$refs.keyboard.initDialog('out') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('out') + } }, // 内呼 dialIn() { - this.$refs.keyboard.initDialog('in') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('in') + } }, // 拨号 dial(type, tel) { @@ -322,36 +327,54 @@ }, // 示忙 onbusy() { - const strSend = this.createCommand('busy') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('busy') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = true + this.btnStatus.btnIdle = false + } }, // 示闲 onidle() { - const strSend = this.createCommand('idle') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('idle') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = false + this.btnStatus.btnIdle = true + } }, // 挂机 hangup() { - const strSend = this.createCommand('hangup') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hangup') + this.webSocket.send(strSend) + } }, // 保持 hold() { - const strSend = this.createCommand('hold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { // 判断坐席状态,判断通话状态 + if (this.judgeCallStatus()) { + const strSend = this.createCommand('hold') + this.webSocket.send(strSend) + } + } }, // 解除保持 unhold() { - const strSend = this.createCommand('unhold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('unhold') + this.webSocket.send(strSend) + } }, // 三方通话 threeWay() { - const sendObj = { - dialString: this.threeWayPhone + if (this.judgeStatus()) { + const sendObj = { + dialString: this.threeWayPhone + } + const strSend = this.createCommand('threeWay', sendObj) + this.webSocket.send(strSend) } - const strSend = this.createCommand('threeWay', sendObj) - this.webSocket.send(strSend) }, // 处理接通来电事宜 incommingAnswerd(object) { @@ -361,7 +384,7 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = false @@ -374,7 +397,7 @@ } console.log(data) const that = this - setTimeout(function(){ + setTimeout(function() { that.$refs['addcase'].initData(data) }, 500) }, @@ -382,6 +405,15 @@ closeCreateDialog() { this.showAddCase = false // 关闭弹窗 }, + // 进入工作态 + goWorkState() { + // TODO:通知后台进入工作态 + + }, + // 退出工作态 + quitWorkState() { + // TODO:通知后台退出工作态 + }, // 初始化 initSapoOcx() { const { ip, port } = this @@ -531,8 +563,6 @@ if (this.statusShow === true) { // 如果有呼叫弹窗,关闭 this.statusShow = false } - } else { // 话机状态 - this.status = '话机已连接' } } if (name === 'queue status') { @@ -552,18 +582,22 @@ const command = object.command if (command === 'login') { this.handleLoginResult(object) - } - if (command === 'logout') { + } else if (command === 'logout') { this.handleLogoutResult(object) - } - if (command === 'getExtensionList') { + } else if (command === 'getExtensionList') { this.handleExtensionList(object) - } - if (command === 'dial') { + } else if (command === 'dial') { if (object.success === 'true') { this.statusDetailText = object.resultText } - } - if (object.resultText === '准备挂断' && object.success) { + } else if (object.resultText === '准备挂断' && object.success === 'true') { this.statusShow = false + } else if (object.resultText === '准备保持' && object.success === 'true') { + if (object.type === '') { // 保持成功后 + this.btnStatus.btnUnhold = false + this.btnStatus.btnHold = true + } else if (object.type === 'off') { // 解除保持成功后 + this.btnStatus.btnUnhold = true + this.btnStatus.btnHold = false + } } } }, @@ -634,6 +668,24 @@ sendStr += '\n' } return sendStr + }, + // 判断坐席状态 + judgeStatus() { + if (this.status == '已签入') { + return true + } else { + this.$message.warning('请先签入呼叫平台') + return false + } + }, + // 判断通话状态 + judgeCallStatus() { + if (this.isInCall) { + return true + } else { + this.$message.warning('未在通话中') + return false + } } } } diff --git a/src/main.js b/src/main.js index 5630ee7..c9df78f 100644 --- a/src/main.js +++ b/src/main.js @@ -23,8 +23,13 @@ * it will intercept your request, so you won't see the request in the network. * If you remove `../mock` it will automatically request easy-mock data. */ +// if (process.env.NODE_ENV === 'development') { // import './../mock' // simulation data // require('./../mock') +// } else { +// console.log('生产环境') +// } + // 兼容IE11 import 'babel-polyfill' @@ -61,6 +66,15 @@ import VCharts from 'v-charts' Vue.use(VCharts) +// js禁止浏览器的回退快捷键 +history.pushState(null, null, document.URL) +window.addEventListener('popstate', function() { + history.pushState(null, null, document.URL) +}) +// 引入区域级联选项 +import vRegion from 'v-region' +Vue.use(vRegion, {}) + new Vue({ el: '#app', router, diff --git a/src/permission.js b/src/permission.js index 7816c64..74371d4 100644 --- a/src/permission.js +++ b/src/permission.js @@ -40,10 +40,17 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { + debugger + const token = to.query.sid + console.log('==============') + console.log(to.query.sid) // 直接调用登录接口 - store.dispatch('AppLogin').then(() => { + store.dispatch('AppLogin', token).then(() => { Message.success('自动登录成功') - next() + console.log(getToken()) + alert(getToken()) + next({ path: '/' }) + // next() }).catch(() => { Message.error('自动登录失败') next(`/login`) // 否则全部重定向到登录页 diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8ff9a57..bb8eaa0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -76,20 +76,28 @@ }) }, // 登录 - AppLogin({ commit }, userInfo) { + AppLogin({ commit }, token) { return new Promise((resolve, reject) => { - applogin(userInfo).then(response => { - if (response.code === 200) { - const data = response.data - setToken(data.token) - commit('SET_TOKEN', data.token) - resolve() - } else { - reject(response.message) - } - }).catch(error => { - reject(error) - }) + if (token) { + debugger + setToken(token) + commit('SET_TOKEN', token) + resolve() + } else { + window.location.href = 'http://10.18.0.50:8086/platform-sso-server/login?service=' + process.env.BASE_API + '/app/caslogin' + // applogin().then(response => { + // if (response.code === 200) { + // const data = response.data + // setToken(data.token) + // commit('SET_TOKEN', data.token) + // resolve() + // } else { + // reject(response.message) + // } + // }).catch(error => { + // reject(error) + // }) + } }) }, // 获取用户信息 diff --git a/src/utils/stringutils.js b/src/utils/stringutils.js new file mode 100644 index 0000000..4ff753d --- /dev/null +++ b/src/utils/stringutils.js @@ -0,0 +1,13 @@ +export function realFormatSecond(second) { + var secondType = typeof second + if (secondType === 'number' || secondType === 'string') { + second = parseInt(second) + var hours = Math.floor(second / 3600) + second = second - hours * 3600 + var mimute = Math.floor(second / 60) + second = second - mimute * 60 + return hours + ':' + ('0' + mimute).slice(-2) + ':' + ('0' + second).slice(-2) + } else { + return '0:00:00' + } +} diff --git a/src/views/caseManage/components/knowledgeDetail.vue b/src/views/caseManage/components/knowledgeDetail.vue new file mode 100644 index 0000000..f4ec86b --- /dev/null +++ b/src/views/caseManage/components/knowledgeDetail.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/views/caseManage/components/knowledgeSearch.vue b/src/views/caseManage/components/knowledgeSearch.vue index 97a9021..d632d26 100644 --- a/src/views/caseManage/components/knowledgeSearch.vue +++ b/src/views/caseManage/components/knowledgeSearch.vue @@ -6,19 +6,24 @@ 知识查找
-
- -
{{ item.kName }}
-
{{ item.kInfo }}
-
-
+ +
+ +
{{ item.kName }} _知识库_ {{ item.kTypeName }}
+
{{ item.kInfo }}
+
+
+
+
+ + + diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index 9bcc449..ba64d8e 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -2,15 +2,14 @@
签入 签出 - 保持 + 保持 解除保持 内呼 外呼 - 保持 挂机 会议 - 小休 - 示忙 + 退出示忙 + 示忙 @@ -37,16 +36,16 @@ - - + + - - + + - - + +
来电号码:{{ number }}
@@ -126,7 +125,7 @@ btnDialIn: true, // 内呼 btnAgentList: true, btnBusy: true, // 示忙 - btnIdle: true, // 示闲 + btnIdle: false, // 示闲 btnMeeting: true, // 会议 btnPickUp: true, btnExtenPickUp: true, @@ -145,7 +144,7 @@ btnGetNumber: true, btnInject: true }, - status: '', + status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 @@ -246,11 +245,12 @@ this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true this.btnStatus.btnBusy = false - this.btnStatus.btnIdle = false - this.btnStatus.btnIdle = false + this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = false this.btnStatus.btnHangUp = false + this.status = '已签入' this.call = '空闲' + // TODO: 通知后台已签入 // 心跳监测定时器 if (this.webVariable.web_hearbeartInterval > 0) { this.webVariable.web_hearbeartID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_hearbeartID * 1000) @@ -275,7 +275,8 @@ }, // 处理签出成功之后的操作 handleLogoutResult(object) { - if (object.success) { + if (object.success === 'true') { + this.status = '未签入' this.$message.success('签出成功') // 处理按钮状态 this.btnStatus.btnLogin = false @@ -284,23 +285,27 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = true this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true - this.btnStatus.btnIdle = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = true this.resetWs() + // TODO: 通知后台已签出 // 清除定时器 clearInterval(this.webVariable.web_hearbeartID) } }, // 外呼 dialOut() { - this.$refs.keyboard.initDialog('out') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('out') + } }, // 内呼 dialIn() { - this.$refs.keyboard.initDialog('in') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('in') + } }, // 拨号 dial(type, tel) { @@ -322,36 +327,54 @@ }, // 示忙 onbusy() { - const strSend = this.createCommand('busy') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('busy') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = true + this.btnStatus.btnIdle = false + } }, // 示闲 onidle() { - const strSend = this.createCommand('idle') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('idle') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = false + this.btnStatus.btnIdle = true + } }, // 挂机 hangup() { - const strSend = this.createCommand('hangup') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hangup') + this.webSocket.send(strSend) + } }, // 保持 hold() { - const strSend = this.createCommand('hold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { // 判断坐席状态,判断通话状态 + if (this.judgeCallStatus()) { + const strSend = this.createCommand('hold') + this.webSocket.send(strSend) + } + } }, // 解除保持 unhold() { - const strSend = this.createCommand('unhold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('unhold') + this.webSocket.send(strSend) + } }, // 三方通话 threeWay() { - const sendObj = { - dialString: this.threeWayPhone + if (this.judgeStatus()) { + const sendObj = { + dialString: this.threeWayPhone + } + const strSend = this.createCommand('threeWay', sendObj) + this.webSocket.send(strSend) } - const strSend = this.createCommand('threeWay', sendObj) - this.webSocket.send(strSend) }, // 处理接通来电事宜 incommingAnswerd(object) { @@ -361,7 +384,7 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = false @@ -374,7 +397,7 @@ } console.log(data) const that = this - setTimeout(function(){ + setTimeout(function() { that.$refs['addcase'].initData(data) }, 500) }, @@ -382,6 +405,15 @@ closeCreateDialog() { this.showAddCase = false // 关闭弹窗 }, + // 进入工作态 + goWorkState() { + // TODO:通知后台进入工作态 + + }, + // 退出工作态 + quitWorkState() { + // TODO:通知后台退出工作态 + }, // 初始化 initSapoOcx() { const { ip, port } = this @@ -531,8 +563,6 @@ if (this.statusShow === true) { // 如果有呼叫弹窗,关闭 this.statusShow = false } - } else { // 话机状态 - this.status = '话机已连接' } } if (name === 'queue status') { @@ -552,18 +582,22 @@ const command = object.command if (command === 'login') { this.handleLoginResult(object) - } - if (command === 'logout') { + } else if (command === 'logout') { this.handleLogoutResult(object) - } - if (command === 'getExtensionList') { + } else if (command === 'getExtensionList') { this.handleExtensionList(object) - } - if (command === 'dial') { + } else if (command === 'dial') { if (object.success === 'true') { this.statusDetailText = object.resultText } - } - if (object.resultText === '准备挂断' && object.success) { + } else if (object.resultText === '准备挂断' && object.success === 'true') { this.statusShow = false + } else if (object.resultText === '准备保持' && object.success === 'true') { + if (object.type === '') { // 保持成功后 + this.btnStatus.btnUnhold = false + this.btnStatus.btnHold = true + } else if (object.type === 'off') { // 解除保持成功后 + this.btnStatus.btnUnhold = true + this.btnStatus.btnHold = false + } } } }, @@ -634,6 +668,24 @@ sendStr += '\n' } return sendStr + }, + // 判断坐席状态 + judgeStatus() { + if (this.status == '已签入') { + return true + } else { + this.$message.warning('请先签入呼叫平台') + return false + } + }, + // 判断通话状态 + judgeCallStatus() { + if (this.isInCall) { + return true + } else { + this.$message.warning('未在通话中') + return false + } } } } diff --git a/src/main.js b/src/main.js index 5630ee7..c9df78f 100644 --- a/src/main.js +++ b/src/main.js @@ -23,8 +23,13 @@ * it will intercept your request, so you won't see the request in the network. * If you remove `../mock` it will automatically request easy-mock data. */ +// if (process.env.NODE_ENV === 'development') { // import './../mock' // simulation data // require('./../mock') +// } else { +// console.log('生产环境') +// } + // 兼容IE11 import 'babel-polyfill' @@ -61,6 +66,15 @@ import VCharts from 'v-charts' Vue.use(VCharts) +// js禁止浏览器的回退快捷键 +history.pushState(null, null, document.URL) +window.addEventListener('popstate', function() { + history.pushState(null, null, document.URL) +}) +// 引入区域级联选项 +import vRegion from 'v-region' +Vue.use(vRegion, {}) + new Vue({ el: '#app', router, diff --git a/src/permission.js b/src/permission.js index 7816c64..74371d4 100644 --- a/src/permission.js +++ b/src/permission.js @@ -40,10 +40,17 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { + debugger + const token = to.query.sid + console.log('==============') + console.log(to.query.sid) // 直接调用登录接口 - store.dispatch('AppLogin').then(() => { + store.dispatch('AppLogin', token).then(() => { Message.success('自动登录成功') - next() + console.log(getToken()) + alert(getToken()) + next({ path: '/' }) + // next() }).catch(() => { Message.error('自动登录失败') next(`/login`) // 否则全部重定向到登录页 diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8ff9a57..bb8eaa0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -76,20 +76,28 @@ }) }, // 登录 - AppLogin({ commit }, userInfo) { + AppLogin({ commit }, token) { return new Promise((resolve, reject) => { - applogin(userInfo).then(response => { - if (response.code === 200) { - const data = response.data - setToken(data.token) - commit('SET_TOKEN', data.token) - resolve() - } else { - reject(response.message) - } - }).catch(error => { - reject(error) - }) + if (token) { + debugger + setToken(token) + commit('SET_TOKEN', token) + resolve() + } else { + window.location.href = 'http://10.18.0.50:8086/platform-sso-server/login?service=' + process.env.BASE_API + '/app/caslogin' + // applogin().then(response => { + // if (response.code === 200) { + // const data = response.data + // setToken(data.token) + // commit('SET_TOKEN', data.token) + // resolve() + // } else { + // reject(response.message) + // } + // }).catch(error => { + // reject(error) + // }) + } }) }, // 获取用户信息 diff --git a/src/utils/stringutils.js b/src/utils/stringutils.js new file mode 100644 index 0000000..4ff753d --- /dev/null +++ b/src/utils/stringutils.js @@ -0,0 +1,13 @@ +export function realFormatSecond(second) { + var secondType = typeof second + if (secondType === 'number' || secondType === 'string') { + second = parseInt(second) + var hours = Math.floor(second / 3600) + second = second - hours * 3600 + var mimute = Math.floor(second / 60) + second = second - mimute * 60 + return hours + ':' + ('0' + mimute).slice(-2) + ':' + ('0' + second).slice(-2) + } else { + return '0:00:00' + } +} diff --git a/src/views/caseManage/components/knowledgeDetail.vue b/src/views/caseManage/components/knowledgeDetail.vue new file mode 100644 index 0000000..f4ec86b --- /dev/null +++ b/src/views/caseManage/components/knowledgeDetail.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/views/caseManage/components/knowledgeSearch.vue b/src/views/caseManage/components/knowledgeSearch.vue index 97a9021..d632d26 100644 --- a/src/views/caseManage/components/knowledgeSearch.vue +++ b/src/views/caseManage/components/knowledgeSearch.vue @@ -6,19 +6,24 @@ 知识查找
-
- -
{{ item.kName }}
-
{{ item.kInfo }}
-
-
+ +
+ +
{{ item.kName }} _知识库_ {{ item.kTypeName }}
+
{{ item.kInfo }}
+
+
+
+
+ + + diff --git a/src/layout/components/ivr/ivrBar.vue b/src/layout/components/ivr/ivrBar.vue index 9bcc449..ba64d8e 100644 --- a/src/layout/components/ivr/ivrBar.vue +++ b/src/layout/components/ivr/ivrBar.vue @@ -2,15 +2,14 @@
签入 签出 - 保持 + 保持 解除保持 内呼 外呼 - 保持 挂机 会议 - 小休 - 示忙 + 退出示忙 + 示忙 @@ -37,16 +36,16 @@ - - + + - - + + - - + +
来电号码:{{ number }}
@@ -126,7 +125,7 @@ btnDialIn: true, // 内呼 btnAgentList: true, btnBusy: true, // 示忙 - btnIdle: true, // 示闲 + btnIdle: false, // 示闲 btnMeeting: true, // 会议 btnPickUp: true, btnExtenPickUp: true, @@ -145,7 +144,7 @@ btnGetNumber: true, btnInject: true }, - status: '', + status: '', // 签入状态:已连接,已签入,未签入 busy: '', // 坐席忙碌状态 :忙碌,'', 另一坐席已登录 call: '', // 通话状态 isInCall: false, // 是否在通话中 @@ -246,11 +245,12 @@ this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true this.btnStatus.btnBusy = false - this.btnStatus.btnIdle = false - this.btnStatus.btnIdle = false + this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = false this.btnStatus.btnHangUp = false + this.status = '已签入' this.call = '空闲' + // TODO: 通知后台已签入 // 心跳监测定时器 if (this.webVariable.web_hearbeartInterval > 0) { this.webVariable.web_hearbeartID = setInterval(this.sendHearbeatMessage(), this.webVariable.web_hearbeartID * 1000) @@ -275,7 +275,8 @@ }, // 处理签出成功之后的操作 handleLogoutResult(object) { - if (object.success) { + if (object.success === 'true') { + this.status = '未签入' this.$message.success('签出成功') // 处理按钮状态 this.btnStatus.btnLogin = false @@ -284,23 +285,27 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = true this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true - this.btnStatus.btnIdle = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = true this.resetWs() + // TODO: 通知后台已签出 // 清除定时器 clearInterval(this.webVariable.web_hearbeartID) } }, // 外呼 dialOut() { - this.$refs.keyboard.initDialog('out') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('out') + } }, // 内呼 dialIn() { - this.$refs.keyboard.initDialog('in') + if (this.judgeStatus()) { + this.$refs.keyboard.initDialog('in') + } }, // 拨号 dial(type, tel) { @@ -322,36 +327,54 @@ }, // 示忙 onbusy() { - const strSend = this.createCommand('busy') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('busy') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = true + this.btnStatus.btnIdle = false + } }, // 示闲 onidle() { - const strSend = this.createCommand('idle') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('idle') + this.webSocket.send(strSend) + this.btnStatus.btnBusy = false + this.btnStatus.btnIdle = true + } }, // 挂机 hangup() { - const strSend = this.createCommand('hangup') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('hangup') + this.webSocket.send(strSend) + } }, // 保持 hold() { - const strSend = this.createCommand('hold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { // 判断坐席状态,判断通话状态 + if (this.judgeCallStatus()) { + const strSend = this.createCommand('hold') + this.webSocket.send(strSend) + } + } }, // 解除保持 unhold() { - const strSend = this.createCommand('unhold') - this.webSocket.send(strSend) + if (this.judgeStatus()) { + const strSend = this.createCommand('unhold') + this.webSocket.send(strSend) + } }, // 三方通话 threeWay() { - const sendObj = { - dialString: this.threeWayPhone + if (this.judgeStatus()) { + const sendObj = { + dialString: this.threeWayPhone + } + const strSend = this.createCommand('threeWay', sendObj) + this.webSocket.send(strSend) } - const strSend = this.createCommand('threeWay', sendObj) - this.webSocket.send(strSend) }, // 处理接通来电事宜 incommingAnswerd(object) { @@ -361,7 +384,7 @@ this.btnStatus.btnDialIn = true this.btnStatus.btnHold = false this.btnStatus.btnUnhold = true - this.btnStatus.btnBusy = true + this.btnStatus.btnBusy = false this.btnStatus.btnIdle = true this.btnStatus.btnMeeting = true this.btnStatus.btnHangUp = false @@ -374,7 +397,7 @@ } console.log(data) const that = this - setTimeout(function(){ + setTimeout(function() { that.$refs['addcase'].initData(data) }, 500) }, @@ -382,6 +405,15 @@ closeCreateDialog() { this.showAddCase = false // 关闭弹窗 }, + // 进入工作态 + goWorkState() { + // TODO:通知后台进入工作态 + + }, + // 退出工作态 + quitWorkState() { + // TODO:通知后台退出工作态 + }, // 初始化 initSapoOcx() { const { ip, port } = this @@ -531,8 +563,6 @@ if (this.statusShow === true) { // 如果有呼叫弹窗,关闭 this.statusShow = false } - } else { // 话机状态 - this.status = '话机已连接' } } if (name === 'queue status') { @@ -552,18 +582,22 @@ const command = object.command if (command === 'login') { this.handleLoginResult(object) - } - if (command === 'logout') { + } else if (command === 'logout') { this.handleLogoutResult(object) - } - if (command === 'getExtensionList') { + } else if (command === 'getExtensionList') { this.handleExtensionList(object) - } - if (command === 'dial') { + } else if (command === 'dial') { if (object.success === 'true') { this.statusDetailText = object.resultText } - } - if (object.resultText === '准备挂断' && object.success) { + } else if (object.resultText === '准备挂断' && object.success === 'true') { this.statusShow = false + } else if (object.resultText === '准备保持' && object.success === 'true') { + if (object.type === '') { // 保持成功后 + this.btnStatus.btnUnhold = false + this.btnStatus.btnHold = true + } else if (object.type === 'off') { // 解除保持成功后 + this.btnStatus.btnUnhold = true + this.btnStatus.btnHold = false + } } } }, @@ -634,6 +668,24 @@ sendStr += '\n' } return sendStr + }, + // 判断坐席状态 + judgeStatus() { + if (this.status == '已签入') { + return true + } else { + this.$message.warning('请先签入呼叫平台') + return false + } + }, + // 判断通话状态 + judgeCallStatus() { + if (this.isInCall) { + return true + } else { + this.$message.warning('未在通话中') + return false + } } } } diff --git a/src/main.js b/src/main.js index 5630ee7..c9df78f 100644 --- a/src/main.js +++ b/src/main.js @@ -23,8 +23,13 @@ * it will intercept your request, so you won't see the request in the network. * If you remove `../mock` it will automatically request easy-mock data. */ +// if (process.env.NODE_ENV === 'development') { // import './../mock' // simulation data // require('./../mock') +// } else { +// console.log('生产环境') +// } + // 兼容IE11 import 'babel-polyfill' @@ -61,6 +66,15 @@ import VCharts from 'v-charts' Vue.use(VCharts) +// js禁止浏览器的回退快捷键 +history.pushState(null, null, document.URL) +window.addEventListener('popstate', function() { + history.pushState(null, null, document.URL) +}) +// 引入区域级联选项 +import vRegion from 'v-region' +Vue.use(vRegion, {}) + new Vue({ el: '#app', router, diff --git a/src/permission.js b/src/permission.js index 7816c64..74371d4 100644 --- a/src/permission.js +++ b/src/permission.js @@ -40,10 +40,17 @@ if (whiteList.indexOf(to.path) !== -1) { // 免登录白名单,直接进入 next() } else { + debugger + const token = to.query.sid + console.log('==============') + console.log(to.query.sid) // 直接调用登录接口 - store.dispatch('AppLogin').then(() => { + store.dispatch('AppLogin', token).then(() => { Message.success('自动登录成功') - next() + console.log(getToken()) + alert(getToken()) + next({ path: '/' }) + // next() }).catch(() => { Message.error('自动登录失败') next(`/login`) // 否则全部重定向到登录页 diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 8ff9a57..bb8eaa0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -76,20 +76,28 @@ }) }, // 登录 - AppLogin({ commit }, userInfo) { + AppLogin({ commit }, token) { return new Promise((resolve, reject) => { - applogin(userInfo).then(response => { - if (response.code === 200) { - const data = response.data - setToken(data.token) - commit('SET_TOKEN', data.token) - resolve() - } else { - reject(response.message) - } - }).catch(error => { - reject(error) - }) + if (token) { + debugger + setToken(token) + commit('SET_TOKEN', token) + resolve() + } else { + window.location.href = 'http://10.18.0.50:8086/platform-sso-server/login?service=' + process.env.BASE_API + '/app/caslogin' + // applogin().then(response => { + // if (response.code === 200) { + // const data = response.data + // setToken(data.token) + // commit('SET_TOKEN', data.token) + // resolve() + // } else { + // reject(response.message) + // } + // }).catch(error => { + // reject(error) + // }) + } }) }, // 获取用户信息 diff --git a/src/utils/stringutils.js b/src/utils/stringutils.js new file mode 100644 index 0000000..4ff753d --- /dev/null +++ b/src/utils/stringutils.js @@ -0,0 +1,13 @@ +export function realFormatSecond(second) { + var secondType = typeof second + if (secondType === 'number' || secondType === 'string') { + second = parseInt(second) + var hours = Math.floor(second / 3600) + second = second - hours * 3600 + var mimute = Math.floor(second / 60) + second = second - mimute * 60 + return hours + ':' + ('0' + mimute).slice(-2) + ':' + ('0' + second).slice(-2) + } else { + return '0:00:00' + } +} diff --git a/src/views/caseManage/components/knowledgeDetail.vue b/src/views/caseManage/components/knowledgeDetail.vue new file mode 100644 index 0000000..f4ec86b --- /dev/null +++ b/src/views/caseManage/components/knowledgeDetail.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/views/caseManage/components/knowledgeSearch.vue b/src/views/caseManage/components/knowledgeSearch.vue index 97a9021..d632d26 100644 --- a/src/views/caseManage/components/knowledgeSearch.vue +++ b/src/views/caseManage/components/knowledgeSearch.vue @@ -6,19 +6,24 @@ 知识查找
-
- -
{{ item.kName }}
-
{{ item.kInfo }}
-
-
+ +
+ +
{{ item.kName }} _知识库_ {{ item.kTypeName }}
+
{{ item.kInfo }}
+
+
+
+