From 46d1b20a3375aa233e606dc63d3f99ce2a439d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=B5=B7=E4=B8=80=E5=88=80?= <849005670@qq.com> Date: Mon, 15 Nov 2021 15:43:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E7=8A=B6=E6=80=81=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/form/main.js | 12 +++-- src/pages/distributor/add/add.js | 3 +- .../adddistributorinfo/adddistributorinfo.js | 18 +++---- src/pages/distributor/edit/edit.js | 40 ++++++++++++++-- src/pages/distributor/list/list.js | 47 ++++++++++++++++--- src/pages/plan/add/step1.js | 17 +++---- src/pages/plan/add/step2.js | 9 ++-- 7 files changed, 110 insertions(+), 36 deletions(-) diff --git a/src/components/form/main.js b/src/components/form/main.js index fd47a2a4..fac37793 100644 --- a/src/components/form/main.js +++ b/src/components/form/main.js @@ -254,6 +254,7 @@ export default class form extends React.Component { console.log("表单验证") let doms = document.getElementsByClassName("form-Item"); let self = this; + let validate = false; for (let i = 0; i < doms.length; i++) { var com = doms[i].children; let item = com[com.length - 1] @@ -269,7 +270,9 @@ export default class form extends React.Component { if (formItem_com.value == ""||formItem_com.value == undefined) { self.removeClass(item) self.isRequired(formItem_com.value, o.className, item, rules_item[j].message); - return false; + validate = false + break; + } else{ self.removeClass(item) @@ -286,9 +289,9 @@ export default class form extends React.Component { self.removeClass(item) } else { - + validate = false self.isRequired(formItem_com.value, o.className, item, rules_item[j].message); - return false + break; } } @@ -297,10 +300,11 @@ export default class form extends React.Component { } } + } - return true; + return validate; } render() { diff --git a/src/pages/distributor/add/add.js b/src/pages/distributor/add/add.js index 33eed848..6991f392 100644 --- a/src/pages/distributor/add/add.js +++ b/src/pages/distributor/add/add.js @@ -11,6 +11,7 @@ import Adddistributor from "../adddistributorinfo/adddistributorinfo" export default class acclist extends React.Component{ constructor(props){ super(props) + console.log(props) this.state={ } } @@ -25,7 +26,7 @@ export default class acclist extends React.Component{
- +
diff --git a/src/pages/distributor/adddistributorinfo/adddistributorinfo.js b/src/pages/distributor/adddistributorinfo/adddistributorinfo.js index 6fa093a7..f3517ceb 100644 --- a/src/pages/distributor/adddistributorinfo/adddistributorinfo.js +++ b/src/pages/distributor/adddistributorinfo/adddistributorinfo.js @@ -10,6 +10,7 @@ import Bus from "../../../assets/eventBus.js" export default class adduserinfo extends React.Component{ constructor(props){ super(props) + this.state={ model:{ //数据模型不可少 fullname:'', @@ -22,6 +23,8 @@ export default class adduserinfo extends React.Component{ } componentDidMount(e){ + + } submit(){ @@ -59,15 +62,12 @@ export default class adduserinfo extends React.Component{ } cancel(){ - let model2 = { //数据模型不可少 - account:"", - phone:"", - pwd:"", - name:"", - company:"", - deparment:"", - post:"", - station:"", + let model2 = { //数据模型不可少 + fullname:'', + account:'', + contacts:'', + contacts_phone:'', + contacts_email:'' } this.setState({model:model2}); this.refs.form1.cancel(); diff --git a/src/pages/distributor/edit/edit.js b/src/pages/distributor/edit/edit.js index 36f942f7..1a0a1d42 100644 --- a/src/pages/distributor/edit/edit.js +++ b/src/pages/distributor/edit/edit.js @@ -1,10 +1,42 @@ -import React from "react" -import './edit.less' -export default class edit extends React.Component{ +import ReactDOM from 'react-dom'; +import React, { Component } from 'react'; +import { HashRouter as Router, Route, Link } from "react-router-dom"; +import { Card,Button,Pagination } from 'zent'; +import "./add.less" +import { Grid,Switch ,Swiper } from 'zent'; +import "../../../assets/comm.css" +import Ipt from "../../../components/input/main" +import Adddistributor from "../adddistributorinfo/adddistributorinfo" + +export default class acclist extends React.Component{ constructor(props){ super(props) this.state={ - } } + //去调子组件的方法 + activeFn(){ + this.refs.disbutorForm.submit(); + } + render(){ + const { current, pageSize } = this.state; + return( +
+ +
+ + +
+
+
+ + +
+
+ ) + } } \ No newline at end of file diff --git a/src/pages/distributor/list/list.js b/src/pages/distributor/list/list.js index ee7d6f8c..294a61c6 100644 --- a/src/pages/distributor/list/list.js +++ b/src/pages/distributor/list/list.js @@ -1,9 +1,12 @@ import ReactDOM from 'react-dom'; import React, { Component } from 'react'; import { HashRouter as Router, Route, Link } from "react-router-dom"; + + + import { Button } from 'zent'; import "./list.less" -import { Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu } from 'zent'; +import { Sweetalert,Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu } from 'zent'; import "../../../assets/comm.css" import Ipt from "../../../components/input/main" import Grid from "../../../components/gird/main.js" @@ -55,13 +58,13 @@ const Column = [ type: "normal", prop:'name', defaultText: 0, - width:'auto', + width:'20%', type: "normal", }, { title: '状态', - width:'auto', + width:'10%', type: "slot", prop:'name' }, @@ -70,7 +73,7 @@ const Column = [ prop: 'opearo', name: 'opearo', type: "slot", - width:'auto', + width:'10%', defaultText: 0, }, @@ -95,6 +98,7 @@ export default class acclist extends React.Component{ clickFn(){ this.props.history.push('/distributor-add'); sessionStorage.setItem('pathname2','/system/distributor-add') + let activerou=[{items:[ { "path": "/system/distributor-list", @@ -109,6 +113,37 @@ export default class acclist extends React.Component{ } + //表单删除 + delFn(e,row){ + Sweetalert.confirm({ + type:'warning', + closeBtn:true, + title:'确认操作', + content:

是否删除此条数据?

, + onConfirm: this.onConfirm, + onCancel: this.onCancel, + className:'questModal', + parentComponent: this + }); + } + editFn(e,row){ + this.props.history.push('distributor-add'); + sessionStorage.setItem('pathname2','distributor-add') + sessionStorage.getItem("distributor-data") + let activerou=[{'pagetitle':'编辑',items:[ + { + "path": "distributor-list", + "name": "账号管理" + }, + { + "path": "distributor-add", + "name": "编辑账号" + } + ]}] + sessionStorage.setItem('breaknav',JSON.stringify(activerou)); + + } + render(){ const { current, pageSize } = this.state; return( @@ -144,8 +179,8 @@ export default class acclist extends React.Component{ if(com == "opearo") { return - 编辑 - 删除 + {this.editFn(e,rowData)}} >编辑 + {this.delFn(e,rowData)}} >删除
更多
diff --git a/src/pages/plan/add/step1.js b/src/pages/plan/add/step1.js index 08ea8182..0a17e10e 100644 --- a/src/pages/plan/add/step1.js +++ b/src/pages/plan/add/step1.js @@ -1,7 +1,7 @@ import ReactDOM from 'react-dom'; import React, { Component } from 'react'; import { HashRouter as Router, Route, Link } from "react-router-dom"; -import { Button ,Tabs, CombinedDateRangePicker,Select,Input} from 'zent'; +import { Button ,Tabs, CombinedDateRangePicker,Select,Input,RadioButton,RadioGroup} from 'zent'; import Ipt from "../../../components/input/main" import Form from "../../../components/form/main" import FormItem from "../../../components/form-item/main" @@ -90,18 +90,19 @@ export default class acclist extends React.Component{ }} value={this.state.model.name} placeholder={"请输入"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'520px'} alignment={'left'}/> - - {type} - + + 活动 + 仅兑换 + - - - {return_val} - + + + 指定数量 + 不限 + {