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

页面修改

parent 4d2f3248
...@@ -26,6 +26,10 @@ namespace Mall.Repository.User ...@@ -26,6 +26,10 @@ namespace Mall.Repository.User
{ {
builder.AppendFormat(" AND MallBaseId={0} ", query.MallBaseId); 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 "); builder.Append(" ORDER BY NavIconSort ASC ");
return Get<RB_MiniProgram_Navicon_Extend>(builder.ToString()).ToList(); return Get<RB_MiniProgram_Navicon_Extend>(builder.ToString()).ToList();
......
...@@ -6,12 +6,14 @@ using Mall.Common.API; ...@@ -6,12 +6,14 @@ using Mall.Common.API;
using Mall.Common.Plugin; using Mall.Common.Plugin;
using Mall.Model.Entity.BaseSetUp; using Mall.Model.Entity.BaseSetUp;
using Mall.Model.Entity.MarketingCenter; using Mall.Model.Entity.MarketingCenter;
using Mall.Model.Entity.User;
using Mall.Model.Extend.BaseSetUp; using Mall.Model.Extend.BaseSetUp;
using Mall.Model.Extend.MarketingCenter; using Mall.Model.Extend.MarketingCenter;
using Mall.Model.Extend.User; using Mall.Model.Extend.User;
using Mall.Module.BaseSetUp; using Mall.Module.BaseSetUp;
using Mall.Module.MarketingCenter; using Mall.Module.MarketingCenter;
using Mall.Module.Product; using Mall.Module.Product;
using Mall.Module.User;
using Mall.WebApi.Filter; using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
...@@ -58,6 +60,16 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -58,6 +60,16 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
private readonly ProductModule productModule = new ProductModule(); private readonly ProductModule productModule = new ProductModule();
/// <summary>
/// 导航图标处理类
/// </summary>
private readonly MiniProgramNaviconModule programNaviconModule = new MiniProgramNaviconModule();
/// <summary>
/// 内容管理
/// </summary>
private readonly ContentModule contentModule = new ContentModule();
/// <summary> /// <summary>
/// 小程序首页 /// 小程序首页
/// </summary> /// </summary>
...@@ -70,6 +82,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -70,6 +82,7 @@ namespace Mall.WebApi.Controllers.MallBase
JObject parms = JObject.Parse(RequestParm.msg.ToString()); JObject parms = JObject.Parse(RequestParm.msg.ToString());
//小程序Id //小程序Id
var MiniAppId = parms.GetStringValue("MiniAppId"); var MiniAppId = parms.GetStringValue("MiniAppId");
var homePage = new object(); var homePage = new object();
//获取小程序信息 //获取小程序信息
var miniProgram = programModule.GetMiniProgramModule(new Model.Extend.User.RB_MiniProgram_Extend() { MiniAppId = MiniAppId }, isGetHomeData: true); var miniProgram = programModule.GetMiniProgramModule(new Model.Extend.User.RB_MiniProgram_Extend() { MiniAppId = MiniAppId }, isGetHomeData: true);
...@@ -81,6 +94,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -81,6 +94,8 @@ namespace Mall.WebApi.Controllers.MallBase
TenantId = miniProgram.TenantId, TenantId = miniProgram.TenantId,
}, isGetHome: true); }, isGetHome: true);
List<object> list = new List<object>(); List<object> list = new List<object>();
//测试使用
//selfHomePage.Id = 0;
//自定义首页 //自定义首页
if (selfHomePage != null && selfHomePage.Id > 0) if (selfHomePage != null && selfHomePage.Id > 0)
{ {
...@@ -109,7 +124,6 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -109,7 +124,6 @@ namespace Mall.WebApi.Controllers.MallBase
templateData.data.Add(PlusDataToObject(subItem, (miniProgram?.TenantId??0),miniProgram.MallBaseId)); templateData.data.Add(PlusDataToObject(subItem, (miniProgram?.TenantId??0),miniProgram.MallBaseId));
} }
} }
var tempObj = new var tempObj = new
{ {
id = item.Id, id = item.Id,
...@@ -130,7 +144,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -130,7 +144,7 @@ namespace Mall.WebApi.Controllers.MallBase
navs = list navs = list
}; };
} }
//默认首页 //自定义首页布局
else else
{ {
//配置了首页 //配置了首页
...@@ -138,9 +152,9 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -138,9 +152,9 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
var templateData = new var templateData = new
{ {
id = 0, id = 0,
name = "", name = "",
data = new List<object>() data = new List<ComponentItem>()
}; };
foreach (var subitem in miniProgram.HomeDataList) foreach (var subitem in miniProgram.HomeDataList)
{ {
...@@ -148,147 +162,288 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -148,147 +162,288 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
//搜索框 //搜索框
case "search": case "search":
templateData.data.Add(new ComponentItem searchData = new ComponentItem()
{ {
subitem.key, Id = subitem.key,
subitem.name, data = new searchItem()
subitem.relation_id, {
subitem.is_edit, color = "#FFFFFF",
subitem.imgBg background = "#f2f2f2", //背景颜色
}); radius = 4, //圆角
placeholder = "搜索", //提示文字
textColor = "#555555", //文字颜色
textPosition = "left" //文字位置
}
};
templateData.data.Add(searchData);
break; break;
//轮播图 //轮播图
case "banner": 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, foreach (var bItem in bannerList)
subitem.name, {
subitem.relation_id, detailsBannerList.Add(new bannerDetailItem()
subitem.is_edit, {
subitem.row_num, url = bItem.NavLink,
subitem.imgBg 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; break;
//导航图标 //导航图标
case "home_nav": case "home_nav":
templateData.data.Add(new var navList = programNaviconModule.GetMiniProgramNaviconListModule(new RB_MiniProgram_Navicon_Extend()
{ {
subitem.key, MallBaseId = miniProgram.MallBaseId
subitem.name,
subitem.relation_id,
subitem.is_edit,
subitem.row_num,
subitem.imgBg
}); });
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; break;
//视频
//视频插件
case "video": case "video":
templateData.data.Add(new ComponentItem videoData = new ComponentItem()
{ {
subitem.key, Id = subitem.key,
subitem.name, data = new videoItem()
subitem.relation_id, {
subitem.is_edit, pic_url = subitem.video_pic_url,
subitem.video_url, url = subitem.video_url,
subitem.video_pic_url, }
subitem.imgBg };
}); templateData.data.Add(videoData);
break; break;
//公告 //公告
case "notice": case "notice":
templateData.data.Add(new ComponentItem noticeData = new ComponentItem()
{ {
subitem.key, Id = subitem.key,
subitem.name, data = new noticeItem()
subitem.relation_id, {
subitem.is_edit, name= subitem.NoticeName, //公告名称
subitem.notice_url, content = subitem.NoticeContent, //公告内容
subitem.notice_bg_color, icon = subitem.notice_url, //公告图标
subitem.notice_text_color, textColor = subitem.notice_text_color, //文字颜色
subitem.imgBg background = subitem.notice_bg_color, //背景颜色
}); headerUrl = "", //头部图片
btnColor = "#ff4544", //按钮颜色
btnWidth = 500, //按钮宽度
btnHeight = 80, //按钮高度
btnRadius = 40, //按钮圆角
btnText = "我知道了", //按钮文本内容
btnTextColor = "#ffffff" //按钮文本颜色
}
};
templateData.data.Add(noticeData);
break; break;
//专题 //专题
case "topic": case "topic":
templateData.data.Add(new var topicSourceList= contentModule.GetTopicListModule(new Model.Entity.User.RB_Topic_Extend()
{ {
subitem.key, MallBaseId = miniProgram.MallBaseId,
subitem.name, TenantId = miniProgram.TenantId,
subitem.relation_id,
subitem.is_edit,
subitem.topic_num,
subitem.topic_url,
subitem.topic_url_2,
subitem.label_url,
subitem.imgBg
}); });
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; break;
//领劵中心
//领券中心
case "coupon": 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; break;
//所有分类 //商品分类
case "cat": 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; break;
//图片魔方 //图片魔方
case "block": case "block":
var blockSourceList = programModule.GetMallMagicListModule(new Model.Entity.User.RB_Mall_Magic_Extend()
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
{ {
subitem.key, MallBaseId = miniProgram.MallBaseId,
subitem.name, TenantId = Convert.ToInt32(miniProgram.TenantId)
subitem.relation_id, }).FirstOrDefault();
subitem.is_edit, ComponentItem blockData = new ComponentItem()
subitem.imgBg
});
break;
//预售
case "advance":
templateData.data.Add(new
{ {
subitem.key, Id = subitem.key,
subitem.name, data = blockSourceList
subitem.relation_id, };
subitem.is_edit, templateData.data.Add(blockData);
subitem.imgBg
});
break; 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 homePage = new
{ {
id = 0, id = 0,
title = miniProgram.MallName, title = miniProgram.MallName,
show_navs = 1, show_navs = 0,
is_home_page = 1, is_home_page = 0,
navs = list navs = list
}; };
} }
......
...@@ -48,7 +48,9 @@ namespace Mall.WebApi ...@@ -48,7 +48,9 @@ namespace Mall.WebApi
"http://localhost:8080", "http://localhost:8080",
"http://localhost:8082", "http://localhost:8082",
"http://127.0.0.1:50512", "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()))); 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