<template>
    <fullscreen :fullscreen.sync="fullscreen" class="container">
        <div class="container-box">
            <h2 style="margin-top: 20px;">知识库</h2>
            <div class="adv-type">
                <div
                    class="wfour"
                    @click="jumpinfo('/knowledgeManagement', '知识库管理')"
                >
                    <span><i class="el-icon-folder-opened"></i></span>
                    <span>知识库管理</span>
                </div>
                <!-- <div
                    class="wfour"
                    @click="jumpinfo('/knowledgeExaminetop', '知识库审核')"
                >
                    <span><i class="el-icon-folder-opened"></i></span>
                    <span>知识库审核</span>
                </div> -->
                <div
                    class="wfour"
                    @click="jumpinfo('/knowledgeTypetop', '知识类型管理')"
                     v-if="lockFlag == 'add'"
                >
                    <span><i class="el-icon-folder-opened"></i></span>
                    <span>知识类型管理</span>
                </div>
                <div
                    class="wfour"
                    @click="
                        jumpinfo('/knowledgeCatalogtop', '知识库目录管理')
                    "
                     v-if="lockFlag == 'add'"
                >
                    <span><i class="el-icon-folder-opened"></i></span>
                    <span>知识库目录管理</span>
                </div>
            </div>
        </div>
    </fullscreen>
</template>
<script>
import mySearch from "../../../components/search.vue";
import myMessage from "../../../components/myMessage.vue";
import toolList from "../../../components/toolList";
import myUpload from "../../../components/upload";

export default {
    components: {
        mySearch,
        myMessage,
        toolList,
        myUpload
    },
    data() {
        return {
            fullscreen: false,
            lockFlag: "see",
            province: true
        };
    },
    methods: {
        jumpinfop(p, v, n) {
            this.$router.push({
                path: p,
                query: {
                    type: v
                }
            });
            this.setabList(n, p + "?type=" + v);
        },
        jumpinfo(p, n) {
            this.$router.push({
                path: p
            });
            this.setabList(n, p);
        },
        setabList(n, p) {
            let params = {
                children: "",
                name: n,
                rountPath: p,
                target: "_self"
            };
            for (let i = 0; i < this.$store.state.tabList.length; i++) {
                if (this.$store.state.tabList[i].name === params.name) {
                    this.$store.state.tabList[i] = params;
                }
            }
            let set = new Set([...this.$store.state.tabList, params]);
            set.add(params);
            this.$store.commit("setDefaultActive", params.rountPath);
            this.$store.commit("setTabList", Array.from(set));
        },
        getRole(){
            this.$http({
                url:"/market/mkNewknowledge/queryRole",
                method: "post",
                headers: {
                    "Content-Type": "application/json",
                },
                data: {}
            }).then(res => {
                console.log("vue"+res.data);
                if(res.data == "1"){
                    this.lockFlag = 'add';//管理员
                }else{
                    this.lockFlag = 'updata';//普通员工
                }
            });
        },
        // getUser() {
        //     this.userInfo = JSON.parse(window.sessionStorage.userInfo);
        //     let Menus = JSON.parse(window.sessionStorage.childrenMenus);
        //     for (let i = 0; i < Menus.length; i++) {
        //         if (
        //             Menus[i].systemflag == 1 &&
        //             Menus[i].jspUrl == "/publicityAccount"
        //         ) {
        //             this.lockFlag = "add"; //省级
        //         }
        //         if (
        //             Menus[i].systemflag == 1 &&
        //             Menus[i].jspUrl == "/publicity"
        //         ) {
        //             this.lockFlag = "updata"; //管理员
        //             i = Menus.length;
        //         }
        //     }
        //     for (let i = 0; i < Menus.length; i++) {
        //         if (
        //             Menus[i].systemflag == 1 &&
        //             Menus[i].jspUrl == "/province"
        //         ) {
        //             this.province = true; //省公司
        //         }
        //     }
        // }
    },
    mounted() {
        this.getRole();
        // this.getUser();
    },
    created() {}
};
</script>
<style scoped lang="scss">
.container-box {
    height: calc(100vh - 200px);
    overflow-y: scroll;
    padding-bottom: 20px;
}
.adv-type {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    // border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    div {
        width: 33%;
        text-align: center;
        height: 80px;
        overflow: hidden;
        min-width: 100px;
        cursor: pointer;
        padding-top: 10px;
        margin: 10px 0;
    }
    div:hover {
        background: #cfe8fc;
        border-radius: 5px;
    }
    span {
        width: 100%;
        display: inline-block;
        height: 40px;
        // line-height: 40px;
        i {
            color: #0074d9;
            font-size: 36px;
        }
    }
    .wfour {
        width: 25%;
    }
    .wfive {
        width: 20%;
    }
}
</style>
