网站首页 网站源码
website
站点相关全部源代码,隐藏了一些关于服务器的信息
@using Dpz.Core.EnumLibrary
@inject Microsoft.Extensions.Configuration.IConfiguration Configuration
@using EasyCaching.Core
@using System.Net.Http
@using AngleSharp
@using AngleSharp.Html.Parser
@inject IHybridCachingProvider EasyCachingProvider
@inject IHttpClientFactory HttpClientFactory
@model VmUserInfo


<device exclude="mobile">
    @{
        Layout = "_AccountLayout";
    }
    <div class="layui-tab" lay-filter="accountTab">
        <ul class="layui-tab-title" id="LAY_mine">
            <li class="layui-this" lay-id="info">我的资料</li>
            <li lay-id="avatar">头像</li>
            <li lay-id="pass">密码</li>
            <li lay-id="unbind-two-factor">解绑二次验证</li>
            <li lay-id="logout">退出</li>
        </ul>
        <div class="layui-tab-content" style="padding: 20px 0;">
            <div class="layui-form layui-form-pane layui-tab-item layui-show">
                <form method="post" asp-action="UpdateInfo">
                    <div class="layui-form-item">
                        <label asp-for="Id" class="layui-form-label">账号</label>
                        <div class="layui-input-inline">
                            <input type="text" required asp-for="Id" readonly autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">账号不能更改</div>
                    </div>
                    <div class="layui-form-item">
                        <label asp-for="Name" class="layui-form-label">昵称</label>
                        <div class="layui-input-inline">
                            <input asp-for="Name" required lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline">
                            <div class="layui-input-inline">
                                @if (Model.Sex == Sex.Wuman)
                                {
                                    <input type="radio" name="sex" value="0" title="男" asp-for="Sex">
                                    <input type="radio" name="sex" value="1" title="女" checked asp-for="Sex">
                                }
                                else
                                {
                                    <input type="radio" name="sex" value="0" title="男" checked asp-for="Sex">
                                    <input type="radio" name="sex" value="1" title="女" asp-for="Sex">
                                }
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label asp-for="Sign" class="layui-form-label">签名</label>
                        <div class="layui-input-block">
                            <textarea placeholder="随便写些什么刷下存在感" asp-for="Sign"  autocomplete="off" class="layui-textarea" style="height: 80px;"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <button class="layui-btn" key="set-mine" lay-filter="account-info" lay-submit>确认修改</button>
                    </div>
                </form>
            </div>

            <div class="layui-form layui-form-pane layui-tab-item">
                <div class="layui-form-item">
                    <div class="avatar-add">
                        <p>建议尺寸168*168,支持jpg、png、gif</p>
                        <button type="button" class="layui-btn upload-img" id="account-avatar">
                            <i class="layui-icon">&#xe67c;</i>上传头像
                        </button>
                        <img id="img-account-avatar" src="@Model.Avatar" alt="@Model.Name">
                        <span class="loading-jump"></span>
                    </div>
                </div>
            </div>

            <div class="layui-form layui-form-pane layui-tab-item">
                <form asp-action="ChangePassword" method="post">
                    <div class="layui-form-item">
                        <label for="nowpass" class="layui-form-label">当前密码</label>
                        <div class="layui-input-inline">
                            <input type="password" id="nowpass" name="nowpass" required lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="pass" class="layui-form-label">新密码</label>
                        <div class="layui-input-inline">
                            <input type="password" id="pass" name="pass" required lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">6到16个字符</div>
                    </div>
                    <div class="layui-form-item">
                        <label for="repass" class="layui-form-label">确认密码</label>
                        <div class="layui-input-inline">
                            <input type="password" id="repass" name="repass" required lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <button class="layui-btn" key="set-mine" lay-filter="account-pass" lay-submit>确认修改</button>
                    </div>
                </form>
            </div>

            <div class="layui-form layui-form-pane layui-tab-item">
                <form asp-action="UnbindTwoFactor" asp-controller="Home" method="post">
                    <div class="layui-form-item">
                        <label for="pinCode" class="layui-form-label">PIN码</label>
                        <div class="layui-input-inline">
                            <input maxlength="6" type="text" id="pinCode" name="pinCode" required lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <button class="layui-btn" key="set-mine" lay-filter="account-unbind" lay-submit>解绑</button>
                    </div>
                </form>
            </div>

            <div class="layui-form layui-form-pane layui-tab-item">
                <form asp-action="LogOut" asp-controller="Account" asp-area="">
                    <button class="layui-btn" lay-filter="logout" type="button" onclick="if (confirm('确定要退出吗?')){$(this).parent('form').submit();}">退出账号</button>
                </form>
            </div>
        </div>
    </div>
    <link rel="stylesheet" href="@(Configuration["CDNBaseAddress"])/lib/editor.md/css/editormd.min.css"/>
    <script src="@(Configuration["CDNBaseAddress"])/lib/editor.md/editormd.min.js"></script>
</device>

<device include="mobile">
    @{
        Layout = null;
        const string membleKey = "memble-version:1.0.1";
        string content;
        var cache = await EasyCachingProvider.GetAsync<string>(membleKey);
        if (!cache.IsNull && cache.HasValue)
        {
            content = cache.Value;
        }
        else
        {
            content = await GetMembleContent();
            await EasyCachingProvider.SetAsync(membleKey, content,
                TimeSpan.FromDays(30));
        }
        
        
        async Task<string> GetMembleContent()
        {
            var httpClient = HttpClientFactory.CreateClient("edge");
            var request = new HttpRequestMessage(HttpMethod.Get,
                $"{Program.CdnBaseAddress}/../memble/index.html");
            var response = await httpClient.SendAsync(request);
            var htmlContent = await response.Content.ReadAsStringAsync();
            
            var htmlParse = new HtmlParser();
            var document = await htmlParse.ParseDocumentAsync(htmlContent);
            foreach (var item in document.Scripts)
            {
                if (!string.IsNullOrEmpty(item.Source))
                {
                    item.Source = $"{Program.CdnBaseAddress}/../memble{item.Source}";
                }
            }
            document.GetElementsByTagName("link").ForEach(x =>
            {
                var src = x.GetAttribute("href");
                if (!string.IsNullOrEmpty(src))
                {
                    x.SetAttribute("href", $"{Program.CdnBaseAddress}/../memble{src}");
                }
            });
            var membleContent = document.ToHtml();
            return membleContent;
        }
    }
    
    @Html.Raw(content)
</device>
loading