From 1bbd76284af39316a785fc1b6598a55091a08c90 Mon Sep 17 00:00:00 2001 From: sunzehua Date: Mon, 22 May 2023 18:02:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- .env.development | 4 ++-- .env.preview | 4 ++-- src/permission.js | 22 ++++++++++++---------- src/store/modules/user.js | 31 ++++++++++++++++++++++++++----- src/views/getway/index.vue | 23 ++++++++++++++--------- 6 files changed, 57 insertions(+), 29 deletions(-) diff --git a/.env b/.env index eb69854..3dc03de 100644 --- a/.env +++ b/.env @@ -2,5 +2,5 @@ NODE_ENV=production VUE_APP_PREVIEW=true //VUE_APP_API_BASE_URL=http://192.168.1.205:25800 //VUE_APP_API_BASE_URL=http://127.0.0.1:5000 -VUE_APP_API_BASE_URL=http://60.209.125.238:25805 +VUE_APP_API_BASE_URL=http://60.209.125.238:35220 # VUE_APP_API_BASE_URL=http://47.104.85.216:12345/api \ No newline at end of file diff --git a/.env.development b/.env.development index 0fc3239..1848b7d 100644 --- a/.env.development +++ b/.env.development @@ -1,7 +1,7 @@ NODE_ENV=development VUE_APP_PREVIEW=true -VUE_APP_API_BASE_URL=http://60.209.125.238:25805 -VUE_APP_SOCKET_BASE_URL=http://60.209.125.238:25805 +VUE_APP_API_BASE_URL=http://60.209.125.238:35220 +VUE_APP_SOCKET_BASE_URL=http://60.209.125.238:35220 # process.env.VUE_APP_API_BASE_URL diff --git a/.env.preview b/.env.preview index 029fbe5..d4f378b 100644 --- a/.env.preview +++ b/.env.preview @@ -1,7 +1,7 @@ NODE_ENV=production VUE_APP_PREVIEW=true -VUE_APP_API_BASE_URL=http://60.209.125.238:25805 -VUE_APP_SOCKET_BASE_URL=http://60.209.125.238:25805 +VUE_APP_API_BASE_URL=http://60.209.125.238:35220 +VUE_APP_SOCKET_BASE_URL=http://60.209.125.238:35220 # VUE_APP_API_BASE_URL=http://47.104.85.216:12345/api # VUE_APP_SOCKET_BASE_URL=http://47.104.85.216:12345/api \ No newline at end of file diff --git a/src/permission.js b/src/permission.js index f0f74a9..9696346 100644 --- a/src/permission.js +++ b/src/permission.js @@ -32,16 +32,18 @@ router.beforeEach((to, from, next) => { // console.log(JSON.stringify(res)) // console.log('=== 测试跳转页面,获取个人信息 -- end ===') if (res.menus.length < 1) { - Modal.error({ - title: '提示:', - content: '无菜单权限,请联系管理员', - okText: '确定', - onOk: () => { - store.dispatch('Logout').then(() => { - window.location.reload() - }) - } - }) + next({ path: '/welcome' }) + // Modal.error({ + // title: '提示:', + // content: '无菜单权限,请联系管理员', + // okText: '确定', + // onOk: () => { + // next({ path: '/welcome' }) + // // store.dispatch('Logout').then(() => { + // // window.location.reload() + // // }) + // } + // }) return } // eslint-disable-next-line camelcase diff --git a/src/store/modules/user.js b/src/store/modules/user.js index e25eb79..7d88c81 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,5 +1,5 @@ import Vue from 'vue' -import { login, getLoginUser, logout } from '@/api/modular/system/loginManage' +import { login, getLoginUser, logout, loginWithCode } from '@/api/modular/system/loginManage' import { sysDictTypeTree } from '@/api/modular/system/dictManage' import { sysMenuChange } from '@/api/modular/system/menuManage' import { ACCESS_TOKEN, ALL_APPS_MENU, DICT_TYPE_TREE_DATA, NOTICE_RECEIVED } from '@/store/mutation-types' @@ -54,11 +54,11 @@ const user = { }, APPEND_NOTICE: (state, notice) => { notice.publicTime = dateFormat(notice.publicTime, 'YYYY-mm-dd HH:MM:SS') - let notices = state.notices - let temp = notices.rows.filter(m => { + const notices = state.notices + const temp = notices.rows.filter(m => { return m.value == notice.type })[0] - let other = notices.rows.filter(m => { + const other = notices.rows.filter(m => { return m.value != notice.type }) temp.noticeData.unshift(notice) @@ -105,7 +105,28 @@ const user = { // eslint-disable-next-line handle-callback-err }) .catch(error => { - // eslint-disable-next-line prefer-promise-reject-errors + console.log(error) + reject('后端未启动或代理错误') + }) + }) + }, + // 跨平台登录 + LoginWithCode({ commit }, userInfo) { + return new Promise((resolve, reject) => { + loginWithCode(userInfo) + .then(response => { + if (!response.success) { + reject(response.message) + return + } + const result = response.data + console.log(response, 1111) + Vue.ls.set(ACCESS_TOKEN, result, 7 * 24 * 60 * 60 * 1000) + commit('SET_TOKEN', result) + resolve() + }) + .catch(error => { + console.log(error) reject('后端未启动或代理错误') }) }) diff --git a/src/views/getway/index.vue b/src/views/getway/index.vue index a0036e1..8796c53 100644 --- a/src/views/getway/index.vue +++ b/src/views/getway/index.vue @@ -4,8 +4,6 @@