diff --git a/src/pages/MainPage/ProjectManager/manager.js b/src/pages/MainPage/ProjectManager/manager.js index a9ed872..da4c1f9 100644 --- a/src/pages/MainPage/ProjectManager/manager.js +++ b/src/pages/MainPage/ProjectManager/manager.js @@ -41,6 +41,7 @@ class manager extends PureComponent { supplierNumber: '', //智慧客服 staffId: '', //智慧客服' staffName:'', //智慧客服 + kfType:0,//智慧客服 // NTKF_PARAM: { // siteid: "bl_1000", //企业ID,,为固定值 // settingid: "bl_1000_1492484340268", //接待组ID,为固定值,必填 @@ -82,10 +83,9 @@ class manager extends PureComponent { } //智慧客服,获取供应商编码 let userData = getSessionUserData() - console.log(userData) this.setState({staffId: userData.userId}) this.setState({staffName: userData.fullName}) - this.setState({supplierNumber: userData? userData.organizationId: 'EMPTY'}) + this.setState({supplierNumber: userData.organizationId}) this.approvalDetail() } onChange = (date, dateString) => { @@ -173,7 +173,7 @@ class manager extends PureComponent { }; render() { const { downlist, projectlist, staloading, tlist, trelist, idList, dateNum } = this.props; - const { datevalue, messId, messageDetail, detailId, noticeDetail, questData, questVisible, mainDetail, isModalVisible, isCloseWs, optionsModal, projectModal, supplierNumber, staffId, staffName, } = this.state; + const { datevalue, messId, messageDetail, detailId, noticeDetail, questData, questVisible, mainDetail, isModalVisible, isCloseWs, optionsModal, projectModal, supplierNumber, staffId, staffName, kfType,} = this.state; return ( <> { @@ -318,15 +318,18 @@ class manager extends PureComponent { {/*智慧客服*/} { + this.setState({kfType: 2}) this.setState({projectModal: true}) }} openWin={()=>{ + this.setState({kfType: 1}) this.setState({optionsModal: false}) this.setState({isModalVisible: true}) this.setState({isCloseWs: false}) this.setState({isFlash :false}) }} closeWin={()=>{ + this.setState({kfType: 0}) this.setState({optionsModal: false}) this.setState({isModalVisible: false}) this.setState({isCloseWs: true}) @@ -336,6 +339,7 @@ class manager extends PureComponent { projectModal={projectModal} isModalVisible={isModalVisible} //supplierNo='EMPTY' + kfType={kfType} staffId={staffId} staffName={staffName} supplierNumber={supplierNumber} diff --git a/src/pages/customerservice/support/conversation/components/ChatInput/ChatInput.jsx b/src/pages/customerservice/support/conversation/components/ChatInput/ChatInput.jsx index b8ae6e3..b2b6679 100644 --- a/src/pages/customerservice/support/conversation/components/ChatInput/ChatInput.jsx +++ b/src/pages/customerservice/support/conversation/components/ChatInput/ChatInput.jsx @@ -25,6 +25,7 @@ const ChatInput = ((props) => { setPostion, isModalVisible, supplierNo, + kfType, conversationId, isSend, sendMsg, @@ -192,12 +193,12 @@ const ChatInput = ((props) => { }) } - //发送消息给客服-websocket + //发送消息给客服-websocket 1 1 2 const sendToCs = (msg)=>{ let params = { "clientNo": msg.user.id, "contentType": msg.message.type=="text"?1:msg.message.type=="image"?2:msg.message.type=="file"?3:'', - "custType": location.pathname.indexOf('/product-detail')!=-1? 2 : 1, + "custType": kfType == 2? 2 : 1, "message": msg.message.type=="image" || msg.message.type=="file" ?JSON.stringify(msg.message.content):msg.message.content, //"questionType": location.pathname.indexOf('/home')!=-1? 3 : 1, "questionType": 2, @@ -471,7 +472,7 @@ const str_substr = (start, end, str)=> { //评价 const onRateHandle = (score)=>{ // const conversationId = '1506204072738394114' - if(conversationId==''){ + if(conversationId=='' || conversationId==undefined){ message.warn('您还没有发起咨询,无需评价') }else{ API.estimate({id: conversationId, remarkScore: score*2, remarkTime: moment(new Date()).format('yyyy-MM-DD HH:mm:ss')}).then(res=>{ @@ -517,7 +518,7 @@ const str_substr = (start, end, str)=> { } }} > - +
{e.preventDefault()}} className={style.input_area} diff --git a/src/pages/customerservice/support/conversation/index.jsx b/src/pages/customerservice/support/conversation/index.jsx index 2bd5a70..52415f3 100644 --- a/src/pages/customerservice/support/conversation/index.jsx +++ b/src/pages/customerservice/support/conversation/index.jsx @@ -43,7 +43,7 @@ const conversation = (props) => { const wid = 600 const hei = 500 - let {isModalVisible, isCloseWs, closeWin, hideWin, msgAlert, supplierNumber, staffId, staffName, optionsModal, projectModal, closeOptionsModal, closeProjectModal, openWin, openProjectWin} = props + let {isModalVisible, isCloseWs, closeWin, hideWin, msgAlert, supplierNumber, staffId, staffName, optionsModal, projectModal, closeOptionsModal, closeProjectModal, kfType, openWin, openProjectWin} = props const onMsgRender = ()=>{ let serverAvatar = user let data = wsMsg @@ -95,7 +95,7 @@ const conversation = (props) => { const websocketInit = (id)=>{ //const bizServiceCustomService = 'http://10.242.31.158:8100/api/biz-customer-service' var addr = `${REACT_APP_CUSTOMERSERVICE_WS_REDIRECT}` + '/websocketClient/' - let no = agentNumber!=''?agentNumber: supplierNumber + let no = kfType==1?'EMPTY':agentNumber var ws = new WebSocket(addr+id+'/'+no); // 建立 web socket 连接成功触发事件 ws.onopen = function () { @@ -135,7 +135,7 @@ const conversation = (props) => { }) API.check({ clientNo: staffId, - supplierNo:agentNumber!=''?agentNumber: supplierNumber + supplierNo:kfType==1?'EMPTY':agentNumber }).then(res => { if (res && res.success) { websocketInit(staffId) @@ -268,7 +268,8 @@ const getProject = (params)=>{ chatUI={chatUI} textHeight={textHeight} listHeight={listHeight} - supplierNo={agentNumber!=''?agentNumber: supplierNumber} + kfType={kfType} + supplierNo={kfType==1?'EMPTY':agentNumber} conversationId={conversationId} closeWin={()=>{ closeWin && closeWin()