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