Commit 1f80c3e0 authored by maple's avatar maple

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

parent d62b9539
......@@ -14,8 +14,8 @@ export default defineConfig({
hmr: true,
},
locale: {
// default zh-CN
default: 'zh-CN',
// default zh-CN //zh-CN
default: 'en-US',
// default true, when it is true, will use `navigator.language` overwrite default
antd: true,
baseNavigator: true,
......@@ -245,7 +245,7 @@ export default defineConfig({
// @ts-ignore
title: false,
ignoreMomentLocale: true,
proxy: proxy[REACT_APP_ENV || 'dev'],
proxy: proxy[REACT_APP_ENV || 'pre'],
manifest: {
basePath: '/',
},
......
......@@ -22,9 +22,19 @@ export default {
},
pre: {
'/api/': {
target: 'your pre url',
target: 'http://localhost:8080',
changeOrigin: true,
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';
import PDF from 'react-pdf-js';//
import { render } from 'react-dom';
import { Document } from 'react-pdf/dist/entry.webpack';
const ChargeDetail = () => {
const { formatMessage } = useIntl();
......@@ -65,15 +66,17 @@ const ChargeDetail = () => {
scale == 1.3 ? (
<Tooltip title="点击放大查看">
<div className={styles.box3out}>
<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} />
<div className={styles.box3} onClick={lookup}>
{/* <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>
</Tooltip>
) : (
<Tooltip title="还原视图">
< 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>
</Tooltip>
)
......
......@@ -44,7 +44,7 @@
}
.box0{
position: absolute;
left: 978px;
right: 0;
}
.box0item1{
width:108px;
......
......@@ -51,7 +51,8 @@ const Template = () => {
key: 'action',
render: (text: any, record: any) => (
<Space size="middle">
<a>详情</a>
<a>详情</a>|
<a>编辑</a>
</Space>
),
},
......
......@@ -17,7 +17,7 @@
.item1{
position: absolute;
width: 400px;
text-align: center;
text-indent: 8px;
border-left: 5px solid rgba(24,144,255,1);
font-family:'Source Han Sans CN';
font-size: 18px;
......
import React, { useState, useEffect } from 'react';
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';
const Template = () => {
const Edit= (props:any) => {
const { dispatch, Data } = props;
const ServiceProviderCreate = (values:any) => {
dispatch({
type: 'ServiceProvider/create',
playload:values
});
};
const goToReturn = () => {
history.back()
......@@ -15,7 +24,17 @@ const Template = () => {
const printContent = (comment: any)=>{
console.log(comment)
}
const onFinish = (values: any) => {
ServiceProviderCreate(values)
console.log('Success:', values);
};
const onFinishFailed = (errorInfo:any) => {
console.log('Failed:', errorInfo);
};
return (
<div className={styles.base}>
......@@ -24,18 +43,18 @@ const printContent = (comment: any)=>{
<div className={styles.item1}>Edit Service Provider</div>
<button className={styles.item3} onClick={goToReturn}>返回</button>
</div>
<Form name="basic" initialValues={{}} onFinish={onFinish} onFinishFailed={onFinishFailed}>
<div className={styles.box1}>
<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.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 className={styles.line}></div>
<SelectOptions list={["美国", "美丽的", "美好", "加拿大", "加油", "XO"].sort()} onSubmit={printContent} />
<div className={styles.box2}>
......@@ -45,24 +64,36 @@ const printContent = (comment: any)=>{
<div className={styles.box3}>
<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 className={styles.box4}>
<div className={styles.box4item1}>Contact Details</div>
<div className={styles.box4item2}><Input style={{width:200}} placeholder="Telephone"/></div>
<div className={styles.box4item3}><Input style={{width:200}} placeholder="E-mail"/></div>
<div className={styles.box4item2}><Form.Item name="phone"><Input style={{width:200}} placeholder="Telephone"/></Form.Item></div>
<div className={styles.box4item3}><Form.Item name="mailbox"><Input style={{width:200}} placeholder="E-mail"/></Form.Item></div>
</div>
<div className={styles.line}></div>
<Button type="primary" size="large">提交</Button>
<div className={styles.line}></div>
<Form.Item>
<Button type="primary" size="large" htmlType="submit">提交</Button>
</Form.Item>
</Form>
</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; }) => {
key: 'action',
render: (text: any, record: any) => (
<Space size="middle">
<a onClick={goToDetail}>详情</a>
<a onClick={goToDetail}>详情</a>|
<a onClick={goToDetail}>编辑</a>
</Space>
),
},
......@@ -112,4 +113,4 @@ const ServiceProviderManagement = (props: { location: any; }) => {
};
export default ServiceProviderManagement;
export default (ServiceProviderManagement);
import React, { useState, useEffect } from 'react';
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=() => {
history.back()
const test = () => {
dispatch({
type: 'Bom/query',
});
}
return (
<div className={styles.base}>
{/* 头部组件 */}
<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>
<>
<Button onClick={test}>TEST</Button>
</>
);
};
function mapStateToProps(state:any) {
const { Data } = state.Bom;
return {
Data
};
}
export default UsersDetail;
export default connect(mapStateToProps)(Bom);
......@@ -16,8 +16,8 @@
}
.item1{
position: absolute;
width: 400px;
text-indent: 15px;
width: 180px;
text-align: center;
border-left: 5px solid rgba(24,144,255,1);
font-family:'Source Han Sans CN';
font-size: 18px;
......@@ -42,7 +42,6 @@
.box1{
width: 100%;
height: 34px;
line-height: 34px;
position: relative;
margin-bottom: 28px;
}
......@@ -51,13 +50,13 @@
}
.box1item2{
position: absolute;
left: 146px;
left: 139px;
}
.box2{
width: 100%;
height: 34px;
line-height: 34px;
position: relative;
margin-bottom: 28px;
}
......@@ -66,34 +65,213 @@
}
.box2item2{
position: absolute;
left: 146px;
left: 139px;
}
.box2item3{
position: absolute;
left: 362px;
left: 407px;
}
.box2item4{
position: absolute;
left: 461px;
left: 565px;
}
.box2item5{
position: absolute;
left: 475px;
left: 713px;
}
.box2item6{
position: absolute;
left: 561px;
left: 778px;
}
.box3{
position: relative;
margin-bottom: 28px;
}
.box2item7{
.box3item1{
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%;
height: 34px;
margin-bottom: 28px;
}
.box5item1{
position: absolute;
}
.box5item2{
position: absolute;
left: 186px;
}
.box6{
position: relative;
line-height: 34px;
width: 100%;
height: 34px;
margin-bottom: 32px;
}
.box3item1{
padding-left: 146px;
.box6item1{
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 = () => {
<div className={styles.box1item2}>
{
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>
......
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