Browse Source

修复bug

shaogen1995 2 months ago
parent
commit
8a6c01194c

+ 3 - 0
.env

@@ -0,0 +1,3 @@
+# .env.production
+GENERATE_SOURCEMAP = false
+# 关闭映射

+ 2 - 2
config-overrides.js

@@ -3,8 +3,8 @@ const { override, addWebpackAlias } = require('customize-cra')
 
 // 添加 @ 别名
 const webpackAlias = addWebpackAlias({
-  '@': path.resolve(__dirname, 'src'),
+  '@': path.resolve(__dirname, 'src')
 })
 
 // 导出要进行覆盖的 webpack 配置
-module.exports = override(webpackAlias)
+module.exports = override(webpackAlias)

+ 1 - 1
package.json

@@ -74,4 +74,4 @@
     "react-app-rewired": "^2.2.1"
   },
   "homepage": "."
-}
+}

+ 6 - 3
src/components/DingLogin/data.ts

@@ -3,7 +3,10 @@ import history from '@/utils/history'
 export const loginOutFu = () => {
   const urlAll = window.location.href
   const urlArr = urlAll.split('/#/')
-  if (urlArr[1]) {
-    history.push(`/login?back=${urlArr[1]}`)
-  } else history.push('/login')
+
+  if (!urlAll.includes('/login')) {
+    if (urlArr[1]) {
+      history.push(`/login?back=${urlArr[1]}`)
+    } else history.push('/login')
+  }
 }

+ 2 - 2
src/components/Z3upFiles/index.module.scss

@@ -11,14 +11,14 @@
       .Z3filesRow {
         display: flex;
         margin-top: 5px;
-        justify-content: space-between;
+        // justify-content: space-between;
         align-items: center;
         font-size: 16px;
         // border-bottom: 1px dashed #999;
         padding-bottom: 5px;
 
         .Z3files1 {
-          width: calc(100% - 130px);
+          max-width: calc(100% - 130px);
           overflow: hidden;
           text-overflow: ellipsis;
           white-space: nowrap;

+ 1 - 1
src/components/ZmaiDian.ts

@@ -64,7 +64,7 @@ export const maiDianFu = (page_id: string) => {
     } else page_name = '数据统计'
   }
 
-  const _user_id = getTokenInfo().user.accountId || '888708'
+  const _user_id = (getTokenInfo().user || {}).accountId || '888708'
 
   setMd(page_id, page_name, page_id, _user_id)
 }

+ 1 - 1
src/pages/A_workbench/A2business/index.tsx

@@ -16,7 +16,7 @@ import A2setStock from './A2setStock'
 import { RouterType } from '@/types'
 import A2table from './A2table'
 
-const userInfoJting = getTokenInfo().user
+const userInfoJting = getTokenInfo().user || {}
 
 function A2business() {
   // 设置常用功能

+ 4 - 1
src/pages/C_goodsManage/C1register/AddGoods/index.tsx

@@ -63,7 +63,10 @@ type Props = {
 
 function AddGoods({ nowSta, closeFu, succFu, isEdit, editSnap }: Props) {
   // 制档日期 / 制档人
-  const [txtArr, setTxtArr] = useState([getTokenInfo().user.realName, dayjs().format('YYYY-MM-DD')])
+  const [txtArr, setTxtArr] = useState([
+    (getTokenInfo().user || {}).realName,
+    dayjs().format('YYYY-MM-DD')
+  ])
 
   // 藏品编辑模块用来对比
   const objOld = useRef<any>({})

+ 8 - 6
src/pages/E_goodsStorage/E1accident/index.tsx

@@ -63,13 +63,13 @@ function E1accident() {
   // 时间选择器改变
   const timeChange = useCallback(
     (date: any, dateString: any) => {
-      let dateStart = ''
-      let dateEnd = ''
+      let businessTimeStart = ''
+      let businessTimeEnd = ''
       if (dateString[0] && dateString[1]) {
-        dateStart = dateString[0] + ' 00:00:00'
-        dateEnd = dateString[1] + ' 23:59:59'
+        businessTimeStart = dateString[0] + ' 00:00:00'
+        businessTimeEnd = dateString[1] + ' 23:59:59'
       }
-      setFormData({ ...formData, dateStart, dateEnd })
+      setFormData({ ...formData, businessTimeStart, businessTimeEnd })
     },
     [formData]
   )
@@ -266,7 +266,9 @@ function E1accident() {
             <span>事故日期范围:</span>
             <RangePicker
               value={
-                formData.dateStart ? [dayjs(formData.dateStart), dayjs(formData.dateEnd)] : null
+                formData.businessTimeStart
+                  ? [dayjs(formData.businessTimeStart), dayjs(formData.businessTimeEnd)]
+                  : null
               }
               onChange={timeChange}
             />

+ 5 - 3
src/pages/Layout/index.tsx

@@ -48,7 +48,7 @@ function Layout() {
 
   // 获取角色下载权限
   const getDownRole = useCallback(async () => {
-    const info = getTokenInfo().user
+    const info = getTokenInfo().user || {}
     if (info && info.roleId) {
       const res = await Z5_APIgetInfo(info.roleId)
       if (res.code === 0) {
@@ -125,7 +125,7 @@ function Layout() {
 
   // 获取用户权限信息
   const getUserAuthFu = useCallback(async () => {
-    const userInfo = getTokenInfo().user
+    const userInfo = getTokenInfo().user || {}
 
     // 获取权限
     const getRoleRes = await API_getRoleArr(userInfo.roleId)
@@ -317,7 +317,9 @@ function Layout() {
               {v.son.map(v2 => (
                 <div
                   key={v2.id}
-                  hidden={v2.id >= 9901 || (getTokenInfo().user.isAdmin !== 1 && v2.id === 9900)}
+                  hidden={
+                    v2.id >= 9901 || ((getTokenInfo().user || {}).isAdmin !== 1 && v2.id === 9900)
+                  }
                   className={classNames('layoutLRowBoxRow', pathAcFu(v2.path) ? 'active' : '')}
                   ref={pathAcFu(v2.path) ? sroolRef : null}
                   onClick={() => pathCutFu(v2)}

+ 6 - 1
src/pages/Login/index.tsx

@@ -72,7 +72,12 @@ export default function Login() {
       // 用户信息存到本地
       setTokenInfo(res.data)
 
-      history.push('/')
+      const urlAll = window.location.href
+      if (urlAll.includes('?back=')) {
+        const url = urlAll.split('?back=')[1]
+        if (url) history.push(`/${url}`)
+        else history.push('/')
+      } else history.push('/')
     } else if (res.code === -1 && res.msg === '验证码有误') {
       LoginGetCodeFu()
     } else if (res.code === 3014) {

+ 1 - 1
src/pages/Z_system/Z3flowSet/index.tsx

@@ -120,7 +120,7 @@ function Z3flowSet() {
       </div>
       <div className='Z3top'>
         <div className='Z3topll'>
-          流程设置
+          流程类型
           <Select
             allowClear={true}
             placeholder='全部'