From 48f054517f76bac3a0bb1a46e57d5cbdac13fc64 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Fri, 25 Nov 2022 14:23:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20perf(=E5=AE=8C=E6=88=90=E4=BC=98?= =?UTF-8?q?=E5=8C=96):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 4 +- src/components/LabAndImg/index.tsx | 17 ++++- src/components/sideBar/index.tsx | 13 ++-- .../details/components/orderCount/index.tsx | 2 +- src/pages/details/index.module.scss | 9 ++- src/pages/details/index.tsx | 2 +- .../components/productClass/index.module.scss | 47 ++++++++---- .../index/components/productClass/index.tsx | 71 ++++++++++--------- src/pages/order/components/scanPay/index.tsx | 2 +- src/pages/userEdit/index.tsx | 7 -- 10 files changed, 105 insertions(+), 69 deletions(-) diff --git a/config/index.js b/config/index.js index 389f1a5..cbc3245 100644 --- a/config/index.js +++ b/config/index.js @@ -60,7 +60,9 @@ const config = { postcss: { pxtransform: { enable: true, - config: {}, + config: { + onePxTransform: false, + }, }, url: { enable: true, diff --git a/src/components/LabAndImg/index.tsx b/src/components/LabAndImg/index.tsx index 7aee959..5fff9dc 100644 --- a/src/components/LabAndImg/index.tsx +++ b/src/components/LabAndImg/index.tsx @@ -19,7 +19,7 @@ type Param = { name?: string } export default memo(({ value, onClick, showStatus = false, round = false, name = '' }: Param) => { - const [imgs, setImgs] = useState([]) + const [imgs, setImgs] = useState('') //lab是否都是0 const rgbStyle = useMemo(() => { @@ -35,7 +35,7 @@ export default memo(({ value, onClick, showStatus = false, round = false, name = let imgs = value.texture_url.split(',').map((item) => { return formatImgUrl(item) }) - setImgs(() => imgs) + setImgs(() => imgs[0]) } }, [value]) @@ -50,10 +50,21 @@ export default memo(({ value, onClick, showStatus = false, round = false, name = setLabAndImgShow(true) } + const checkLoad = (val) => { + setImgs(() => formatImgUrl('')) + } + return ( <> onShowLabAndImg()}> - {value.texture_url && } + {value.texture_url && ( + checkLoad(e)} + className={styles.labAndImg_image} + style={{ borderRadius: round ? '50%' : '' }}> + )} {!value.texture_url && rgbStyle && } {!value.texture_url && !rgbStyle && ( diff --git a/src/components/sideBar/index.tsx b/src/components/sideBar/index.tsx index d8ec31a..6d800bb 100644 --- a/src/components/sideBar/index.tsx +++ b/src/components/sideBar/index.tsx @@ -1,8 +1,8 @@ import { ScrollView, View } from '@tarojs/components' -import React, { memo, ReactNode, useEffect, useRef, useState } from 'react' +import React, { memo, ReactNode, useEffect, useLayoutEffect, useRef, useState } from 'react' import styles from './index.module.scss' import classnames from 'classnames' -import Taro, { useReady } from '@tarojs/taro' +import Taro, { getCurrentInstance, useReady, useRouter } from '@tarojs/taro' import InfiniteScroll, { StatusParam } from '../infiniteScroll' import LoadingCard from '../loadingCard' import ProductClass from '@/pages/index/components/productClass' @@ -73,7 +73,7 @@ export default memo( } } - useReady(() => { + useEffect(() => { Taro.nextTick(() => { let query = Taro.createSelectorQuery() query @@ -85,16 +85,17 @@ export default memo( let ratio = 750 / clientWidth let height = clientHeight * ratio num_half.current = Math.ceil(height / 2 / heightItem) + console.log('num_half::', num_half) init() }) .exec() }) - }) + }, []) //二级面料系列分类 const [openClass, setOpenClass] = useState(false) const [classList, setClassList] = useState([]) - const [classId, setClassId] = useState(0) + const [classId, setClassId] = useState(-1) const { fetchData } = GetClassList() const getClassData = async (id) => { let res = await fetchData({ id }) @@ -111,7 +112,7 @@ export default memo( const getSelectClass = (id) => { selectClass?.(id) - setClassId(id) + setClassId(() => id) } return ( diff --git a/src/pages/details/components/orderCount/index.tsx b/src/pages/details/components/orderCount/index.tsx index cd90c9c..955e8e8 100644 --- a/src/pages/details/components/orderCount/index.tsx +++ b/src/pages/details/components/orderCount/index.tsx @@ -302,7 +302,7 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param height={400} /* 列表的高度 */ width='100%' /* 列表的宽度 */ itemData={list} /* 渲染列表的数据 */ - itemCount={list.length + 1} /* 渲染列表的长度 */ + itemCount={list.length} /* 渲染列表的长度 */ itemSize={100} /* 列表单项的高度 */ overscanCount={1}> {Rows} diff --git a/src/pages/details/index.module.scss b/src/pages/details/index.module.scss index 4e511b5..9b238eb 100644 --- a/src/pages/details/index.module.scss +++ b/src/pages/details/index.module.scss @@ -66,7 +66,9 @@ } .con { display: grid; - grid-template-columns: auto auto; + grid-template-columns: 50% 50%; + grid-template-rows: auto auto auto; + grid-template-areas: 'a b' 'c d' 'e e'; font-size: $font_size_medium; color: $color_font_three; background-color: rgba(247, 247, 247, 0.6); @@ -77,6 +79,10 @@ .des_text { display: flex; margin-bottom: 24px; + font-size: 26px; + &:nth-child(5) { + grid-area: e; + } text { flex: 1; color: #333333; @@ -95,6 +101,7 @@ .title { color: rgba(0, 0, 0, 0.8); font-weight: 500; + font-size: 28px; } .list { margin-top: 30px; diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index 537a5e1..6de3f91 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -247,7 +247,7 @@ export default (props: Params) => { - 客服 + 询货/咨询