优化落地页编辑模块代码

This commit is contained in:
Apple 2022-08-25 14:22:08 +08:00
parent 3d733e2205
commit 2241437012
2 changed files with 126 additions and 171 deletions

View File

@ -1,21 +1,13 @@
import ReactDOM from 'react-dom' import React from 'react'
import React, { Component } from 'react'
import './main.less' import './main.less'
import '../../../assets/comm.css' import '../../../assets/comm.css'
import { import {
Notify, Notify,
BlockLoading, BlockLoading,
Button, Button,
Input,
onUpload,
RadioGroup, RadioGroup,
RadioButton, RadioButton
Dropdown,
Icon
} from 'zent' } from 'zent'
import Ipt from '../../../components/input/main'
import Form from '../../../components/form/main'
import FormItem from '../../../components/form-item/main'
import { import {
uploadImg, uploadImg,
handelResponse, handelResponse,
@ -88,7 +80,6 @@ export default class edittemplate extends React.Component {
activeHeight: 667, activeHeight: 667,
pageStep: 1, pageStep: 1,
showPage: 1, showPage: 1,
fontSize: 10000 / (375 * 0.75),
setStyle: { width: '375px', height: '667px', transform: 'scale(0.75)' }, setStyle: { width: '375px', height: '667px', transform: 'scale(0.75)' },
detailType: 1 //详情页1 权益 2-立减金 detailType: 1 //详情页1 权益 2-立减金
} }
@ -579,44 +570,9 @@ export default class edittemplate extends React.Component {
showactivedetail(c) { showactivedetail(c) {
this.setState({ detailactiveshow: false }) this.setState({ detailactiveshow: false })
} }
onUpload = (file, report) => {
return new Promise((resolve, reject) => {
let path = ''
let formdata = new FormData()
formdata.append('file', file)
formdata.append('path', 'common_image')
uploadImg(formdata).then((res) => {
handelResponse(
res,
(req, msg) => {
path = req.path
},
(err) => {
reject()
}
)
})
let count = 0
const update = () => {
if (path) {
resolve(path)
} else {
if (count < 100) {
count += 2
report(count)
setTimeout(update, 500)
} else {
reject()
}
}
}
setTimeout(update, 500)
})
}
handleSize(width, height) { handleSize(width, height) {
let style = { width: width + 'px', height: height + 'px' } let style = { width: width + 'px', height: height + 'px' }
let fontSize = null
switch (height) { switch (height) {
case 667: case 667:
style = { width: '375px', height: '667px', transform: 'scale(0.75)' } style = { width: '375px', height: '667px', transform: 'scale(0.75)' }

View File

@ -23,7 +23,6 @@ export default class previewEffect extends React.Component {
} }
handleSize(width, height) { handleSize(width, height) {
let style = { width: width + 'px', height: height + 'px' } let style = { width: width + 'px', height: height + 'px' }
let fontSize = null
switch (height) { switch (height) {
case 667: case 667:
style = { width: '375px', height: '667px', transform: 'scale(0.75)' } style = { width: '375px', height: '667px', transform: 'scale(0.75)' }