From c7bd1a3fd46b5d5f887ce4f674387294ee1e8ccd Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期二, 31 十月 2023 17:09:29 +0800 Subject: [PATCH] 添加手机校验 --- src/views/Home.vue | 49 ++++++++++++++++++++++++++++++++----------------- 1 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/views/Home.vue b/src/views/Home.vue index e9d3509..16dd879 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -2,7 +2,8 @@ <div> <a-layout id="components-layout-demo-custom-trigger" :style="{ height: '100vh' }"> <a-layout-sider v-model="collapsed" :trigger="null" collapsible> - <div class="logo">{{ collapsed ? collapsed : '预警响应系统' }}</div> + <div class="logo" v-if="!collapsed">{{ '预警响应系统' }}</div> + <div class="logo" v-else><a-icon type="alert" /></div> <menuSider /> </a-layout-sider> <a-layout> @@ -31,7 +32,9 @@ margin: '15px 16px 24px 16px', }"> <!-- Content --> - <router-view ref="tabContent"></router-view> + <keep-alive include="notice"> + <router-view ref="tabContent"></router-view> + </keep-alive> <div style="height: 30px;text-align: center;line-height: 30px"> 技术支持:中国科学院 </div> @@ -50,14 +53,14 @@ import menuSider from "@/layout/menuSider"; import TabsHeader from '@/components/TabsHeader'; import pwdMod from "@/views/Admin/components/pwdMod"; - import { loginOut } from "@/api/login"; - import { Session } from '@/util/storage'; - import Cookies from 'js-cookie'; + import { loginOut, getDistrictInfo } from "@/api/login"; + import { Session, getUserInfo} from '@/util/storage'; + import Cookies from "js-cookie"; export default { name: "Home", data() { return { - userInfo: {}, + userInfo: getUserInfo(), collapsed: false, //返回logo图片或表述 pageList: [], activePage: '', @@ -70,7 +73,6 @@ pwdMod }, created() { - this.userInfo = JSON.parse(Cookies.get('userInfo')) const route = this.$route if (this.pageList.findIndex(item => item.path === route.path) === -1) { this.pageList.push(this.createPage(route)) @@ -121,16 +123,17 @@ cancelText: '取消', okText: '确认', centered: true, - async onOk() { - const res = await loginOut() - if (res.data.code === 100) { - Session.clear(); // 清除缓存/token等 - // 使用 reload 时,不需要调用 resetRoute() 重置路由 - t.$router.push('/') - // window.location.reload(); - } else { - this.$message.warning(res.data.msg); - } + onOk() { + loginOut().then(res=>{ + if (res.data.code === 100) { + Session.clear(); // 清除缓存/token等 + // 使用 reload 时,不需要调用 resetRoute() 重置路由 + t.$router.push('/') + // window.location.reload(); + } else { + this.$message.warning(res.data.msg); + } + }) }, onCancel() { console.log('Cancel'); @@ -138,6 +141,18 @@ class: 'test', }); }, + + // async getDistrictInfo(){ + // let res = await getDistrictInfo() + // if(res.data.code == 100){ + // console.log(res.data.data) + // Cookies.set('district', res.data.data); + // console.log(Cookies.get('district'),666) + // } else { + // this.$message.warning(res.data.msg); + // } + // }, + changePage(key) { this.activePage = key const page = this.pageList.find(item => item.path === key) -- Gitblit v1.9.2