Parcourir la source

feat: 版本4-bug修复

lanjianrong il y a 4 ans
Parent
commit
60947eb1bf

+ 1 - 1
package.json

@@ -9,7 +9,7 @@
     "deploy:qa": "cross-env REACT_APP_ENV=qa auto-deploy build -t qa",
     "deploy:prod": "auto-deploy build -t prod",
     "deploy-gh-pages": "npm run site && npm run gh-pages",
-    "dev": "cross-env REACT_APP_ENV=dev npm run start:dev",
+    "dev": "npm run start:dev",
     "fetch:blocks": "pro fetch-blocks && npm run prettier",
     "gh-pages": "gh-pages -d dist",
     "i18n-remove": "pro i18n-remove --locale=zh-CN --write",

+ 7 - 1
src/components/RightContent/Book/index.tsx

@@ -3,6 +3,7 @@ import ws, { CmdType, onMessage } from '@/utils/ws'
 import { debounce } from 'lodash-es'
 import UesrList from './components/UserList'
 import { useModel } from 'umi'
+// import { isDevMode } from '@/utils/env'
 
 const Book = () => {
   const [onlineList, setOnlineList] = useState([])
@@ -10,11 +11,16 @@ const Book = () => {
 
   useEffect(() => {
     if (initialState?.currentUser) {
+      const { host } = window.location
+
+      const isDev = /^(cld2qa)|(localhost)/.test(host)
       const { username, staffId: id, wsToken: token } = initialState?.currentUser
       id &&
         ws.init(
           id,
-          `ws://cld2qa.com/summon/v1/chat/link?username=${username}&id=${id}&token=${token}`,
+          `${window.location.protocol === 'https:' ? 'wss' : 'ws'}://${
+            isDev ? 'cld2qa' : 'zhcld'
+          }.com/summon/v1/chat/link?username=${username}&id=${id}&token=${token}`,
           {
             onMessage: msg => {
               onMessage(msg)

+ 7 - 3
src/pages/Customer/Client/components/AddClient/TelephoneFormItem.jsx

@@ -1,6 +1,6 @@
 import { useModal } from '@/components/Modal'
 import consts from '@/consts'
-import { queryClient } from '@/services/customer'
+import { queryClientWithTelephone } from '@/services/customer'
 import { useDebounceFn } from 'ahooks'
 import { Input, Alert, Popover } from 'antd'
 import ClientDetail from '../ClientDetail'
@@ -20,7 +20,11 @@ const TelephoneFormItem = ({ value, onChange, validateFn }) => {
 
   const queryList = async search => {
     if (!search) return
-    const { code = -1, data } = await queryClient({ current: 1, pageSize: 20, search })
+    const { code = -1, data } = await queryClientWithTelephone({
+      current: 1,
+      pageSize: 20,
+      search
+    })
     if (code === consts.RET_CODE.SUCCESS) {
       const { client = [] } = data
       setState({ ...state, list: client, visible: !!client?.length })
@@ -66,7 +70,7 @@ const TelephoneFormItem = ({ value, onChange, validateFn }) => {
     <Popover
       zIndex={1003}
       placement="bottom"
-      visible={visible && list?.length}
+      visible={list && list?.length && visible}
       onVisibleChange={e => setState({ ...state, visible: e })}
       title={
         <Alert

+ 6 - 1
src/pages/Customer/Company/components/AddCompany/CompanyFormItem.jsx

@@ -26,7 +26,12 @@ const CompanyFormItem = ({ value, onChange, validateFn }) => {
 
   const queryList = async search => {
     if (!search) return
-    const { code = -1, data } = await queryCompany({ current: 1, pageSize: 20, search })
+    const { code = -1, data } = await queryCompany({
+      current: 1,
+      pageSize: 20,
+      search,
+      waiver: true
+    })
     if (code === consts.RET_CODE.SUCCESS) {
       const { customer = [] } = data
       setState({ ...state, list: customer, visible: !!customer?.length })

+ 13 - 1
src/pages/Product/Cloud/index.jsx

@@ -116,6 +116,14 @@ const Cloud = () => {
       width: 100
     },
     {
+      title: '公司',
+      dataIndex: 'customerName',
+      key: 'customerName',
+      ellipsis: true,
+      width: 50,
+      renderText: (_, record) => record.cld?.customerName
+    },
+    {
       title: '截至上一次登录时长',
       dataIndex: 'onlineTimes',
       key: 'onlineTimes',
@@ -155,7 +163,7 @@ const Cloud = () => {
       }
     },
     {
-      title: 'CLD联系人',
+      title: 'CLD客户',
       dataIndex: 'cld',
       key: 'cld',
       ellipsis: true,
@@ -294,6 +302,10 @@ const Cloud = () => {
       search={false}
       columns={columns}
       columnsStateMap={columnsMap}
+      pagination={{
+        pageSize: 20,
+        showSizeChanger: false
+      }}
     />
   )
 }

+ 10 - 0
src/services/customer.js

@@ -73,6 +73,16 @@ export async function queryClient(payload) {
 }
 
 /**
+ * 请求客户列表(根据手机号码)
+ * @param {*} payload 载荷
+ */
+export async function queryClientWithTelephone(payload) {
+  return request.post('/client/telephone', {
+    data: payload
+  })
+}
+
+/**
  * 修改客户信息
  */
 export async function updateClient(payload) {

+ 3 - 2
src/utils/env.ts

@@ -1,4 +1,5 @@
 import pkg from '../../package.json'
+import { isDevOrQa } from './is'
 
 // Generate cache key according to version
 export function getStorageShortName() {
@@ -28,8 +29,8 @@ export function getEnv(): string {
  * @example:
  */
 export function isDevMode(): boolean {
-  const { NODE_ENV } = process.env
-  return NODE_ENV === devMode
+  // isDevOrQa
+  return isDevOrQa()
 }
 
 /**

+ 5 - 0
src/utils/is.ts

@@ -55,3 +55,8 @@ export function isEmpty<T = unknown>(val: T): val is T {
 export function isMobile() {
   return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
 }
+
+export function isDevOrQa() {
+  const { host } = window.location
+  return /^(cld2qa)|(localhost)/.test(host)
+}