Ver Fonte

Merge branch 'mfyx_2.1'

lwei há 7 meses atrás
pai
commit
3695690c51

+ 1 - 1
src/Activity/ActivitySpecialInfo.tsx

@@ -83,7 +83,7 @@ const ActivitySpecialInfo: React.FC<IActivitySpecialInfo> = props => {
   // 登录报名
   const handleToShowMore = () => {
     if (!login2p.jwt) {
-      history.push(`/login2p?next=${window.location.pathname + window.location.search}`)
+      history.push(`/login2p?next=${encodeURIComponent(window.location.pathname + window.location.search)}`)
       return
     }
   }

+ 1 - 1
src/Activity/ActivityTypeDetail.tsx

@@ -103,7 +103,7 @@ const ActivityTypeDetail: React.FC<IActivityTypeDetail> = props => {
   // 登录报名
   const handleToShowMore = () => {
     if (!login2p.jwt) {
-      history.push(`/login2p?next=${window.location.pathname + window.location.search}`)
+      history.push(`/login2p?next=${encodeURIComponent(window.location.pathname + window.location.search)}`)
       return
     }
   }

+ 1 - 1
src/Activity/components/ActivityBtn.component.tsx

@@ -386,7 +386,7 @@ const ActivityBtnComponent: React.FC<IActivityBtnComponent> = props => {
     e.stopPropagation()
     // 检查是否登录了,未登录进入登录页面
     if (!login2p.jwt) {
-      history.push(`/login2p?next=${location.pathname + location.search}`)
+      history.push(`/login2p?next=${encodeURIComponent(location.pathname + location.search)}`)
       return
     }
 

+ 1 - 1
src/Activity/components/ActivityCard.tsx

@@ -93,7 +93,7 @@ const ActivityCard: React.FC<IActivityCard> = props => {
     e.stopPropagation()
     // 检查是否登录了,未登录进入登录页面
     if (!login2p.jwt) {
-      history.push(`/login2p?next=${location.pathname + location.search}`)
+      history.push(`/login2p?next=${encodeURIComponent(location.pathname + location.search)}`)
       return
     }
     onOpenVideoOrAudio && onOpenVideoOrAudio(item)

+ 1 - 1
src/Column/ColumnIndex.tsx

@@ -232,7 +232,7 @@ const ColumnIndex: React.FC<IColumnIndexProps> = props => {
   const handleOnFollowColumn = () => {
     // 检查是否登录了,未登录进入登录页面
     if (!login2p.jwt) {
-      history.push(`/login2p?next=${location.pathname + location.search}`)
+      history.push(`/login2p?next=${encodeURIComponent(location.pathname + location.search)}`)
       return
     }
     postColumnFollow(props.columnId, columnInfo?.IsFollow ? 2 : 1)

+ 2 - 2
src/Column/components/ColumnContent.tsx

@@ -82,7 +82,7 @@ const ColumnContent: React.FC<IColumnContentProps> = props => {
   const handleOnFollowColumn = () => {
     // 检查是否登录了,未登录进入登录页面
     if (!login2p.jwt) {
-      history.push(`/login2p?next=${window.location.pathname + window.location.search}`)
+      history.push(`/login2p?next=${encodeURIComponent(window.location.pathname + window.location.search)}`)
       return
     }
     postColumnFollow(detail.SpecialColumnId, (detail as IColumnDetail)?.IsFollowAuthor ? 2 : 1)
@@ -185,7 +185,7 @@ const ColumnContent: React.FC<IColumnContentProps> = props => {
   // 查看更多
   const handleToShowMore = () => {
     if (!login2p.jwt) {
-      history.push(`/login2p?next=${window.location.pathname + window.location.search}`)
+      history.push(`/login2p?next=${encodeURIComponent(window.location.pathname + window.location.search)}`)
       return
     }
   }

+ 1 - 1
src/Indepth/components/Small.component.tsx

@@ -53,7 +53,7 @@ const SmallComponent: React.FC<ISmallComponentProps> = props => {
   // 打开精选看板
   const handleOpencollections = () => {
     if (!login2p.jwt) {
-      history.push(`/login2p?next=${window.location.pathname + window.location.search}`)
+      history.push(`/login2p?next=${encodeURIComponent(window.location.pathname + window.location.search)}`)
       return
     }
     applyCollectionClick()

+ 6 - 2
src/Login2p/Login2p.tsx

@@ -55,7 +55,9 @@ const Login2p: React.FC = () => {
         // wx.miniProgram.navigateBack()
       }
     } else if (login2p.isWechat && !wechatToken) {
-      login2p.loginWechatLaunch(`${process.env.REACT_APP_URL}login2p/wechat?next=${next ? next : '/'}`)
+      login2p.loginWechatLaunch(
+        `${process.env.REACT_APP_URL}login2p/wechat?next=${next ? next : encodeURIComponent('/')}`
+      )
     }
   }
   const handleLoginegByCode = (value: any) => {
@@ -151,7 +153,9 @@ const Login2p: React.FC = () => {
               <Button
                 icon={<WechatOutlined style={{ color: '#60C84D' }} />}
                 onClick={() =>
-                  login2p.loginWechatLaunch(`${process.env.REACT_APP_URL}login2p/wechat?next=${next ? next : '/'}`)
+                  login2p.loginWechatLaunch(
+                    `${process.env.REACT_APP_URL}login2p/wechat?next=${next ? next : encodeURIComponent('/')}`
+                  )
                 }
                 shape="circle"
                 size="large"

+ 1 - 0
src/Login2p/Login2pContext.tsx

@@ -110,6 +110,7 @@ const Login2pProvider: React.FC<ContextProviderProps> = ({ children }: ContextPr
       // 如果有邀请码
       if (!!data.InviteShareCode) {
         sessionStorage.setItem('invite_code', data.InviteShareCode)
+        console.log(window.location)
         history.replace(`${window.location.pathname}?invite_code=${data.InviteShareCode}`)
       }
 

+ 2 - 1
src/Login2p/Login2pWechatLanding.tsx

@@ -8,10 +8,11 @@ import { useLogin2p } from './Login2pContext'
 const Login2pWechatLanding: React.FC = () => {
   const code = new URLSearchParams(useLocation().search).get('code')
   const next = new URLSearchParams(useLocation().search).get('next')
+  console.log(next)
   const login2p = useLogin2p()
   React.useEffect(() => {
     if (code) {
-      login2p.loginWechat(code, next ? next : '/').then(r => console.log(r))
+      login2p.loginWechat(code, decodeURIComponent(next ? next : '/')).then(r => console.log(r))
     }
   }, [])
 

+ 2 - 2
src/Material/components/Research.container.tsx

@@ -23,7 +23,7 @@ const ResearchContainer: React.FC<ResearchContainerProps> = props => {
 
   const { data: hotList, run } = useRequest(MaterialService.getArcticleHotList, {
     manual: true,
-    formatResult: response => response.data.Data.List
+    formatResult: response => response.data.Data?.List
   })
   const media = useMedia()
   const login2p = useLogin2p()
@@ -45,7 +45,7 @@ const ResearchContainer: React.FC<ResearchContainerProps> = props => {
   // 查看更多
   const handleToShowMore = () => {
     if (!login2p.jwt) {
-      history.push(`/login2p?next=${window.location.pathname + window.location.search}`)
+      history.push(`/login2p?next=${encodeURIComponent(window.location.pathname + window.location.search)}`)
       return
     }
   }

+ 2 - 2
src/NewPageHeader.tsx

@@ -164,7 +164,7 @@ const NewPage: React.FC = props => {
                 onClick={() => setIsShowMenu(!isShowMenu)}
               />
             ) : (
-              <Link to={`/login2p?next=${location.pathname + location.search}`}>
+              <Link to={`/login2p?next=${encodeURIComponent(location.pathname + location.search)}`}>
                 <Button type="primary" className="mobile-login2p-btn">
                   登录
                 </Button>
@@ -351,7 +351,7 @@ const NewPage: React.FC = props => {
                 </div>
               </div>
             ) : (
-              <Link to={`/login2p?next=${location.pathname + location.search}`}>
+              <Link to={`/login2p?next=${encodeURIComponent(location.pathname + location.search)}`}>
                 <Button type="primary" className={styles['login2p-btn']}>
                   登录
                 </Button>

+ 1 - 1
src/Search/components/HeadSearch.tsx

@@ -113,7 +113,7 @@ const HeadSearch: React.FC<IHeadSearchProps> = props => {
         maskClosable={false}
         closable={false}
         onOk={() => {
-          history.push(`/login2p?next=${window.location.pathname + window.location.search}`)
+          history.push(`/login2p?next=${encodeURIComponent(window.location.pathname + window.location.search)}`)
         }}
         onCancel={() => {
           setIsModalVisible(false)

+ 1 - 1
src/Vmp.tsx

@@ -29,7 +29,7 @@ const Vmp: React.FC = () => {
       sessionStorage.setItem('invite_code', inviteCode)
     }
     // 如果有邀请码,带上邀请码
-    if (sessionStorage.getItem('invite_code')) {
+    if (sessionStorage.getItem('invite_code') && !window.location.search.includes('invite_code')) {
       history.push(`${window.location.pathname}?invite_code=${sessionStorage.getItem('invite_code')}`)
     }
     if (login2p.jwt) {