<commit_before><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理</title>
    <script src="../common/import.js"></script>
    <style>
        .el-header {
            /*background-color: #B3C0D1;*/
            /*color: #333;*/
            /*text-align: center;*/
            /*line-height: 60px;*/
        }

        .el-main {
            /*background-color: #E9EEF3;*/
            /*color: #333;*/
            /*text-align: center;*/
            /*line-height: 160px;*/
        }

        .main-sidebar-menu {
            height: 100%;
        }

        .main-sidebar-menu:not(.el-menu--collapse) {
            width: 200px;
        }
    </style>

</head>
<body>
<div id="mainApp">
    <el-container style="position:absolute; left:0; top:0; width:100%;height:100%;">
        <el-aside :style="{'overflow-x': 'hidden', width: sidebarCollapsed ? '65px' : '200px', transition: sidebarCollapsed ? 'width 0.3s' : 'width 0.45s'}">
            <el-menu :collapse="sidebarCollapsed"
                     :default-active="$route.path"
                     class="main-sidebar-menu"
                     background-color="#304156"
                     text-color="#bfcbd9"
                     active-text-color="#409EFF">
                <router-menu-item v-for="child in $router.options.routes" v-if="!child.meta.type || child.meta.type==='menu-item'" parent-path="" :route="child" :key="child.path"></router-menu-item>
            </el-menu>
        </el-aside>
        <el-container>
            <el-header height="50px" style="padding: 0px 10px; border-bottom: solid 1px rgb(230, 230, 230)">
                <div style="float: left;line-height: 58px;">
                    <svg @click="sidebarCollapsed = !sidebarCollapsed" p-id="1691" t="1492500959545" :style="{display: 'inline-block',cursor: 'pointer',width: '20px',height: '20px',transform: sidebarCollapsed ? 'rotate(90deg)' : 'rotate(0deg)',transition: '.38s','transform-origin': '50% 50%'}" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" version="1.1">
                        <path p-id="1692" d="M966.8023 568.849776 57.196677 568.849776c-31.397081 0-56.850799-25.452695-56.850799-56.850799l0 0c0-31.397081 25.452695-56.849776 56.850799-56.849776l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.849776l0 0C1023.653099 543.397081 998.200404 568.849776 966.8023 568.849776z"></path>
                        <path p-id="1693" d="M966.8023 881.527125 57.196677 881.527125c-31.397081 0-56.850799-25.452695-56.850799-56.849776l0 0c0-31.397081 25.452695-56.849776 56.850799-56.849776l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.849776l0 0C1023.653099 856.07443 998.200404 881.527125 966.8023 881.527125z"></path>
                        <path p-id="1694" d="M966.8023 256.17345 57.196677 256.17345c-31.397081 0-56.850799-25.452695-56.850799-56.849776l0 0c0-31.397081 25.452695-56.850799 56.850799-56.850799l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.850799l0 0C1023.653099 230.720755 998.200404 256.17345 966.8023 256.17345z"></path>
                    </svg>
                </div>
                <el-breadcrumb style="display: inline-block;margin-left: 20px;line-height: 50px;">
                    <el-breadcrumb-item v-for="meta in breadcrumbMetas" :to="{ path: meta.path }" :key="meta.path">{{ meta.title }}</el-breadcrumb-item>
                </el-breadcrumb>
                <el-dropdown @command="handleProfileCommand" trigger="click" style="cursor: pointer;position: absolute;right: 30px;line-height: 50px;">
                    <span>
                    {{ manager.name }}<i class="el-icon-caret-bottom el-icon--right"></i>
                    </span>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="showManagerProfile">我的信息</el-dropdown-item>
                        <el-dropdown-item command="logout">退出</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-header>
            <el-main>
                <router-view></router-view>
            </el-main>
        </el-container>
    </el-container>
