diff --git a/config/config.UAT.ts b/config/config.UAT.ts index 6fce63b..bca21d4 100644 --- a/config/config.UAT.ts +++ b/config/config.UAT.ts @@ -22,15 +22,24 @@ export default defineConfig({ //询价-查看报价详情-虚拟用户uid REACT_APP_XUNJIA_UID: 'admin_entrance', - //智慧客服ws地址 - REACT_APP_CUSTOMERSERVICE_WS_REDIRECT: 'ws://10.242.31.158:18022/api/api/biz-customer-service', + // //智慧客服ws地址 + // REACT_APP_CUSTOMERSERVICE_WS_REDIRECT: 'ws://10.242.31.158:18022/api/api/biz-customer-service', - //智慧客服文档中心查看图片地址 - REACT_APP_CUSTOMERSERVICE_DOC_REDIRECT: 'http://cos.gz-tst.cos.tg.unicom.local/349553515466:mall/', + //智慧客服用户中心地址 + REACT_APP_CUSTOMERSERVICE_USERCENTER: 'http://10.242.31.158:8100/auth/oauth/authorize?response_type=code', - //智慧客服加密公钥私钥ciphercode - REACT_APP_CUSTOMERSERVICE_PUBLICKEY : '0428D625CEEB71CE823BD7D78DFEE7B122F2DA5C4D21E32253AD684D0FE21810394A799639C0CDFBFEB535A1DFD6A366A637E582CE0B1466A5FE7858841135DE6B', - REACT_APP_CUSTOMERSERVICE_PRIVATEKEY : '4F7144028D4DCF88FA50F0E2B3FFDDCF63BBE17D1700537DCE037687D3AA3DA7', - REACT_APP_CUSTOMERSERVICE_CIPHERCODE : 1, + //智慧客服client_id + REACT_APP_CUSTOMERSERVICE_CLIENT_ID: 'S00hFPxc', + + //智慧客服地址 + REACT_APP_CUSTOMERSERVICE_REDIRECT: 'http://localhost:3000', + + // //智慧客服文档中心查看图片地址 + // REACT_APP_CUSTOMERSERVICE_DOC_REDIRECT: 'http://cos.gz-tst.cos.tg.unicom.local/349553515466:mall/', + + // //智慧客服加密公钥私钥ciphercode + // REACT_APP_CUSTOMERSERVICE_PUBLICKEY : '0428D625CEEB71CE823BD7D78DFEE7B122F2DA5C4D21E32253AD684D0FE21810394A799639C0CDFBFEB535A1DFD6A366A637E582CE0B1466A5FE7858841135DE6B', + // REACT_APP_CUSTOMERSERVICE_PRIVATEKEY : '4F7144028D4DCF88FA50F0E2B3FFDDCF63BBE17D1700537DCE037687D3AA3DA7', + // REACT_APP_CUSTOMERSERVICE_CIPHERCODE : 1, }, }); diff --git a/config/config.dev.ts b/config/config.dev.ts index 723cdb8..dede5a4 100644 --- a/config/config.dev.ts +++ b/config/config.dev.ts @@ -21,15 +21,25 @@ export default defineConfig({ // REACT_APP_XUNJIA_REDIRECT: 'http://10.0.204.215:8080/provider_dev', //询价-查看报价详情-虚拟用户uid REACT_APP_XUNJIA_UID: 'admin_entrance', - //智慧客服ws地址 - REACT_APP_CUSTOMERSERVICE_WS_REDIRECT: 'ws://10.242.37.148:18022/api/api/biz-customer-service', - - //智慧客服文档中心查看图片地址 - REACT_APP_CUSTOMERSERVICE_DOC_REDIRECT: 'http://cos.gz-tst.cos.tg.unicom.local/349553515466:mall/', - //智慧客服加密公钥私钥ciphercode - REACT_APP_CUSTOMERSERVICE_PUBLICKEY : '0428D625CEEB71CE823BD7D78DFEE7B122F2DA5C4D21E32253AD684D0FE21810394A799639C0CDFBFEB535A1DFD6A366A637E582CE0B1466A5FE7858841135DE6B', - REACT_APP_CUSTOMERSERVICE_PRIVATEKEY : '4F7144028D4DCF88FA50F0E2B3FFDDCF63BBE17D1700537DCE037687D3AA3DA7', - REACT_APP_CUSTOMERSERVICE_CIPHERCODE : 1, + //智慧客服用户中心地址 + REACT_APP_CUSTOMERSERVICE_USERCENTER: 'http://10.242.31.158:8100/auth/oauth/authorize?response_type=code', + + //智慧客服client_id + REACT_APP_CUSTOMERSERVICE_CLIENT_ID: 'S00hFPxc', + + //智慧客服地址 + REACT_APP_CUSTOMERSERVICE_REDIRECT: 'http://localhost:3000', + + // //智慧客服ws地址 + // REACT_APP_CUSTOMERSERVICE_WS_REDIRECT: 'ws://10.242.37.148:18022/api/api/biz-customer-service', + + // //智慧客服文档中心查看图片地址 + // REACT_APP_CUSTOMERSERVICE_DOC_REDIRECT: 'http://cos.gz-tst.cos.tg.unicom.local/349553515466:mall/', + + // //智慧客服加密公钥私钥ciphercode + // REACT_APP_CUSTOMERSERVICE_PUBLICKEY : '0428D625CEEB71CE823BD7D78DFEE7B122F2DA5C4D21E32253AD684D0FE21810394A799639C0CDFBFEB535A1DFD6A366A637E582CE0B1466A5FE7858841135DE6B', + // REACT_APP_CUSTOMERSERVICE_PRIVATEKEY : '4F7144028D4DCF88FA50F0E2B3FFDDCF63BBE17D1700537DCE037687D3AA3DA7', + // REACT_APP_CUSTOMERSERVICE_CIPHERCODE : 1, }, }); diff --git a/config/config.prod.ts b/config/config.prod.ts index 067ee29..bbf3343 100644 --- a/config/config.prod.ts +++ b/config/config.prod.ts @@ -21,16 +21,23 @@ export default defineConfig({ // REACT_APP_XUNJIA_REDIRECT: 'https://60.10.26.178/provider', //询价-查看报价详情-虚拟用户uid REACT_APP_XUNJIA_UID: 'admin_entrance', + //智慧客服用户中心地址 + REACT_APP_CUSTOMERSERVICE_USERCENTER: 'http://10.242.31.158:8100/auth/oauth/authorize?response_type=code', - //智慧客服ws地址 - REACT_APP_CUSTOMERSERVICE_WS_REDIRECT: 'ws://uscm.unicom.local:18022/api/api/biz-customer-service', + //智慧客服client_id + REACT_APP_CUSTOMERSERVICE_CLIENT_ID: 'S00hFPxc', - //智慧客服文档中心查看图片地址 - REACT_APP_CUSTOMERSERVICE_DOC_REDIRECT: 'http://cos.xx-pbc.cos.tg.unicom.local/349553515466:mall/', + //智慧客服地址 + REACT_APP_CUSTOMERSERVICE_REDIRECT: 'http://localhost:3000', + // //智慧客服ws地址 + // REACT_APP_CUSTOMERSERVICE_WS_REDIRECT: 'ws://uscm.unicom.local:18022/api/api/biz-customer-service', - //智慧客服加密公钥私钥ciphercode - REACT_APP_CUSTOMERSERVICE_PUBLICKEY : '0428D625CEEB71CE823BD7D78DFEE7B122F2DA5C4D21E32253AD684D0FE21810394A799639C0CDFBFEB535A1DFD6A366A637E582CE0B1466A5FE7858841135DE6B', - REACT_APP_CUSTOMERSERVICE_PRIVATEKEY : '4F7144028D4DCF88FA50F0E2B3FFDDCF63BBE17D1700537DCE037687D3AA3DA7', - REACT_APP_CUSTOMERSERVICE_CIPHERCODE : 1, + // //智慧客服文档中心查看图片地址 + // REACT_APP_CUSTOMERSERVICE_DOC_REDIRECT: 'http://cos.xx-pbc.cos.tg.unicom.local/349553515466:mall/', + + // //智慧客服加密公钥私钥ciphercode + // REACT_APP_CUSTOMERSERVICE_PUBLICKEY : '0428D625CEEB71CE823BD7D78DFEE7B122F2DA5C4D21E32253AD684D0FE21810394A799639C0CDFBFEB535A1DFD6A366A637E582CE0B1466A5FE7858841135DE6B', + // REACT_APP_CUSTOMERSERVICE_PRIVATEKEY : '4F7144028D4DCF88FA50F0E2B3FFDDCF63BBE17D1700537DCE037687D3AA3DA7', + // REACT_APP_CUSTOMERSERVICE_CIPHERCODE : 1, }, }); diff --git a/config/config.sim.ts b/config/config.sim.ts index 8be6ed2..436155e 100644 --- a/config/config.sim.ts +++ b/config/config.sim.ts @@ -21,16 +21,23 @@ export default defineConfig({ // REACT_APP_XUNJIA_REDIRECT: 'http://10.0.204.215:8080/provider', //询价-查看报价详情-虚拟用户uid REACT_APP_XUNJIA_UID: 'admin_entrance', + //智慧客服用户中心地址 + REACT_APP_CUSTOMERSERVICE_USERCENTER: 'http://10.242.31.158:8100/auth/oauth/authorize?response_type=code', - //智慧客服ws地址 - REACT_APP_CUSTOMERSERVICE_WS_REDIRECT: 'ws://10.242.31.54:18022/api/api/biz-customer-service', + //智慧客服client_id + REACT_APP_CUSTOMERSERVICE_CLIENT_ID: 'S00hFPxc', - //智慧客服文档中心查看图片地址 - REACT_APP_CUSTOMERSERVICE_DOC_REDIRECT: 'http://cos.xx-pbc.cos.tg.unicom.local/349553515466:mall/', + //智慧客服地址 + REACT_APP_CUSTOMERSERVICE_REDIRECT: 'http://localhost:3000', + // //智慧客服ws地址 + // REACT_APP_CUSTOMERSERVICE_WS_REDIRECT: 'ws://10.242.31.54:18022/api/api/biz-customer-service', - //智慧客服加密公钥私钥ciphercode - REACT_APP_CUSTOMERSERVICE_PUBLICKEY : '0428D625CEEB71CE823BD7D78DFEE7B122F2DA5C4D21E32253AD684D0FE21810394A799639C0CDFBFEB535A1DFD6A366A637E582CE0B1466A5FE7858841135DE6B', - REACT_APP_CUSTOMERSERVICE_PRIVATEKEY : '4F7144028D4DCF88FA50F0E2B3FFDDCF63BBE17D1700537DCE037687D3AA3DA7', - REACT_APP_CUSTOMERSERVICE_CIPHERCODE : 1, + // //智慧客服文档中心查看图片地址 + // REACT_APP_CUSTOMERSERVICE_DOC_REDIRECT: 'http://cos.xx-pbc.cos.tg.unicom.local/349553515466:mall/', + + // //智慧客服加密公钥私钥ciphercode + // REACT_APP_CUSTOMERSERVICE_PUBLICKEY : '0428D625CEEB71CE823BD7D78DFEE7B122F2DA5C4D21E32253AD684D0FE21810394A799639C0CDFBFEB535A1DFD6A366A637E582CE0B1466A5FE7858841135DE6B', + // REACT_APP_CUSTOMERSERVICE_PRIVATEKEY : '4F7144028D4DCF88FA50F0E2B3FFDDCF63BBE17D1700537DCE037687D3AA3DA7', + // REACT_APP_CUSTOMERSERVICE_CIPHERCODE : 1, }, }); diff --git a/src/assets/img/cs_client.png b/src/assets/img/cs_client.png deleted file mode 100644 index abb7ffe..0000000 Binary files a/src/assets/img/cs_client.png and /dev/null differ diff --git a/src/assets/img/cs_user.png b/src/assets/img/cs_user.png deleted file mode 100644 index e10b17c..0000000 Binary files a/src/assets/img/cs_user.png and /dev/null differ diff --git a/src/customerServiceHelpers/constants/http.js b/src/customerServiceHelpers/constants/http.js deleted file mode 100644 index bfff3b2..0000000 --- a/src/customerServiceHelpers/constants/http.js +++ /dev/null @@ -1,25 +0,0 @@ -// HTTP状态码映射(可补充) -export const HTTP_STATUS_CODE_MAP = { - 200: '服务请求成功!', - 201: '新建或修改数据成功!', - 202: '请求已进入后台排队中!', - 204: '删除数据成功!', - 400: '发出的请求有错误,未能执行相关操作!', - 401: '无权限访问,请重新登录!', - 403: '已得到授权,但访问被禁止!', - 404: '请求失败,未找到相关资源!', - 406: '请求格式不可得!', - 410: '请求的资源已被永久删除!', - 422: '请求过程中出现验证错误!', - 500: '服务器发生错误!', - 502: '网关错误!', - 503: '服务不可用,服务器暂时过载或正在维护!', - 504: '网关超时!', - }; - - // 携带着请求体的请求方法 - export const WITH_REQUEST_BODY_METHODS = ['post', 'put', 'patch']; - - // 请求后端接口失败时对应的几种code值(与后端协定) - export const RESPONSE_FAILED_CODES = [400, 500]; - \ No newline at end of file diff --git a/src/customerServiceHelpers/request.js b/src/customerServiceHelpers/request.js deleted file mode 100644 index c313248..0000000 --- a/src/customerServiceHelpers/request.js +++ /dev/null @@ -1,132 +0,0 @@ -import axios from 'axios'; -import { WITH_REQUEST_BODY_METHODS } from './constants/http'; -import { HTTP_STATUS_CODE_MAP } from './constants/http'; -import { notification, message } from 'antd' -import { getSessionRoleData, getUserToken } from '@/utils/session'; - -// Axios全局配置项 -axios.defaults.withCredentials = true //允许带cookie -axios.defaults.baseURL = ''; -axios.defaults.headers['Content-Type'] = 'application/json;charset=UTF-8'; -axios.defaults.headers['Authorization'] = ''; - -// Axios请求拦截器 -axios.interceptors.request.use(function (config) { - config.headers['Authorization'] = getUserToken() == null ? null : getUserToken(); - //config.headers['clientId']='bVS46ElU'; - //config.headers['scope']=sessionStorage.getItem('scope')?JSON.parse(sessionStorage.getItem('scope')):''; - return config; -}, function (error) { - return Promise.reject(error); -}); -// Axios响应拦截器 -axios.interceptors.response.use(function (response) { - const { data } = response; - const { success = true } = data - // 解构赋值 success默认设置为true,如果为false,说明返回错误 - if (!success) { - // message.error(data.message); - } - - return response; -}, function (error) { - // const { response } = error; - // if (response && response.status) { - // const { status } = response; - // const errText = HTTP_STATUS_CODE_MAP[status] || response.message; - // notification.error({ - // message: `请求错误 ${status}`, - // description: errText, - // }); - // } else if (!response) { - // notification.error({ - // message: '网络异常', - // description: '您的网络状况不佳或异常,无法连接服务器!', - // }); - // } - return Promise.reject(error); -}); - -function paddingBaseURL(config) { - return Object.assign(config); -} - -/** - * 封装通用的axios公共方法 (需要结合业务逻辑来进一步完善) - * @param {Object} config - 非通用性(自定义)的一些axios请求配置 - * @returns {Promise} - */ -const $axios = function (config) { - - let defaultConfig = paddingBaseURL(config); - - if (WITH_REQUEST_BODY_METHODS.includes(config.method)) { - if (!config.data && config.params) { - defaultConfig.data = config.params; - defaultConfig.params = undefined; - } - } - - return new Promise((resolve, reject) => { - axios(defaultConfig) - .then(result => { - const { data } = result; - resolve(data); - }) - .catch(err => { - reject(err); - }); - }); -}; - -export function $get(url, options) { - return $axios({ ...options, url, method: 'get' }); -} - -export function $post(url, options) { - return $axios({ ...options, url, method: 'post' }); -} - -export function $put(url, options) { - return $axios({ ...options, url, method: 'put' }); -} - -export function $patch(url, options) { - return $axios({ ...options, url, method: 'patch' }); -} - -export function $delete(url, options) { - return $axios({ ...options, url, method: 'delete' }); -} - -export function $head(url, options) { - return $axios({ ...options, url, method: 'head' }); -} - -export function $options(url, options) { - return $axios({ ...options, url, method: 'options' }); -} - - -/** - * 下载专用请求 - * @param {downloadUrl} 接口路径 params:接口参数 - * @returns {Promise} - */ -export function $download(downloadUrl, params) { - return new Promise((resolve, reject) => { - axios( - { - method: "post", - url: downloadUrl, - data: params, - responseType: "blob", // 指定获取数据的类型为blob - } - ).then(result => { - // const { data } = result; - resolve(result); - }).catch(err => { - reject(err); - }); - }); -}; \ No newline at end of file diff --git a/src/pages/MainPage/ProjectManager/Jury.js b/src/pages/MainPage/ProjectManager/Jury.js index 2b64340..6c1cd69 100644 --- a/src/pages/MainPage/ProjectManager/Jury.js +++ b/src/pages/MainPage/ProjectManager/Jury.js @@ -10,8 +10,6 @@ import moment from 'moment'; import { jurySaveInfo, getSessionUserData, getRA } from '@/utils/session'; import NoticeDetail from '@/pages/notice/noticeList/components/NoticeDetail' import ExpertEnter from '@/pages/BidEvaluation/components/ExpertEnter'; -import ChatUI from '@/pages/customerservice/support/conversation' //智慧客服 - @connect(({ dashboard, loading }) => ({ ...dashboard, downlistLoading: loading.effects['dashboard/fetchDowntlist'], @@ -25,17 +23,7 @@ class Jury extends PureComponent { noticeDetail: false, // 公告弹窗 recordData: '', // 进入评审室弹窗数据 enterVisible: false, // 进入评审室弹窗 - isModalVisible: false, //智慧客服 - isFlash: false, //智慧客服 - isCloseWs: true, //智慧客服 - optionsModal: false, //智慧客服 - projectModal: false, //智慧客服 - supplierNumber: '', //智慧客服 - staffId: '', //智慧客服' - staffName:'', //智慧客服 - kfType:0,//智慧客服 - questionType:0,//智慧客服 - roleIds:'',//智慧客服 + } componentDidMount() { this.props.dispatch({ @@ -59,14 +47,6 @@ class Jury extends PureComponent { userlevel: "1",                       //网站自定义会员级别,1-N,可根据选择判断,取值显示到小能客户端 erpparam: "abc"                          //erpparam为erp功能的扩展字段,可选,购买erp功能后用于erp功能集成 } - //智慧客服,获取供应商编码 - let userData = getSessionUserData() - let roleAuthority = getRA() - this.setState({roleIds: roleAuthority && roleAuthority.length>0? roleAuthority[0]: userData.roleIds}) - this.setState({staffId: userData.userId}) - this.setState({staffName: userData.fullName}) - this.setState({supplierNumber: userData.organizationId}) - //<<<<<<智慧客服end } onChange = (date, dateString) => { this.setState({ @@ -115,22 +95,12 @@ class Jury extends PureComponent { enterVisible: false }) } - initChatUI = () => { - //智慧客服 - if(this.state.isCloseWs && sessionStorage.getItem('CUSTOMERSERVICE_isCloseChatUIModal')==null){ //弹窗主动关闭或者页面刷新 - this.setState({optionsModal: true}) - }else{ - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - } - } render() { - const { datevalue, detailId, noticeDetail, recordData, enterVisible, isModalVisible, isCloseWs, optionsModal, projectModal, supplierNumber, staffId, staffName, kfType, questionType, isFlash, roleIds} = this.state; //智慧客服state + const { datevalue, detailId, noticeDetail, recordData, enterVisible, } = this.state; const { Juryuplist, Jurydownlist, staloading, tlist } = this.props; return ( <> - this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 + {/* this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 */}
}> @@ -203,52 +173,6 @@ class Jury extends PureComponent { {noticeDetail && { this.noticeModel() }} modalVisible={noticeDetail} />} {recordData == '' ? null : { this.enterModel() }} onRefresh={() => { this.onRefresh() }} recordData={recordData} />} - {/*智慧客服*/} - { - this.setState({kfType: 2}) - this.setState({projectModal: true}) - }} - openWin={(kfType, questionType)=>{ - this.setState({questionType: questionType}) - this.setState({kfType: kfType}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - }} - closeWin={()=>{ - this.setState({kfType: 0}) - this.setState({questionType: 0}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - this.setState({isCloseWs: true}) - this.setState({projectModal: false}) - }} - optionsModal={optionsModal} - projectModal={projectModal} - isModalVisible={isModalVisible} - kfType={kfType} - questionType={questionType} - staffId={staffId} - staffName={staffName} - supplierNumber={supplierNumber} - isCloseWs={isCloseWs} - roleIds={roleIds} - hideWin={()=>{ - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - }} - closeOptionsModal={()=>{ - this.setState({optionsModal: false}) - }} - closeProjectModal={()=>{ - this.setState({projectModal: false}) - }} - msgAlert={()=>{ - if(!isModalVisible) this.setState({isFlash: true}) - }} - /> ) } diff --git a/src/pages/MainPage/ProjectManager/disposalManager.js b/src/pages/MainPage/ProjectManager/disposalManager.js index a9e0f6b..91431b0 100644 --- a/src/pages/MainPage/ProjectManager/disposalManager.js +++ b/src/pages/MainPage/ProjectManager/disposalManager.js @@ -13,8 +13,6 @@ import { getURLInformation } from '@/utils/CommonUtils'; import MessageDetail from '@/pages/SystemMessage/message/components/messageDetail' import NoticeDetail from '@/pages/notice/noticeList/components/NoticeDetail' import QuestDetail from '@/pages/SystemMessage/message/components/questDetail' -import { getQuestList } from '@/pages/SystemMessage/message/service' -import ChatUI from '@/pages/customerservice/support/conversation' //智慧客服 @connect(({ dashboard, loading }) => ({ ...dashboard, fetchtPageList: loading.effects['dashboard/fetchtPageList'], @@ -30,17 +28,6 @@ class manager extends PureComponent { noticeDetail: false, // 公告弹窗 questData: {},//问卷数据 questVisible: false, //问卷弹窗 - isModalVisible: false, //智慧客服 - isFlash: false, //智慧客服 - isCloseWs: true, //智慧客服 - optionsModal: false, //智慧客服 - projectModal: false, //智慧客服 - supplierNumber: '', //智慧客服 - staffId: '', //智慧客服' - staffName:'', //智慧客服 - kfType:0,//智慧客服 - questionType:0,//智慧客服 - roleIds:'',//智慧客服 } componentDidMount() { this.props.dispatch({ @@ -68,14 +55,6 @@ class manager extends PureComponent { userlevel: "1",                       //网站自定义会员级别,1-N,可根据选择判断,取值显示到小能客户端 erpparam: "abc"                          //erpparam为erp功能的扩展字段,可选,购买erp功能后用于erp功能集成 } - //<<<<<<智慧客服,获取供应商编码 - let userData = getSessionUserData() - let roleAuthority = getRA() - this.setState({roleIds: roleAuthority && roleAuthority.length>0? roleAuthority[0]: userData.roleIds}) - this.setState({staffId: userData.userId}) - this.setState({staffName: userData.fullName}) - this.setState({supplierNumber: userData.organizationId}) - //<<<<<<智慧客服end } onChange = (date, dateString) => { this.setState({ @@ -132,16 +111,6 @@ class manager extends PureComponent { questVisible: false }) } - initChatUI = () => { - //智慧客服 - if(this.state.isCloseWs && sessionStorage.getItem('CUSTOMERSERVICE_isCloseChatUIModal')==null){ //弹窗主动关闭或者页面刷新 - this.setState({optionsModal: true}) - }else{ - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - } - } followUpProject = async (data) => { // 项目跟进 auctionFollowUpAProjectManager(data) // sessionStorage.setItem('projectData', JSON.stringify(data)); @@ -150,10 +119,10 @@ class manager extends PureComponent { }; render() { const { projectlist, staloading, tlist, trelist, pagelist, disposalList } = this.props; - const { datevalue, messId, messageDetail, detailId, noticeDetail, questData, questVisible, isModalVisible, isCloseWs, optionsModal, projectModal, supplierNumber, staffId, staffName, kfType, questionType, isFlash, roleIds} = this.state; //智慧客服state + const { datevalue, messId, messageDetail, detailId, noticeDetail, questData, questVisible, } = this.state; return ( <> - this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 + {/* this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 */}
history.push('/SystemMessage/message')}>更多
}> @@ -223,52 +192,6 @@ class manager extends PureComponent { {messageDetail ? { this.closeModel(), this.props.dispatch({type: "dashboard/fetchtlistre", payload: { pageNo: 1, pageSize: 7 }}) }} modalVisible={messageDetail} /> : null } {questVisible ? { this.closeParticipate(), this.props.dispatch({type: "dashboard/fetchtlistre", payload: { pageNo: 1, pageSize: 7 }}) }} modalVisible={questVisible} /> : null} {noticeDetail && { this.noticeModel() }} modalVisible={noticeDetail} />} - {/*智慧客服*/} - { - this.setState({kfType: 2}) - this.setState({projectModal: true}) - }} - openWin={(kfType, questionType)=>{ - this.setState({questionType: questionType}) - this.setState({kfType: kfType}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - }} - closeWin={()=>{ - this.setState({kfType: 0}) - this.setState({questionType: 0}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - this.setState({isCloseWs: true}) - this.setState({projectModal: false}) - }} - optionsModal={optionsModal} - projectModal={projectModal} - isModalVisible={isModalVisible} - kfType={kfType} - questionType={questionType} - staffId={staffId} - staffName={staffName} - supplierNumber={supplierNumber} - isCloseWs={isCloseWs} - roleIds={roleIds} - hideWin={()=>{ - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - }} - closeOptionsModal={()=>{ - this.setState({optionsModal: false}) - }} - closeProjectModal={()=>{ - this.setState({projectModal: false}) - }} - msgAlert={()=>{ - if(!isModalVisible) this.setState({isFlash: true}) - }} - /> ) } diff --git a/src/pages/MainPage/ProjectManager/manager.js b/src/pages/MainPage/ProjectManager/manager.js index 7488cf8..998315d 100644 --- a/src/pages/MainPage/ProjectManager/manager.js +++ b/src/pages/MainPage/ProjectManager/manager.js @@ -16,7 +16,6 @@ import NoticeDetail from '@/pages/notice/noticeList/components/NoticeDetail' import QuestDetail from '@/pages/SystemMessage/message/components/questDetail' import { getQuestList } from '@/pages/SystemMessage/message/service' import ApprovalDetail from '@/pages/SystemMessage/message/components/approvalDetail' -import ChatUI from '@/pages/customerservice/support/conversation' //智慧客服 @connect(({ dashboard, loading }) => ({ ...dashboard, downlistLoading: loading.effects['dashboard/fetchDowntlist'], @@ -33,17 +32,6 @@ class manager extends PureComponent { questData: {},//问卷数据 questVisible: false,//问卷弹窗 mainDetail: false, // 审批单消息弹窗 - isModalVisible: false, //智慧客服 - isFlash: false, //智慧客服 - isCloseWs: true, //智慧客服 - optionsModal: false, //智慧客服 - projectModal: false, //智慧客服 - supplierNumber: '', //智慧客服 - staffId: '', //智慧客服' - staffName:'', //智慧客服 - kfType:0,//智慧客服 - questionType:0,//智慧客服 - roleIds:'',//智慧客服 // NTKF_PARAM: { // siteid: "bl_1000", //企业ID,,为固定值 // settingid: "bl_1000_1492484340268", //接待组ID,为固定值,必填 @@ -83,14 +71,6 @@ class manager extends PureComponent { userlevel: "1",                       //网站自定义会员级别,1-N,可根据选择判断,取值显示到小能客户端 erpparam: "abc"                          //erpparam为erp功能的扩展字段,可选,购买erp功能后用于erp功能集成 } - //智慧客服,获取供应商编码 - let userData = getSessionUserData() - let roleAuthority = getRA() - this.setState({roleIds: roleAuthority && roleAuthority.length>0? roleAuthority[0]: userData.roleIds}) - this.setState({staffId: userData.userId}) - this.setState({staffName: userData.fullName}) - this.setState({supplierNumber: userData.organizationId}) - //<<<<<<智慧客服end this.approvalDetail() } onChange = (date, dateString) => { @@ -154,16 +134,6 @@ class manager extends PureComponent { questVisible: false }) } - initChatUI = () => { - //智慧客服 - if(this.state.isCloseWs && sessionStorage.getItem('CUSTOMERSERVICE_isCloseChatUIModal')==null){ //弹窗主动关闭或者页面刷新 - this.setState({optionsModal: true}) - }else{ - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - } - } followUpProject = async (data) => { // let defId = ''; //项目流程id // await getDefId(data.id).then((res) => { @@ -181,10 +151,10 @@ 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, kfType, questionType, isFlash, roleIds} = this.state; //智慧客服state + const { datevalue, messId, messageDetail, detailId, noticeDetail, questData, questVisible, mainDetail, } = this.state; return ( <> - this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 + {/* 咨询服务︵8:30|12:3013:00|17:00 */}
{ @@ -312,52 +282,6 @@ class manager extends PureComponent { { idList.length > 0 ? { this.closeModel(), this.props.dispatch({ type: "dashboard/fetchtClarify", payload: { authorizestate: '0', templatetype: '4', size: 6 } }) }} modalVisible={mainDetail} /> : null } - {/*智慧客服*/} - { - this.setState({kfType: 2}) - this.setState({projectModal: true}) - }} - openWin={(kfType, questionType)=>{ - this.setState({questionType: questionType}) - this.setState({kfType: kfType}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - }} - closeWin={()=>{ - this.setState({kfType: 0}) - this.setState({questionType: 0}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - this.setState({isCloseWs: true}) - this.setState({projectModal: false}) - }} - optionsModal={optionsModal} - projectModal={projectModal} - isModalVisible={isModalVisible} - kfType={kfType} - questionType={questionType} - staffId={staffId} - staffName={staffName} - supplierNumber={supplierNumber} - isCloseWs={isCloseWs} - roleIds={roleIds} - hideWin={()=>{ - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - }} - closeOptionsModal={()=>{ - this.setState({optionsModal: false}) - }} - closeProjectModal={()=>{ - this.setState({projectModal: false}) - }} - msgAlert={()=>{ - if(!isModalVisible) this.setState({isFlash: true}) - }} - /> ) } diff --git a/src/pages/MainPage/ProjectManager/managerAdmin.js b/src/pages/MainPage/ProjectManager/managerAdmin.js index 31a2ad3..818e428 100644 --- a/src/pages/MainPage/ProjectManager/managerAdmin.js +++ b/src/pages/MainPage/ProjectManager/managerAdmin.js @@ -19,17 +19,6 @@ class manager extends PureComponent { state = { detailId: '1', // 公告id noticeDetail: false, // 公告弹窗 - isModalVisible: false, //智慧客服 - isFlash: false, //智慧客服 - isCloseWs: true, //智慧客服 - optionsModal: false, //智慧客服 - projectModal: false, //智慧客服 - supplierNumber: '', //智慧客服 - staffId: '', //智慧客服' - staffName:'', //智慧客服 - kfType:0,//智慧客服 - questionType:0,//智慧客服 - roleIds:'',//智慧客服 } componentDidMount() { this.props.dispatch({ @@ -45,14 +34,6 @@ class manager extends PureComponent { userlevel: "1",                       //网站自定义会员级别,1-N,可根据选择判断,取值显示到小能客户端 erpparam: "abc"                          //erpparam为erp功能的扩展字段,可选,购买erp功能后用于erp功能集成 } - //智慧客服,获取供应商编码 - let userData = getSessionUserData() - let roleAuthority = getRA() - this.setState({roleIds: roleAuthority && roleAuthority.length>0? roleAuthority[0]: userData.roleIds}) - this.setState({staffId: userData.userId}) - this.setState({staffName: userData.fullName}) - this.setState({supplierNumber: userData.organizationId}) - //<<<<<<智慧客服end } lookInfo = (id) => { // 公告查看 this.setState({ @@ -65,22 +46,13 @@ class manager extends PureComponent { noticeDetail: false }) } - initChatUI = () => { - //智慧客服 - if(this.state.isCloseWs && sessionStorage.getItem('CUSTOMERSERVICE_isCloseChatUIModal')==null){ //弹窗主动关闭或者页面刷新 - this.setState({optionsModal: true}) - }else{ - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - } - } + render() { const { tlist, trelist } = this.props; - const { detailId, noticeDetail, isModalVisible, isCloseWs, optionsModal, projectModal, supplierNumber, staffId, staffName, kfType, questionType, isFlash, roleIds } = this.state; //智慧客服state + const { detailId, noticeDetail,} = this.state; //智慧客服state return ( <> - this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 + {/* this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 */}
history.push('/notice/noticeList')}>更多
}> @@ -97,52 +69,6 @@ class manager extends PureComponent {
{noticeDetail && { this.noticeModel() }} modalVisible={noticeDetail} />} - {/*智慧客服*/} - { - this.setState({kfType: 2}) - this.setState({projectModal: true}) - }} - openWin={(kfType, questionType)=>{ - this.setState({questionType: questionType}) - this.setState({kfType: kfType}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - }} - closeWin={()=>{ - this.setState({kfType: 0}) - this.setState({questionType: 0}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - this.setState({isCloseWs: true}) - this.setState({projectModal: false}) - }} - optionsModal={optionsModal} - projectModal={projectModal} - isModalVisible={isModalVisible} - kfType={kfType} - questionType={questionType} - staffId={staffId} - staffName={staffName} - supplierNumber={supplierNumber} - isCloseWs={isCloseWs} - roleIds={roleIds} - hideWin={()=>{ - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - }} - closeOptionsModal={()=>{ - this.setState({optionsModal: false}) - }} - closeProjectModal={()=>{ - this.setState({projectModal: false}) - }} - msgAlert={()=>{ - if(!isModalVisible) this.setState({isFlash: true}) - }} - /> ) } diff --git a/src/pages/MainPage/ProjectManager/managerSubAdmin.js b/src/pages/MainPage/ProjectManager/managerSubAdmin.js index 09ff491..7e168be 100644 --- a/src/pages/MainPage/ProjectManager/managerSubAdmin.js +++ b/src/pages/MainPage/ProjectManager/managerSubAdmin.js @@ -10,7 +10,6 @@ import moment from 'moment'; import { getSessionUserData, getRA } from '@/utils/session'; import { getURLInformation } from '@/utils/CommonUtils'; import NoticeDetail from '@/pages/notice/noticeList/components/NoticeDetail' -import ChatUI from '@/pages/customerservice/support/conversation' //智慧客服 @connect(({ dashboard, loading }) => ({ ...dashboard, })) @@ -18,17 +17,6 @@ class manager extends PureComponent { state = { detailId: '1', // 公告id noticeDetail: false, // 公告弹窗 - isModalVisible: false, //智慧客服 - isFlash: false, //智慧客服 - isCloseWs: true, //智慧客服 - optionsModal: false, //智慧客服 - projectModal: false, //智慧客服 - supplierNumber: '', //智慧客服 - staffId: '', //智慧客服' - staffName:'', //智慧客服 - kfType:0,//智慧客服 - questionType:0,//智慧客服 - roleIds:'',//智慧客服 } componentDidMount() { this.props.dispatch({ @@ -44,14 +32,6 @@ class manager extends PureComponent { userlevel: "1",                       //网站自定义会员级别,1-N,可根据选择判断,取值显示到小能客户端 erpparam: "abc"                          //erpparam为erp功能的扩展字段,可选,购买erp功能后用于erp功能集成 } - //智慧客服,获取供应商编码 - let userData = getSessionUserData() - let roleAuthority = getRA() - this.setState({roleIds: roleAuthority && roleAuthority.length>0? roleAuthority[0]: userData.roleIds}) - this.setState({staffId: userData.userId}) - this.setState({staffName: userData.fullName}) - this.setState({supplierNumber: userData.organizationId}) - //<<<<<<智慧客服end } lookInfo = (id) => { // 公告查看 this.setState({ @@ -64,22 +44,13 @@ class manager extends PureComponent { noticeDetail: false }) } - initChatUI = () => { - //智慧客服 - if(this.state.isCloseWs && sessionStorage.getItem('CUSTOMERSERVICE_isCloseChatUIModal')==null){ //弹窗主动关闭或者页面刷新 - this.setState({optionsModal: true}) - }else{ - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - } - } + render() { const { tlist, trelist } = this.props; - const { detailId, noticeDetail, isModalVisible, isCloseWs, optionsModal, projectModal, supplierNumber, staffId, staffName, kfType, questionType, isFlash, roleIds} = this.state; //智慧客服state + const { detailId, noticeDetail, } = this.state; return ( <> - this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 + {/* this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 */}
history.push('/notice/noticeList')}>更多
}> @@ -96,52 +67,6 @@ class manager extends PureComponent { {noticeDetail && { this.noticeModel() }} modalVisible={noticeDetail} />} - {/*智慧客服*/} - { - this.setState({kfType: 2}) - this.setState({projectModal: true}) - }} - openWin={(kfType, questionType)=>{ - this.setState({questionType: questionType}) - this.setState({kfType: kfType}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - }} - closeWin={()=>{ - this.setState({kfType: 0}) - this.setState({questionType: 0}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - this.setState({isCloseWs: true}) - this.setState({projectModal: false}) - }} - optionsModal={optionsModal} - projectModal={projectModal} - isModalVisible={isModalVisible} - kfType={kfType} - questionType={questionType} - staffId={staffId} - staffName={staffName} - supplierNumber={supplierNumber} - isCloseWs={isCloseWs} - roleIds={roleIds} - hideWin={()=>{ - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - }} - closeOptionsModal={()=>{ - this.setState({optionsModal: false}) - }} - closeProjectModal={()=>{ - this.setState({projectModal: false}) - }} - msgAlert={()=>{ - if(!isModalVisible) this.setState({isFlash: true}) - }} - /> ) } diff --git a/src/pages/MainPage/ProjectManager/participants.js b/src/pages/MainPage/ProjectManager/participants.js index af81eee..a715881 100644 --- a/src/pages/MainPage/ProjectManager/participants.js +++ b/src/pages/MainPage/ProjectManager/participants.js @@ -16,7 +16,6 @@ import NoticeModal from '@/pages/Auction/NoticeModal/noticeModal' import StopReason from '@/pages/Auction/NoticeModal/stopReason' import QuestDetail from '@/pages/SystemMessage/message/components/questDetail' import { getQuestList } from '@/pages/SystemMessage/message/service' -import ChatUI from '@/pages/customerservice/support/conversation' //智慧客服 @connect(({ dashboard, loading }) => ({ ...dashboard, @@ -36,17 +35,7 @@ class manager extends PureComponent { tpid: '0', // 中止原因id isModalVisible: false, // 中止原因弹窗 questData: {},//问卷数据 - questVisible: false, //问卷弹窗 - isChatModalVisible: false, //智慧客服 - isFlash: false, //智慧客服 - isCloseWs: true, //智慧客服 - optionsModal: false, //智慧客服 - projectModal: false, //智慧客服 - supplierNumber: '', //智慧客服 - staffId: '', //智慧客服' - staffName:'', //智慧客服 - kfType:0,//智慧客服 - questionType:0,//智慧客服 + questVisible: false, //问卷弹窗服 roleIds:'',//智慧客服 } componentDidMount() { @@ -75,14 +64,6 @@ class manager extends PureComponent { userlevel: "1",                       //网站自定义会员级别,1-N,可根据选择判断,取值显示到小能客户端 erpparam: "abc"                          //erpparam为erp功能的扩展字段,可选,购买erp功能后用于erp功能集成 } - //智慧客服,获取供应商编码 - let userData = getSessionUserData() - let roleAuthority = getRA() - this.setState({roleIds: roleAuthority && roleAuthority.length>0? roleAuthority[0]: userData.roleIds}) - this.setState({staffId: userData.userId}) - this.setState({staffName: userData.fullName}) - this.setState({supplierNumber: userData.organizationId}) - //<<<<<<智慧客服end } onChange = (date, dateString) => { this.setState({ @@ -160,22 +141,13 @@ class manager extends PureComponent { sessionStorage.setItem('projectData', JSON.stringify(projectData)); window.open("/AuctionViewAuctions/Index"); } - initChatUI = () => { - //智慧客服 - if(this.state.isCloseWs && sessionStorage.getItem('CUSTOMERSERVICE_isCloseChatUIModal')==null){ //弹窗主动关闭或者页面刷新 - this.setState({optionsModal: true}) - }else{ - this.setState({isChatModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - } - } + render() { const { projectlist, staloading, tlist, trelist, shotList, Participants } = this.props; - const { datevalue, messId, messageDetail, detailId, noticeDetail, noticeModalVis, projectId, isModalVisible, tpid, questData, questVisible, isChatModalVisible, isCloseWs, optionsModal, projectModal, supplierNumber, staffId, staffName, kfType, questionType, isFlash, roleIds} = this.state; //智慧客服state + const { datevalue, messId, messageDetail, detailId, noticeDetail, noticeModalVis, projectId, isModalVisible, tpid, questData, questVisible, } = this.state; return ( <> - this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 + {/* this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 */}
history.push('/SystemMessage/message')}>更多
}> @@ -264,52 +236,6 @@ class manager extends PureComponent { {noticeDetail && { this.noticeModel() }} modalVisible={noticeDetail} />} { this.noticeModel() }} /> { this.noticeModel() }} /> - {/*智慧客服*/} - { - this.setState({kfType: 2}) - this.setState({projectModal: true}) - }} - openWin={(kfType, questionType)=>{ - this.setState({questionType: questionType}) - this.setState({kfType: kfType}) - this.setState({optionsModal: false}) - this.setState({isChatModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - }} - closeWin={()=>{ - this.setState({kfType: 0}) - this.setState({questionType: 0}) - this.setState({optionsModal: false}) - this.setState({isChatModalVisible: false}) - this.setState({isCloseWs: true}) - this.setState({projectModal: false}) - }} - optionsModal={optionsModal} - projectModal={projectModal} - isModalVisible={isChatModalVisible} - kfType={kfType} - questionType={questionType} - staffId={staffId} - staffName={staffName} - supplierNumber={supplierNumber} - isCloseWs={isCloseWs} - roleIds={roleIds} - hideWin={()=>{ - this.setState({optionsModal: false}) - this.setState({isChatModalVisible: false}) - }} - closeOptionsModal={()=>{ - this.setState({optionsModal: false}) - }} - closeProjectModal={()=>{ - this.setState({projectModal: false}) - }} - msgAlert={()=>{ - if(!isChatModalVisible) this.setState({isFlash: true}) - }} - /> ) } diff --git a/src/pages/MainPage/ProjectManager/purchaseManager.js b/src/pages/MainPage/ProjectManager/purchaseManager.js index 22dd04f..e269900 100644 --- a/src/pages/MainPage/ProjectManager/purchaseManager.js +++ b/src/pages/MainPage/ProjectManager/purchaseManager.js @@ -16,7 +16,6 @@ import NoticeDetail from '@/pages/notice/noticeList/components/NoticeDetail' import QuestDetail from '@/pages/SystemMessage/message/components/questDetail' import { getQuestList } from '@/pages/SystemMessage/message/service' import ApprovalDetail from '@/pages/SystemMessage/message/components/approvalDetail' -import ChatUI from '@/pages/customerservice/support/conversation' //智慧客服 @connect(({ dashboard, loading }) => ({ ...dashboard, downlistLoading: loading.effects['dashboard/fetchDowntlist'], @@ -34,16 +33,6 @@ class manager extends PureComponent { questVisible: false, //问卷弹窗 mainDetail: false, // 审批单消息弹窗 isModalVisible: false, //智慧客服 - isFlash: false, //智慧客服 - isCloseWs: true, //智慧客服 - optionsModal: false, //智慧客服 - projectModal: false, //智慧客服 - supplierNumber: '', //智慧客服 - staffId: '', //智慧客服' - staffName:'', //智慧客服 - kfType:0,//智慧客服 - questionType:0,//智慧客服 - roleIds:'',//智慧客服 } componentDidMount() { this.props.dispatch({ @@ -75,14 +64,6 @@ class manager extends PureComponent { userlevel: "1",                       //网站自定义会员级别,1-N,可根据选择判断,取值显示到小能客户端 erpparam: "abc"                          //erpparam为erp功能的扩展字段,可选,购买erp功能后用于erp功能集成 } - //智慧客服,获取供应商编码 - let userData = getSessionUserData() - let roleAuthority = getRA() - this.setState({roleIds: roleAuthority && roleAuthority.length>0? roleAuthority[0]: userData.roleIds}) - this.setState({staffId: userData.userId}) - this.setState({staffName: userData.fullName}) - this.setState({supplierNumber: userData.organizationId}) - //<<<<<<智慧客服end this.approvalDetail() } onChange = (date, dateString) => { @@ -150,22 +131,13 @@ class manager extends PureComponent { await followUpAProjectManager(data); history.push('/ProjectLayout/Manager/HomePageSectionList'); }; - initChatUI = () => { - //智慧客服 - if(this.state.isCloseWs && sessionStorage.getItem('CUSTOMERSERVICE_isCloseChatUIModal')==null){ //弹窗主动关闭或者页面刷新 - this.setState({optionsModal: true}) - }else{ - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - } - } + 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, kfType, questionType, isFlash, roleIds} = this.state; //智慧客服state + const { datevalue, messId, messageDetail, detailId, noticeDetail, questData, questVisible, mainDetail, } = this.state; //智慧客服state return ( <> - this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 + {/* this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 */}
history.push('/SystemMessage/message')}>更多
}> @@ -287,52 +259,6 @@ class manager extends PureComponent { { idList.length > 0 ? { this.closeModel(), this.props.dispatch({ type: "dashboard/fetchtClarify", payload: { authorizestate: '0', templatetype: '4', size: 6 } }) }} modalVisible={mainDetail} /> : null } - {/*智慧客服*/} - { - this.setState({kfType: 2}) - this.setState({projectModal: true}) - }} - openWin={(kfType, questionType)=>{ - this.setState({questionType: questionType}) - this.setState({kfType: kfType}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - }} - closeWin={()=>{ - this.setState({kfType: 0}) - this.setState({questionType: 0}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - this.setState({isCloseWs: true}) - this.setState({projectModal: false}) - }} - optionsModal={optionsModal} - projectModal={projectModal} - isModalVisible={isModalVisible} - kfType={kfType} - questionType={questionType} - staffId={staffId} - staffName={staffName} - supplierNumber={supplierNumber} - isCloseWs={isCloseWs} - roleIds={roleIds} - hideWin={()=>{ - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - }} - closeOptionsModal={()=>{ - this.setState({optionsModal: false}) - }} - closeProjectModal={()=>{ - this.setState({projectModal: false}) - }} - msgAlert={()=>{ - if(!isModalVisible) this.setState({isFlash: true}) - }} - /> ) } diff --git a/src/pages/MainPage/ProjectManager/supplier.js b/src/pages/MainPage/ProjectManager/supplier.js index ca1b97a..bee62d2 100644 --- a/src/pages/MainPage/ProjectManager/supplier.js +++ b/src/pages/MainPage/ProjectManager/supplier.js @@ -18,8 +18,6 @@ import IParticipateIn from '@/utils/IParticipateIn' import InvitationLetter from '@/utils/InvitationLetter' import QuestDetail from '@/pages/SystemMessage/message/components/questDetail' import { getQuestList } from '@/pages/SystemMessage/message/service' -import ChatUI from '@/pages/customerservice/support/conversation' //智慧客服 - @connect(({ dashboard, loading }) => ({ ...dashboard, downlistLoading: loading.effects['dashboard/fetchDowntlist'], @@ -40,17 +38,6 @@ class supplier extends PureComponent { questData: {},//问卷数据 questVisible: false, //问卷弹窗 datestring: moment().format('YYYY-MM'),//我参与的项目日期 - isModalVisible: false, //智慧客服 - isFlash: false, //智慧客服 - isCloseWs: true, //智慧客服 - optionsModal: false, //智慧客服 - projectModal: false, //智慧客服 - supplierNumber: '', //智慧客服 - staffId: '', //智慧客服' - staffName:'', //智慧客服 - kfType:0,//智慧客服 - questionType:0,//智慧客服 - roleIds:'',//智慧客服 } componentDidMount() { const paramst = { @@ -94,14 +81,6 @@ class supplier extends PureComponent { userlevel: "1",                       //网站自定义会员级别,1-N,可根据选择判断,取值显示到小能客户端 erpparam: "abc"                          //erpparam为erp功能的扩展字段,可选,购买erp功能后用于erp功能集成 } - //智慧客服,获取供应商编码 - let userData = getSessionUserData() - let roleAuthority = getRA() - this.setState({roleIds: roleAuthority && roleAuthority.length>0? roleAuthority[0]: userData.roleIds}) - this.setState({staffId: userData.userId}) - this.setState({staffName: userData.fullName}) - this.setState({supplierNumber: userData.organizationId}) - //<<<<<<智慧客服end this.clarifyDetail() } onChange = (date, dateString) => { @@ -197,22 +176,12 @@ class supplier extends PureComponent { invitationDetail: true }) } - initChatUI = () => { - //智慧客服 - if(this.state.isCloseWs && sessionStorage.getItem('CUSTOMERSERVICE_isCloseChatUIModal')==null){ //弹窗主动关闭或者页面刷新 - this.setState({optionsModal: true}) - }else{ - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - } - } render() { const { supplieruplist, supplierleftlist, supplierrightlist, staloading, tlist, trelist, idList, dateNum } = this.props; - const { datevalue, messId, messageDetail, mainDetail, detailId, noticeDetail, joinData, joinDetail, invitationData, invitationDetail, questData, questVisible, isModalVisible, isCloseWs, optionsModal, projectModal, supplierNumber, staffId, staffName, kfType, questionType, isFlash, roleIds} = this.state; //智慧客服state + const { datevalue, messId, messageDetail, mainDetail, detailId, noticeDetail, joinData, joinDetail, invitationData, invitationDetail, questData, questVisible,} = this.state; return ( <> - this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00 + this.initChatUI()}>咨询服务︵8:30|12:3013:00|17:00
history.push('/SystemMessage/message')}>更多
}> @@ -323,52 +292,6 @@ class supplier extends PureComponent { {noticeDetail && { this.noticeModel() }} modalVisible={noticeDetail} />} {joinData == '' ? null : { this.noticeModel() }} visible={joinDetail} />} {invitationData == '' ? null : { this.noticeModel() }} visible={invitationDetail} />} - {/*智慧客服*/} - { - this.setState({kfType: 2}) - this.setState({projectModal: true}) - }} - openWin={(kfType, questionType)=>{ - this.setState({questionType: questionType}) - this.setState({kfType: kfType}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: true}) - this.setState({isCloseWs: false}) - this.setState({isFlash :false}) - }} - closeWin={()=>{ - this.setState({kfType: 0}) - this.setState({questionType: 0}) - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - this.setState({isCloseWs: true}) - this.setState({projectModal: false}) - }} - optionsModal={optionsModal} - projectModal={projectModal} - isModalVisible={isModalVisible} - kfType={kfType} - questionType={questionType} - staffId={staffId} - staffName={staffName} - supplierNumber={supplierNumber} - isCloseWs={isCloseWs} - roleIds={roleIds} - hideWin={()=>{ - this.setState({optionsModal: false}) - this.setState({isModalVisible: false}) - }} - closeOptionsModal={()=>{ - this.setState({optionsModal: false}) - }} - closeProjectModal={()=>{ - this.setState({projectModal: false}) - }} - msgAlert={()=>{ - if(!isModalVisible) this.setState({isFlash: true}) - }} - /> ) } diff --git a/src/pages/Tender/ProjectsInvolved/index.tsx b/src/pages/Tender/ProjectsInvolved/index.tsx index 2d40af1..791834c 100644 --- a/src/pages/Tender/ProjectsInvolved/index.tsx +++ b/src/pages/Tender/ProjectsInvolved/index.tsx @@ -1,15 +1,16 @@ -import React, { useState, useRef } from 'react'; +import React, { useState, useRef, useEffect } from 'react'; import { Button, Tabs, Form, Input, Modal, Space, Checkbox, message, PageHeader, Popconfirm, Progress, Tag, Spin } from 'antd'; import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table'; import { getSection, exitProject, getProject, getOther, supplierRegister, exitProjectPayCheck } from './service'; import { getSupplierUser } from '@/utils/SupplierList/service' -import { getProMethod } from '@/utils/session'; +import { getProMethod, getSessionUserData, getRA } from '@/utils/session'; import '@/assets/ld_style.less'; import { history } from 'umi'; import { followUpAProjectSupplier, getDicData } from '@/utils/session'; import { getDictName, getProjectTypeCode, getURLInformation, getUrlParam, getUrlRelativePath, isEmpty, isNotEmpty, proTableValueEnum, proTableValueEnumOther } from '@/utils/CommonUtils'; import { btnAuthority } from '@/utils/authority'; import ProList from '@ant-design/pro-list'; +import { MessageOutlined } from '@ant-design/icons'; const { TabPane } = Tabs; const { TextArea } = Input; @@ -36,6 +37,8 @@ const Index: React.FC<{}> = () => { const [sectionsVal, setSectionsVal] = useState([]); // 选中数组id const [organId, setOrganId] = useState(); // id const [projectId, setProjectId] = useState(); // id + + const [quitForm] = Form.useForm(); const MethodDict = getProMethod(); //获取采购方式 const modalHeight = (innerHeight * 96) / 100; @@ -120,6 +123,13 @@ const Index: React.FC<{}> = () => { dataIndex: 'projectName', initialValue: projectName ? projectName : void 0, }, + { + title: '我要咨询', + dataIndex: 'consult', + render: (text: any, record: any) => ( + - -
- - {isSendFile && - {setIsSendFile(false);sendFile()}} onCancel={()=>setIsSendFile(false)} > - -
{e.preventDefault()}} onClick={openLocalUploadFile} className={style.customer_service_uploadfile}> - {uploadFile.name} - {uploadFile.size / 1024>=1024?(uploadFile.size / 1024/1024).toFixed(1)+"M":(uploadFile.size / 1024).toFixed(1)+"K"} - -
-
-
-

