From 3d99d1680c681818f2384ee8701818f3d4edab2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E7=8E=89=E7=90=B3?= <1584592841@qq.com> Date: Thu, 21 Jul 2022 09:34:53 +0800 Subject: [PATCH] 1 --- src/App.js | 41 +++-------------- .../homeOut/CreateOutApplication.js | 30 ++++++------- .../homeTrading/CreateTradingApplication.js | 42 +++++++++--------- .../userMessageCenter/MessageCenter.js | 44 +++++++++---------- src/userPages/IntoHomePage.js | 4 +- 5 files changed, 65 insertions(+), 96 deletions(-) diff --git a/src/App.js b/src/App.js index 5ead832..708657a 100644 --- a/src/App.js +++ b/src/App.js @@ -6,43 +6,12 @@ import axios from "axios"; // axios.defaults.baseURL = "http://localhost:80"; axios.interceptors.request.use((config) => { - // console.log(config); - - config.headers.token = localStorage.getItem('token'); - - return config; - - }) + config.headers.token = localStorage.getItem("token"); - /* - router.beforeEach((to, form, next) => { - // to要跳转到的路径 - // from从哪个路径来 - // next往下执行的回调 - // 在localStorage中获取信息 - if (to.name !== 'login') { - store.dispatch('getLayoutConfigInfo').then(() => { - next(); - }); - } else { - next(); - } - let a = localStorage.getItem('username') - let b = ['pageConfig','indexConfig','classConfig','stationConfig'] - if (a!='admin'&&b.includes(to.name)) { - //满足条件进行判断 跳转 - ElementUI.Message.error('无权限访问此页面') - next({ - path:"/fixture" - }) - - } else { - next(); - } - }); -*/ + return config; +}); function App() { return ( @@ -56,8 +25,8 @@ function App() { } /> } /> - }/> - }/> + } /> + } /> diff --git a/src/userComponents/userManageCenter/homeOut/CreateOutApplication.js b/src/userComponents/userManageCenter/homeOut/CreateOutApplication.js index 94b6465..471226f 100644 --- a/src/userComponents/userManageCenter/homeOut/CreateOutApplication.js +++ b/src/userComponents/userManageCenter/homeOut/CreateOutApplication.js @@ -115,7 +115,7 @@ const CreateOutApplication=()=>{ console.log(error.config); }); - + },[]); const addGoodsItem = () => { @@ -124,18 +124,18 @@ const CreateOutApplication=()=>{ { inventoryNum: null, inventoryProduct: null, inventoryProductName: null, inventoryPosition:null, inventoryRepository:null, inventoryOwner:userIc}, ]); }; - //inventoryPosition:null, inventoryRepository:null, + //inventoryPosition:null, inventoryRepository:null, const removeGoodsItem = (e, index) => { e.stopPropagation(); let newList = [...productVOList]; newList.splice(index, 1); setProductVOList([...newList]); }; - - + + const onSubmit=(event)=>{ console.log(productVOList); - + axios({ method: 'post', url: '/user/userhome/manage/outstorage/order', @@ -152,7 +152,7 @@ const CreateOutApplication=()=>{ .catch(function (error) { console.log(error.config); }); - + } const getPosition=(a,b)=>{ @@ -183,7 +183,7 @@ const CreateOutApplication=()=>{
- +

@@ -193,7 +193,7 @@ const CreateOutApplication=()=>{
*/} - +

