🐞 fix(ID1001368领取色卡页面没自动显示默认的地址):

This commit is contained in:
czm 2023-02-28 16:35:57 +08:00
parent 2917f201ec
commit 2b57dd145f
2 changed files with 15 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import { Text, View } from '@tarojs/components'
import Taro, { getCurrentPages, useDidShow } from '@tarojs/taro'
import Taro, { getCurrentPages, useDidShow, useUnload } from '@tarojs/taro'
import { useCallback, useMemo, useRef, useState } from 'react'
import styles from './index.module.scss'
import type { AddressItem } from './components/address'
@ -48,7 +48,9 @@ export default () => {
getAddressDefault()
}
setRemarkData(info.remark)
})
useUnload(() => {
Taro.removeStorageSync('colorCard')
Taro.removeStorageSync('colorCardOther')
})
@ -127,12 +129,14 @@ export default () => {
const res = await addressListFetchData()
let defaultInfo: AddressItem|null = null
res?.data.list?.map((item) => {
if (item.is_default) {
defaultInfo = {
id: item.id,
address_title: item.province_name + item.city_name + item.district_name + item.address_detail,
address_name: item.name,
address_phone: item.phone,
}
}
})
submitData.current.address_id = defaultInfo!.id
setAddressInfo(defaultInfo!)

View File

@ -39,10 +39,11 @@
justify-content: space-between;
}
.card_info_label {
display: grid;
grid-template-columns: repeat(3, 100px);
display: flex;
flex-wrap: wrap;
grid-gap: 10px 10px;
margin-top: 10px;
width: 330px;
text {
font-size: 24px;
color: #4581ff;
@ -51,12 +52,13 @@
line-height: 34px;
background-color: rgba(69, 129, 255, 0.15);
border-radius: 8px;
padding: 5px 10px;
}
}
text {
&:nth-child(1) {
padding-right: 10px;
flex: 1;
// flex: 1;
@include common_ellipsis(2);
}
}