修改BUG:个人中心网站样式与网站设置网站样式分开处理 closed #IVBF3

#Issue
https://gitee.com/LongbowEnterprise/dashboard/issues?id=IVBF3
This commit is contained in:
Argo Zhang 2019-04-12 17:39:20 +08:00
parent 6d2772b7ac
commit bc82933c07
5 changed files with 139 additions and 122 deletions

View File

@ -1,45 +1,56 @@
using Bootstrap.DataAccess;
using System.Security.Principal;
namespace Bootstrap.Admin.Models
{
/// <summary>
///
/// </summary>
public class HeaderBarModel : ModelBase
{
/// <summary>
///
/// </summary>
/// <param name="identity"></param>
public HeaderBarModel(IIdentity identity)
{
var user = UserHelper.RetrieveUserByUserName(identity.Name);
Icon = string.Format("{0}{1}", DictHelper.RetrieveIconFolderPath(), user.Icon);
DisplayName = user.DisplayName;
UserName = user.UserName;
AppCode = user.App;
if (!string.IsNullOrEmpty(user.Css)) Theme = user.Css;
}
/// <summary>
///
/// </summary>
public string UserName { get; }
/// <summary>
///
/// </summary>
public string DisplayName { get; }
/// <summary>
/// 获得/设置 用户头像地址
/// </summary>
public string Icon { get; }
/// <summary>
/// 获得 当前设置的默认应用
/// </summary>
public string AppCode { get; }
}
using Bootstrap.DataAccess;
using System.Security.Principal;
namespace Bootstrap.Admin.Models
{
/// <summary>
///
/// </summary>
public class HeaderBarModel : ModelBase
{
/// <summary>
///
/// </summary>
/// <param name="identity"></param>
public HeaderBarModel(IIdentity identity)
{
var user = UserHelper.RetrieveUserByUserName(identity.Name);
Icon = string.Format("{0}{1}", DictHelper.RetrieveIconFolderPath(), user.Icon);
DisplayName = user.DisplayName;
UserName = user.UserName;
AppCode = user.App;
Css = user.Css;
ActiveCss = string.IsNullOrEmpty(Css) ? Theme : Css;
}
/// <summary>
///
/// </summary>
public string UserName { get; }
/// <summary>
///
/// </summary>
public string DisplayName { get; }
/// <summary>
/// 获得/设置 用户头像地址
/// </summary>
public string Icon { get; }
/// <summary>
/// 获取/设置 个人网站样式
/// </summary>
public string Css { get; }
/// <summary>
/// 获得 当前设置的默认应用
/// </summary>
public string AppCode { get; }
/// <summary>
/// 获得 当前样式
/// </summary>
public string ActiveCss { get; }
}
}

View File

@ -1,41 +1,41 @@
using Bootstrap.DataAccess;
namespace Bootstrap.Admin.Models
{
/// <summary>
///
/// </summary>
public class ModelBase
{
/// <summary>
///
/// </summary>
public ModelBase()
{
Title = DictHelper.RetrieveWebTitle();
Footer = DictHelper.RetrieveWebFooter();
Theme = DictHelper.RetrieveActiveTheme();
IsDemo = DictHelper.RetrieveSystemModel();
}
/// <summary>
///
/// </summary>
public string Title { get; private set; }
/// <summary>
///
/// </summary>
public string Footer { get; private set; }
/// <summary>
///
/// </summary>
public string Theme { get; protected set; }
/// <summary>
/// 是否为演示系统
/// </summary>
public bool IsDemo { get; protected set; }
}
using Bootstrap.DataAccess;
namespace Bootstrap.Admin.Models
{
/// <summary>
///
/// </summary>
public class ModelBase
{
/// <summary>
///
/// </summary>
public ModelBase()
{
Title = DictHelper.RetrieveWebTitle();
Footer = DictHelper.RetrieveWebFooter();
Theme = DictHelper.RetrieveActiveTheme();
IsDemo = DictHelper.RetrieveSystemModel();
}
/// <summary>
///
/// </summary>
public string Title { get; private set; }
/// <summary>
///
/// </summary>
public string Footer { get; private set; }
/// <summary>
/// 网站样式全局设置
/// </summary>
public string Theme { get; protected set; }
/// <summary>
/// 是否为演示系统
/// </summary>
public bool IsDemo { get; protected set; }
}
}

View File

@ -102,11 +102,14 @@
</div>
</div>
<div class="card">
<div class="card-header">网站皮肤</div>
<div class="card-header">网站样式</div>
<div class="card-body">
<div class="alert alert-info" role="alert">
<span>注意:本设置将覆盖<b><a class="badge-pill" href="./Settings">网站设置</a></b>中已经设置的网站样式</span>
</div>
<div class="form-group">
<div class="btn-group" role="group">
<button id="css" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="" value="@Model.Theme">默认样式</button>
<button id="css" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="" value="@Model.Css">默认样式</button>
<div class="dropdown-menu">
<a href="#" data-val="">默认样式</a>
@foreach (var css in Model.Themes)

View File

@ -50,6 +50,9 @@
<div class="card">
<div class="card-header">网站样式</div>
<div class="card-body">
<div class="alert alert-info" role="alert">
<span>注意:如果<b><a class="badge-pill" href="./Profiles">个人中心</a></b>中已经设置了网站样式,此处设置对当前用户不生效,对其他用户生效</span>
</div>
<div class="form-group text-right">
<div class="btn-group" role="group">
<div class="btn-group" role="group">

View File

@ -1,37 +1,37 @@
@model ModelBase
@{
Layout = "_Layout";
}
@section css {
<environment include="Development">
<link href="~/lib/twitter-bootstrap/css/bootstrap.css" rel="stylesheet" />
<link href="~/lib/font-awesome/css/font-awesome.css" rel="stylesheet" />
</environment>
<environment exclude="Development">
<link href="~/lib/twitter-bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="~/lib/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
</environment>
@RenderSection("css", false)
<link href="~/css/theme.css" rel="stylesheet" asp-append-version="true" />
<link href="~/css/theme-responsive.css" rel="stylesheet" asp-append-version="true" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
<link href="~/css/site-responsive.css" rel="stylesheet" asp-append-version="true" />
@if (!string.IsNullOrEmpty(Model.Theme))
{
<link href="~/css/@Model.Theme" rel="stylesheet" asp-append-version="true" />
}
}
@section javascript {
<environment include="Development">
<script src="~/lib/twitter-bootstrap/js/bootstrap.bundle.js"></script>
</environment>
<environment exclude="Development">
<script src="~/lib/twitter-bootstrap/js/bootstrap.bundle.min.js"></script>
</environment>
<script src="~/lib/longbow/longbow.common.js" asp-append-version="true"></script>
@RenderSection("javascript", false)
}
@await Html.PartialAsync("Header")
@RenderBody()
@await Html.PartialAsync("Footer")
@model HeaderBarModel
@{
Layout = "_Layout";
}
@section css {
<environment include="Development">
<link href="~/lib/twitter-bootstrap/css/bootstrap.css" rel="stylesheet" />
<link href="~/lib/font-awesome/css/font-awesome.css" rel="stylesheet" />
</environment>
<environment exclude="Development">
<link href="~/lib/twitter-bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="~/lib/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
</environment>
@RenderSection("css", false)
<link href="~/css/theme.css" rel="stylesheet" asp-append-version="true" />
<link href="~/css/theme-responsive.css" rel="stylesheet" asp-append-version="true" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
<link href="~/css/site-responsive.css" rel="stylesheet" asp-append-version="true" />
@if (!string.IsNullOrEmpty(Model.ActiveCss))
{
<link href="~/css/@Model.ActiveCss" rel="stylesheet" asp-append-version="true" />
}
}
@section javascript {
<environment include="Development">
<script src="~/lib/twitter-bootstrap/js/bootstrap.bundle.js"></script>
</environment>
<environment exclude="Development">
<script src="~/lib/twitter-bootstrap/js/bootstrap.bundle.min.js"></script>
</environment>
<script src="~/lib/longbow/longbow.common.js" asp-append-version="true"></script>
@RenderSection("javascript", false)
}
@await Html.PartialAsync("Header")
@RenderBody()
@await Html.PartialAsync("Footer")
@RenderSection("modal", false)