浏览代码

转义next

lwei 11 月之前
父节点
当前提交
6df90a8869
共有 2 个文件被更改,包括 7 次插入3 次删除
  1. 6 2
      src/Login2p/Login2p.tsx
  2. 1 1
      src/Material/components/Research.container.tsx

+ 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 ? encodeURIComponent(next) : '/'}`
+      )
     }
   }
   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 ? encodeURIComponent(next) : '/'}`
+                  )
                 }
                 shape="circle"
                 size="large"

+ 1 - 1
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()