From a14150f9d21e5531a83463a5563cf6ebb1358058 Mon Sep 17 00:00:00 2001
From: xy <271556543@qq.com>
Date: Wed, 13 Dec 2023 15:31:57 +0800
Subject: [PATCH] 2023-12-13
---
src/api/user.js | 9 +-
src/layout/index.vue | 2 +-
src/permission.js | 9 +-
src/store/index.js | 9 +-
src/views/budget/seeBudget.vue | 92 +++++++++----------
.../contract/components/detailContract.vue | 2 +-
.../contract/components/editorContract.vue | 13 ++-
src/views/contract/contractList.vue | 12 +--
8 files changed, 79 insertions(+), 69 deletions(-)
diff --git a/src/api/user.js b/src/api/user.js
index f9dcc72..e3cea54 100644
--- a/src/api/user.js
+++ b/src/api/user.js
@@ -17,7 +17,14 @@ export function loginOss(data) {
})
}
-
+export function loginOssV2 (data) {
+ return request({
+ url: "/api/admin/auth/oss-login-v2",
+ method: "post",
+ data,
+ noloading:true
+ })
+}
export function getInfo(token) {
return request({
diff --git a/src/layout/index.vue b/src/layout/index.vue
index 3e0acf0..99c150b 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -158,7 +158,7 @@ export default {
async logout() {
await this.$store.dispatch('app/clearLayout')
await this.$store.dispatch("user/logout");
- this.$router.push(`/login?redirect=${this.$route.fullPath}`);
+ this.$router.push(`/login`);
},
handleClickOutside() {
this.$store.dispatch("app/closeSideBar", {
diff --git a/src/permission.js b/src/permission.js
index 593029a..16471a7 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -9,6 +9,7 @@ import {
getToken
} from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title'
+import { loginOssV2 } from "@/api/user"
NProgress.configure({
showSpinner: false
@@ -23,13 +24,19 @@ router.beforeEach(async (to, from, next) => {
// set page title
document.title = getPageTitle(to.meta.title)
+ if (to.query.code) {
+ console.log(to)
+ const { token } = await loginOssV2({
+ code: to.query.code
+ })
+ store.commit('user/SET_TOKEN',token)
+ }
// determine whether the user has logged in
const hasToken = getToken()
if (hasToken) {
if (to.path === '/login') {
// if is logged in, redirect to the home page
- console.log(to.fullPath)
await store.dispatch('user/resetToken')
next(to.fullPath)
diff --git a/src/store/index.js b/src/store/index.js
index e30b4db..840edbe 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -16,14 +16,7 @@ const store = new Vuex.Store({
settings,
user
},
- getters,
- plugins:[
- createPersistedState({
- storage:window.localStorage,
- key:'worker-layout',
- paths:['app.workerLayout']
- })
- ]
+ getters
})
export default store
diff --git a/src/views/budget/seeBudget.vue b/src/views/budget/seeBudget.vue
index b836d24..89e08fc 100644
--- a/src/views/budget/seeBudget.vue
+++ b/src/views/budget/seeBudget.vue
@@ -48,17 +48,17 @@