Explorar el Código

fix: 图片资源访问本机静态目录

lanjianrong hace 4 años
padre
commit
925c819a41

+ 1 - 4
src/components/RightContent/AvatarDropdown.tsx

@@ -95,10 +95,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => {
         <Avatar
           size="small"
           className={styles.avatar}
-          src={
-            (isDevMode() ? 'http://cld2qa.com' : 'http://zhcld.com') +
-            (currentUser?.avatar ?? consts.DEFAULT_AVATAR)
-          }
+          src={(isDevMode() && 'http://cld2qa.com') + (currentUser?.avatar ?? consts.DEFAULT_AVATAR)}
           alt="avatar"
         />
         <span className={`${styles.name} anticon`}>{currentUser.username}</span>

+ 2 - 2
src/components/RightContent/Book/components/UserList/index.tsx

@@ -3,6 +3,7 @@ import classNames from 'classnames'
 import { useState, useRef } from 'react'
 import { useIntl } from '@umijs/max'
 import './index.less'
+import consts from '@/consts'
 
 export type StaffItem = {
   avatar: string
@@ -57,8 +58,7 @@ const UesrList: React.FC<UserListProps> = ({ onlineList }) => {
                           className="w-8 h-8 rounded-1/2 block"
                           style={{
                             backgroundImage: `url(${
-                              (isDevMode() ? 'http://cld2qa.com' : 'http://zhcld.com') +
-                              (item.avatar ? item.avatar : '/global/img/avtra_2.jpg')
+                              (isDevMode() && 'http://cld2qa.com') + (item.avatar ?? consts.DEFAULT_AVATAR)
                             })`,
                             backgroundSize: 'cover'
                           }}

+ 4 - 11
src/components/RightContent/NoticeIcon/NoticeIcon.tsx

@@ -7,6 +7,7 @@ import type { NoticeIconTabProps } from './NoticeList'
 import NoticeList from './NoticeList'
 import styles from './index.less'
 import HeaderDropdown from '@/components/HeaderDropdown'
+import { isDevMode } from '@/utils/env'
 
 const { TabPane } = Tabs
 
@@ -33,16 +34,8 @@ const NoticeIcon: React.FC<NoticeIconProps> & {
   Tab: typeof NoticeList
 } = props => {
   const getNotificationBox = (): React.ReactNode => {
-    const {
-      children,
-      loading,
-      onClear,
-      onTabChange,
-      onItemClick,
-      onViewMore,
-      clearText,
-      viewMoreText
-    } = props
+    const { children, loading, onClear, onTabChange, onItemClick, onViewMore, clearText, viewMoreText } =
+      props
     if (!children) {
       return null
     }
@@ -117,7 +110,7 @@ const NoticeIcon: React.FC<NoticeIconProps> & {
 }
 
 NoticeIcon.defaultProps = {
-  emptyImage: 'https://zhcld.com/static/notice_bell.png'
+  emptyImage: isDevMode() && 'http://cld2qa.com' + '/resource/notice_bell.png'
 }
 
 NoticeIcon.Tab = NoticeList

+ 1 - 2
src/pages/Customer/Client/components/ClientDetail/LowerList.tsx

@@ -118,8 +118,7 @@ export const ServiceLogItem: React.FC<ServiceLogItemProps> = ({ item, logType, u
               className="rounded-1/2 w-8 h-8"
               style={{
                 backgroundImage: `url(${
-                  (isDevMode() ? 'http://cld2qa.com' : 'http://zhcld.com') +
-                  (item.avatar ?? consts.DEFAULT_AVATAR)
+                  (isDevMode() && 'http://cld2qa.com') + (item.avatar ?? consts.DEFAULT_AVATAR)
                 })`,
                 backgroundSize: 'cover'
               }}

+ 5 - 16
src/pages/Hr/Notification/components/AddMessage.jsx

@@ -1,12 +1,6 @@
 import React, { useRef } from 'react'
 import { Button, Form, message } from 'antd'
-import {
-  ModalForm,
-  ProFormDependency,
-  ProFormRadio,
-  ProFormSelect,
-  ProFormText
-} from '@ant-design/pro-form'
+import { ModalForm, ProFormDependency, ProFormRadio, ProFormSelect, ProFormText } from '@ant-design/pro-form'
 import RighEditor from './RighEditor'
 import { Plus } from '@icon-park/react'
 
@@ -28,10 +22,10 @@ const AddMessage = props => {
       case msgTypeEnum.NotificationOne:
         switch (values.media) {
           case mediaType.VersionUpdate:
-            newValues.avatar = 'https://zhcld.com/resource/notice_email.png'
+            newValues.avatar = isDevMode() && 'http://cld2qa.com' + '/resource/notice_email.png'
             break
           case mediaType.HolidayNotice:
-            newValues.avatar = 'https://zhcld.com/resource/notice_airplane.png'
+            newValues.avatar = isDevMode() && 'http://cld2qa.com' + '/resource/notice_airplane.png'
             break
           default:
             break
@@ -64,19 +58,14 @@ const AddMessage = props => {
         } catch (error) {
           return false
         }
-      }}
-    >
+      }}>
       <ProFormText
         name="title"
         label="标题"
         placeholder="请输入标题"
         rules={[{ required: true, message: '请输入标题' }]}
       />
-      <Form.Item
-        label="内容"
-        name="content"
-        rules={[{ required: true, message: '请输入通知内容' }]}
-      >
+      <Form.Item label="内容" name="content" rules={[{ required: true, message: '请输入通知内容' }]}>
         <RighEditor />
       </Form.Item>
       <ProFormRadio.Group

+ 48 - 49
src/pages/Product/Lock/LockStore/components/LockDetail/TabList.tsx

@@ -148,8 +148,7 @@ const LockTabList: React.FC<LockTabListProps> = ({
                 className="rounded-1/2 w-8 h-8"
                 style={{
                   backgroundImage: `url(${
-                    (isDevMode() ? 'http://cld2qa.com' : 'http://zhcld.com') +
-                    (item.avatar ?? consts.DEFAULT_AVATAR)
+                    (isDevMode() && 'http://cld2qa.com') + (item.avatar ?? consts.DEFAULT_AVATAR)
                   })`,
                   backgroundSize: 'cover'
                 }}
@@ -235,50 +234,50 @@ const LockTabList: React.FC<LockTabListProps> = ({
         </Tabs>
       </div>
       <div className="sheet-btns pl-4 pt-4 flex">
-  {[StockStatus.CHUKU].includes(stockStatus) ? (
-    <Button
-      type="primary"
-      ghost
-      size="small"
-      className="mr-3px"
-      onClick={() => openLockModal(lockTypeEnum.RECEIVE)}>
-      接收
-    </Button>
-  ) : null}
-  {([StockStatus.CHUKU, StockStatus.CREATE].includes(stockStatus) &&
-    [SellStatus.NONE].includes(sellStatus)) ||
-  [PreserveStatus.REPLACE].includes(preserveStatus) ? (
-    <Button
-      type="primary"
-      ghost
-      size="small"
-      className="mr-1"
-      onClick={() => openLockModal(lockTypeEnum.SALE)}>
-      借销赠
-    </Button>
-  ) : null}
-  {[SellStatus.SALES, SellStatus.LENDING].includes(sellStatus) &&
-  [PreserveStatus.SAFEGUARD, PreserveStatus.REPLACE].includes(preserveStatus) ? (
-    <Button
-      type="primary"
-      ghost
-      size="small"
-      className="mr-1"
-      onClick={() => openLockModal(lockTypeEnum.CHANGE)}>
-      更换
-    </Button>
-  ) : null}
-  {[PreserveStatus.NONE, PreserveStatus.SAFEGUARD, PreserveStatus.UPGRADE].includes(preserveStatus) ? (
-    <Button
-      type="primary"
-      ghost
-      size="small"
-      className="mr-1"
-      onClick={() => openLockModal(lockTypeEnum.RECOVER)}>
-      收回
-    </Button>
-  ) : null}
-  {/* <Button
+        {[StockStatus.CHUKU].includes(stockStatus) ? (
+          <Button
+            type="primary"
+            ghost
+            size="small"
+            className="mr-3px"
+            onClick={() => openLockModal(lockTypeEnum.RECEIVE)}>
+            接收
+          </Button>
+        ) : null}
+        {([StockStatus.CHUKU, StockStatus.CREATE].includes(stockStatus) &&
+          [SellStatus.NONE].includes(sellStatus)) ||
+        [PreserveStatus.REPLACE].includes(preserveStatus) ? (
+          <Button
+            type="primary"
+            ghost
+            size="small"
+            className="mr-1"
+            onClick={() => openLockModal(lockTypeEnum.SALE)}>
+            借销赠
+          </Button>
+        ) : null}
+        {[SellStatus.SALES, SellStatus.LENDING].includes(sellStatus) &&
+        [PreserveStatus.SAFEGUARD, PreserveStatus.REPLACE].includes(preserveStatus) ? (
+          <Button
+            type="primary"
+            ghost
+            size="small"
+            className="mr-1"
+            onClick={() => openLockModal(lockTypeEnum.CHANGE)}>
+            更换
+          </Button>
+        ) : null}
+        {[PreserveStatus.NONE, PreserveStatus.SAFEGUARD, PreserveStatus.UPGRADE].includes(preserveStatus) ? (
+          <Button
+            type="primary"
+            ghost
+            size="small"
+            className="mr-1"
+            onClick={() => openLockModal(lockTypeEnum.RECOVER)}>
+            收回
+          </Button>
+        ) : null}
+        {/* <Button
     type="primary"
     ghost
     size="small"
@@ -289,9 +288,9 @@ const LockTabList: React.FC<LockTabListProps> = ({
   >
     升级
   </Button> */}
-  <Button type="primary" ghost size="small" onClick={() => openLockModal(lockTypeEnum.REMARK)}>
-    备注
-  </Button>
+        <Button type="primary" ghost size="small" onClick={() => openLockModal(lockTypeEnum.REMARK)}>
+          备注
+        </Button>
       </div>
     </div>
   )

+ 1 - 3
src/pages/User/Account/Settings/components/BaseView.jsx

@@ -50,9 +50,7 @@ const BaseView = () => {
     }
     initData()
   }, [])
-  const avatar =
-    (isDevMode() ? 'http://cld2qa.com' : 'http://zhcld.com') +
-    (staff?.avatar ? staff?.avatar : '/resource/avatar/avtra_2.jpg')
+  const avatar = (isDevMode() && 'http://cld2qa.com') + (staff?.avatar ?? '/resource/avatar/avtra_2.jpg')
   return (
     <Tabs defaultActiveKey="1">
       <TabPane tab="基本信息" key="1">

+ 2 - 2
src/pages/Workbench/Dashboard/index.tsx

@@ -17,7 +17,7 @@ import { isDevMode } from '@/utils/env'
 import { useModal } from '@/components/ModalStore'
 import classNames from 'classnames'
 import { PageContainer } from '@ant-design/pro-layout'
-import "antd/lib/card/style"
+
 const Dashboard = ({ dispatch, departments = [] }) => {
   const { initialState: { currentUser } = { currentUser: {} } } = useModel('@@initialState')
   const timer = useRef(null)
@@ -391,7 +391,7 @@ const Dashboard = ({ dispatch, departments = [] }) => {
                   <img
                     className="w-full max-w-8 h-8 border rounded-4xl"
                     src={
-                      (isDevMode() ? 'http://cld2qa.com' : 'http://zhcld.com') +
+                      (isDevMode() ? 'http://cld2qa.com' : 'http://localhost') +
                       (item?.avatar ?? consts.DEFAULT_AVATAR)
                     }
                   />