编辑器保存编辑加载动画介入

This commit is contained in:
red-deng-deng 2022-01-11 10:50:57 +08:00
parent 6dc009ee41
commit a98f33d051
3 changed files with 75 additions and 67 deletions

View File

@ -802,7 +802,7 @@ export const addTheme= (data) => {
} }
//编辑落地页模板 //编辑落地页模板
export const putTheme= (id,data) => { export const putTheme= (id,data) => {
return req('put', baseurl + "/plan/plan_theme/"+id,data) return req('put', testzyg + "/plan/plan_theme/"+id,data)
} }
//我的模板列表查询 //我的模板列表查询
export const getTheme= (data) => { export const getTheme= (data) => {

View File

@ -4,7 +4,7 @@ import { HashRouter as Router, Route, Link } from "react-router-dom";
import { Button ,ColorPicker,ImageUpload,Input ,onUpload} from 'zent'; import { Button ,ColorPicker,ImageUpload,Input ,onUpload} from 'zent';
import "./main.less" import "./main.less"
import "../../../assets/comm.css" import "../../../assets/comm.css"
import { Notify,Switch ,RadioGroup,RadioButton,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu ,BlockLoading} from 'zent'; import { Notify,BlockLoading,Switch ,RadioGroup,RadioButton,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu} from 'zent';
import Ipt from "../../../components/input/main" import Ipt from "../../../components/input/main"
import Form from "../../../components/form/main" import Form from "../../../components/form/main"
import FormItem from "../../../components/form-item/main" import FormItem from "../../../components/form-item/main"
@ -22,6 +22,7 @@ export default class edittemplate extends React.Component{
super(props) super(props)
this.state={ this.state={
activeshow:true,//控制显示 activeshow:true,//控制显示
loading_visible:false,
detailactiveshow:true, detailactiveshow:true,
showType:1,//兑换码/白名单/立减金 showType:1,//兑换码/白名单/立减金
//落地页 //落地页
@ -93,21 +94,6 @@ getLandingdata(val){
writeData.font_color=myInfoData.font_color; writeData.font_color=myInfoData.font_color;
let product_list=myInfoData.product_list; let product_list=myInfoData.product_list;
let product_detail=myInfoData.product_detail; let product_detail=myInfoData.product_detail;
// if(sessionStorage.getItem("isSort") == 1 && myInfo.creator == 0)
// {
// this.setState({isSystemModel:true})
// model.sort = myInfo.sort;
// }
// if(myInfo.href)
// {
// model.list = parseInt(myInfo.list)
// model.use = myInfo.use
// model.link = myInfo.link
// model.edit= myInfo.edit
// model.href= myInfo.href
// this.setState({isExchangePage:true})
// }
this.setState({model:writeData}) this.setState({model:writeData})
this.setState({product_list,product_detail}) this.setState({product_list,product_detail})
let newObj={} let newObj={}
@ -118,7 +104,6 @@ getLandingdata(val){
} }
} }
async onSave(){ async onSave(){
if(!this.state.model.top_image) if(!this.state.model.top_image)
{ {
Notify.clear(); Notify.clear();
@ -140,10 +125,10 @@ getLandingdata(val){
this.setState({activeNavStatus:2}); this.setState({activeNavStatus:2});
return; return;
} }
this.setState({activeNavStatus:1});
this.setState({loading_visible:true,activeNavStatus:1});
this.canvasImg.style.display='block'; this.canvasImg.style.display='block';
let thumbresult =await this.canvasImgFn(); let thumbresult =await this.canvasImgFn();
let formdata = { let formdata = {
"title": this.state.model.title, "title": this.state.model.title,
"thumb": this.state.model.thumb, "thumb": this.state.model.thumb,
@ -158,9 +143,11 @@ getLandingdata(val){
"product_list":this.state.product_list, "product_list":this.state.product_list,
"product_detail":this.state.product_detail "product_detail":this.state.product_detail
} }
console.log(164,formdata); let myInfoData = JSON.parse(sessionStorage.getItem("pageInfo"))
addTheme(formdata).then((res)=>{ if(myInfoData){//编辑
putTheme(myInfoData.id,formdata).then((res)=>{
handelResponse(res,(req,msg)=>{ handelResponse(res,(req,msg)=>{
this.setState({loading_visible:false});
Notify.success(msg) Notify.success(msg)
setTimeout(() => { setTimeout(() => {
this.props.history.push('/home/myexchangetemplate'); this.props.history.push('/home/myexchangetemplate');
@ -169,15 +156,19 @@ getLandingdata(val){
Notify.error(err) Notify.error(err)
}) })
}); });
// if(info.href) }else{//添加
// { addTheme(formdata).then((res)=>{
// console.log(111111) handelResponse(res,(req,msg)=>{
// formdata.list = this.state.model.list this.setState({loading_visible:false});
// formdata.use = this.state.model.use Notify.success(msg)
// formdata.link = this.state.model.link setTimeout(() => {
// formdata.edit= this.state.model.edit this.props.history.push('/home/myexchangetemplate');
// formdata.href= this.state.model.href }, 2000);
},(err)=>{
Notify.error(err)
})
});
}
// putTheme(this.state.model.id,formdata).then((res)=>{ // putTheme(this.state.model.id,formdata).then((res)=>{
// handelResponse(res,(req,msg)=>{ // handelResponse(res,(req,msg)=>{
@ -189,7 +180,6 @@ getLandingdata(val){
// Notify.error(err) // Notify.error(err)
// }) // })
// }); // });
// } // }
// else{ // else{
@ -691,6 +681,14 @@ getLandingdata(val){
</div> </div>
) :null ) :null
} }
{
this.state.loading_visible?(
<div className="loadingShow">
<div className="modal"></div>
<BlockLoading loading icon="circle" iconSize={64} iconText="加载中" />
</div>
):null
}
</div> </div>
</div> </div>
</div> </div>

View File

@ -1748,3 +1748,13 @@ div{
right: 10px; right: 10px;
} }
} }
.loadingShow .zent-loading-color-preset--primary[data-zv="9.11.0"] .zent-loading-icon-circle + .zent-loading-icon-text{
color:#fff!important;
}
.loadingShow .zent-loading--block[data-zv="9.11.0"] {
position: fixed;
top: 30%;
left: 50%;
z-index: 99999;
}