账户界面微调,完成公告更改功能,测试账户管理界面
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
using ClientsLibrary;
|
using ClientsLibrary;
|
||||||
using CommonLibrary;
|
using CommonLibrary;
|
||||||
|
using HslCommunication;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using 软件系统浏览器模版.Models;
|
||||||
using 软件系统浏览器模版.Models.Account;
|
using 软件系统浏览器模版.Models.Account;
|
||||||
|
|
||||||
namespace 软件系统浏览器模版.Controllers
|
namespace 软件系统浏览器模版.Controllers
|
||||||
@@ -64,17 +67,6 @@ namespace 软件系统浏览器模版.Controllers
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 一个错误的消息界面
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="message"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult ErrorPage(string message)
|
|
||||||
{
|
|
||||||
ViewBag.Message = message;
|
|
||||||
return View("Error");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//GET
|
//GET
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -116,5 +108,81 @@ namespace 软件系统浏览器模版.Controllers
|
|||||||
return Content("<div class=\"alert alert-danger\" role=\"alert\">这是一个错误的请求!</div>", "text/html");
|
return Content("<div class=\"alert alert-danger\" role=\"alert\">这是一个错误的请求!</div>", "text/html");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//GET
|
||||||
|
/// <summary>
|
||||||
|
/// 设置新的公告的页面
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet]
|
||||||
|
[AuthorizeUser]
|
||||||
|
public ActionResult ChangeAnnouncement()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//POST
|
||||||
|
/// <summary>
|
||||||
|
/// 设置新的公告内容的界面
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[AuthorizeUser]
|
||||||
|
[ValidateAntiForgeryToken]
|
||||||
|
public ActionResult SetAnnouncement(FormCollection fc)
|
||||||
|
{
|
||||||
|
if (Request.IsAjaxRequest())
|
||||||
|
{
|
||||||
|
string announcement = fc["Announcement"];
|
||||||
|
UserAccount account = Session[SessionItemsDescription.UserAccount] as UserAccount;
|
||||||
|
|
||||||
|
if (announcement.Length > 1000)
|
||||||
|
{
|
||||||
|
ViewData["alertMessage"] = "公告的字数超过了1000字!";
|
||||||
|
return PartialView("_MessageDangerPartial");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.更新公告, announcement);
|
||||||
|
if (result.IsSuccess)
|
||||||
|
{
|
||||||
|
ViewData["alertMessage"] = "公告更改成功!";
|
||||||
|
UserClient.Announcement = announcement;
|
||||||
|
return PartialView("_MessageSuccessPartial");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ViewData["alertMessage"] = result.Message;
|
||||||
|
return PartialView("_MessageDangerPartial");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ViewData["alertMessage"] = "请求无效!";
|
||||||
|
return PartialView("_MessageDangerPartial");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//GET
|
||||||
|
/// <summary>
|
||||||
|
/// 获取账号管理的界面
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet]
|
||||||
|
[AuthorizeUser]
|
||||||
|
public ActionResult ManagementAccount()
|
||||||
|
{
|
||||||
|
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode.获取账户);
|
||||||
|
if(result.IsSuccess)
|
||||||
|
{
|
||||||
|
ViewData["accounts"] = result.Content;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ViewData["accounts"] = "数据获取失败:" + result.ToMessageShowString();
|
||||||
|
}
|
||||||
|
return View();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputPassword1" class="col-lg-2 control-label">密码:</label>
|
<label for="inputPassword1" class="col-lg-2 control-label">密码:</label>
|
||||||
<div class="col-lg-10">
|
<div class="col-lg-10">
|
||||||
<input type="password" class="form-control" id="inputPassword1" name="inputPassword1" placeholder="密码5-8位" required>
|
<input type="password" class="form-control" id="inputPassword1" name="inputPassword1" placeholder="密码6-8位" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
41
软件系统浏览器模版/Views/Home/ChangeAnnouncement.cshtml
Normal file
41
软件系统浏览器模版/Views/Home/ChangeAnnouncement.cshtml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
@{
|
||||||
|
ViewBag.Title = "更改公告";
|
||||||
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@section scripts
|
||||||
|
{
|
||||||
|
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
|
||||||
|
}
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
@{ string updateId = Guid.NewGuid().ToString();}
|
||||||
|
@using (Ajax.BeginForm("SetAnnouncement", null, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = updateId, InsertionMode = InsertionMode.Replace },
|
||||||
|
new { @class = "form-horizontal" }))
|
||||||
|
{
|
||||||
|
<fieldset>
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
<legend style="font-family:'Microsoft YaHei UI',Arial, Helvetica, sans-serif">请输入新的公告内容,不能为空!</legend>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="Announcement" class="col-lg-2 control-label">公告:</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<textarea class="form-control" id="Announcement" name="Announcement" placeholder="1000字以内" required rows="10">@ClientsLibrary.UserClient.Announcement</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-10 col-lg-offset-2">
|
||||||
|
<button type="submit" class="btn btn-primary">提交公告</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div id="@updateId">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
39
软件系统浏览器模版/Views/Home/ManagementAccount.cshtml
Normal file
39
软件系统浏览器模版/Views/Home/ManagementAccount.cshtml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
@{
|
||||||
|
ViewBag.Title = "账户管理";
|
||||||
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
@section scripts
|
||||||
|
{
|
||||||
|
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
|
||||||
|
}
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
@{ string updateId = Guid.NewGuid().ToString();}
|
||||||
|
@using (Ajax.BeginForm("SetAnnouncement", null, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = updateId, InsertionMode = InsertionMode.Replace },
|
||||||
|
new { @class = "form-horizontal" }))
|
||||||
|
{
|
||||||
|
<fieldset>
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
<legend style="font-family:'Microsoft YaHei UI',Arial, Helvetica, sans-serif">账户管理</legend>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="Announcement" class="col-lg-2 control-label">账户json数据:</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<textarea class="form-control" id="Announcement" name="Announcement" placeholder="json数据" required rows="25">@ViewData["accounts"].ToString()</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-10 col-lg-offset-2">
|
||||||
|
<button type="submit" class="btn btn-primary">提交新数据</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div id="@updateId">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
|
||||||
管理员</a>
|
管理员</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li>@Html.ActionLink("公告更改", "About", "Home")</li>
|
<li>@Html.ActionLink("公告更改", "ChangeAnnouncement", "Home")</li>
|
||||||
<li>@Html.ActionLink("账号管理", "About", "Home")</li>
|
<li>@Html.ActionLink("账号管理", "ManagementAccount", "Home")</li>
|
||||||
<li>@Html.ActionLink("注册账户", "About", "Home")</li>
|
<li>@Html.ActionLink("注册账户", "About", "Home")</li>
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
<li>@Html.ActionLink("日志查看", "About", "Home")</li>
|
<li>@Html.ActionLink("日志查看", "About", "Home")</li>
|
||||||
|
|||||||
@@ -226,6 +226,8 @@
|
|||||||
<Content Include="Views\Shared\_MessageInfoPartial.cshtml" />
|
<Content Include="Views\Shared\_MessageInfoPartial.cshtml" />
|
||||||
<Content Include="Views\Shared\_MessageSuccessPartial.cshtml" />
|
<Content Include="Views\Shared\_MessageSuccessPartial.cshtml" />
|
||||||
<Content Include="Views\Shared\_MessageWarningPartial.cshtml" />
|
<Content Include="Views\Shared\_MessageWarningPartial.cshtml" />
|
||||||
|
<Content Include="Views\Home\ChangeAnnouncement.cshtml" />
|
||||||
|
<Content Include="Views\Home\ManagementAccount.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="App_Data\" />
|
<Folder Include="App_Data\" />
|
||||||
|
|||||||
Reference in New Issue
Block a user