- 修改首页轮播图组件,替换为新的 Banner 组件实现 - 新增广告图片数据标准化处理函数,支持多种字段格式兼容 - 优化首页广告数据加载逻辑,改用 Promise.allSettled 并行请求 - 修复轮播图高度计算,添加数字转换安全处理 - 调整经销商申请页面文本,将"入驻申请"改为"门店入驻" - 修复商品卡片图片显示,添加空值处理防止报错 - 临时隐藏搜索栏组件,设置为隐藏状态 - 恢复开发环境 API 地址配置,便于本地调试 - 移除经销商申请表单中邀请人 ID 的禁用状态
68 lines
1.8 KiB
TypeScript
68 lines
1.8 KiB
TypeScript
import {Search} from '@nutui/icons-react-taro'
|
|
import {Button, Input} from '@nutui/nutui-react-taro'
|
|
import {useState} from "react";
|
|
import Taro from '@tarojs/taro';
|
|
import { goTo } from '@/utils/navigation';
|
|
|
|
function MySearch(props: any) {
|
|
const [keywords, setKeywords] = useState<string>('')
|
|
|
|
const onKeywords = (keywords: string) => {
|
|
setKeywords(keywords)
|
|
}
|
|
|
|
const onQuery = () => {
|
|
if(!keywords.trim()){
|
|
Taro.showToast({
|
|
title: '请输入关键字',
|
|
icon: 'none'
|
|
});
|
|
return false;
|
|
}
|
|
// 跳转到搜索页面 - 使用新的导航工具,自动处理路径和参数
|
|
goTo('shop/search/index', { keywords: keywords.trim() });
|
|
}
|
|
|
|
// 点击搜索框跳转到搜索页面
|
|
const onInputFocus = () => {
|
|
goTo('shop/search/index');
|
|
}
|
|
|
|
|
|
return (
|
|
<div className={'z-50 left-0 w-full hidden'}>
|
|
<div className={'px-2'}>
|
|
<div
|
|
style={{
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
background: '#ffffff',
|
|
padding: '0 5px',
|
|
borderRadius: '20px',
|
|
marginTop: `${props.statusBarHeight + 50}px`,
|
|
}}
|
|
>
|
|
<Search size={18} className={'ml-2 text-gray-400'}/>
|
|
<Input
|
|
placeholder="搜索商品"
|
|
value={keywords}
|
|
onChange={onKeywords}
|
|
onConfirm={onQuery}
|
|
onFocus={onInputFocus}
|
|
style={{ padding: '9px 8px'}}
|
|
/>
|
|
<div
|
|
className={'flex items-center'}
|
|
>
|
|
<Button type="success" style={{background: 'linear-gradient(to bottom, #1cd98a, #24ca94)'}} onClick={onQuery}>
|
|
搜索
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default MySearch;
|