123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772 |
- <template>
- <!-- 顶部登录导航 -->
- <div class="LoginNav1" v-if="isData">
- <div class="logo" v-if="configInfor">
- <img
- v-if="configInfor.logo_image_url"
- :src="configInfor.logo_image_url"
- alt=""
- class="logo-image"
- @click="handleSelect"
- />
- <span class="logo-img" v-else>logo</span>
- <ul class="logo-projectlist" v-if="!projectShow">
- <li
- v-for="(itemI, indexI) in projectList"
- :key="indexI"
- :class="indexI == LoginNavIndex ? 'active' : ''"
- @click="handleCommand(indexI)"
- >
- {{ itemI.name }}
- </li>
- </ul>
- <template v-else-if="seekShow">
- <div class="ylk_seek" @keydown="downSeek">
- <input type="text" v-model="keyword" />
- <div @click="seekresult">搜索</div>
- </div>
- </template>
- <el-popover
- placement="bottom"
- width="335"
- trigger="click"
- v-model="visibleOption"
- v-if="seekOptions"
- >
- <div class="set_corpus_dv">
- <span>选择难度</span>
- <el-select
- style="width: 205px"
- v-model="corpus.difficlty"
- placeholder="请选择"
- >
- <el-option v-for="(itemD,indexD) in difficltyList" :key="indexD" :label="itemD.label" :value="itemD.value"></el-option>
- </el-select>
- </div>
- <div class="set_corpus_dv">
- <span>选择范围</span>
- <el-select
- style="width: 205px"
- v-model="corpus.scope"
- placeholder="请选择"
- >
- <el-option v-for="(itemD,indexD) in scopeList" :key="indexD" :label="itemD.label" :value="itemD.value"></el-option>
- </el-select>
- </div>
- <div class="set_corpus_dv">
- <span>句子长度</span>
- <el-input
- v-model="corpus.sentenceStart"
- style="width: 55px; margin-right: 8px;"
- onkeyup="value=value.replace(/^0+(\d)|[^\d]+/g,'')"
- class="numbre-input"
- ></el-input>
- ——
- <el-input
- v-model="corpus.sentenceEnd"
- style="width: 55px; margin-left: 8px"
- onkeyup="value=value.replace(/^0+(\d)|[^\d]+/g,'')"
- class="numbre-input"
- ></el-input>
- </div>
- <div class="set_corpus_submit">
- <div @click="visibleOption = false">取消</div>
- <div @click="visibleOption = false">确认</div>
- </div>
- <div slot="reference" class="set_corpus" style="margin-left: 24px;cursor:pointer;">设置条件</div>
- </el-popover>
- </div>
- <div class="userName">
- <template v-if="seekOption">
- <el-popover
- placement="bottom"
- width="335"
- trigger="click"
- v-model="visible"
- >
- <div class="set_corpus_dv">
- <span>选择难度</span>
- <el-select
- style="width: 205px"
- v-model="corpus.difficlty"
- placeholder="请选择"
- >
- <el-option v-for="(itemD,indexD) in difficltyList" :key="indexD" :label="itemD.label" :value="itemD.value"></el-option>
- </el-select>
- </div>
- <div class="set_corpus_dv">
- <span>选择范围</span>
- <el-select
- style="width: 205px"
- v-model="corpus.scope"
- placeholder="请选择"
- >
- <el-option v-for="(itemD,indexD) in scopeList" :key="indexD" :label="itemD.label" :value="itemD.value"></el-option>
- </el-select>
- </div>
- <div class="set_corpus_dv">
- <span>句子长度</span>
- <el-input
- v-model="corpus.sentenceStart"
- style="width: 55px; margin-right: 8px;"
- onkeyup="value=value.replace(/^0+(\d)|[^\d]+/g,'')"
- class="numbre-input"
- ></el-input>
- ——
- <el-input
- v-model="corpus.sentenceEnd"
- style="width: 55px; margin-left: 8px"
- onkeyup="value=value.replace(/^0+(\d)|[^\d]+/g,'')"
- class="numbre-input"
- ></el-input>
- </div>
- <div class="set_corpus_submit">
- <div @click="visible = false">取消</div>
- <div @click="visible = false">确认</div>
- </div>
- <div slot="reference" class="set_corpus">设置</div>
- </el-popover>
- </template>
- <template>
- <el-dropdown
- style="margin-right: 16px; cursor: pointer"
- trigger="click"
- @command="changeLang"
- >
- <span class="el-dropdown-link" style="color: #000000">
- {{ lang }}
- <i class="el-icon-arrow-down el-icon--right"></i>
- </span>
- <el-dropdown-menu slot="dropdown" style="width: 200px">
- <el-dropdown-item
- v-for="item in language_list"
- :key="item.language_type"
- :command="item"
- >{{ item.language_name }}</el-dropdown-item
- >
- </el-dropdown-menu>
- </el-dropdown>
- </template>
- <div v-if="!userMessage" class="selectLoginOrRegistration">
- <span @click="cutLoginReg"> <!-- 登录 -->{{ $t("Key9") }} </span>
- </div>
- <!-- 用户头像和用户名 -->
- <div class="user" v-else>
- <img
- @click="userShow = !userShow"
- class="headPhoto"
- :src="
- userMessage.image_url
- ? userMessage.image_url
- : require('../assets/login/Group3214.png')
- "
- alt=""
- />
- <span @click="userShow = !userShow">{{
- userMessage.user_real_name
- }}</span>
- <div class="userShow" v-show="userShow">
- <p @click="gotoPersonalcenter">
- <img src="../assets/login/project7.png" alt="" />
- <!-- 个人中心 -->{{ $t("Key8") }}
- </p>
- <p @click="QuitLogin">
- <img src="../assets/login/Frame77.png" alt="" />
- <!-- 退出登录 -->{{ $t("Key39") }}
- </p>
- </div>
- </div>
- <!-- 消息 铃铛图片 -->
- <div class="message">
- <img
- @click="gotoPersonalcenter"
- src="../assets/login/Vector.png"
- alt=""
- />
- <span class="redDot" v-if="is_exist == 'true'"></span>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import { getToken, removeToken } from "@/utils/auth";
- import Cookies from "js-cookie";
- import {
- getContent,
- getStaticContent,
- getLearnWebContent,
- getContentFile,
- } from "@/api/api";
- import { setI18nLang } from "@/utils/i18n";
- import { getConfig } from "@/utils/auth";
- import { saveSession, getSession, removeSession } from "@/utils/role";
- import { updateWordPack } from "@/utils/i18n";
- export default {
- name: "LayoutHeader",
- props: ["projectShow", "seekShow", "seekOption","seekOptions"],
- data() {
- return {
- keyword: this.$route.query.keyword?this.$route.query.keyword:'',
- visible: false,
- visibleOption: false,
- corpus: {
- difficlty: null,
- scope: null,
- sentenceStart: null,
- sentenceEnd: null,
- },
- activeIndex: "2", // 主导航索引
- LoginNavIndex: 0, //下拉框导航索引
- projectName: "教研中心",
- projectList: [],
- is_exist: "false",
- teacherProList: [
- //普通教师
- {
- id: 0,
- name: "教学中心",
- img: "project1",
- },
- {
- id: 2,
- name: "教培中心",
- img: "project3",
- },
- {
- id: 3,
- name: "教研中心",
- img: "project4",
- },
- {
- id: 5,
- name: "学习中心",
- img: "project6",
- },
- {
- id: 4,
- name: "考试中心",
- img: "project5",
- },
- {
- id: 6,
- name: "个人中心",
- img: "project7",
- },
- ],
- stuProList: [
- {
- id: 0,
- name: "教学中心",
- img: "project1",
- },
- {
- id: 5,
- name: "学习中心",
- img: "project6",
- },
- {
- id: 6,
- name: "个人中心",
- img: "project7",
- },
- ],
- userMessage: null,
- userShow: false,
- language_list: [],
- lang: "",
- headTimer: null,
- configInfor: null,
- isData: false,
- difficltyList: [
- {
- value: '',
- label: '全部'
- }
- ],
- scopeList: [
- {
- value: '',
- label: '全部'
- }
- ]
- };
- },
- watch: {},
- computed: {
- ...mapGetters(["language_type"]),
- },
- methods: {
- downSeek(e) {
- if (e.keyCode == 13) {
- if (!this.keyword) {
- this.$message.warning("请先输入内容");
- return;
- }
- this.seekresult();
- }
- },
- seekresult() {
- this.$router.replace({
- path: "/corpus/Result",
- query: {
- keyword: this.keyword,
- },
- });
- this.$emit("changehzdata");
- },
- // 前往个人中心
- gotoPersonalcenter() {
- if (!this.userMessage) {
- this.$message.warning("请先登录");
- return;
- }
- let MethodName = "login_control-CreateAccessCode";
- let acsCode = "";
- // getContent(MethodName, UserCode, UserType, SessionID).then((res) => {
- // acsCode = res.access_code;
- location.href = `/GCLS-Personal/#/EnterSys`;
- // });
- },
- // 切换导航
- handleSelect(key, keyPath) {
- window.location.href = "/";
- },
- // 切换项目
- handleCommand(command) {
- let _this = this;
- _this.LoginNavIndex = command;
- if (!_this.userMessage) {
- this.$message.warning("请先登录");
- this.projectName = this.$t("Key5"); //"教研中心";
- window.location.href = "/";
- return;
- }
- _this.projectName = _this.projectList[command].name;
- let relative_path = _this.projectList[command].relative_path;
- location.href = relative_path;
- },
- // 切换登录的注册
- cutLoginReg() {
- window.location.href = "/";
- },
- QuitLogin() {
- window.location.href = "/";
- removeSession("SysList");
- removeToken();
- Cookies.remove("JSESSIONID");
- this.userShow = false;
- this.userMessage = null;
- sessionStorage.removeItem("useragent_root_close");
- },
- getLangList() {
- let MethodName = "language_manager-GetLanguageList";
- let data = {};
- getStaticContent(MethodName, data).then((res) => {
- this.language_list = res.language_list;
- for (let i = 0; i < this.language_list.length; i++) {
- let item = this.language_list[i];
- if (item.language_type == this.language_type) {
- this.lang = item.language_name;
- break;
- }
- }
- });
- },
- async changeLang(command) {
- console.log(command);
- this.lang = command.language_name;
- let lang_type = command.language_type;
- await setI18nLang(lang_type);
- this.$router.go(0);
- },
- getNotReadMessage() {
- let MethodName = "message-message_manager-IsExistMyMessage_NotRead";
- let data = {};
- getLearnWebContent(MethodName, data).then((res) => {
- this.is_exist = res.is_exist;
- });
- },
- // async _getConfig() {
- // this.configInfor = await getConfigInfor();
- // },
- getChildSysList() {
- let _this = this;
- let MethodName = "login_control-GetChildSysList_CanEnter_PC";
- getContentFile(MethodName, {})
- .then((res) => {
- if (res.child_sys_list && res.child_sys_list.length > 0) {
- let invok_module = this.$route.query.invok_module;
- _this.projectList = res.child_sys_list;
- for (let i = 0; i < _this.projectList.length; i++) {
- let item = _this.projectList[i];
- if (invok_module) {
- if (invok_module == item.key) {
- _this.LoginNavIndex = i;
- _this.projectName = item.name;
- }
- } else {
- let key = "GCLS-TC";
- if (key == item.key) {
- _this.LoginNavIndex = i;
- _this.projectName = item.name;
- }
- }
- }
- }
- })
- .catch((err) => {
- console.log(err);
- });
- },
- },
- async created() {
- let _this = this;
- _this.getChildSysList();
- console.log("v2022.03.18.10:25");
- let userInfor = getToken();
- if (userInfor) {
- await updateWordPack({
- word_key_list: ["Key9", "Key8", "Key39"],
- });
- this.isData = true;
- }
- },
- mounted() {
- let _this = this;
- let user = getToken();
- if (user) {
- _this.userMessage = JSON.parse(user);
- }
- let config = getConfig();
- if (config) {
- _this.configInfor = JSON.parse(config);
- }
- _this.getLangList();
- _this.getNotReadMessage();
- _this.headTimer = setInterval(() => {
- _this.getNotReadMessage();
- }, 120000);
- },
- beforeDestroy() {
- if (this.headTimer) {
- //如果定时器还在运行 或者直接关闭,不用判断
- clearInterval(this.headTimer); //关闭
- }
- },
- };
- </script>
- <style lang="scss" scoped>
- .LoginNav1 {
- // height: 74px;
- height: 64px;
- position: relative;
- display: flex;
- align-items: center;
- justify-content: space-between;
- box-sizing: border-box;
- padding: 0px 24px;
- z-index: 999;
- // background: #ffffff;
- // box-shadow: 0px 1px 0px rgba(0, 0, 0, 0.15);
- font-family: "sourceR";
- .el-dropdown-link {
- img {
- width: 8px;
- height: 4px;
- vertical-align: middle;
- }
- }
- .logo {
- > img {
- // width: 188px;
- height: 48px;
- cursor: pointer;
- }
- &-img {
- font-style: normal;
- font-weight: 600;
- font-size: 30px;
- font-variant: small-caps;
- color: #000000;
- // color: #fff;
- margin-right: 29px;
- line-height: 64px;
- }
- display: flex;
- align-items: center;
- .logo-projectlist {
- display: flex;
- padding: 0 24px;
- height: 64px;
- list-style: none;
- li {
- padding: 0 12px;
- color: rgba(0, 0, 0, 0.45);
- font-size: 16px;
- line-height: 64px;
- font-weight: 500;
- cursor: pointer;
- white-space: nowrap;
- &:hover {
- background: #f6f6f6;
- }
- &.active {
- color: #ff9900;
- background: #ffefd6;
- }
- }
- }
- }
- .userName {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- .set_corpus {
- width: 48px;
- height: 35px;
- background: #ebebeb;
- border-radius: 8px;
- font-weight: 400;
- font-size: 16px;
- line-height: 35px;
- text-align: center;
- color: #000000;
- cursor: pointer;
- margin-right: 24px;
- }
- .seek {
- margin-right: 100px;
- position: relative;
- img {
- left: 10px;
- top: 11px;
- position: absolute;
- }
- }
- .flag {
- position: relative;
- top: 5px;
- }
- .headPhoto {
- width: 50px;
- height: 50px;
- // background: url("../assets/teacherTrain/image 4.png") no-repeat 100% 100%;
- // background-size: 100%;
- border-radius: 50%;
- // margin-right: 10px;
- }
- .message {
- height: 100%;
- position: relative;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-left: 23px;
- cursor: pointer;
- img {
- width: 18px;
- height: 24px;
- }
- .redDot {
- position: absolute;
- top: 2px;
- right: 2px;
- width: 6px;
- height: 6px;
- display: inline-block;
- background: red;
- border-radius: 50%;
- }
- }
- .selectLoginOrRegistration {
- display: flex;
- height: 32px;
- border: 1px solid #ffffff;
- box-sizing: border-box;
- border-radius: 4px;
- justify-content: space-evenly;
- align-items: center;
- padding: 0 16px;
- > span {
- cursor: pointer;
- font-size: 16px;
- color: #000000;
- }
- }
- .user {
- display: flex;
- align-items: center;
- cursor: pointer;
- position: relative;
- color: #000000;
- > img {
- width: 34px;
- height: 34px;
- }
- > span {
- font-size: 20px;
- padding-left: 10px;
- }
- .userShow {
- position: absolute;
- width: 156px;
- height: 96px;
- background: #ffffff;
- box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.15);
- border-radius: 8px;
- bottom: -100px;
- left: -5px;
- color: #000000;
- img {
- width: 24px;
- height: 24px;
- margin-right: 10px;
- }
- p {
- font-size: 16px;
- height: 40px;
- display: flex;
- align-items: center;
- padding-left: 20px;
- margin: 0;
- margin-top: 5px;
- }
- > p:hover {
- background: #f2f2f2;
- }
- }
- }
- }
- .ylk_seek {
- margin-left: 24px;
- height: 35px;
- display: flex;
- input {
- width: 484px;
- height: 35px;
- background: #ffffff;
- border: 1px solid #669aff;
- outline: none;
- padding: 0 10px;
- box-sizing: border-box;
- }
- div {
- width: 80px;
- height: 100%;
- background: #669aff;
- border-width: 1px 1px 1px 0px;
- box-sizing: border-box;
- border-style: solid;
- border-color: #669aff;
- text-align: center;
- font-weight: 400;
- font-size: 16px;
- line-height: 35px;
- color: #ffffff;
- cursor: pointer;
- }
- }
- }
- </style>
- <style lang="scss">
- .LoginNav1 {
- .el-dropdown-menu__item {
- line-height: 40px;
- display: flex;
- justify-content: center;
- align-items: center;
- > span {
- font-family: "sourceR";
- font-size: 16px;
- }
- }
- .el-menu--horizontal > .el-menu-item {
- height: 64px;
- line-height: 64px;
- }
- .el-dropdown {
- display: block;
- > span {
- font-family: "sourceR";
- font-size: 16px;
- }
- }
- .el-menu-item.is-active i {
- color: white;
- }
- }
- .set_corpus_dv {
- display: flex;
- align-items: center;
- margin-bottom: 24px;
- > span {
- font-weight: 400;
- font-size: 16px;
- line-height: 19px;
- color: #000000;
- margin-right: 18px;
- }
- .numbre-input{
- .el-input__inner{
- padding: 0;
- text-align: center;
- }
- }
- }
- .set_corpus_submit {
- margin-top: 32px;
- display: flex;
- justify-content: flex-end;
- div {
- width: 44px;
- height: 32px;
- border-radius: 4px;
- font-weight: 400;
- font-size: 14px;
- line-height: 32px;
- text-align: center;
- cursor: pointer;
- }
- > :nth-child(2) {
- color: #ffffff;
- background: #4992ff;
- }
- > :nth-child(1) {
- color: #000000;
- margin-right: 8px;
- }
- }
- .projectList {
- &.el-dropdown-menu__item {
- line-height: 40px;
- display: flex;
- align-items: center;
- color: #000000;
- > img {
- top: 0;
- }
- > span {
- line-height: 40px;
- font-family: "sourceR";
- }
- }
- &:hover {
- background: #ff9900 !important;
- // background: rgba(255, 153, 0, 0.1) !important;
- color: #000 !important;
- // color: #fff;
- }
- &.menuActive {
- background: #ff9900;
- }
- }
- .el-popper{
- z-index: 100000 !important;
- }
- </style>
|