From 022c394b3b720936a266dffd20343b82abba6ec9 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Wed, 25 Dec 2024 08:52:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E7=99=BB=E5=BD=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 11 +++++++++++ env/.env.dev | 4 ++-- src/App.vue | 17 ++++++++++++++++- src/hooks/login.ts | 16 ++++++++++++++++ src/http/api/home/index.ts | 5 +++++ src/http/api/login/index.ts | 1 + src/http/index.ts | 8 +++++--- src/layout/header.vue | 2 +- src/router/index.ts | 11 ++++++++++- src/views/Login.vue | 4 +++- src/views/home/index.vue | 4 +++- 11 files changed, 73 insertions(+), 10 deletions(-) create mode 100644 src/hooks/login.ts diff --git a/components.d.ts b/components.d.ts index d2cf9ba..b0bbef1 100644 --- a/components.d.ts +++ b/components.d.ts @@ -9,15 +9,19 @@ declare module 'vue' { export interface GlobalComponents { Breadcrumb: typeof import('./src/components/Breadcrumb/index.vue')['default'] EditorModel: typeof import('./src/components/EditorModel/index.vue')['default'] + ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElBadge: typeof import('element-plus/es')['ElBadge'] ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] ElButton: typeof import('element-plus/es')['ElButton'] + ElCard: typeof import('element-plus/es')['ElCard'] ElCarousel: typeof import('element-plus/es')['ElCarousel'] ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem'] ElCascader: typeof import('element-plus/es')['ElCascader'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCol: typeof import('element-plus/es')['ElCol'] + ElCollapse: typeof import('element-plus/es')['ElCollapse'] + ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElCountdown: typeof import('element-plus/es')['ElCountdown'] ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] @@ -25,18 +29,25 @@ declare module 'vue' { ElEmpty: typeof import('element-plus/es')['ElEmpty'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] + ElHeader: typeof import('element-plus/es')['ElHeader'] ElIcon: typeof import('element-plus/es')['ElIcon'] ElImage: typeof import('element-plus/es')['ElImage'] ElInput: typeof import('element-plus/es')['ElInput'] + ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] ElMenu: typeof import('element-plus/es')['ElMenu'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElOption: typeof import('element-plus/es')['ElOption'] + ElPageHeader: typeof import('element-plus/es')['ElPageHeader'] ElPagination: typeof import('element-plus/es')['ElPagination'] + ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm'] ElProgress: typeof import('element-plus/es')['ElProgress'] + ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] + ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElStep: typeof import('element-plus/es')['ElStep'] ElSteps: typeof import('element-plus/es')['ElSteps'] + ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTag: typeof import('element-plus/es')['ElTag'] diff --git a/env/.env.dev b/env/.env.dev index fbd6442..4354c44 100644 --- a/env/.env.dev +++ b/env/.env.dev @@ -9,8 +9,8 @@ VITE_API_URL = '/proxyApi' # VITE_proxyTarget = 'http://192.168.2.246:28080' # 马帅 # VITE_proxyTarget = 'http://192.168.2.127:28080' # 梁超 -# VITE_proxyTarget = 'http://36.33.26.201:17788/proxyApi' # 测试服务 -VITE_proxyTarget = 'http://192.168.0.244:28580' # 测试服务 +VITE_proxyTarget = 'http://36.33.26.201:17788/proxyApi' # 测试服务 +# VITE_proxyTarget = 'http://192.168.0.244:28580' # 测试服务 # VITE_proxyTarget = 'http://192.168.2.75:28080' # 盛旭 # VITE_proxyTarget = 'http://10.40.92.185:9206' # 赵福海 ( 设备类型) diff --git a/src/App.vue b/src/App.vue index 3b0b65d..dc7329e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,4 +1,19 @@ - + + diff --git a/src/hooks/login.ts b/src/hooks/login.ts new file mode 100644 index 0000000..119b711 --- /dev/null +++ b/src/hooks/login.ts @@ -0,0 +1,16 @@ + + +import { loginByIwsApi } from 'http/api/login/index' + + + +export default function () { + const getLoginIwsInfo = async (data: any) => { + const res: any = await loginByIwsApi(data) + console.log(res) + } + return { + getLoginIwsInfo, + } +} + diff --git a/src/http/api/home/index.ts b/src/http/api/home/index.ts index a503c51..bed4be1 100644 --- a/src/http/api/home/index.ts +++ b/src/http/api/home/index.ts @@ -29,3 +29,8 @@ export const setAcceptByIdApi = (data: any = {}) => { export const apiGetCollect = (params = {}) => { return post('/zlpt-equip/dev/userCollectList', params) } + +// I 皖送登录 +export const loginNewApi = (data: any) => { + return post('/auth/iwsLogin', data) +} diff --git a/src/http/api/login/index.ts b/src/http/api/login/index.ts index 264e853..d216101 100644 --- a/src/http/api/login/index.ts +++ b/src/http/api/login/index.ts @@ -4,6 +4,7 @@ import { get, post } from '../../index' export const loginApi = (data: any) => { return post('/auth/login', data) } + // 获取用户信息 export const getUserInfoAPI = () => { return get('/system/user/getInfo', {}) diff --git a/src/http/index.ts b/src/http/index.ts index bb01ebb..05004be 100644 --- a/src/http/index.ts +++ b/src/http/index.ts @@ -2,11 +2,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import axios from 'axios' import NProgress from 'nprogress' -import { mainStore } from 'store/main' +// import { mainStore } from 'store/main' import { ElMessage } from "element-plus"; import { saveAs } from 'file-saver' import router from "@/router" -const store = mainStore() +// const store = mainStore() + // const CancelToken = axios.CancelToken // const source = CancelToken.source() const baseUrl = import.meta.env.VITE_API_URL @@ -20,9 +21,10 @@ const service = axios.create({ timeout: 60000 }) + service.interceptors.request.use( (config) => { - config.headers['Authorization'] = store.token + config.headers['Authorization'] = localStorage.getItem('tokenNew') return config }, (error) => { diff --git a/src/layout/header.vue b/src/layout/header.vue index 6e49a46..bf00403 100644 --- a/src/layout/header.vue +++ b/src/layout/header.vue @@ -691,7 +691,7 @@ const onJumpUser = () => { right: 0; width: 100px; height: 43px; - transform: translate(-10px, 5px); + transform: translate(-5px, 5px); border-radius: 43px; background: linear-gradient(132deg, #22ab9b 0%, #0d7462 100%); box-shadow: 0px 2px 4px 0px rgba(20, 175, 255, 0.5); diff --git a/src/router/index.ts b/src/router/index.ts index 5bce551..c8c62a2 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,9 +1,12 @@ import { createRouter, RouteRecordRaw, createWebHistory } from 'vue-router' import test from './module/test' import myInfo from './module/myInfo' +// import login from '../hooks/login' +// const { getLoginIwsInfo } = login() + import { mainStore } from 'store/main' -import { el } from 'element-plus/es/locale' +// import { el } from 'element-plus/es/locale' @@ -757,6 +760,12 @@ const router = createRouter({ const white = ['/qr-code'] // 使页面跳转后滚动条恢复至顶部 router.beforeEach((to, from, next) => { + + // const origin = window.location.href + // if (origin.indexOf('ticket') != -1) { + // console.log(origin.split('ticket=')[1], 'origin.split爱玩送ticket') + // // getLoginIwsInfo({ ticket: 996 }) + // } const store = mainStore() if (to.meta.isLogin && !to.meta.AuthFlag) { if (store.token) { diff --git a/src/views/Login.vue b/src/views/Login.vue index 1e906f4..d3c6ba7 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -31,6 +31,8 @@ const handlerLogin = async () => { console.log('登录成功**', res) if (res.code === 200) { userStore.setToken(res.data.access_token) + + localStorage.setItem('tokenNew', res.data.access_token) const result: any = await getUserInfoAPI() ElMessage({ showClose: true, @@ -153,7 +155,7 @@ const handlerLogin = async () => { background-size: cover; .login-form { - width: 500px; + width: 580px; // height: 360px; display: flex; flex-direction: column; diff --git a/src/views/home/index.vue b/src/views/home/index.vue index e17715a..77e8adc 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -410,12 +410,13 @@ const onSelectItem = (type: number) => { .left-filter { margin-top: 10px; - padding: 8px 0; + padding: 16px 0; position: relative; display: flex; align-content: center; justify-content: center; color: #38b2a4; + font-size: 22px; // height: 46px; // line-height: 46px; // text-align: center; @@ -466,6 +467,7 @@ const onSelectItem = (type: number) => { height: 32px; line-height: 32px; text-align: center; + padding: 2px 20px; // font-size: 16px !important; &:hover {