Commit 13813b55 authored by 黄奎's avatar 黄奎

页面修改

parent 4d2f3248
......@@ -26,6 +26,10 @@ namespace Mall.Repository.User
{
builder.AppendFormat(" AND MallBaseId={0} ", query.MallBaseId);
}
if (query.NavIconIsShow != null && query.NavIconIsShow > -1)
{
builder.AppendFormat(" AND NavIconIsShow={0} ", query.NavIconIsShow);
}
}
builder.Append(" ORDER BY NavIconSort ASC ");
return Get<RB_MiniProgram_Navicon_Extend>(builder.ToString()).ToList();
......
......@@ -6,12 +6,14 @@ using Mall.Common.API;
using Mall.Common.Plugin;
using Mall.Model.Entity.BaseSetUp;
using Mall.Model.Entity.MarketingCenter;
using Mall.Model.Entity.User;
using Mall.Model.Extend.BaseSetUp;
using Mall.Model.Extend.MarketingCenter;
using Mall.Model.Extend.User;
using Mall.Module.BaseSetUp;
using Mall.Module.MarketingCenter;
using Mall.Module.Product;
using Mall.Module.User;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
......@@ -58,6 +60,16 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
private readonly ProductModule productModule = new ProductModule();
/// <summary>
/// 导航图标处理类
/// </summary>
private readonly MiniProgramNaviconModule programNaviconModule = new MiniProgramNaviconModule();
/// <summary>
/// 内容管理
/// </summary>
private readonly ContentModule contentModule = new ContentModule();
/// <summary>
/// 小程序首页
/// </summary>
......@@ -70,6 +82,7 @@ namespace Mall.WebApi.Controllers.MallBase
JObject parms = JObject.Parse(RequestParm.msg.ToString());
//小程序Id
var MiniAppId = parms.GetStringValue("MiniAppId");
var homePage = new object();
//获取小程序信息
var miniProgram = programModule.GetMiniProgramModule(new Model.Extend.User.RB_MiniProgram_Extend() { MiniAppId = MiniAppId }, isGetHomeData: true);
......@@ -81,6 +94,8 @@ namespace Mall.WebApi.Controllers.MallBase
TenantId = miniProgram.TenantId,
}, isGetHome: true);
List<object> list = new List<object>();
//测试使用
//selfHomePage.Id = 0;
//自定义首页
if (selfHomePage != null && selfHomePage.Id > 0)
{
......@@ -109,7 +124,6 @@ namespace Mall.WebApi.Controllers.MallBase
templateData.data.Add(PlusDataToObject(subItem, (miniProgram?.TenantId??0),miniProgram.MallBaseId));
}
}
var tempObj = new
{
id = item.Id,
......@@ -130,7 +144,7 @@ namespace Mall.WebApi.Controllers.MallBase
navs = list
};
}
//默认首页
//自定义首页布局
else
{
//配置了首页
......@@ -138,9 +152,9 @@ namespace Mall.WebApi.Controllers.MallBase
{
var templateData = new
{
id = 0,
name = "",
data = new List<object>()
id = 0,
name = "",
data = new List<ComponentItem>()
};
foreach (var subitem in miniProgram.HomeDataList)
{
......@@ -148,147 +162,288 @@ namespace Mall.WebApi.Controllers.MallBase
{
//搜索框
case "search":
templateData.data.Add(new
ComponentItem searchData = new ComponentItem()
{
subitem.key,
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.imgBg
});
Id = subitem.key,
data = new searchItem()
{
color = "#FFFFFF",
background = "#f2f2f2", //背景颜色
radius = 4, //圆角
placeholder = "搜索", //提示文字
textColor = "#555555", //文字颜色
textPosition = "left" //文字位置
}
};
templateData.data.Add(searchData);
break;
//轮播图
case "banner":
templateData.data.Add(new
var bannerList = programModule.GetMallNavListModule(new Model.Entity.User.RB_Mall_Nav_Extend() { TenantId = miniProgram.TenantId, MallBaseId = miniProgram.MallBaseId });
var detailsBannerList = new List<bannerDetailItem>();
if (bannerList != null && bannerList.Count > 0)
{
subitem.key,
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.row_num,
subitem.imgBg
});
foreach (var bItem in bannerList)
{
detailsBannerList.Add(new bannerDetailItem()
{
url = bItem.NavLink,
picUrl = bItem.NavImg
});
}
}
ComponentItem bannerData = new ComponentItem()
{
Id = subitem.key,
data = new bannerItem()
{
style = 1, //样式
fill = 1, //填充方式0-留白 1填充
height = 450, //默认高度
banners = detailsBannerList
}
};
templateData.data.Add(bannerData);
break;
//导航图标
case "home_nav":
templateData.data.Add(new
var navList = programNaviconModule.GetMiniProgramNaviconListModule(new RB_MiniProgram_Navicon_Extend()
{
subitem.key,
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.row_num,
subitem.imgBg
MallBaseId = miniProgram.MallBaseId
});
List<navIconItem> navs = new List<navIconItem>();
if (navList != null && navList.Count > 0)
{
foreach (var nItem in navList)
{
navs.Add(new navIconItem()
{
icon = nItem.NavIconImg,
url = nItem.NavIconUrl,
key = "",
name = nItem.NavIconName,
openType = ""
});
}
}
ComponentItem navData = new ComponentItem()
{
Id = subitem.key,
data = new navItem()
{
color = "#353535",
rows = 1,//每页行数
columns = subitem.row_num, //每行个数
scroll = true, //左右滑动
showImg = false, //背景图片
backgroundColor = "#ffffff", //背景颜色
backgroundPicUrl = "", //背景链接
position = 5, //图片位置
mode = 1, //填充方式
backgroundHeight = 100, //背景图宽
backgroundWidth = 100, //背景图高
navs = navs, //导航图标
}
};
templateData.data.Add(navData);
break;
//视频
//视频插件
case "video":
templateData.data.Add(new
ComponentItem videoData = new ComponentItem()
{
subitem.key,
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.video_url,
subitem.video_pic_url,
subitem.imgBg
});
Id = subitem.key,
data = new videoItem()
{
pic_url = subitem.video_pic_url,
url = subitem.video_url,
}
};
templateData.data.Add(videoData);
break;
//公告
case "notice":
templateData.data.Add(new
ComponentItem noticeData = new ComponentItem()
{
subitem.key,
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.notice_url,
subitem.notice_bg_color,
subitem.notice_text_color,
subitem.imgBg
});
Id = subitem.key,
data = new noticeItem()
{
name= subitem.NoticeName, //公告名称
content = subitem.NoticeContent, //公告内容
icon = subitem.notice_url, //公告图标
textColor = subitem.notice_text_color, //文字颜色
background = subitem.notice_bg_color, //背景颜色
headerUrl = "", //头部图片
btnColor = "#ff4544", //按钮颜色
btnWidth = 500, //按钮宽度
btnHeight = 80, //按钮高度
btnRadius = 40, //按钮圆角
btnText = "我知道了", //按钮文本内容
btnTextColor = "#ffffff" //按钮文本颜色
}
};
templateData.data.Add(noticeData);
break;
//专题
case "topic":
templateData.data.Add(new
var topicSourceList= contentModule.GetTopicListModule(new Model.Entity.User.RB_Topic_Extend()
{
subitem.key,
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.topic_num,
subitem.topic_url,
subitem.topic_url_2,
subitem.label_url,
subitem.imgBg
MallBaseId = miniProgram.MallBaseId,
TenantId = miniProgram.TenantId,
});
var topic_list = new List<topicDetailsItem>();
if (topicSourceList != null && topicSourceList.Count > 0)
{
foreach (var tItem in topicSourceList)
{
topic_list.Add(new topicDetailsItem()
{
cover_pic = tItem.CoverImg,
read_count = 0,
title = tItem.Title,
id = tItem.Id,
layout = 0
});
}
}
ComponentItem topicData = new ComponentItem()
{
Id = subitem.key,
data = new topicItem()
{
style = "normal",
count = subitem.topic_num,
logo_1 = subitem.topic_url,
logo_2 = subitem.topic_url_2,
icon = subitem.label_url,
cat_show = false,
list = new List<topicTypeItem>(),
topic_list = topic_list
}
};
templateData.data.Add(topicData);
break;
//领券中心
//领劵中心
case "coupon":
templateData.data.Add(new
{
subitem.key,
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.coupon_url,
subitem.coupon_not_url,
subitem.imgBg
});
break;
//所有分类
//商品分类
case "cat":
var tempGoodsList = new List<GoodsDetailsItem2>();
if (subitem.relation_id == 0)
{
var goodsList = productModule.GetProductGoodsPageList(1, 6, out long rowsCount, new Model.Extend.Product.RB_Goods_Extend()
{
TenantId = Convert.ToInt32(miniProgram.TenantId),
MallBaseId = miniProgram.MallBaseId
});
if (goodsList != null && goodsList.Count > 0)
{
foreach (var gItem in goodsList)
{
tempGoodsList.Add(new GoodsDetailsItem2()
{
id = gItem.Id,
price = gItem?.SellingPrice ?? 0,
name = gItem.Name,
picUrl = Common.Config.GetFileUrl(gItem.CoverImage)
});
}
}
}
else
{
var goodsList = productModule.GetProductGoodsPageList(1, 6, out long rowsCount, new Model.Extend.Product.RB_Goods_Extend()
{
TenantId = Convert.ToInt32(miniProgram.TenantId),
MallBaseId = miniProgram.MallBaseId,
CategoryIds = subitem.relation_id.ToString()
}) ;
if (goodsList != null && goodsList.Count > 0)
{
foreach (var gItem in goodsList)
{
tempGoodsList.Add(new GoodsDetailsItem2()
{
id = gItem.Id,
price = gItem?.SellingPrice ?? 0,
name = gItem.Name,
picUrl = Common.Config.GetFileUrl(gItem.CoverImage)
});
}
}
}
ComponentItem goodsData = new ComponentItem()
{
Id = subitem.key,
data = new goodsItem()
{
showCat = false,
catPosition = "",
catStyle = 0,
addGoodsType = 0,
goodsLength = 6,
listStyle = 3,
goodsCoverProportion = "1-1",
fill = 1,
goodsStyle = 1,
textStyle = 1,
showGoodsName = true,
showGoodsPrice = true,
showBuyBtn = true,
buyBtn = "cart",
buyBtnStyle = 1,
buyBtnText = "购买",
buttonColor = "#ff4544",
showGoodsTag = false,
customizeGoodsTag = false,
goodsTagPicUrl = "",
showImg = false,
backgroundColor = "#fff",
backgroundPicUrl = "",
position = 5,
mode = 1,
backgroundHeight = 100,
backgroundWidth = 100,
list= tempGoodsList
}
};
templateData.data.Add(goodsData);
break;
//图片魔方
case "block":
break;
//预约
case "booking":
templateData.data.Add(new
{
subitem.key,
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.imgBg
});
break;
//拼团
case "pintuan":
templateData.data.Add(new
var blockSourceList = programModule.GetMallMagicListModule(new Model.Entity.User.RB_Mall_Magic_Extend()
{
subitem.key,
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.imgBg
});
break;
//预售
case "advance":
templateData.data.Add(new
MallBaseId = miniProgram.MallBaseId,
TenantId = Convert.ToInt32(miniProgram.TenantId)
}).FirstOrDefault();
ComponentItem blockData = new ComponentItem()
{
subitem.key,
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.imgBg
});
Id = subitem.key,
data = blockSourceList
};
templateData.data.Add(blockData);
break;
}
}
var tempObj = new
{
id = miniProgram.MallBaseId,
name = "自定义首页布局",
page_id = miniProgram.MallBaseId,
template_id = miniProgram.MallBaseId,
template = templateData
};
list.Add(tempObj);
list.Add(templateData);
homePage = new
{
id = 0,
title = miniProgram.MallName,
show_navs = 1,
is_home_page = 1,
show_navs = 0,
is_home_page = 0,
navs = list
};
}
......
......@@ -48,7 +48,9 @@ namespace Mall.WebApi
"http://localhost:8080",
"http://localhost:8082",
"http://127.0.0.1:50512",
"http://127.0.0.1:20224"
"http://127.0.0.1:20224",
"http://mall.oytour.com",
"http://testmall.oytour.com"
};
services.AddCors(options => options.AddPolicy("AllowCors", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowCredentials().WithOrigins(corsArray.ToArray())));
}
......
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