Files
ZelWiki/TightWiki/Views/Profile/My.cshtml
2025-02-07 16:29:14 +08:00

210 lines
9.6 KiB
Plaintext

@using TightWiki.Models
@model TightWiki.Models.ViewModels.Profile.AccountProfileViewModel
@{
Layout = "/Views/Shared/_Layout.cshtml";
}
<h3>
简介
</h3>
@* <p>
This is your profile, do with it what you may.<br /><br />
</p> *@
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
<div class="alert alert-danger">@Html.Raw(Model.ErrorMessage)</div>
}
@if (!string.IsNullOrEmpty(Model.SuccessMessage))
{
<div class="alert alert-success">@Html.Raw(Model.SuccessMessage)</div>
}
@using (Html.BeginForm(null, null, null, FormMethod.Post, true, new { action = $"{GlobalConfiguration.BasePath}{Context.Request.Path}", enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
<div class="container">
<form>
@Html.HiddenFor(m => m.AccountProfile.UserId)
@Html.HiddenFor(m => m.AccountProfile.Navigation)
<div class="form-group row mb-1">
<label for="Avatar" class="col-sm-2 col-form-label"><strong>头像</strong></label>
<div class="col-sm-10">
@if (@Model.AccountProfile.Navigation != "")
{
<img src="@GlobalConfiguration.BasePath/Profile/@Model.AccountProfile.Navigation/Avatar?max=150" class="mb-1" />
}
<input type="file" id="Avatar" name="Avatar" class="form-control-file" onchange="fileCheck(this);" />
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.EmailAddress)</div>
</div>
</div>
<div class="form-group row mb-3">
<label for="EmailAddress" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.EmailAddress)</strong></label>
<div class="col-sm-10">
@Html.DisplayFor(m => m.AccountProfile.EmailAddress, new { @class = "form-control-plaintext" })
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.AccountName)</div>
</div>
</div>
<div class="form-group row mb-3">
<label for="AccountName" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.AccountName)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.AccountProfile.AccountName, new { @class = "form-control" })
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.LastName)</div>
</div>
</div>
<div class="form-group row mb-3">
<label for="LastName" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.LastName)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.AccountProfile.LastName, new { @class = "form-control" })
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.FirstName)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="FirstName" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.FirstName)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.AccountProfile.FirstName, new { @class = "form-control" })
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.Role)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="Role" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.Role)</strong></label>
<div class="col-sm-10">
@Html.DisplayFor(m => m.AccountProfile.Role, new { @class = "form-control-plaintext" })
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.Theme)</div>
</div>
</div>
<div class="form-group row mb-3">
<label for="Theme" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.Theme)</strong></label>
<div class="col-sm-10">
<select name="AccountProfile.Theme" id="AccountProfile.Theme" class="form-control">
<option value="">默认主题</option>
@foreach (var item in Model.Themes)
{
<option value="@item.Name" selected=@(Model.AccountProfile.Theme == item.Name ? "selected" : null)>
@item.Name
</option>
}
</select>
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.Country)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="Country" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.Country)</strong></label>
<div class="col-sm-10">
<select name="AccountProfile.Country" id="AccountProfile.Country" class="form-control">
<option value="" style="color:#ccc !important;">选择一个国家</option>
@foreach (var item in Model.Countries)
{
<option value="@item.Value" selected=@(Model.AccountProfile.Country == item.Value ? "selected" : null)>
@item.Text
</option>
}
</select>
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.Language)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="Language" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.Language)</strong></label>
<div class="col-sm-10">
<select name="AccountProfile.Language" id="AccountProfile.Language" class="form-control">
<option value="" style="color:#ccc !important;">选择一种语言</option>
@foreach (var item in Model.Languages)
{
<option value="@item.Value" selected=@(Model.AccountProfile.Language == item.Value ? "selected" : null)>
@item.Text
</option>
}
</select>
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.TimeZone)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="TimeZone" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.TimeZone)</strong></label>
<div class="col-sm-10">
<select name="AccountProfile.TimeZone" id="AccountProfile.TimeZone" class="form-control">
<option value="" style="color:#ccc !important;">Select a time-zone</option>
@foreach (var item in Model.TimeZones)
{
<option value="@item.Value" selected=@(Model.AccountProfile.TimeZone == item.Value ? "selected" : null)>
@item.Text
</option>
}
</select>
</div>
</div>
<div class="form-group row">
<div class="col-sm-12">
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.Biography)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="Biography" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.Biography)</strong></label>
<div class="col-sm-10">
@Html.TextAreaFor(m => m.AccountProfile.Biography, new { @class = "form-control", style = "height:200px", Name = "Biography" })
</div>
</div>
<div class="form-group row mb-1">
<div class="col-sm-10 offset-sm-2">
<button type="submit" class="btn btn-primary rounded-0">保存</button>
</div>
</div>
</form>
</div>
}
<br />
<form action="@GlobalConfiguration.BasePath/Profile/Delete">
<button type="submit" class="btn btn-danger rounded-0">删除账号</button>
</form>