mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 05:40:20 +08:00
♻️ Refactoring code. 重构前端部分接口支持新的验证码接口
This commit is contained in:
parent
3d680f474a
commit
231361be88
@ -2,7 +2,7 @@ import request from '/@/utils/request';
|
|||||||
|
|
||||||
export function fetchList(query: object) {
|
export function fetchList(query: object) {
|
||||||
return request({
|
return request({
|
||||||
url: '/admin/token/page',
|
url: '/admin/sys-token/page',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: query,
|
data: query,
|
||||||
});
|
});
|
||||||
@ -10,7 +10,7 @@ export function fetchList(query: object) {
|
|||||||
|
|
||||||
export function delObj(accessTokens: string[]) {
|
export function delObj(accessTokens: string[]) {
|
||||||
return request({
|
return request({
|
||||||
url: '/admin/token/delete',
|
url: '/admin/sys-token/delete',
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
data: accessTokens,
|
data: accessTokens,
|
||||||
});
|
});
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
import { nextTick, defineAsyncComponent } from 'vue';
|
import {nextTick, defineAsyncComponent} from 'vue';
|
||||||
import type { App } from 'vue';
|
import type {App} from 'vue';
|
||||||
import * as svg from '@element-plus/icons-vue';
|
import * as svg from '@element-plus/icons-vue';
|
||||||
import router from '/@/router/index';
|
import router from '/@/router/index';
|
||||||
import pinia from '/@/stores/index';
|
import pinia from '/@/stores/index';
|
||||||
import { storeToRefs } from 'pinia';
|
import {storeToRefs} from 'pinia';
|
||||||
import { useThemeConfig } from '/@/stores/themeConfig';
|
import {useThemeConfig} from '/@/stores/themeConfig';
|
||||||
import { i18n } from '/@/i18n/index';
|
import {i18n} from '/@/i18n/index';
|
||||||
import { Local } from '/@/utils/storage';
|
import {Local} from '/@/utils/storage';
|
||||||
import { verifyUrl } from '/@/utils/toolsValidate';
|
import {verifyUrl} from '/@/utils/toolsValidate';
|
||||||
import request from '/@/utils/request';
|
import request from '/@/utils/request';
|
||||||
import { useMessage } from '/@/hooks/message';
|
import {useMessage} from '/@/hooks/message';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import * as CryptoJS from 'crypto-js';
|
import * as CryptoJS from 'crypto-js';
|
||||||
import {sm4} from 'sm-crypto'
|
import {sm4} from 'sm-crypto'
|
||||||
import { validateNull } from './validate';
|
import {validateNull} from './validate';
|
||||||
import { RouteItem, RouteItems, RouteToFrom } from '/@/types/global';
|
import {RouteItem, RouteItems, RouteToFrom} from '/@/types/global';
|
||||||
|
|
||||||
// 引入组件
|
// 引入组件
|
||||||
const SvgIcon = defineAsyncComponent(() => import('/@/components/SvgIcon/index.vue'));
|
const SvgIcon = defineAsyncComponent(() => import('/@/components/SvgIcon/index.vue'));
|
||||||
@ -38,7 +38,7 @@ export function elSvg(app: App) {
|
|||||||
*/
|
*/
|
||||||
export function useTitle() {
|
export function useTitle() {
|
||||||
const stores = useThemeConfig(pinia);
|
const stores = useThemeConfig(pinia);
|
||||||
const { themeConfig } = storeToRefs(stores);
|
const {themeConfig} = storeToRefs(stores);
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
let globalTitle: string = themeConfig.value.globalTitle;
|
let globalTitle: string = themeConfig.value.globalTitle;
|
||||||
let webTitle = setMenuI18n(router.currentRoute.value);
|
let webTitle = setMenuI18n(router.currentRoute.value);
|
||||||
@ -72,7 +72,7 @@ export const lazyImg = (el: string, arr: EmptyArrayType) => {
|
|||||||
const io = new IntersectionObserver((res) => {
|
const io = new IntersectionObserver((res) => {
|
||||||
res.forEach((v: any) => {
|
res.forEach((v: any) => {
|
||||||
if (v.isIntersecting) {
|
if (v.isIntersecting) {
|
||||||
const { img, key } = v.target.dataset;
|
const {img, key} = v.target.dataset;
|
||||||
v.target.src = img;
|
v.target.src = img;
|
||||||
v.target.onload = () => {
|
v.target.onload = () => {
|
||||||
io.unobserve(v.target);
|
io.unobserve(v.target);
|
||||||
@ -92,7 +92,7 @@ export const lazyImg = (el: string, arr: EmptyArrayType) => {
|
|||||||
*/
|
*/
|
||||||
export const globalComponentSize = (): string => {
|
export const globalComponentSize = (): string => {
|
||||||
const stores = useThemeConfig(pinia);
|
const stores = useThemeConfig(pinia);
|
||||||
const { themeConfig } = storeToRefs(stores);
|
const {themeConfig} = storeToRefs(stores);
|
||||||
return Local.get('themeConfig')?.globalComponentSize || themeConfig.value?.globalComponentSize;
|
return Local.get('themeConfig')?.globalComponentSize || themeConfig.value?.globalComponentSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -502,15 +502,6 @@ const adaptationUrl = (originUrl?: string) => {
|
|||||||
return originUrl;
|
return originUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证码服务
|
|
||||||
if (originUrl?.startsWith('/code/')) {
|
|
||||||
return `/admin${originUrl}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是代码生成服务,不做路径转换
|
|
||||||
if (originUrl?.startsWith('/gen')) {
|
|
||||||
return originUrl;
|
|
||||||
}
|
|
||||||
// 转为 /admin 路由前缀的请求
|
// 转为 /admin 路由前缀的请求
|
||||||
return `/admin/${originUrl?.split('/').splice(2).join('/')}`;
|
return `/admin/${originUrl?.split('/').splice(2).join('/')}`;
|
||||||
};
|
};
|
||||||
|
@ -95,7 +95,7 @@ const imgSrc = ref('')
|
|||||||
//获取验证码图片
|
//获取验证码图片
|
||||||
const getVerifyCode = () => {
|
const getVerifyCode = () => {
|
||||||
state.ruleForm.randomStr = generateUUID()
|
state.ruleForm.randomStr = generateUUID()
|
||||||
imgSrc.value = `${import.meta.env.VITE_API_URL}${import.meta.env.VITE_IS_MICRO == 'false' ? '/admin' : ''}/code/image?randomStr=${state.ruleForm.randomStr}`
|
imgSrc.value = `${import.meta.env.VITE_API_URL}${import.meta.env.VITE_IS_MICRO == 'false' ? '/admin' : '/auth'}/code/image?randomStr=${state.ruleForm.randomStr}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 账号密码登录
|
// 账号密码登录
|
||||||
|
Loading…
Reference in New Issue
Block a user