</div>
<script>
    const routerMenuItem = {
        name: 'router-menu-item',
        props: ['parentPath', 'route'],
        computed: {
            path: function () {
                let path = this.parentPath;
                if (!this.route.path.startsWith('/')) {
                    path += '/';
                }
                path += this.route.path;

                return path;
            }
        },
        template: `
            <router-link v-if="!(route.children) || route.children.length <= 0" :to="path" style="text-decoration: none;">
                <el-menu-item :index="path">
                    <i :class="route.meta.icon"></i>
                    <span slot="title">{{ route.meta.title }}</span>
                </el-menu-item>
            </router-link>
            <el-submenu v-else :index="path">
                <template slot="title">
                    <i :class="route.meta.icon"></i>
                    <span slot="title">{{ route.meta.title }}</span>
                </template>
                <router-menu-item v-for="child in route.children" v-if="!child.meta.type || child.meta.type==='menu-item'" :parent-path="path" :route="child" :key="path + '/' + child.path"></router-menu-item>
            </el-submenu>`
    };


    // 判断用户是否已登录
    axios.get('../manager/main/current')
        .then(function (result) {
            if (!result.success) {
                Vue.prototype.$message.error(result.message);
                return;
            }
            if (result.manager === null) {
                // 未登录，则跳转到登录页面
                Vue.prototype.$alert('未登录或登录已超时，请进行登录', '警告', {
                    callback: function () {
                        window.location.href = 'login.html';
                    }
                });
                return;
            }
            mainApp.manager = Object.assign({}, mainApp.manager, result.manager);
        });

    const configurationsComponent = {
        template: '<div>configurations</div>'
    };
    const appsComponent = {
        template: '<div>apps</div>'
    };
    const profilesComponent = {
        template: '<div>profiles</div>'
    };
    const managersComponent = {
        template: '<div>managers</div>'
    };

    const router = new VueRouter({
        routes: [{
            path: '/configurations',
            component: configurationsComponent,
            meta: {
                title: '配置',
                icon: 'el-icon-tickets'
            }
        }, {
            path: '/apps',
            component: appsComponent,
            meta: {
                title: '应用',
                icon: 'el-icon-menu'
            }
        }, {
            path: '/profiles',
            component: profilesComponent,
            meta: {
                title: '环境',
                icon: 'el-icon-upload'
            }
        }, {
            path: '/managers',
            component: managersComponent,
            meta: {
                title: '管理员',
                icon: 'el-icon-view'
            }
        }]
    });


    const mainApp = new Vue({
        el: '#mainApp',
        components: {
            'router-menu-item': routerMenuItem
        },
        router: router,
        data: {
            sidebarCollapsed: false,
            breadcrumbMetas: [],
            manager: {}
        },
        created: function () {
            this.$router.beforeEach(function (to, from, next) {
                mainApp.appendBreadcrumb(to);
                next();
            });
        },
        methods: {
            appendBreadcrumb: function (route) {
                let target = route.matched[route.matched.length - 1];
                if (target.meta.type !== 'inner') {
                    this.breadcrumbMetas.splice(0, this.breadcrumbMetas.length);
                }
                this.breadcrumbMetas.push({
                    title: target.meta.title,
                    icon: target.meta.icon,
                    path: route.path
                });
            },
            handleProfileCommand: function (command) {
                switch (command) {
                    case 'showManagerProfile':
                        this.showManagerProfile();
                        break;
                    case 'logout':
                        this.logout();
                        break;
                }
            },
            showManagerProfile: function () {

            },
            logout: function () {
                axios.get('../manager/main/logout')
                    .then(function (result) {
                        if (!result.success) {
                            Vue.prototype.$message.error(result.message);
                            return;
                        }
                        window.location.href = 'login.html';
                    });
            }
        }
    });
</script>
</body>
</html><commit_msg>简化main.html<commit_after><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理</title>
    <script src="../common/import.js"></script>
    <style>
        .main-sidebar-menu {
            height: 100%;
        }

        .main-sidebar-menu:not(.el-menu--collapse) {
            width: 200px;
        }
    </style>

