修改BUG:前台菜单直接导航到指定网页上,无需frame内呈现

This commit is contained in:
Argo-Lenovo 2016-11-23 18:25:52 +08:00
parent a06380fcaf
commit 5805c36a60
6 changed files with 12 additions and 34 deletions

View File

@ -259,7 +259,6 @@
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Models\ContentModel.cs" />
<Compile Include="Models\LockModel.cs" />
<Compile Include="Models\MessageCountModel.cs" />
<Compile Include="Models\QueryDictOption.cs" />

View File

@ -18,7 +18,8 @@ namespace Bootstrap.Admin.Controllers
/// <returns></returns>
public ActionResult Index()
{
var v = new ContentModel();
var v = new HeaderBarModel();
v.ShowMenu = true;
return View(v);
}
/// <summary>

View File

@ -1,12 +0,0 @@

namespace Bootstrap.Admin.Models
{
public class ContentModel : HeaderBarModel
{
public ContentModel()
{
ShowMenu = true;
}
public string Url { get; set; }
}
}

View File

@ -31,7 +31,7 @@ namespace Bootstrap.Admin.Models
/// <summary>
///
/// </summary>
public bool ShowMenu { get; protected set; }
public bool ShowMenu { get; set; }
/// <summary>
///
/// </summary>

View File

@ -1,25 +1,15 @@
$(function () {
if ($.browser.versions.ios) $('#content').css({ 'overflow': 'auto', '-webkit-overflow-scrolling': 'touch' });
function setActive(ele) {
ele.addClass('active');
ele.parents("ul").first().find('p').addClass('active');
$breadNav.text(ele.text()).show();
}
$('#navbar').attr('data-toggle', "dropdown").addClass('dropdown-toggle');
var $subMenu = $('#submenu');
var $breadNav = $('#breadNav');
$subMenu.on('click', 'a', function (event) {
var $this = $(this);
var act = $this.attr("data-act");
if (act === "True") return true;
event.preventDefault();
$subMenu.find('p, a').removeClass('active');
setActive($this);
$('iframe').attr('src', $this.attr('href'));
});
$breadNav.hide();
$subMenu.find('a').each(function (index, ele) {
$subMenu.on('click', 'a', function () {
var $this = $(this);
if ($this.attr('href') == window.location.pathname) setActive($this);
var href = $this.attr('href');
var tail = new Date().format("HHmmss");
if (href.indexOf('?') > -1) href += '&ba=' + tail;
else href += '?ba=' + tail;
window.location.href = href;
return false;
});
});

View File

@ -1,5 +1,6 @@
@model ContentModel
@model HeaderBarModel
@{
ViewBag.Title = "首页";
Layout = "~/Views/Shared/_Normal.cshtml";
}
@section javascript {
@ -9,5 +10,4 @@
@Html.Partial("Header", Model)
}
<div id="content" class="content-body">
<iframe src="@Model.Url"><a href="@Model.Url">你的浏览器不支持iframe页面嵌套请点击这里访问页面内容。</a></iframe>
</div>