@@ -202,7 +202,7 @@ const CreateOutApplication=()=>{ {productVOList.map((item, index) => ( - +
- + - { let newList = [...productVOList]; @@ -279,10 +279,10 @@ const CreateOutApplication=()=>{ - +


- +

@@ -294,12 +294,12 @@ const CreateOutApplication=()=>{
确定
- + ]}>

您已提交申请,即将返回主界面。

- + ) } diff --git a/src/userComponents/userManageCenter/homeTrading/CreateTradingApplication.js b/src/userComponents/userManageCenter/homeTrading/CreateTradingApplication.js index f6cec7e..d048492 100644 --- a/src/userComponents/userManageCenter/homeTrading/CreateTradingApplication.js +++ b/src/userComponents/userManageCenter/homeTrading/CreateTradingApplication.js @@ -93,7 +93,7 @@ const CreateTradingApplication=()=>{ } }) .then(response=> { - + setUserIc(response.data.data.userIC); return axios({ method: 'post', @@ -115,17 +115,17 @@ const CreateTradingApplication=()=>{ console.log(error.config); }); - - + + },[]); const addGoodsItem = () => { setProductVOList([ ...productVOList, - { inventoryNum: null, inventoryProduct: null, inventoryProductName: null, inventoryOwner:userIc }, + { inventoryNum: null, inventoryProduct: null, inventoryProductName: null, inventoryPosition:null, inventoryRepository:null, inventoryOwner:userIc }, ]); }; - + const removeGoodsItem = (e, index) => { e.stopPropagation(); let newList = [...productVOList]; @@ -136,7 +136,7 @@ const CreateTradingApplication=()=>{ const onSubmit=(event)=>{ console.log(productVOList); console.log(userIc); - + axios({ method: 'post', url: '/user/userhome/manage/trading/order', @@ -144,12 +144,12 @@ const CreateTradingApplication=()=>{ params:{ order_buyer:orderBuyer, } - + //orderCreatetime: "2022-07-14T07:47:57.850Z", //orderCreatetime:time, - + //inventoryList:this.state.productVOList, - + }) .then(response=> { console.log(response); @@ -162,7 +162,7 @@ const CreateTradingApplication=()=>{ .catch(function (error) { console.log(error.config); }); - + } const getPosition=(a,b)=>{ @@ -170,13 +170,13 @@ const CreateTradingApplication=()=>{ let position=data[0].inventoryPosition; return position; } - + const getRepository=(a,b)=>{ let data=allData.filter(item=>item.inventoryProductName==a&&item.inventoryProduct==b); let repository=data[0].inventoryRepository; return repository; } - + const getAmount=(a,b)=>{ let data=allData.filter(item=>item.inventoryProductName==a&&item.inventoryProduct==b); let amount=data[0].inventoryNum; @@ -201,12 +201,12 @@ const CreateTradingApplication=()=>{
*/} - +


- +
{setOrderBuyer(e.target.value)}} className='rounded-md outline outline-1 outline-gray-700 relative inset-x-1 w-44'> @@ -214,7 +214,7 @@ const CreateTradingApplication=()=>{ {productVOList.map((item, index) => ( - +
- + - { let newList = [...productVOList]; @@ -289,10 +291,10 @@ const CreateTradingApplication=()=>{ - +


- +


@@ -304,7 +306,7 @@ const CreateTradingApplication=()=>{
确定
- + ]}>

您已提交申请,即将返回主界面。

diff --git a/src/userComponents/userMessageCenter/MessageCenter.js b/src/userComponents/userMessageCenter/MessageCenter.js index b354fad..c3bebbf 100644 --- a/src/userComponents/userMessageCenter/MessageCenter.js +++ b/src/userComponents/userMessageCenter/MessageCenter.js @@ -10,7 +10,7 @@ import { EventSourcePolyfill } from 'event-source-polyfill'; -const MessageCenter=forwardRef((props, ref)=>{ +const MessageCenter=()=>{ const [userIc,setUserIc]=useState(null); //const [isok,setIsok]=useState(true); useEffect(() => { @@ -45,45 +45,43 @@ const MessageCenter=forwardRef((props, ref)=>{ console.log(error.config); }); - + },[]); - - - const evtSource = new EventSourcePolyfill('http://10.133.128.40:8088/sse/connect/'+userIc, { + + + const evtSource = new EventSourcePolyfill('http://localhost:8088/sse/connect/'+userIc, { headers: { token:localStorage.getItem('token'), } }); - + //var evtSource=new EventSource('http://localhost/sse/connect'+userIc); - if(props.isok){ evtSource.onopen = function(event){ console.log("ok"); }; evtSource.addEventListener("msg", function(event){ console.log(evtSource.readyState); - console.log(props.isok); var result = document.getElementById("result").innerText; result +='\n' + " message:" + event.data; document.getElementById("result").innerText=result; }) - + evtSource.onerror = function(event) { console.log("no"); evtSource.close(); console.log(evtSource.readyState); }; - - } - - - - + + + + + + useEffect(()=>{ console.log('useEffect=>Index') @@ -98,11 +96,11 @@ const MessageCenter=forwardRef((props, ref)=>{ method: 'get', url: '/sse/close/'+userIc, //headers: {'Authorization': localStorage.getItem('token')}, - + params:{ token:localStorage.getItem('token'), } - + }) .then(response=> { console.log(response); @@ -169,12 +167,12 @@ const MessageCenter=forwardRef((props, ref)=>{ }) } */ - + // return(
- - + +
@@ -193,7 +191,7 @@ const MessageCenter=forwardRef((props, ref)=>{
- +
@@ -201,11 +199,11 @@ const MessageCenter=forwardRef((props, ref)=>{
) -}) +} /* class MessageCenter extends React.Component{ - + render(){ return(
diff --git a/src/userPages/IntoHomePage.js b/src/userPages/IntoHomePage.js index f4cffb0..8afc6d1 100644 --- a/src/userPages/IntoHomePage.js +++ b/src/userPages/IntoHomePage.js @@ -37,10 +37,10 @@ const Into=()=> { } />} /> }/> }/> - } /> + } />
- +
); } -- Gitee