落地页预览和新建编辑预览

This commit is contained in:
red-deng-deng 2022-01-26 13:21:45 +08:00
parent 1a5b64ce16
commit 5b5b74881d
3 changed files with 122 additions and 55 deletions

View File

@ -64,7 +64,11 @@ export default class edittemplate extends React.Component{
isExchangePage:false, isExchangePage:false,
isSystemModel:false, isSystemModel:false,
activeNavStatus:1, activeNavStatus:1,
headfile:'' headfile:'',
activeHeight:667,
pageStep:1,
showPage:1,
setStyle:{width:'282px',height:'547px'},
} }
this.canvasImgDom=this.canvasImgDom.bind(this); this.canvasImgDom=this.canvasImgDom.bind(this);
this.canvasImgDomScr=this.canvasImgDomScr.bind(this); this.canvasImgDomScr=this.canvasImgDomScr.bind(this);
@ -83,6 +87,10 @@ getLandingdata(val){
} }
},500) },500)
} }
onpageChange(e){
this.setState({showPage:e.target.value});
this.setState({pageStep:e.target.value});
}
componentWillMount(e){ componentWillMount(e){
let href=window.location.href; let href=window.location.href;
@ -419,7 +427,7 @@ getLandingdata(val){
onPreview(){ onPreview(){
this.setState({previewData:this.state}) this.setState({previewData:this.state})
this.setState({preview_visible:true}) this.setState({preview_visible:true,pageStep:1,showPage:1})
} }
//获取商品详情数据 //获取商品详情数据
@ -582,7 +590,16 @@ getLandingdata(val){
}); });
}; };
handleSize(width,height){
let style={width:width+'px',height:height+'px'};
switch(height){
case 667:style={width:'282px',height:'547px'};break;
case 750:style={width:'282px',height:'609px'};break;
case 812:style={width:'262px',height:'612px'};break;
case 500:style={width:'358px',height:'500px'};break;
}
this.setState({setStyle:style,activeHeight:height});
}
componentWillUnmount(){ componentWillUnmount(){
if(document.querySelector('canvas')){ if(document.querySelector('canvas')){
document.querySelector('canvas').remove(); document.querySelector('canvas').remove();
@ -768,16 +785,43 @@ getLandingdata(val){
{ {
this.state.preview_visible ? ( this.state.preview_visible ? (
<div> <div>
<div className="modal model44"></div> <div className="modal model44" style={{background:'rgba(0,0,0,0.8)'}}></div>
<div className="preview-box"> <div className="preview-box">
<div className="preview-top-bar">
<div className="preview-top-back" ></div>
<Icon type="close" className="preview-top-close" onClick={(e)=>{this.onClose(e)}} /> <Icon type="close" className="preview-top-close" onClick={(e)=>{this.onClose(e)}} />
<div style={{height:'100%'}}>
<div className="previewComponent">
<div className="previewbody">
<div className="ctorSize" style={this.state.setStyle}>
<PreviewItem data={this.state.previewData} ref="preview" step={this.state.pageStep}/>
</div>
</div>
<div className="left-choice">
<div className="exchange-page">
<p className="preview-setting">落地页预览:</p>
<section class="screen-size-selector"><div className={this.state.activeHeight==667?'size active':'size'} onClick={()=>this.handleSize(375,667)}>主流机型<span>375x667</span></div><div className={this.state.activeHeight==750?'size active':'size'} onClick={()=>this.handleSize(375,750)}><span>375x750</span></div><div className={this.state.activeHeight==812?'size active':'size'} onClick={()=>this.handleSize(375,812)}><span>375x812</span></div><div className={this.state.activeHeight==500?'size active':'size'} onClick={()=>this.handleSize(375,500)}><span>375x500</span></div></section>
</div>
<div className="exchange-page">
<p>页面类型:</p>
<RadioGroup onChange={(e)=>{this.onpageChange(e)} } value={this.state.showPage} >
<RadioButton value={1} >落地页</RadioButton>
<RadioButton value={2} >列表页</RadioButton>
<RadioButton value={3}>详情页</RadioButton>
</RadioGroup>
</div>
</div>
</div>
</div> </div>
<PreviewItem data={this.state.previewData} ref="preview" />
</div> </div>
</div> </div>
) :null ) :null
} }
{ {
this.state.loading_visible?( this.state.loading_visible?(

View File

@ -8,7 +8,7 @@ import {
Link Link
} from "react-router-dom"; } from "react-router-dom";
import { import {
Button Button,RadioButton
} from 'zent'; } from 'zent';
import "./main.less" import "./main.less"
import { import {
@ -16,6 +16,7 @@ import {
Swiper, Swiper,
Dropdown, Dropdown,
DropdownPosition, DropdownPosition,
RadioGroup,
DropdownClickTrigger, DropdownClickTrigger,
Icon, Icon,
MenuItem, MenuItem,
@ -154,6 +155,10 @@ export default class acclist extends React.Component {
dataCount: 0, dataCount: 0,
preview_visible:false, preview_visible:false,
preview_url:"", preview_url:"",
activeHeight:667,
pageStep:1,
showPage:1,
setStyle:{width:'282px',height:'547px'},
} }
} }
@ -162,7 +167,21 @@ export default class acclist extends React.Component {
} }
//预览改变大小
handleSize(width,height){
let style={width:width+'px',height:height+'px'};
switch(height){
case 667:style={width:'282px',height:'547px'};break;
case 750:style={width:'282px',height:'609px'};break;
case 812:style={width:'262px',height:'612px'};break;
case 500:style={width:'358px',height:'500px'};break;
}
this.setState({setStyle:style,activeHeight:height});
}
onpageChange(e){
this.setState({showPage:e.target.value});
this.setState({pageStep:e.target.value});
}
getTableList(data) { getTableList(data) {
if(this.state.key_word) if(this.state.key_word)
{ {
@ -299,7 +318,7 @@ export default class acclist extends React.Component {
rowdata.product_detail=row.exchange.product_detail; rowdata.product_detail=row.exchange.product_detail;
} }
this.setState({preview_visible:true}) this.setState({preview_visible:true,pageStep:1,showPage:1})
this.setState({previewData:rowdata}) this.setState({previewData:rowdata})
this.setState({preview_url:row.href}) this.setState({preview_url:row.href})
@ -506,23 +525,44 @@ export default class acclist extends React.Component {
/TabPage> /TabPage>
{ {
this.state.preview_visible ? ( this.state.preview_visible ? (
<div> <div>
<div className="modal"></div> <div className="modal model44" style={{background:'rgba(0,0,0,0.8)'}}></div>
<div className="preview-box"> <div className="preview-box">
<div className="preview-top-bar">
<div className="preview-top-back" onClick={(e)=>{this.onBack(e)}} ></div>
<Icon type="close" className="preview-top-close" onClick={(e)=>{this.onClose(e)}} /> <Icon type="close" className="preview-top-close" onClick={(e)=>{this.onClose(e)}} />
<div style={{height:'100%'}}>
<div className="previewComponent">
<div className="previewbody">
<div className="ctorSize" style={this.state.setStyle}>
<PreviewItem data={this.state.previewData} ref="preview" step={this.state.pageStep}/>
</div> </div>
<PreviewItem data={this.state.previewData} ref="preview" />
</div>
<div className="left-choice">
<div className="exchange-page">
<p className="preview-setting">落地页预览:</p>
<section class="screen-size-selector"><div className={this.state.activeHeight==667?'size active':'size'} onClick={()=>this.handleSize(375,667)}>主流机型<span>375x667</span></div><div className={this.state.activeHeight==750?'size active':'size'} onClick={()=>this.handleSize(375,750)}><span>375x750</span></div><div className={this.state.activeHeight==812?'size active':'size'} onClick={()=>this.handleSize(375,812)}><span>375x812</span></div><div className={this.state.activeHeight==500?'size active':'size'} onClick={()=>this.handleSize(375,500)}><span>375x500</span></div></section>
</div>
<div className="exchange-page">
<p>页面类型:</p>
<RadioGroup onChange={(e)=>{this.onpageChange(e)} } value={this.state.showPage} >
<RadioButton value={1} >落地页</RadioButton>
<RadioButton value={2} >列表页</RadioButton>
<RadioButton value={3}>详情页</RadioButton>
</RadioGroup>
</div> </div>
</div> </div>
</div>
</div>
</div>
</div>
) :null ) :null
} }
</div> </div>

View File

@ -8,17 +8,6 @@ import "../../../assets/comm.css"
import PreviewItem from "./preview.js" import PreviewItem from "./preview.js"
import {handelResponse,getThemeType,getSystemTemplate,getTheme,copyThemecustom} from "../../../assets/api.js" import {handelResponse,getThemeType,getSystemTemplate,getTheme,copyThemecustom} from "../../../assets/api.js"
// <div className="block-selector-list">
// <span className="block-selector-list-label">行业:</span>
// <div className="block-selector">
// <div className="block-selector-item active">
// 全部
// </div>
// <div className="block-selector-item">
// 通用
// </div>
// </div>
// </div>
window.addEventListener('scroll',function(){ window.addEventListener('scroll',function(){
console.log('滚动'); console.log('滚动');
@ -106,6 +95,7 @@ export default class mytemplate extends React.Component{
let scrolHeight=event.target.scrollTop; let scrolHeight=event.target.scrollTop;
if(scrolHeight>300){ if(scrolHeight>300){
this.setState({toTopFlag:true}); this.setState({toTopFlag:true});
this.setState({toTopshow:false});
let isBottom=event.target.scrollHeight-event.target.clientHeight; let isBottom=event.target.scrollHeight-event.target.clientHeight;
if(isBottom==event.target.scrollTop){ if(isBottom==event.target.scrollTop){
@ -166,10 +156,8 @@ export default class mytemplate extends React.Component{
window.removeEventListener('scroll', this.bindHandleScroll); window.removeEventListener('scroll', this.bindHandleScroll);
} }
createBox(){ createBox(){
// let link = window.location.href.replace(window.location.hash,"#/edittemplate");
sessionStorage.removeItem('pageInfo'); sessionStorage.removeItem('pageInfo');
sessionStorage.setItem('mouldType',1); sessionStorage.setItem('mouldType',1);
// window.open(link, "_blank")
window.location.href= "/#/edittemplate" window.location.href= "/#/edittemplate"
} }
typeClick(e){ typeClick(e){
@ -274,8 +262,6 @@ export default class mytemplate extends React.Component{
sessionStorage.setItem("isSort",0) sessionStorage.setItem("isSort",0)
sessionStorage.setItem('mouldType',1); sessionStorage.setItem('mouldType',1);
sessionStorage.setItem('pageChange',0); sessionStorage.setItem('pageChange',0);
// let link = window.location.href.replace(window.location.hash,"#/edittemplate");
// window.open(link, "_blank")
if(type){ if(type){
window.location.href= "/#/edittemplate?type="+type; window.location.href= "/#/edittemplate?type="+type;
}else{ }else{
@ -289,10 +275,7 @@ export default class mytemplate extends React.Component{
} }
else{ else{
sessionStorage.setItem("pageInfo", JSON.stringify(row)) sessionStorage.setItem("pageInfo", JSON.stringify(row))
// let link = window.location.href.replace(window.location.hash,"#/home/edittemplate");
// window.open(link, "_blank")
sessionStorage.setItem('mouldType',1); sessionStorage.setItem('mouldType',1);
// window.location.href='/#/edittemplate';
if(type){ if(type){
window.location.href= "/#/edittemplate?type="+type; window.location.href= "/#/edittemplate?type="+type;
}else{ }else{