This commit is contained in:
姜棚 2021-11-27 21:22:28 +08:00
parent 62ba91fbc6
commit 400854731a
9 changed files with 191 additions and 89 deletions

View File

@ -38,6 +38,11 @@ const upload = (method, url, params, responseType) => {
const req = (method, url, params, responseType) => {
var obj = null;
if (method == "get") {
obj = {
headers: new Headers({
'authorization': sessionStorage.getItem("authorization")
})
}
if (params) {
let paramsArray = [];
//拼接参数
@ -54,12 +59,14 @@ const req = (method, url, params, responseType) => {
method: method,
body: JSON.stringify(params),
headers: new Headers({
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'authorization': sessionStorage.getItem("authorization")
})
}
}
let http = fetch(url, obj).then(res =>{
window.timeshow=res.headers.get('Date-Time');
return res.json()
@ -122,6 +129,13 @@ export const addKeysBatchInfo = (id, params) => {
}
//编辑修改
export const putPlanStep = (id, params) => {
return req('put', baseurl + "/plan/edit/"+id,params)
}
//获取key批次信息
export const getKeysBatchInfo = (id, params) => {
return req('get', baseurl + "/keys", params)

View File

@ -112,7 +112,7 @@ export default class acclist extends React.Component{
total:0,
page:1,
limit:10,
tabList:[{title:"全部"},{title:"进行中"},{title:"暂停中"},{title:"未开始"},{title:"已完结"},{title:"已作废"},{title:"创建中"}],
tabList:[{title:"全部"},{title:"进行中"},{title:"暂停中"},{title:"未开始"},{title:"已完结"},{title:"已作废"}],
combinedValue:[],
DateTime:'',//数据更新时间
key_word:'',

View File

@ -614,25 +614,7 @@ export default class edittemplate extends React.Component{
}
{
this.state.pageInfo ? (
<FormItem labelname="域名选择" prop="use">
<div>
</div>
</FormItem>
) : null
}
{
this.state.pageInfo ? (
<FormItem labelname="" prop="use" labelwidth="0px" required={false}>
<RadioGroup onChange={(e)=>{this.onUserChange(e)} } value={this.state.model.use}>
<RadioButton value={1}>大客户</RadioButton>
<RadioButton value={2}>普通商户</RadioButton>
<RadioButton value={3}>备用</RadioButton>
</RadioGroup>
</FormItem>
) : null
}
</Form>
<div className="bottom-footer">
到底了

View File

@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { HashRouter as Router, Route, Link } from "react-router-dom";
import { Button } from 'zent';
import {Input,openDialog ,Notify,Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu,Sweetalert } from 'zent';
import {RadioGroup,RadioButton,Input,openDialog ,Notify,Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu,Sweetalert } from 'zent';
import "../../../assets/comm.css"
import _ from "lodash";
import "./preview.less"
@ -14,7 +14,9 @@ export default class acclist extends React.Component{
super(props)
this.state={
step:1,
layout:"matrix"
layout:"list",
type:1,
top_url:""
}
@ -23,7 +25,7 @@ export default class acclist extends React.Component{
componentDidMount(e){
console.log(111)
console.log()
console.log(this.props.data)
setTimeout(()=>{
let img = document.getElementById("preview-center-img")
@ -64,7 +66,24 @@ export default class acclist extends React.Component{
this.setState({step : step })
}
}
onListChange(e){
console.log("dadas",e)
this.setState({type:e.target.value })
if(e.target.value == 1)
{
this.setState({layout:"list"})
}
if(e.target.value == 2)
{
this.setState({layout:"rotation"})
}
if(e.target.value ==3)
{
this.setState({layout:"matrix"})
}
}
render(){
const productData = [
{
@ -230,6 +249,7 @@ export default class acclist extends React.Component{
}
];
return(
<div>
<div id="preview-bg">
{
@ -258,7 +278,8 @@ export default class acclist extends React.Component{
(
<div id="rotation" onClick={(e)=>this.pushPage(e)}>
<div className="top">
<img src="https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20211123/a0c3f9a4b8e0bffa471e45e3251a06a1.png"/>
<img src={this.props.data.top_img} className="top-bg"/>
<div className="title">权益兑换</div>
</div>
<div className="center">
<div className="center-img">
@ -275,7 +296,8 @@ export default class acclist extends React.Component{
): this.state.layout == "list" ? (
<div id="list">
<div className="top">
<img src="https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20211123/a0c3f9a4b8e0bffa471e45e3251a06a1.png"/>
<img src={this.props.data.top_img} className="top-bg"/>
<div className="title">权益兑换</div>
</div>
<div className="center">
<ul class="listcommity">
@ -286,9 +308,9 @@ export default class acclist extends React.Component{
<li key={index}>
<div>
<img src={item.img_url} alt=""/>
<span>{item.name}</span>
<span className="product-name">{item.name}</span>
</div>
<span style={{background: "#F98F5B"}} onClick="exchangeBtn(item)">兑换</span>
<span className="product-exchange" style={{background: "#F98F5B"}} onClick="exchangeBtn(item)">兑换</span>
</li>
)
@ -303,8 +325,8 @@ export default class acclist extends React.Component{
) : (
<div id="matrix" onClick={(e)=>this.pushPage(e)}>
<div className="top">
<img src="https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20211123/a0c3f9a4b8e0bffa471e45e3251a06a1.png"/>
<div className="top" >
<img src={this.props.data.top_img} className="top-bg" />
<div className="title">权益兑换</div>
</div>
<div className="center">
@ -357,9 +379,19 @@ export default class acclist extends React.Component{
}
</div>
<div className="footbar">
<RadioGroup onChange={(e)=>{this.onListChange(e)} } value={this.state.type}>
<RadioButton value={1}>列表</RadioButton>
<RadioButton value={2}>轮播</RadioButton>
<RadioButton value={3}>矩阵</RadioButton>
</RadioGroup>
</div>
</div>
)
}
}

View File

@ -1,3 +1,4 @@
#preview-bg{
max-height: 600px;
@ -81,6 +82,14 @@
height: 200px;
position: absolute;
z-index: 2px;
.title{
width: 100%;
color: #FFFFFF;
position: absolute;
top: 50px;
font-size: 20px;
text-align: center;
}
}
.center{
width: 100%;
@ -133,9 +142,27 @@
background-color: #F4F6F9;
position: relative;
list-style: none;
.top{
position: absolute;
top: -80px;
top: -180px;
height: 100px;
.title{
width: 100%;
color: #FFFFFF;
position: absolute;
top: 200px;
font-size: 20px;
text-align: center;
}
}
.top-bg
{
width: 100% !important;
height: auto;
border-radius: 0px;
}
ul{
width: 96%;
@ -156,12 +183,24 @@
height: 24px;
line-height: 24px;
width: 60px;
color: #FFFFFF;
color: #151515;
text-align: center;
margin-right: 10px;
border-radius: 15px;
}
}
.product-name{
font-weight: bold;
}
.product-exchange{
color: #FFFFFF;
}
img{
border-radius: 50%;
width: 50px;
height: 50px;
}
}
#matrix{
@ -230,4 +269,13 @@
}
}
.footbar{
width: 100%;
height: 80px;
background-color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
}

View File

@ -31,6 +31,7 @@ function FormDom(props) {
}
postLogin(value).then(res=>{
handelResponse(res,(response,msg)=>{
sessionStorage.setItem("authorization",response.authorization)
Notify.clear();
Notify.success(msg);
sessionStorage.setItem('showflag',true);

View File

@ -7,7 +7,7 @@ import Step1 from "./step1.js"
import Step2 from "./step2.js"
import Step3 from "./step3.js"
import _ from "lodash";
import {addPlanStep,handelResponse,getReseller,planSend,getDraftInfo} from "../../../assets/api.js"
import {addPlanStep,handelResponse,getReseller,planSend,getDraftInfo,putPlanStep} from "../../../assets/api.js"
export default class add extends React.Component{
constructor(props){
@ -60,7 +60,7 @@ export default class add extends React.Component{
componentDidMount(e){
console.log("测试编辑")
console.log(sessionStorage.getItem("plan_id"))
if(sessionStorage.getItem("plan_status") > 0)
if(sessionStorage.getItem("plan_status") == 4)
{
this.setState({disabled:true})
}
@ -76,21 +76,20 @@ export default class add extends React.Component{
{
this.refs.step1.edit(req.info)
}
if(req.keys)
if(req.keys.length > 0 && this.state.disabled ==false)
{
this.setState({curstep:2})
this.setState({keys:req.keys})
setTimeout(()=>{
for(let i = 0;i < this.state.keys.length;i++)
{
this.refs["step2-"+i].edit(req.keys[i])
}
},500)
}
setTimeout(()=>{
for(let i = 0;i < this.state.keys.length;i++)
{
this.refs["step2-"+i].edit(req.keys[i])
}
},500)
},(err)=>{
Notify.error(err)
})
@ -112,7 +111,7 @@ export default class add extends React.Component{
}
}
if(this.state.curstep >= 2){
if(this.state.curstep >= 2 ){
let temp=[]
@ -241,17 +240,45 @@ export default class add extends React.Component{
Notify.error(err)
})
})
}
onEditInfo(){
let plan_id = sessionStorage.getItem("plan_id")
if(this.refs.step1.submit(plan_id))
{
setTimeout(()=>{
this.props.history.push('/home/plan-list/');
},1500)
}
console.log("编辑和")
}
render(){
return(
<div id="plan-edit">
{
this.state.disabled ?
(
<div className="plan-main">
<div className="action-panel">
<div id="step1" className="step1">
<div className="plan-title">营销计划</div>
<Card style={{ width:'100%' }} title={this.state.step1_pagetitle}>
<Step1 ref="step1" data={this.state.step1_data} disabled={this.state.disabled} />
</Card>
</div>
<div className="step-btn-group">
<Button type="primary" onClick={()=>this.onEditInfo()} >修改</Button>
<Button type="normal" onClick={()=>this.onReturn()}>取消</Button>
</div>
</div>
</div>
)
:
(
<div className="plan-main">
<div className="action-panel">
@ -376,6 +403,12 @@ export default class add extends React.Component{
</div>
</div>
)
}
</div>
)
}

View File

@ -7,7 +7,7 @@ import Form from "../../../components/form/main"
import FormItem from "../../../components/form-item/main"
import Bus from "../../../assets/eventBus.js"
import _ from "lodash";
import {addPlanStep,handelResponse,getPlanList,getReSellerOption,} from "../../../assets/api.js"
import {addPlanStep,handelResponse,getPlanList,getReSellerOption,putPlanStep} from "../../../assets/api.js"
export default class acclist extends React.Component{
@ -90,10 +90,14 @@ export default class acclist extends React.Component{
}
async submit(){
async submit(id){
let valide = false;
if(this.refs.form1.validator())
{
let data = {};
data.title = this.state.model.title;
data.type = parseInt(this.state.model.type);
@ -102,6 +106,27 @@ export default class acclist extends React.Component{
data.reseller_name = this.state.model.reseller.text;
data.begin_time = this.state.model.date_time[0];
data.end_time = this.state.model.date_time[1];
if(id)
{
let form ={
"title": data.title,
"begin_time": data.begin_time,
"end_time": data.end_time,
}
await putPlanStep(id,form).then((res)=>{
handelResponse(res,(req,msg)=>{
Notify.success("保存成功")
valide = true;
return
},(err)=>{
Notify.error(err)
})
})
}
else{
let formdata = {}
formdata.info = data;
@ -124,12 +149,13 @@ export default class acclist extends React.Component{
}
else{
sessionStorage.setItem("step1",JSON.stringify(data))
return true;
}
}
}
return valide

View File

@ -320,41 +320,7 @@ export default class acclist extends React.Component{
this.setState({distdata: temp})
}
// componentWillReceiveProps(nextProps) {
// if(this.state.oldData != this.state.model)
// {
// let c_model = nextProps.data;
// let model={ //数据模型不可少
// style: parseInt(c_model.style),
// quantity:c_model.quantity,
// allow_repetition: parseInt(c_model.allow_repetition),
// allow_loss: parseInt(c_model.allow_loss),
// merge_stock:c_model.merge_stock,
// code_batch:c_model.code_batch,
// draw_title:c_model.draw_title,
// }
// this.setState({model:model})
// this.setState({oldData:model})
// this.setState({checkedList:c_model.bind_object.map(Number)})
// let temp = _.map(c_model.code_batch,(o)=>{
// o.checked = true;
// return o
// })
// this.setState({distdata: temp})
// }
// }
render(){