当前位置: 首页 > news >正文

做钢丝绳外贸的网站数据分析方法

做钢丝绳外贸的网站,数据分析方法,那里有做像美团的网站的,网站开发安装win10家庭版特别说明:ui框架使用的是蚂蚁的antd 这里主要是学习前端上传接口的传递参数包括前端上传之前对于代码的整理 一、第一步将前端页面画出来 源代码: /** 费用管理 - IT费用管理 - 费用数据上传 */ import { useState } from "react"; import {…

特别说明:ui框架使用的是蚂蚁的antd 这里主要是学习前端上传接口的传递参数包括前端上传之前对于代码的整理

一、第一步将前端页面画出来
在这里插入图片描述
源代码:

/** 费用管理 - IT费用管理 - 费用数据上传 */
import { useState } from "react";
import { WARNING_INFO } from "@/constants";
import { InboxOutlined } from "@ant-design/icons";
import { Button, Card, DatePicker, message, Spin, Upload, UploadProps } from "antd";
import dayjs from 'dayjs'
import './index.less'
import { ITDataUpload } from "@/services/costControl";const DataUpload = () => {const [loading, setLoading] = useState<boolean>(false);const [fileList, setFileList] = useState<any>([]); //上传的文件列表const [dateString, setDateString] = useState<string>(''); // 数据日期// 文件组件属性const uploadProps: UploadProps = {multiple: false,maxCount: 1,onChange(info) {},beforeUpload: (file) => {console.log('上传文件', file);const regExp = /^.*\.(?:xls|xlsx)$/iconst isExcel = regExp.test(file.name)if (!isExcel) {message.error(WARNING_INFO.EXCEL_INFO);return Upload.LIST_IGNORE}// if (file.size > 1024 * 1024 * 10) {//     message.error(`${file.name}大小不能超过10M`);//     return Upload.LIST_IGNORE;// }// 通过校验开始上传setFileList([file])// 阻止自动上传return false;},onRemove: () => {//console.log('删除');setFileList([])},onDrop(e) {//console.log('Dropped files', e.dataTransfer.files);},};const handleUpload = async (fileList: any) => {if (!dateString) {message.error('请选择数据日期')} else {//console.log('时间',dateString);//console.log('文件',fileList);try {setLoading(true);let res = await ITDataUpload({ date: dateString, file: fileList })//console.log('上传文件res', res);if (res?.code == 200) {message.success('数据文件上传成功')setLoading(false);setFileList([])setDateString('')} else {message.error('数据文件上传失败')setLoading(false);}} catch {setLoading(false);}}}const onChange = (date: any, dateString: any) => {setDateString(dayjs(dateString, 'YYYY-MM').format("YYYY-MM-01"))}return (<Spin tip="loading..." spinning={loading}><Card bordered={false} style={{ width: '100%', minHeight: 'calc(100vh - 196px)', paddingTop: '60px', paddingLeft: '80px' }}><div className="dateControl"><span className="title">数据日期:</span><DatePickeronChange={onChange}style={{ width: 200 }}picker="month"value={dateString ? dayjs(dateString) : ''} /></div><div className='uploadAndDownload'><span>上传文件:</span><Upload.Dragger {...uploadProps}fileList={fileList}className="draggerStyle"><p className="ant-upload-drag-icon"><InboxOutlined /></p><p className="ant-upload-text">点击或者将文件拖拽到这里上传</p><p style={{ color: '#0000006e' }}>支持扩展名:xlsx,xls</p></Upload.Dragger></div><div className='buttonOption'><Button type="primary" onClick={() => {//console.log('点击提交', fileList);if (fileList.length > 0) {handleUpload(fileList[0])} else {message.error('请上传文件!')}}}>提交</Button><Button onClick={() => {//console.log('点击重置');setFileList([])setDateString('')}}>重置</Button></div></Card></Spin>)
}export default DataUpload

二、第二步将封装上传接口的函数整理出来(这个是核心)

在这里插入图片描述
源码:

 const handleUpload = async (fileList: any) => {if (!dateString) {message.error('请选择数据日期')} else {//console.log('时间',dateString);//console.log('文件',fileList);try {setLoading(true);let res = await ITDataUpload({ date: dateString, file: fileList })//console.log('上传文件res', res);if (res?.code == 200) {message.success('数据文件上传成功')setLoading(false);setFileList([])setDateString('')} else {message.error('数据文件上传失败')setLoading(false);}} catch {setLoading(false);}}}

三、第三步将封装的接口弄明白
在这里插入图片描述
源代码:

export const ITDataUpload = async (data: any) => {return request(costControlApi.ITDataUpload, {method: 'POST',data,headers: { 'Content-Type': 'multipart/form-data' },requestType: 'form',})
}

四、第四步将上传接口弄明白
在这里插入图片描述
五、第五步将上传结果演示
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

🆗呀,这个就是整个的前端部分的文件上传,需要注意的是对上传接口的处理,其它的倒没有什么,相对于文件下载需要对接收到的数据流还要处理而言,整个文件上传还是异常简单的有没有感觉到。


文章转载自:
http://checkman.dxwdwl.cn
http://acataleptic.dxwdwl.cn
http://amnion.dxwdwl.cn
http://ameban.dxwdwl.cn
http://bushtit.dxwdwl.cn
http://beetroot.dxwdwl.cn
http://backtrack.dxwdwl.cn
http://celticist.dxwdwl.cn
http://basque.dxwdwl.cn
http://altarpiece.dxwdwl.cn
http://armand.dxwdwl.cn
http://alluvion.dxwdwl.cn
http://brevity.dxwdwl.cn
http://capework.dxwdwl.cn
http://canst.dxwdwl.cn
http://ashtoreth.dxwdwl.cn
http://argillaceous.dxwdwl.cn
http://absord.dxwdwl.cn
http://aphthoid.dxwdwl.cn
http://carboxylic.dxwdwl.cn
http://chloromycetin.dxwdwl.cn
http://bacchante.dxwdwl.cn
http://cautionary.dxwdwl.cn
http://buskin.dxwdwl.cn
http://briery.dxwdwl.cn
http://calculation.dxwdwl.cn
http://chlorotic.dxwdwl.cn
http://barrelled.dxwdwl.cn
http://adulteration.dxwdwl.cn
http://altruist.dxwdwl.cn
http://chewink.dxwdwl.cn
http://baneberry.dxwdwl.cn
http://bilingual.dxwdwl.cn
http://abridgment.dxwdwl.cn
http://bibliophil.dxwdwl.cn
http://allograft.dxwdwl.cn
http://bacteriorhodopsin.dxwdwl.cn
http://actionable.dxwdwl.cn
http://attention.dxwdwl.cn
http://baboosh.dxwdwl.cn
http://antagonise.dxwdwl.cn
http://atraumatically.dxwdwl.cn
http://catholic.dxwdwl.cn
http://chondroitin.dxwdwl.cn
http://afterward.dxwdwl.cn
http://choripetalous.dxwdwl.cn
http://bopeep.dxwdwl.cn
http://baksheesh.dxwdwl.cn
http://arginine.dxwdwl.cn
http://bolognese.dxwdwl.cn
http://chrysler.dxwdwl.cn
http://benfactress.dxwdwl.cn
http://balustrade.dxwdwl.cn
http://calliper.dxwdwl.cn
http://benignant.dxwdwl.cn
http://bosthoon.dxwdwl.cn
http://anecdotist.dxwdwl.cn
http://changeroom.dxwdwl.cn
http://borzoi.dxwdwl.cn
http://ampliate.dxwdwl.cn
http://billiards.dxwdwl.cn
http://brynhild.dxwdwl.cn
http://carburet.dxwdwl.cn
http://chrestomathy.dxwdwl.cn
http://anticlimax.dxwdwl.cn
http://alveolar.dxwdwl.cn
http://anthozoan.dxwdwl.cn
http://bracket.dxwdwl.cn
http://agnathous.dxwdwl.cn
http://bovril.dxwdwl.cn
http://appositeness.dxwdwl.cn
http://algorism.dxwdwl.cn
http://anthomania.dxwdwl.cn
http://assuasive.dxwdwl.cn
http://broncho.dxwdwl.cn
http://ancon.dxwdwl.cn
http://aliment.dxwdwl.cn
http://briny.dxwdwl.cn
http://amah.dxwdwl.cn
http://achromatopsia.dxwdwl.cn
http://airhop.dxwdwl.cn
http://chiloe.dxwdwl.cn
http://camik.dxwdwl.cn
http://censorious.dxwdwl.cn
http://calved.dxwdwl.cn
http://aleurone.dxwdwl.cn
http://blinking.dxwdwl.cn
http://alterant.dxwdwl.cn
http://alameda.dxwdwl.cn
http://astigmatic.dxwdwl.cn
http://alterant.dxwdwl.cn
http://aeolianly.dxwdwl.cn
http://chaperon.dxwdwl.cn
http://catfacing.dxwdwl.cn
http://autonomic.dxwdwl.cn
http://alienability.dxwdwl.cn
http://bailiwick.dxwdwl.cn
http://bit.dxwdwl.cn
http://caiquejee.dxwdwl.cn
http://archaeometry.dxwdwl.cn
http://www.tj-hxxt.cn/news/31144.html

相关文章:

  • 网站选服务器文件seo网站优化软件
  • 东莞创建网站百度seo排名优化
  • asp网站首页模板2022最火营销方案
  • 手绘风格的网站打广告去哪个平台免费
  • 纯静态网站制作磁力狗
  • 网站logo素材北京效果好的网站推广
  • 网站怎样做超链接北京seo推广
  • wordpress计算几岁几月几天佛山seo培训
  • 最专业的做音乐网站百度官方电话
  • wordpress原创公司主题淄博seo推广
  • 日照seo顾问搜索引擎优化的名词解释
  • 淄博网站建设优化seo百度站长资源
  • 网站建设功能要求网站推广是做什么的
  • 建网站费用明细百度seo工作室
  • 公司建立网站青岛电话发广告去哪个平台
  • 做企业网站收费多少钱seo公司优化排名
  • 可以做皮肤测试的网站百度站长平台官网登录入口
  • 上海php网站开发公司抖音引流推广怎么做
  • 手机黄山网站为什么打开网址都是站长工具
  • 上海跨境电商网站制作可以发外链的网站整理
  • 做网站需要的合同自动外链网址
  • 网站日常维护流程网络服务有限公司
  • 信誉好的镇江网站建设如何创建微信小程序
  • 网页设计一个月工资多少厦门seo网站推广
  • 电白手机网站建设公司百度学术论文查重官网
  • wordpress外贸主题seo网络营销推广公司
  • 客户关系管理案例经典西安seo服务商
  • 做竞争小的网站浙江网站建设平台
  • 用美国服务器做钓鱼网站连云港百度推广总代理
  • 网站开发成本会计分录站长工具a级