存入用户的account

master
吕天方 8 months ago
parent 141f0f504e
commit fcc9e2eb19

@ -4,7 +4,7 @@
* @Author: JC9527 * @Author: JC9527
* @Date: 2024-01-09 23:11:58 * @Date: 2024-01-09 23:11:58
* @LastEditors: JC9527 * @LastEditors: JC9527
* @LastEditTime: 2024-03-06 18:56:29 * @LastEditTime: 2024-09-03 20:12:27
*/ */
import request from "@/utils/request2" import request from "@/utils/request2"
@ -19,10 +19,11 @@ export function getTrend(params) {
// 事件概况统计 // 事件概况统计
export function summarystat() { export function summarystat(params) {
return request({ return request({
url: "/event/summary/stat", url: "/event/summary/stat",
method:'get', method:'get',
params
}) })
} }

@ -4,7 +4,7 @@
* @Author: JC9527 * @Author: JC9527
* @Date: 2024-01-09 23:08:15 * @Date: 2024-01-09 23:08:15
* @LastEditors: JC9527 * @LastEditors: JC9527
* @LastEditTime: 2024-05-16 11:20:06 * @LastEditTime: 2024-09-03 20:23:09
*/ */
import router from './router' import router from './router'
import store from './store' import store from './store'
@ -22,11 +22,10 @@ const whiteList = ['/login', '/register', '/bigScreen']
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start() NProgress.start()
// console.log('tototo',to.path); // console.log('tototo',to.path);
if(localStorage.getItem('accessToken')) { if(localStorage.getItem('accessToken') && localStorage.getItem('account')) {
next() next()
NProgress.done() NProgress.done()
} else { } else if (window.location.href.includes("code=")) {
if (window.location.href.includes("code=")) {
var reg = new RegExp(/[?&]code=([^&#]+)/); var reg = new RegExp(/[?&]code=([^&#]+)/);
var c = window.location.href.match(reg); var c = window.location.href.match(reg);
const code = c && c[1]; const code = c && c[1];
@ -34,62 +33,42 @@ router.beforeEach((to, from, next) => {
// console.log(res,"res") // console.log(res,"res")
// setAccessToken(res.data.accessToken) // setAccessToken(res.data.accessToken)
localStorage.setItem('accessToken',res.data.accessToken) localStorage.setItem('accessToken',res.data.accessToken)
return getUserinfo({ accessToken: res.data.accessToken })
}).then(el=>{
// setToken(el.data.token)
localStorage.setItem('account',el.data.account)
let url = window.location.href; let url = window.location.href;
var modifiedUrl = url.replace(/[\?&](code)=.*?(#\/|$)/g, ''); var modifiedUrl = url.replace(/[\?&](code)=.*?(#\/|$)/g, '');
// console.log(modifiedUrl,'modifiedUrl'); // console.log(modifiedUrl,'modifiedUrl');
window.location.href = modifiedUrl; window.location.href = modifiedUrl;
// next() // next()
NProgress.done() NProgress.done()
// return getUserinfo({accessToken:res.data.accessToken})
}) })
// .then(res=>{ // .then(res=>{
// localStorage.setItem('AuserInfo', JSON.stringify(el.data)) // localStorage.setItem('AuserInfo', JSON.stringify(el.data))
// }) // })
} else {
location.href = "http://10.236.2.28:54567/bjh-admin/"
}
} }
// next() // else if(getToken()) {
// if (getToken()) {
// to.meta.title && store.dispatch('settings/setTitle', to.meta.title) // to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
// /* has token*/ // /* has token*/
// if (to.path === '/login') {
// next({ path: '/' })
// NProgress.done()
// } else {
// console.log('store.getters.roles',store.getters.roles)
// if (store.getters.roles.length === 0) { // if (store.getters.roles.length === 0) {
// isRelogin.show = true // // isRelogin.show = true
// // 判断当前用户是否已拉取完user_info信息 // // 判断当前用户是否已拉取完user_info信息
// store.dispatch('GetInfo').then(() => { // store.dispatch('GetInfo').then(() => {
// isRelogin.show = false // isRelogin.show = false
// store.dispatch('GenerateRoutes').then(accessRoutes => { // next()
// // 根据roles权限生成可访问的路由表 // NProgress.done()
// router.addRoutes(accessRoutes) // 动态添加可访问路由表
// next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
// })
// }).catch(err => { // }).catch(err => {
// store.dispatch('LogOut').then(() => {
// Message.error(err)
// next({ path: '/' })
// }) // })
// })
// } else {
// next()
// }
// }
// } else { // } else {
// // 没有token
// if (whiteList.indexOf(to.path) !== -1) {
// // 在免登录白名单,直接进入
// next() // next()
// } else {
// next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
// NProgress.done() // NProgress.done()
// } // }
// } // }
else {
location.href = "http://10.236.2.28:54567/bjh-admin/"
}
}) })
router.afterEach(() => { router.afterEach(() => {

@ -4,7 +4,7 @@
* @Author: JC9527 * @Author: JC9527
* @Date: 2023-08-15 09:44:13 * @Date: 2023-08-15 09:44:13
* @LastEditors: JC9527 * @LastEditors: JC9527
* @LastEditTime: 2024-09-02 18:56:45 * @LastEditTime: 2024-09-03 20:10:39
--> -->
<template> <template>
<div class="left-wai-box"> <div class="left-wai-box">
@ -208,6 +208,7 @@ export default {
mapLoading:false, mapLoading:false,
personLoading:false, personLoading:false,
isBreadcrumb:true, isBreadcrumb:true,
account:"",
} }
}, },
props: ['personLine', 'carLine'], props: ['personLine', 'carLine'],
@ -300,11 +301,11 @@ export default {
MYsummarystat() { MYsummarystat() {
// //
summarystat().then(res => { summarystat({account:this.account}).then(res => {
if (res.code == 200) this.MYsummarystatdata = res.data if (res.code == 200) this.MYsummarystatdata = res.data
}) })
// //
tasksummarystat().then(res => { tasksummarystat({account:this.account}).then(res => {
if (res.code == 200) this.tasksummarystatdata = res.data if (res.code == 200) this.tasksummarystatdata = res.data
}) })
}, },
@ -439,11 +440,9 @@ export default {
this.getDomHeight(); this.getDomHeight();
this.getEvent(); this.getEvent();
this.getOnline(); this.getOnline();
}, this.account = localStorage.getItem('account')
created() {
this.MYsummarystat() this.MYsummarystat()
},
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

Loading…
Cancel
Save