修改坐席状态设置
This commit is contained in:
parent
eb9d5d4d40
commit
0021ce240c
@ -117,6 +117,7 @@ export default {
|
||||
voiceCall.webCalling().then(res => {
|
||||
const {agent, token, sdkAppId, agentId, sdkURL} = res;
|
||||
// console.log(res, '---res')
|
||||
this.$store.commit('setAgent', agent)
|
||||
if (agent){
|
||||
let userId = agentId;
|
||||
let sdkUrl = sdkURL;
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<el-avatar size="medium" :src="userInfo.headUrl?userInfo.headUrl:defaultHeadUrl" ></el-avatar>
|
||||
<span class="f16 color-fff ml-16">{{ userInfo.realName || userInfo.showName || '-' }}</span>
|
||||
</div>
|
||||
<div class="cursor-pointer border-radius-8 p-8-16" style="background-color:#00000010 ;">
|
||||
<div v-if="agent" class="cursor-pointer border-radius-8 p-8-16" style="background-color:#00000010 ;">
|
||||
<el-dropdown @command="handleCommand">
|
||||
<div class="flex-row align-items-center">
|
||||
<img :src="require(`@/assets/image/${agentStatus}.png`)" alt="" class="mr-8">
|
||||
@ -241,7 +241,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import api from "@/services/systemManage";
|
||||
|
||||
import {mapState} from 'vuex'
|
||||
export default {
|
||||
components: {
|
||||
SideMenu: () => import('./SideMenu'),
|
||||
@ -319,12 +319,23 @@ export default {
|
||||
agentStatusName: '空闲',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
agent: state => state.agent
|
||||
}),
|
||||
},
|
||||
mounted() {
|
||||
if (JSON.parse(sessionStorage.getItem('userInfo'))) {
|
||||
this.userInfo = JSON.parse(sessionStorage.getItem('userInfo'))
|
||||
}
|
||||
// console.log('获取当前登录人的信息',this.userInfo)
|
||||
// console.log(this.userInfo.showName)
|
||||
console.log('判断是否绑定坐席agent',this.agent)
|
||||
// if (this.agent) {
|
||||
// setTimeout(() => {
|
||||
// this.getStatus()
|
||||
// }, 2000)
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
// 个人信息
|
||||
@ -414,6 +425,7 @@ export default {
|
||||
} else if (command === 'rest') {
|
||||
this.agentStatusName = '小休'
|
||||
}
|
||||
this.setStatus()
|
||||
},
|
||||
// 关闭
|
||||
handleClose() {
|
||||
@ -437,6 +449,27 @@ export default {
|
||||
|
||||
})
|
||||
},
|
||||
// 获取座席状态
|
||||
async getStatus() {
|
||||
console.log('进入获取座席状态')
|
||||
try {
|
||||
let res = await window.tccc.Agent.getStatus()
|
||||
console.log('获取座席状态:', res)
|
||||
} catch (error) {
|
||||
this.$message.error('获取座席状态失败' + error.message)
|
||||
console.log('获取座席状态失败',error.message)
|
||||
}
|
||||
},
|
||||
// 设置座席状态
|
||||
async setStatus() {
|
||||
try {
|
||||
let res = await window.tccc.Agent.setStatus({status: this.agentStatus})
|
||||
console.log('设置座席状态:', res)
|
||||
} catch (err) {
|
||||
this.$message.error('设置座席状态失败' + err.message)
|
||||
console.log('设置座席状态失败',err.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -11,6 +11,7 @@ const vuexPersisted = new CreatePersistedState({
|
||||
token: state.token, //需要持久化的数据
|
||||
routes: state.routes,
|
||||
userinfo: state.userinfo,
|
||||
agent: state.agent
|
||||
})
|
||||
})
|
||||
|
||||
@ -26,6 +27,7 @@ const store = new Vuex.Store({
|
||||
routes: [], // 从后端获取的路由菜单
|
||||
brokerEndpoint: '',
|
||||
videoReminder: '',
|
||||
agent: false, // 是否绑定坐席
|
||||
},
|
||||
plugins: [vuexPersisted],
|
||||
// 全局同步方法, 调用方法,this.$store.commit("xxx",'赋值数据')
|
||||
@ -47,6 +49,9 @@ const store = new Vuex.Store({
|
||||
},
|
||||
setVideoReminder(state, data) {
|
||||
state.videoReminder = data;
|
||||
},
|
||||
setAgent(state, data) {
|
||||
state.agent = data;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user