jxy-identity-popover
v2.1.12
Published
| Name | Description | Default | Control | |------|-------------|---------|---------| | labelType | 编码类型, sku:商品编码, spu:款式编码 | 'sku' | - | | onFeedbackSuccess | 反馈成功回调函数<br/>`() => void` | - | - | | onFeedbackError | 反馈失败回调函数<br/>`(error: unknown) => void
Readme
API
| Name | Description | Default | Control |
|------|-------------|---------|---------|
| labelType | 编码类型, sku:商品编码, spu:款式编码 | 'sku' | - |
| onFeedbackSuccess | 反馈成功回调函数() => void | - | - |
| onFeedbackError | 反馈失败回调函数(error: unknown) => void | - | - |
| onSearchSuccess | 搜索成功回调函数(result: SearchResult[]) => void | - | - |
| onSearchError | 搜索失败回调函数(error: unknown) => void | - | - |
| onItemClick | 点击识别结果项的回调函数(item: SearchResult) => void | - | - |
| onVideoInitialSuccess | 摄像头初始化成功回调函数() => void | - | - |
| onVideoInitialError | 摄像头初始化失败回调函数(error: unknown) => void | - | - |
| onUploadSuccess | 上传成功回调函数() => void | - | - |
| onUploadError | 上传失败回调函数(error: unknown) => void | - | - |
SearchResult 类型定义
interface SearchResult {
sku_id: string; // 商品ID
i_id: string; // 图片ID
pic: string; // 图片URL
prop_value: string; // 属性值
pic_id: string; // 图片ID
pic_hash: string; // 图片哈希值
is_spu_pic: boolean; // 是否为SPU图片
search_score: number; // 搜索匹配度分数
}ERPAIIdentityPopoverRef 类型定义
interface ERPAIIdentityPopoverRef {
show: () => void; // 显示弹层
hide: () => void; // 隐藏弹层
}Demo
import {ERPAIIdentityPopover, type ERPAIIdentityPopoverRef,} from 'jxy-identity-popover';
render: (args) => {
const skuPopoverRef = useRef<ERPAIIdentityPopoverRef>(null);
const spuPopoverRef = useRef<ERPAIIdentityPopoverRef>(null);
return (
<Space direction="vertical" size="middle">
<Space>
<Button
onClick={() => {
skuPopoverRef.current?.show();
}}
>
打开商品编码识别
</Button>
<Button
onClick={() => {
spuPopoverRef.current?.show();
}}
>
打开款式编码识别
</Button>
</Space>
<ERPAIIdentityPopover
ref={skuPopoverRef}
onItemClick={(item) => console.log('点击结果项:', item)}
onSearchSuccess={(result) => console.log('搜索成功:', result)}
onSearchError={(error) => console.error('搜索失败:', error)}
onVideoInitialSuccess={() => console.log('摄像头初始化成功')}
onVideoInitialError={(error) => console.error('摄像头初始化失败:', error)}
onUploadSuccess={() => console.log('上传成功')}
onUploadError={(error) => console.error('上传失败:', error)}
onFeedbackSuccess={() => console.log('反馈成功')}
onFeedbackError={(error) => console.error('反馈失败:', error)}
labelType="sku"
/>
<ERPAIIdentityPopover
ref={spuPopoverRef}
onItemClick={(item) => console.log('点击结果项:', item)}
onSearchSuccess={(result) => console.log('搜索成功:', result)}
onSearchError={(error) => console.error('搜索失败:', error)}
onVideoInitialSuccess={() => console.log('摄像头初始化成功')}
onVideoInitialError={(error) => console.error('摄像头初始化失败:', error)}
onUploadSuccess={() => console.log('上传成功')}
onUploadError={(error) => console.error('上传失败:', error)}
onFeedbackSuccess={() => console.log('反馈成功')}
onFeedbackError={(error) => console.error('反馈失败:', error)}
labelType="spu"
/>
</Space>
);
}组件临时调试说明
一、清理 HSTS
打开chrome ,进入 页面 chrome://net-internals/#hsts, 在Delete domain security policies 中输入 w.erp321.com, 点击Delete清除强制https
hosts添加解析
127.0.0.1 w.erp321.com
