s-material-react 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,7 +5,7 @@ export interface ListType {
|
|
|
5
5
|
goodsName: string;
|
|
6
6
|
pricesetNprice: number;
|
|
7
7
|
}
|
|
8
|
-
export declare function useGoodsList(classtreeCode: string, filterParmas: FilterType): {
|
|
8
|
+
export declare function useGoodsList(classtreeCode: string, searchParam: string, filterParmas: FilterType): {
|
|
9
9
|
loading: boolean;
|
|
10
10
|
getData: (...args: any[]) => any;
|
|
11
11
|
list: ListType[];
|
|
@@ -11,7 +11,7 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
11
11
|
import { find } from '@brushes/api';
|
|
12
12
|
import { _, useImmutableCallback } from '@brushes/tools';
|
|
13
13
|
const { isEmpty } = _;
|
|
14
|
-
export function useGoodsList(classtreeCode, filterParmas) {
|
|
14
|
+
export function useGoodsList(classtreeCode, searchParam, filterParmas) {
|
|
15
15
|
const isCanScroll = useRef(true);
|
|
16
16
|
const num = useRef(0);
|
|
17
17
|
const [list, setList] = useState([]);
|
|
@@ -37,6 +37,7 @@ export function useGoodsList(classtreeCode, filterParmas) {
|
|
|
37
37
|
goodsType: '00,50',
|
|
38
38
|
page: num.current,
|
|
39
39
|
rows: 10,
|
|
40
|
+
searchParam,
|
|
40
41
|
classtreeCode
|
|
41
42
|
});
|
|
42
43
|
if (isEmpty(response.list)) {
|
|
@@ -5,10 +5,10 @@ import { QjMobileIcon } from '../../common/icon';
|
|
|
5
5
|
import { Filter } from './components/filter';
|
|
6
6
|
import { useGoodsList } from './hooks/useGoodsList';
|
|
7
7
|
import { routerMap } from '../../routerMap';
|
|
8
|
-
const GoodsListJsx = ({ classtreeCode = '' }) => {
|
|
8
|
+
const GoodsListJsx = ({ classtreeCode = '', searchParam = '' }) => {
|
|
9
9
|
const { View, Text } = useComponent();
|
|
10
10
|
const [filterParmas, setFilterParams] = useState({});
|
|
11
|
-
const { loading, getData, list } = useGoodsList(classtreeCode, filterParmas);
|
|
11
|
+
const { loading, getData, list } = useGoodsList(classtreeCode, searchParam, filterParmas);
|
|
12
12
|
return (_jsxs(View, Object.assign({ className: 'goodsList' }, { children: [_jsxs(View, Object.assign({ className: 'top-info' }, { children: [_jsxs(View, Object.assign({ className: 'top-info-search', onClick: () => navigatorImpl(routerMap.search) }, { children: [_jsx(QjMobileIcon, { value: "fenxiang" }), _jsx(Text, { children: "\u641C\u7D22\u5546\u54C1" })] })), _jsx(Filter, { setParams: setFilterParams })] })), _jsx(View, Object.assign({ className: 'listWrap' }, { children: _jsxs(ScrollView, Object.assign({ onScroll: () => getData(filterParmas), style: { height: '100vh' } }, { children: [_jsx(View, Object.assign({ className: 'list' }, { children: list.map((item) => {
|
|
13
13
|
return (_jsxs(View, Object.assign({ onClick: () => navigatorImpl(`${routerMap.goodDetail}?skuCode=${item.skuCode}`), className: 'listItem' }, { children: [_jsx(View, { className: 'img', style: { backgroundImage: `url(${item.dataPic})` } }), _jsx(Text, Object.assign({ className: 'name' }, { children: item.goodsName })), _jsxs(Text, Object.assign({ className: 'price' }, { children: ["\uFFE5 ", item.pricesetNprice.toFixed(2)] }))] }), item.skuCode));
|
|
14
14
|
}) })), loading ? _jsx(Loading, {}) : null] })) }))] })));
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
import { useComponent } from '@brushes/qj-simulate-component';
|
|
3
|
+
import { navigatorImpl, useComponent } from '@brushes/qj-simulate-component';
|
|
4
4
|
import { SEARCH } from '../../static';
|
|
5
5
|
import { getEnv } from '@brushes/api';
|
|
6
|
+
import { routerMap } from '../../routerMap';
|
|
6
7
|
const flag = getEnv();
|
|
7
8
|
const fake = ['衣服', '裤子'];
|
|
8
9
|
const SearchPageJsx = ({ placeholder, placeholderText, history }) => {
|
|
9
10
|
const { View, Text } = useComponent();
|
|
10
11
|
const searchGoodsImpl = (e) => {
|
|
11
|
-
console.log(19, e);
|
|
12
|
+
console.log(19, e.detail.value);
|
|
13
|
+
navigatorImpl(`${routerMap.goodList}?searchParam=${e.detail.value}`);
|
|
12
14
|
};
|
|
13
|
-
return (_jsxs(View, Object.assign({ className: 'searchPage', style: { height: flag ? '100vh' : '600px' } }, { children: [_jsxs(View, Object.assign({ className: 'search-title' }, { children: [_jsx("img", { src: SEARCH, alt: "" }), _jsx("input", Object.assign({ "confirm-type": "search", type: "text", className: 'content',
|
|
15
|
+
return (_jsxs(View, Object.assign({ className: 'searchPage', style: { height: flag ? '100vh' : '600px' } }, { children: [_jsxs(View, Object.assign({ className: 'search-title' }, { children: [_jsx("img", { src: SEARCH, alt: "" }), _jsx("input", Object.assign({ "confirm-type": "search", type: "text", className: 'content', onConfirm: searchGoodsImpl }, (placeholder ? { placeholder: placeholderText } : {}))), _jsx(Text, Object.assign({ className: 'btn' }, { children: "\u53D6\u6D88" }))] })), history ? (_jsxs(View, Object.assign({ className: 'historyWrap' }, { children: [_jsxs(View, Object.assign({ className: 'title' }, { children: [_jsxs(View, Object.assign({ className: 'label' }, { children: [_jsx(View, { className: 'icon' }), "\u5386\u53F2\u641C\u7D22\u8BB0\u5F55"] })), _jsx(Text, Object.assign({ className: 'clear' }, { children: "\u6E05\u9664" }))] })), _jsx(View, Object.assign({ className: 'content' }, { children: fake.map((item, index) => {
|
|
14
16
|
return (_jsx(View, Object.assign({ className: 'historyItem' }, { children: item }), index));
|
|
15
17
|
}) }))] }))) : null] })));
|
|
16
18
|
};
|