</head>
<body>
<div id="mainApp">
    <el-container style="position:absolute; left:0; top:0; width:100%;height:100%;">
        <el-aside :style="{'overflow-x': 'hidden', width: sidebarCollapsed ? '65px' : '200px', transition: sidebarCollapsed ? 'width 0.3s' : 'width 0.45s'}">
            <el-menu :collapse="sidebarCollapsed"
                     :default-active="$route.path"
                     class="main-sidebar-menu"
                     background-color="#304156"
                     text-color="#bfcbd9"
                     active-text-color="#409EFF">
                <router-link v-for="route in $router.options.routes" v-if="!route.meta.hidden" :to="route.path" :key="route.path" style="text-decoration: none;">
                    <el-menu-item :index="route.path">
                        <i :class="route.meta.icon"></i>
                        <span slot="title">{{ route.meta.title }}</span>
                    </el-menu-item>
                </router-link>
            </el-menu>
        </el-aside>
        <el-container>
            <el-header height="50px" style="padding: 0px 10px; border-bottom: solid 1px rgb(230, 230, 230)">
                <div style="float: left;line-height: 58px;">
                    <svg @click="sidebarCollapsed = !sidebarCollapsed" p-id="1691" t="1492500959545" :style="{display: 'inline-block',cursor: 'pointer',width: '20px',height: '20px',transform: sidebarCollapsed ? 'rotate(90deg)' : 'rotate(0deg)',transition: '.38s','transform-origin': '50% 50%'}" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" version="1.1">
                        <path p-id="1692" d="M966.8023 568.849776 57.196677 568.849776c-31.397081 0-56.850799-25.452695-56.850799-56.850799l0 0c0-31.397081 25.452695-56.849776 56.850799-56.849776l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.849776l0 0C1023.653099 543.397081 998.200404 568.849776 966.8023 568.849776z"></path>
                        <path p-id="1693" d="M966.8023 881.527125 57.196677 881.527125c-31.397081 0-56.850799-25.452695-56.850799-56.849776l0 0c0-31.397081 25.452695-56.849776 56.850799-56.849776l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.849776l0 0C1023.653099 856.07443 998.200404 881.527125 966.8023 881.527125z"></path>
                        <path p-id="1694" d="M966.8023 256.17345 57.196677 256.17345c-31.397081 0-56.850799-25.452695-56.850799-56.849776l0 0c0-31.397081 25.452695-56.850799 56.850799-56.850799l909.605623 0c31.397081 0 56.849776 25.452695 56.849776 56.850799l0 0C1023.653099 230.720755 998.200404 256.17345 966.8023 256.17345z"></path>
                    </svg>
                </div>
                <el-breadcrumb style="display: inline-block;margin-left: 20px;line-height: 50px;">
                    <el-breadcrumb-item v-for="matchedRoute in $route.matched" v-if="!matchedRoute.path.endsWith('/')" :to="{ path: matchedRoute.path }" :key="matchedRoute.path">{{ matchedRoute.meta.title }}</el-breadcrumb-item>
                </el-breadcrumb>
                <el-dropdown @command="handleProfileCommand" trigger="click" style="cursor: pointer;position: absolute;right: 30px;line-height: 50px;">
                    <span>
                    {{ manager.name }}<i class="el-icon-caret-bottom el-icon--right"></i>
                    </span>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="showManagerProfile">我的信息</el-dropdown-item>
                        <el-dropdown-item command="logout">退出</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-header>
            <el-main>
                <router-view></router-view>
            </el-main>
        </el-container>
    </el-container>
</div>
<script>
    // 判断用户是否已登录
    axios.get('../manager/main/current')
        .then(function (result) {
            if (!result.success) {
                Vue.prototype.$message.error(result.message);
                return;
            }
            if (result.manager === null) {
                // 未登录，则跳转到登录页面
                Vue.prototype.$alert('未登录或登录已超时，请进行登录', '警告', {
                    callback: function () {
                        window.location.href = 'login.html';
                    }
                });
                return;
            }
            mainApp.manager = Object.assign({}, mainApp.manager, result.manager);
        });

    const configurationsComponent = {
        template: '<div>configurations</div>'
    };
    const appsComponent = {
        template: '<div>apps</div>'
    };
    const profilesComponent = {
        template: '<div>profiles</div>'
    };
    const managersComponent = {
        template: '<div>managers</div>'
    };

    const router = new VueRouter({
        routes: [{
            path: '/configurations',
            component: {
                template: '<router-view></router-view>'
            },
            meta: {
                title: '配置',
                icon: 'el-icon-tickets'
            },
            children: [{
                path: '',
                component: configurationsComponent
            }]
        }, {
            path: '/apps',
            component: appsComponent,
            meta: {
                title: '应用',
                icon: 'el-icon-menu'
            }
        }, {
            path: '/profiles',
            component: profilesComponent,
            meta: {
                title: '环境',
                icon: 'el-icon-upload',
                hidden: true
            }
        }, {
            path: '/managers',
            component: managersComponent,
            meta: {
                title: '管理员',
                icon: 'el-icon-view'
            }
        }]
    });

    const mainApp = new Vue({
        el: '#mainApp',
        router: router,
        data: {
            sidebarCollapsed: false,
            manager: {}
        },
        methods: {
            handleProfileCommand: function (command) {
                switch (command) {
                    case 'showManagerProfile':
                        this.showManagerProfile();
                        break;
                    case 'logout':
                        this.logout();
                        break;
                }
            },
            showManagerProfile: function () {

            },
            logout: function () {
                axios.get('../manager/main/logout')
                    .then(function (result) {
                        if (!result.success) {
                            Vue.prototype.$message.error(result.message);
                            return;
                        }
                        window.location.href = 'login.html';
                    });
            }
        }
    });
</script>
</body>
</html>
{'fraction_non_alphanumeric': 0.14789253142716294, 'fraction_numerical': 0.09767069263002219, 'mean_word_length': 1.4952337023370235, 'pattern_counts': {'":': 0, '<': 166, '<?xml version=': 0, '>': 165, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '824755', 'n_tokens_mistral': 6023, 'n_tokens_neox': 4927, 'n_words': 791}