@{
    Layout = "_Layout.cshtml";
}
<style>
    i {font-size: 20px;font-style: normal;color: #ff0000}
    .remark{font-weight:normal}
</style>
<div class="huanjing-box">
    <div class="pr-title"><h3>系统环境检测</h3></div>
    <table border="0" cellspacing="0" cellpadding="0" class="tb">
        <thead>
            <tr>
                <th width="50%">参数</th>
                <th>值</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>服务器IP</td>
                <td>@Request.ServerVariables["LOCAL_ADDR"]</td>
            </tr>

            <tr>
                <td>服务器域名</td>
                <td>@Request.Url.Host</td>
            </tr>
            <tr>
                <td>端口</td>
                <td>@Request.Url.Port</td>
            </tr>
            <tr>
                <td>服务器操作系统</td>
                <td>@Environment.OSVersion.ToString()</td>
            </tr>
            <tr>
                <td>IIS版本</td>
                <td>@Request.ServerVariables["SERVER_SOFTWARE"]</td>
            </tr>
            <tr>
                <td>.NET引擎版本</td>
                <td>@(Environment.Version.Major).@Environment.Version.Minor.@Environment.Version.Build.@Environment.Version.Revision</td>
            </tr>
            <tr>
                <td>系统安装目录</td>
                <td>@Request.PhysicalApplicationPath</td>
            </tr>
        </tbody>
    </table>
</div>

<div id="main">
    <div class="huanjing-box">
        <div class="pr-title"><h3>目录权限检测</h3></div>
        <table border="0" cellspacing="0" cellpadding="0" class="tb">
            <thead>
                <tr>
                    <th>目录/文件</th>
                    <th>写入权限<span class="remark">（必须）</span></th>
                    <th>删除权限<span class="remark">（必须）</span></th>
                    <th>解压权限<span class="remark">(影响在线升级，插件安装等操作)</span></th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>/Web.Config</td>
                    <td><span class="permssion basic-permssion" v-html="getState(write[0])"></span></td>
                    <td>-</td>
                    <td>-</td>
                </tr>
                <tr>
                    <td>/Config</td>
                    <td><span class="permssion basic-permssion" v-html="getState(write[1])"></span></td>
                    <td>-</td>
                    <td>-</td>
                </tr>
                <tr>
                    <td>/Entities</td>
                    <td><span class="permssion basic-permssion" v-html="getState(write[2])"></span></td>
                    <td>-</td>
                    <td>-</td>
                </tr>
                <tr>
                    <td>/AppData</td>
                    <td><span class="permssion basic-permssion" v-html="getState(write[3])"></span></td>
                    <td><span class="permssion basic-permssion" v-html="getState(delete[0])"></span></td>
                    <td><span class="permssion decompress-permssion" v-html="getState(decompress[0])"></span></td>
                </tr>
                <tr>
                    <td>/AppPlugins</td>
                    <td><span class="permssion basic-permssion" v-html="getState(write[4])"></span></td>
                    <td><span class="permssion basic-permssion" v-html="getState(delete[1])"></span></td>
                    <td><span class="permssion decompress-permssion" v-html="getState(decompress[1])"></span></td>
                </tr>
                <tr>
                    <td>/Upload</td>
                    <td><span class="permssion basic-permssion" v-html="getState(write[5])">></span></td>
                    <td><span class="permssion basic-permssion" v-html="getState(delete[2])"></span></td>
                    <td><span class="permssion decompress-permssion" v-html="getState(decompress[2])"></span></td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="btn-box">
            <button class="el-button el-button--primary" onclick="location.href='@Url.ActionUrl("Index")'" >上一步</button>
            <button class="el-button el-button--primary" v-on:click="next">下一步</button>
    </div>
</div>

<script type="text/javascript">
    document.getElementById("progressBar").style.width="400px";
    var nextUrl = "@Url.ActionUrl("Step3")";
    var checkData = {
        write:[true,true,true,true,true,true],
        delete: [true, true, true],
        decompress: [true, true, true],
    }
      var vue= new Vue({
          el: "#main",
          data: checkData,
            methods: {
                next: function () {
                    if (this.validate()) {
                        location.href = nextUrl
                    }
                    else
                    {
                        this.$message.error("权限未通过检测，请先设置好目录权限！");
                    }
                },
                validate: function ()
                {
                    for (var i = 0; i < this.write.length;i++)
                    {
                        if (this.write[i].toString() == "false")
                        {
                            return false;
                        }

                    }
                    for (var i = 0; i < this.delete.length; i++)
                    {
                        if (this.delete[i].toString() == "false") {
                            return false;
                        }
                    }
                    return true;
                },
                getState: function (value) {
                        if (value == "true" || value == true) {
                            return "√";
                        }
                        else {
                            return "<i>×</i>";
                        }
                    },
          },

         created:function ()
         {
             var options = {
                 url: "@Url.ActionUrl("GetPermission")", type: "post", success: function (data) {
                     vue.write = data.write;
                     vue.delete = data.delete;
                     vue.decompress = data.decompress;
                 }};
             var vue = this;
             this.ajax(options);

          }
    });

</script>
