Commit 4d3b078c authored by GuanHua's avatar GuanHua

feat:商品详情选择商品属性

parent e73b5644
......@@ -20,8 +20,11 @@ const ShopTemplate: React.FC = () => {
if (res.code === 1000) {
setTemplateList(res.data)
} else if (res.code === 47001) {
message.destroy()
message.info("您还未创建渠道商城,请先创建渠道商城")
history.push('/memberCenter/channekAbility/infoManage')
setTimeout(() => {
history.push('/memberCenter/channekAbility/infoManage')
}, 2000);
}
})
}
......
......@@ -10,7 +10,7 @@ export const mallLayoutConfig = {
"background": "#FFF"
}
},
"childNodes": ["1", "3", "4", "5", "6"]
"childNodes": ["1", "3", "4", "5", "18", "6"]
},
}
......
......@@ -158,7 +158,7 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
initIndex += 100
}
mallLayoutConfig["0"].childNodes = [...mallLayoutConfig["0"].childNodes, ...floorLineKeys, serviceAdvertConfig.key, CommonTitle2Config.key, AboutUsConfig.key, InformationConfig.key, FooterConfig.key]
mallLayoutConfig["0"].childNodes = [...mallLayoutConfig["0"].childNodes, ...floorLineKeys, serviceAdvertConfig.key, CommonTitle2Config.key, InformationConfig.key, FooterConfig.key]
let config = {
...mallLayoutConfig,
...topBarConfig,
......@@ -166,11 +166,11 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
...headerConfig,
...mainNavConfig,
...bannerAdvertConfig,
...AboutUsConfig,
...CommonTitle1Config,
...floorLineConfig,
...serviceAdvertConfig,
...CommonTitle2Config,
...AboutUsConfig,
...InformationConfig,
...FooterConfig
}
......
......@@ -104,7 +104,8 @@ const CommodityDetail = (props) => {
attrValId: attrItem.customerAttributeValue.id
}
})
if (JSON.stringify(temp) === JSON.stringify(selectAttrVal)) {
if (judgeArrisCommon(temp, selectAttrVal)) {
setSelectCommodityId(item.id)
setCurrentPriceRange(item.unitPrice)
}
......@@ -112,6 +113,17 @@ const CommodityDetail = (props) => {
}
}
const judgeArrisCommon = (list, otherList) => {
if (list.length === otherList.length) {
let result = list.every(listItem => {
return otherList.some(item => JSON.stringify(item) === JSON.stringify(listItem))
})
return result
} else {
return false
}
}
const handleAddToPurchase = () => {
if (!selectCommodityId) {
......@@ -217,6 +229,7 @@ const CommodityDetail = (props) => {
setCurrentPriceRange(unitPriceAndPicList[0].unitPrice)
setCommodityImgList(tempImgList)
console.log(tempAttrList, "tempAttrList")
setAttributeList(tempAttrList)
}
......
......@@ -33,7 +33,7 @@ const TopBar: React.FC<TopBarPropsType> = (props) => {
) : (
<>
<li className={styles.topbar_menu_item}>
<a href={`/user/login?redirect=${window.location}`}>请登录</a>
<a href={`/user/login?redirect=${btoa(encodeURIComponent(String(window.location)))}`}>请登录</a>
</li>
<li className={styles.topbar_menu_item}>
<a href="/user/register">注册</a>
......
......@@ -20,8 +20,11 @@ const ShopTemplate: React.FC = () => {
if (res.code === 1000) {
setTemplateList(res.data)
} else if (res.code === 47001) {
message.destroy()
message.info("您还未创建店铺,请先创建店铺")
history.push('/memberCenter/shopAbility/infoManage')
setTimeout(() => {
history.push('/memberCenter/shopAbility/infoManage')
}, 2000);
}
})
}
......
......@@ -22,7 +22,7 @@ const LoginWrap: React.FC = () => {
setRouters(data.urls)
// 此处需使用href跳转, 否则无法触发app.ts中的路由初始化校验
if (redirect) {
window.location.href = redirect
window.location.href = decodeURIComponent(atob(redirect))
} else {
window.location.href = '/memberCenter/home'
}
......
......@@ -111,17 +111,21 @@ class ApiRequest {
createRequest<T>(url: string, options: IApiRequest = { ctlType: 'none' }): Promise<IRequestSuccess<T>> {
return new Promise((resolve, reject) => {
baseRequest<IRequestSuccess<T>>(url, options).then(res => {
message.destroy()
// 登录验证
if (res.code === 1101) {
removeAuth()
// history.replace('/user/login')
window.location.href = `/user/login?redirect=${window.location}`
window.location.href = `/user/login?redirect=${btoa(encodeURIComponent(String(window.location)))}`
message.destroy()
message.error(res.message)
return false
}
if (res.code === 1000) {
if (options.ctlType === 'message') {
message.destroy()
}
options.ctlType === 'message' && message.success(res.message)
resolve(res)
} else {
......
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 to comment