提交 75dd5070 作者: 翁进城

企业认证页面登录判断

上级 c8482076
...@@ -2,13 +2,14 @@ import { LoadingOutlined, PlusOutlined } from "@ant-design/icons"; ...@@ -2,13 +2,14 @@ import { LoadingOutlined, PlusOutlined } from "@ant-design/icons";
import { Col, Form, Input, Row, Upload, message, Button, Image } from "antd"; import { Col, Form, Input, Row, Upload, message, Button, Image } from "antd";
import type { UploadChangeParam } from "antd/es/upload"; import type { UploadChangeParam } from "antd/es/upload";
import type { RcFile, UploadFile, UploadProps } from "antd/es/upload/interface"; import type { RcFile, UploadFile, UploadProps } from "antd/es/upload/interface";
import { useState } from "react"; import { useContext, useState } from "react";
import config from "~/api/config"; import config from "~/api/config";
import Layout from "~/components/layout"; import Layout from "~/components/layout";
import api from "./api"; import api from "./api";
import styles from "./index.module.scss"; import styles from "./index.module.scss";
import gApi from '~/api'; import gApi from "~/api";
import Router from "next/router"; import Router from "next/router";
import { UserContext } from "~/lib/userProvider";
const beforeUpload = (file: RcFile) => { const beforeUpload = (file: RcFile) => {
const isJpgOrPng = file.type === "image/jpeg" || file.type === "image/png"; const isJpgOrPng = file.type === "image/jpeg" || file.type === "image/png";
...@@ -34,6 +35,7 @@ const normFile = (e: any) => { ...@@ -34,6 +35,7 @@ const normFile = (e: any) => {
export default function Certification() { export default function Certification() {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [imageUrl, setImageUrl] = useState<string>(); const [imageUrl, setImageUrl] = useState<string>();
const { userInfo, setUserInfo } = useContext(UserContext);
//上传change事件 //上传change事件
const handleChange: UploadProps["onChange"] = ( const handleChange: UploadProps["onChange"] = (
...@@ -60,12 +62,18 @@ export default function Certification() { ...@@ -60,12 +62,18 @@ export default function Certification() {
licenseImg: imageUrl, licenseImg: imageUrl,
}) })
.then((res) => { .then((res) => {
console.log('提交结果', res); console.log("提交结果", res);
if(res.code === '200'){ if (res.code === "200") {
window.messageApi.success(res.result); window.messageApi.success("提交成功,请等待审核");
if (userInfo) {
setUserInfo({
...userInfo,
companyAuthStatus: 1,
});
}
setTimeout(() => { setTimeout(() => {
Router.push('/'); Router.push("/");
}, 1000) }, 1000);
} }
}); });
}; };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论