您确定要上传文件么?【确定】后,文件将无法撤回!

-
- } - - ) -}) -ChatInput.propTypes = { - me:PropTypes.object.isRequired, - onSend:PropTypes.func.isRequired, - height:PropTypes.number.isRequired, - showPic:PropTypes.func.isRequired, - changeHeight:PropTypes.func.isRequired, - setPostion:PropTypes.func.isRequired, - isModalVisible:PropTypes.bool, - style:PropTypes.any, - chatUI:PropTypes.any, - supplierNo:PropTypes.any, - roleIds:PropTypes.any, -} -export default ChatInput; \ No newline at end of file diff --git a/src/pages/customerservice/support/conversation/components/ChatInput/style.module.css b/src/pages/customerservice/support/conversation/components/ChatInput/style.module.css deleted file mode 100644 index f96b8c3..0000000 --- a/src/pages/customerservice/support/conversation/components/ChatInput/style.module.css +++ /dev/null @@ -1,103 +0,0 @@ -.customer_service_content { - background-color: white; - box-sizing: border-box; - width: 100%; - height: 100%; - min-height: 150px; - display: flex; - flex-direction: column; - /* box-shadow: 0px -5px 10px -5px rgba(0, 0, 0, 0.2); */ -} -.customer_service_content .input_area { - height: 100%; - overflow-y:auto; - border: none; - outline: none; - padding: 10px; - margin-right: 10px; - font-size: 16px; - line-height: 22px; - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - letter-spacing: 2px; -} -.customer_service_content .input_area .emoji{ - font-size: 20px; -} -.customer_service_content .input_area::placeholder { - color: #999; -} -.customer_service_content .but_area { - align-self: flex-end; - margin-bottom: 10px; - margin-right: 20px; -} -.customer_service_content .but:hover{ - cursor: pointer; -} -.customer_service_content .but { - padding: 3px 20px; - border: none; - outline: none; - -background-color: #2ba245; - background-color: rgb(235, 34, 32); - color: white; - border-radius: 3px; -} -.customer_service_content .but:active { - background-color: rgb(235, 34, 32); -} -.customer_service_content .but:disabled { - background-color: #ddd; - cursor:auto; -} -.customer_service_content .bar_block{ - width: 8px; - /* border-radius: 4px; */ - box-sizing: border-box; - background-color: white -} -.customer_service_uploadfile{ - border: 1px solid #CCC; - background-color: white; - width: 200px; - height: 120px; - position: relative; - -webkit-touch-callout: none; /* iOS Safari */ - -webkit-user-select: none; /* Chrome/Safari/Opera */ - -khtml-user-select: none; /* Konqueror */ - -moz-user-select: none; /* Firefox */ - -ms-user-select: none; /* Internet Explorer/Edge */ - user-select: none; /* Non-prefixed version, currently - not supported by any browser */ -} -.customer_service_uploadfile:hover{ - cursor: pointer; -} -.customer_service_filename { - height: 45px; - margin-left: 10px; - margin-top: 5px; -} -.customer_service_filesize { - margin-left: 10px; - margin-top: 5px; - color: rgb(153,153,153); -} -.customer_service_ellipsis { - max-width: 150px; - overflow: hidden; - text-overflow: ellipsis; - display:-webkit-box; - -webkit-box-orient:vertical; - -webkit-line-clamp:2; - -white-space: nowrap; -} -.customer_service_uploadicon{ - float: right; - margin-top: 15px; - margin-right: 10px; - width: 40px; - height: 40px; - background-image: url('../../image/uploadFile.png'); - background-size: cover; -} \ No newline at end of file diff --git a/src/pages/customerservice/support/conversation/components/ChatRecordList/ChatRecordList.jsx b/src/pages/customerservice/support/conversation/components/ChatRecordList/ChatRecordList.jsx deleted file mode 100644 index b37c7d1..0000000 --- a/src/pages/customerservice/support/conversation/components/ChatRecordList/ChatRecordList.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react' -import style from './style.module.css' -import MsgItem from '../MsgItem/MsgItem' -import PropTypes from 'prop-types'; -import {Spin } from 'antd' - -const ChatRecordList = (props) => { - let { data, me, showPic, reConnect, onEarlier } = props - return ( - -
-
- -
- - {data.map((bubble) => ( - - ))} -
-
- ) -} -ChatRecordList.propTypes = { - loading: PropTypes.bool, - showPic: PropTypes.func, - contact: PropTypes.object, - data:PropTypes.array, - me:PropTypes.any, -} -export default ChatRecordList - diff --git a/src/pages/customerservice/support/conversation/components/ChatRecordList/style.module.css b/src/pages/customerservice/support/conversation/components/ChatRecordList/style.module.css deleted file mode 100644 index ba10780..0000000 --- a/src/pages/customerservice/support/conversation/components/ChatRecordList/style.module.css +++ /dev/null @@ -1,29 +0,0 @@ -.customer_service_content_list_area { - flex: 1; - overflow: auto; - -ms-overflow-style: none; - overflow: -moz-scrollbars-none; - padding: 10px; - background-color: rgb(245,245,245) -} -.customer_service_content_list_area .load_more { - display: flex; - justify-content: center; - align-items: center; - height: 20px; - width: 100px; - text-align: center; - color: #999; - background-color: #f1f1f1; - font-size: 12px; - margin: 0 auto; - border: none; - outline: none; - border-radius: 10px; - -moz-user-select: none; - -khtml-user-select: none; - user-select: none; -} -.customer_service_content_list_area .load_more:hover { - cursor: pointer; -} \ No newline at end of file diff --git a/src/pages/customerservice/support/conversation/components/ChatToolsBar/ChatToolBar.jsx b/src/pages/customerservice/support/conversation/components/ChatToolsBar/ChatToolBar.jsx deleted file mode 100644 index 9573864..0000000 --- a/src/pages/customerservice/support/conversation/components/ChatToolsBar/ChatToolBar.jsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import style from './style.module.css' -import EmojiPopover from '../EmojiPopover/EmojiPopover' -import ImgPopover from '../ImgPopover/ImgPopover' -import FilePopover from '../FilePopover/FilePopover' -import RatePopover from '../RatePopover/RatePopover' - -export default function ChatToolBar(props) { - const { tools = [], - onEmojiSelect, - onImage, - onFile, - onRate, - isRateModalVisible, - closeRateModal, - } = props - return ( -
- {typeof onEmojiSelect === 'function' && ( - - )} - {typeof onImage === 'function' && } - {typeof onFile === 'function' && } - {typeof onRate === 'function' && } - {/* */} - {tools.map((tool) => tool)} -
- ) -} - -ChatToolBar.propTypes = { - tools: PropTypes.array, - onEmojiSelect: PropTypes.func, - onImage: PropTypes.func, - onFile:PropTypes.func, -} diff --git a/src/pages/customerservice/support/conversation/components/ChatToolsBar/style.module.css b/src/pages/customerservice/support/conversation/components/ChatToolsBar/style.module.css deleted file mode 100644 index 3b95871..0000000 --- a/src/pages/customerservice/support/conversation/components/ChatToolsBar/style.module.css +++ /dev/null @@ -1,8 +0,0 @@ -.customer_service_content { - height: 30px; - display: flex; - align-items: center; - padding: 0px 10px; - margin-top: 8px; - margin-right: 10px; -} \ No newline at end of file diff --git a/src/pages/customerservice/support/conversation/components/EmojiPopover/EmojiPopover.jsx b/src/pages/customerservice/support/conversation/components/EmojiPopover/EmojiPopover.jsx deleted file mode 100644 index a5898e8..0000000 --- a/src/pages/customerservice/support/conversation/components/EmojiPopover/EmojiPopover.jsx +++ /dev/null @@ -1,85 +0,0 @@ -import React, { useEffect, useState } from 'react' -import PropTypes from 'prop-types' -import style from './style.module.css' -import { cns } from '../../utils/toClass' - -const emojiList = [ - '😃', - '😄', - '😁', - '😆', - '😅', - '😂', - '😊', - '😇', - '🙂', - '🙃', - '😉', - '😌', - '😘', - '😗', - '😙', - '😚', - '😋', - '😛', - '😝', - '😜', - '😎', - '😳', - '😱', - '😨', - '😰', - '😥', - '😓', - -] -export default function EmojiPopover(props) { - const {onSelect} = props - const [visible, setVisible] = useState(false) - - const switchEmojiModal = (vis) => { - setVisible(vis) - } - - const iconClickHandle = (emoji) => { - onSelect(emoji) - } - const emojiFn = (e)=>{ - if (e.target.getAttribute('datatype') === 'emoji') { - switchEmojiModal(true) - } else { - switchEmojiModal(false) - } - } - useEffect(() => { - addEventListener('click', emojiFn) - return () => { - removeEventListener('click',emojiFn) - } - }, []) - - return ( -
-
- {emojiList.map((emoji) => ( - - {emoji} - - ))} -
-
-
- ) -} - -EmojiPopover.propTypes = { - onSelect: PropTypes.func.isRequired, -} diff --git a/src/pages/customerservice/support/conversation/components/EmojiPopover/style.module.css b/src/pages/customerservice/support/conversation/components/EmojiPopover/style.module.css deleted file mode 100644 index 83064eb..0000000 --- a/src/pages/customerservice/support/conversation/components/EmojiPopover/style.module.css +++ /dev/null @@ -1,56 +0,0 @@ -.customer_service_content { - position: relative; -} -.customer_service_content .emoji_wrapper { - position: absolute; - bottom: -90px; - left: 30px; - display: flex; - flex-wrap: wrap; - width: 400px; - background-color: white; - border: solid 1px #aaaaaa; - border-radius: 5px; - padding: 3px; -} -.customer_service_content .emoji_wrapper::before { - content: ''; - border: solid 8px transparent; - border-right: solid 8px #aaaaaa; - position: absolute; - top: 50%; - left: -16px; -} -.customer_service_content .emoji_wrapper::after { - content: ''; - border: solid 8px transparent; - border-right: solid 8px white; - position: absolute; - top: 50%; - left: -14.5px; -} -.customer_service_content .emoji_item { - font-size: 22px; - box-sizing: border-box; - padding: 0px 7px 0px 3px; -} -.customer_service_content .emoji_item:hover { - background-color: #f1f1f1; - border-radius: 50%; - cursor: pointer; -} -.customer_service_content .tool_icon { - height: 20px; - width: 20px; - background-size: 100%; - background-repeat: no-repeat; - background-position: center; - margin-right: 10px; -} -.customer_service_content .emoji { - background-image: url('../../image/emoji_black.png'); -} -.customer_service_content .emoji:hover { - cursor: pointer; - background-image: url('../../image/emoji_light.png'); -} diff --git a/src/pages/customerservice/support/conversation/components/FilePopover/FilePopover.jsx b/src/pages/customerservice/support/conversation/components/FilePopover/FilePopover.jsx deleted file mode 100644 index 4d1cdad..0000000 --- a/src/pages/customerservice/support/conversation/components/FilePopover/FilePopover.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import React, {useRef, useState } from 'react' -import PropTypes from 'prop-types' -import style from './style.module.css' -import { message, Modal, Tooltip} from 'antd'; -export default function FilePopover(props) { - const { onFile } = props - const fileSelector = useRef() - const isUpload = (file) => { - // /* - // let name = file.name; - // let type; - // if (name.lastIndexOf(".") > 0) { - // type = name - // .substr(name.lastIndexOf(".") + 1, name.length) - // .toLocaleLowerCase(); - // } - // let isType = ["pdf", "png", "jpg", "jpeg"].indexOf(type) === -1; - // if (isType) { - // message.error("上传格式错误"); - // }*/ - const isType = false - const isLt50M = file.size / 1024 / 1024 < 20; - if (!isLt50M) { - message.error("文件大小不能超过20MB"); - } - const bool = !isType && isLt50M; - return bool - } - - const beforeUpload = (file) => { - let bool = isUpload(file) - if (bool) { - onFile(file) - } - return false; - }; - const selectImg = () => { - if (fileSelector.current) { - fileSelector.current.value='' - fileSelector.current.click() - } - } - - const fileHandle = (event) => { - const files = event.target.files - //console.log(files[0]) - // if(files && files[0] && (files[0].type.indexOf('application/')!=-1 || files[0].type.indexOf('text/plain')!=-1 )){ - // beforeUpload(files[0]) - // }else{ - // message.error('上传文件格式不支持') - // } - beforeUpload(files[0]) - } - return ( -
- -
- ) -} - -FilePopover.propTypes = { - onFile: PropTypes.func.isRequired, -} diff --git a/src/pages/customerservice/support/conversation/components/FilePopover/style.module.css b/src/pages/customerservice/support/conversation/components/FilePopover/style.module.css deleted file mode 100644 index e9d5bca..0000000 --- a/src/pages/customerservice/support/conversation/components/FilePopover/style.module.css +++ /dev/null @@ -1,16 +0,0 @@ -.customer_service_content { - width: 20px; - height: 20px; - margin-right: 10px; - background-image: url('../../image/file_black.png'); - background-size: 100%; - background-position: center; - background-repeat: no-repeat; -} -.customer_service_content:hover { - background-image: url('../../image/file_light.png'); - cursor: pointer; -} -.customer_service_content > input { - display: none; -} diff --git a/src/pages/customerservice/support/conversation/components/ImgPopover/ImgPopover.jsx b/src/pages/customerservice/support/conversation/components/ImgPopover/ImgPopover.jsx deleted file mode 100644 index 64f6821..0000000 --- a/src/pages/customerservice/support/conversation/components/ImgPopover/ImgPopover.jsx +++ /dev/null @@ -1,86 +0,0 @@ -import React, {useRef } from 'react' -import PropTypes from 'prop-types' -import style from './style.module.css' -import { message } from "antd"; -//import { customerserviceAPI as API} from '@/services/customerservice'; - -export default function ImgPopover(props) { - const { onImage } = props - const fileSelector = useRef() - - const isUpload = (file) => { - /* - let name = file.name; - let type; - if (name.lastIndexOf(".") > 0) { - type = name - .substr(name.lastIndexOf(".") + 1, name.length) - .toLocaleLowerCase(); - } - let isType = ["pdf", "png", "jpg", "jpeg"].indexOf(type) === -1; - if (isType) { - message.error("上传格式错误"); - }*/ - const isType = false - const isLt50M = file.size / 1024 / 1024 < 50; - if (!isLt50M) { - message.error("文件大小不能超过50MB"); - } - const bool = !isType && isLt50M; - return bool - } - - const beforeUpload = (file) => { - let bool = isUpload(file) - if (bool) { - onImage(file) - /* - const formData = new FormData(); - console.log(file.getOriginalFilename()) - formData.append('multipartFiles', file); - API.fileUpload({ - multipartFiles: formData - }).then(res => { - if (res && res.data && res.data.length>0 && res.data[0].sysStorageVO && res.data[0].sysStorageVO.filePath!=undefined && res.data[0].sysStorageVO.filePath!=null&& res.data[0].sysStorageVO.filePath!='') { - console.log(res) - console.log(res.data) - - //文档中心返回的filePath重写content - - }else{ - console.log(res && res.message) - } - })*/ - } - return false; - }; - const selectImg = () => { - if (fileSelector.current) { - fileSelector.current.value='' - fileSelector.current.click() - } - } - - const fileHandle = (event) => { - const files = event.target.files - if(files && files[0] && files[0].type.indexOf('image/')!=-1){ - beforeUpload(files[0]) - }else{ - message.error("上传格式错误"); - } - } - return ( -
- -
- ) -} - -ImgPopover.propTypes = { - onImage: PropTypes.func.isRequired, -} diff --git a/src/pages/customerservice/support/conversation/components/ImgPopover/style.module.css b/src/pages/customerservice/support/conversation/components/ImgPopover/style.module.css deleted file mode 100644 index 7c95726..0000000 --- a/src/pages/customerservice/support/conversation/components/ImgPopover/style.module.css +++ /dev/null @@ -1,16 +0,0 @@ -.customer_service_content { - width: 20px; - height: 20px; - margin-right: 10px; - background-image: url('../../image/pic_black.png'); - background-size: 100%; - background-position: center; - background-repeat: no-repeat; -} -.customer_service_content:hover { - background-image: url('../../image/pic_light.png'); - cursor: pointer; -} -.customer_service_content > input { - display: none; -} diff --git a/src/pages/customerservice/support/conversation/components/ImgPreview/ImgPreview.jsx b/src/pages/customerservice/support/conversation/components/ImgPreview/ImgPreview.jsx deleted file mode 100644 index 94ca9e6..0000000 --- a/src/pages/customerservice/support/conversation/components/ImgPreview/ImgPreview.jsx +++ /dev/null @@ -1,56 +0,0 @@ -import React, { useRef, useState, useEffect } from 'react' -import PropTypes from 'prop-types' -import {handleElement } from '../../utils/utils' -import { Button,} from 'antd'; -import { CloseOutlined, BorderOutlined, MinusOutlined } from '@ant-design/icons'; -import style from './style.module.css' - -export default function ImgPreview(props) { - const { isImgPreviewVisible, imageParams, closePreview, maxSizePreview, normalSizePreview,} = props - const imgRef = useRef() - const [scales,setScales] = useState(1) - //const refs = useRef() - - const changeScales = (a) =>{ - setScales(a) - } - useEffect(()=>{ - if(isImgPreviewVisible) { - var html=document.querySelector("html"); - var body=document.querySelector("body"); - html.style.overflow="hidden"; - body.style.overflow="hidden"; - } - - },[isImgPreviewVisible]) - - return ( - <> -
-
-
- handleElement.handleStopDrag(e)} - onMouseDown={(e) => { e.persist(); handleElement.handleDrag(e,imgRef) }} - onContextMenu={(e)=>e.preventDefault()} - onWheel={(e)=>handleElement.handleZoom(e, imgRef, scales, changeScales)} - /> -
- - ) -} - -ImgPreview.propTypes = { - isImgPreviewVisible:PropTypes.bool, - closePreview:PropTypes.func, - maxSizePreview:PropTypes.func, - normalSizePreview:PropTypes.func, - imageParams:PropTypes.any, -} diff --git a/src/pages/customerservice/support/conversation/components/ImgPreview/style.module.css b/src/pages/customerservice/support/conversation/components/ImgPreview/style.module.css deleted file mode 100644 index 87998db..0000000 --- a/src/pages/customerservice/support/conversation/components/ImgPreview/style.module.css +++ /dev/null @@ -1,6 +0,0 @@ -.customer_service_btn{ - height: 20px; - background-color: rgb(245, 245, 245); - position: relative; - align-self: flex-end; -} diff --git a/src/pages/customerservice/support/conversation/components/MsgBubble/MsgBubble.jsx b/src/pages/customerservice/support/conversation/components/MsgBubble/MsgBubble.jsx deleted file mode 100644 index b13631b..0000000 --- a/src/pages/customerservice/support/conversation/components/MsgBubble/MsgBubble.jsx +++ /dev/null @@ -1,105 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import style from './style.module.css' -import { cns } from '../../utils/toClass' -import {parseBase64ToBlob,downloadFile} from '../../utils/utils' -import { customerserviceAPI as API} from '@/services/customerservice'; -import { message, Tooltip } from "antd"; -//import { downloadFile } from "@utils/utils"; - -export default function MsgBubble(props) { - const { data, isMe, showPic, reConnect} = props - - const onDownload = (fileId) => { - API.getSecretKey({fileId: fileId}).then(res => { - if(res.success==true){ - API.getDownload({ fileId: fileId, documentSecretKey: res.data }).then(buffer => { - const dotIndex = data.content.name.lastIndexOf('.') - const ext = data.content.name.substr(dotIndex) - const fileName = data.content.name.substring(0, dotIndex) - downloadFile(buffer, fileName, ext) - }) - }else{ - message.warning(res.message) - } - }) - } - const openFile = ()=>{ - const element = document.createElement("a"); - if(data.content.content.indexOf('base64')!=-1){ - var arr = data.content.content.split(',') //分割为数组,分割到第一个逗号 - let mime = arr[0].match(/:(.*?);/)[1] //获取分割后的base64前缀中的类型 - let myBlob = parseBase64ToBlob(arr[1], mime); - element.href = URL.createObjectURL(myBlob); - element.download = data.content.name; - document.body.appendChild(element); // Required for this to work in FireFox - element.click(); - document.body.removeChild(element); - window.URL.revokeObjectURL(myBlob); //释放掉blob对象 - }else{ - if(data.content.fileId!=''){ - onDownload(data.content.fileId) - } - } - } - const renderContent = (message) => { - switch (message.type) { - case 'dom': - return( -
您的连接已超时,请点击这里重新连接
- ) - case 'text': - return( -
{e.preventDefault()}} dangerouslySetInnerHTML={{ __html: message.content }} /> - ) - case 'image': - //console.log(message.content.content) - return ( -
{e.preventDefault()}}> - { - let src = message.content.content - let realWidth = message.content.realWidth - let realHeight = message.content.realHeight - let msgWidth = message.content.msgWidth - let msgHeight = message.content.msgHeight - let previewidth = message.content.previewidth - let previewHeight = message.content.previewHeight - let param = { - src, realWidth, realHeight, msgWidth, msgHeight, previewidth, previewHeight - } - showPic(param) - }} /> -
- ) - case 'file': - return( - -
{e.preventDefault()}} className={style.customer_service_uploadfile} onClick={openFile}> - {message.content.name} - {message.content.size} - -
-
- ) - default: - break - } - - } - return ( -
- {renderContent(data)} -
- ) -} - -MsgBubble.propTypes = { - data: PropTypes.object.isRequired, - isMe: PropTypes.bool.isRequired, - showPic: PropTypes.func.isRequired -} diff --git a/src/pages/customerservice/support/conversation/components/MsgBubble/style.module.css b/src/pages/customerservice/support/conversation/components/MsgBubble/style.module.css deleted file mode 100644 index 2179c67..0000000 --- a/src/pages/customerservice/support/conversation/components/MsgBubble/style.module.css +++ /dev/null @@ -1,84 +0,0 @@ -.customer_service_noselect{ - -webkit-touch-callout: none; /* iOS Safari */ - -webkit-user-select: none; /* Chrome/Safari/Opera */ - -khtml-user-select: none; /* Konqueror */ - -moz-user-select: none; /* Firefox */ - -ms-user-select: none; /* Internet Explorer/Edge */ - user-select: none; /* Non-prefixed version, currently - not supported by any browser */ -} -.customer_service_text_content { - background-color: rgb(216,216,216); - color: #333; - padding: 8px; - border-radius: 3px; - max-width: 100%; - word-wrap: break-word; - word-break: break-all; - font-size: 15px; - font-family:sans-serif; - letter-spacing: 2px; -} -.customer_service_uploadfile{ - border: 1px solid #CCC; - background-color: white; - width: 200px; - height: 120px; - position: relative; - -webkit-touch-callout: none; /* iOS Safari */ - -webkit-user-select: none; /* Chrome/Safari/Opera */ - -khtml-user-select: none; /* Konqueror */ - -moz-user-select: none; /* Firefox */ - -ms-user-select: none; /* Internet Explorer/Edge */ - user-select: none; /* Non-prefixed version, currently - not supported by any browser */ -} -.customer_service_uploadfile:hover{ - cursor: pointer; -} -.customer_service_filename { - height: 45px; - margin-left: 10px; - margin-top: 5px; -} -.customer_service_filesize { - margin-left: 10px; - margin-top: 5px; - color: rgb(153,153,153); -} -.customer_service_ellipsis { - max-width: 150px; - overflow: hidden; - text-overflow: ellipsis; - display:-webkit-box; - -webkit-box-orient:vertical; - -webkit-line-clamp:2; - -white-space: nowrap; -} -.customer_service_uploadicon{ - float: right; - margin-top: 15px; - margin-right: 10px; - width: 40px; - height: 40px; - background-image: url('../../image/uploadFile.png'); - background-size: cover; -} -.customer_service_arrow { - position: relative; -} -.customer_service_arrow::after { - content: ''; - position: absolute; - width: 8px; - height: 8px; - background-color: rgb(216,216,216); - transform: rotate(45deg); - top: 8px; -} -.customer_service_arrow_left::after { - left: -4px; -} -.customer_service_arrow_right::after { - right: -4px; -} \ No newline at end of file diff --git a/src/pages/customerservice/support/conversation/components/MsgItem/MsgItem.jsx b/src/pages/customerservice/support/conversation/components/MsgItem/MsgItem.jsx deleted file mode 100644 index bd7e38b..0000000 --- a/src/pages/customerservice/support/conversation/components/MsgItem/MsgItem.jsx +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react' -import PropTypes from 'prop-types' -import style from './style.module.css' -import MsgBubble from '../MsgBubble/MsgBubble' -//import dayjs from 'dayjs' -import moment from 'moment'; - - -export default function MsgItem(props) { - const { data, me ,showPic, reConnect } = props - const isMe = data.user.id === me.id - - const isValidDate= (date)=>{ - return date instanceof Date && !isNaN(date.getTime()) - } - - return ( -
-
- -
-
-
- {data.user.name} - - {/*moment(data.date).format('MM-DD HH:mm:ss')*/} - {isValidDate(new Date(data.date))?moment(data.date).format('MM-DD HH:mm:ss'):data.date} - -
- {} -
-
- ) -} - -MsgItem.propTypes = { - data: PropTypes.object.isRequired, - me: PropTypes.object.isRequired, - showPic: PropTypes.func.isRequired -} diff --git a/src/pages/customerservice/support/conversation/components/MsgItem/style.module.css b/src/pages/customerservice/support/conversation/components/MsgItem/style.module.css deleted file mode 100644 index 3c82dde..0000000 --- a/src/pages/customerservice/support/conversation/components/MsgItem/style.module.css +++ /dev/null @@ -1,39 +0,0 @@ -@import '../../style/common.css'; - -.customer_service_content { - padding-top: 20px; - display: flex; -} -.customer_service_content .avatar { - min-width: 35px; - width: 35px; - padding-top: 14px; - -moz-user-select: none; - -khtml-user-select: none; - user-select: none; -} -.customer_service_content .avatar > img { - width: 100%; - height: auto; - border-radius: 50%; - overflow: hidden; -} -.customer_service_content .text_area { - flex: 1; - padding: 0px 10px; - display: flex; - flex-direction: column; - overflow: hidden; - max-width: 60%; -} -.customer_service_content .comment_area { - font-size: 12px; - color: #999; - padding-bottom: 4px; - -moz-user-select: none; - -khtml-user-select: none; - user-select: none; -} -.customer_service_content .date_text { - margin-left: 10px; -} diff --git a/src/pages/customerservice/support/conversation/components/RatePopover/RatePopover.jsx b/src/pages/customerservice/support/conversation/components/RatePopover/RatePopover.jsx deleted file mode 100644 index 9ea98f0..0000000 --- a/src/pages/customerservice/support/conversation/components/RatePopover/RatePopover.jsx +++ /dev/null @@ -1,41 +0,0 @@ -import React, {useRef, useState } from 'react' -import PropTypes from 'prop-types' -import style from './style.module.css' -import { HeartFilled } from '@ant-design/icons'; -import { Rate, Button, Modal, Tooltip } from 'antd'; -export default function RatePopover(props) { - - const { onRate, isRateModalVisible, closeRateModal } = props - const fileSelector = useRef() - const [score, setScore] = useState(0) - const [rateModal, setRateModal] = useState(false) - - return ( - <> -
{ setScore(0); setRateModal(true)}} className={style.customer_service_content}/> - {(isRateModalVisible || rateModal) && - { - closeRateModal && closeRateModal() - setRateModal(false) - }} - footer={[ - , - ]} - > - { - setScore(value) - }}/> - - } - - ) -} -RatePopover.propTypes = { - onRate: PropTypes.func.isRequired, -} diff --git a/src/pages/customerservice/support/conversation/components/RatePopover/style.module.css b/src/pages/customerservice/support/conversation/components/RatePopover/style.module.css deleted file mode 100644 index 4162967..0000000 --- a/src/pages/customerservice/support/conversation/components/RatePopover/style.module.css +++ /dev/null @@ -1,45 +0,0 @@ -/* .customer_service_btn { - width: 12px; - height: 12px; - line-height: 12px; - margin-left: 5px; - position: relative; - background-color: #b30000; - transform: rotate(45deg); -} -.customer_service_btn::before, -.customer_service_btn::after { - position: absolute; - content: ''; - background-color: #b30000; - top: 0px; - left: -50%; - width: 100%; - height: 100%; - border-radius: 50%; -} - -.customer_service_btn::after { - left: 0; - top: -50%; -} -.customer_service_btn:hover{ - cursor: pointer; -} */ - -.customer_service_content { - width: 20px; - height: 20px; - margin-right: 10px; - background-image: url('../../image/rate_black.png'); - background-size: 100%; - background-position: center; - background-repeat: no-repeat; -} -.customer_service_content:hover { - background-image: url('../../image/rate_light.png'); - cursor: pointer; -} -.customer_service_content > input { - display: none; -} diff --git a/src/pages/customerservice/support/conversation/components/ScrollWrapper/ScrollWrapper.jsx b/src/pages/customerservice/support/conversation/components/ScrollWrapper/ScrollWrapper.jsx deleted file mode 100644 index e14643c..0000000 --- a/src/pages/customerservice/support/conversation/components/ScrollWrapper/ScrollWrapper.jsx +++ /dev/null @@ -1,145 +0,0 @@ -import React, { - useEffect, - useLayoutEffect, - useRef, - useState, - useMemo -} from 'react' -import { cns } from '../../utils/toClass' -import styles from './style.module.css' -import PropTypes from 'prop-types'; - -const ScrollWrapper = (Comp) => (props) => { - - //var data = this.props.data - const scrollView = useRef() - const thumb = useRef() - - const [viewPortH, setViewPortH] = useState(1) - const [scrollH, setScrollH] = useState(1) - const [scrollT, setScrollT] = useState(0) - const [scrollR, setScrollR] = useState(1) - // const [isReset, setIsReset] = useState(false) - const [isPressing, setIsPressing] = useState(false) - const [showScrollBar, setShowScrollBar] = useState(false) - - const [shadowStyle, setShadowStyle] = useState('') - -let { data, viewH, scrollToBottom, switchFlag, style, isMove, isModalVisible, loading, } = this? this.props : props - -const scrollHandle = () => { - if (scrollView.current) { - setScrollT(scrollView.current.scrollTop) - } -} - -const mouseUpHandle = (e) => { - setIsPressing(false) -} - -const mouseDownHandle = (e) => { - setIsPressing(true) -} - -const mouseMovingHandle = (e) => { - e.persist() - if (isPressing !== true) return - if (scrollT < 0) { - setScrollT(0) - } else if (scrollT > scrollH - viewPortH) { - setScrollT(scrollH - viewPortH) - } else { - setScrollT((preScrollT) => preScrollT + e.movementY / scrollR) - } -} - -const thumbHeight = () => viewPortH * scrollR - -const transH = () => scrollT * scrollR - -useEffect(() => { - addEventListener('mouseup', mouseUpHandle) - return () => { - removeEventListener('mouseup', mouseUpHandle) - } -}, []) - - useEffect(() => { - if(isModalVisible){ - if (scrollView.current) { - setViewPortH(scrollView.current.offsetHeight) - setScrollH(scrollView.current.scrollHeight) - } - } - }, [data, isModalVisible, viewH]) - - useLayoutEffect(() => { - if (scrollView.current) { - scrollView.current.scrollTop = scrollT - } - - if (showScrollBar !== true) return - - if (scrollT <= 0) { - setShadowStyle(styles.shadow_bottom) - } else if (scrollT >= scrollH - viewPortH) { - setShadowStyle(styles.shadow_top) - } else { - setShadowStyle(styles.shadow_vertical) - } - }, [scrollT]) - - useEffect(() => { - const sr = scrollH==0? 0: (viewPortH / scrollH) - setScrollR(sr) - if (viewPortH < scrollH) { - setShowScrollBar(true) - } else { - setShowScrollBar(false) - } - }, [scrollH, viewPortH]) - - useEffect(() => { - if (scrollToBottom) { - setScrollT(scrollH - viewPortH) - }else{ - setScrollT(0) - } - }, [scrollR, switchFlag]) - - return ( -
-
- {useMemo(() => , [data, loading, style])} -
- -
- ) -}; - -ScrollWrapper.propTypes = { - data: PropTypes.object, -}; -export default ScrollWrapper; \ No newline at end of file diff --git a/src/pages/customerservice/support/conversation/components/ScrollWrapper/style.module.css b/src/pages/customerservice/support/conversation/components/ScrollWrapper/style.module.css deleted file mode 100644 index f54b3e8..0000000 --- a/src/pages/customerservice/support/conversation/components/ScrollWrapper/style.module.css +++ /dev/null @@ -1,45 +0,0 @@ -.customer_service_wrapper_content { - display: flex; - box-sizing: border-box; -} -.customer_service_wrapper_content .list_block { - flex: auto; - overflow: auto; - overflow-x: hidden; - scrollbar-width: none; /* Firefox */ - -ms-overflow-style: none; /* IE 10+ */ - box-sizing: border-box; -} -.customer_service_wrapper_content .list_block::-webkit-scrollbar { - display: none; /* Chrome Safari */ -} -.customer_service_wrapper_content .scroll_bar_block { - width: 8px; - /* border-radius: 4px; */ - overflow: hidden; - transition: all 0.3s; - box-sizing: border-box; - background-color: rgb(231,229,229); -} -.customer_service_wrapper_content .scroll_bar_block:hover { - background-color: #eee; -} -.customer_service_wrapper_content .scroll_thumb { - display: block; - width: 100%; - background-color: #aaa; - border-radius: 4px; -} -.customer_service_wrapper_content .scroll_thumb:hover { - cursor: pointer; -} -.customer_service_wrapper_content .shadow_top { - box-shadow: inset 0px 5px 10px -5px rgba(0, 0, 0, 0.2); -} -.customer_service_wrapper_content .shadow_bottom { - box-shadow: inset 0px -5px 10px -5px rgba(0, 0, 0, 0.2); -} -.customer_service_wrapper_content .shadow_vertical { - box-shadow: inset 0px 5px 10px -5px rgba(0, 0, 0, 0.2), - inset 0px -5px 10px -5px rgba(0, 0, 0, 0.2); -} diff --git a/src/pages/customerservice/support/conversation/components/SeactList/index.jsx b/src/pages/customerservice/support/conversation/components/SeactList/index.jsx deleted file mode 100644 index a6fa0ab..0000000 --- a/src/pages/customerservice/support/conversation/components/SeactList/index.jsx +++ /dev/null @@ -1,285 +0,0 @@ -import React, { useState, useImperativeHandle, forwardRef } from 'react'; -import { - Card, - Form, - Row, - Col, - Input, - Button, - DatePicker, - Select, - Cascader, - TreeSelect, - Tooltip, - InputNumber -} from 'antd'; -import { FormLabelCenterBoxes } from './index.styled'; -import { DoubleRightOutlined } from '@ant-design/icons'; -import PropTypes from 'prop-types'; -import moment from 'moment'; -const { TreeNode } = TreeSelect; -const { Option, OptGroup } = Select; -const { RangePicker } = DatePicker; -const layout = { - labelCol: { span: 8 }, - wrapperCol: { span: 16 }, -}; -function SeactList(props, ref) { - const [form] = Form.useForm(); - const [isShow, setIsShow] = useState(false); - const { title, colSpan = 6, labelCenter = false, ResetFlag = true, extraButton, extra, bordered=false } = props; - useImperativeHandle(ref, () => { - return { - onSubmit: () => { - form.submit(); - }, - form, - }; - }); - const renderTreeNodes = (data) => - data.map((item) => { - const title = ( - <> - {item.operName} - - ); - if (item.children) { - return ( - - {renderTreeNodes(item.children)} - - ); - } - return ; - }); - - const onRangePickerChange = (dates, value) => { - let obj = {}; - obj[value] = dates; - form.setFieldsValue({ ...obj }); - props.onRangePickerChange && props.onRangePickerChange(obj); - }; - - const beforeMonthdisabledDate = (current) => { - return current > moment().subtract(1, 'months').endOf('month'); - }; - - const getformType = (item) => { - //设置默认值 - const { value, defaultValue } = item; - let obj = {}; - if (defaultValue) { - let result = form.getFieldValue(value); - if (!result) { - obj[value] = defaultValue ? defaultValue : null; - form.setFieldsValue({ ...obj }); - } - } - let formType = ; - let type = item.type; - let OptionList = item.OptionList ? item.OptionList : []; - if (type === 'input') { - formType = ; - } else if (type === 'RangePicker') { - formType = ( - { - onRangePickerChange(dates, item.value); - }} - allowClear={false} - /> - ); - } else if (type === 'Select') { - const { valueKey = 'value', labelKey = 'label' } = item; - formType = ( - - ); - } else if (type === 'monthSelect') { - formType = ; - } else if (type === 'Cascader') { - formType = ; - } else if (type === 'DatePicker') { - formType = ( - - ); - } else if (type === 'TreeSelect') { - formType = {renderTreeNodes(item.data)}; - } else if (type === 'SelectGroup') { - const { valueKey = 'value', labelKey = 'label', childrenKey = 'children', OptionList } = item; - formType = ( - - ); - } else if (type === 'daySelect') { - formType = ( - - ); - } else if (type === 'beforeMonthSelect') { - formType = ( - - ); - } else if (type === 'Range') { - formType = ( - - - ~ - - - ); - } - const label = (value) => { - return ( - - {value} - - ); - }; - return ( - - {formType} - - ); - }; - const formRef = React.createRef(); - - // 下拉框选择后回调,用于多个下拉框级联 - const onSelected = (itemValue, value) => { - if (props.getSelectedValue) { - props.getSelectedValue(itemValue, value); - } - }; - - const onReset = () => { - //清空时不清空设置的默认值 - const obj = form.getFieldsValue(); - form.setFieldsValue({ ...obj }); - formRef.current.resetFields(); - if (props.onReset) { - props.onReset(); - } - }; - const onFinish = (values) => { - if (props.onSearch) { - props.onSearch(values); - } - }; - const { dataList = [] } = props || {}; - const Center = ( - // { - // setIsShow(!isShow); - // }} - // > - // - // - // ) - // } - // > -
- - {dataList.map((item, index) => { - return ( - - {getformType(item)} - - ); - })} - 6 - ? dataList.length >= 3 - ? '24' - : colSpan - : dataList.length > 3 - ? '24' - : colSpan - } - style={{ - textAlign: - colSpan > 6 - ? dataList.length >= 3 - ? 'center' - : 'left' - : dataList.length > 3 - ? 'center' - : 'left', - }} - > - - {ResetFlag && } - {extraButton && extraButton()} - - -
- //
- ); - return labelCenter ? {Center} : Center; -} -SeactList.propTypes = { - dataList: PropTypes.array, - title: PropTypes.string, - colSpan: PropTypes.number, - extra: PropTypes.boolean, - bordered: PropTypes.boolean, -}; -export default forwardRef(SeactList); diff --git a/src/pages/customerservice/support/conversation/components/SeactList/index.styled.js b/src/pages/customerservice/support/conversation/components/SeactList/index.styled.js deleted file mode 100644 index f294e9f..0000000 --- a/src/pages/customerservice/support/conversation/components/SeactList/index.styled.js +++ /dev/null @@ -1,8 +0,0 @@ - -import styled from 'styled-components'; - -export const FormLabelCenterBoxes = styled.div` - .ant-form-item-label{ - text-align: center - } -`; \ No newline at end of file diff --git a/src/pages/customerservice/support/conversation/constants.js b/src/pages/customerservice/support/conversation/constants.js deleted file mode 100644 index e3d265e..0000000 --- a/src/pages/customerservice/support/conversation/constants.js +++ /dev/null @@ -1,31 +0,0 @@ -//保存websocket对象 -export const CUSTOMERSERVICE_WEBSOCKET = [] -//消息提醒计时器 -export const CUSTOMERSERVICE_messageAlert = { - timeout: null, - oldTitle:'招投标系统', - time: 0, - num: 0, - showMessage(msg){ - CUSTOMERSERVICE_messageAlert.num++; - if(CUSTOMERSERVICE_messageAlert.num==1){ - CUSTOMERSERVICE_messageAlert.timeout = setInterval(function(){ - CUSTOMERSERVICE_messageAlert.time ++; - let title = ''; - if(CUSTOMERSERVICE_messageAlert.time % 2 === 0){ - title = '[   ]我的咨询'; - }else{ - title = '['+msg+']我的咨询'; - } - document.getElementsByTagName('title')[0].innerText = title; - },500); - } - - - }, - stopMessage(){ - document.getElementsByTagName('title')[0].innerText = CUSTOMERSERVICE_messageAlert.oldTitle; - CUSTOMERSERVICE_messageAlert.num = 0; - clearInterval(CUSTOMERSERVICE_messageAlert.timeout); - } -} \ No newline at end of file diff --git a/src/pages/customerservice/support/conversation/image/emoji_black.png b/src/pages/customerservice/support/conversation/image/emoji_black.png deleted file mode 100644 index 0d7a15c..0000000 Binary files a/src/pages/customerservice/support/conversation/image/emoji_black.png and /dev/null differ diff --git a/src/pages/customerservice/support/conversation/image/emoji_light.png b/src/pages/customerservice/support/conversation/image/emoji_light.png deleted file mode 100644 index 39123b0..0000000 Binary files a/src/pages/customerservice/support/conversation/image/emoji_light.png and /dev/null differ diff --git a/src/pages/customerservice/support/conversation/image/file_black.png b/src/pages/customerservice/support/conversation/image/file_black.png deleted file mode 100644 index 9ef02b4..0000000 Binary files a/src/pages/customerservice/support/conversation/image/file_black.png and /dev/null differ diff --git a/src/pages/customerservice/support/conversation/image/file_light.png b/src/pages/customerservice/support/conversation/image/file_light.png deleted file mode 100644 index 0276bcb..0000000 Binary files a/src/pages/customerservice/support/conversation/image/file_light.png and /dev/null differ diff --git a/src/pages/customerservice/support/conversation/image/pic_black.png b/src/pages/customerservice/support/conversation/image/pic_black.png deleted file mode 100644 index 7d57019..0000000 Binary files a/src/pages/customerservice/support/conversation/image/pic_black.png and /dev/null differ diff --git a/src/pages/customerservice/support/conversation/image/pic_light.png b/src/pages/customerservice/support/conversation/image/pic_light.png deleted file mode 100644 index b42f693..0000000 Binary files a/src/pages/customerservice/support/conversation/image/pic_light.png and /dev/null differ diff --git a/src/pages/customerservice/support/conversation/image/rate_black.png b/src/pages/customerservice/support/conversation/image/rate_black.png deleted file mode 100644 index 907dfae..0000000 Binary files a/src/pages/customerservice/support/conversation/image/rate_black.png and /dev/null differ diff --git a/src/pages/customerservice/support/conversation/image/rate_light.png b/src/pages/customerservice/support/conversation/image/rate_light.png deleted file mode 100644 index f5070c8..0000000 Binary files a/src/pages/customerservice/support/conversation/image/rate_light.png and /dev/null differ diff --git a/src/pages/customerservice/support/conversation/image/server-avatar.jpg b/src/pages/customerservice/support/conversation/image/server-avatar.jpg deleted file mode 100644 index abb7ffe..0000000 Binary files a/src/pages/customerservice/support/conversation/image/server-avatar.jpg and /dev/null differ diff --git a/src/pages/customerservice/support/conversation/image/uploadFile.png b/src/pages/customerservice/support/conversation/image/uploadFile.png deleted file mode 100644 index 3e9b110..0000000 Binary files a/src/pages/customerservice/support/conversation/image/uploadFile.png and /dev/null differ diff --git a/src/pages/customerservice/support/conversation/index.jsx b/src/pages/customerservice/support/conversation/index.jsx deleted file mode 100644 index fcd2dc5..0000000 --- a/src/pages/customerservice/support/conversation/index.jsx +++ /dev/null @@ -1,576 +0,0 @@ -import React, { useState, useEffect, useRef } from 'react' -import Chat from './components/Chat/Chat' -import ImgPreview from './components/ImgPreview/ImgPreview' -import SeactList from './components/SeactList' -import {entitiestoUtf16, handleElement, doEncrypt } from './utils/utils' -import user from '@/assets/img/cs_user.png' -import client from '@/assets/img/cs_client.png' -import { customerserviceAPI as API} from '@/services/customerservice'; -import { message, Modal, Table, Button, Popconfirm } from 'antd'; -import { history } from 'umi' -import {CUSTOMERSERVICE_WEBSOCKET, CUSTOMERSERVICE_messageAlert} from './constants' -import moment from "moment"; -//网页刷新时,清空sessionStorage -window.onbeforeunload = function(){ - sessionStorage.removeItem('CUSTOMERSERVICE_CONVERSATIONID') - sessionStorage.removeItem('CUSTOMERSERVICE_isCloseChatUIModal') - sessionStorage.removeItem('CUSTOMERSERVICE_msgFlash') -} - -const conversation = (props) => { - const [msgList, setMsgList] = useState([]) - const [scrollToBottom, setScrollToBottom] = useState(true) - const [switchFlag,setSwitchFlag] = useState(false) - const [viewH,setViewH] = useState(0) - const [curuser,setCuruser] = useState({}) - const [wsMsg, setWsMsg] = useState({}) - const [wsObj, setWsObj] = useState(null) - const [isImgPreviewVisible, setIsImgPreviewVisible] = useState(false) //在线客服/图片预览 - const [imageParams, setImageParams] = useState({}) //图片属性 - const [show, setShow] = useState(false) - const [projectData, setProjectData] = useState([]) - const [showLoading, setShowLoading] = useState(false) - const [isSend, setIsSend] = useState(false) - const [loading, setLoading] = useState(false) - const [sendMsg, setSendMsg] = useState([]) - const [isRateModalVisible, setIsRateModalVisible] = useState(false) - const [agentNumber, setAgentNumber] = useState('') - const [serverNo, setServerNo] = useState('') - const [msgPage, setMsgPage] = useState(1) - const [pagination, setPagination] = useState({ - showQuickJumper: true, - showSizeChanger: false, - current: 1, - pageSize: 10, - total: 0, - }); - const [queryParams, setQueryParams] = useState({}) - - const refs = useRef() - const chatUI = document.getElementById('chatUI') - const record = document.getElementById('section') - const chatInput = document.getElementById('chatInput') - const listHeight = 290 - const textHeight = 150 - const wid = 600 - const hei = 500 - - const {isModalVisible, isCloseWs, closeWin, hideWin, msgAlert, supplierNumber, staffId, staffName, optionsModal, projectModal, closeOptionsModal, closeProjectModal, kfType, questionType, openWin, openProjectWin, roleIds} = props - - document.addEventListener('visibilitychange',()=>{ //监听网页是否失焦 - var isHidden = document.hidden - sessionStorage.setItem('CUSTOMERSERVICE_isBlur', isHidden? 1: 0) - if(!isHidden && sessionStorage.getItem('CUSTOMERSERVICE_isConversationURLChanged')==0){ - stopMsg() - } - }) - - //项目信息 - const onChange = () => { - setShowLoading(true) - getProject({ - projectName: queryParams.projectName==undefined? null: queryParams.projectName, - }); - } - const getProject = (params)=>{ - API.list(params).then((res)=>{ - setShowLoading(false) - if(res && res.success && res.data){ - let data = res.data - setProjectData(data) - setPagination({ - showQuickJumper: true, - showSizeChanger: false, - pageSize: params.pageSize, - current: params.pageNum, - total: res.data.total, - showTotal: total => `共 ${total} 条`, - }) - }else{ - //message.warn(res && res.message) - } - }) - } - const dataList=[ - { label: '项目名称', value: 'projectName', type: 'input', }, - ] - const onSearch = (param) => { - setQueryParams(param) - getProject({ - projectName: param.projectName, - }); - }; - const onReset = () => { - getProject({ - projectName: null, - }); - setQueryParams({}) - } - const onMsgRender = (data)=>{ - let serverAvatar = user - if(data && data.clientNo!=undefined){ - setServerNo(data.serverNo) //保存客服编码 - let type = data.contentType==1?'text':data.contentType==2?'image':data.contentType==3?'file':'text' - let content={} - if(type=='text'){ - content = data.contentType==1?entitiestoUtf16(data.message) : data.message - }else if(type =='image'){ - let newcontent = data.message.indexOf('{')!= -1 ? JSON.parse(data.message):{} - content={ - content: newcontent.content, - realWidth: newcontent.realWidth, - realHeight:newcontent.realHeight, - msgWidth: newcontent.msgWidth, - msgHeight:newcontent.msgHeight, - previewidth: newcontent.previewidth, - previewHeight:newcontent.previewHeight, - success:false, - fileId:newcontent.fileId, - } - }else if(type =='file'){ - let newcontent = data.message.indexOf('{')!= -1 ? JSON.parse(data.message):{} - content={ - content: newcontent.content, - name: newcontent.name, - size:newcontent.size, - success:false, - fileId:newcontent.fileId, - } - } - let msgData={ - _id: doEncrypt(Math.floor(Math.random() * 1000)+ (new Date()).getTime()), - date: new Date(), - user: { - id: data.serverNo, - avatar: serverAvatar, - name: data.serverName? data.serverName: '供应链客服', - }, - message: { type: type, content: content }, - } - setMsgList([...msgList, msgData]) - msgAlert && msgAlert() - } - } - //点击获取更多信息,和uat不一致 - const getMoreMessage = (pageNum)=>{ - let serverAvatar = user - let customerAvatar = client - API.getMessageList({customNumber: serverNo, uid: staffId, empty:1, pageNum:pageNum==1?1:msgPage+1}).then(res => { - setLoading(false) - if (res && res.success) { - let data = res.data.records - let earlierMsg = [] - data && data.map((item)=>{ - let type = item.contentType==1?'text':item.contentType==2?'image':item.contentType==3?'file':'text' - let content={} - if(type=='text'){ - content = item.contentType==1?entitiestoUtf16(item.content) : item.content - }else if(type =='image'){ - let newcontent = item.content.indexOf('{')!=-1?JSON.parse(item.content):{} - content={ - content: newcontent.content, - realWidth: newcontent.realWidth, - realHeight:newcontent.realHeight, - msgWidth: newcontent.msgWidth, - msgHeight:newcontent.msgHeight, - previewidth: newcontent.previewidth, - previewHeight:newcontent.previewHeight, - success:false, - fileId:newcontent.fileId, - } - }else if(type =='file'){ - let newcontent = item.content.indexOf('{')!=-1?JSON.parse(item.content):{} - content={ - content: newcontent.content, - name: newcontent.name, - size:newcontent.size, - success:false, - fileId:newcontent.fileId, - } - } - earlierMsg.push({ - _id: doEncrypt(Math.floor(Math.random() * 1000)+ (new Date()).getTime()), - date: item.sendingTime, - user: { - id: item.senderUid, - avatar: item.senderType==1?customerAvatar:serverAvatar, - name: item.senderType==1?staffName:item.customName, - }, - message: { type: type, content: content }, - }) - }) - - if(data && data.length>0){ - if(pageNum==-1){ - setMsgPage(msgPage+1) - } - let count = earlierMsg.length - let arr = pageNum==1?[] : [...msgList] - while(count>0){ - arr.unshift(earlierMsg.pop()) - count-- - } - setMsgList([...arr]) - } - if(sendMsg && sendMsg.length>0) { //连接建立后,sendMsg有值才可以发即时消息(用户不点击发送,打开窗口即发送) - setIsSend(true) - } - } else { - //message.warn(res && res.message) - } - - }) - } -//断开连接提醒 -const disconnectedAlert = () =>{ - let serverAvatar = user - const msg = { - _id: doEncrypt(Math.floor(Math.random() * 1000)+ (new Date()).getTime()), - date: new Date(), - user: { - id: serverNo, - avatar: serverAvatar, - name: '供应链客服', - }, - message: { type: 'dom', content: '' }, - } - setMsgList([...msgList, msg]) -} -//检验连接websocket -const checkDisconnected = ()=>{ - if(sessionStorage.getItem('CUSTOMERSERVICE_isCloseChatUIModal')==0){ //弹窗没有关闭(弹窗开着或者隐藏,ws不应该断) - console.log('websocket断开,重新连接') - if(sessionStorage.getItem('CUSTOMERSERVICE_isModalVisible')==1){ //断连后,用户打开弹窗再发提醒 - disconnectedAlert() - } - }else{ - setMsgPage(0) - } -} - -//获取当前登录者token -const getToken = ()=>{ - API.check({ - clientNo: staffId, - supplierNo:kfType==1?'EMPTY':agentNumber - }).then(res => { - if (res && res.success) { - setShow(true) - websocketInit(staffId) - setLoading(true) - getMoreMessage(1) - }else{ - if(CUSTOMERSERVICE_WEBSOCKET && CUSTOMERSERVICE_WEBSOCKET.length>0){ - //别的路由切过来,ws没断,重新监听 - console.log('ws没断,重新监听') - setShow(true) - monitorWebSocket(CUSTOMERSERVICE_WEBSOCKET[0]) - setLoading(true) - getMoreMessage(1) - }else{ - closeWin && closeWin() - sessionStorage.removeItem('CUSTOMERSERVICE_isCloseChatUIModal') - message.warn(res && '您已在别的终端建立会话') - } - } - }) -} -//监听websocket -const monitorWebSocket = (ws)=>{ - // 建立 web socket 连接成功触发事件 - ws.onopen = function () { - console.log("Connection open ..."); - //记录ws - CUSTOMERSERVICE_WEBSOCKET.push(ws) - } - // 接收服务端数据时触发事件 - ws.onmessage = function (res) { - if(res.data){ - let data = JSON.parse(res.data) - //切换路由,conversaId会丢失,所以存sessionStorage - sessionStorage.setItem('CUSTOMERSERVICE_CONVERSATIONID',data.conversationId==undefined? 'EMPTY':data.conversationId) - if(sessionStorage.getItem('CUSTOMERSERVICE_isConversationURLChanged')==1){//路由变化 - sessionStorage.setItem('CUSTOMERSERVICE_msgFlash',1) - showMsg() - }else { - if(sessionStorage.getItem('CUSTOMERSERVICE_isBlur')==1){//失焦 - sessionStorage.setItem('CUSTOMERSERVICE_msgFlash',1) - showMsg() - } - setWsMsg(data) - } - } - }; - - // 断开 web socket 连接成功触发事件 - ws.onclose = function () { - console.log("连接已关闭..."); - if(CUSTOMERSERVICE_WEBSOCKET && CUSTOMERSERVICE_WEBSOCKET.length>0) - CUSTOMERSERVICE_WEBSOCKET.splice(0,CUSTOMERSERVICE_WEBSOCKET.length); - checkDisconnected() - }; -} -/*websocket*/ -const websocketInit = (id)=>{ - var addr = `${REACT_APP_CUSTOMERSERVICE_WS_REDIRECT}` + '/websocketClient/' - let no = kfType==1?'EMPTY':agentNumber - var ws = new WebSocket(addr+id+'/'+no, [sessionStorage.getItem('Authorization')]); - monitorWebSocket(ws) -} - -//消息闪烁提醒 -const showMsg = ()=>{ - CUSTOMERSERVICE_messageAlert.showMessage('新消息'); -} -//取消消息闪烁提醒 -const stopMsg = ()=>{ - CUSTOMERSERVICE_messageAlert.stopMessage('新消息'); -} - -useEffect(()=>{ - history.listen(location => { - // 最新路由的 location 对象,可以通过比较 pathname 是否相同来判断路由的变化情况 - let isChanged = location.pathname.indexOf('/Dashboard')==-1 - sessionStorage.setItem("CUSTOMERSERVICE_isConversationURLChanged", isChanged? 1: 0) - }) - if(sessionStorage.getItem('CUSTOMERSERVICE_msgFlash')==1){ - msgAlert && msgAlert() //侧边栏提醒 - } -},[]) -useEffect(()=>{ - if(!isCloseWs){ - sessionStorage.setItem("CUSTOMERSERVICE_isCloseChatUIModal", 0) - } -},[isCloseWs]) - -useEffect(() => { - sessionStorage.setItem("CUSTOMERSERVICE_isModalVisible", isModalVisible? 1: 0) - if(isModalVisible){ - stopMsg() - //登录人的信息的关键字 顺序是固定的。 - let avatar = client - //当前用户 - setCuruser({ - id: staffId, - name: staffName, - avatar: avatar, - }) - //恢复初始值 - chatUI.style.width = wid - chatUI.style.height = hei - chatUI.style.left = (document.documentElement.clientWidth - wid)*0.5 +"px" - chatUI.style.top = (document.documentElement.clientHeight - hei)*0.5 +"px" - record.style.height = listHeight + "px" - chatInput.style.height = textHeight + "px" - - //清空alert - sessionStorage.removeItem('CUSTOMERSERVICE_msgFlash'); - //校验登录 - getToken() - }else{ - setMsgList([]) - } -}, [isModalVisible]) - -useEffect(() => { - if(projectModal && supplierNumber!='EMPTY'){ - //获取项目 - setShowLoading(true) - getProject({ - projectName: null, - }) - } -}, [projectModal]) - -useEffect(() => { - //实时渲染消息 - if(sessionStorage.getItem('CUSTOMERSERVICE_isConversationURLChanged') == 0 && wsMsg && wsMsg.clientNo!=undefined){ - if(isModalVisible){ //弹窗开着才渲染 - onMsgRender(wsMsg) - }else{ - msgAlert && msgAlert() //只提醒 - } - } -}, [wsMsg]) - - const columns=[ - { title: '项目名称', dataIndex: 'projectName', align: 'center', ellipsis:true, width:'40%'}, - { title: '代理公司', dataIndex: 'agentName', align: 'center', ellipsis:true, width:'40%'}, - { - title: '操作', align: 'center', width: '150px', - render: (text, record) => { - setAgentNumber(record.agentNumber) - setSendMsg([{ - type:'text', - content:'项目名称:'+record.projectName+'
项目编号:'+record.projectNumber+'
项目状态:'+record.projectStatus - } - ]) - closeProjectModal && closeProjectModal() - openWin && openWin(2,10) - }} - okText="确定" - cancelText="取消" - >
- }, - ] - return ( - <> -
- {setIsSend(false); setSendMsg([])}} - chatUI={chatUI} - textHeight={textHeight} - listHeight={listHeight} - kfType={kfType} - questionType={questionType} - supplierNo={kfType==1?'EMPTY':agentNumber} - conversationId={sessionStorage.getItem('CUSTOMERSERVICE_CONVERSATIONID')} - roleIds={roleIds} - loading={loading} - isRateModalVisible={isRateModalVisible} - closeWin={()=>{ - if(sessionStorage.getItem('CUSTOMERSERVICE_CONVERSATIONID')!=null && sessionStorage.getItem('CUSTOMERSERVICE_CONVERSATIONID')!='EMPTY'){ - let conversationId = sessionStorage.getItem('CUSTOMERSERVICE_CONVERSATIONID') - API.estimate({id: conversationId, endTime: moment(new Date()).format('yyyy-MM-DD HH:mm:ss')}).then(res=>{ - if (res && res.success) { - }else{ - //message.warn(res && res.message) - } - }) - setIsRateModalVisible(true) - } - setShow(false) - sessionStorage.removeItem('CUSTOMERSERVICE_isCloseChatUIModal') - let ws = CUSTOMERSERVICE_WEBSOCKET.pop() - ws && ws.close() - closeWin && closeWin() - }} - closeRateModal={()=>{ - sessionStorage.removeItem('CUSTOMERSERVICE_CONVERSATIONID') - setIsRateModalVisible(false) - }} - hideWin={()=>{ - hideWin && hideWin() - }} - setPostion={()=>{ - setScrollToBottom(true) - setSwitchFlag(!switchFlag) - }} - changeHeight={(h)=>{ - setViewH(h) - }} - onSend={(msg) =>{ - setScrollToBottom(true) - setMsgList([...msgList, ...msg]) - setIsSend(false) - setSendMsg([]) - }} - showPic={(imageParams)=>{ - setImageParams(imageParams) - setIsImgPreviewVisible(true) - }} - reConnect={()=>{ - setMsgList([]) - websocketInit(staffId) - setLoading(true) - getMoreMessage(1) - } - } - onEarlier={()=>{ - setLoading(true) - setScrollToBottom(false) - getMoreMessage(-1) - }} - style={{ - width: wid, - height: hei, - }} - /> -
- {isImgPreviewVisible &&
{if(e.target.id=='blankArea' || e.target.id=='popUpImage'){e.persist(); handleElement.handleDrag(e,refs)} }}> - { - var html=document.querySelector("html") - var body=document.querySelector("body") - html.style.overflow="visible" - body.style.overflow="visible" - setIsImgPreviewVisible(false) - }} - maxSizePreview={()=>{ - refs.current.style.width=document.documentElement.clientWidth + "px" - refs.current.style.height=document.documentElement.clientHeight + "px" - refs.current.style.top= '50%' - refs.current.style.left= '50%' - refs.current.style.transform='translate(-50%,-50%)' - }} - normalSizePreview={()=>{ - refs.current.style.width= wid + "px" - refs.current.style.height= hei + "px" - refs.current.style.top= '50%' - refs.current.style.left= '50%' - refs.current.style.transform='translate(-50%,-50%)' - }} - /> -
} - {optionsModal && isCloseWs && - { - closeOptionsModal && closeOptionsModal() - }}> -

openWin && openWin(1,2)}>点击咨询平台客服(平台操作相关问题)

-

openWin && openWin(1,6)}>点击咨询智慧安全公司客服(iPASS及电子签章相关问题)

- {roleIds=="ebtp-supplier" &&

openProjectWin && openProjectWin()}>点击咨询代理机构客服(项目内容相关问题)

} -
- } - {projectModal && roleIds=="ebtp-supplier" && - { - closeWin && closeWin() - }}> - {supplierNumber=='EMPTY'?

没有要咨询的项目

: - <> - - record['projectNumber']} - loading={showLoading} - pagination={pagination} - onChange={onChange} - /> - } - - } - - ) -} -export default conversation diff --git a/src/pages/customerservice/support/conversation/style/common.css b/src/pages/customerservice/support/conversation/style/common.css deleted file mode 100644 index fb6a08b..0000000 --- a/src/pages/customerservice/support/conversation/style/common.css +++ /dev/null @@ -1,21 +0,0 @@ -/* flex */ -.flex { - display: flex; -} -.flex_1 { - flex: auto; -} -.jus_cen { - justify-content: center; -} -.ali_cen { - align-items: center; -} - -/* position */ -.pos_a { - position: absolute; -} -.pos_r { - position: relative; -} diff --git a/src/pages/customerservice/support/conversation/utils/toClass.js b/src/pages/customerservice/support/conversation/utils/toClass.js deleted file mode 100644 index 1e0ebdc..0000000 --- a/src/pages/customerservice/support/conversation/utils/toClass.js +++ /dev/null @@ -1,3 +0,0 @@ -export function cns(classes = []) { - return classes.join(' ') -} diff --git a/src/pages/customerservice/support/conversation/utils/utils.jsx b/src/pages/customerservice/support/conversation/utils/utils.jsx deleted file mode 100644 index cfa1c0f..0000000 --- a/src/pages/customerservice/support/conversation/utils/utils.jsx +++ /dev/null @@ -1,568 +0,0 @@ -const sm2 = require('sm-crypto').sm2 - -export function AutoResizeImage(maxWidth,maxHeight,objImg) { - var img = new Image(); - img.src = objImg.src; - var hRatio; - var wRatio; - var Ratio = 1; - var w = img.width; - var h = img.height; - wRatio = maxWidth / w; - hRatio = maxHeight / h; - if (maxWidth ==0 && maxHeight==0){ - Ratio = 1; - }else if (maxWidth==0){// - if (hRatio<1) Ratio = hRatio; - }else if (maxHeight==0){ - if (wRatio<1) Ratio = wRatio; - }else if (wRatio<1 || hRatio<1){ - Ratio = (wRatio<=hRatio?wRatio:hRatio); - } - if (Ratio<1){ - w = w * Ratio; - h = h * Ratio; - } - objImg.style.height = h+"px"; - objImg.style.width = w+"px"; -} -export function GetResizeImg(maxsize,obj) { - var img = new Image(); - img.src = obj.src; - var hRatio; - var wRatio; - var Ratio = 1; - var w = img.width; - var h = img.height; - var maxWidth; - var maxHeight; - - if(w>=h){ - maxWidth = maxsize - maxHeight = 0 - - }else{ - maxWidth = 0 - maxHeight = maxsize - } - - wRatio = maxWidth / w; - hRatio = maxHeight / h; - - if (maxWidth ==0 && maxHeight==0){ - Ratio = 1; - }else if (maxWidth==0){// - if (hRatio<1) Ratio = hRatio; - }else if (maxHeight==0){ - if (wRatio<1) Ratio = wRatio; - }else if (wRatio<1 || hRatio<1){ - Ratio = (wRatio<=hRatio?wRatio:hRatio); - } - /* - wRatio = maxWidth / w; - hRatio = maxHeight / h; - if (maxWidth ==0 && maxHeight==0){ - Ratio = 1; - }else if (maxWidth==0){// - if (hRatio<1) Ratio = hRatio; - }else if (maxHeight==0){ - if (wRatio<1) Ratio = wRatio; - }else if (wRatio<1 || hRatio<1){ - Ratio = (wRatio<=hRatio?wRatio:hRatio); - } - */ - if (Ratio<1){ - w = w * Ratio; - h = h * Ratio; - } - - return {"width":w,"height":h} -} -export function GetNewsize(maxsize,width,height) { - var hRatio; - var wRatio; - var Ratio = 1; - var w = width; - var h = height; - - var maxWidth; - var maxHeight; - - if(w>=h){ - maxWidth = maxsize - maxHeight = 0 - - }else{ - maxWidth = 0 - maxHeight = maxsize - } - - wRatio = maxWidth / w; - hRatio = maxHeight / h; - if (maxWidth ==0 && maxHeight==0){ - Ratio = 1; - }else if (maxWidth==0){// - if (hRatio<1) Ratio = hRatio; - }else if (maxHeight==0){ - if (wRatio<1) Ratio = wRatio; - }else if (wRatio<1 || hRatio<1){ - Ratio = (wRatio<=hRatio?wRatio:hRatio); - } - if (Ratio<1){ - w = w * Ratio; - h = h * Ratio; - } - return {"width":w,"height":h} -} -/*over、move、拖拽*/ -export function mouseOverHandle(e,chatUI){ - let clickBox = e.target - var direction = 0; - - var mouseDownX = e.clientX; - var mouseDownY = e.clientY; - var clickBoxTop = chatUI.offsetHeight - clickBox.offsetHeight + chatUI.offsetTop - var clickBoxBottom = clickBoxTop + 60 - var clickBoxLeft = chatUI.offsetLeft; - var clickBoxRight = chatUI.offsetWidth + clickBoxLeft - - if(clickBox.id=="chatInput" ){ - e=e||event; //兼容ie和其他浏览器的写法 - - if ( mouseDownY < clickBoxTop + 5){ - direction = 'top'; - } - - // if(clickBox.id=="chatHeader" ){ - // e=e||event; //兼容ie和其他浏览器的写法 - // if ((mouseDownY > clickBoxTop && mouseDownY < clickBoxBottom) || (mouseDownX > clickBoxLeft && mouseDownX < clickBoxRight)){ - // direction = 'move'; - // } - // } - - if(direction!=0){ - if(direction=="left" || direction=="right"){ - clickBox.style.cursor='w-resize' - }else if(direction=="top" || direction=="bottom"){ - clickBox.style.cursor='s-resize' - }else{ - clickBox.style.cursor="auto" - } - }else{ - clickBox.style.cursor="auto" - } - } - -} -export function mouseMoveHandle(e,chatUI){ - let clickBox = e.target - var direction = 0; - clickBox.style.cursor="auto" - - var mouseDownX = e.clientX; - var mouseDownY = e.clientY; - var clickBoxTop = chatUI.offsetHeight - clickBox.offsetHeight + chatUI.offsetTop - var clickBoxBottom = clickBoxTop + 60 - var clickBoxLeft = chatUI.offsetLeft; - var clickBoxRight = chatUI.offsetWidth + clickBoxLeft - - if(clickBox.id=="chatInput" ){ - e=e||event; //兼容ie和其他浏览器的写法 - - if ( mouseDownY < clickBoxTop + 5){ - direction = 'top'; - } - } - // if(clickBox.id=="chatHeader" ){ - // e=e||event; //兼容ie和其他浏览器的写法 - // if ((mouseDownY > clickBoxTop && mouseDownY < clickBoxBottom) || (mouseDownX > clickBoxLeft && mouseDownX < clickBoxRight)){ - // direction = 'move'; - // } - // } - - if(direction!=0){ - if(direction=="left" || direction=="right"){ - clickBox.style.cursor='w-resize' - }else if(direction=="top" || direction=="bottom"){ - clickBox.style.cursor='s-resize' - }else { - clickBox.style.cursor="auto" - } - }else{ - clickBox.style.cursor="auto" - } -} -export function mouseDrag(e,selfHeight,chatUI,changeHeight,setPostion){ - - let clickBox = e.target - var direction = 0; - let count = 0 - - var mouseDownX = e.clientX; - var mouseDownY = e.clientY; - var clickBoxTop = chatUI.offsetHeight - clickBox.offsetHeight + chatUI.offsetTop - var clickBoxBottom = clickBoxTop + 60 - var clickBoxLeft = chatUI.offsetLeft; - var clickBoxRight = chatUI.offsetWidth + clickBoxLeft - var ll = chatUI.offsetLeft - var tt = chatUI.offsetTop - let record=null; - let topHeight=0; - - var maxLeft = document.documentElement.clientWidth - chatUI.offsetWidth - var maxTop = document.documentElement.clientHeight - chatUI.offsetHeight - - if(clickBox.id=="chatInput" ){ - e=e||event; //兼容ie和其他浏览器的写法 - var clickBoxHeight = clickBox.offsetHeight; - var input_maxHeight = chatUI.offsetHeight - 60 - 40 - var record_maxHeight = chatUI.offsetHeight - 60 - selfHeight - record = document.getElementById('section') - topHeight = record.offsetHeight - - if ( mouseDownY < clickBoxTop + 10){ - direction = 'top'; - } - } - if(clickBox.id=="chatHeader" || clickBox.id=="chatHeaderAvatar" || clickBox.id=="chatHeaderTitle" || clickBox.id=="chatHeaderSologan"){ - e=e||event; //兼容ie和其他浏览器的写法 - if ((mouseDownY > clickBoxTop && mouseDownY < clickBoxBottom) || (mouseDownX > clickBoxLeft && mouseDownX < clickBoxRight)){ - direction = 'move'; - } - } - document.onmousemove = function(e) { - e = e || event; //是要是使用原生js给我们提供的e回调参数,这存储了很多有用的信息 - - var yy = e.clientY; - var xx = e.clientX; - - if (clickBox.id=="chatInput" && direction==='top'){ - if(count==0 && setPostion && setPostion!=undefined) { - setPostion() - count++ - } - record.style.height = Math.min(record_maxHeight,(topHeight - mouseDownY + yy) < 40 ? 40:(topHeight - mouseDownY + yy)) + 'px'; - clickBox.style.height = Math.min(input_maxHeight, (clickBoxHeight + mouseDownY - yy) < selfHeight? selfHeight: (clickBoxHeight + mouseDownY - yy)) + 'px'; - if(changeHeight && changeHeight!=undefined) changeHeight(Math.min(record_maxHeight,(topHeight - mouseDownY + yy) < 20 ? 20:(topHeight - mouseDownY + yy))) - - } - if ((clickBox.id=="chatHeader" || clickBox.id=="chatHeaderAvatar" || clickBox.id=="chatHeaderTitle" || clickBox.id=="chatHeaderSologan") && direction==='move'){ - - var l = xx - mouseDownX + ll - var t = yy - mouseDownY + tt - - chatUI.style.left = l <0 ? 0 : Math.min(l,maxLeft) +"px" - chatUI.style.top = t < 0 ? 0 : Math.min(t,maxTop)+"px" - - chatUI.style.transform='' - //chatUI.style.top = t < 0 ? 0 : Math.min(t,maxTop) - } - //return false; //这里为了避免抖动 - }; - document.onmouseup = function(e) { - document.onmousemove = null; - document.onmouseup = null; - e.target.style.cursor='auto' - }; - - if (e.preventDefault){ - e.preventDefault(); - } -} -/*base64转blob*/ -export function previewHtmlByBase64 (base64Str, fileType) { - if (base64Str) { - const myBlob = parseBase64ToBlob(base64Str, fileType) - return myBlob - } - } -export function parseBase64ToBlob (data, fileType) { - let bstr = window.atob(data) - let n = bstr.length - const u8arr = new Uint8Array(n) - while (n--) { - u8arr[n] = bstr.charCodeAt(n) - } - if(fileType=='text/plain') - return new Blob(['\ufeff', u8arr], { type: fileType }) - else return new Blob([u8arr], { type: fileType }) -} -// 表情解码 -export function entitiestoUtf16 (strObj) { - const patt = /&#\d+;/g; - const arr = strObj.match(patt) || []; - - let H; - let L; - let code; - - for (let i = 0; i < arr.length; i += 1) { - code = arr[i]; - code = code.replace('&#', '').replace(';', ''); - // 高位 - H = Math.floor((code - 0x10000) / 0x400) + 0xD800; - // 低位 - L = ((code - 0x10000) % 0x400) + 0xDC00; - code = `&#${code};`; - const s = String.fromCharCode(H, L); - strObj = strObj.replace(code, s); - } - return strObj; - } -// 表情转义保存数据库 -export function utf16toEntities (str){ -const patt = /[\ud800-\udbff][\udc00-\udfff]/g; // 检测utf16字符正则 -str = str.replace(patt, (char) => { - let H; - let L; - let code; - let s; - - if (char.length === 2) { - H = char.charCodeAt(0); // 取出高位 - L = char.charCodeAt(1); // 取出低位 - code = (H - 0xD800) * 0x400 + 0x10000 + L - 0xDC00; // 转换算法 - s = `&#${code};`; - } else { - s = char; - } - - return s; -}); - -return str; -} -export function isEmojiCharacter(substring) { - for ( var i = 0; i < substring.length; i++) { - var hs = substring.charCodeAt(i); - if (0xd800 <= hs && hs <= 0xdbff) { - if (substring.length > 1) { - var ls = substring.charCodeAt(i + 1); - var uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000; - if (0x1d000 <= uc && uc <= 0x1f77f) { - return true; - } - } - } else if (substring.length > 1) { - var ls = substring.charCodeAt(i + 1); - if (ls == 0x20e3) { - return true; - } - } else { - if (0x2100 <= hs && hs <= 0x27ff) { - return true; - } else if (0x2B05 <= hs && hs <= 0x2b07) { - return true; - } else if (0x2934 <= hs && hs <= 0x2935) { - return true; - } else if (0x3297 <= hs && hs <= 0x3299) { - return true; - } else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 - || hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b - || hs == 0x2b50) { - return true; - } - } - } -} -//补齐html标签 -export function closeHTML(str){ - var arrTags=["span","font","b","u","i","h1","h2","h3","h4","h5","h6","p","li","ul","table","div"]; - for(var i=0;i]+|)\\>","ig"); - var arrMatch=str.match(re); - if(arrMatch!=null) intOpen=arrMatch.length; - re=new RegExp("\\<\\/"+arrTags[i]+"\\>","ig"); - arrMatch=str.match(re); - if(arrMatch!=null) intClose=arrMatch.length; - for(var j=0;j"; - } - } - return str; -} -/*图片处理*/ -export const imageHandleUtil = { - //插入图片 - insertImage(img, range, reformMsg, resetCachedRange,resetLoadling){ - range.insertNode(img) - resetCachedRange && resetCachedRange(range) - range.collapse(false) - window.getSelection().removeAllRanges(); - window.getSelection().addRange(range); - reformMsg && reformMsg() - resetLoadling && resetLoadling() - }, - //图片调整大小、增加onclick事件 - changeImage(img, showPic, imgInputSize, imgMsgSize, imgPreviewSize){ - let w = img.width - let h =img.height - let inputSize = GetNewsize(imgInputSize,w,h) - let msgSize = GetNewsize(imgMsgSize,w,h) - let previewSize = GetNewsize(imgPreviewSize,w,h) - - img.style.width=inputSize.width+"px" - img.style.height=inputSize.height+"px" - - let realWidth = img.realWidth = w+"px" - let realHeight = img.realHeight = h+"px" - let msgWidth = img.msgWidth = msgSize.width+"px" - let msgHeight = img.msgHeight = msgSize.height+"px" - let previewidth = img.previewidth = previewSize.width+"px" - let previewHeight = img.previewHeight = previewSize.height+"px" - - img.onclick = function() { - let src = img.src - let param = { - src, realWidth, realHeight, msgWidth, msgHeight, previewidth, previewHeight - } - showPic(param); - } - }, - //粘贴图片 - pasteImages (params){ - let {srcArr, sig, el, range, reformMsg, showPic, resetCachedRange, resetLoadling, imgInputSize, imgMsgSize, imgPreviewSize} = params - var img=new Image(); - img.src=srcArr[sig].src - img.onload=function(){ - //console.log(srcArr[sig]) - //if(!srcArr[sig].style.width || srcArr[sig].style.width==undefined || srcArr[sig].style.width==''){ - if(srcArr[sig].src.indexOf('base64')!=-1){ - var dataarr = img.src.split(',') //分割为数组,分割到第一个逗号 - let mime = dataarr[0].match(/:(.*?);/)[1] //获取分割后的base64前缀中的类型 - let myBlob = parseBase64ToBlob(dataarr[1], mime); - srcArr[sig].src = URL.createObjectURL(myBlob); - } - imageHandleUtil.changeImage(srcArr[sig], showPic, imgInputSize, imgMsgSize, imgPreviewSize) - //} - if(sig{ - imageHandleUtil.changeImage(img, showPic, imgInputSize, imgMsgSize, imgPreviewSize) - imageHandleUtil.insertImage(img, range, reformMsg, resetCachedRange, resetLoadling) - } - } - }, - // canvas转dataURL:canvas对象、转换格式、图像品质 - canvasToDataURL(canvas, format, quality){ - return canvas.toDataURL(format||'image/*', quality||1.0); - }, - // DataURL转Blob对象 - dataURLToBlob(dataurl){ - var arr = dataurl.split(','); - var mime = arr[0].match(/:(.*?);/)[1]; - let blob = parseBase64ToBlob(arr[1], mime); - return blob - }, - // image转canvas:图片地址 - imageToCanvas(src, cb){ - var canvas = document.createElement('CANVAS'); - var ctx = canvas.getContext('2d'); - var img = new Image(); - - img.onload = function (){ - canvas.width = img.width; - canvas.height = img.height; - ctx.drawImage(img, 0, 0); - cb(canvas); - }; - img.setAttribute("crossOrigin",'anonymous') - img.src = src - }, - // image转Blob - imageToBlob(msgData, imgUpload){ - imageHandleUtil.imageToCanvas(msgData.message.content.content, function (canvas){ - let blob = imageHandleUtil.dataURLToBlob(imageHandleUtil.canvasToDataURL(canvas)); - imgUpload && imgUpload(blob, msgData) - }) - }, - uploadImage(msgData, imgUpload){ - imageHandleUtil.imageToBlob(msgData, imgUpload) - }, -} - -//拖动组件 -export const handleElement = { - handleDrag(e,imgRef){ - const o = imgRef.current - const s = o.style - const p = 'onmousemove' - //在jsx中需要用e.persist()此方法会从池中移除合成事件,允许用户代码保留对事件的引用,否则clientX会是null - let x = e.clientX - o.offsetLeft; - let y = e.clientY - o.offsetTop; - document[p] = function (e) { - s.left = e.clientX - x + 'px'; - s.top = e.clientY - y + 'px'; - } - - document.onmouseup = function () { - document[p] = null - } - }, - handleZoom(e, imgRef, scales, changeScales){ - let { style } = imgRef.current - if (e.nativeEvent.deltaY <= 0 && scales < 5 ) { - let a = scales+0.05 - style.transform = 'translate(-50%,-50%) scale('+a+')' - changeScales && changeScales(a) - } else if (e.nativeEvent.deltaY > 0) { - if(scales>0.5){ - let a = scales-0.05 - style.transform = 'translate(-50%,-50%) scale('+a+') ' - changeScales && changeScales(a) - } - } - }, - - handleStopDrag(e){ - e.preventDefault() - }, -} -export function downloadFile(data, name, suffix) { - if (window.navigator && window.navigator.msSaveBlob) { - window.navigator.msSaveBlob(new Blob([data]),name + (suffix ? ('.' + suffix) : '')); - }else{ - const url = window.URL.createObjectURL(new Blob([data])) - const link = document.createElement('a') - link.style.display = 'none' - link.href = url - // const fileName = parseTime(new Date()) + '-' + name + (suffix ? ('.' + suffix) : '') - const fileName = name + (suffix ? ('.' + suffix) : '') - link.setAttribute('download', fileName) - document.body.appendChild(link) - link.click() - document.body.removeChild(link) - } - } -//加密 -export function doEncrypt(value) { - let encryptData = sm2.doEncrypt(value, `${REACT_APP_CUSTOMERSERVICE_PUBLICKEY}`, `${REACT_APP_CUSTOMERSERVICE_CIPHERCODE}`) - return '04' + encryptData; - } - //解密 - export function doDecrypt(value) { - let newValue = value.slice(2, value.length); - let decryptData = sm2.doDecrypt(newValue, `${REACT_APP_CUSTOMERSERVICE_PRIVATEKEY}`, `${REACT_APP_CUSTOMERSERVICE_CIPHERCODE}`) // 解密结果 - return decryptData; - } \ No newline at end of file diff --git a/src/services/customerservice.js b/src/services/customerservice.js deleted file mode 100644 index d1d3a69..0000000 --- a/src/services/customerservice.js +++ /dev/null @@ -1,73 +0,0 @@ -import { $post, $get } from '@/customerServiceHelpers/request'; -import request from '@/utils/request'; - -export const customerserviceAPI = { - //发送消息 - sendToCs(params) { - return request('/api/api/biz-customer-service/msg/sendToCs',{ - method:'POST', - data:{ - ...params, - } - }); - }, - //上传附件 - fileUpload(params){ - return $post('/api/doc/v1.0/files/upload?appCode=upload_cs&objectId=22&objectType='+params.objectType, { - params: params.multipartFiles, - headers: { - 'Content-Type': 'multipart/form-data' - }, - }); - }, - //下载附件 - getSecretKey(params) { - const downloadService = '/api/doc/api/data-service-document-center' - return $get(`${downloadService}` + '/outer/v1.0/files/getSecretKey', { params }); - }, - /** - * - * @param {object} params - * - * 物流订单详情附件下载 - */ - getDownload(params) { - const downloadService = '/api/doc/api/data-service-document-center' - return $post(`${downloadService}` + '/outer/v1.0/files/getDownloadBody', { params, responseType: 'arraybuffer' }); - }, - check(params) { - return request('/api/api/biz-customer-service/conversation/check',{ - method:'POST', - data:{ - ...params, - } - }); - }, - //评价 - estimate(params) { - return request('/api/api/biz-customer-service/outer/v1.0/eshopConversation/updateConversationById',{ - method:'POST', - data:{ - ...params, - } - }); - }, - //获取咨询项目 - list(params) { - let method = "get"; - if(params.projectName==null){ - return request('/api/biz-service-ebtp-tender/v1/participateProject/list', { method: method }) - }else{ - return request('/api/biz-service-ebtp-tender/v1/participateProject/list?projectName='+params.projectName, { method: method }) - } - }, - //获取历史记录 - getMessageList(params){ - return request('/api/api/biz-customer-service/outer/v1.0/conversationRecord/findRecordPageForUser',{ - method:'POST', - data:{ - ...params, - } - }); - }, -} \ No newline at end of file diff --git a/src/typings.d.ts b/src/typings.d.ts index 33e3ba7..5168230 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -52,3 +52,7 @@ declare const START_ENV: string // declare const REACT_APP_XUNJIA_REDIRECT: string /**ENV-询价查看报价跳转地址 */ declare const REACT_APP_XUNJIA_UID: string +//智慧客服 +declare const REACT_APP_CUSTOMERSERVICE_USERCENTER: string +declare const REACT_APP_CUSTOMERSERVICE_CLIENT_ID: string +declare const REACT_APP_CUSTOMERSERVICE_REDIRECT: string