CodePreview.cshtml 3.38 KB
@using Hh.Mes.POJO.ViewModel
@model CodePreviewVM
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
    ViewData["Title"] = "代码预览";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section header {
    <link href="~/lib/highlight.js/styles/vs.min.css" rel="stylesheet" />
    <style type="text/css">
        #areaSelect {
            width: 150px;
            margin-right: 8px;
        }

        .form-query {
            margin-top: 5px;
        }
        .container-head {
            position: fixed;
            height:45px;
            z-index: 99999;
            width: 100%;
            background-color:white;
        }
        .VPContent {
            padding-top: 45px;
        }

        .layui-tab-title {
            position: fixed;
            background-color:white;
            width: 100%;
        }
        .layui-tab-content {
            padding-top: 35px;
        }
    </style>
}
<!--from表单-->
<div class="layui-container container-head">
    <div class="layui-row form-query">
        <form class="layui-form" method="post">
            <div id="areaSelect" class="layui-input-inline layui-col-md5 layui-col-xs5">
                <input asp-for="AreaName" list="AreaList" class="layui-input" placeholder="请输入Area名称" />
                <datalist id="AreaList">
                    @foreach (var item in Model.AreaItems)
                    {
                        <option value="@item" />
                    }
                </datalist>
            </div>
            <input asp-for="EntityName" style="display: none;" />
            <div class="layui-col-md3 layui-col-xs3">
                <button type="submit" class="layui-btn  layui-btn-primary">选区域后点击预览</button>
            </div>
            <div asp-validation-summary="All" class="layui-col-md2 layui-col-xs2 div-relative " style="color: #FF5722; top: 7px;">

            </div>
        </form>

        <div>
            <a class="layui-btn layui-btn-normal @(Model.SaveBtnDisabled ? "layui-btn-disabled" : "")" asp-action="SaveCodeFile" asp-all-route-data='new Dictionary<string, string> { { "entityName", Model.EntityName },{"areaName", Model.AreaName} }'>保存</a>
        </div>


    </div>
</div>

<!--代码预览-->
<div class="layui-tab layui-tab-brief VPContent">
    <ul class="layui-tab-title">
        <li class="layui-this">Controller</li>
        <li>Service</li>
        <li>Model</li>
        <li>Cshtml</li>
        <li>JavaScript</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <pre><code class="language-csharp">@Model.ControllerTemp</code></pre>
        </div>
        <div class="layui-tab-item">
            <pre><code class="language-csharp">@Model.ServiceTemp</code></pre>
        </div>
        <div class="layui-tab-item">
            <pre><code class="language-csharp">@Model.ModelTemp</code></pre>
        </div>
        <div class="layui-tab-item">
            <pre><code class="language-html">@Model.CshtmlTemp</code></pre>
        </div>
        <div class="layui-tab-item">
            <pre><code class="language-javascript">@Model.JavaScriptTemp</code></pre>
        </div>
    </div>
</div>

@section Scripts {
    <script src="~/lib/highlight.js/highlight.min.js"></script>
    <script>
        layui.use(['element'], function () {
            var element = layui.element;
        });
        hljs.highlightAll();
    </script>
}