🦄 refactor:搜索页点击搜索
This commit is contained in:
parent
9342906c67
commit
c2fa0766aa
@ -30,14 +30,32 @@ page {
|
||||
justify-content: space-between;
|
||||
margin-bottom: 32px;
|
||||
|
||||
.histroyFonts {
|
||||
margin-left: 32px;
|
||||
font-size: 28px;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
.histroyLeft {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
.histroyFonts {
|
||||
margin-left: 32px;
|
||||
font-size: 28px;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.back {
|
||||
margin-right: 32px;
|
||||
font-size: 28px;
|
||||
font-family: PingFangSC-Regular, PingFang SC;
|
||||
font-weight: 400;
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.icon_delect {
|
||||
margin-right: 45px;
|
||||
color: #f7f7f7;
|
||||
|
@ -144,7 +144,6 @@ export default memo(() => {
|
||||
const [goodObj, setGoodsobj] = useState({})
|
||||
//点击对应商品显示购物车
|
||||
const showCart = async (item) => {
|
||||
console.log(item, 6666)
|
||||
setSearchObj((e) => ({ ...e, goodsId: item.id }))
|
||||
setShowShopCart(true)
|
||||
setGoodsobj(item)
|
||||
@ -269,6 +268,25 @@ export default memo(() => {
|
||||
setGoodlist([...goodList])
|
||||
}
|
||||
|
||||
//点击关键字搜索内容
|
||||
const handItem = (item) => {
|
||||
Taro.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
})
|
||||
productFetch({ code_or_name: item.search_key }).then((res) => {
|
||||
if (res.data) {
|
||||
setHasFonts(true)
|
||||
setSearchList([...res.data.list])
|
||||
Taro.hideLoading()
|
||||
}
|
||||
})
|
||||
}
|
||||
//点击返回文字
|
||||
const handBack = () => {
|
||||
setHasFonts(false)
|
||||
setSearchList([])
|
||||
}
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<Search placeholder='请输入搜索布料' showBtn={false} changeOnSearch={getSearchData} debounceTime={300} >
|
||||
@ -285,7 +303,7 @@ export default memo(() => {
|
||||
<View className={styles.bigBox}>
|
||||
{histroyList.map((item, index) => {
|
||||
return (
|
||||
<View key={index} className={styles.itemBox}>{item.search_key}</View>
|
||||
<View onClick={() => handItem(item)} key={index} className={styles.itemBox}>{item.search_key}</View>
|
||||
)
|
||||
})}
|
||||
</View>
|
||||
@ -298,7 +316,10 @@ export default memo(() => {
|
||||
{
|
||||
hasFonts && <>
|
||||
<View className={styles.topBox}>
|
||||
<View className={styles.histroyFonts}>搜索结果</View>
|
||||
<View className={styles.histroyLeft}>
|
||||
<View className={styles.histroyFonts}>搜索结果</View>
|
||||
<View className={styles.back} onClick={() => handBack()}>返回</View>
|
||||
</View>
|
||||
</View>
|
||||
{
|
||||
!!searchList.length && searchList.map((item, index) => {
|
||||
|
@ -2,7 +2,7 @@
|
||||
font-family: "iconfont";
|
||||
/* Project id 3619513 */
|
||||
src:
|
||||
url('iconfont.ttf?t=1663065236955') format('truetype');
|
||||
url('/src/styles/iconfont.ttf') format('truetype');
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
|
Loading…
x
Reference in New Issue
Block a user