提交 0a6d70fb 作者: ZhangLingKun

功能:eslint-disable

上级 f2ce8723
...@@ -64,17 +64,21 @@ ...@@ -64,17 +64,21 @@
} }
} }
], ],
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/comma-dangle": "off", // Avoid conflict rule between Eslint and Prettier "@typescript-eslint/comma-dangle": "off", // Avoid conflict rule between Eslint and Prettier
"import/prefer-default-export": "off", // Named export is easier to refactor automatically "import/prefer-default-export": "off", // Named export is easier to refactor automatically
"class-methods-use-this": "off", // _document.tsx use render method without `this` keyword "class-methods-use-this": "off", // _document.tsx use render method without `this` keyword
"@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error", "unused-imports/no-unused-imports": "warn",
"unused-imports/no-unused-vars": [ "unused-imports/no-unused-vars": [
"error", "warn",
{ "argsIgnorePattern": "^_" } { "argsIgnorePattern": "^_" }
], ],
"jsx-a11y/click-events-have-key-events": "off", "jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-static-element-interactions": "off" "jsx-a11y/no-static-element-interactions": "off",
"eqeqeq": "warn",
"no-unsafe-optional-chaining": "warn",
"no-param-reassign": "warn"
} }
} }
] ]
......
import React, { useContext, useEffect, useState } from 'react'; import React, { useContext, useEffect, useState } from 'react';
import { Avatar, Button, Dropdown, Space, Tabs } from 'antd'; import { Avatar, Button, Dropdown, Space, Tabs } from 'antd';
import type { TabsProps } from 'antd'; import type { TabsProps } from 'antd';
import styles from './index.module.scss';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import LoginModal from '~/components/loginModal'; import LoginModal from '~/components/loginModal';
import PublishModal from './publishModal';
import JoinModal from './joinModal';
import { UserContext } from '~/lib/userProvider'; import { UserContext } from '~/lib/userProvider';
import styles from './index.module.scss';
import JoinModal from './joinModal';
import PublishModal from './publishModal';
const items: TabsProps['items'] = [ const items: TabsProps['items'] = [
{ {
key: '/home', key: '/home',
...@@ -57,23 +60,23 @@ export default function NavHeader(props: Props) { ...@@ -57,23 +60,23 @@ export default function NavHeader(props: Props) {
} }
}, [router.route]); }, [router.route]);
//导航更改 // 导航更改
const onChange = (key: string) => { const onChange = (key: string) => {
router.push(key); router.push(key);
}; };
//退出登录 // 退出登录
const onLogout = () => { const onLogout = () => {
logout(); logout();
}; };
const [openLoginModal, setOpenLoginModal] = useState(false); //登录modal const [openLoginModal, setOpenLoginModal] = useState(false); // 登录modal
const [openPublishModal, setOpenPublishModal] = useState(false); //发布modal const [openPublishModal, setOpenPublishModal] = useState(false); // 发布modal
const [openJoinModal, setOpenJoinModal] = useState(false); //加盟modal const [openJoinModal, setOpenJoinModal] = useState(false); // 加盟modal
//发布按钮事件 // 发布按钮事件
function onPublish() { function onPublish() {
//登录判断 // 登录判断
if (!userInfo) { if (!userInfo) {
setOpenLoginModal(true); setOpenLoginModal(true);
} else { } else {
...@@ -81,9 +84,9 @@ export default function NavHeader(props: Props) { ...@@ -81,9 +84,9 @@ export default function NavHeader(props: Props) {
} }
} }
//加盟按钮事件 // 加盟按钮事件
function onJoin() { function onJoin() {
//登录判断 // 登录判断
if (!userInfo) { if (!userInfo) {
setOpenLoginModal(true); setOpenLoginModal(true);
} else { } else {
...@@ -91,7 +94,7 @@ export default function NavHeader(props: Props) { ...@@ -91,7 +94,7 @@ export default function NavHeader(props: Props) {
} }
} }
//从其它组件通知需要登录 // 从其它组件通知需要登录
useEffect(() => { useEffect(() => {
if (needLogin) { if (needLogin) {
setOpenLoginModal(true); setOpenLoginModal(true);
......
...@@ -8,8 +8,9 @@ export interface ListTagResp { ...@@ -8,8 +8,9 @@ export interface ListTagResp {
createTime: string; createTime: string;
} }
// eslint-disable-next-line import/no-anonymous-default-export
export default { export default {
//加盟标签列表 // 加盟标签列表
listTag: (): Promise<Response<Array<ListTagResp>>> => { listTag: (): Promise<Response<Array<ListTagResp>>> => {
return request('/userapp/cooperation/listTag'); return request('/userapp/cooperation/listTag');
}, },
......
/* eslint-disable */
import { useContext, useEffect, useState } from 'react';
import { Col, Modal, Row } from 'antd'; import { Col, Modal, Row } from 'antd';
import Image from 'next/image'; import Image from 'next/image';
import styles from './index.module.scss';
import { useContext, useEffect, useState } from 'react';
import api, { ListTagResp } from './api';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { UserContext } from '~/lib/userProvider';
import commonApi from '~/api'; import commonApi from '~/api';
import { UserContext } from '~/lib/userProvider';
import api, { ListTagResp } from './api';
import styles from './index.module.scss';
const imgs = [ const imgs = [
require('./assets/生产制造商.png'), require('./assets/生产制造商.png'),
......
...@@ -6,11 +6,11 @@ export interface TypeResp { ...@@ -6,11 +6,11 @@ export interface TypeResp {
} }
export interface PublishParams { export interface PublishParams {
publishPhone: number; //手机号 publishPhone: number; // 手机号
publishName: string; //发布名称 publishName: string; // 发布名称
requirementTypeId: number; //需求类型 requirementTypeId: number; // 需求类型
requireDescription: string; //需求描述 requireDescription: string; // 需求描述
provinceCode?: string; //省编码 provinceCode?: string; // 省编码
} }
export default { export default {
......
import { Button, Form, Input, Modal, Select } from 'antd';
import { useContext, useEffect, useState } from 'react'; import { useContext, useEffect, useState } from 'react';
import { Button, Form, Input, Modal, Select } from 'antd';
import { CommonContext } from '~/lib/commonProvider'; import { CommonContext } from '~/lib/commonProvider';
import { useGeolocation } from '~/lib/hooks'; import { useGeolocation } from '~/lib/hooks';
import { phoneNumber } from '~/lib/validateUtils';
import api, { PublishParams, TypeResp } from './api'; import api, { PublishParams, TypeResp } from './api';
import styles from './index.module.scss'; import styles from './index.module.scss';
import { phoneNumber } from '~/lib/validateUtils';
type Props = { type Props = {
open?: boolean; open?: boolean;
...@@ -12,7 +15,7 @@ type Props = { ...@@ -12,7 +15,7 @@ type Props = {
onCancel?: () => void; onCancel?: () => void;
}; };
export default function PublishModal(props: Props) { export default function PublishModal(props: Props) {
const [types, setTypes] = useState<Array<TypeResp>>([]); //需求类型 const [types, setTypes] = useState<Array<TypeResp>>([]); // 需求类型
const [params, setParams] = useState<PublishParams>({ const [params, setParams] = useState<PublishParams>({
publishName: '', publishName: '',
publishPhone: -1, publishPhone: -1,
...@@ -31,6 +34,7 @@ export default function PublishModal(props: Props) { ...@@ -31,6 +34,7 @@ export default function PublishModal(props: Props) {
const onFinish = (values: any) => { const onFinish = (values: any) => {
console.log('Success:', values); console.log('Success:', values);
// eslint-disable-next-line no-param-reassign
values.publishPhone = Number(values.publishPhone); values.publishPhone = Number(values.publishPhone);
api api
.publish({ .publish({
...@@ -40,6 +44,7 @@ export default function PublishModal(props: Props) { ...@@ -40,6 +44,7 @@ export default function PublishModal(props: Props) {
}) })
.then((res) => { .then((res) => {
if (res.code === '200') { if (res.code === '200') {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
props.onCancel && props.onCancel(); props.onCancel && props.onCancel();
window.messageApi.success('发布成功'); window.messageApi.success('发布成功');
setReloadRequirements(!reloadRequirements); setReloadRequirements(!reloadRequirements);
......
/* eslint-disable */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import './index.scss'; import './index.scss';
import { pinyin } from 'pinyin-pro';
import { Select } from 'antd'; import { Select } from 'antd';
import { pinyin } from 'pinyin-pro';
// 搜索列表的类型 // 搜索列表的类型
interface searchColumns { interface searchColumns {
...@@ -49,12 +51,14 @@ const BrandSelectSearch: React.FC<propType> = (props) => { ...@@ -49,12 +51,14 @@ const BrandSelectSearch: React.FC<propType> = (props) => {
if (!columns.some((i) => i.type === 'Alphabet')) return; if (!columns.some((i) => i.type === 'Alphabet')) return;
// 获取字母列表 // 获取字母列表
const options = columns.find((i) => i.type === 'Alphabet')?.options; const options = columns.find((i) => i.type === 'Alphabet')?.options;
var _options; let _options;
var temp = new Set( const temp = new Set(
(_options = options) === null || _options === void 0 (_options = options) === null || _options === void 0
? void 0 ? void 0
: _options.map(function (i) { : _options.map(function (i) {
var _pinyin, _pinyin$at, _pinyin$at$at; let _pinyin;
let _pinyin$at;
let _pinyin$at$at;
return (_pinyin = pinyin(i.label, { return (_pinyin = pinyin(i.label, {
toneType: 'none', toneType: 'none',
type: 'array', type: 'array',
......
import React from 'react'; import React from 'react';
import { Box } from './styled';
import { BoxProps } from './interface';
import Left from './left'; import Left from './left';
import Right from './right'; import Right from './right';
import { BoxProps } from './interface'; import { Box } from './styled';
export default function ContentBox(props: BoxProps) { export default function ContentBox(props: BoxProps) {
return ( return (
<Box> <Box>
......
...@@ -13,6 +13,7 @@ export interface WaterfallType { ...@@ -13,6 +13,7 @@ export interface WaterfallType {
}[]; }[];
pagination?: JSX.Element; pagination?: JSX.Element;
} }
// eslint-disable-next-line @typescript-eslint/naming-convention
export interface leftBoxProps { export interface leftBoxProps {
boxIndex: number; boxIndex: number;
leftRenderDom?: DomType; leftRenderDom?: DomType;
...@@ -27,6 +28,7 @@ export interface leftBoxProps { ...@@ -27,6 +28,7 @@ export interface leftBoxProps {
}; };
}; };
} }
// eslint-disable-next-line @typescript-eslint/naming-convention
export interface rightBoxProps { export interface rightBoxProps {
rightRenderDom: DomType; rightRenderDom: DomType;
} }
......
import React, { useEffect } from 'react'; import React from 'react';
import { Empty } from 'antd'; import { Empty } from 'antd';
import { LeftBox, Box, WaterfallBox } from './styled'; import { LeftBox, Box, WaterfallBox } from './styled';
import { leftBoxProps } from '../interface'; import { leftBoxProps } from '../interface';
......
import styled from 'styled-components'; import styled from 'styled-components';
export interface BoxProps { export interface BoxProps {
index: number; index: number;
leftcontentstyle?: { leftcontentstyle?: {
......
import React from 'react'; import React from 'react';
import { Box } from './styled'; import { Box } from './styled';
import { rightBoxProps } from '../interface'; import { rightBoxProps } from '../interface';
export default function Right(props: rightBoxProps) { export default function Right(props: rightBoxProps) {
const { rightRenderDom } = props; const { rightRenderDom } = props;
return <Box>{rightRenderDom.columns.map((item) => item.element)}</Box>; return <Box>{rightRenderDom.columns.map((item) => item.element)}</Box>;
......
import { Space, Select } from 'antd';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import styles from '../../index.module.scss';
import { Space, Select } from 'antd';
import api, { RegionResp } from '../../api'; import api, { RegionResp } from '../../api';
import styles from '../../index.module.scss';
type Props = { type Props = {
onChange: (item: RegionResp) => void; onChange: (item: RegionResp) => void;
......
import React from 'react';
import { Space, Tag } from 'antd'; import { Space, Tag } from 'antd';
// eslint-disable-next-line import/no-cycle
import { FilterResult } from '../..'; import { FilterResult } from '../..';
import styles from '../../index.module.scss';
import { InfoList } from '../../api'; import { InfoList } from '../../api';
import styles from '../../index.module.scss';
type Props = { type Props = {
data: FilterResult; data: FilterResult;
onDel: (key: string | number) => void; onDel: (key: string | number) => void;
......
import { Space, Button, Select, Collapse } from 'antd';
import styles from '../../index.module.scss';
import api, { FilterOptionResp, InfoList } from '../../api';
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { Space, Button, Collapse } from 'antd';
import { FilterOptionResp, InfoList } from '../../api';
import styles from '../../index.module.scss';
type Props = { type Props = {
onChange: (id: FilterOptionResp) => void; onChange: (id: FilterOptionResp) => void;
typeName: string; typeName: string;
...@@ -19,11 +21,11 @@ export default function CategoryItem(props: Props) { ...@@ -19,11 +21,11 @@ export default function CategoryItem(props: Props) {
const onClick = (item: FilterOptionResp) => { const onClick = (item: FilterOptionResp) => {
props.onChange({ props.onChange({
id: item.id, id: item.id,
name: `${props.typeName}` + item.name, name: `${props.typeName}${item.name}`,
}); });
}; };
const showCount = 9; //展示数量 const showCount = 9; // 展示数量
return ( return (
<div className={styles.filterItem}> <div className={styles.filterItem}>
......
import { FilterOptionResp, RegionResp } from './api';
import ResultItem from './compoents/resultItem';
import RegionItem from './compoents/regionItem';
import styles from './index.module.scss';
import React, { useEffect, useState, forwardRef, useImperativeHandle, Ref } from 'react'; import React, { useEffect, useState, forwardRef, useImperativeHandle, Ref } from 'react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import api, { FilterOptionResp, TypesResp, InfoList } from './api';
import RegionItem from './compoents/regionItem';
// eslint-disable-next-line import/no-cycle
import ResultItem from './compoents/resultItem';
import TypeInfo from './compoents/typeInfo'; import TypeInfo from './compoents/typeInfo';
import api, { TypesResp, InfoList } from './api'; import styles from './index.module.scss';
export type AdapterResult = { export type AdapterResult = {
categoryId?: any[]; categoryId?: any[];
...@@ -18,29 +20,29 @@ export type FilterResult = { ...@@ -18,29 +20,29 @@ export type FilterResult = {
}; };
type Props = { type Props = {
types: string[]; //需要包含的筛选条件项 types: string[]; // 需要包含的筛选条件项
showResultItem: Boolean; //显示结果栏 showResultItem: Boolean; // 显示结果栏
onChange: ( onChange: (
filterResult: FilterResult, filterResult: FilterResult,
adapterFilterResult: AdapterResult, //适配器,直接用于接口请求 adapterFilterResult: AdapterResult, // 适配器,直接用于接口请求
) => void; //筛选条件更改事件 ) => void; // 筛选条件更改事件
}; };
const Filter = (props: Props, ref: Ref<any>) => { const Filter = (props: Props, ref: Ref<any>) => {
const router = useRouter(); const router = useRouter();
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
clearRouter: clearRouter, clearRouter,
})); }));
const [result, setResult] = useState<FilterResult>({}); const [result, setResult] = useState<FilterResult>({});
const onChange = (item: FilterOptionResp, type: string) => { const onChange = (item: FilterOptionResp, type: string) => {
clearRouter(); clearRouter();
let data: { [key: string]: FilterOptionResp[] | FilterOptionResp } = {}; const data: { [key: string]: FilterOptionResp[] | FilterOptionResp } = {};
if (type === 'categoryId') { if (type === 'categoryId') {
if (result.categoryId) { if (result.categoryId) {
data[type] = [...result.categoryId, item]; data[type] = [...result.categoryId, item];
const map = new Map(); const map = new Map();
//去重 // 去重
data[type] = (data[type] as InfoList[]).filter((v) => !map.has(v.id) && map.set(v.id, 1)); data[type] = (data[type] as InfoList[]).filter((v) => !map.has(v.id) && map.set(v.id, 1));
} else { } else {
data[type] = [item]; data[type] = [item];
...@@ -66,21 +68,19 @@ const Filter = (props: Props, ref: Ref<any>) => { ...@@ -66,21 +68,19 @@ const Filter = (props: Props, ref: Ref<any>) => {
}; };
const onDel = (key: string | number) => { const onDel = (key: string | number) => {
clearRouter(); clearRouter();
console.log(key); // console.log(key);
if (Object.prototype.toString.call(key) === '[object String]') { if (Object.prototype.toString.call(key) === '[object String]') {
//@ts-ignore // @ts-ignore
delete result[key]; delete result[key];
} else { } else if (result.categoryId?.length! === 1) {
if (result.categoryId?.length! === 1) { result.categoryId = undefined;
result.categoryId = undefined; } else if (result.categoryId?.length! >= 2) {
} else if (result.categoryId?.length! >= 2) { result.categoryId?.forEach((item, index) => {
result.categoryId?.map((item, index) => { if (item.id === key) {
if (item.id === key) { result.categoryId?.splice(index, 1);
result.categoryId?.splice(index, 1); }
} });
});
}
} }
setResult({ setResult({
...result, ...result,
...@@ -95,21 +95,21 @@ const Filter = (props: Props, ref: Ref<any>) => { ...@@ -95,21 +95,21 @@ const Filter = (props: Props, ref: Ref<any>) => {
type: routerList.indexOf(router.pathname) + 1, type: routerList.indexOf(router.pathname) + 1,
}); });
setTypeInfo(res.result); setTypeInfo(res.result);
//首页跳转自定筛选选中 // 首页跳转自定筛选选中
let queryVal = JSON.parse(JSON.stringify(router.query)); const queryVal = JSON.parse(JSON.stringify(router.query));
if (Object.keys(router.query).length) { if (Object.keys(router.query).length) {
//获取类型的id // 获取类型的id
const idOfType = res.result const idOfType = res.result
?.map((item) => item.categoriesInfoListDTO) ?.map((item) => item.categoriesInfoListDTO)
.flat() .flat()
.filter((item) => item && item.id === Number(queryVal['categoryId']))[0]?.directoryId; .filter((item) => item && item.id === Number(queryVal.categoryId))[0]?.directoryId;
//获取类型的名称然后拼接 // 获取类型的名称然后拼接
const TypeName = res.result?.filter((item) => item.directoryId === idOfType)[0]?.name; const TypeName = res.result?.filter((item) => item.directoryId === idOfType)[0]?.name;
onChange( onChange(
{ {
id: Number(queryVal['categoryId']), id: Number(queryVal.categoryId),
name: `${TypeName ? TypeName + ':' + queryVal.name : queryVal.name}`, name: `${TypeName ? `${TypeName}${queryVal.name}` : queryVal.name}`,
}, },
'categoryId', 'categoryId',
); );
...@@ -139,7 +139,7 @@ const Filter = (props: Props, ref: Ref<any>) => { ...@@ -139,7 +139,7 @@ const Filter = (props: Props, ref: Ref<any>) => {
key={item.directoryId} key={item.directoryId}
typeName={item.name} typeName={item.name}
dataValue={item.categoriesInfoListDTO} dataValue={item.categoriesInfoListDTO}
onChange={(item: FilterOptionResp) => onChange(item, 'categoryId')} onChange={(e: FilterOptionResp) => onChange(e, 'categoryId')}
></TypeInfo> ></TypeInfo>
))} ))}
{props.showResultItem && <ResultItem data={result} onDel={onDel}></ResultItem>} {props.showResultItem && <ResultItem data={result} onDel={onDel}></ResultItem>}
......
import styles from './index.module.scss';
import { Image } from 'antd'; import { Image } from 'antd';
import errImg from '~/assets/errImg'; import errImg from '~/assets/errImg';
import styles from './index.module.scss';
const qrcodeList = [ const qrcodeList = [
{ {
img: '/assets/xiaochengxu.png', img: '/assets/xiaochengxu.png',
...@@ -30,7 +32,7 @@ export default function Footer() { ...@@ -30,7 +32,7 @@ export default function Footer() {
return ( return (
<div className={styles.footer}> <div className={styles.footer}>
<div className={styles.footerBox}> <div className={styles.footerBox}>
{/*<div className={styles.logo}></div>*/} {/* <div className={styles.logo}></div> */}
<div className={styles.qrcodeList}> <div className={styles.qrcodeList}>
{qrcodeList.map((item, i) => { {qrcodeList.map((item, i) => {
return ( return (
......
import React from 'react'; import React from 'react';
import { Layout, Space } from 'antd'; import { Layout, Space } from 'antd';
import NavHeader from '~/components/NavHeader';
import FooterView from '~/components/footer';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import FooterView from '~/components/footer';
import NavHeader from '~/components/NavHeader';
import styles from './index.module.scss'; import styles from './index.module.scss';
const { Header, Footer, Content } = Layout; const { Header, Footer, Content } = Layout;
//底部栏固定定位 // 底部栏固定定位
const includesPage = ['/home', '/flyingHandService/detail/[id]']; const includesPage = ['/home', '/flyingHandService/detail/[id]'];
const homeStyle: React.CSSProperties = { const homeStyle: React.CSSProperties = {
...@@ -50,9 +53,7 @@ export default function LayoutView(props: Props) { ...@@ -50,9 +53,7 @@ export default function LayoutView(props: Props) {
const router = useRouter(); const router = useRouter();
return ( return (
<Space direction='vertical' style={{ minWidth: '100%' }} size={[0, 48]}> <Space direction='vertical' style={{ minWidth: '100%' }} size={[0, 48]}>
<Layout <Layout style={{ minHeight: '100vh', backgroundColor: '#F8F8F8', ...props.layoutStyle }}>
style={Object.assign({ minHeight: '100vh', backgroundColor: '#F8F8F8' }, props.layoutStyle)}
>
<Header style={headerStyle}> <Header style={headerStyle}>
<NavHeader style={props.headerStyle} /> <NavHeader style={props.headerStyle} />
</Header> </Header>
......
import React, { useContext, useEffect, useState } from 'react'; import React, { useContext, useEffect, useState } from 'react';
import { Modal, Image } from 'antd'; import { Modal, Image } from 'antd';
import api from '~/api'; import api from '~/api';
import { UserContext } from '~/lib/userProvider';
import errImg from '~/assets/errImg'; import errImg from '~/assets/errImg';
import { UserContext } from '~/lib/userProvider';
type Props = { type Props = {
open: boolean; open: boolean;
...@@ -37,14 +39,14 @@ export default function LoginModal(props: Props) { ...@@ -37,14 +39,14 @@ export default function LoginModal(props: Props) {
useEffect(() => { useEffect(() => {
if (randomLoginCode) { if (randomLoginCode) {
//获取登录码 // 获取登录码
api api
.getAppletQRCode({ .getAppletQRCode({
randomLoginCode, randomLoginCode,
}) })
.then((res) => { .then((res) => {
if (res.code == '200') { if (res.code == '200') {
setQrCode('data:image/png;base64,' + res.result || ''); setQrCode(`data:image/png;base64,${res.result}` || '');
} else { } else {
window.messageApi.error('获取登录二维码失败'); window.messageApi.error('获取登录二维码失败');
} }
...@@ -58,7 +60,7 @@ export default function LoginModal(props: Props) { ...@@ -58,7 +60,7 @@ export default function LoginModal(props: Props) {
const handle = setInterval(() => { const handle = setInterval(() => {
api api
.getLoginInfo({ .getLoginInfo({
randomLoginCode: randomLoginCode, randomLoginCode,
}) })
.then((res) => { .then((res) => {
if (res.code === '200') { if (res.code === '200') {
...@@ -66,8 +68,8 @@ export default function LoginModal(props: Props) { ...@@ -66,8 +68,8 @@ export default function LoginModal(props: Props) {
setTimeHandle(null); setTimeHandle(null);
window.localStorage.setItem('token', res.result.token); window.localStorage.setItem('token', res.result.token);
api.userInfo().then((res) => { api.userInfo().then((userRes) => {
setUserInfo(res.result); setUserInfo(userRes.result);
window.messageApi.success('登录成功'); window.messageApi.success('登录成功');
props.onCancel(); props.onCancel();
window.location.reload(); window.location.reload();
......
import { headers } from 'next/dist/client/components/headers';
import request, { Response } from '~/api/request'; import request, { Response } from '~/api/request';
// eslint-disable-next-line import/no-anonymous-default-export
export default { export default {
uploadFile: (data: FormData): Promise<Response<string>> => uploadFile: (data: FormData): Promise<Response<string>> =>
request('/pms/upload/breakpoint', 'post', data, { headers: {}, body: data }), request('/pms/upload/breakpoint', 'post', data, { headers: {}, body: data }),
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { message, Upload, UploadProps } from 'antd'; import { message, Upload, UploadProps } from 'antd';
import uploadApi from './api'; import uploadApi from './api';
interface PropsType { interface PropsType {
...@@ -9,7 +11,7 @@ interface PropsType { ...@@ -9,7 +11,7 @@ interface PropsType {
fileUpload: boolean; // 是否上传到服务器(返回文件流还是返回上传后的地址) fileUpload: boolean; // 是否上传到服务器(返回文件流还是返回上传后的地址)
fileLength?: number; // 最大上传文件数量 fileLength?: number; // 最大上传文件数量
children: React.ReactNode; // 上传按钮 children: React.ReactNode; // 上传按钮
showUploadList?: boolean; //是否隐藏上传文件列表 showUploadList?: boolean; // 是否隐藏上传文件列表
onChange?: ( onChange?: (
fileList: { fileList: {
id: number; id: number;
......
import { Modal, ModalProps } from 'antd';
import { FC, useEffect, useState } from 'react'; import { FC, useEffect, useState } from 'react';
import { Box } from './styled';
import { Modal, ModalProps, Image } from 'antd';
import api from '~/api'; import api from '~/api';
import { Image } from 'antd';
import { Box } from './styled';
const WxCodeModal: FC<ModalProps> = ({ open, onCancel }) => { const WxCodeModal: FC<ModalProps> = ({ open, onCancel }) => {
const [wxCodeImg, setWxCodeImg] = useState<string>(''); const [wxCodeImg, setWxCodeImg] = useState<string>('');
const getWXCode = () => { const getWXCode = () => {
...@@ -20,7 +23,7 @@ const WxCodeModal: FC<ModalProps> = ({ open, onCancel }) => { ...@@ -20,7 +23,7 @@ const WxCodeModal: FC<ModalProps> = ({ open, onCancel }) => {
<Box> <Box>
<div className='title'>立即申请合作</div> <div className='title'>立即申请合作</div>
<div className='img'> <div className='img'>
<Image src={wxCodeImg} width={160} height={160} /> <Image src={wxCodeImg} width={160} height={160} alt={'图片'} />
</div> </div>
<div className='meta'>打开微信扫一扫</div> <div className='meta'>打开微信扫一扫</div>
</Box> </Box>
......
import React, { createContext, Dispatch, SetStateAction, useState } from 'react'; import React, { createContext, Dispatch, SetStateAction, useState } from 'react';
export const CommonContext = createContext<{ export const CommonContext = createContext<{
reloadRequirements: boolean; //更新项目需求列表 reloadRequirements: boolean; // 更新项目需求列表
setReloadRequirements: Dispatch<SetStateAction<boolean>>; setReloadRequirements: Dispatch<SetStateAction<boolean>>;
}>({ }>({
reloadRequirements: false, reloadRequirements: false,
......
// @ts-nocheck
/* eslint-disable */
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
export function useGeolocation() { export function useGeolocation() {
...@@ -17,13 +20,13 @@ export function useGeolocation() { ...@@ -17,13 +20,13 @@ export function useGeolocation() {
plugins: ['AMap.Geolocation', 'AMap.Geocoder'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等 plugins: ['AMap.Geolocation', 'AMap.Geocoder'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
}) })
.then(async (AMap: any) => { .then(async (AMap: any) => {
//用户定位 // 用户定位
const geolocation = new AMap.Geolocation({ const geolocation = new AMap.Geolocation({
enableHighAccuracy: true, //是否使用高精度定位,默认:true enableHighAccuracy: true, // 是否使用高精度定位,默认:true
timeout: 10000, //超过10秒后停止定位,默认:5s timeout: 10000, // 超过10秒后停止定位,默认:5s
position: 'RB', //定位按钮的停靠位置 position: 'RB', // 定位按钮的停靠位置
offset: [10, 20], //定位按钮与设置的停靠位置的偏移量,默认:[10, 20] offset: [10, 20], // 定位按钮与设置的停靠位置的偏移量,默认:[10, 20]
zoomToAccuracy: true, //定位成功后是否自动调整地图视野到定位点 zoomToAccuracy: true, // 定位成功后是否自动调整地图视野到定位点
}); });
geolocation.getCurrentPosition(function (status: string, result: any) { geolocation.getCurrentPosition(function (status: string, result: any) {
if (status == 'complete') { if (status == 'complete') {
...@@ -32,7 +35,7 @@ export function useGeolocation() { ...@@ -32,7 +35,7 @@ export function useGeolocation() {
onError(result); onError(result);
} }
}); });
//解析定位结果 // 解析定位结果
async function onComplete(data: any) { async function onComplete(data: any) {
console.log('定位成功', data.position); console.log('定位成功', data.position);
setPosition({ setPosition({
...@@ -40,7 +43,7 @@ export function useGeolocation() { ...@@ -40,7 +43,7 @@ export function useGeolocation() {
address: null, address: null,
}); });
var geocoder = new AMap.Geocoder({ const geocoder = new AMap.Geocoder({
city: '全国', // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode city: '全国', // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
}); });
...@@ -74,7 +77,7 @@ export function useGeolocation() { ...@@ -74,7 +77,7 @@ export function useGeolocation() {
}, },
); );
} }
//解析定位错误信息 // 解析定位错误信息
async function onError(data: any) { async function onError(data: any) {
// message.error(`定位失败 // message.error(`定位失败
// 失败原因排查信息:${data.message} // 失败原因排查信息:${data.message}
......
import React, { createContext, Dispatch, SetStateAction, useEffect, useState } from 'react'; import React, { createContext, Dispatch, SetStateAction, useEffect, useState } from 'react';
import api, { UserInfoResp } from '~/api'; import api, { UserInfoResp } from '~/api';
export const UserContext = createContext<{ export const UserContext = createContext<{
...@@ -22,15 +23,13 @@ type Props = { ...@@ -22,15 +23,13 @@ type Props = {
}; };
const UserProvider = ({ children }: Props) => { const UserProvider = ({ children }: Props) => {
const [userInfo, setUserInfo] = useState<UserInfoResp | null | undefined>(null); const [userInfo, setUserInfo] = useState<UserInfoResp | null | undefined>(null);
const [needLogin, setNeedLogin] = useState<Boolean>(false); //用于通知登录modal需要打开 const [needLogin, setNeedLogin] = useState<Boolean>(false); // 用于通知登录modal需要打开
useEffect(() => { useEffect(() => {
try { setUserInfo(JSON.parse(window.localStorage.getItem('userInfo') || '') || undefined);
setUserInfo(JSON.parse(window.localStorage.getItem('userInfo') || '') || undefined); window.setUserInfo = setUserInfo;
window.setUserInfo = setUserInfo; window.setNeedLogin = setNeedLogin;
window.setNeedLogin = setNeedLogin; window.logout = logout;
window.logout = logout;
} catch (e) {}
}, []); }, []);
useEffect(() => { useEffect(() => {
...@@ -39,19 +38,19 @@ const UserProvider = ({ children }: Props) => { ...@@ -39,19 +38,19 @@ const UserProvider = ({ children }: Props) => {
} }
}, [userInfo]); }, [userInfo]);
//测试登录 // 测试登录
function testLogin() { function testLogin() {
api.testAppletLogin().then((res) => { api.testAppletLogin().then((res) => {
if (res.code == '200') { if (res && res.code === '200') {
window.localStorage.setItem('token', res.result?.token || ''); window.localStorage.setItem('token', res.result?.token || '');
api.userInfo().then((res) => { api.userInfo().then((userRes) => {
setUserInfo(res.result || undefined); setUserInfo(userRes.result || undefined);
}); });
} }
}); });
} }
//登出 // 登出
function logout() { function logout() {
localStorage.setItem('token', ''); localStorage.setItem('token', '');
setUserInfo(undefined); setUserInfo(undefined);
......
// @ts-nocheck
/* eslint-disable */
// 不能输入数字,其他可惜输入 // 不能输入数字,其他可惜输入
export const exceptNumber = (val: any) => { export const exceptNumber = (val: any) => {
val.target.value = val.target.value.replace(/1?(\d|([1-9]\d+))(.\d+)?$/g, '').replace(/\s/g, ''); val.target.value = val.target.value.replace(/1?(\d|([1-9]\d+))(.\d+)?$/g, '').replace(/\s/g, '');
......
...@@ -35,6 +35,7 @@ export interface Paging { ...@@ -35,6 +35,7 @@ export interface Paging {
TotalRecords: number; TotalRecords: number;
} }
// eslint-disable-next-line import/no-anonymous-default-export
export default { export default {
// 提交企业认证 // 提交企业认证
companyAuth(params: CompanyAuthParams): Promise<Response<string>> { companyAuth(params: CompanyAuthParams): Promise<Response<string>> {
......
...@@ -89,7 +89,7 @@ export default function Certification() { ...@@ -89,7 +89,7 @@ export default function Certification() {
}); });
} }
setTimeout(() => { setTimeout(() => {
if (Router.query.type == 'back') { if (Router.query.type === 'back') {
Router.back(); Router.back();
} else { } else {
Router.push('/'); Router.push('/');
......
...@@ -8,6 +8,7 @@ import { UserContext } from '~/lib/userProvider'; ...@@ -8,6 +8,7 @@ import { UserContext } from '~/lib/userProvider';
import api, { UserAddress, GetOrderForGoods } from './api'; import api, { UserAddress, GetOrderForGoods } from './api';
import { OrderForGoodsBox } from './styled'; import { OrderForGoodsBox } from './styled';
// eslint-disable-next-line import/no-cycle
import { ShopDetail } from '../../[id].page'; import { ShopDetail } from '../../[id].page';
import { GetWebDeviceDetailResult, GetWebDeviceWareSkuById, GetLeaseGoodsResult } from '../../api'; import { GetWebDeviceDetailResult, GetWebDeviceWareSkuById, GetLeaseGoodsResult } from '../../api';
...@@ -35,6 +36,7 @@ export default function OrderForGoods(props: PropsBox) { ...@@ -35,6 +36,7 @@ export default function OrderForGoods(props: PropsBox) {
const onChangeValue = (index: number) => { const onChangeValue = (index: number) => {
setValue(index); setValue(index);
}; };
// eslint-disable-next-line consistent-return
const detailSumbit = () => { const detailSumbit = () => {
if (!list?.length) return message.warning('暂无地址信息,请前往云享飞添加地址'); if (!list?.length) return message.warning('暂无地址信息,请前往云享飞添加地址');
if (value === -1) return message.warning('请选择地址'); if (value === -1) return message.warning('请选择地址');
......
/* eslint-disable */
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
import { LeftOutlined, RightOutlined } from '@ant-design/icons'; import { LeftOutlined, RightOutlined } from '@ant-design/icons';
...@@ -35,6 +36,7 @@ export default function PicturePreview(props: ImagesType) { ...@@ -35,6 +36,7 @@ export default function PicturePreview(props: ImagesType) {
const handleSlide = (direction: string) => { const handleSlide = (direction: string) => {
// 左侧按钮 // 左侧按钮
if (direction == 'left') { if (direction == 'left') {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
moveLeft == 0 ? setMoveLeft(0) : setMoveLeft((props) => props - 1); moveLeft == 0 ? setMoveLeft(0) : setMoveLeft((props) => props - 1);
} else { } else {
// 右侧按钮 // 右侧按钮
......
...@@ -107,6 +107,7 @@ export default function EquipmentLeasing(props: Props) { ...@@ -107,6 +107,7 @@ export default function EquipmentLeasing(props: Props) {
}); });
}, [abort]); }, [abort]);
// eslint-disable-next-line
const onFilterChange = (filterResult: FilterResult, adapterFilterResult: AdapterResult) => { const onFilterChange = (filterResult: FilterResult, adapterFilterResult: AdapterResult) => {
setPageParams({ setPageParams({
...pageParams, ...pageParams,
......
...@@ -52,6 +52,7 @@ export default function FlyingDetail() { ...@@ -52,6 +52,7 @@ export default function FlyingDetail() {
<Box> <Box>
<div className='box'> <div className='box'>
<div className='box-body'> <div className='box-body'>
{/* eslint-disable-next-line jsx-a11y/media-has-caption */}
<video className='body-video' controls src={detail?.videoUrl as string} /> <video className='body-video' controls src={detail?.videoUrl as string} />
</div> </div>
<div className='box-bottom'> <div className='box-bottom'>
......
...@@ -27,12 +27,12 @@ export default function BrushQuestionZone() { ...@@ -27,12 +27,12 @@ export default function BrushQuestionZone() {
setSkills(res.result || []); setSkills(res.result || []);
}); });
api.IndustryFlightSkills().then((res) => { api.IndustryFlightSkills().then((res) => {
const list = res.result?.map((item) => { const arr = res.result?.map((item) => ({
item.label = item.skillsName; label: item.skillsName,
item.value = item.id; value: item.id,
return item; }));
}); // @ts-ignore
setFlightSkillsList(list || []); setFlightSkillsList(arr || []);
}); });
}, []); }, []);
return ( return (
......
/* eslint-disable */
import { useContext, useEffect, useState } from 'react'; import { useContext, useEffect, useState } from 'react';
import { import {
......
...@@ -56,10 +56,12 @@ export interface ByDynamicResp { ...@@ -56,10 +56,12 @@ export interface ByDynamicResp {
}; };
mediaVO: { type: number; url: string }; mediaVO: { type: number; url: string };
} }
// eslint-disable-next-line @typescript-eslint/naming-convention
export interface dynamicDetail extends ByDynamicResp { export interface dynamicDetail extends ByDynamicResp {
commentAndReplyVO: ByDynamicResp[]; commentAndReplyVO: ByDynamicResp[];
} }
// eslint-disable-next-line import/no-anonymous-default-export
export default { export default {
/** /**
* 论坛动态列表 * 论坛动态列表
......
/* eslint-disable */
import { useContext, useState } from 'react'; import { useContext, useState } from 'react';
import { Form, Input, Modal, Image, Button, Row, Col } from 'antd'; import { Form, Input, Modal, Image, Button, Row, Col } from 'antd';
......
/* eslint-disable */
import { useContext, useEffect, useState } from 'react'; import { useContext, useEffect, useState } from 'react';
import { RightOutlined } from '@ant-design/icons'; import { RightOutlined } from '@ant-design/icons';
......
/* eslint-disable */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
......
/* eslint-disable */
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { message } from 'antd'; import { message } from 'antd';
......
/* eslint-disable */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Select, Space } from 'antd'; import { Select, Space } from 'antd';
......
...@@ -109,9 +109,10 @@ export default function JobServicesDetail() { ...@@ -109,9 +109,10 @@ export default function JobServicesDetail() {
formDate formDate
.validateFields() .validateFields()
.then(async (values) => { .then(async (values) => {
console.log(values); // console.log(values);
if (!addressContent) { if (!addressContent) {
return message.warning('请选择地点'); message.warning('请选择地点');
return;
} }
const res = await api.insertOrderTask({ const res = await api.insertOrderTask({
address: addressContent.addressDteail, address: addressContent.addressDteail,
......
/* eslint-disable */
import React from 'react'; import React from 'react';
import { Rate } from 'antd'; import { Rate } from 'antd';
......
/* eslint-disable */
import React, { Dispatch, SetStateAction, useEffect, useState } from 'react'; import React, { Dispatch, SetStateAction, useEffect, useState } from 'react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
......
...@@ -114,6 +114,7 @@ export default function JobServices() { ...@@ -114,6 +114,7 @@ export default function JobServices() {
}); });
}, [abort]); }, [abort]);
// eslint-disable-next-line
const onFilterChange = (filterResult: FilterResult, adapterFilterResult: AdapterResult) => { const onFilterChange = (filterResult: FilterResult, adapterFilterResult: AdapterResult) => {
setPageParams({ setPageParams({
...pageParams, ...pageParams,
......
/* eslint-disable */
import styles from './index.module.scss'; import styles from './index.module.scss';
import { useContext, useEffect, useState } from 'react'; import { useContext, useEffect, useState } from 'react';
...@@ -13,6 +14,7 @@ import { Swiper, SwiperSlide } from 'swiper/react'; ...@@ -13,6 +14,7 @@ import { Swiper, SwiperSlide } from 'swiper/react';
import errImg from '~/assets/errImg'; import errImg from '~/assets/errImg';
import Layout from '~/components/layout'; import Layout from '~/components/layout';
// eslint-disable-next-line import/order
import OrderForGoods from './components/orderForGoods'; import OrderForGoods from './components/orderForGoods';
// Import Swiper styles // Import Swiper styles
......
/* eslint-disable */
import { Dispatch, SetStateAction, useEffect, useState } from 'react'; import { Dispatch, SetStateAction, useEffect, useState } from 'react';
import { Button, Col, Image, message, Modal, Row, Space, InputNumber } from 'antd'; import { Button, Col, Image, message, Modal, Row, Space, InputNumber } from 'antd';
......
/* eslint-disable */
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import type { RadioChangeEvent } from 'antd'; import type { RadioChangeEvent } from 'antd';
......
...@@ -71,7 +71,7 @@ export default function Mall(props: Props) { ...@@ -71,7 +71,7 @@ export default function Mall(props: Props) {
setAdList(res.result || []); setAdList(res.result || []);
}); });
}, []); }, []);
// eslint-disable-next-line
const onFilterChange = (filterResult: FilterResult, adapterFilterResult: AdapterResult) => { const onFilterChange = (filterResult: FilterResult, adapterFilterResult: AdapterResult) => {
setPageParams({ setPageParams({
...pageParams, ...pageParams,
...@@ -99,6 +99,7 @@ export default function Mall(props: Props) { ...@@ -99,6 +99,7 @@ export default function Mall(props: Props) {
<ul className={styles.listWrap}> <ul className={styles.listWrap}>
{productList.map((item, i) => { {productList.map((item, i) => {
return ( return (
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
<li <li
key={i} key={i}
className={styles.item} className={styles.item}
......
...@@ -53,10 +53,12 @@ export default function PayModal(props: Props) { ...@@ -53,10 +53,12 @@ export default function PayModal(props: Props) {
if (res.code == '200') { if (res.code == '200') {
message.success('付款成功'); message.success('付款成功');
setTimeout(() => { setTimeout(() => {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
props.onCancel && props.onCancel(); props.onCancel && props.onCancel();
setLoading(false); setLoading(false);
}, 1000); }, 1000);
} else { } else {
// eslint-disable-next-line
res.message && message.error(res.message); res.message && message.error(res.message);
setLoading(false); setLoading(false);
} }
......
...@@ -53,10 +53,12 @@ export default function RefundModal(props: Props) { ...@@ -53,10 +53,12 @@ export default function RefundModal(props: Props) {
if (res.code == '200') { if (res.code == '200') {
message.success('付款成功'); message.success('付款成功');
setTimeout(() => { setTimeout(() => {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
props.onCancel && props.onCancel(); props.onCancel && props.onCancel();
setLoading(false); setLoading(false);
}, 1000); }, 1000);
} else { } else {
// eslint-disable-next-line
res.message && message.error(res.message); res.message && message.error(res.message);
setLoading(false); setLoading(false);
} }
......
...@@ -2,7 +2,6 @@ import { useEffect, useState } from 'react'; ...@@ -2,7 +2,6 @@ import { useEffect, useState } from 'react';
import { TabsProps, Tabs, Row, Col, Image, Space, Button, Pagination, Empty, Spin } from 'antd'; import { TabsProps, Tabs, Row, Col, Image, Space, Button, Pagination, Empty, Spin } from 'antd';
import moment from 'moment'; import moment from 'moment';
import Moment from 'moment';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import errImg from '~/assets/errImg'; import errImg from '~/assets/errImg';
...@@ -118,7 +117,9 @@ export default function LeasingOrders() { ...@@ -118,7 +117,9 @@ export default function LeasingOrders() {
}; };
// 交易状态对应的按钮渲染 // 交易状态对应的按钮渲染
// eslint-disable-next-line consistent-return
const statusBtn = function (item: LeasingList) { const statusBtn = function (item: LeasingList) {
// eslint-disable-next-line default-case
switch (item.tranStatus) { switch (item.tranStatus) {
case '100': case '100':
return ( return (
...@@ -172,10 +173,13 @@ export default function LeasingOrders() { ...@@ -172,10 +173,13 @@ export default function LeasingOrders() {
); );
case '500': case '500':
<Button type='link' style={{ marginTop: 10 }}> return (
查看物流 <Button type='link' style={{ marginTop: 10 }}>
</Button>; 查看物流
</Button>
);
// eslint-disable-next-line no-fallthrough
case '600': case '600':
return <Button className={styles.btn1}>再来一单</Button>; return <Button className={styles.btn1}>再来一单</Button>;
} }
...@@ -217,8 +221,8 @@ export default function LeasingOrders() { ...@@ -217,8 +221,8 @@ export default function LeasingOrders() {
<div className={styles.font2}> <div className={styles.font2}>
<Space size={10}> <Space size={10}>
<div> <div>
{Moment(item.startDate).format('YYYY-MM-DD')}{' '} {moment(item.startDate).format('YYYY-MM-DD')}{' '}
{Moment(item.endDate).format('YYYY-MM-DD')} {moment(item.endDate).format('YYYY-MM-DD')}
</div> </div>
<div>订单编号: {item.orderNo}</div> <div>订单编号: {item.orderNo}</div>
</Space>{' '} </Space>{' '}
......
...@@ -69,8 +69,7 @@ export default function News(props: Props) { ...@@ -69,8 +69,7 @@ export default function News(props: Props) {
// 获取产品信息事件 // 获取产品信息事件
const onGetInfo = () => { const onGetInfo = () => {
if (userInfo) { if (userInfo) {
if (userInfo.companyAuthStatus) { if (!userInfo.companyAuthStatus) {
} else {
Router.push('/certification?type=back'); Router.push('/certification?type=back');
} }
} else { } else {
......
...@@ -24,6 +24,7 @@ export default function ProjectInfo() { ...@@ -24,6 +24,7 @@ export default function ProjectInfo() {
[/* "项目需求", */ '招标快讯', '业务案例', '行业新闻'].map((value) => { [/* "项目需求", */ '招标快讯', '业务案例', '行业新闻'].map((value) => {
let children: JSX.Element | string = <></>; let children: JSX.Element | string = <></>;
// eslint-disable-next-line default-case
switch (value) { switch (value) {
case '项目需求': case '项目需求':
children = <Requirements params={params}></Requirements>; children = <Requirements params={params}></Requirements>;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论