Commit 1f80c3e0 authored by maple's avatar maple

[fix]修改跨域请求PDF文件

parent d62b9539
...@@ -14,8 +14,8 @@ export default defineConfig({ ...@@ -14,8 +14,8 @@ export default defineConfig({
hmr: true, hmr: true,
}, },
locale: { locale: {
// default zh-CN // default zh-CN //zh-CN
default: 'zh-CN', default: 'en-US',
// default true, when it is true, will use `navigator.language` overwrite default // default true, when it is true, will use `navigator.language` overwrite default
antd: true, antd: true,
baseNavigator: true, baseNavigator: true,
...@@ -245,7 +245,7 @@ export default defineConfig({ ...@@ -245,7 +245,7 @@ export default defineConfig({
// @ts-ignore // @ts-ignore
title: false, title: false,
ignoreMomentLocale: true, ignoreMomentLocale: true,
proxy: proxy[REACT_APP_ENV || 'dev'], proxy: proxy[REACT_APP_ENV || 'pre'],
manifest: { manifest: {
basePath: '/', basePath: '/',
}, },
......
...@@ -22,9 +22,19 @@ export default { ...@@ -22,9 +22,19 @@ export default {
}, },
pre: { pre: {
'/api/': { '/api/': {
target: 'your pre url', target: 'http://localhost:8080',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
'/res/': {
target: 'http://mapleonlyone.top',
changeOrigin: true,
pathRewrite: { '^': '' },
},
'/cash/tos-manager/bill/': {
target: 'http://acc-huahui.oss-cn-shenzhen.aliyuncs.com',
changeOrigin: true,
pathRewrite: { '^': '' },
}
}, },
}; };
import * as service from '../services/ServiceProviderServices';
import { message } from 'antd';
import { routerRedux } from 'dva/router'
export default {
namespace: 'ServiceProvider',
state: {
Data: '',
},
reducers: {
returnPage(state, { Data }) {
return { ...state, Data };
},
},
effects: {
*create({playload}, { call, put }){
const resp = yield call(service.create, playload);
console.log(resp)
let Data = resp;
message.success("create success!", 2);
//yield put({ type: 'returnPage', Data, });
yield put(routerRedux.push('/UserManagement/ServiceProviderManagement'));
},
*get({playload}, { call, put }){
const resp = yield call(service.create, playload);
console.log(resp)
let Data = resp;
yield put({ type: 'returnPage', Data, });
},
},
};
import { message } from 'antd';
import * as service from '../services/ServiceProviderServices';
export default {
namespace: 'Bom',
state: {
Data: '',
},
reducers: {
returnQuery(state, { Data }) {
return { ...state, Data };
},
},
effects: {
*query({ }, { call, put }) {
console.log("1")
const resp = yield call(service.create);
let Data=resp;
yield put({type: 'returnQuery',Data,});
},
},
subscriptions: {
setup({dispatch, history, query, store,}) {
return history.listen(({ pathname, search }) => {});
},
},
};
...@@ -8,6 +8,7 @@ import { Link, useIntl, connect, Dispatch } from 'umi'; ...@@ -8,6 +8,7 @@ import { Link, useIntl, connect, Dispatch } from 'umi';
import PDF from 'react-pdf-js';// import PDF from 'react-pdf-js';//
import { render } from 'react-dom'; import { render } from 'react-dom';
import { Document } from 'react-pdf/dist/entry.webpack';
const ChargeDetail = () => { const ChargeDetail = () => {
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
...@@ -65,15 +66,17 @@ const ChargeDetail = () => { ...@@ -65,15 +66,17 @@ const ChargeDetail = () => {
scale == 1.3 ? ( scale == 1.3 ? (
<Tooltip title="点击放大查看"> <Tooltip title="点击放大查看">
<div className={styles.box3out}> <div className={styles.box3out}>
<div className={styles.box3} onClick={lookup}> <div className={styles.box3} onClick={lookup}>
<PDF key="pdfjs" file="test2.pdf" cMapUrl="http://127.0.0.1:80/" workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.worker.js" scale={scale} page={curpage} onDocumentComplete={pdfpages} /> {/* <Document file="http://localhost:8000/test2.pdf" /> */}
<PDF key="pdfjs" file="/cash/tos-manager/bill/B1-21-1002.pdf?Expires=1911893716&OSSAccessKeyId=LTAI4FxB6SgPMtnJ7UpcATA6&Signature=c72T%2B6BrcHcqXeXdMY%2BuBNZmgCw%3D" workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.worker.js" scale={scale} page={curpage} onDocumentComplete={pdfpages} />
</div> </div>
</div> </div>
</Tooltip> </Tooltip>
) : ( ) : (
<Tooltip title="还原视图"> <Tooltip title="还原视图">
< div className={ styles.box3of } onClick={ lookup } > < div className={ styles.box3of } onClick={ lookup } >
<PDF key="pdfjs" file="test2.pdf" cMapUrl="http://127.0.0.1:80/" workerSrc = '//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.worker.js' scale={scale} page={curpage} onDocumentComplete={pdfpages} /> {/* <PDF key="pdfjs" file="test2.pdf" cMapUrl="http://127.0.0.1:80/" workerSrc = '//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.228/pdf.worker.js' scale={scale} page={curpage} onDocumentComplete={pdfpages} /> */}
</div> </div>
</Tooltip> </Tooltip>
) )
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
} }
.box0{ .box0{
position: absolute; position: absolute;
left: 978px; right: 0;
} }
.box0item1{ .box0item1{
width:108px; width:108px;
......
...@@ -51,7 +51,8 @@ const Template = () => { ...@@ -51,7 +51,8 @@ const Template = () => {
key: 'action', key: 'action',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<Space size="middle"> <Space size="middle">
<a>详情</a> <a>详情</a>|
<a>编辑</a>
</Space> </Space>
), ),
}, },
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
.item1{ .item1{
position: absolute; position: absolute;
width: 400px; width: 400px;
text-align: center; text-indent: 8px;
border-left: 5px solid rgba(24,144,255,1); border-left: 5px solid rgba(24,144,255,1);
font-family:'Source Han Sans CN'; font-family:'Source Han Sans CN';
font-size: 18px; font-size: 18px;
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './Edit.less'; import styles from './Edit.less';
import { Input ,Button,Table,Space,Pagination,Tooltip, Checkbox } from 'antd'; import { Input ,Button,Form,Result,Pagination,Tooltip, Checkbox } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { Link, useIntl, connect } from 'umi';
import SelectOptions from '../../../components/SelectOptions/index'; import SelectOptions from '../../../components/SelectOptions/index';
const Template = () => { const Edit= (props:any) => {
const { dispatch, Data } = props;
const ServiceProviderCreate = (values:any) => {
dispatch({
type: 'ServiceProvider/create',
playload:values
});
};
const goToReturn = () => { const goToReturn = () => {
history.back() history.back()
...@@ -15,7 +24,17 @@ const Template = () => { ...@@ -15,7 +24,17 @@ const Template = () => {
const printContent = (comment: any)=>{ const printContent = (comment: any)=>{
console.log(comment) console.log(comment)
} }
const onFinish = (values: any) => {
ServiceProviderCreate(values)
console.log('Success:', values);
};
const onFinishFailed = (errorInfo:any) => {
console.log('Failed:', errorInfo);
};
return ( return (
<div className={styles.base}> <div className={styles.base}>
...@@ -24,18 +43,18 @@ const printContent = (comment: any)=>{ ...@@ -24,18 +43,18 @@ const printContent = (comment: any)=>{
<div className={styles.item1}>Edit Service Provider</div> <div className={styles.item1}>Edit Service Provider</div>
<button className={styles.item3} onClick={goToReturn}>返回</button> <button className={styles.item3} onClick={goToReturn}>返回</button>
</div> </div>
<Form name="basic" initialValues={{}} onFinish={onFinish} onFinishFailed={onFinishFailed}>
<div className={styles.box1}> <div className={styles.box1}>
<div className={styles.box1item1}>Company Name</div> <div className={styles.box1item1}>Company Name</div>
<div className={styles.box1item2}><Input style={{width:260}} placeholder="Please enter company name"/></div> <div className={styles.box1item2}><Form.Item name="companyName" ><Input style={{width:260}} placeholder="Please enter company name" /></Form.Item></div>
<div className={styles.box1item3}>Office Address</div> <div className={styles.box1item3}>Office Address</div>
<div className={styles.box1item4}><Input style={{width:200}} placeholder="Single Line Input"/></div> <div className={styles.box1item4}><Form.Item name="address"><Input style={{width:200}} placeholder="Single Line Input"/></Form.Item></div>
</div> </div>
<div className={styles.line}></div> <div className={styles.line}></div>
<SelectOptions list={["美国", "美丽的", "美好", "加拿大", "加油", "XO"].sort()} onSubmit={printContent} /> <SelectOptions list={["美国", "美丽的", "美好", "加拿大", "加油", "XO"].sort()} onSubmit={printContent} />
<div className={styles.box2}> <div className={styles.box2}>
...@@ -45,24 +64,36 @@ const printContent = (comment: any)=>{ ...@@ -45,24 +64,36 @@ const printContent = (comment: any)=>{
<div className={styles.box3}> <div className={styles.box3}>
<div className={styles.box3item1}>Person In Charge</div> <div className={styles.box3item1}>Person In Charge</div>
<div className={styles.box3item2}><Input style={{width:200}} placeholder="Please enter a name"/></div> <div className={styles.box3item2}><Form.Item name="name"><Input style={{width:200}} placeholder="Please enter a name"/></Form.Item></div>
</div> </div>
<div className={styles.box4}> <div className={styles.box4}>
<div className={styles.box4item1}>Contact Details</div> <div className={styles.box4item1}>Contact Details</div>
<div className={styles.box4item2}><Input style={{width:200}} placeholder="Telephone"/></div> <div className={styles.box4item2}><Form.Item name="phone"><Input style={{width:200}} placeholder="Telephone"/></Form.Item></div>
<div className={styles.box4item3}><Input style={{width:200}} placeholder="E-mail"/></div> <div className={styles.box4item3}><Form.Item name="mailbox"><Input style={{width:200}} placeholder="E-mail"/></Form.Item></div>
</div> </div>
<div className={styles.line}></div> <div className={styles.line}></div>
<Button type="primary" size="large">提交</Button> <Form.Item>
<Button type="primary" size="large" htmlType="submit">提交</Button>
</Form.Item>
</Form>
</div> </div>
); );
}; };
function mapStateToProps(state:any) {
const { Data } = state.ServiceProvider;
return {
Data
};
}
export default Template; export default connect(mapStateToProps)(Edit);
\ No newline at end of file
...@@ -79,7 +79,8 @@ const ServiceProviderManagement = (props: { location: any; }) => { ...@@ -79,7 +79,8 @@ const ServiceProviderManagement = (props: { location: any; }) => {
key: 'action', key: 'action',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<Space size="middle"> <Space size="middle">
<a onClick={goToDetail}>详情</a> <a onClick={goToDetail}>详情</a>|
<a onClick={goToDetail}>编辑</a>
</Space> </Space>
), ),
}, },
...@@ -112,4 +113,4 @@ const ServiceProviderManagement = (props: { location: any; }) => { ...@@ -112,4 +113,4 @@ const ServiceProviderManagement = (props: { location: any; }) => {
}; };
export default ServiceProviderManagement; export default (ServiceProviderManagement);
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './index.less'; import styles from './index.less';
import { Input ,Menu,Table,Space,Pagination,Tooltip, Button } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { Link, useIntl, connect } from 'umi';
import Line from '../../components/Line/Line'; import { Button, } from 'antd';
const UsersDetail = () => { const Bom = (props: any) => {
const { dispatch, Data } = props;
const gotoReturn=() => { const test = () => {
history.back() dispatch({
type: 'Bom/query',
});
} }
return ( return (
<div className={styles.base}> <>
<Button onClick={test}>TEST</Button>
{/* 头部组件 */}
<div className={styles.box}>
<div className={styles.item1}>Owner Details</div> </>
<button className={styles.item3} onClick={gotoReturn}>返回</button>
</div>
<div className={styles.box1}>
<div className={styles.box1item1}>Owner's Name</div>
<div className={styles.box1item2}><Input style={{width:200}} placeholder="Single Line Input" /></div>
</div>
<div className={styles.box2}>
<div className={styles.box2item1}>Contact Details</div>
<div className={styles.box2item2}><Input.Search style={{width:200}} placeholder="Project Name"/></div>
<div className={styles.box2item3}><Input style={{width:94}}/></div>
<div className={styles.box2item4}>#</div>
<div className={styles.box2item5}><Input style={{width:80}} /></div>
<div className={styles.box2item6}>——</div>
<div className={styles.box2item7}><Input style={{width:112}}/></div>
</div>
<div className={styles.box3}>
<div className={styles.box3item1}>
<Input style={{width:680}} placeholder="Display the address and postcode automatically according to the"/>
</div>
</div>
<Line />
<Button type="primary" size="large">Submit</Button>
</div>
); );
}; };
function mapStateToProps(state:any) {
const { Data } = state.Bom;
return {
Data
};
}
export default UsersDetail; export default connect(mapStateToProps)(Bom);
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
} }
.item1{ .item1{
position: absolute; position: absolute;
width: 400px; width: 180px;
text-indent: 15px; text-align: center;
border-left: 5px solid rgba(24,144,255,1); border-left: 5px solid rgba(24,144,255,1);
font-family:'Source Han Sans CN'; font-family:'Source Han Sans CN';
font-size: 18px; font-size: 18px;
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
.box1{ .box1{
width: 100%; width: 100%;
height: 34px; height: 34px;
line-height: 34px;
position: relative; position: relative;
margin-bottom: 28px; margin-bottom: 28px;
} }
...@@ -51,13 +50,13 @@ ...@@ -51,13 +50,13 @@
} }
.box1item2{ .box1item2{
position: absolute; position: absolute;
left: 146px; left: 139px;
} }
.box2{ .box2{
width: 100%; width: 100%;
height: 34px; height: 34px;
line-height: 34px;
position: relative; position: relative;
margin-bottom: 28px; margin-bottom: 28px;
} }
...@@ -66,34 +65,213 @@ ...@@ -66,34 +65,213 @@
} }
.box2item2{ .box2item2{
position: absolute; position: absolute;
left: 146px; left: 139px;
} }
.box2item3{ .box2item3{
position: absolute; position: absolute;
left: 362px; left: 407px;
} }
.box2item4{ .box2item4{
position: absolute; position: absolute;
left: 461px; left: 565px;
} }
.box2item5{ .box2item5{
position: absolute; position: absolute;
left: 475px; left: 713px;
} }
.box2item6{ .box2item6{
position: absolute; position: absolute;
left: 561px; left: 778px;
}
.box3{
position: relative;
margin-bottom: 28px;
} }
.box2item7{
.box3item1{
position: absolute; position: absolute;
left: 583px;
} }
.box3{ .box3item2{
padding-left: 160px;
}
.box3group1{
width: 266px;
height: 100px;
}
.box4{
position: relative;
}
.box4item1{
position: absolute;
}
.box4item2{
padding-left: 160px;
}
.ulist{
float:left;
width:100%;
padding:0;
margin:0;
list-style-type:none;
}
.llist{
display:inline;
}
.alist{
float:left;
width: 160px;
}
.alist1{
position: relative;
width: 100px;
height: 100px;
}
.alist2{
float: left;
width: 326px;
margin-bottom: 20px;
z-index: 1;
}
.alist2box{
width: 100%;
height: 100%;
position: relative;
}
.alist2boxitem1{
position: absolute;
top: -100px;
left: 127px;
}
.alist2boxitem2{
position: absolute;
top: -100px;
left: 180px;
}
.alist2boxitem3{
position: absolute;
top: -40px;
left: 216px;
}
.alist2boxNone{
color: #ffffff;
moz-user-select: -moz-none;
-moz-user-select: none;
-o-user-select:none;
-khtml-user-select:none;
-webkit-user-select:none;
-ms-user-select:none;
user-select:none;
}
.alist3{
z-index: 10;
cursor: pointer;
float: left;
width: 100px;
height: 100px;
background-color: rgba(244,244,244,1);
}
// 线栏
.line{
width: 100%;
height: 1px;
border-top: 1px solid rgba(217,217,217,1);
margin-top: 28px;
margin-bottom: 28px;
}
.box5{
position: relative;
width: 100%; width: 100%;
height: 34px; height: 34px;
margin-bottom: 28px;
}
.box5item1{
position: absolute;
}
.box5item2{
position: absolute;
left: 186px;
}
.box6{
position: relative; position: relative;
line-height: 34px;
width: 100%;
height: 34px;
margin-bottom: 32px;
} }
.box3item1{ .box6item1{
padding-left: 146px; position: absolute;
}
.box6item2{
position: absolute;
left: 186px;
}
.box6item3{
position: absolute;
left: 276px;
}
.box6item4{
position: absolute;
left: 478px;
}
.box6item5{
position: absolute;
left: 569px;
}
.box6item6{
position: absolute;
left: 794px;
}
.box6item7{
position: absolute;
left: 885px;
}
.box7{
position: relative;
width: 100%;
height: 34px;
margin-bottom: 28px;
}
.box7item1{
position: absolute;
left: 186px;
}
.box7item2{
position: absolute;
left: 323px;
}
.box8{
position: relative;
width: 100%;
height: 34px;
}
.box8item1{
position: absolute;
}
.box8item2{
position: absolute;
left: 346px;
}
.box8item3{
position: absolute;
left: 462px;
color: rgba(217,217,217,1);
}
.box8item4{
position: absolute;
left: 502px;
} }
\ No newline at end of file
...@@ -73,7 +73,7 @@ const Template = () => { ...@@ -73,7 +73,7 @@ const Template = () => {
<div className={styles.box1item2}> <div className={styles.box1item2}>
{ {
service.map((item, index) => { service.map((item, index) => {
return (<div key={"service_"+index} className={styles.item2x1} onClick={showModal.bind(this,item)} >{item}</div>) return (<div key={"service_"+index} className={styles.item2x1} onClick={showModal.bind(this,item)} >{item}</div>)
}) })
} }
<div className={styles.item2x3}><PlusCircleOutlined style={{cursor: "pointer",fontSize:30}} onClick={addModal} /></div> <div className={styles.item2x3}><PlusCircleOutlined style={{cursor: "pointer",fontSize:30}} onClick={addModal} /></div>
......
import request from '@/utils/request';
export function create(values: any) {
console.log(values)
return request('/api/ServiceProvider/create',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}})
}
import request from '@/utils/request';
//创建供应商
export function query(values: any) {
console.log("2")
return request('/api/ServiceProvider/create',{method: 'POST',body: JSON.stringify(values),})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment