From 8a31ec46aaab37374873c8880b513371389e762c Mon Sep 17 00:00:00 2001 From: Apple <> Date: Tue, 20 Sep 2022 17:28:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=AD=E5=BF=83=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BC=98=E5=8C=96=EF=BC=8C=E9=A2=84=E8=A7=88=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E8=80=81=E6=95=B0=E6=8D=AE=E5=85=BC=E5=AE=B9=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goodsPage/componentLib/main.js | 5 - .../goodsPage/componentLib/main.less | 7 +- .../goodsPage/config/backPicture.js | 19 +- .../couponTemplate/goodsPage/config/comm.less | 14 - .../couponTemplate/goodsPage/config/main.js | 2 +- .../goodsPage/config/picture.js | 14 +- .../goodsPage/config/searchBar.js | 5 - .../couponTemplate/goodsPage/config/title.js | 3 - .../couponTemplate/landingPage/config/main.js | 2 - src/pages/exchangepage/edittemplate/main.js | 4 +- src/pages/exchangepage/template/main.js | 294 ++++------ src/pages/exchangepage/template/preview.js | 548 ++++++++++++------ 12 files changed, 498 insertions(+), 419 deletions(-) diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.js b/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.js index bd23a85e..ab104510 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.js @@ -31,12 +31,7 @@ export default class componentLib extends React.Component { constructor(props) { super(props); } - componentWillMount(e) {} - - //组件将要销毁阶段 - componentWillUnmount() {} propcomponentName(item){ - console.log(39,item); this.props.componentName(item.name); if(item.name){ Bus.emit('componentLib',item) diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.less b/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.less index 69d3d629..d01a4aae 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.less +++ b/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.less @@ -1,4 +1,3 @@ - .componentLib { width: 180px; height: 100%; @@ -8,17 +7,14 @@ right: -190px; padding: 15px; box-sizing: border-box; - h4 { padding: 15px 0; cursor: pointer; } - ul { display: flex; flex-wrap: wrap; justify-content: space-between; - li { margin: 0 0 15px 0; border-radius: 2px; @@ -33,10 +29,11 @@ justify-content: center; cursor: pointer; transition: all .3s; + &:hover { background: #007aff; color: #fff; - i{ + i { color: #fff; } } diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js index 6373852b..221d09b7 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js @@ -1,13 +1,12 @@ -import React from 'react'; -import { ImageUpload, ColorPicker, Notify, RadioGroup, RadioButton } from 'zent'; -import "@/assets/comm.css" -import Form from "@/components/form/main" -import FormItem from "@/components/form-item/main" -import { uploadImg, handelResponse } from "@/assets/api.js" -import Ipt from "@/components/input/main" +import { handelResponse, uploadImg } from "@/assets/api.js"; +import "@/assets/comm.css"; +import Bus from '@/assets/eventBus.js'; +import FormItem from "@/components/form-item/main"; +import Form from "@/components/form/main"; import _ from "lodash"; -import Bus from '@/assets/eventBus.js' -export default class edittemplate extends React.Component { +import React from 'react'; +import { ColorPicker, ImageUpload, Notify } from 'zent'; +export default class backPicture extends React.Component { constructor(props) { super(props) this.state = { @@ -27,7 +26,7 @@ export default class edittemplate extends React.Component { this.setState({ bgColor: color }); - Bus.emit('globalColor',color) + Bus.emit('globalColor',color) } handleChange1 = (color) => { this.setState({ diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/comm.less b/src/pages/exchangepage/couponTemplate/goodsPage/config/comm.less index 48af7074..478d2d88 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/comm.less +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/comm.less @@ -5,35 +5,28 @@ margin-bottom: 8px; background: #f5faff; } - .component-item .v-editItem { font-size: 14px; display: flex; justify-content: space-between; align-items: center; } - .component-item .v-editItem>span { color: #999; } - .component-item .showType { margin-right: 10px; color: #333 !important; } - .bottomBar .form-compontent { padding-top: 0; - .choice-up-image { margin-right: 15px; - .zent-image-upload-tips[data-zv="9.12.7"] { text-align: center; color: #333; } } - .colorItemfont { margin-top: 0; } @@ -43,31 +36,24 @@ .form-Item { margin-bottom: 15px; } - .form-compontent { padding-top: 0; - .colorItemfont { margin-top: 0; } } - } - .tips { color: #999; - span { color: #f00; } } - .color-control { margin-top: 10px; display: flex; justify-content: space-between; } - .backpic-item { margin-bottom: 30px; } \ No newline at end of file diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/main.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/main.js index 06416151..969a73a1 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/main.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/main.js @@ -10,7 +10,7 @@ import BottomBar from './bottomBar'; import Picture from './picture.js'; //白名单商品页面 import SearchBar from './searchBar.js'; import Title from './title'; -export default class edittemplate extends React.Component { +export default class couponGoodConfig extends React.Component { constructor(props) { super(props) this.state = { diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/picture.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/picture.js index a27f614e..a234575e 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/picture.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/picture.js @@ -46,8 +46,6 @@ export default class edittemplate extends React.Component { } }; - - onUploadError = (type, data) => { if (type === 'overMaxAmount') { Notify.error(`最多可上传 ${data.maxAmount} 张图片`); @@ -71,18 +69,14 @@ export default class edittemplate extends React.Component { reject(); }) }); - let count = 0; const update = () => { if (path) { - resolve( path ); - } else { - if (count < 100) { count += 2; report(count); @@ -96,18 +90,15 @@ export default class edittemplate extends React.Component { }; setTimeout(update, 500); }); - }; componentWillUnmount() { - let oldobj = JSON.parse(sessionStorage.getItem('editorConfig')); + let oldobj = JSON.parse(sessionStorage.getItem('editorConfig')); let coupon = oldobj.coupon; - console.log(105,this.state); coupon.product_list.picture = _.cloneDeep(this.state); oldobj.coupon = coupon; - sessionStorage.setItem('editorConfig', JSON.stringify(oldobj)); + sessionStorage.setItem('editorConfig', JSON.stringify(oldobj)); } render() { - return (
@@ -148,7 +139,6 @@ export default class edittemplate extends React.Component { value={this.state.jumpUrl} placeholder={"请输入"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'300px'} alignment={'left'} /> :null } -
diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/searchBar.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/searchBar.js index 359c8f71..c14d6071 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/searchBar.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/searchBar.js @@ -22,7 +22,6 @@ export default class Searchbar extends React.Component { componentWillMount(e) { //关闭 Bus.addListener('componentLibClose', (prop) => { - console.log(999,prop); if(prop=='search'){ this.setState({iswitch:false}) } @@ -43,8 +42,6 @@ export default class Searchbar extends React.Component { this.setState({ textAlign: e.target.value }) Bus.emit('textAlign', e.target.value) } - - changeBorder = (color) => { this.setState({ borderColor: color @@ -63,7 +60,6 @@ export default class Searchbar extends React.Component { }); Bus.emit('searchfontColor', color) } - borderColorFn(cor) { this.setState({ borderColor: cor }); Bus.emit('borderColor', cor) @@ -90,7 +86,6 @@ export default class Searchbar extends React.Component {

搜索栏设置

-
diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js index fe63cf16..426ec9af 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js @@ -22,7 +22,6 @@ export default class Title extends React.Component { } componentWillMount(e) { Bus.addListener('componentLibClose', (prop) => { - console.log(999,prop); if(prop=='title'){ this.setState({iswitch:false}) } @@ -201,8 +200,6 @@ export default class Title extends React.Component { /> } - -
diff --git a/src/pages/exchangepage/couponTemplate/landingPage/config/main.js b/src/pages/exchangepage/couponTemplate/landingPage/config/main.js index d59d193a..9dbafb3a 100644 --- a/src/pages/exchangepage/couponTemplate/landingPage/config/main.js +++ b/src/pages/exchangepage/couponTemplate/landingPage/config/main.js @@ -21,7 +21,6 @@ export default class couponLandpage extends React.Component { }, } } - componentWillMount(_e) { let config = JSON.parse(sessionStorage.getItem('editorConfig')); let data = config.coupon.land; @@ -34,7 +33,6 @@ export default class couponLandpage extends React.Component { model: model1 }); this.props.landbgcolor(color); - } handleChange1 = (color) => { let model1 = this.state.model; diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index 64468997..60d53970 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -676,7 +676,9 @@ export default class edittemplate extends React.Component { this.setState({ showType: e.target.value, activeNavStatus: 1,model: land, product_list, product_detail }) } onPreview() { - this.setState({ previewData: this.state }) + let previewInfo=_.cloneDeep(this.state); + previewInfo.land=this.state.model; + this.setState({ previewData:previewInfo}) this.setState({ preview_visible: true, }) diff --git a/src/pages/exchangepage/template/main.js b/src/pages/exchangepage/template/main.js index feaf6b23..2c5cd958 100644 --- a/src/pages/exchangepage/template/main.js +++ b/src/pages/exchangepage/template/main.js @@ -1,35 +1,17 @@ -import ReactDOM from 'react-dom'; -import React, { Component } from 'react'; -import { Button, RadioGroup, RadioButton } from 'zent'; -import "./main.less" -import { Icon, Notify } from 'zent'; -import "../../../assets/comm.css" -import PreviewItem from "./preview.js" -import { handelResponse, getThemeType, getSystemTemplate, getTheme, copyThemecustom } from "../../../assets/api.js" -let model = { - title: "落地页标题", - top_image: "", - middle_image: "", - describe: { type: "", content: "", bg_image: '' }, - bg_color: "#EEEEEE", - sort: 1, - type_id: { key: 2, text: '通用' }, - font_color: "#000000", - thumb: '' +import _ from 'lodash'; +import React from 'react'; +import { Button, Icon, Notify, RadioButton, RadioGroup } from 'zent'; +import { copyThemecustom, getSystemTemplate, getTheme, getThemeType, handelResponse } from "../../../assets/api.js"; +import "../../../assets/comm.css"; +import "./main.less"; +import PreviewItem from "./preview.js"; +let typeList={//1 白名单 3 兑换码 4优惠券 8 优惠券白名单 + '1':'access_conf', + '3':'exchange', + '4':'coupon', + '8':'coupon', } //商品列表 -let product_list = { - top_image: "", - list: "2", - font_color: "#ffffff", - button_color: "#FACD6A", - describe: { type: "", content: "", bg_image: '' }, -} -let product_detail = { - font_color: "#ffffff", - button_color: "#FACD6A", - describe: { type: "", content: "", bg_image: '' }, -} export default class mytemplate extends React.Component { constructor(props) { super(props) @@ -45,7 +27,7 @@ export default class mytemplate extends React.Component { activeHeight: 667, showType: 1, previewData: {}, - moudleData: {}, + moudleData: {}, //模版数据 previewwhite: {}, previewexchange: {}, system_template: [], @@ -71,86 +53,86 @@ export default class mytemplate extends React.Component { } onTypeChange(e) { this.setState({ showType: e.target.value, pageStep: 1, showPage: 1,detailType:3 }); - if (e.target.value == 1) {//白名单 - let previewwhite = { ...this.state.previewwhite } - this.setState({ previewData: previewwhite }); - } else if (e.target.value == 3) {//兑换码 - let previewexchange = { ...this.state.previewexchange } - this.setState({ previewexchange: previewexchange }); - this.setState({ previewData: previewexchange }); + let viewInfo=_.cloneDeep(this.state.moudleData); + let viewData=viewInfo[typeList[e.target.value]]; + if(!viewData){//新增模板,没有数据,需要拼接组装 + viewData={ + land:{ + describe:{} + }, + product_list:{ + list:'', + describe:{} + + }, + product_detail:{ + describe:{} + } + } } + this.setState({ previewData: viewData}); } - componentDidMount(e) { + componentDidMount() { let self = this; getThemeType().then(res => { - handelResponse(res, (req, msg) => { + handelResponse(res, () => { let typeListSource = res.data.map(it => { return { id: it.id, title: it.name } }); let typelistData = self.state.typeList.concat(typeListSource); self.setState({ typeList: typelistData }); - }, (err) => { + }, () => { }) - }).catch(err => { + }).catch(() => { }); let data = { page: 1, limit: 10 } getSystemTemplate(data).then(res => { - handelResponse(res, (req, msg) => { + handelResponse(res, (req) => { this.setState({ system_template: req.data }) - }, (err) => { + }, () => { }) - }).catch(err => { + }).catch(() => { }); //监听滚动条滚动事件 this.refs.component.addEventListener('scroll', (event) => { let scrolHeight = event.target.scrollTop; + let endreq = this.state.endreq; if (scrolHeight > 300) { - this.setState({ toTopFlag: true }); - this.setState({ toTopshow: false }); + this.setState({ toTopFlag: true,toTopshow: false }); let isBottom = event.target.scrollHeight - event.target.clientHeight; - console.log('到底了',Math.round(isBottom)); - console.log('设备高度',Math.round(event.target.scrollTop)); - if (Math.round(isBottom)== Math.round(event.target.scrollTop)) { - let endreq = this.state.endreq; - if (endreq) { - let page = this.state.page;//请求 - page = page + 1; - let data = { page: page, limit: 10 } - if (this.state.sourceIndex == 0) {//系统模板 - if (this.state.typeIndex != 0) { - data.type_id = this.state.typeIndex; - } - let preResult = this.state.system_template; - getSystemTemplate(data).then(res => { - handelResponse(res, (req, msg) => { - if (0 { - - }) - }).catch(err => { - }); - } else { - let preResult = this.state.system_template; - getTheme(data).then(res => { - handelResponse(res, (req, msg) => { - if (req.data.length > 0) { - let addres = preResult.concat(req.data) - this.setState({ system_template: addres, page: page }) - } else { - this.setState({ endreq: false }); - } - }, (err) => { - }) - }).catch(err => { - }); - } + if (Math.round(isBottom)== Math.round(event.target.scrollTop)&&endreq) { + let preResult = this.state.system_template; + let page = this.state.page;//请求 + page = page + 1; + let data = { page: page, limit: 10 } + if (this.state.sourceIndex == 0) {//系统模板 + if(this.state.typeIndex != 0) data.type_id = this.state.typeIndex; + getSystemTemplate(data).then(res => { + handelResponse(res, (req) => { + if (0 { + }) + }).catch(() => { + }); + } else { + getTheme(data).then(res => { + handelResponse(res, (req) => { + if (req.data.length > 0) { + let addres = preResult.concat(req.data) + this.setState({ system_template: addres, page: page }) + } else { + this.setState({ endreq: false }); + } + }, () => { + }) + }).catch(() => { + }); } } } else { @@ -168,127 +150,79 @@ export default class mytemplate extends React.Component { } typeClick(e) { this.setState({ typeIndex: e, page: 1, endreq: true }) - if (e == 0)//全部 - { - let data = { page: 1, limit: 10 } - getSystemTemplate(data).then(res => { - handelResponse(res, (req, msg) => { - console.log(req) - this.setState({ system_template: req.data }) - if (req.data.length < 10) { - this.setState({ endreq: false }); - } - }, (err) => { - - }) - }).catch(err => { - }); - } else { - let data = { type_id: e, page: 1, limit: 10 } - getSystemTemplate(data).then(res => { - handelResponse(res, (req, msg) => { - this.setState({ system_template: req.data }) - if (req.data.length < 10) { - this.setState({ endreq: false }); - } - }, (err) => { - - }) - }).catch(err => { - }); - - } + let data = { page: 1, limit: 10 } + if(e) data.type_id=e; + getSystemTemplate(data).then(res => { + handelResponse(res, (req) => { + console.log(req) + this.setState({ system_template: req.data }) + if (req.data.length < 10) { + this.setState({ endreq: false }); + } + }, () => { + }) + }).catch(() => { + }); } sourceClick(e) { this.setState({ sourceIndex: e, page: 1, endreq: true }) - + let data = { page: 1, limit: 10 } if (e == 0) { - let data = { page: 1, limit: 10 } getSystemTemplate(data).then(res => { - handelResponse(res, (req, msg) => { + handelResponse(res, (req) => { this.setState({ system_template: req.data }) - }, (err) => { + }, () => { }) - }).catch(err => { + }).catch(() => { }); } else { - let data = { page: 1, limit: 10 } getTheme(data).then(res => { - handelResponse(res, (req, msg) => { + handelResponse(res, (req) => { this.setState({ system_template: req.data }) - }, (err) => { + }, () => { }) - }).catch(err => { + }).catch(() => { }); } } onPreview(row) { - let rowdata = {}; - rowdata.model = model; - rowdata.product_list = product_list; - rowdata.product_detail = product_detail; - let exchangedata = {} - exchangedata.model = model; - exchangedata.product_list = product_list; - exchangedata.product_detail = product_detail; - this.setState({ moudleData: row, showPage: 1, pageStep: 1, activeHeight: 667, setStyle: { width: '375px', height: '667px', transform: 'scale(0.75)' } }); - if (row.access_conf) { - rowdata.model = row.access_conf.land; - rowdata.product_list = row.access_conf.product_list; - rowdata.product_detail = row.access_conf.product_detail; - } - if (row.exchange) { - exchangedata.model = row.exchange.land; - exchangedata.product_list = row.exchange.product_list; - exchangedata.product_detail = row.exchange.product_detail; - } - this.setState({ preview_url: row.href }) - this.setState({ preview_visible: true, showType: row.page }) - this.setState({ previewwhite: rowdata }) - this.setState({ previewexchange: exchangedata }) - if (row.page == 1) { - this.setState({ previewData: rowdata }); - } else { - this.setState({ previewData: exchangedata }); + let templateType=this.state.sourceIndex; //0 系统模版 1:我的模板 + let previewInfo; + if(templateType==1){ + previewInfo=row[typeList[row.page]] + }else{ + previewInfo=row.exchange; } + console.log(14,previewInfo); + this.setState({ preview_visible: true,previewData:previewInfo, showType: row.page,moudleData: row, showPage: 1, pageStep: 1, activeHeight: 667, setStyle: { width: '375px', height: '667px', transform: 'scale(0.75)' } }); } onUse(row, type) { - let self = this; if (row.edit == 0) { Notify.error("该模板是定制模板无法编辑"); return } if (this.state.sourceIndex == 0) { copyThemecustom(row.id).then(res => { - handelResponse(res, (req, msg) => { + handelResponse(res, (req) => { row.id = req.id; sessionStorage.setItem("pageInfo", JSON.stringify(row)) sessionStorage.setItem("isSort", 0) - sessionStorage.setItem('mouldType', 1); sessionStorage.setItem('pageChange', 0); - if (type) { - window.location.href = "/#/edittemplate?type=" + type; - } else { - window.location.href = "/#/edittemplate?type=" + row.page; - } - }, (err) => { + }, () => { }) - }).catch(err => { + }).catch(() => { }); - - } - else { + }else { sessionStorage.setItem("pageInfo", JSON.stringify(row)) - sessionStorage.setItem('mouldType', 1); - if (type) { - window.location.href = "/#/edittemplate?type=" + type; - } else { - window.location.href = "/#/edittemplate?type=" + row.page; - } sessionStorage.setItem('pageChange', 1); } - + sessionStorage.setItem('mouldType', 1); + if (type) { + window.location.href = "/#/edittemplate?type=" + type; + } else { + window.location.href = "/#/edittemplate?type=" + row.page; + } } toTop() { this.refs.component.scrollTo({ @@ -347,7 +281,7 @@ export default class mytemplate extends React.Component { { this.state.sourceList.map((child, c_index) => { return ( -
{ this.sourceClick(c_index) }} > +
{ this.sourceClick(c_index) }} > {child.title}
) @@ -362,7 +296,7 @@ export default class mytemplate extends React.Component { { this.state.typeList.map((child, c_index) => { return ( -
{ this.typeClick(c_index) }} key={c_index} > +
{ this.typeClick(c_index) }} key={c_index} > {child.title}
) @@ -398,11 +332,11 @@ export default class mytemplate extends React.Component {
- { this.onPreview(child) }}> + { this.onPreview(child) }}>
预览
- { this.onUse(child) }}> + { this.onUse(child) }}>
使用
@@ -470,7 +404,7 @@ export default class mytemplate extends React.Component { ) : null}
+ onClick={() => { this.onUse(this.state.moudleData, this.state.showType) }}> 使用
diff --git a/src/pages/exchangepage/template/preview.js b/src/pages/exchangepage/template/preview.js index a821372e..89384268 100644 --- a/src/pages/exchangepage/template/preview.js +++ b/src/pages/exchangepage/template/preview.js @@ -1,186 +1,372 @@ -import ReactDOM from 'react-dom'; -import React, { Component } from 'react'; -import { Button } from 'zent'; -import { RadioGroup, RadioButton, Input, openDialog, Dialog, Notify, Switch, Swiper, Dropdown, DropdownPosition, DropdownClickTrigger, Icon, MenuItem, DropdownContent, Menu, Sweetalert } from 'zent'; -import "../../../assets/comm.css" -import _ from "lodash"; -import '../edittemplate/goodstemplate' -import "./preview.less" -import SearchBarView from '../edittemplate/couponConfig/searchBar' //商品详情搜索栏 -import BottomBarView from '../edittemplate/couponConfig/bottomBar' //底部栏 - -import Descteplate from "../edittemplate/goodsdesc.js" +import React from "react"; +import "../../../assets/comm.css"; +import BottomBarView from "../edittemplate/couponConfig/bottomBar"; //底部栏 +import SearchBarView from "../edittemplate/couponConfig/searchBar"; //商品详情搜索栏 +import Descteplate from "../edittemplate/goodsdesc.js"; +import "../edittemplate/goodstemplate"; +import "./preview.less"; export default class preview extends React.Component { - constructor(props) { - super(props) - this.state = { - layout: "list", - type: 1, - top_url: "", - activeshow: false, - detailactiveshow: false, - top_image: 'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220105/59ba305520d3229e7fc53d5229bfec0c.png', - middle_image: 'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220105/5dd765e3b46042f7ecd8c576e6fa9568.png', - } - } - componentDidMount(e) { - // let center = document.getElementById("preview-center") - // let img = document.getElementById("preview-center-img") - // // center.style.height = img.scrollHeight + "px"; - // let imgHeight=this.refs; - // img.onload = function (e) { - // center.style.height = imgHeight.middleCenter.clientHeight + "px"; - // } + constructor(props) { + super(props); + this.state = { + layout: "list", + type: 1, + top_url: "", + activeshow: false, + detailactiveshow: false, + top_image: + "https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220105/59ba305520d3229e7fc53d5229bfec0c.png", + middle_image: + "https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220105/5dd765e3b46042f7ecd8c576e6fa9568.png", + }; + } + showactiveIcon(c) { + this.setState({ activeshow: false }); + } + opendescFn() { + this.setState({ activeshow: true }); + } + showactivedetail(c) { + this.setState({ detailactiveshow: false }); + } + opendetaildescFn() { + this.setState({ detailactiveshow: true }); + } + componentDidUpdate() { + document.querySelector("#previewbg").scrollTop = 0; + } + render() { + let propsData = this.props.data; + let goodsConfig = propsData.product_list; + let naVisual = []; + if (goodsConfig&&goodsConfig.bottomBar) { + naVisual = goodsConfig.bottomBar.navlist.filter((item) => item.iswitch); + } + return ( +
+
+ {this.props.step == 1 ? ( +
+
+ {propsData.land.top_image ? ( + + ) : ( + + )} +
+
+ {propsData.land.middle_image ? ( + + ) : ( + + )} + {this.props.pageType == 1 ? ( + + ) : ( + + )} +
+
+
+ {propsData.land.describe.bg_image ? ( + + ) : null} + {propsData.land.describe.content ? ( +
+ ) : null} +
+
+ ) : null} + {this.props.step == 2 ? ( + this.state.activeshow && + propsData.product_list.describe.type == 2 && + propsData.product_list.describe.content ? ( + this.showactiveIcon(c)} + goodsdata={propsData.product_list} + /> + ) : ( +
+ {goodsConfig.search && goodsConfig.search.iswitch ? ( + + ) : null} + + {!propsData.product_list.top_image ? ( + + ) : ( + + )} + {goodsConfig.picture && goodsConfig.picture.iswitch ? ( + + ) : null} + {goodsConfig.title && + goodsConfig.title.iswitch && + goodsConfig.title.comstyle == 1 ? ( +
+ {goodsConfig.title.text} +
+ ) : null} + {goodsConfig.title && + goodsConfig.title.iswitch && + goodsConfig.title.comstyle == 2 ? ( + + ) : null} - } - exchangeBtn() { + {(goodsConfig.title && + goodsConfig.title.iswitch && + goodsConfig.title.text) || + (goodsConfig.picture && + goodsConfig.picture.iswitch && + goodsConfig.picture.img) ? ( +
+ ) : null} - } - showactiveIcon(c) { - this.setState({ activeshow: false }); - } - opendescFn() { - this.setState({ activeshow: true }); - } - showactivedetail(c) { - this.setState({ detailactiveshow: false }); - } - opendetaildescFn() { - this.setState({ detailactiveshow: true }); - } - componentDidUpdate(){ - document.querySelector('#previewbg').scrollTop = 0 - } - render() { - let propsData = this.props.data; - let goodsConfig=propsData.product_list; - let naVisual=[] - if(goodsConfig.bottomBar){ - naVisual=goodsConfig.bottomBar.navlist.filter(item=>item.iswitch); - } - console.log(53,this.props); - return ( -
-
- { - this.props.step == 1 ? ( -
-
- { - propsData.model.top_image ? : - } -
-
- { - propsData.model.middle_image ? : - } - { - this.props.pageType == 1 ? : - } -
-
-
- { - propsData.model.describe.bg_image ? : null - } - { - propsData.model.describe.content ?
: null - } -
-
- ) : null - } - { - this.props.step == 2 ? this.state.activeshow && propsData.product_list.describe.type == 2 && propsData.product_list.describe.content ? this.showactiveIcon(c)} goodsdata={propsData.product_list} /> :
- { - goodsConfig.search&&goodsConfig.search.iswitch? - :null - } - - { - !propsData.product_list.top_image ? : - } - { - goodsConfig.picture&&goodsConfig.picture.iswitch?:null - } - { - goodsConfig.title&&goodsConfig.title.iswitch&&goodsConfig.title.comstyle==1?
{goodsConfig.title.text}
:null - } - { - goodsConfig.title&&goodsConfig.title.iswitch&&goodsConfig.title.comstyle==2? - - :null - } + {propsData.product_list.list == 2 ? ( + + ) : propsData.product_list.list == 3 ? ( + + ) : ( + + )} + {propsData.product_list.list == 2 ? ( + + ) : null} + {propsData.product_list.describe.type == 1 ? ( + + ) : propsData.product_list.describe.type == 3 ? ( +
+ ) : null} + {propsData.product_list.describe.type == 2 ? ( + + ) : null} + {goodsConfig.bottomBar && + goodsConfig.bottomBar.iswitch && + naVisual.length > 1 ? ( + + ) : null} +
+ ) + ) : null} - { - goodsConfig.title&&goodsConfig.title.iswitch&&goodsConfig.title.text||goodsConfig.picture&&goodsConfig.picture.iswitch&&goodsConfig.picture.img?
:null - - } - - { - propsData.product_list.list == 2 ? : propsData.product_list.list == 3 ? : - } - { - propsData.product_list.list == 2 ? : null - } - { - propsData.product_list.describe.type == 1 ? : propsData.product_list.describe.type == 3 ?
: null - } - { - propsData.product_list.describe.type == 2 ? : null - } - { - goodsConfig.bottomBar&&goodsConfig.bottomBar.iswitch&&naVisual.length>1? :null - } -
: null - } - - { - this.props.step == 3 ? this.state.detailactiveshow && propsData.product_detail.describe.type == 2 && propsData.product_detail.describe.content ? this.showactivedetail(c)} goodsdata={propsData.product_detail} /> : ( -
- - -

- -

- { - propsData.product_detail.describe.bg_image && propsData.product_detail.describe.type == 1 ? : propsData.product_detail.describe.type == 3 ?
: null - } - { - propsData.product_detail.describe.type == 2 ? : null - } - { - [1,3].includes(this.props.pageType)?: -
-
-

¥0.00

-

共省¥0.01

-
- -
- } -
- ) : null - } - { - this.props.step==4?
- - { - [1,3].includes(this.props.pageType)?null: -
-
-

¥0.00

-

共省¥0.01

-
- -
- } -
- :null - } -
- -
- ) - } + {this.props.step == 3 ? ( + this.state.detailactiveshow && + propsData.product_detail.describe.type == 2 && + propsData.product_detail.describe.content ? ( + this.showactivedetail(c)} + goodsdata={propsData.product_detail} + /> + ) : ( +
+ + +

+ +

+ {propsData.product_detail.describe.bg_image && + propsData.product_detail.describe.type == 1 ? ( + + ) : propsData.product_detail.describe.type == 3 ? ( +
+ ) : null} + {propsData.product_detail.describe.type == 2 ? ( + + ) : null} + {[1, 3].includes(this.props.pageType) ? ( + + ) : ( +
+
+

¥0.00

+

共省¥0.01

+
+ +
+ )} +
+ ) + ) : null} + {this.props.step == 4 ? ( +
+ + {[1, 3].includes(this.props.pageType) ? null : ( +
+
+

¥0.00

+

共省¥0.01

+
+ +
+ )} +
+ ) : null} +
+
+ ); + } }