Commit 2983dfdd authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents ed7867bb bddcdc38
......@@ -4,6 +4,7 @@ import proxy from './proxy'
import theme from './lingxi.theme.config'
const OPEN_THEME_BUILD = process.env.NODE_ENV === 'production' ? true : false // 是否开启动态主题
const isProduction = process.env.NODE_ENV === 'production' ? true : false
const config: any = {
// 如需写入环境变量 需在config中先写入
......@@ -49,29 +50,29 @@ const config: any = {
defaultSizes: 'parsed', // stat // gzip
},
inlineLimit: 10000,
// chunks: ['vendors', 'umi'],
// chainWebpack: function (config, { webpack }) {
// config.merge({
// optimization: {
// minimize: true,
// splitChunks: {
// chunks: 'all',
// minSize: 30000,
// minChunks: 3,
// automaticNameDelimiter: '.',
// cacheGroups: {
// vendor: {
// name: 'vendors',
// test({ resource }) {
// return /[\\/]node_modules[\\/]/.test(resource);
// },
// priority: 10,
// },
// },
// },
// }
// });
// },
chunks: isProduction && ['vendors', 'umi'],
chainWebpack: function (config, { webpack }) {
isProduction && config.merge({
optimization: {
minimize: true,
splitChunks: {
chunks: 'all',
minSize: 30000,
minChunks: 3,
automaticNameDelimiter: '.',
cacheGroups: {
vendor: {
name: 'vendors',
test({ resource }) {
return /[\\/]node_modules[\\/]/.test(resource);
},
priority: 10,
},
},
},
}
});
},
cssLoader: {
localsConvention: 'camelCase', // 将style中的class由 .foo-body 转化为fooBody调用
},
......
......@@ -21,13 +21,13 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
if (min || min === 0) {
setMinCount(min)
if (value < min) {
onChange(min)
onChange(min, 'blur')
}
}
if (max || max === 0) {
setMaxCount(max)
if (value > max) {
onChange(max)
onChange(max, 'blur')
}
}
}, [min, max])
......@@ -35,14 +35,14 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
const handleReduce = (e) => {
e.stopPropagation()
if (value > minCount) {
onChange(Number(value) - 1)
onChange(Number(value) - 1, 'click')
}
}
const handleAdd = (e) => {
e.stopPropagation()
if (value < maxCount) {
onChange(Number(value) + 1)
onChange(Number(value) + 1, 'click')
}
}
......@@ -50,17 +50,22 @@ const InputNumber: React.FC<InputNumberPropsType> = (props) => {
const { value } = e.target;
const reg = /^\d*?$/;
if (reg.test(value)) {
onChange(value)
onChange(value, 'change')
}
}
const handleBlur = (e) => {
const { value } = e.target;
if (value === "") {
onChange(minCount)
onChange(minCount, 'blur')
} else {
Number(value) < minCount && onChange(minCount)
Number(value) > maxCount && onChange(maxCount)
if(Number(value) < minCount) {
onChange(minCount, 'blur')
} else if(Number(value) > maxCount) {
onChange(maxCount, 'blur')
} else {
onChange(value, 'blur')
}
}
}
......
......@@ -195,7 +195,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
setConfirmLoading(true)
let newParam: any = JSON.parse(JSON.stringify(newProps))
newParam.advertList = newParam.advertList.map((item) => {
if (!item.link.startsWith('http://') && !item.link.startsWith('https://')) {
if (!item.link && !item.link.startsWith('http://') && !item.link.startsWith('https://')) {
item.link = `http://${item.link}`
}
return item
......
......@@ -42,7 +42,7 @@ const Comment: React.FC<CommentPropsType> = (props) => {
}, [current])
const fetchCommentList = (type = '') => {
let param: any = {
const param: any = {
current,
pageSize,
productIds: productIds.toString() // '2339'
......@@ -55,7 +55,7 @@ const Comment: React.FC<CommentPropsType> = (props) => {
param.starLevel = 1
}
setSpinLoading(true)
//@ts-ignore
PublicApi.getMemberCommentMallTradeHistoryPage(param).then(res => {
setSpinLoading(false)
if (res.code === 1000) {
......@@ -85,7 +85,7 @@ const Comment: React.FC<CommentPropsType> = (props) => {
let middleCount = 0
let badCount = 0
if (data) {
for (let item of data) {
for (const item of data) {
switch (item.star) {
case 1:
case 2:
......@@ -103,9 +103,9 @@ const Comment: React.FC<CommentPropsType> = (props) => {
}
}
}
let allCount = goodCount + middleCount + badCount
const allCount = goodCount + middleCount + badCount
let result = [{
const result = [{
title: '全部评价',
sum: allCount,
sumText: allCount > 200 ? `(200+)` : `(${allCount})`,
......
......@@ -8,15 +8,10 @@ interface ImageViewListPropsType {
}
const ImageViewList: React.FC<ImageViewListPropsType> = (props) => {
const { imgList = []} = props
const [previewImage, setPreviewImage] = useState<number>(-1)
const [rotateZ, setRotateZ] = useState<number>(0)
const imgList = [
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1.jpg",
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-5.jpg",
"https://woodmartcdn-cec2.kxcdn.com/wp-content/uploads/2016/09/product-furniture-1-3.jpg"
]
const handlePreviewImg = (index: number) => {
if (previewImage !== index) {
setPreviewImage(index)
......@@ -39,7 +34,7 @@ const ImageViewList: React.FC<ImageViewListPropsType> = (props) => {
setRotateZ(0)
break
case 'preview':
let el = document.createElement('a')
const el = document.createElement('a')
el.href = imgList[previewImage];
el.target = '_blank';
el.click()
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment