Commit f5ede3d0 authored by GuanHua's avatar GuanHua

refactor: 修改代码eslint提示的规范问题

parent 2c4fccea
......@@ -144,26 +144,6 @@ export default {
"hasQuickNav": true,
"linkdisable": true,
"advertList": []
// "advertList": [
// {
// id: 1,
// templateId: 707,
// type: 2,
// name: '意大利进口荔枝纹牛皮会员价促销最低 9 折',
// picUrl: 'https://img.alicdn.com/imgextra/i4/81/O1CN01VT5ViO1CT8h4sY7qc_!!81-0-luban.jpg_q100.jpg_.webp',
// link: 'https://www.baidu.com',
// sort: 1,
// },
// {
// id: 2,
// templateId: 707,
// type: 2,
// name: '意大利进口荔枝纹牛皮会员价促销最低 9 折',
// picUrl: 'https://img.alicdn.com/tps/i4/TB1ICgYL.H1gK0jSZSySuttlpXa.jpg',
// link: 'https://www.baidu.com',
// sort: 2,
// }
// ]
}
},
"7": {
......
......@@ -27,7 +27,7 @@ interface MallEditPropsType {
}
}
let TemplateList = ['science']
const TemplateList = ['science']
const MallEdit: React.FC<MallEditPropsType> = (props) => {
const { query: { id, template } } = props.location
......@@ -46,11 +46,11 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
const findFirstAdvertsByType = () => {
return new Promise((resolve) => {
let params = {
const params: any = {
templateId: id,
type: 1
}
//@ts-ignore
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -63,11 +63,11 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
const findSecondAdvertsByType = () => {
return new Promise((resolve) => {
let params = {
const params: any = {
templateId: id,
type: 2
}
//@ts-ignore
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -98,12 +98,11 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
*/
const fetchCategoryById = (categoryId) => {
return new Promise((resolve) => {
let param = {
const param: any = {
templateId: id,
categoryId
}
// @ts-ignore
PublicApi.getTemplatePlatformFindFirstCategoryDetail(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -112,18 +111,6 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
})
}
const fetchTmeplateInfo = () => {
return new Promise((resolve) => {
//@ts-ignore
PublicApi.getTemplatePlatformFindMallHome({ templateId: id }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
/**
* 获取头条新闻
*/
......@@ -132,10 +119,10 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
//@ts-ignore
PublicApi.getManageContentInformationFindAllByRecommendLabel({ recommendLabel: 1 }).then(res => {
if (res.code === 1000) {
let leadNewsList: any = res.data || []
const leadNewsList: any = res.data || []
if (leadNewsList.length >= 2) {
let leftList = leadNewsList.slice(0, Math.round(leadNewsList.length / 2))
let rightList = leadNewsList.slice(Math.round(leadNewsList.length / 2), leadNewsList.length)
const leftList = leadNewsList.slice(0, Math.round(leadNewsList.length / 2))
const rightList = leadNewsList.slice(Math.round(leadNewsList.length / 2), leadNewsList.length)
resolve({
leadLeftNews: leftList,
leadRightNews: rightList
......@@ -160,10 +147,10 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
PublicApi.getManageContentColumnAll().then(res => {
if (res.code === 1000) {
let result = ""
let allColumn = res.data
const allColumn = res.data
if (allColumn && allColumn.length > 0) {
let labelList = allColumn.map((item: any) => item.name)
let showCount = 4
const showCount = 4
if (labelList.length <= showCount) {
result = labelList.join(' | ')
} else {
......@@ -190,7 +177,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
interactAdvertConfig[interactAdvertConfig.key].props.advertList = await findSecondAdvertsByType()
const shopList = GlobalConfig.web.shopInfo
let webMallInfo = shopList.filter(item => item.environment === 1 && item.type === 1)[0]
const webMallInfo = shopList.filter(item => item.environment === 1 && item.type === 1)[0]
headerConfig[headerConfig.key].props.logoUrl = webMallInfo.logoUrl
topBarConfig[topBarConfig.key].props.shopname = webMallInfo.name
......@@ -200,17 +187,17 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
let initIndex = 100
let floorLineConfig: any = {}
let floorLineKeys: any = []
const floorLineKeys: any = []
let firstCategory: any = await fetchFirstCategory()
const firstCategory: any = await fetchFirstCategory()
for (let item of firstCategory) {
let categoryDetail: any = await fetchCategoryById(item.id)
for (const item of firstCategory) {
const categoryDetail: any = await fetchCategoryById(item.id)
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
let FloorLine = {
const FloorLine = {
[String(initIndex + 1)]: {
"componentName": "FloorLine",
"props": {
......@@ -219,7 +206,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
"childNodes": [String(initIndex + 2), String(initIndex + 3)]
}
}
let Horizontal1 = {
const Horizontal1 = {
[String(initIndex + 2)]: {
"componentName": "FloorLine.Horizontal",
"props": {},
......@@ -227,7 +214,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Brand = {
const Brand = {
[String(initIndex + 3)]: {
"componentName": "FloorLine.Brand",
"props": {
......@@ -238,7 +225,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Category = {
const Category = {
[String(initIndex + 4)]: {
"componentName": "FloorLine.Category",
"props": {
......@@ -250,7 +237,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Vertical1 = {
const Vertical1 = {
[String(initIndex + 5)]: {
"componentName": "FloorLine.Vertical",
"props": {},
......@@ -258,7 +245,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let FloorHeader = {
const FloorHeader = {
[String(initIndex + 6)]: {
"componentName": "FloorLine.FloorHeader",
"props": {
......@@ -270,7 +257,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Banner = {
const Banner = {
[String(initIndex + 7)]: {
"componentName": "FloorLine.Banner",
"props": {
......@@ -282,14 +269,14 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Horizontal2 = {
const Horizontal2 = {
[String(initIndex + 8)]: {
"componentName": "FloorLine.Horizontal",
"props": {},
"childNodes": [String(initIndex + 9), String(initIndex + 10)]
},
}
let Goods = {
const Goods = {
[String(initIndex + 9)]: {
"componentName": "FloorLine.Goods",
"props": {
......@@ -300,7 +287,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Shops = {
const Shops = {
[String(initIndex + 10)]: {
"componentName": "FloorLine.Shops",
"props": {
......@@ -317,7 +304,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
}
mallLayoutConfig["0"].childNodes = [...mallLayoutConfig["0"].childNodes, ...floorLineKeys, FindMoreConfig.key, InformationConfig.key, FooterConfig.key]
let config = {
const config = {
...mallLayoutConfig,
...topBarConfig,
...topAdvertConfig,
......
......@@ -26,7 +26,7 @@ interface MallPreviewPropsType {
}
}
let TemplateList = ['science']
const TemplateList = ['science']
const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
const { query: { id, template } } = props.location
......@@ -45,11 +45,11 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
const findFirstAdvertsByType = () => {
return new Promise((resolve) => {
let params = {
const params: any = {
templateId: id,
type: 1
}
//@ts-ignore
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -62,11 +62,11 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
const findSecondAdvertsByType = () => {
return new Promise((resolve) => {
let params = {
const params: any = {
templateId: id,
type: 2
}
//@ts-ignore
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -99,12 +99,11 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
*/
const fetchCategoryById = (categoryId) => {
return new Promise((resolve) => {
let param = {
const param: any = {
templateId: id,
categoryId
}
// @ts-ignore
PublicApi.getTemplatePlatformFindFirstCategoryDetail(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -113,30 +112,20 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
})
}
const fetchTmeplateInfo = () => {
return new Promise((resolve) => {
//@ts-ignore
PublicApi.getTemplatePlatformFindMallHome({ templateId: id }).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
/**
* 获取头条新闻
*/
const fetchLeadNews = () => {
return new Promise((resolve) => {
//@ts-ignore
PublicApi.getManageContentInformationFindAllByRecommendLabel({ recommendLabel: 1 }).then(res => {
const params: any = {
recommendLabel: 1
}
PublicApi.getManageContentInformationFindAllByRecommendLabel(params).then(res => {
if (res.code === 1000) {
let leadNewsList: any = res.data || []
const leadNewsList: any = res.data || []
if (leadNewsList.length >= 2) {
let leftList = leadNewsList.slice(0, Math.round(leadNewsList.length / 2))
let rightList = leadNewsList.slice(Math.round(leadNewsList.length / 2), leadNewsList.length)
const leftList = leadNewsList.slice(0, Math.round(leadNewsList.length / 2))
const rightList = leadNewsList.slice(Math.round(leadNewsList.length / 2), leadNewsList.length)
resolve({
leadLeftNews: leftList,
leadRightNews: rightList
......@@ -161,10 +150,10 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
PublicApi.getManageContentColumnAll().then(res => {
if (res.code === 1000) {
let result = ""
let allColumn = res.data
const allColumn = res.data
if (allColumn && allColumn.length > 0) {
let labelList = allColumn.map((item: any) => item.name)
let showCount = 4
const showCount = 4
if (labelList.length <= showCount) {
result = labelList.join(' | ')
} else {
......@@ -191,7 +180,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
interactAdvertConfig[interactAdvertConfig.key].props.advertList = await findSecondAdvertsByType()
const shopList = GlobalConfig.web.shopInfo
let webMallInfo = shopList.filter(item => item.environment === 1 && item.type === 1)[0]
const webMallInfo = shopList.filter(item => item.environment === 1 && item.type === 1)[0]
headerConfig[headerConfig.key].props.logoUrl = webMallInfo.logoUrl
topBarConfig[topBarConfig.key].props.shopname = webMallInfo.name
......@@ -201,17 +190,17 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
let initIndex = 100
let floorLineConfig: any = {}
let floorLineKeys: any = []
const floorLineKeys: any = []
let firstCategory: any = await fetchFirstCategory()
const firstCategory: any = await fetchFirstCategory()
for (let item of firstCategory) {
let categoryDetail: any = await fetchCategoryById(item.id)
for (const item of firstCategory) {
const categoryDetail: any = await fetchCategoryById(item.id)
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
let FloorLine = {
const FloorLine = {
[String(initIndex + 1)]: {
"componentName": "FloorLine",
"props": {
......@@ -220,7 +209,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
"childNodes": [String(initIndex + 2), String(initIndex + 3)]
}
}
let Horizontal1 = {
const Horizontal1 = {
[String(initIndex + 2)]: {
"componentName": "FloorLine.Horizontal",
"props": {},
......@@ -228,7 +217,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Brand = {
const Brand = {
[String(initIndex + 3)]: {
"componentName": "FloorLine.Brand",
"props": {
......@@ -239,7 +228,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Category = {
const Category = {
[String(initIndex + 4)]: {
"componentName": "FloorLine.Category",
"props": {
......@@ -251,7 +240,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Vertical1 = {
const Vertical1 = {
[String(initIndex + 5)]: {
"componentName": "FloorLine.Vertical",
"props": {},
......@@ -259,7 +248,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let FloorHeader = {
const FloorHeader = {
[String(initIndex + 6)]: {
"componentName": "FloorLine.FloorHeader",
"props": {
......@@ -271,7 +260,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Banner = {
const Banner = {
[String(initIndex + 7)]: {
"componentName": "FloorLine.Banner",
"props": {
......@@ -283,14 +272,14 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Horizontal2 = {
const Horizontal2 = {
[String(initIndex + 8)]: {
"componentName": "FloorLine.Horizontal",
"props": {},
"childNodes": [String(initIndex + 9), String(initIndex + 10)]
},
}
let Goods = {
const Goods = {
[String(initIndex + 9)]: {
"componentName": "FloorLine.Goods",
"props": {
......@@ -301,7 +290,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Shops = {
const Shops = {
[String(initIndex + 10)]: {
"componentName": "FloorLine.Shops",
"props": {
......@@ -318,7 +307,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
}
mallLayoutConfig["0"].childNodes = [...mallLayoutConfig["0"].childNodes, ...floorLineKeys, FindMoreConfig.key, InformationConfig.key, FooterConfig.key]
let config = {
const config = {
...mallLayoutConfig,
...topBarConfig,
...topAdvertConfig,
......
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