| ¶Ô±ÈÐÂÎļþ |
| | |
| | | export default { |
| | | title: 'ZTTC-LIMS', |
| | | copyright: 'Copyright © 2021 chinaztt.com. All rights reserved.', |
| | | isFirstPage: true, // é
ç½®é¦é¡µä¸å¯å
³é |
| | | key: 'ztt', // é
置主é®,ç®åç¨äºåå¨ |
| | | whiteList: ['/login', '/404', '/401', '/lock'], // é
ç½®æ æéå¯ä»¥è®¿é®çé¡µé¢ |
| | | whiteTagList: ['/login', '/404', '/401', '/lock'], // é
ç½®ä¸æ·»å tagsé¡µé¢ ï¼'/advanced-router/mutative-detail/*'ââ*为éé
ç¬¦ï¼ |
| | | fistPage: { |
| | | label: 'é¦é¡µ', |
| | | value: '/wel/index', |
| | | params: {}, |
| | | query: {}, |
| | | group: [], |
| | | close: false |
| | | }, |
| | | // é
ç½®èåç屿§ |
| | | menu: { |
| | | props: { |
| | | label: 'label', |
| | | path: 'path', |
| | | icon: 'icon', |
| | | children: 'children' |
| | | } |
| | | } |
| | | } |
| | |
| | | <span class="label">LIMSå®éªå®¤ç®¡çç³»ç»</span> |
| | | </div> |
| | | <div class="right-menu"> |
| | | <div class="avatar-wrapper"> |
| | | <!-- <img :src="avatar" class="user-avatar" /> --> |
| | | <!-- <div class="avatar-wrapper"> |
| | | <el-avatar :size="28">{{ nickName.substring(0, 1) }}</el-avatar> |
| | | <span class="userName">{{ nickName }}</span> |
| | | <img |
| | |
| | | @click="logout" |
| | | title="éåºè´¦å·" |
| | | /> |
| | | </div> --> |
| | | <template v-if="device !== 'mobile'"> |
| | | <el-tooltip |
| | | class="right-menu-item" |
| | | effect="dark" |
| | | content="éå±" |
| | | placement="bottom" |
| | | > |
| | | <top-lock /> |
| | | </el-tooltip> |
| | | </template> |
| | | |
| | | <el-dropdown |
| | | class="avatar-container right-menu-item hover-effect" |
| | | trigger="click" |
| | | > |
| | | <div class="avatar-wrapper"> |
| | | <img :src="avatar" class="user-avatar" /> |
| | | <i class="el-icon-caret-bottom" /> |
| | | </div> |
| | | <!-- <template v-if="device!=='mobile'">--> |
| | | <!-- <search id="header-search" class="right-menu-item" />--> |
| | | |
| | | <!-- <el-tooltip content="æºç å°å" effect="dark" placement="bottom">--> |
| | | <!-- <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />--> |
| | | <!-- </el-tooltip>--> |
| | | |
| | | <!-- <el-tooltip content="ææ¡£å°å" effect="dark" placement="bottom">--> |
| | | <!-- <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />--> |
| | | <!-- </el-tooltip>--> |
| | | |
| | | <!-- <screenfull id="screenfull" class="right-menu-item hover-effect" />--> |
| | | |
| | | <!-- <el-tooltip content="å¸å±å¤§å°" effect="dark" placement="bottom">--> |
| | | <!-- <size-select id="size-select" class="right-menu-item hover-effect" />--> |
| | | <!-- </el-tooltip>--> |
| | | |
| | | <!-- </template>--> |
| | | |
| | | <!-- <div class="avatar-container">--> |
| | | <!-- <el-dropdown-menu slot="dropdown">--> |
| | | <!-- <router-link to="/user/profile">--> |
| | | <!-- <el-dropdown-item>个人ä¸å¿</el-dropdown-item>--> |
| | | <!-- </router-link>--> |
| | | <!-- <el-dropdown-item @click.native="setting = true">--> |
| | | <!-- <span>å¸å±è®¾ç½®</span>--> |
| | | <!-- </el-dropdown-item>--> |
| | | <!-- <el-dropdown-item divided @click.native="logout">--> |
| | | <!-- <span>éåºç»å½</span>--> |
| | | <!-- </el-dropdown-item>--> |
| | | <!-- </el-dropdown-menu>--> |
| | | <!-- </div>--> |
| | | <el-dropdown-menu slot="dropdown"> |
| | | <router-link to="/user/profile"> |
| | | <el-dropdown-item>个人ä¸å¿</el-dropdown-item> |
| | | </router-link> |
| | | <el-dropdown-item @click.native="setting = true"> |
| | | <span>å¸å±è®¾ç½®</span> |
| | | </el-dropdown-item> |
| | | <el-dropdown-item divided @click.native="logout"> |
| | | <span>éåºç»å½</span> |
| | | </el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { mapGetters } from "vuex"; |
| | | import { mapGetters, mapState } from "vuex"; |
| | | import Breadcrumb from "@/components/Breadcrumb"; |
| | | import TopNav from "@/components/TopNav"; |
| | | import Hamburger from "@/components/Hamburger"; |
| | | import Screenfull from "@/components/Screenfull"; |
| | | import SizeSelect from "@/components/SizeSelect"; |
| | | import Search from "@/components/HeaderSearch"; |
| | | import RuoYiGit from "@/components/RuoYi/Git"; |
| | | import RuoYiDoc from "@/components/RuoYi/Doc"; |
| | | |
| | | import topLock from "./top-lock"; |
| | | export default { |
| | | components: { |
| | | Breadcrumb, |
| | |
| | | Screenfull, |
| | | SizeSelect, |
| | | Search, |
| | | RuoYiGit, |
| | | RuoYiDoc, |
| | | topLock, |
| | | }, |
| | | computed: { |
| | | ...mapState({ |
| | | showLock: (state) => state.app.showLock, |
| | | }), |
| | | ...mapGetters(["avatar", "device", "nickName"]), |
| | | setting: { |
| | | get() { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="lock-container"> |
| | | <div class="lock-form animated bounceInDown"> |
| | | <div class="animated" :class="{ shake: passwdError, bounceOut: pass }"> |
| | | <h3 class="title">{{ loginUserInfo.nickName }}</h3> |
| | | <el-input |
| | | placeholder="请è¾å
¥ç»å½å¯ç " |
| | | type="password" |
| | | class="input-with-select animated" |
| | | v-model="passwd" |
| | | @keyup.enter.native="handleLogin" |
| | | > |
| | | <el-button |
| | | slot="append" |
| | | icon="el-icon-unlock" |
| | | @click="handleLogin" |
| | | ></el-button> |
| | | <el-button |
| | | slot="append" |
| | | icon="el-icon-switch-button" |
| | | @click="handleLogout" |
| | | ></el-button> |
| | | </el-input> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { mapGetters } from "vuex"; |
| | | export default { |
| | | name: "lock", |
| | | data() { |
| | | return { |
| | | passwd: "", |
| | | passwdError: false, |
| | | pass: false, |
| | | }; |
| | | }, |
| | | created() {}, |
| | | mounted() {}, |
| | | computed: { |
| | | ...mapGetters([ |
| | | "visitedViews", |
| | | "iframeViews", |
| | | "cachedViews", |
| | | "lockPasswd", |
| | | "loginUserInfo", |
| | | ]), |
| | | }, |
| | | props: [], |
| | | methods: { |
| | | handleLogout() { |
| | | this.$confirm("æ¯å¦éåºç³»ç», æ¯å¦ç»§ç»?", "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | closeOnClickModal: false, |
| | | type: "warning", |
| | | }).then(() => { |
| | | this.$store.dispatch("LogOut").then(() => { |
| | | this.$router.push({ path: "/login" }); |
| | | }); |
| | | }); |
| | | }, |
| | | handleLogin() { |
| | | if (this.passwd != this.lockPasswd) { |
| | | this.passwd = ""; |
| | | this.$message({ |
| | | message: "è§£éå¯ç é误,è¯·éæ°è¾å
¥", |
| | | type: "error", |
| | | }); |
| | | this.passwdError = true; |
| | | setTimeout(() => { |
| | | this.passwdError = false; |
| | | }, 1000); |
| | | return; |
| | | } |
| | | this.pass = true; |
| | | setTimeout(() => { |
| | | this.$store.dispatch("app/clearLock"); |
| | | //éå®åè·¯ç±è¿éè°æ´ |
| | | let path = |
| | | this.visitedViews && this.visitedViews.length > 0 |
| | | ? this.visitedViews.pop().fullPath |
| | | : "/index"; |
| | | this.$router.push({ |
| | | path: path, |
| | | }); |
| | | }, 1000); |
| | | }, |
| | | }, |
| | | components: {}, |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | .lock-container { |
| | | height: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | position: relative; |
| | | .title { |
| | | text-align: center; |
| | | margin-bottom: 8px; |
| | | } |
| | | } |
| | | .lock-container::before { |
| | | z-index: -999; |
| | | content: ""; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | background-image: url("~@/assets/images/lock_bg.png"); |
| | | background-size: cover; |
| | | } |
| | | .lock-form { |
| | | width: 300px; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <span> |
| | | <i class="fa fa-lock" @click="handleLock"></i> |
| | | <el-dialog |
| | | title="设置éå±å¯ç " |
| | | :visible.sync="box" |
| | | width="30%" |
| | | append-to-body |
| | | > |
| | | <el-form :model="form" ref="form" label-width="80px"> |
| | | <el-form-item |
| | | label="éå±å¯ç " |
| | | prop="passwd" |
| | | :rules="[{ required: true, message: 'éå±å¯ç ä¸è½ä¸ºç©º' }]" |
| | | > |
| | | <el-input |
| | | v-model="form.passwd" |
| | | placeholder="请è¾å
¥éå±å¯ç " |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="handleSetLock">ç¡® å®</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </span> |
| | | </template> |
| | | |
| | | <script> |
| | | import { validatenull } from "@/utils/validate"; |
| | | import { mapGetters } from "vuex"; |
| | | export default { |
| | | name: "top-lock", |
| | | data() { |
| | | return { |
| | | box: false, |
| | | form: { |
| | | passwd: "", |
| | | }, |
| | | }; |
| | | }, |
| | | created() {}, |
| | | mounted() {}, |
| | | computed: { |
| | | ...mapGetters(["lockPasswd"]), |
| | | }, |
| | | props: [], |
| | | methods: { |
| | | handleSetLock() { |
| | | this.$refs["form"].validate((valid) => { |
| | | if (valid) { |
| | | this.$store.dispatch("app/setLockPasswd", this.form.passwd); |
| | | // this.$store.commit("SET_LOCK_PASSWD", this.form.passwd); |
| | | this.handleLock(); |
| | | } |
| | | }); |
| | | }, |
| | | handleLock() { |
| | | if (validatenull(this.lockPasswd)) { |
| | | this.box = true; |
| | | return; |
| | | } |
| | | this.$store.dispatch("app/setLock"); |
| | | setTimeout(() => { |
| | | this.$router.push({ path: "/lock" }); |
| | | }, 100); |
| | | }, |
| | | }, |
| | | components: {}, |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped></style> |
| | |
| | | }) |
| | | }) |
| | | } else { |
| | | if (store.getters.isLock && to.path !=='/lock') { |
| | | next('/lock') |
| | | } else { |
| | | next() |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | // 没ætoken |
| | | if (isWhiteList(to.path)) { |
| | |
| | | hidden: true, |
| | | }, |
| | | { |
| | | path: "/lock", |
| | | component: () => import("@/layout/components/lock/index"), |
| | | hidden: true, |
| | | }, |
| | | { |
| | | path: "", |
| | | component: Layout, |
| | | redirect: "index", |
| | |
| | | topbarRouters: (state) => state.permission.topbarRouters, |
| | | defaultRoutes: (state) => state.permission.defaultRoutes, |
| | | sidebarRouters: (state) => state.permission.sidebarRouters, |
| | | isLock: (state) => state.app.isLock, |
| | | lockPasswd: (state) => state.app.lockPasswd, |
| | | }; |
| | | export default getters; |
| | |
| | | import Cookies from 'js-cookie' |
| | | |
| | | import website from '@/const/website' |
| | | import { getStore, removeStore, setStore } from '@/utils/store' |
| | | const state = { |
| | | sidebar: { |
| | | opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, |
| | |
| | | hide: false |
| | | }, |
| | | device: 'desktop', |
| | | size: Cookies.get('size') || 'medium' |
| | | size: Cookies.get('size') || 'medium', |
| | | lockPasswd: getStore({ name: 'lockPasswd' }) || '', |
| | | isLock: getStore({ name: 'isLock' }) || false, |
| | | website: website, |
| | | showLock: getStore({ name: 'showLock' }), |
| | | } |
| | | |
| | | const mutations = { |
| | |
| | | }, |
| | | SET_SIDEBAR_HIDE: (state, status) => { |
| | | state.sidebar.hide = status |
| | | } |
| | | }, |
| | | SET_LOCK_PASSWD: (state, lockPasswd) => { |
| | | state.lockPasswd = lockPasswd |
| | | setStore({ |
| | | name: 'lockPasswd', |
| | | content: state.lockPasswd, |
| | | type: 'session' |
| | | }) |
| | | }, |
| | | CLEAR_LOCK: (state) => { |
| | | state.isLock = false |
| | | state.lockPasswd = '' |
| | | removeStore({ |
| | | name: 'lockPasswd' |
| | | }) |
| | | removeStore({ |
| | | name: 'isLock', |
| | | type: 'session' |
| | | }) |
| | | }, |
| | | SET_LOCK: (state) => { |
| | | state.isLock = true |
| | | setStore({ |
| | | name: 'isLock', |
| | | content: state.isLock, |
| | | type: 'session' |
| | | }) |
| | | }, |
| | | SET_SHOW_LOCK: (state, active) => { |
| | | state.showLock = active |
| | | setStore({ |
| | | name: 'showLock', |
| | | content: state.showLock |
| | | }) |
| | | }, |
| | | } |
| | | |
| | | const actions = { |
| | |
| | | }, |
| | | toggleSideBarHide({ commit }, status) { |
| | | commit('SET_SIDEBAR_HIDE', status) |
| | | } |
| | | }, |
| | | setLockPasswd({ commit }, lockPasswd) { |
| | | commit('SET_LOCK_PASSWD', lockPasswd) |
| | | }, |
| | | setLock({ commit }) { |
| | | commit('SET_LOCK') |
| | | }, |
| | | clearLock({ commit }) { |
| | | commit('CLEAR_LOCK') |
| | | }, |
| | | } |
| | | |
| | | export default { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import { validatenull } from '@/utils/validate' |
| | | import website from '@/const/website' |
| | | |
| | | const keyName = website.key + '-' |
| | | /** |
| | | * åå¨localStorage |
| | | */ |
| | | export const setStore = (params = {}) => { |
| | | let { name, content, type } = params |
| | | name = keyName + name |
| | | const obj = { |
| | | dataType: typeof content, |
| | | content: content, |
| | | type: type, |
| | | datetime: new Date().getTime() |
| | | } |
| | | if (type) window.sessionStorage.setItem(name, JSON.stringify(obj)) |
| | | else window.localStorage.setItem(name, JSON.stringify(obj)) |
| | | } |
| | | /** |
| | | * è·ålocalStorage |
| | | */ |
| | | |
| | | export const getStore = (params = {}) => { |
| | | let { name, debug } = params |
| | | name = keyName + name |
| | | let obj = {} |
| | | let content |
| | | obj = window.sessionStorage.getItem(name) |
| | | if (validatenull(obj)) obj = window.localStorage.getItem(name) |
| | | if (validatenull(obj)) return |
| | | try { |
| | | obj = JSON.parse(obj) |
| | | } catch (e) { |
| | | return obj |
| | | } |
| | | if (debug) { |
| | | return obj |
| | | } |
| | | if (obj.dataType === 'string') { |
| | | content = obj.content |
| | | } else if (obj.dataType === 'number') { |
| | | content = Number(obj.content) |
| | | } else if (obj.dataType === 'boolean') { |
| | | content = eval(obj.content) |
| | | } else if (obj.dataType === 'object') { |
| | | content = obj.content |
| | | } |
| | | return content |
| | | } |
| | | /** |
| | | * å é¤localStorage |
| | | */ |
| | | export const removeStore = (params = {}) => { |
| | | let { name, type } = params |
| | | name = keyName + name |
| | | if (type) { |
| | | window.sessionStorage.removeItem(name) |
| | | } else { |
| | | window.localStorage.removeItem(name) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åå
¨é¨localStorage |
| | | */ |
| | | export const getAllStore = (params = {}) => { |
| | | const list = [] |
| | | const { type } = params |
| | | if (type) { |
| | | for (let i = 0; i <= window.sessionStorage.length; i++) { |
| | | list.push({ |
| | | name: window.sessionStorage.key(i), |
| | | content: getStore({ |
| | | name: window.sessionStorage.key(i), |
| | | type: 'session' |
| | | }) |
| | | }) |
| | | } |
| | | } else { |
| | | for (let i = 0; i <= window.localStorage.length; i++) { |
| | | list.push({ |
| | | name: window.localStorage.key(i), |
| | | content: getStore({ |
| | | name: window.localStorage.key(i) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | return list |
| | | } |
| | | |
| | | /** |
| | | * æ¸
空å
¨é¨localStorage |
| | | */ |
| | | export const clearStore = (params = {}) => { |
| | | const { type } = params |
| | | if (type) { |
| | | window.sessionStorage.clear() |
| | | } else { |
| | | window.localStorage.clear() |
| | | } |
| | | } |
| | |
| | | return Object.prototype.toString.call(arg) === '[object Array]' |
| | | } |
| | | return Array.isArray(arg) |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦ä¸ºç©º |
| | | */ |
| | | export function validatenull(val) { |
| | | if (typeof val === 'boolean') { |
| | | return false |
| | | } |
| | | if (typeof val === 'number') { |
| | | return false |
| | | } |
| | | if (val instanceof Array) { |
| | | if (val.length === 0) return true |
| | | } else if (val instanceof Object) { |
| | | if (JSON.stringify(val) === '{}') return true |
| | | } else { |
| | | if ( |
| | | val === 'null' || |
| | | val == null || |
| | | val === 'undefined' || |
| | | val === undefined || |
| | | val === '' |
| | | ) |
| | | return true |
| | | return false |
| | | } |
| | | return false |
| | | } |
| | |
| | | /> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="code" v-if="captchaEnabled"> |
| | | <!-- <el-form-item prop="code" v-if="captchaEnabled"> |
| | | <el-input |
| | | v-model="loginForm.code" |
| | | auto-complete="off" |
| | |
| | | <div class="login-code"> |
| | | <img :src="codeUrl" @click="getCode" class="login-code-img" /> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form-item> --> |
| | | <el-checkbox |
| | | v-model="loginForm.rememberMe" |
| | | style="margin: 0px 0px 25px 0px" |
| | |
| | | }, |
| | | loading: false, |
| | | // éªè¯ç å¼å
³ |
| | | captchaEnabled: true, |
| | | captchaEnabled: false, |
| | | // 注åå¼å
³ |
| | | register: false, |
| | | redirect: undefined, |