From 737578d7bdeca8e4d38dc64093ee2b1efa45ab21 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Wed, 28 Jun 2023 17:12:45 +0800
Subject: [PATCH] 修改接口
---
src/views/Home.vue | 69 +++++++++++++++++++++++++++++++---
1 files changed, 63 insertions(+), 6 deletions(-)
diff --git a/src/views/Home.vue b/src/views/Home.vue
index 44ea8d8..9a57f99 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -11,14 +11,14 @@
@click="() => (collapsed = !collapsed)"/>
<a-dropdown>
<a class="ant-dropdown-link" @click="e => e.preventDefault()">
- 您好,李静 <a-icon type="down"/>
+ 您好,{{userInfo.realName}} <a-icon type="down"/>
</a>
<a-menu slot="overlay">
<a-menu-item>
- <a href="javascript:;">修改密码</a>
+ <a href="javascript:;" @click="editPwd">修改密码</a>
</a-menu-item>
<a-menu-item>
- <a href="javascript:;">回到首页</a>
+ <a href="javascript:;" @click="backHome">回到首页</a>
</a-menu-item>
<a-menu-item>
<a @click="logout">退出登录</a>
@@ -31,12 +31,17 @@
margin: '15px 16px 24px 16px',
}">
<!-- Content -->
- <router-view ref="tabContent"></router-view>
- <div style="height: 30px"></div>
+ <keep-alive include="notice">
+ <router-view ref="tabContent"></router-view>
+ </keep-alive>
+ <div style="height: 30px;text-align: center;line-height: 30px">
+ 技术支持:中国科学院
+ </div>
</a-layout-content>
</a-layout>
</a-layout>
+ <pwd-mod ref="pwdMod"></pwd-mod>
<!-- <center style="textAlign: center;margin-left: 5%;margin-top:50px;">-->
<!-- 技术支持:中国科学院-->
<!-- </center>-->
@@ -46,10 +51,15 @@
<script>
import menuSider from "@/layout/menuSider";
import TabsHeader from '@/components/TabsHeader';
+ import pwdMod from "@/views/Admin/components/pwdMod";
+ import { loginOut, getDistrictInfo } from "@/api/login";
+ import { Session, getUserInfo} from '@/util/storage';
+ import Cookies from "js-cookie";
export default {
name: "Home",
data() {
return {
+ userInfo: getUserInfo(),
collapsed: false, //返回logo图片或表述
pageList: [],
activePage: '',
@@ -59,6 +69,7 @@
components: {
menuSider,
TabsHeader,
+ pwdMod
},
created() {
const route = this.$route
@@ -92,9 +103,55 @@
}
},
methods: {
+ backHome(){
+ this.$router.push('/home')
+ },
+
+ editPwd(){
+ const t = this
+ t.$refs.pwdMod.updateType = 1
+ t.$refs.pwdMod.form.uid = t.userInfo.uid
+ t.$refs.pwdMod.visible = true
+ },
+
logout(){
- this.$router.push('/')
+ const t = this
+ this.$confirm({
+ title: '提示',
+ content: h => <div>该操作将登出,是否继续?</div>,
+ cancelText: '取消',
+ okText: '确认',
+ centered: true,
+ 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');
+ },
+ 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