Commit dfcc7742 by 肖康

supplier

parent 7165f187
Showing with 10 additions and 22 deletions
const os = require('os');
export const QQURL='https://wpa.qq.com/msgrd?v=3&uin=1908059998&site=qq&menu=yes'
export const API_URL=((os.hostname()=="MS-NDPSTQVAWPAX"||os.hostname()=="dev235"||os.hostname()=="localhost"||os.hostname()=="erpweb.liexindev.com")?'http://erpweb.liexindev.net':'http://api.chiplinks.net')
console.log(os.hostname(),API_URL)
......@@ -63,26 +63,7 @@ const Page = (props: { cateList: ResponseTypeCateList }) => {
};
}, []);
const getSlideSupplierInit = (datasg: any[]) => {
let newSlideSupplier: any = []
datasg.forEach((item) => {
const id_ = String(item.supplier_id)
const name_ = String(item.supplier_name)
newSlideSupplier = [...newSlideSupplier, { id: id_, value: name_, checked: false }]
})
let uniqueBrand = newSlideSupplier.reduce((acc: any, current: any) => {
if (!acc.some((item: any) => item.id === current.id)) {
if (current.value) {
acc.push(current);
}
}
return acc;
}, []);
if (uniqueBrand.length > 0) {
uniqueBrand[0].checked = true
}
return uniqueBrand
}
useEffect(() => {
initSupplierList.current = []
......@@ -91,6 +72,13 @@ const Page = (props: { cateList: ResponseTypeCateList }) => {
getListRequest({ url: '/api/search/goodsSearch', method: 'post', data: { keyword: keyword, num: num, supplier_id: supplier_id, page: 1, page_size: 10 } }).then((res) => {
requestCount.current = requestCount.current + 1
if (res?.code === 0) {
let arr_=res.data || []
arr_.forEach(item=>{
(item.data||[]).forEach(item1=>{
item1!.supplier_name=String(item.supplier_name||"")
item1.supplier_id=item.supplier_id
})
})
initSupplierList.current = [...initSupplierList.current, ...(res.data || [])]
}
getInitData()
......@@ -183,7 +171,6 @@ const Page = (props: { cateList: ResponseTypeCateList }) => {
if (element) {
const elementTop = element.offsetTop;
const scrollPosition = elementTop - 100;
console.log(scrollPosition)
window.scrollTo({
top: scrollPosition,
behavior: 'smooth'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment