diff --git a/src/mock/userindex.js b/src/mock/userindex.js
index 25d8fde0d6e3a4f09cd132bc49d4bcca9e9c7e00..adf9b3a60e6e2d4cb1b9f2e1f7e59f4823fba084 100644
--- a/src/mock/userindex.js
+++ b/src/mock/userindex.js
@@ -247,15 +247,17 @@ Mock.mock("/user/userhome/manage/instorage/order", {
"orderPrice|500-1000000":500,
orderSeller:"@cname",
"orderStatus|1":[
- "待完成",
"未支付",
- "已完成",
+ "已支付",
"已取消",
],
"orderType|1":[
"入库",
"出库",
"过户",
+ "入库待办",
+ "过户待办",
+ "出库待办",
],
"orderWeight|500-1000000":500,
"amount|500-1000000":500,
diff --git a/src/userComponents/index.js b/src/userComponents/index.js
index 8fe337ff8b3f00c59854465d419f3c6012f8a805..34cba24da80e599ede4f3e0d991b65a341429735 100644
--- a/src/userComponents/index.js
+++ b/src/userComponents/index.js
@@ -27,6 +27,9 @@ export { default as UserSidebar } from "./userManageCenter/UserSidebar";
export { default as UserInput } from "./userLogin/UserLogin";
export { default as UserRegister } from "./userLogin/UserRegister";
+export { default as VCode } from "./userLogin/VCode";
+
+
export { default as UserHelpSidebar } from "./userHelpCenter/UserHelpSidebar";
export { default as UserHeader } from "./UserHeader";
diff --git a/src/userComponents/userLogin/UserLogin.jsx b/src/userComponents/userLogin/UserLogin.jsx
index 14a15164ac778178814be2c4ac82af5e78d9a9b4..63020618b12e725235c1ceee400a39758070cc15 100644
--- a/src/userComponents/userLogin/UserLogin.jsx
+++ b/src/userComponents/userLogin/UserLogin.jsx
@@ -3,6 +3,9 @@ import React from 'react';
import ReactDOM from 'react-dom/client';
import { AiOutlineUser } from "react-icons/ai";
import { NavLink, Outlet, Navigate } from 'react-router-dom';
+import axios from "axios";
+import Logo from "../../img/logo1.png";
+import { VCode } from '../index';
/*
function LoginSkip(){
@@ -11,6 +14,7 @@ function LoginSkip(){
}
*/
+
class UserInput extends React.Component{
constructor(props){
@@ -18,13 +22,24 @@ class UserInput extends React.Component{
this.state={
userUserName:'',
password:'',
+ inVCode:'',
+ rightVCode:'',
+ imgCode:Logo,
+ result:'',
+ code:'',
+
isInfoRight:false,
}
this.infoChange=this.infoChange.bind(this);
this.psChange=this.psChange.bind(this);
+ //this.vcChange=this.vcChange.bind(this);
this.infoRight=this.infoRight.bind(this);
this.infoFalse=this.infoFalse.bind(this);
this.loginBtn=this.loginBtn.bind(this);
+ //this.setCode=this.setCode.bind(this);
+
+ this.getCode=this.getCode.bind(this);
+ this.login=this.login.bind(this);
}
//修改用户信息和密码
@@ -39,6 +54,33 @@ class UserInput extends React.Component{
});
}
+ getCode(event){
+ axios.get("http://localhost:8081/code",{withCredentials:true}).then(res=>{
+ this.setState({
+ imgCode : res.data
+ })
+ })
+ event.preventDefault();
+ }
+
+ login(){
+ // 登录时发送验证码
+ axios.get("http://localhost:8081/login",{params:{code:this.state.code},withCredentials:true}).then(res=>{
+ this.setState({
+ result : res.data
+ })
+
+ })
+ }
+ /*
+ vcChange(event){
+ this.setState({
+ inVCode:event.target.value,
+ });
+ }
+ */
+
+
infoRight(event){
this.setState({
isInfoRight:true,
@@ -50,10 +92,25 @@ class UserInput extends React.Component{
});
}
+ /*
+ setCode(){
+ const words='AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'
+ let code=''
+ for(let i=0;i<4;i++){
+ code+=words[Math.floor( Math.random()*52)]
+ }
+ this.setState({
+ rightVCode:code,
+ });
+ return code;
+ }
+ */
+
//登录按钮功能
loginBtn(event){
const userUserName=this.state.userUserName;
const password=this.state.password;
+ const inVCode=this.state.inVCode;
if(userUserName==123&&password==123){
this.setState({
@@ -65,8 +122,15 @@ class UserInput extends React.Component{
isInfoRight:false,
});
alert('您的信息或密码错误!')
- event.preventDefault();
+ //event.preventDefault();
}
+ axios.get("http://localhost:8081/login",{params:{code:this.state.code},withCredentials:true}).then(res=>{
+ this.setState({
+ result : res.data
+ })
+
+ })
+ event.preventDefault();
}
render(){
@@ -79,6 +143,28 @@ class UserInput extends React.Component{
+
+ {/**
+
+
+
+
*/}
+
+
+
+
+ {/** 输入验证码: */}
+
+
+
+

+
+
+
+
+
+
验证结果:{this.state.result}
+
diff --git a/src/userComponents/userLogin/UserRegister.js b/src/userComponents/userLogin/UserRegister.js
index 5eaf5bf163a9a3ef999a788572e2d710a3b99666..fc938f9ed63d70786d98acca351c389b6b89c81b 100644
--- a/src/userComponents/userLogin/UserRegister.js
+++ b/src/userComponents/userLogin/UserRegister.js
@@ -6,20 +6,33 @@ class UserRegister extends React.Component{
constructor(props){
super(props);
this.state={
- userUserName:'',
+ userName:'',
+ userUsername:'',
password:'',
passagain:'',
+ userPhonenum:'',
+ userSex:'',
+
}
- this.infoChange=this.infoChange.bind(this);
+ this.nameChange=this.nameChange.bind(this);
+ this.usernameChange=this.usernameChange.bind(this);
this.psChange=this.psChange.bind(this);
this.psagChange=this.psagChange.bind(this);
+ this.phonenumChange=this.phonenumChange.bind(this);
+ this.sexChange=this.sexChange.bind(this);
this.registerBtn=this.registerBtn.bind(this);
}
- infoChange(event){
+ nameChange(event){
+ this.setState({
+ userName:event.target.value,
+ });
+ }
+
+ usernameChange(event){
this.setState({
- userUserName:event.target.value,
+ userUsername:event.target.value,
});
}
@@ -35,9 +48,22 @@ class UserRegister extends React.Component{
});
}
+ phonenumChange(event){
+ this.setState({
+ userPhonenum:event.target.value,
+ });
+ }
+
+ sexChange(event){
+ this.setState({
+ userSex:event.target.value,
+ });
+ }
+
registerBtn(event){
const password=this.state.password;
const passagain=this.state.passagain;
+ console.log(this.state.userName,this.state.userUsername,this.state.userSex);
if(password==passagain){
alert('注册成功!');
event.preventDefault();
@@ -51,12 +77,21 @@ class UserRegister extends React.Component{
return(
diff --git a/src/userComponents/userLogin/VCode.js b/src/userComponents/userLogin/VCode.js
new file mode 100644
index 0000000000000000000000000000000000000000..db6a7b720a6e080bc6711bc013ec26e6fc557108
--- /dev/null
+++ b/src/userComponents/userLogin/VCode.js
@@ -0,0 +1,103 @@
+import React, { Component } from 'react'
+
+export default class VCode extends Component {
+
+ static defaultProps={
+ setCode:()=>"" //更新验证码的方法,返回验证码即可
+ }
+
+ state={
+ contentWidth: 100,
+ contentHeight: 35,
+ codeLength:4,
+ backgroundColorMin: 180,
+ backgroundColorMax:240,
+ fontSizeMin: 25,
+ fontSizeMax: 30,
+ colorMin: 50,
+ colorMax: 160,
+ lineColorMin:40,
+ lineColorMax: 180,
+ dotColorMin: 0,
+ dotColorMax: 255,
+ textStyle:{fontSize:'12px',color:'gray',marginLeft:'6px',cursor:'pointer',padding:'5px',userSelect:"none"}
+ }
+
+ drawPic=(code)=>{
+ let canvas = this.canvas
+ let ctx = canvas.getContext('2d')
+ ctx.fillStyle = this.randomColor(this.state.backgroundColorMin, this.state.backgroundColorMax)
+ ctx.strokeStyle = this.randomColor(this.state.backgroundColorMin, this.state.backgroundColorMax)
+ ctx.fillRect(0, 0, this.state.contentWidth,this.state.contentHeight)
+ ctx.strokeRect(0,0,this.state.contentWidth,this.state.contentHeight)
+ for (let i = 0; i < code.length; i++) {
+ this.drawText(ctx,code[i], i)
+ }
+ this.drawLine(ctx)
+ this.drawDot(ctx)
+ }
+ randomNum=(min, max)=>{
+ return Math.floor(Math.random() * (max - min) + min)
+ }
+ randomColor=(min, max)=>{
+ let r = this.randomNum(min, max)
+ let g = this.randomNum(min, max)
+ let b = this.randomNum(min, max)
+ return 'rgb(' + r + ',' + g + ',' + b + ')'
+ }
+ drawText=(ctx, txt, i)=>{
+ ctx.fillStyle = this.randomColor(this.state.colorMin,this.state.colorMax)
+ ctx.font = this.randomNum(this.state.fontSizeMin,this.state.fontSizeMax) + 'px SimHei'
+ ctx.textBaseline = 'alphabetic'
+ let x = (i + 1) * (this.state.contentWidth / (this.state.codeLength + 1))
+ let y = this.randomNum(this.state.fontSizeMax, this.state.contentHeight - 12)
+ let deg = this.randomNum(-45, 45)
+ ctx.translate(x, y)
+ ctx.rotate(deg * Math.PI / 180)
+ ctx.fillText(txt, 0, 0)
+ ctx.rotate(-deg * Math.PI / 180)
+ ctx.translate(-x, -y)
+ }
+ drawLine=(ctx)=>{
+ for (let i = 0; i < 8; i++) {
+ ctx.strokeStyle = this.randomColor(this.state.lineColorMin,this.state.lineColorMax)
+ ctx.beginPath()
+ ctx.moveTo(this.randomNum(0, this.state.contentWidth), this.randomNum(0, this.state.contentHeight)) //设置起点x,y
+ ctx.lineTo(this.randomNum(0,this.state.contentWidth), this.randomNum(0, this.state.contentHeight)) //绘制直线 x,y 一条当前位置到x,y点的直线
+ ctx.stroke()
+ }
+ }
+ drawDot=(ctx)=>{
+ for (let i = 0; i < 100; i++) {
+ ctx.fillStyle = this.randomColor(0, 255)
+ ctx.beginPath()
+ ctx.arc(this.randomNum(0, this.state.contentWidth), this.randomNum(0, this.state.contentHeight), 1, 0, 2 * Math.PI)
+ ctx.fill()
+ }
+ }
+ refresh=()=>{
+ const words='AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz'
+ let code=''
+ for(let i=0;i
+
+ )
+ }
+}
diff --git a/src/userComponents/userManageCenter/homeDocuments/DocumentsManage.js b/src/userComponents/userManageCenter/homeDocuments/DocumentsManage.js
index f4697c054854fc5add61c945668a8eda3f7fb1f0..830dfd4acad356c6e09046cc894c9977cc0b8a41 100644
--- a/src/userComponents/userManageCenter/homeDocuments/DocumentsManage.js
+++ b/src/userComponents/userManageCenter/homeDocuments/DocumentsManage.js
@@ -11,6 +11,7 @@ class DocumentsManage extends React.Component{
super(props);
this.state={
isModalVisible:false,
+
detailData:[],
dataSource:[],
dataSource2:[],
@@ -116,22 +117,22 @@ class DocumentsManage extends React.Component{
showIn(event){
this.setState({
showType:"in",
- dataSource2:this.state.dataSource.filter(item=>item.orderType=="入库"),
- queryData:this.state.dataSource.filter(item=>item.orderType=="入库"),
+ dataSource2:this.state.dataSource.filter(item=>item.orderType=="入库"||item.orderType=="入库待办"),
+ queryData:this.state.dataSource.filter(item=>item.orderType=="入库"||item.orderType=="入库待办"),
})
}
showOut(event){
this.setState({
showType:"out",
- dataSource2:this.state.dataSource.filter(item=>item.orderType=="出库"),
- queryData:this.state.dataSource.filter(item=>item.orderType=="出库"),
+ dataSource2:this.state.dataSource.filter(item=>item.orderType=="出库"||item.orderType=="出库待办"),
+ queryData:this.state.dataSource.filter(item=>item.orderType=="出库"||item.orderType=="出库待办"),
})
}
showTrading(event){
this.setState({
showType:"trading",
- dataSource2:this.state.dataSource.filter(item=>item.orderType=="过户"),
- queryData:this.state.dataSource.filter(item=>item.orderType=="过户"),
+ dataSource2:this.state.dataSource.filter(item=>item.orderType=="过户"||item.orderType=="过户待办"),
+ queryData:this.state.dataSource.filter(item=>item.orderType=="过户"||item.orderType=="过户待办"),
})
}
@@ -146,16 +147,22 @@ class DocumentsManage extends React.Component{
switch(this.state.detailData.orderType){
case "入库":
return();
+ case "入库待办":
+ return();
case "出库":
return();
+ case "出库待办":
+ return();
case "过户":
return();
+ case "过户待办":
+ return();
}
}
cancelApp(item){
- if(item.orderStatus=="待完成"){
+ if((item.orderType=="入库待办"||item.orderType=="出库待办"||item.orderType=="过户待办")&&item.orderStatus!="已取消"){
item.orderStatus="已取消"
}else{
@@ -231,7 +238,7 @@ class DocumentsManage extends React.Component{
return(
- {record.orderStatus=="待完成"?
+ {(record.orderType=="入库待办"||record.orderType=="出库待办"||record.orderType=="过户待办")&&record.orderStatus!="已取消"?
:}