封装图片组件

This commit is contained in:
2022-06-10 15:41:33 +08:00
parent 8197140027
commit 38a3b348bd
57 changed files with 2899 additions and 181 deletions
@@ -1,9 +0,0 @@
import { memo } from "react";
export default memo(() => {
return (
<>
</>
)
})
@@ -81,12 +81,7 @@
width: 156.5px;
height: 156.5px;
border-radius: 20px;
background-color: red;
image{
width: 100%;
height: 100%;
border-radius: 20px;
}
}
.item_con{
flex:1;
@@ -15,6 +15,7 @@ import Taro, { useRouter } from "@tarojs/taro";
import UseLogin from "@/use/useLogin"
import { formatHashTag, formatPriceDiv } from "@/common/fotmat";
import { debounce, getFilterData } from "@/common/util";
import LabAndImg from "@/components/LabAndImg";
@@ -144,15 +145,15 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
const {getSelfUserInfo} = UseLogin()
const {fetchData:addFetchData} = AddShoppingCartApi()
const addShopCart = async () => {
try {
await getSelfUserInfo()
} catch(msg) {
Taro.showToast({
icon:'none',
title:'授权失败,请求完善授权'
})
return false
}
// try {
// await getSelfUserInfo()
// } catch(msg) {
// Taro.showToast({
// icon:'none',
// title:'授权失败,请求完善授权'
// })
// return false
// }
if(selectCount.sumCount == 0) {
Taro.showToast({
@@ -233,7 +234,7 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
{list.map(item => {
return <View className={styles.item} key={item.id}>
<View className={styles.item_color}>
<Image src={item.texture_url}/>
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
</View>
<View className={styles.item_con}>
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
@@ -273,4 +274,5 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
</Popup>
</View>
)
})
})
+2 -1
View File
@@ -14,6 +14,7 @@ import useLogin from '@/use/useLogin';
import { AnalysisShortCodeApi, BindShortCodeApi, GetShortCodeApi } from '@/api/share';
import { SHARE_SCENE } from '@/common/enum';
import useUserInfo from '@/use/useUserInfo';
import LabAndImg from '@/components/LabAndImg';
type item = {title:string, img:string, url:string, id:number}
@@ -167,7 +168,7 @@ export default (props:Params) => {
{productInfo?.product_color_list?.map(item => {
return <View className={styles.item} onClick={() => getColorItem(item)}>
<View className={styles.item_color}>
<Image src={formatImgUrl(item.texture_url)}></Image>
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
</View>
<View className={styles.item_name}>{item.code}</View>
</View>