提交 59b2ef32 作者: 龚洪江

修复:论坛,招投标,新闻等缺陷修复

上级 f515c921
......@@ -5,6 +5,7 @@ import { useContext, useEffect, useState } from 'react';
import api, { ListTagResp } from './api';
import { useRouter } from 'next/router';
import { UserContext } from '~/lib/userProvider';
import commonApi from '~/api';
const imgs = [
require('./assets/生产制造商.png'),
......@@ -26,7 +27,7 @@ type Props = {
export default function JoinModal(props: Props) {
const router = useRouter();
const [tagList, setTagList] = useState<ListTagResp[]>([]);
const { userInfo } = useContext(UserContext);
const { userInfo, setUserInfo } = useContext(UserContext);
useEffect(() => {
api.listTag().then((res) => {
......@@ -35,12 +36,15 @@ export default function JoinModal(props: Props) {
}, []);
const onClickTag = (item: ListTagResp) => {
if (userInfo!.companyAuthStatus) {
router.replace({ pathname: '/JoinPolicy', query: { tagId: item.id } });
props.onCancel && props.onCancel();
} else {
router.push('/certification');
}
commonApi.userInfo().then((res) => {
setUserInfo(res.result);
if (res.result!.companyAuthStatus) {
router.replace({ pathname: '/JoinPolicy', query: { tagId: item.id } });
props.onCancel && props.onCancel();
} else {
router.push('/certification');
}
});
};
return (
<Modal
......
......@@ -106,7 +106,12 @@ export default function PublishModal(props: Props) {
name='requireDescription'
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>
<Button
......
......@@ -214,7 +214,7 @@ export default function EquipmentLeasingDetail() {
<span className='menoy-right'>/天起</span>
</div>
) : (
<div className='menoy'>暂无报价</div>
<div className='menoy'>获取报价</div>
)}
<div className='classification'>
......
......@@ -47,7 +47,7 @@ export default function EquipmentLeasing(props: Props) {
<span className='unit'>/天起</span>
</div>
) : (
<div className='unit'>暂无报价</div>
<div className='unit'>获取报价</div>
)}
</div>
</div>
......
......@@ -15,9 +15,9 @@ export interface Dynamic {
lat: number;
lon: number;
mediaVO: {
picture: string[];
videoUrl: string;
};
type: number;
url: string;
}[];
likesCount: number;
commentCount: number;
likes: boolean;
......@@ -44,18 +44,19 @@ export interface CommentParams {
export interface ByDynamicResp {
id: number;
dynamicId: number;
parentId: number;
userId: number;
content: string;
description: string;
likesCount: number;
createTime: string;
dynamicPublishTime: string;
children: ByDynamicResp[];
userBaseInfoVO: {
userBaseInfo: {
id: number;
nickName: string;
userImg: string;
};
mediaVO: { type: number; url: string };
}
export interface dynamicDetail extends ByDynamicResp {
commentAndReplyVO: ByDynamicResp[];
}
export default {
......@@ -73,9 +74,9 @@ export default {
return request('/release/dynamic/comment', 'post', params);
},
//根据动态查看评论
byDynamic(params: { dynamicId: number }): Promise<Response<Array<ByDynamicResp>>> {
return request('/release/dynamic/byDynamic', 'get', params);
//动态详情
byDynamic(params: { dynamicId: number }): Promise<Response<dynamicDetail>> {
return request('/release/dynamic/dynamicDetails', 'get', params);
},
//点赞或取消点赞
......
......@@ -136,7 +136,7 @@ export default function PublishMessage(props: Props) {
allowClear
showCount
placeholder='输入内容'
maxLength={100}
maxLength={256}
style={{ height: 120, resize: 'none' }}
></Input.TextArea>
</Form.Item>
......
......@@ -60,6 +60,7 @@
margin-bottom: 16px;
padding-right: 10px;
line-height: 1.2;
word-break: break-all;
}
}
......
......@@ -81,7 +81,7 @@ export default function Forum() {
})
.then((res) => {
if (res?.code === '200') {
item.commentList = res.result || [];
item.commentList = res.result?.commentAndReplyVO || [];
}
const temp = [...list];
setList(temp);
......@@ -169,28 +169,40 @@ export default function Forum() {
<div className={styles.name}>{item.userBaseInfo?.nickName}</div>
<div className={styles.desc}>{item.description}</div>
<div className={styles.imgs}>
<Image.PreviewGroup
preview={{
onChange: (current, prev) =>
console.log(`current index: ${current}, prev index: ${prev}`),
}}
>
<Space size={6} wrap>
{item?.mediaVO?.picture?.map((img) => {
return (
<Image
key={img}
alt=''
className='img'
width={132}
height={132}
src={img}
fallback={errImg}
/>
);
})}
</Space>
</Image.PreviewGroup>
<Space size={6} wrap>
{item?.mediaVO?.map((v, index: number) =>
v.type === 0 ? (
<Image
key={index}
alt=''
className='img'
width={132}
height={132}
src={v.url}
fallback={errImg}
/>
) : (
<video
src={v.url}
controls
style={{ width: '132px', height: '132px' }}
/>
),
)}
</Space>
{/*<Image.PreviewGroup*/}
{/*>*/}
{/* <Space size={6} wrap>*/}
{/* {item?.mediaVO*/}
{/* ?.filter((v) => v.type === 0)*/}
{/* ?.map((img, index: number) => {*/}
{/* return (*/}
{/* );*/}
{/* })}*/}
{/* </Space>*/}
{/*</Image.PreviewGroup>*/}
</div>
<div className={styles.ctrls}>
<div className={styles.ctrlsItem} onClick={() => openComment(item)}>
......@@ -253,17 +265,19 @@ export default function Forum() {
return (
<div key={comment.id} className={styles.commentItem}>
<div className={styles.commentHeadImg}>
<Image src={comment.userBaseInfoVO?.userImg}></Image>
<Image src={comment.userBaseInfo?.userImg}></Image>
</div>
<div className={styles.info}>
<div className={styles.nameWrap}>
<div className={styles.commentName}>
{comment.userBaseInfoVO?.nickName}
{comment.userBaseInfo?.nickName}
<div className={styles.date}>
{moment(comment.createTime).format('YYYY-MM-DD')}
{moment(comment.dynamicPublishTime).format('YYYY-MM-DD')}
</div>
</div>
<div className={styles.commentContent}>{comment.content}</div>
<div className={styles.commentContent}>
{comment.description}
</div>
</div>
</div>
</div>
......
......@@ -116,6 +116,7 @@ export interface NewsTenderType {
tenderPrice: number;
createTime: string;
apply: number;
tenderTitle: string;
}
export interface ListPageNewsInfoResp {
......
......@@ -17,6 +17,7 @@ import api, {
listNewsApi,
mallApi,
} from './api';
import { bigNumberTransform } from '~/utils/money';
interface ColumnsType {
title: string;
......@@ -428,15 +429,15 @@ export default function WaterfallFlowBody() {
<div className='body'>
{list?.map((item) => (
<div key={item.id} className='body-item'>
<div className='item-label' title={item.tenderContent}>
{item.tenderContent}
<div className='item-label' title={item.tenderTitle}>
{item.tenderTitle}
<div className='label-bottom'>{item.tenderPrice}</div>
</div>
<div
className={`item-right ${item.apply ? 'apply' : ''}`}
onClick={() => handleTenderApply(item)}
>
<div className='left'>{`${item.tenderPrice}W`}</div>
<div className='left'>{bigNumberTransform(item.tenderPrice * 10000, true)}</div>
{item.apply ? (
<div className='right'>已申请</div>
) : (
......
......@@ -294,12 +294,12 @@ export const Box = styled.div`
height: 22px;
line-height: 22px;
font-size: 11px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #ff4500;
text-align: center;
left: 4px;
top: 0;
white-space: nowrap;
}
.right {
width: 48px;
......
import { RightOutlined } from '@ant-design/icons';
import { Col, Row, Space, Image } from 'antd';
import { Col, Row } from 'antd';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import errImg from '~/assets/errImg';
import Layout from '~/components/layout';
import newsApi, { Item } from '../components/news/api';
import api, { DetailsResp } from './api';
......@@ -70,11 +69,12 @@ export default function CaseArticle() {
<Col flex='auto'>
<div className={styles.font1}>{data?.caseTitle}</div>
<div className={styles.font2} style={{ marginTop: 18, marginBottom: 41 }}>
{data?.createTime && Moment(data?.createTime).format('YYYY-MM-DD')} ·{' '}
{data?.caseAuthor}
{data?.createTime && Moment(data?.createTime).format('YYYY-MM-DD')} ·作者:
{data?.caseAuthor || '不详'}
</div>
<div
style={{ lineHeight: 1.5 }}
className={styles.richText}
dangerouslySetInnerHTML={{ __html: data?.caseContents || '' }}
></div>
</Col>
......
......@@ -37,3 +37,9 @@
.ellipse1 {
@include ellipsis(1);
}
.richText{
img{
max-width: 100%;
height: auto;
}
}
......@@ -25,6 +25,7 @@ export interface Item {
tenderPrice: number;
createTime: string;
apply: 0 | 1;
tenderTitle: string;
}
export interface ApplyParams {
......
......@@ -8,7 +8,14 @@
border-bottom: 1px dashed RGBA(222, 222, 222, 1);
justify-content: space-between;
align-items: center;
cursor: pointer;
&:hover {
.info{
.title{
color: red;
}
}
}
.info {
.title {
font-size: 14px;
......
......@@ -3,6 +3,8 @@ import { useState, useEffect, useContext } from 'react';
import { UserContext } from '~/lib/userProvider';
import api, { Item } from './api';
import styles from './index.module.scss';
import { bigNumberTransform } from '~/utils/money';
import { useRouter } from 'next/router';
type Props = {
params?: {
......@@ -14,6 +16,7 @@ type Props = {
};
export default function Bids(props: Props) {
const router = useRouter();
const [list, setList] = useState<Array<Item>>([]);
const [pageParams, setPageParams] = useState({
pageNo: 1,
......@@ -78,24 +81,32 @@ export default function Bids(props: Props) {
setNeedLogin(true);
}
};
//招标项目详情
const toTenderProjectsDetail = (item: Item) => {
router.push('/projectInfo/tenderProjectsDetail/' + item.tenderNewsId);
};
return (
<Spin spinning={loading} delay={500}>
<div className={styles.bids} style={{ height: 610 }}>
{list.map((item) => {
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.title}>{item.tenderContent}</div>
<div className={styles.title}>{item.tenderTitle}</div>
</div>
{item.apply ? (
<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>
</Button>
) : (
<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>
......
......@@ -11,11 +11,13 @@
align-items: center;
.info {
flex: 1;
.title {
font-size: 14px;
font-family: MicrosoftYaHeiUI-Bold, MicrosoftYaHeiUI;
color: #3c3e42;
width: 649px;
white-space: nowrap;
text-overflow: ellipsis;
@include ellipsis(1);
}
.desc {
......
......@@ -70,7 +70,9 @@ export default function Cases(props: Props) {
<div className={styles.title}>
<Button
type='link'
style={{ padding: '0 0' }}
style={{
padding: '0 0',
}}
onClick={() => Router.push('/projectInfo/caseArticle/' + item.id)}
>
{item.caseTitle}
......
......@@ -11,7 +11,14 @@
display: flex;
border-bottom: 1px dashed RGBA(222, 222, 222, 1);
align-items: center;
cursor: pointer;
&:hover {
.info{
.title{
color: red;
}
}
}
.logo {
width: 120px;
height: 80px;
......
......@@ -3,8 +3,7 @@ import styles from './index.module.scss';
import Image from 'next/image';
import { useState, useEffect, useContext } from 'react';
import api, { Item } from './api';
import Router from 'next/router';
import Moment from 'moment';
import Router, { useRouter } from 'next/router';
import { UserContext } from '~/lib/userProvider';
type Props = {
......@@ -17,6 +16,7 @@ type Props = {
};
export default function News(props: Props) {
const router = useRouter();
const [loading, setLoading] = useState(false);
const [list, setList] = useState<Array<Item>>([]);
const [pageParams, setPageParams] = useState({
......@@ -73,14 +73,17 @@ export default function News(props: Props) {
setNeedLogin(true);
}
};
//新闻点击
const newsClick = (item: Item) => {
router.push('/projectInfo/newsArticle/' + item.id);
};
return (
<Spin spinning={loading} delay={500}>
<Row justify='space-between' style={{ height: 606 }}>
<Col className={styles.new}>
{list.map((item) => {
return (
<div className={styles.item} key={item.id}>
<div className={styles.item} key={item.id} onClick={() => newsClick(item)}>
<Image
className={styles.logo}
src={item.surfaceImg}
......@@ -90,9 +93,14 @@ export default function News(props: Props) {
></Image>
<div className={styles.info}>
<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}>
{Moment().format('yyyy-MM-DD')} · {item.newsAuthor}
{item.createTime} · 作者:{item.newsAuthor}
</div>
</div>
{/*<Button*/}
......
import { RightOutlined } from '@ant-design/icons';
import { Col, Row, Space, Image } from 'antd';
import { Col, Row } from 'antd';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import errImg from '~/assets/errImg';
import Layout from '~/components/layout';
import newsApi, { Item } from '../components/news/api';
import api, { DetailsResp } from './api';
......@@ -70,11 +69,12 @@ export default function CaseArticle() {
<Col flex='auto'>
<div className={styles.font1}>{data?.newsTitle}</div>
<div className={styles.font2} style={{ marginTop: 18, marginBottom: 41 }}>
{data?.createTime && Moment(data?.createTime).format('YYYY-MM-DD')} ·{' '}
{data?.newsAuthor}
{data?.createTime && Moment(data?.createTime).format('YYYY-MM-DD')} ·作者:
{data?.newsAuthor || '不详'}
</div>
<div
style={{ lineHeight: 1.5 }}
className={styles.richText}
dangerouslySetInnerHTML={{ __html: data?.newsContents || '' }}
></div>
</Col>
......
......@@ -3,7 +3,6 @@ import request, { Response } from '~/api/request';
export interface DetailsParams {
id: number;
}
export interface DetailsResp {
id: number;
newsTitle?: string;
......
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({
tenderNewsId: id,
pageNo: 1,
pageSize: 10,
})
.then((res) => {
setData(res.result?.list[0]);
});
}
}, [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 {
tenderNewsId: number;
pageNo: number;
pageSize: number;
}
export interface DetailsResp {
id: number;
tenderTitle?: string;
tenderPrice?: number;
tenderContent?: string;
createTime?: string;
}
export interface ListTenderPageResp {
pageNo: number;
pageSize: number;
list: DetailsResp[];
totalCount: number;
totalPage: number;
}
export default {
//招标详情
details(params: DetailsParams): Promise<Response<ListTenderPageResp>> {
return request('/release/tender/info', '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);
}
\ No newline at end of file
// @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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论