提交 b798db35 作者: ZhangLingKun

Merge remote-tracking branch 'origin/develop'

...@@ -31,6 +31,14 @@ jobs: ...@@ -31,6 +31,14 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: WeChat Work notification by text
uses: chf007/action-wechat-work@master
env:
WECHAT_WORK_BOT_WEBHOOK: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=9be1b073-1760-442d-8e3d-faa0fd32ea16
with:
msgtype: text
content: "GitHub提交信息\n - 提交人: ${{github.actor}}\n - 提交信息: ${{ github.event.head_commit.message }}\n - 提交到仓库: ${{github.repository}}\n - 提交到分支: ${{github.ref}}\n 即将开始更新,请关注Argocd同步状态..."
- name: Login to ACR EE with the AccessKey pair - name: Login to ACR EE with the AccessKey pair
uses: aliyun/acr-login@v1 uses: aliyun/acr-login@v1
with: with:
......
const dev = { const dev = {
baseUrl: "/local", baseUrl: '/local',
}; };
const prod = { const prod = {
baseUrl: "", baseUrl: '',
}; };
export default process.env.NODE_ENV === "development" ? dev : prod; export default process.env.NODE_ENV === 'development' ? dev : prod;
...@@ -79,6 +79,10 @@ export default { ...@@ -79,6 +79,10 @@ export default {
imgOss: () => { imgOss: () => {
return config.baseUrl + '/pms/upload/imgOss'; return config.baseUrl + '/pms/upload/imgOss';
}, },
//文件上传地址
fileUpload: () => {
return config.baseUrl + '/pms/upload/breakpoint';
},
//宣传中心 //宣传中心
listBannerImg: ( listBannerImg: (
moduleCode: string, moduleCode: string,
......
import config from './config'; import config from './config';
let loginTimeout: NodeJS.Timeout | undefined; let loginTimeout: NodeJS.Timeout | undefined;
...@@ -10,7 +9,12 @@ let loginTimeout: NodeJS.Timeout | undefined; ...@@ -10,7 +9,12 @@ let loginTimeout: NodeJS.Timeout | undefined;
* @param options 额外参数 * @param options 额外参数
* @returns Promise<Response> * @returns Promise<Response>
*/ */
export default function request(url: string, method: String = 'get', data?: any, options: any & { hideError?: boolean, headers?: { token?: string } } = {}): Promise<Response<any>> { export default function request(
url: string,
method: String = 'get',
data?: any,
options: any & { hideError?: boolean; headers?: { token?: string } } = {},
): Promise<Response<any>> {
let token = localStorage.getItem('token') || ''; let token = localStorage.getItem('token') || '';
switch (method.toLowerCase()) { switch (method.toLowerCase()) {
...@@ -19,7 +23,7 @@ export default function request(url: string, method: String = 'get', data?: any, ...@@ -19,7 +23,7 @@ export default function request(url: string, method: String = 'get', data?: any,
if (data) { if (data) {
Object.keys(data).forEach((key) => { Object.keys(data).forEach((key) => {
params.append(key, data[key]); params.append(key, data[key]);
}) });
url += '?' + params; url += '?' + params;
} }
...@@ -33,16 +37,16 @@ export default function request(url: string, method: String = 'get', data?: any, ...@@ -33,16 +37,16 @@ export default function request(url: string, method: String = 'get', data?: any,
}, },
body: JSON.stringify(data), body: JSON.stringify(data),
...options, ...options,
} };
break; break;
} }
if(options.headers){ if (options.headers) {
options.headers.token = token; options.headers.token = token;
}else{ } else {
options.headers = { options.headers = {
token token,
} };
} }
/** /**
...@@ -59,63 +63,63 @@ export default function request(url: string, method: String = 'get', data?: any, ...@@ -59,63 +63,63 @@ export default function request(url: string, method: String = 'get', data?: any,
* 未登录消息展示,1.5秒内限制只展示一次 * 未登录消息展示,1.5秒内限制只展示一次
* @returns * @returns
*/ */
function loginErrorMsg(){ function loginErrorMsg() {
console.log('loginTimeout', loginTimeout) console.log('loginTimeout', loginTimeout);
if(loginTimeout){ if (loginTimeout) {
return; return;
} }
loginTimeout = setTimeout(() => { loginTimeout = setTimeout(() => {
errMsg('请先登录'); errMsg('请先登录');
loginTimeout = undefined; loginTimeout = undefined;
}, 1500) }, 1500);
} }
return fetch(config.baseUrl + url, options) return fetch(config.baseUrl + url, options)
.then((r) => { .then((r) => {
try { try {
return r.json() return r.json();
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
return { return {
code: '-1', code: '-1',
message: '请求失败', message: '请求失败',
result: null result: null,
} };
}) })
.then((data) => { .then((data) => {
if (data.errors) { if (data.errors) {
//全局消息提示 //全局消息提示
errMsg('请求出错') errMsg('请求出错');
if (Array.isArray(data.errors)) { if (Array.isArray(data.errors)) {
data.errors.forEach((item: any) => { data.errors.forEach((item: any) => {
if (item.defaultMessage) { if (item.defaultMessage) {
errMsg(item.defaultMessage) errMsg(item.defaultMessage);
} }
}) });
} }
return { return {
code: '-1', code: '-1',
message: '请求失败', message: '请求失败',
result: null result: null,
} };
} }
if (data.code !== '200') { if (data.code !== '200') {
//未登录判断 //未登录判断
if(data.code === '5008' || data.code === '2014'){ if (data.code === '5008' || data.code === '2014') {
loginErrorMsg(); loginErrorMsg();
window.logout(); window.logout();
}else{ } else {
errMsg(data.message || '请求出错'); errMsg(data.message || '请求出错');
} }
} }
return data; return data;
}) })
.catch(error => { .catch((error) => {
if (error.name === 'AbortError') { if (error.name === 'AbortError') {
console.log('请求已中断'); console.log('请求已中断');
console.log(error); console.log(error);
...@@ -125,14 +129,14 @@ export default function request(url: string, method: String = 'get', data?: any, ...@@ -125,14 +129,14 @@ export default function request(url: string, method: String = 'get', data?: any,
return { return {
code: '-1', code: '-1',
message: '请求失败', message: '请求失败',
result: null result: null,
} };
}); });
} }
//准备响应结构 //准备响应结构
export interface Response<T> { export interface Response<T> {
code: string, code: string;
message: string, message: string;
result?: T | null result?: T | null;
} }
...@@ -14,8 +14,8 @@ const items: TabsProps['items'] = [ ...@@ -14,8 +14,8 @@ const items: TabsProps['items'] = [
label: ` 首页 `, label: ` 首页 `,
}, },
{ {
key: '/jobServices', key: '/mall',
label: `作业服务`, label: `产品商城`,
}, },
{ {
key: '/equipmentLeasing', key: '/equipmentLeasing',
...@@ -26,8 +26,8 @@ const items: TabsProps['items'] = [ ...@@ -26,8 +26,8 @@ const items: TabsProps['items'] = [
label: `飞手培训`, label: `飞手培训`,
}, },
{ {
key: '/mall', key: '/jobServices',
label: `产品商城`, label: `作业服务`,
}, },
{ {
key: '/projectInfo', key: '/projectInfo',
......
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 styles from './index.module.scss';
import img from './assets/img.png';
import { useContext, useEffect, useState } from 'react'; import { useContext, useEffect, useState } from 'react';
import api, { ListTagResp } from './api'; import api, { ListTagResp } from './api';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { UserContext } from '~/lib/userProvider'; import { UserContext } from '~/lib/userProvider';
import commonApi from '~/api';
const imgs = [ const imgs = [
require('./assets/生产制造商.png'), require('./assets/生产制造商.png'),
...@@ -27,7 +27,7 @@ type Props = { ...@@ -27,7 +27,7 @@ type Props = {
export default function JoinModal(props: Props) { export default function JoinModal(props: Props) {
const router = useRouter(); const router = useRouter();
const [tagList, setTagList] = useState<ListTagResp[]>([]); const [tagList, setTagList] = useState<ListTagResp[]>([]);
const { userInfo } = useContext(UserContext); const { userInfo, setUserInfo } = useContext(UserContext);
useEffect(() => { useEffect(() => {
api.listTag().then((res) => { api.listTag().then((res) => {
...@@ -36,12 +36,15 @@ export default function JoinModal(props: Props) { ...@@ -36,12 +36,15 @@ export default function JoinModal(props: Props) {
}, []); }, []);
const onClickTag = (item: ListTagResp) => { const onClickTag = (item: ListTagResp) => {
if (userInfo!.companyAuthStatus) { commonApi.userInfo().then((res) => {
router.replace('/JoinPolicy?tagId=' + item.id); setUserInfo(res.result);
if (res.result!.companyAuthStatus) {
router.replace({ pathname: '/JoinPolicy', query: { tagId: item.id } });
props.onCancel && props.onCancel(); props.onCancel && props.onCancel();
} else { } else {
router.push('/certification'); router.push('/certification');
} }
});
}; };
return ( return (
<Modal <Modal
......
...@@ -106,7 +106,12 @@ export default function PublishModal(props: Props) { ...@@ -106,7 +106,12 @@ export default function PublishModal(props: Props) {
name='requireDescription' name='requireDescription'
rules={[{ required: true, message: '请输入需求描述!' }]} rules={[{ required: true, message: '请输入需求描述!' }]}
> >
<Input.TextArea placeholder='项目需求描述' style={{ height: 162 }}></Input.TextArea> <Input.TextArea
placeholder='项目需求描述'
style={{ height: 162 }}
maxLength={256}
showCount
></Input.TextArea>
</Form.Item> </Form.Item>
<Form.Item> <Form.Item>
<Button <Button
......
import React, { Suspense } from 'react'; import React from 'react';
import { Layout, Space } from 'antd'; import { Layout, Space } from 'antd';
import NavHeader from '~/components/NavHeader'; import NavHeader from '~/components/NavHeader';
import FooterView from '~/components/footer'; import FooterView from '~/components/footer';
......
import { headers } from 'next/dist/client/components/headers';
import request, { Response } from '~/api/request';
export default {
uploadFile: (data: FormData): Promise<Response<string>> =>
request('/pms/upload/breakpoint', 'post', data, { headers: {}, body: data }),
};
.uploader-view{
.ant-upload-wrapper .ant-upload-list .ant-upload-list-item-container{
//width: 200px !important;
}
}
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
import { message, Upload, UploadProps } from 'antd'; import { message, Upload, UploadProps } from 'antd';
// import { UploadFile } from "antd/es/upload/interface"; import uploadApi from './api';
import './index.scss';
interface PropsType { interface PropsType {
listType?: 'text' | 'picture' | 'picture-card'; // 上传列表的内建样式 listType?: 'text' | 'picture' | 'picture-card'; // 上传列表的内建样式
fileSize?: number; // 文件大小 fileSize?: number; // 文件大小
fileType?: string[]; // 上传文件类型 fileType?: string[]; // 上传文件类型
fileUpload: boolean; // 是否上传到服务器(返回文件流还是返回上传后的地址)
fileLength?: number; // 最大上传文件数量 fileLength?: number; // 最大上传文件数量
children: React.ReactNode; // 上传按钮 children: React.ReactNode; // 上传按钮
onChange?: (fileList: any[]) => void; // 上传文件改变时的状态 onChange?: (
onRemove?: (fileList: any[]) => void; fileList: {
id: number;
name: string;
uid: number;
url: string;
}[],
) => void; // 上传文件改变时的状态
defaultFileList?: any[]; // 默认文件列表
} }
export const Uploader: React.FC<PropsType> = (props) => { export const Uploader: React.FC<PropsType> = (props) => {
Uploader.defaultProps = { Uploader.defaultProps = {
listType: 'text', listType: 'picture-card',
fileSize: 2, fileSize: 2,
fileLength: 1, fileLength: 1,
fileType: ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/bmp'], fileType: ['image/png', 'image/jpeg', 'image/jpg', 'image/gif'],
onChange: () => {}, onChange: () => {},
onRemove: () => {}, defaultFileList: [],
}; };
const { fileType, children, listType, fileSize, fileLength, onChange, onRemove } = props; const {
fileType = ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/bmp'],
children,
listType,
fileSize,
fileUpload,
fileLength,
onChange,
defaultFileList,
} = props;
const [fileList, setFileList] = useState<any[]>([]); const [fileList, setFileList] = useState<any[]>([]);
// 上传文件配置 // 上传文件配置
const uploadProps: UploadProps = { const uploadProps: UploadProps = {
...@@ -30,34 +46,84 @@ export const Uploader: React.FC<PropsType> = (props) => { ...@@ -30,34 +46,84 @@ export const Uploader: React.FC<PropsType> = (props) => {
beforeUpload: (res) => { beforeUpload: (res) => {
const isType = fileType?.includes(res.type); const isType = fileType?.includes(res.type);
const isSize = res.size / 1024 / 1024 < (fileSize || 2); const isSize = res.size / 1024 / 1024 < (fileSize || 2);
const isLength = fileList.length < (fileLength || 1);
if (!isType) { if (!isType) {
message.error('请上传正确的格式!').then(); message.error('上传文件格式错误!').then();
return isType;
} }
if (!isSize) { if (!isSize) {
message.error('文件最大2M,请压缩后上传!').then(); message.error(`文件最大${props.fileSize}M,请压缩后上传!`).then();
return isSize; }
if (!isLength) {
message.error(`最多上传${fileLength || 1}个文件`).then();
} }
return isType && isSize && isLength;
}, },
customRequest: (res) => { customRequest: (res) => {
if (fileList.length >= (fileLength || 1)) { if (fileUpload) {
message.error(`最多上传${fileLength || 1}个文件`).then(); setFileList([
return; ...fileList,
{
id: new Date().getTime(),
uid: new Date().getTime(),
name: (res.file as any).name,
type: (res.file as any).type,
url: (res.file as any).url,
status: 'uploading',
},
]);
// 上传到服务器
const formData = new FormData();
formData.append('uploadFile', res.file);
uploadApi.uploadFile(formData).then(({ result, code }) => {
if (code === '200') {
setFileList([
...fileList,
{
id: new Date().getTime(),
uid: new Date().getTime(),
name: (res.file as any).name || '',
url: result,
type: (res.file as any).type,
status: 'done',
},
]);
onChange?.([
...fileList,
{
id: new Date().getTime(),
uid: new Date().getTime(),
name: (res.file as any).name || '',
url: result,
type: (res.file as any).type,
status: 'done',
},
]);
} }
});
} else {
setFileList([...fileList, res.file]); setFileList([...fileList, res.file]);
onChange?.([...fileList, res.file]); onChange?.([...fileList, res.file]);
}
}, },
onRemove: (res) => { onRemove: (res) => {
const newFileList = fileList.filter((item) => item.uid !== res.uid); const newFileList = fileList.filter((item) => item.uid !== res.uid);
setFileList(newFileList); setFileList(newFileList);
onRemove?.(newFileList); onChange?.(newFileList);
}, },
// onPreview: { onPreview }, // onPreview: { onPreview },
}; };
useEffect(() => {
// 如果有默认文件列表
if (defaultFileList?.length) {
setFileList(defaultFileList);
} else {
setFileList([]);
}
}, [defaultFileList]);
return ( return (
<div className='uploader-view'> <div className='uploader-view'>
<Upload {...uploadProps} style={{ width: '100%' }}> <Upload {...uploadProps} style={{ width: '100%' }}>
<>{fileList.length < (fileLength || 1) && children}</> {children}
</Upload> </Upload>
</div> </div>
); );
......
...@@ -4,7 +4,7 @@ metadata: ...@@ -4,7 +4,7 @@ metadata:
name: web-deployment name: web-deployment
namespace: default namespace: default
spec: spec:
# minReadySeconds: 250 minReadySeconds: 10
revisionHistoryLimit: 2 revisionHistoryLimit: 2
replicas: 1 replicas: 1
selector: selector:
...@@ -24,6 +24,7 @@ spec: ...@@ -24,6 +24,7 @@ spec:
cpu: 100m cpu: 100m
ports: ports:
- containerPort: 3000 - containerPort: 3000
name: web-port
env: env:
- name: NODE_ENV - name: NODE_ENV
valueFrom: valueFrom:
......
...@@ -3,9 +3,9 @@ kind: Deployment ...@@ -3,9 +3,9 @@ kind: Deployment
metadata: metadata:
name: web-deployment name: web-deployment
spec: spec:
replicas: 2 replicas: 1
strategy: strategy:
type: RollingUpdate type: RollingUpdate
rollingUpdate: rollingUpdate:
maxSurge: 1 maxSurge: 1
maxUnavailable: 1 maxUnavailable: 0
\ No newline at end of file
...@@ -18,4 +18,4 @@ patches: ...@@ -18,4 +18,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/web newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/web
newTag: 6a106c3db8bec076ee249d2f97e575522949a1b1 newTag: 89ba34b307547ad0928c625c100f535432479e78
...@@ -27,7 +27,6 @@ const UserProvider = ({ children }: Props) => { ...@@ -27,7 +27,6 @@ const UserProvider = ({ children }: Props) => {
useEffect(() => { useEffect(() => {
try { 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;
......
...@@ -27,8 +27,8 @@ const nextConfig = { ...@@ -27,8 +27,8 @@ const nextConfig = {
return [ return [
{ {
source: '/local/:path*', source: '/local/:path*',
destination: 'https://www.iuav.shop/:path*', // destination: 'https://www.iuav.shop/:path*',
// destination: 'https://test.iuav.shop/:path*', destination: 'https://test.iuav.shop/:path*',
}, },
]; ];
}, },
......
...@@ -4,8 +4,8 @@ export interface CooperationApplyParams { ...@@ -4,8 +4,8 @@ export interface CooperationApplyParams {
applyName: string; applyName: string;
applyPhone: string; applyPhone: string;
remark?: string; remark?: string;
userAccountId: number;
cooperationTagId: number; cooperationTagId: number;
attachmentList?: { type: number; url: string }[];
} }
export interface GetTagIdResp { export interface GetTagIdResp {
...@@ -14,6 +14,7 @@ export interface GetTagIdResp { ...@@ -14,6 +14,7 @@ export interface GetTagIdResp {
tagImg: string; tagImg: string;
tagDescription: string; tagDescription: string;
createTime: string; createTime: string;
tagRequire: string;
} }
export default { export default {
......
.banner { .headerLine{
width: 100vw; height: 8px;
height: 200px; background: linear-gradient(90deg, #F5B351 0%, #FF552D 100%);
background: #f25834;
position: absolute;
left: 50%;
top: 0;
transform: translate(-50%, 0);
} }
.font1 { .font1 {
font-size: 20px; font-size: 20px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold; font-weight: bold;
color: #000000; color: #000000;
line-height: 25px; line-height: 25px;
} }
.font2 { .font2 {
font-size: 18px; font-size: 14px;
font-family: MicrosoftYaHei; color: #1A1B1C;
color: #333333; line-height: 19px;
line-height: 32px;
letter-spacing: 1px; letter-spacing: 1px;
} }
.infoContent{
padding: 29px 0 0 50px;
box-sizing: border-box;
.tip{
.tipTitle{
font-size: 14px;
font-weight: bold;
color: #000000;
line-height: 18px;
margin-bottom: 17px;
}
}
.formWrap{
margin-top: 35px;
.formTitle{
font-size: 14px;
font-weight: bold;
color: #000000;
line-height: 18px;
margin-bottom: 17px;
}
}
.uploadTip{
font-size: 12px;
color: #858687;
line-height: 18px;
margin-bottom: 12px;
}
.uploadOperate{
}
}
.submitOperate{
text-align: center;
margin-top: 69px;
button{
width: 200px;
height: 40px;
border-radius: 6px;
background: linear-gradient(90deg, #FF552D 0%, #FF812D 100%);
font-size: 16px;
color: #FEFFFE;
}
}
...@@ -4,107 +4,149 @@ import { useEffect, useState } from 'react'; ...@@ -4,107 +4,149 @@ import { useEffect, useState } from 'react';
import LayoutView from '~/components/layout'; import LayoutView from '~/components/layout';
import api from './api'; import api from './api';
import styles from './index.module.scss'; import styles from './index.module.scss';
import { phoneNumber } from '~/lib/validateUtils'; import { Uploader } from '~/components/uploader';
import JoinModal from '~/components/NavHeader/joinModal';
export default function JoinPolicy() { export default function JoinPolicy() {
const [form] = Form.useForm();
const router = useRouter(); const router = useRouter();
const [content, setContent] = useState(''); //福利内容 const [content, setContent] = useState(''); //福利内容
const tagId = Number(router.query.tagId); const [tagId, setTagId] = useState<number>(-1);
useEffect(() => { useEffect(() => {
if (tagId) { if (router.query.tagId) {
setTagId(Number(router.query.tagId));
api api
.getTagById({ .getTagById({
id: tagId, id: Number(router.query.tagId),
}) })
.then((res) => { .then((res) => {
setContent(res.result?.tagDescription.replaceAll('\n', '<br/>') || ''); setContent(res.result?.tagRequire.replaceAll('\n', '<br/>') || '');
}); });
} }
}, []); }, [router.query.tagId]);
//提交 //提交
const onFinish = (values: any) => { const submitApply = () => {
console.log(values); form.validateFields().then((valid) => {
api api
.cooperationApply({ .cooperationApply({
...values, ...valid,
cooperationTagId: tagId, cooperationTagId: tagId,
}) })
.then((res) => { .then((res) => {
console.log('提交结果', res);
if (res.code === '200') { if (res.code === '200') {
window.messageApi.success('提交成功'); window.messageApi.success('提交成功');
form.resetFields();
setTimeout(() => { setTimeout(() => {
router.push('/'); router.push('/');
}, 1500); }, 1500);
} }
}); });
});
};
//上传变更
const uploadChange = (value: any) => {
let attachmentList = value.map((v: any) => ({
type: v.type.includes('image') ? 0 : 1,
url: v.url,
}));
form.setFieldValue('attachmentList', attachmentList);
}; };
return ( return (
<LayoutView> <LayoutView>
<div className={styles.banner}></div>
<div <div
className='page' className='page'
style={{ style={{
background: '#fff', background: '#fff',
position: 'relative', position: 'relative',
zIndex: 1, zIndex: 1,
marginTop: 60, marginTop: 20,
paddingBottom: 63, paddingBottom: 63,
}} }}
> >
<div <div className={styles.headerLine}></div>
className={styles.font1} <div className={styles.font1} style={{ textAlign: 'center', marginTop: '22px' }}>
style={{ textAlign: 'center', paddingTop: 40, paddingBottom: 30 }} 加盟入驻
>
加盟入驻福利
</div> </div>
<div
className={styles.font2}
style={{ paddingLeft: 50, paddingRight: 50 }}
dangerouslySetInnerHTML={{ __html: content }}
></div>
<Divider /> <Divider />
<div className={styles.font1} style={{ textAlign: 'center', marginBottom: 28 }}> <div className={styles.infoContent}>
申请加盟入驻 <div className={styles.tip}>
<div className={styles.tipTitle}>需准备上传资料</div>
<div className={styles.font2} dangerouslySetInnerHTML={{ __html: content }}></div>
</div> </div>
<Row justify={'center'}> <div className={styles.formWrap}>
<Col style={{ width: 400 }}> <div className={styles.formTitle}>填写资料</div>
<Form labelAlign='left' labelCol={{ span: 5 }} onFinish={onFinish}> <div className={styles.form}>
<Form.Item label='姓名' name='applyName' rules={[{ required: true }]}> <Form labelCol={{ span: 2 }} wrapperCol={{ span: 10 }} labelAlign='left' form={form}>
<Input placeholder='请输入姓名'></Input> <Form.Item
label='联系人'
name='applyName'
rules={[{ required: true, message: '请输入联系人' }]}
>
<Input placeholder='请输入联系人' maxLength={30} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label='联系方式' label='联系方式'
name='applyPhone' name='applyPhone'
rules={[ rules={[
{ required: true }, { required: true, message: '请输入联系方式' },
{ { pattern: /^1\d{10}$/, message: '请输入正确的手机号码' },
pattern: /^1\d{10}$/,
message: '很输入11位手机号',
},
]} ]}
> >
<Input placeholder='请输入手机号' maxLength={11} onInput={phoneNumber}></Input> <Input placeholder='请输入联系方式' />
</Form.Item> </Form.Item>
<Form.Item name='remark'> <Row>
<Input.TextArea placeholder='其它信息'></Input.TextArea> <Col span={2}>
</Form.Item> <div>上传资料:</div>
<Row justify={'center'}> </Col>
<Button <Col span={10}>
type='primary' <div className={styles.uploadTip}>
htmlType='submit' <div>1. 图片格式为JPG、JPEG、BMP、GIF、PNG</div>
style={{ marginTop: 11, width: 200 }} <div>2. 文档格式为word、PDF、excel</div>
size='large' <div> 3. 文件大小不超过10M</div>
</div>
<div className={styles.uploadOperate}>
<Form.Item name='attachmentList'>
<Uploader
fileUpload
listType='text'
fileLength={10}
fileSize={10}
onChange={uploadChange}
fileType={[
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.ms-excel',
'application/pdf',
'application/msword',
'image/png',
'image/jpeg',
'image/jpg',
'image/gif',
'image/bmp',
]}
> >
提交申请 <Button>上传文件</Button>
</Button> </Uploader>
</Row> </Form.Item>
</Form> </div>
</Col> </Col>
</Row> </Row>
<Form.Item label='备注(选填)' name='remark'>
<Input placeholder='请输入备注' maxLength={60} />
</Form.Item>
</Form>
</div>
</div>
</div>
<div className={styles.submitOperate}>
<Button type='primary' onClick={submitApply}>
提交申请
</Button>
</div>
</div> </div>
</LayoutView> </LayoutView>
); );
} }
JoinPolicy.getInitialProps = async () => {
return {};
};
...@@ -214,7 +214,7 @@ export default function EquipmentLeasingDetail() { ...@@ -214,7 +214,7 @@ export default function EquipmentLeasingDetail() {
<span className='menoy-right'>/天起</span> <span className='menoy-right'>/天起</span>
</div> </div>
) : ( ) : (
<div className='menoy'>暂无报价</div> <div className='menoy'>获取报价</div>
)} )}
<div className='classification'> <div className='classification'>
......
...@@ -19,7 +19,7 @@ interface PropsBox { ...@@ -19,7 +19,7 @@ interface PropsBox {
export default function OrderForGoods(props: PropsBox) { export default function OrderForGoods(props: PropsBox) {
const { setIsorderForGoods, shopDetail, days, detailData, wareSkuList, discount } = props; const { setIsorderForGoods, shopDetail, days, detailData, wareSkuList, discount } = props;
const [value, setValue] = useState(1); const [value, setValue] = useState(-1);
const [areaValue, setAreaValue] = useState<string>(); const [areaValue, setAreaValue] = useState<string>();
const [list, setList] = useState<Array<UserAddress> | null>(); const [list, setList] = useState<Array<UserAddress> | null>();
const [detail, setDetail] = useState<ShopDetail>(); const [detail, setDetail] = useState<ShopDetail>();
...@@ -33,9 +33,7 @@ export default function OrderForGoods(props: PropsBox) { ...@@ -33,9 +33,7 @@ export default function OrderForGoods(props: PropsBox) {
}; };
const detailSumbit = () => { const detailSumbit = () => {
if (!list?.length) return message.warning('暂无地址信息,请前往云享飞添加地址'); if (!list?.length) return message.warning('暂无地址信息,请前往云享飞添加地址');
console.log(value !== 0); if (value === -1) return message.warning('请选择地址');
if (list?.length && !value && value !== 0) return message.warning('请选择地址');
if (detailData && shopDetail && list?.length && wareSkuList) { if (detailData && shopDetail && list?.length && wareSkuList) {
const pushList = { const pushList = {
actualPay: discount?.specPrice[0]?.price! * shopDetail?.num! * days! || 0, actualPay: discount?.specPrice[0]?.price! * shopDetail?.num! * days! || 0,
...@@ -83,11 +81,8 @@ export default function OrderForGoods(props: PropsBox) { ...@@ -83,11 +81,8 @@ export default function OrderForGoods(props: PropsBox) {
.then((res) => { .then((res) => {
console.log(res); console.log(res);
setList(res.result); setList(res.result);
res.result?.map((item, index) => { let index: number = res.result?.findIndex((item) => item.type === 0) as number;
if (item.type === 0) {
setValue(index); setValue(index);
}
});
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
......
import { Pagination } from 'antd'; import { Pagination, Image as AntdImage } from 'antd';
import Image from 'next/image'; import Image from 'next/image';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useContext, useEffect, useRef, useState } from 'react'; import { useContext, useEffect, useRef, useState } from 'react';
...@@ -47,7 +47,7 @@ export default function EquipmentLeasing(props: Props) { ...@@ -47,7 +47,7 @@ export default function EquipmentLeasing(props: Props) {
<span className='unit'>/天起</span> <span className='unit'>/天起</span>
</div> </div>
) : ( ) : (
<div className='unit'>暂无报价</div> <div className='unit'>获取报价</div>
)} )}
</div> </div>
</div> </div>
...@@ -57,7 +57,7 @@ export default function EquipmentLeasing(props: Props) { ...@@ -57,7 +57,7 @@ export default function EquipmentLeasing(props: Props) {
const rightDom = (item: { id: number; bannerImg: string }) => { const rightDom = (item: { id: number; bannerImg: string }) => {
return ( return (
<div key={item.id} className='right-box-item right-item'> <div key={item.id} className='right-box-item right-item'>
<Image src={item.bannerImg} alt='error' fill /> <AntdImage src={item.bannerImg} width={180} preview={false} />
</div> </div>
); );
}; };
......
...@@ -67,11 +67,6 @@ export const Box = styled.div` ...@@ -67,11 +67,6 @@ export const Box = styled.div`
} }
.right-item { .right-item {
width: 180px; width: 180px;
height: 347px;
background: #d8d8d8;
border-radius: 6px;
overflow: hidden;
position: relative;
} }
.pagination-page { .pagination-page {
text-align: right; text-align: right;
......
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
Select, Select,
Space, Space,
message, message,
Image as AntdImage,
} from 'antd'; } from 'antd';
import type { CheckboxValueType } from 'antd/es/checkbox/Group'; import type { CheckboxValueType } from 'antd/es/checkbox/Group';
import Image from 'next/image'; import Image from 'next/image';
...@@ -94,7 +95,7 @@ export default function FlyingHandService() { ...@@ -94,7 +95,7 @@ export default function FlyingHandService() {
const rightDom = (item: string) => { const rightDom = (item: string) => {
return ( return (
<div className='right-box-item right-item' key={item}> <div className='right-box-item right-item' key={item}>
<Image src={item} alt='error' fill /> <AntdImage src={item} width={260} preview={false} />
</div> </div>
); );
}; };
......
...@@ -128,11 +128,6 @@ export const Box = styled.div` ...@@ -128,11 +128,6 @@ export const Box = styled.div`
} }
.right-item { .right-item {
width: 260px; width: 260px;
height: 500px;
background: #ffffff;
border-radius: 6px;
overflow: hidden;
position: relative;
} }
.pagination-page { .pagination-page {
text-align: right; text-align: right;
......
...@@ -15,9 +15,9 @@ export interface Dynamic { ...@@ -15,9 +15,9 @@ export interface Dynamic {
lat: number; lat: number;
lon: number; lon: number;
mediaVO: { mediaVO: {
picture: string[]; type: number;
videoUrl: string; url: string;
}; }[];
likesCount: number; likesCount: number;
commentCount: number; commentCount: number;
likes: boolean; likes: boolean;
...@@ -40,22 +40,24 @@ export interface CommentParams { ...@@ -40,22 +40,24 @@ export interface CommentParams {
content: string; //评论内容 content: string; //评论内容
dynamicId: number; //动态id dynamicId: number; //动态id
parentId?: number; //父级评论 parentId?: number; //父级评论
rootPath: string;
} }
export interface ByDynamicResp { export interface ByDynamicResp {
id: number; id: number;
dynamicId: number; description: string;
parentId: number;
userId: number;
content: string;
likesCount: number; likesCount: number;
createTime: string; dynamicPublishTime: string;
children: ByDynamicResp[]; children: ByDynamicResp[];
userBaseInfoVO: { userBaseInfo: {
id: number; id: number;
nickName: string; nickName: string;
userImg: string; userImg: string;
}; };
mediaVO: { type: number; url: string };
}
export interface dynamicDetail extends ByDynamicResp {
commentAndReplyVO: ByDynamicResp[];
} }
export default { export default {
...@@ -73,9 +75,9 @@ export default { ...@@ -73,9 +75,9 @@ export default {
return request('/release/dynamic/comment', 'post', params); return request('/release/dynamic/comment', 'post', params);
}, },
//根据动态查看评论 //动态详情
byDynamic(params: { dynamicId: number }): Promise<Response<Array<ByDynamicResp>>> { byDynamic(params: { dynamicId: number }): Promise<Response<dynamicDetail>> {
return request('/release/dynamic/byDynamic', 'get', params); return request('/release/dynamic/dynamicDetails', 'get', params);
}, },
//点赞或取消点赞 //点赞或取消点赞
......
...@@ -5,10 +5,7 @@ export interface PublishParams { ...@@ -5,10 +5,7 @@ export interface PublishParams {
lon?: number; //经度 lon?: number; //经度
description: string; //描述 description: string; //描述
userId: number; //用户id userId: number; //用户id
mediaVO: { mediaVO: { type: number; url: string }[];
//发布图片
picture: Array<string>;
};
} }
export default { export default {
......
.mediaContent{
display: flex;
align-items: center;
flex-wrap: wrap;
.mediaItemWrap{
position: relative;
.mediaItem{
margin-right: 10px;
margin-bottom: 10px;
}
.mediaDelete{
position: absolute;
right: 0;
top: 0;
transform: translate(0%,-50%);
}
}
}
import { PlusOutlined } from '@ant-design/icons';
import { Form, Input, Modal, Upload, Image, Button, Row, Col } from 'antd'; import { Form, Input, Modal, Upload, Image, Button, Row, Col } from 'antd';
import type { RcFile, UploadProps } from 'antd/es/upload'; import type { UploadProps } from 'antd/es/upload';
import type { UploadFile } from 'antd/es/upload/interface'; import type { UploadFile } from 'antd/es/upload/interface';
import { useContext, useEffect, useState } from 'react'; import { useContext, useEffect, useState } from 'react';
import gApi from '~/api'; import gApi from '~/api';
...@@ -8,7 +7,9 @@ import NImage from 'next/image'; ...@@ -8,7 +7,9 @@ import NImage from 'next/image';
import api from './api'; import api from './api';
import { useGeolocation } from '~/lib/hooks'; import { useGeolocation } from '~/lib/hooks';
import { UserContext } from '~/lib/userProvider'; import { UserContext } from '~/lib/userProvider';
import { useToken } from 'antd/es/theme/internal'; import uploadImg from '~/assets/images/upload.png';
import deleteIcon from '~/assets/images/delete-icon.png';
import styles from './index.module.scss';
type Props = { type Props = {
open: boolean; open: boolean;
...@@ -25,10 +26,6 @@ const normFile = (e: any) => { ...@@ -25,10 +26,6 @@ const normFile = (e: any) => {
}; };
export default function PublishMessage(props: Props) { export default function PublishMessage(props: Props) {
const [confirmLoading, setConfirmLoading] = useState(false);
const [previewOpen, setPreviewOpen] = useState(false);
const [previewImage, setPreviewImage] = useState('');
const [previewTitle, setPreviewTitle] = useState('');
const [fileList, setFileList] = useState<UploadFile[]>([]); const [fileList, setFileList] = useState<UploadFile[]>([]);
const [showLoading, setShowLoad] = useState(false); const [showLoading, setShowLoad] = useState(false);
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -39,22 +36,28 @@ export default function PublishMessage(props: Props) { ...@@ -39,22 +36,28 @@ export default function PublishMessage(props: Props) {
useEffect(() => { useEffect(() => {
setToken(window.localStorage.getItem('token') || ''); setToken(window.localStorage.getItem('token') || '');
}, []); }, []);
//预览关闭
const handlePreviewCancel = () => setPreviewOpen(false);
//图片预览
const handlePreview = async (file: UploadFile) => {
if (file.url) {
setPreviewImage(file.url);
setPreviewOpen(true);
setPreviewTitle(file.name || file.url!.substring(file.url!.lastIndexOf('/') + 1));
}
};
//图片上传 //图片上传
const handleChange: UploadProps['onChange'] = (info) => { const handleChange: UploadProps['onChange'] = (info) => {
console.log('uploadChange', info); const isSize = (info.file as any).size / 1024 / 1024 < 5;
if (!isSize) {
window.messageApi.error('上传文件最大5M');
return;
}
const isType = [
'video/mp4',
'video/avi',
'video/wmv',
'video/rmvb',
'image/png',
'image/jpeg',
'image/jpg',
'image/gif',
'image/bmp',
].includes(info.file.type as string);
if (!isType) {
window.messageApi.error('上传文件类型错误');
return;
}
if (info.file.status === 'uploading') { if (info.file.status === 'uploading') {
let find = fileList.find((item) => { let find = fileList.find((item) => {
return item.uid === info.file.uid; return item.uid === info.file.uid;
...@@ -64,11 +67,10 @@ export default function PublishMessage(props: Props) { ...@@ -64,11 +67,10 @@ export default function PublishMessage(props: Props) {
} }
return; return;
} else if (info.file.status === 'done') { } else if (info.file.status === 'done') {
// Get this url from response in real world.
if (info.file.response.code === '200' && info.file.response.result) { if (info.file.response.code === '200' && info.file.response.result) {
let fileList1 = fileList.map((item) => { let fileList1 = fileList.map((item) => {
if (item.uid === info.file.uid) { if (item.uid === info.file.uid) {
info.file.url = info.file.response.result?.[0]; info.file.url = info.file.response.result;
return info.file; return info.file;
} }
return item; return item;
...@@ -85,10 +87,13 @@ export default function PublishMessage(props: Props) { ...@@ -85,10 +87,13 @@ export default function PublishMessage(props: Props) {
setFileList([...info.fileList]); setFileList([...info.fileList]);
} }
}; };
//删除媒体
const deleteMedia = (file: UploadFile) => {
let list = fileList.filter((v) => v.uid !== file.uid);
setFileList(list || []);
};
//提交 //提交
const onFinish = (values: any) => { const onFinish = (values: any) => {
console.log(values);
setShowLoad(true); setShowLoad(true);
if (userInfo) { if (userInfo) {
...@@ -96,39 +101,39 @@ export default function PublishMessage(props: Props) { ...@@ -96,39 +101,39 @@ export default function PublishMessage(props: Props) {
.publish({ .publish({
lat: position?.position?.lat, //纬度 lat: position?.position?.lat, //纬度
lon: position?.position?.lng, //经度 lon: position?.position?.lng, //经度
title: '', //标题
description: values.description, //描述 description: values.description, //描述
userId: userInfo.id, //用户id userId: userInfo.id, //用户id
mediaVO: { mediaVO: fileList.map((item) => ({
//发布图片 type: item.type?.includes('image') ? 0 : 1,
//@ts-ignore url: item.url as string,
picture: fileList.filter((item) => item.url).map((item) => item.url), })),
},
}) })
.then((res) => { .then((res) => {
console.log('提交结果', res);
setShowLoad(false); setShowLoad(false);
if (res.code === '200') { if (res.code === '200') {
window.messageApi.success('发布成功'); window.messageApi.success('发布成功');
props.onCancel(); props.onCancel();
props.onOk && props.onOk(); props.onOk && props.onOk();
setTimeout(() => { setTimeout(() => {
form.resetFields(['title', 'description']); form.resetFields();
setFileList([]); setFileList([]);
}, 500); }, 500);
} }
}); });
} }
}; };
//取消
const handleCancel = () => {
form.resetFields();
setFileList([]);
props.onCancel();
};
return ( return (
<Modal <Modal
title='' title=''
open={props.open} open={props.open}
onCancel={props.onCancel} onCancel={handleCancel}
width={500} width={500}
confirmLoading={confirmLoading}
footer={null} footer={null}
okButtonProps={{ style: { height: 37, padding: '0 32px', fontSize: 16 } }} okButtonProps={{ style: { height: 37, padding: '0 32px', fontSize: 16 } }}
cancelButtonProps={{ style: { display: 'none' } }} cancelButtonProps={{ style: { display: 'none' } }}
...@@ -140,38 +145,63 @@ export default function PublishMessage(props: Props) { ...@@ -140,38 +145,63 @@ export default function PublishMessage(props: Props) {
allowClear allowClear
showCount showCount
placeholder='输入内容' placeholder='输入内容'
maxLength={100} maxLength={256}
style={{ height: 120, resize: 'none' }} style={{ height: 120, resize: 'none' }}
></Input.TextArea> ></Input.TextArea>
</Form.Item> </Form.Item>
<Row style={{ marginTop: '10px' }}>
{fileList.length ? (
<Col>
<div className={styles.mediaContent}>
{fileList.map((v, index: number) => (
<div className={styles.mediaItemWrap} key={index}>
<div className={styles.mediaItem}>
{v.type?.includes('image') ? (
<Image
src={v.url}
width={100}
height={100}
alt=''
style={{ verticalAlign: 'top' }}
/>
) : (
<video src={v.url} style={{ width: '100px', height: '100px' }} controls />
)}
</div>
<NImage
src={deleteIcon}
alt=''
className={styles.mediaDelete}
width={20}
height={20}
onClick={() => deleteMedia(v)}
/>
</div>
))}
</div>
</Col>
) : (
''
)}
<Col>
<Form.Item valuePropName='picture' getValueFromEvent={normFile}> <Form.Item valuePropName='picture' getValueFromEvent={normFile}>
<Upload <Upload
name='uploadFile' name='uploadFile'
action={gApi.imgOss} action={gApi.fileUpload}
listType='picture-card' listType='picture-card'
fileList={fileList}
onPreview={handlePreview}
onChange={handleChange} onChange={handleChange}
showUploadList={false}
maxCount={1} maxCount={1}
headers={{ token: token }} headers={{ token: token }}
> >
{fileList.length >= 8 ? null : ( {fileList.length >= 9 ? null : (
<div> <NImage src={uploadImg} alt='' width={100} height={100} />
<PlusOutlined />
<div style={{ marginTop: 8 }}>Upload</div>
</div>
)} )}
</Upload> </Upload>
<Modal
open={previewOpen}
title={previewTitle}
footer={null}
onCancel={handlePreviewCancel}
bodyStyle={{ textAlign: 'center' }}
>
<Image alt='example' src={previewImage} preview={false} />
</Modal>
</Form.Item> </Form.Item>
</Col>
</Row>
<Row justify='space-between' align='middle'> <Row justify='space-between' align='middle'>
<Col> <Col>
<NImage <NImage
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
margin-bottom: 16px; margin-bottom: 16px;
padding-right: 10px; padding-right: 10px;
line-height: 1.2; line-height: 1.2;
word-break: break-all;
} }
} }
......
...@@ -81,7 +81,7 @@ export default function Forum() { ...@@ -81,7 +81,7 @@ export default function Forum() {
}) })
.then((res) => { .then((res) => {
if (res?.code === '200') { if (res?.code === '200') {
item.commentList = res.result || []; item.commentList = res.result?.commentAndReplyVO || [];
} }
const temp = [...list]; const temp = [...list];
setList(temp); setList(temp);
...@@ -102,6 +102,7 @@ export default function Forum() { ...@@ -102,6 +102,7 @@ export default function Forum() {
.comment({ .comment({
content: values.content, content: values.content,
dynamicId: item.id, dynamicId: item.id,
rootPath: item.id.toString(),
}) })
.then((res) => { .then((res) => {
if (res.code === '200') { if (res.code === '200') {
...@@ -169,28 +170,41 @@ export default function Forum() { ...@@ -169,28 +170,41 @@ export default function Forum() {
<div className={styles.name}>{item.userBaseInfo?.nickName}</div> <div className={styles.name}>{item.userBaseInfo?.nickName}</div>
<div className={styles.desc}>{item.description}</div> <div className={styles.desc}>{item.description}</div>
<div className={styles.imgs}> <div className={styles.imgs}>
<Image.PreviewGroup
preview={{
onChange: (current, prev) =>
console.log(`current index: ${current}, prev index: ${prev}`),
}}
>
<Space size={6} wrap> <Space size={6} wrap>
{item?.mediaVO?.picture?.map((img) => { {item?.mediaVO?.map((v, index: number) =>
return ( v.type === 0 ? (
<Image <Image
key={img} key={index}
alt='' alt=''
className='img' className='img'
width={132} width={132}
height={132} height={132}
src={img} src={v.url}
fallback={errImg} fallback={errImg}
/> />
); ) : (
})} <video
key={index}
src={v.url}
controls
style={{ width: '132px', height: '132px' }}
/>
),
)}
</Space> </Space>
</Image.PreviewGroup>
{/*<Image.PreviewGroup*/}
{/*>*/}
{/* <Space size={6} wrap>*/}
{/* {item?.mediaVO*/}
{/* ?.filter((v) => v.type === 0)*/}
{/* ?.map((img, index: number) => {*/}
{/* return (*/}
{/* );*/}
{/* })}*/}
{/* </Space>*/}
{/*</Image.PreviewGroup>*/}
</div> </div>
<div className={styles.ctrls}> <div className={styles.ctrls}>
<div className={styles.ctrlsItem} onClick={() => openComment(item)}> <div className={styles.ctrlsItem} onClick={() => openComment(item)}>
...@@ -253,17 +267,19 @@ export default function Forum() { ...@@ -253,17 +267,19 @@ export default function Forum() {
return ( return (
<div key={comment.id} className={styles.commentItem}> <div key={comment.id} className={styles.commentItem}>
<div className={styles.commentHeadImg}> <div className={styles.commentHeadImg}>
<Image src={comment.userBaseInfoVO?.userImg}></Image> <Image src={comment.userBaseInfo?.userImg}></Image>
</div> </div>
<div className={styles.info}> <div className={styles.info}>
<div className={styles.nameWrap}> <div className={styles.nameWrap}>
<div className={styles.commentName}> <div className={styles.commentName}>
{comment.userBaseInfoVO?.nickName} {comment.userBaseInfo?.nickName}
<div className={styles.date}> <div className={styles.date}>
{moment(comment.createTime).format('YYYY-MM-DD')} {moment(comment.dynamicPublishTime).format('YYYY-MM-DD')}
</div>
</div> </div>
<div className={styles.commentContent}>
{comment.description}
</div> </div>
<div className={styles.commentContent}>{comment.content}</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -116,6 +116,7 @@ export interface NewsTenderType { ...@@ -116,6 +116,7 @@ export interface NewsTenderType {
tenderPrice: number; tenderPrice: number;
createTime: string; createTime: string;
apply: number; apply: number;
tenderTitle: string;
} }
export interface ListPageNewsInfoResp { export interface ListPageNewsInfoResp {
......
...@@ -17,6 +17,7 @@ import api, { ...@@ -17,6 +17,7 @@ import api, {
listNewsApi, listNewsApi,
mallApi, mallApi,
} from './api'; } from './api';
import { bigNumberTransform } from '~/utils/money';
interface ColumnsType { interface ColumnsType {
title: string; title: string;
...@@ -428,15 +429,15 @@ export default function WaterfallFlowBody() { ...@@ -428,15 +429,15 @@ export default function WaterfallFlowBody() {
<div className='body'> <div className='body'>
{list?.map((item) => ( {list?.map((item) => (
<div key={item.id} className='body-item'> <div key={item.id} className='body-item'>
<div className='item-label' title={item.tenderContent}> <div className='item-label' title={item.tenderTitle}>
{item.tenderContent} {item.tenderTitle}
<div className='label-bottom'>{item.tenderPrice}</div> <div className='label-bottom'>{item.tenderPrice}</div>
</div> </div>
<div <div
className={`item-right ${item.apply ? 'apply' : ''}`} className={`item-right ${item.apply ? 'apply' : ''}`}
onClick={() => handleTenderApply(item)} onClick={() => handleTenderApply(item)}
> >
<div className='left'>{`${item.tenderPrice}W`}</div> <div className='left'>{bigNumberTransform(item.tenderPrice * 10000, true)}</div>
{item.apply ? ( {item.apply ? (
<div className='right'>已申请</div> <div className='right'>已申请</div>
) : ( ) : (
......
...@@ -294,12 +294,12 @@ export const Box = styled.div` ...@@ -294,12 +294,12 @@ export const Box = styled.div`
height: 22px; height: 22px;
line-height: 22px; line-height: 22px;
font-size: 11px; font-size: 11px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500; font-weight: 500;
color: #ff4500; color: #ff4500;
text-align: center; text-align: center;
left: 4px; left: 4px;
top: 0; top: 0;
white-space: nowrap;
} }
.right { .right {
width: 48px; width: 48px;
......
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { Box } from './styled'; import { Box } from './styled';
import { Pagination } from 'antd'; import { Pagination, Image } from 'antd';
import Layout from '~/components/layout'; import Layout from '~/components/layout';
import ContentBox from '~/components/contentBox'; import ContentBox from '~/components/contentBox';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import Filter, { FilterResult, AdapterResult } from '~/components/filter'; import Filter, { FilterResult, AdapterResult } from '~/components/filter';
import api, { Job } from './api'; import api, { Job } from './api';
import commonApi from '~/api'; import commonApi from '~/api';
import Image from 'next/image';
// 此函数在构建时被调用 // 此函数在构建时被调用
export async function getServerSideProps() { export async function getServerSideProps() {
return { return {
...@@ -53,7 +52,7 @@ export default function JobServices() { ...@@ -53,7 +52,7 @@ export default function JobServices() {
const rightDom = (item: string) => { const rightDom = (item: string) => {
return ( return (
<div className='right-box-item advertisement' key={item}> <div className='right-box-item advertisement' key={item}>
<Image src={item} alt='error' width={260} height={500} /> <Image src={item} width={260} preview={false} />
</div> </div>
); );
}; };
......
...@@ -86,12 +86,6 @@ export const Box = styled.div` ...@@ -86,12 +86,6 @@ export const Box = styled.div`
} }
} }
} }
.advertisement {
width: 260px;
height: 420px;
background: #ffffff;
border-radius: 6px;
}
.pagination-page { .pagination-page {
text-align: right; text-align: right;
} }
......
...@@ -24,20 +24,21 @@ interface PropsBox { ...@@ -24,20 +24,21 @@ interface PropsBox {
export default function OrderForGoods(props: PropsBox) { export default function OrderForGoods(props: PropsBox) {
const { setIsorderForGoods, shopDetail, detailData, wareSkuList, discount, mallDetail } = props; const { setIsorderForGoods, shopDetail, detailData, wareSkuList, discount, mallDetail } = props;
const [value, setValue] = useState(1); const [value, setValue] = useState(0);
const [areaValue, setAreaValue] = useState<string>(); const [areaValue, setAreaValue] = useState<string>();
const [list, setList] = useState<Array<UserAddress> | null>(); const [list, setList] = useState<Array<UserAddress> | null>();
const onChange = (e: RadioChangeEvent) => { const onChange = (e: RadioChangeEvent) => {
console.log('radio checked', e.target.value); console.log('数据-->', e.target.value);
setValue(e.target.value); setValue(e.target.value);
}; };
const onChangeValue = (index: number) => { const onChangeValue = (id: number) => {
setValue(index); console.log('数据id-->', id);
setValue(id);
}; };
const detailSumbit = () => { const detailSumbit = () => {
if (!list?.length) return message.warning('暂无地址信息,请前往云享飞添加地址'); if (!list?.length) return message.warning('暂无地址信息,请前往云享飞添加地址');
if (list?.length && !value && value !== 0) return message.warning('请选择地址'); if (!value) return message.warning('请选择地址');
if (detailData && list && mallDetail) { if (detailData && list && mallDetail) {
const pushList = { const pushList = {
buyNum: mallDetail.buyNum, buyNum: mallDetail.buyNum,
...@@ -246,7 +247,11 @@ export default function OrderForGoods(props: PropsBox) { ...@@ -246,7 +247,11 @@ export default function OrderForGoods(props: PropsBox) {
</div> </div>
<div className='bottom'> <div className='bottom'>
<div className='value'>寄送至</div> <div className='value'>寄送至</div>
{list ? <div className='value-content'>{list![value]?.takeAddress}</div> : null} {list ? (
<div className='value-content'>
{list![list.findIndex((v) => v.id === value)]?.takeAddress}
</div>
) : null}
</div> </div>
</div> </div>
<div className='detail-sumbit'> <div className='detail-sumbit'>
......
...@@ -151,7 +151,7 @@ export default function Mall(props: Props) { ...@@ -151,7 +151,7 @@ export default function Mall(props: Props) {
className={styles.ad} className={styles.ad}
src={item.bannerImg} src={item.bannerImg}
width={189} width={189}
height={364} // height={364}
preview={false} preview={false}
fallback={errImg} fallback={errImg}
></Image> ></Image>
......
import { RightOutlined } from '@ant-design/icons'; import { RightOutlined } from '@ant-design/icons';
import { Col, Row, Space, Image } from 'antd'; import { Col, Row } from 'antd';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import errImg from '~/assets/errImg';
import Layout from '~/components/layout'; import Layout from '~/components/layout';
import newsApi, { Item } from '../components/news/api'; import newsApi, { Item } from '../components/news/api';
import api, { DetailsResp } from './api'; import api, { DetailsResp } from './api';
...@@ -70,11 +69,12 @@ export default function CaseArticle() { ...@@ -70,11 +69,12 @@ export default function CaseArticle() {
<Col flex='auto'> <Col flex='auto'>
<div className={styles.font1}>{data?.caseTitle}</div> <div className={styles.font1}>{data?.caseTitle}</div>
<div className={styles.font2} style={{ marginTop: 18, marginBottom: 41 }}> <div className={styles.font2} style={{ marginTop: 18, marginBottom: 41 }}>
{data?.createTime && Moment(data?.createTime).format('YYYY-MM-DD')} ·{' '} {data?.createTime && Moment(data?.createTime).format('YYYY-MM-DD')} ·作者:
{data?.caseAuthor} {data?.caseAuthor || '不详'}
</div> </div>
<div <div
style={{ lineHeight: 1.5 }} style={{ lineHeight: 1.5 }}
className={styles.richText}
dangerouslySetInnerHTML={{ __html: data?.caseContents || '' }} dangerouslySetInnerHTML={{ __html: data?.caseContents || '' }}
></div> ></div>
</Col> </Col>
......
...@@ -37,3 +37,9 @@ ...@@ -37,3 +37,9 @@
.ellipse1 { .ellipse1 {
@include ellipsis(1); @include ellipsis(1);
} }
.richText{
img{
max-width: 100%;
height: auto;
}
}
...@@ -25,6 +25,7 @@ export interface Item { ...@@ -25,6 +25,7 @@ export interface Item {
tenderPrice: number; tenderPrice: number;
createTime: string; createTime: string;
apply: 0 | 1; apply: 0 | 1;
tenderTitle: string;
} }
export interface ApplyParams { export interface ApplyParams {
......
...@@ -8,7 +8,14 @@ ...@@ -8,7 +8,14 @@
border-bottom: 1px dashed RGBA(222, 222, 222, 1); border-bottom: 1px dashed RGBA(222, 222, 222, 1);
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
cursor: pointer;
&:hover {
.info{
.title{
color: red;
}
}
}
.info { .info {
.title { .title {
font-size: 14px; font-size: 14px;
......
...@@ -3,6 +3,8 @@ import { useState, useEffect, useContext } from 'react'; ...@@ -3,6 +3,8 @@ import { useState, useEffect, useContext } from 'react';
import { UserContext } from '~/lib/userProvider'; import { UserContext } from '~/lib/userProvider';
import api, { Item } from './api'; import api, { Item } from './api';
import styles from './index.module.scss'; import styles from './index.module.scss';
import { bigNumberTransform } from '~/utils/money';
import { useRouter } from 'next/router';
type Props = { type Props = {
params?: { params?: {
...@@ -14,6 +16,7 @@ type Props = { ...@@ -14,6 +16,7 @@ type Props = {
}; };
export default function Bids(props: Props) { export default function Bids(props: Props) {
const router = useRouter();
const [list, setList] = useState<Array<Item>>([]); const [list, setList] = useState<Array<Item>>([]);
const [pageParams, setPageParams] = useState({ const [pageParams, setPageParams] = useState({
pageNo: 1, pageNo: 1,
...@@ -78,24 +81,32 @@ export default function Bids(props: Props) { ...@@ -78,24 +81,32 @@ export default function Bids(props: Props) {
setNeedLogin(true); setNeedLogin(true);
} }
}; };
//招标项目详情
const toTenderProjectsDetail = (item: Item) => {
router.push('/projectInfo/tenderProjectsDetail/' + item.id);
};
return ( return (
<Spin spinning={loading} delay={500}> <Spin spinning={loading} delay={500}>
<div className={styles.bids} style={{ height: 610 }}> <div className={styles.bids} style={{ height: 610 }}>
{list.map((item) => { {list.map((item) => {
return ( return (
<div className={styles.item} key={item.id}> <div className={styles.item} key={item.id} onClick={() => toTenderProjectsDetail(item)}>
<div className={styles.info}> <div className={styles.info}>
<div className={styles.title}>{item.tenderContent}</div> <div className={styles.title}>{item.tenderTitle}</div>
</div> </div>
{item.apply ? ( {item.apply ? (
<Button type='primary' disabled className={`${styles.btn} ${styles.disabled}`}> <Button type='primary' disabled className={`${styles.btn} ${styles.disabled}`}>
<div className={styles.text1}>{item.tenderPrice}</div> <div className={styles.text1}>
{bigNumberTransform(item.tenderPrice * 10000, true)}
</div>
<div className={styles.text2}>已申请</div> <div className={styles.text2}>已申请</div>
</Button> </Button>
) : ( ) : (
<Button type='primary' className={styles.btn}> <Button type='primary' className={styles.btn}>
<div className={styles.text1}>{item.tenderPrice}</div> <div className={styles.text1}>
{bigNumberTransform(item.tenderPrice * 10000, true)}
</div>
<div className={styles.text2} onClick={() => onApply(item)}> <div className={styles.text2} onClick={() => onApply(item)}>
商务合作 商务合作
</div> </div>
......
...@@ -9,14 +9,23 @@ ...@@ -9,14 +9,23 @@
border-bottom: 1px dashed RGBA(222, 222, 222, 1); border-bottom: 1px dashed RGBA(222, 222, 222, 1);
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
cursor: pointer;
&:hover{
.info{
.title{
color: red;
}
}
}
.info { .info {
flex: 1;
.title { .title {
font-size: 14px; font-size: 14px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
color: #3c3e42; color: #3c3e42;
width: 649px; width:100%;
text-overflow: ellipsis;
@include ellipsis(1); @include ellipsis(1);
margin-right: 10px;
} }
.desc { .desc {
font-size: 14px; font-size: 14px;
......
...@@ -67,14 +67,11 @@ export default function Cases(props: Props) { ...@@ -67,14 +67,11 @@ export default function Cases(props: Props) {
return ( return (
<div className={styles.item} key={item.id}> <div className={styles.item} key={item.id}>
<div className={styles.info}> <div className={styles.info}>
<div className={styles.title}> <div
<Button className={styles.title}
type='link'
style={{ padding: '0 0' }}
onClick={() => Router.push('/projectInfo/caseArticle/' + item.id)} onClick={() => Router.push('/projectInfo/caseArticle/' + item.id)}
> >
{item.caseTitle} {item.caseTitle}
</Button>
</div> </div>
</div> </div>
<Button <Button
......
...@@ -11,7 +11,14 @@ ...@@ -11,7 +11,14 @@
display: flex; display: flex;
border-bottom: 1px dashed RGBA(222, 222, 222, 1); border-bottom: 1px dashed RGBA(222, 222, 222, 1);
align-items: center; align-items: center;
cursor: pointer;
&:hover {
.info{
.title{
color: red;
}
}
}
.logo { .logo {
width: 120px; width: 120px;
height: 80px; height: 80px;
......
import { RightOutlined } from '@ant-design/icons'; import { Col, Empty, Pagination, Row, Spin } from 'antd';
import { Button, Col, Empty, Pagination, Row, Spin } from 'antd';
import styles from './index.module.scss'; import styles from './index.module.scss';
import Image from 'next/image'; import Image from 'next/image';
import { useState, useEffect, useContext } from 'react'; import { useState, useEffect, useContext } from 'react';
import api, { Item } from './api'; import api, { Item } from './api';
import Router from 'next/router'; import Router, { useRouter } from 'next/router';
import Moment from 'moment';
import { UserContext } from '~/lib/userProvider'; import { UserContext } from '~/lib/userProvider';
type Props = { type Props = {
...@@ -18,6 +16,7 @@ type Props = { ...@@ -18,6 +16,7 @@ type Props = {
}; };
export default function News(props: Props) { export default function News(props: Props) {
const router = useRouter();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [list, setList] = useState<Array<Item>>([]); const [list, setList] = useState<Array<Item>>([]);
const [pageParams, setPageParams] = useState({ const [pageParams, setPageParams] = useState({
...@@ -74,14 +73,17 @@ export default function News(props: Props) { ...@@ -74,14 +73,17 @@ export default function News(props: Props) {
setNeedLogin(true); setNeedLogin(true);
} }
}; };
//新闻点击
const newsClick = (item: Item) => {
router.push('/projectInfo/newsArticle/' + item.id);
};
return ( return (
<Spin spinning={loading} delay={500}> <Spin spinning={loading} delay={500}>
<Row justify='space-between' style={{ height: 606 }}> <Row justify='space-between' style={{ height: 606 }}>
<Col className={styles.new}> <Col className={styles.new}>
{list.map((item) => { {list.map((item) => {
return ( return (
<div className={styles.item} key={item.id}> <div className={styles.item} key={item.id} onClick={() => newsClick(item)}>
<Image <Image
className={styles.logo} className={styles.logo}
src={item.surfaceImg} src={item.surfaceImg}
...@@ -91,18 +93,23 @@ export default function News(props: Props) { ...@@ -91,18 +93,23 @@ export default function News(props: Props) {
></Image> ></Image>
<div className={styles.info}> <div className={styles.info}>
<div className={styles.title}>{item.newsTitle}</div> <div className={styles.title}>{item.newsTitle}</div>
<div className={styles.desc}>{item.newsContents}</div> <div
className={styles.desc}
dangerouslySetInnerHTML={{
__html: item.newsContents.replace(/<img(?:(?!\/>).|\n)*?\/>/gm, '') || '',
}}
></div>
<div className={styles.date}> <div className={styles.date}>
{Moment().format('yyyy-MM-DD')} · {item.newsAuthor} {item.createTime} · 作者:{item.newsAuthor}
</div> </div>
</div> </div>
<Button {/*<Button*/}
type='primary' {/* type='primary'*/}
style={{ width: 120, height: 40, flexShrink: 0 }} {/* style={{ width: 120, height: 40, flexShrink: 0 }}*/}
onClick={onGetInfo} {/* onClick={onGetInfo}*/}
> {/*>*/}
获取产品资料 {/* 获取产品资料*/}
</Button> {/*</Button>*/}
</div> </div>
); );
})} })}
......
.bannerWrap{ .bannerWrap{
height: 100px; height: 100px;
position: relative; position: relative;
} }
......
import { RightOutlined } from '@ant-design/icons'; import { RightOutlined } from '@ant-design/icons';
import { Col, Row, Space, Image } from 'antd'; import { Col, Row } from 'antd';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import errImg from '~/assets/errImg';
import Layout from '~/components/layout'; import Layout from '~/components/layout';
import newsApi, { Item } from '../components/news/api'; import newsApi, { Item } from '../components/news/api';
import api, { DetailsResp } from './api'; import api, { DetailsResp } from './api';
...@@ -70,11 +69,12 @@ export default function CaseArticle() { ...@@ -70,11 +69,12 @@ export default function CaseArticle() {
<Col flex='auto'> <Col flex='auto'>
<div className={styles.font1}>{data?.newsTitle}</div> <div className={styles.font1}>{data?.newsTitle}</div>
<div className={styles.font2} style={{ marginTop: 18, marginBottom: 41 }}> <div className={styles.font2} style={{ marginTop: 18, marginBottom: 41 }}>
{data?.createTime && Moment(data?.createTime).format('YYYY-MM-DD')} ·{' '} {data?.createTime && Moment(data?.createTime).format('YYYY-MM-DD')} ·作者:
{data?.newsAuthor} {data?.newsAuthor || '不详'}
</div> </div>
<div <div
style={{ lineHeight: 1.5 }} style={{ lineHeight: 1.5 }}
className={styles.richText}
dangerouslySetInnerHTML={{ __html: data?.newsContents || '' }} dangerouslySetInnerHTML={{ __html: data?.newsContents || '' }}
></div> ></div>
</Col> </Col>
......
...@@ -3,7 +3,6 @@ import request, { Response } from '~/api/request'; ...@@ -3,7 +3,6 @@ import request, { Response } from '~/api/request';
export interface DetailsParams { export interface DetailsParams {
id: number; id: number;
} }
export interface DetailsResp { export interface DetailsResp {
id: number; id: number;
newsTitle?: string; newsTitle?: string;
......
...@@ -37,3 +37,9 @@ ...@@ -37,3 +37,9 @@
.ellipse1 { .ellipse1 {
@include ellipsis(1); @include ellipsis(1);
} }
.richText{
img{
max-width: 100%;
height: auto;
}
}
import { RightOutlined } from '@ant-design/icons';
import { Col, Row } from 'antd';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import Layout from '~/components/layout';
import newsApi, { Item } from '../components/news/api';
import api, { DetailsResp } from './api';
import styles from './index.module.scss';
import Moment from 'moment';
export default function TenderProjectsDetail() {
const router = useRouter();
const [data, setData] = useState<DetailsResp>();
const [newsList, setNewList] = useState<Item[]>([]);
//获取案例详情
useEffect(() => {
const id = Number(router.query.id);
if (id) {
api
.details({
id,
})
.then((res) => {
setData(res.result || undefined);
});
}
}, [router]);
//获取新闻列表
useEffect(() => {
newsApi
.listNewsPage({
pageNo: 1,
pageSize: 10,
})
.then((res) => {
setNewList(res.result?.list || []);
});
}, []);
const fontColor = (i: number) => {
switch (i) {
case 0:
return {
color: '#ff2c46',
};
case 1:
return {
color: '#FF6602',
};
case 2:
return {
color: '#FAA910',
};
default:
return {
color: '#9295A3',
};
}
};
return (
<Layout layoutStyle={{ backgroundColor: '#fff' }}>
<div style={{ paddingTop: 29 }}>
<Row justify='space-between' wrap={false}>
<Col flex='auto'>
<div className={styles.font1}>{data?.tenderTitle}</div>
<div className={styles.font2} style={{ marginTop: 18, marginBottom: 41 }}>
{data?.createTime && Moment(data?.createTime).format('YYYY-MM-DD')}
</div>
<div
style={{ lineHeight: 1.5 }}
className={styles.richText}
dangerouslySetInnerHTML={{ __html: data?.tenderContent || '' }}
></div>
</Col>
<Col>
<div className={styles.newsBox}>
<Row
className={styles.font4}
align='middle'
style={{ paddingTop: 16, paddingLeft: 20 }}
>
行业新闻
<RightOutlined style={{ fontSize: 16, marginLeft: 9 }} />
</Row>
<Row gutter={10} style={{ marginTop: 8 }}>
<Col span={24}>
{newsList.map((item, i) => {
return (
<Row
key={item.id}
justify='space-between'
align='middle'
style={{ cursor: 'pointer' }}
onClick={() => {
router.push('/projectInfo/newsArticle/' + item.id);
}}
>
<Col
className={`${styles.font3}`}
style={{ margin: '6px 23px 6px 19px', width: '100%' }}
>
<Row wrap={false}>
<Col span={2} style={{ textAlign: 'center', ...fontColor(i) }}>
{i + 1}
</Col>
<Col span={22} className={styles.ellipse1}>
{item.newsTitle}
</Col>
</Row>
</Col>
</Row>
);
})}
</Col>
</Row>
</div>
</Col>
</Row>
</div>
</Layout>
);
}
import request, { Response } from '~/api/request';
import { Item } from '~/pages/projectInfo/components/news/api';
export interface DetailsParams {
id: number;
}
export interface DetailsResp {
id: number;
tenderTitle?: string;
tenderPrice?: number;
tenderContent?: string;
createTime?: string;
}
export default {
//招标详情
details(params: DetailsParams): Promise<Response<DetailsResp>> {
return request('/release/tender/infoById', 'get', params);
},
};
@import "~/styles/mixins.scss";
.font1 {
font-size: 36px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #000000;
line-height: 50px;
}
.font2 {
font-size: 12px;
font-family: MicrosoftYaHei;
color: #333333;
line-height: 16px;
}
.font3 {
font-size: 14px;
font-family: MicrosoftYaHei;
color: #323232;
line-height: 19px;
}
.font4 {
font-size: 16px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
font-weight: bold;
color: #000000;
line-height: 20px;
}
.newsBox {
width: 384px;
}
.ellipse1 {
@include ellipsis(1);
}
.richText{
img{
max-width: 100%;
height: auto;
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
// @ts-nocheck
/* eslint-disable */
export const formatCurrency = (s, n) => {
n = n > 0 && n <= 20 ? n : 2
s = `${parseFloat(`${s}`.replace(/[^\d\.-]/g, '')).toFixed(n)}`
const l = s.split('.')[0].split('').reverse()
const r = s.split('.')[1]
let t = ''
for (let i = 0; i < l.length; i++) {
t += l[i] + ((i + 1) % 3 == 0 && i + 1 != l.length ? ',' : '')
}
return t.split('').reverse().join('')
}
// 格式化千分位并补零
export const moneyFormat = (num) => {
if (Number(num).toString() !== 'NaN') {
// 添加千分符
let _n = Number(num).toLocaleString()
if (_n.indexOf('.') !== -1) {
_n = `${_n}00`
} else {
_n = `${_n}.00`
}
// 因为有千分符所以,返回数据为字符串格式,无法做运算操作,适合做直接显示使用
return _n.substring(0, _n.indexOf('.') + 3)
}
// console.log('参数格式有误')
}
// 金额大数字转换
export const bigNumberTransform = (value, type) => {
const newValue = ['', '', '']
let fr = 1000
let num = 3
let text1 = ''
let text2 = ''
let fm = 1
if (value == '' || value == null || isNaN(value)) {
return !type ? newValue : ''
}
if (value < 0) {
value = Math.abs(value)
text2 = '-'
}
while (value / fr >= 1) {
fr *= 10
num += 1
// console.log('数字', value / fr, 'num:', num)
}
if (num <= 4) {
// 千
newValue[0] = value
newValue[1] = ''
} else if (num <= 8) {
// 万
// text1 = parseInt(num - 4) / 3 > 1 ? '千万' : '万'
text1 = '万'
// tslint:disable-next-line:no-shadowed-variable
fm = text1 === '万' ? 10000 : 10000000
if (value % fm === 0) {
newValue[0] = `${parseInt(value / fm)}`
} else {
newValue[0] = `${parseFloat(value / fm).toFixed(2)}`
}
newValue[1] = text1
} else {
// 亿 if (num <= 16)
// text1 = (num - 8) / 3 > 1 ? '千亿' : '亿'
text1 = '亿'
text1 = (num - 8) / 4 > 1 ? '万亿' : text1
text1 = (num - 8) / 7 > 1 ? '千万亿' : text1
text1 = (num - 8) / 10 > 1 ? '亿亿' : text1
// tslint:disable-next-line:no-shadowed-variable
fm = 1
if (text1 === '亿') {
fm = 100000000
} else if (text1 === '千亿') {
fm = 100000000000
} else if (text1 === '万亿') {
fm = 1000000000000
} else if (text1 === '千万亿') {
fm = 1000000000000000
} else {
fm = 1000000000000000000
}
if (value % fm === 0) {
newValue[0] = `${parseInt(value / fm)}`
} else {
newValue[0] = `${parseFloat(value / fm).toFixed(2)}`
}
newValue[1] = text1
}
if (value < 1000) {
newValue[0] = `${value}`
newValue[1] = ''
}
newValue[0] = text2 ? text2 + newValue[0] : newValue[0]
return !type ? newValue : newValue[0] + newValue[1]
}
// 格式化金额
export const formatMoney = (money) => {
return money?.toLocaleString()
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论