update 重构 彻底删除proxy用法 改为vue3官方推荐写法

This commit is contained in:
疯狂的狮子Li
2026-04-10 13:07:37 +08:00
parent eb62402423
commit 9acf52e8a7
144 changed files with 1264 additions and 1082 deletions
+12
View File
@@ -15,5 +15,17 @@
"htmlWhitespaceSensitivity": "ignore",
"experimentalSortPackageJson": {
"sortScripts": true
},
"sortImports": {
"newlinesBetween": false,
"groups": [
"type-import",
["value-builtin", "value-external"],
"type-internal",
"value-internal",
["type-parent", "type-sibling", "type-index"],
["value-parent", "value-sibling", "value-index"],
"unknown"
]
}
}
+8 -1
View File
@@ -8,7 +8,14 @@
"typescript/no-this-alias": "off",
"typescript/no-empty-object-type": "off",
"typescript/no-unused-expressions": "off",
"prefer-rest-params": "off"
"prefer-rest-params": "off",
"import/no-unassigned-import": "off",
"import/no-named-as-default-member": "off",
"import/no-named-as-default": "off",
"no-shadow": "off",
"unicorn/prefer-add-event-listener": "off",
"unicorn/consistent-function-scoping": "off",
"unicorn/no-instanceof-builtins": "off"
},
"categories": {
"correctness": "error",
+1 -1
View File
@@ -5,9 +5,9 @@
</template>
<script setup lang="ts">
import { useAppStore } from '@/store/modules/app';
import { useSettingsStore } from '@/store/modules/settings';
import { handleThemeStyle } from '@/utils/theme';
import { useAppStore } from '@/store/modules/app';
const appStore = useAppStore();
+3 -3
View File
@@ -1,7 +1,7 @@
import type { DemoForm, DemoQuery, DemoVO } from '@/api/demo/demo/types';
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DemoVO, DemoForm, DemoQuery } from '@/api/demo/demo/types';
import { PageResult } from '@/api/types';
/**
* 查询测试单列表
+2 -2
View File
@@ -1,6 +1,6 @@
import type { TreeForm, TreeQuery, TreeVO } from '@/api/demo/tree/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TreeVO, TreeForm, TreeQuery } from '@/api/demo/tree/types';
/**
* 查询测试树列表
+4 -4
View File
@@ -1,8 +1,8 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LoginData, LoginResult, VerifyCodeResult } from './types';
import { UserInfo } from '@/api/system/user/types';
import type { UserInfo } from '@/api/system/user/types';
import type { AxiosPromise } from '@/utils/api-types';
import { closePush } from '@/utils/push';
import request from '@/utils/request';
import type { LoginData, LoginResult, VerifyCodeResult } from './types';
// pc端固定客户端授权id
const clientId = import.meta.env.VITE_APP_CLIENT_ID;
+2 -2
View File
@@ -1,6 +1,6 @@
import type { RouteRecordRaw } from 'vue-router';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RouteRecordRaw } from 'vue-router';
// 获取路由
export function getRouters(): AxiosPromise<RouteRecordRaw[]> {
+2 -2
View File
@@ -1,6 +1,6 @@
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CacheVO } from './types';
import type { CacheVO } from './types';
// 查询缓存详细
export function getCache(): AxiosPromise<CacheVO> {
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { LoginInfoQuery, LoginInfoVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
import type { LoginInfoQuery, LoginInfoVO } from './types';
// 查询登录日志列表
export function list(query: LoginInfoQuery): AxiosPromise<PageResult<LoginInfoVO>> {
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { OnlineQuery, OnlineVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
import type { OnlineQuery, OnlineVO } from './types';
// 查询在线用户列表
export function list(query: OnlineQuery): AxiosPromise<PageResult<OnlineVO>> {
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { OperLogQuery, OperLogVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
import type { OperLogQuery, OperLogVO } from './types';
// 查询操作日志列表
export function list(query: OperLogQuery): AxiosPromise<PageResult<OperLogVO>> {
+3 -3
View File
@@ -1,7 +1,7 @@
import type { ClientForm, ClientQuery, ClientVO } from '@/api/system/client/types';
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ClientVO, ClientForm, ClientQuery } from '@/api/system/client/types';
import { PageResult } from '@/api/types';
/**
* 查询客户端管理列表
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { ConfigForm, ConfigQuery, ConfigVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
import type { ConfigForm, ConfigQuery, ConfigVO } from './types';
// 查询参数列表
export function listConfig(query: ConfigQuery): AxiosPromise<PageResult<ConfigVO>> {
+2 -2
View File
@@ -1,6 +1,6 @@
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeptForm, DeptQuery, DeptTreeVO, DeptVO } from './types';
import { type DeptForm, type DeptQuery, type DeptVO } from './types';
// 查询部门列表
export const listDept = (query?: DeptQuery) => {
+4 -3
View File
@@ -1,6 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DictDataForm, DictDataQuery, DictDataVO } from './types';
import type { DictDataForm, DictDataQuery, DictDataVO } from './types';
// 根据字典类型查询字典数据信息
export function getDicts(dictType: string): AxiosPromise<DictDataVO[]> {
return request({
@@ -10,7 +11,7 @@ export function getDicts(dictType: string): AxiosPromise<DictDataVO[]> {
}
// 查询字典数据列表
export function listData(query: DictDataQuery): AxiosPromise<DictDataVO[]> {
export function listData(query: DictDataQuery): AxiosPromise<PageResult<DictDataVO>> {
return request({
url: '/system/dict/data/list',
method: 'get',
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { DictTypeForm, DictTypeVO, DictTypeQuery } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
import type { DictTypeForm, DictTypeQuery, DictTypeVO } from './types';
// 查询字典类型列表
export function listType(query: DictTypeQuery): AxiosPromise<PageResult<DictTypeVO>> {
+2 -2
View File
@@ -1,6 +1,6 @@
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MenuQuery, MenuVO, MenuForm, MenuTreeOption, RoleMenuTree } from './types';
import type { MenuForm, MenuQuery, MenuTreeOption, MenuVO, RoleMenuTree } from './types';
// 查询菜单列表
export const listMenu = (query?: MenuQuery): AxiosPromise<MenuVO[]> => {
+1 -1
View File
@@ -1,4 +1,4 @@
import { MenuTypeEnum } from '@/enums/MenuTypeEnum';
import type { MenuTypeEnum } from '@/enums/MenuTypeEnum';
/**
*
+2 -2
View File
@@ -1,6 +1,6 @@
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MessageBoxVO } from './types';
import type { MessageBoxVO } from './types';
export function getMessageBox(): AxiosPromise<MessageBoxVO> {
return request({
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { NoticeForm, NoticeQuery, NoticeVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
import type { NoticeForm, NoticeQuery, NoticeVO } from './types';
// 查询公告列表
export function listNotice(query: NoticeQuery): AxiosPromise<PageResult<NoticeVO>> {
return request({
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { OssQuery, OssVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
import type { OssQuery, OssVO } from './types';
// 查询OSS对象存储列表
export function listOss(query: OssQuery): AxiosPromise<PageResult<OssVO>> {
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { OssConfigForm, OssConfigQuery, OssConfigVO } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
import type { OssConfigForm, OssConfigQuery, OssConfigVO } from './types';
// 查询对象存储配置列表
export function listOssConfig(query: OssConfigQuery): AxiosPromise<PageResult<OssConfigVO>> {
+4 -4
View File
@@ -1,8 +1,8 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { PostForm, PostQuery, PostVO } from './types';
import { AxiosPromise } from 'axios';
import { DeptTreeVO } from '../dept/types';
import { PageResult } from '@/api/types';
import type { DeptTreeVO } from '../dept/types';
import type { PostForm, PostQuery, PostVO } from './types';
// 查询岗位列表
export function listPost(query: PostQuery): AxiosPromise<PageResult<PostVO>> {
+4 -5
View File
@@ -1,9 +1,8 @@
import { UserVO } from '@/api/system/user/types';
import { UserQuery } from '@/api/system/user/types';
import { AxiosPromise } from 'axios';
import { RoleQuery, RoleVO, RoleDeptTree } from './types';
import type { UserQuery, UserVO } from '@/api/system/user/types';
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { PageResult } from '@/api/types';
import type { RoleDeptTree, RoleQuery, RoleVO } from './types';
export const listRole = (query: RoleQuery): AxiosPromise<PageResult<RoleVO>> => {
return request({
+5 -5
View File
@@ -1,10 +1,10 @@
import { DeptTreeVO } from './../dept/types';
import { RoleVO } from '@/api/system/role/types';
import type { RoleVO } from '@/api/system/role/types';
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserForm, UserQuery, UserVO, UserInfoVO } from './types';
import { parseStrEmpty } from '@/utils/ruoyi';
import { PageResult } from '@/api/types';
import type { DeptTreeVO } from './../dept/types';
import type { UserForm, UserInfoVO, UserQuery, UserVO } from './types';
/**
*
+4 -2
View File
@@ -1,5 +1,5 @@
import { RoleVO } from '@/api/system/role/types';
import { PostVO } from '@/api/system/post/types';
import type { PostVO } from '@/api/system/post/types';
import type { RoleVO } from '@/api/system/role/types';
/**
*
@@ -43,6 +43,8 @@ export interface UserVO extends BaseEntity {
loginDate: string;
remark: string;
deptName: string;
/** 详情接口可能返回嵌套部门 */
dept?: { deptName?: string };
roles: RoleVO[];
roleIds: any;
postIds: any;
+8 -6
View File
@@ -1,7 +1,9 @@
import type { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { DbTableQuery, DbTableVO, TableQuery, TableVO, GenTableVO, DbTableForm } from './types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
import type { DbTableForm, DbTableQuery, DbTableVO, GenTableDetailPayload, TableQuery, TableVO } from './types';
export type { GenTableDetailPayload } from './types';
// 查询生成表数据
export const listTable = (query: TableQuery): AxiosPromise<PageResult<TableVO>> => {
@@ -21,7 +23,7 @@ export const listDbTable = (query: DbTableQuery): AxiosPromise<PageResult<DbTabl
};
// 查询表详细信息
export const getGenTable = (tableId: string | number): AxiosPromise<GenTableVO> => {
export const getGenTable = (tableId: string | number): AxiosPromise<GenTableDetailPayload> => {
return request({
url: '/tool/gen/' + tableId,
method: 'get'
@@ -29,7 +31,7 @@ export const getGenTable = (tableId: string | number): AxiosPromise<GenTableVO>
};
// 修改代码生成信息
export const updateGenTable = (data: DbTableForm): AxiosPromise<GenTableVO> => {
export const updateGenTable = (data: DbTableForm): AxiosPromise<unknown> => {
return request({
url: '/tool/gen',
method: 'put',
@@ -38,7 +40,7 @@ export const updateGenTable = (data: DbTableForm): AxiosPromise<GenTableVO> => {
};
// 导入表
export const importTable = (data: { tables: string; dataName: string }): AxiosPromise<GenTableVO> => {
export const importTable = (data: { tables: string; dataName: string }): AxiosPromise<unknown> => {
return request({
url: '/tool/gen/importTable',
method: 'post',
+7 -1
View File
@@ -103,7 +103,13 @@ export interface DbTableQuery extends PageQuery {
tableComment: string;
}
export interface GenTableVO {
/**
* data Map
* - info GenTable
* - rows GenTableColumn[]
* - tables GenTable[]
*/
export interface GenTableDetailPayload {
info: DbTableVO;
rows: DbColumnVO[];
tables: DbTableVO[];
+2 -2
View File
@@ -1,6 +1,6 @@
import type { CategoryForm, CategoryQuery, CategoryTreeVO, CategoryVO } from '@/api/workflow/category/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CategoryVO, CategoryForm, CategoryQuery, CategoryTreeVO } from '@/api/workflow/category/types';
/**
*
+5 -5
View File
@@ -1,12 +1,12 @@
import request from '@/utils/request';
import {
FlowDefinitionQuery,
import type { PageResult } from '@/api/types';
import type {
definitionXmlVO,
FlowDefinitionForm,
FlowDefinitionQuery,
FlowDefinitionVo
} from '@/api/workflow/definition/types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
/**
*
+4 -4
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import { AxiosPromise } from 'axios';
import { PageResult } from '@/api/types';
/**
*
@@ -34,7 +34,7 @@ export const pageByFinish = (query: FlowInstanceQuery): AxiosPromise<PageResult<
*/
export const flowHisTaskList = (businessId: string | number) => {
return request({
url: `/workflow/instance/flowHisTaskList/${businessId}` + '?t' + Math.random(),
url: `/workflow/instance/flowHisTaskList/${businessId}?t=${Math.random()}`,
method: 'get'
});
};
+2 -2
View File
@@ -1,11 +1,11 @@
import { FlowTaskVO } from '@/api/workflow/task/types';
import type { FlowTaskVO } from '@/api/workflow/task/types';
export interface FlowInstanceQuery extends PageQuery {
category?: string | number;
nodeName?: string;
flowCode?: string;
flowName?: string;
createByIds?: string[] | number[];
createByIds?: Array<string | number>;
businessId?: string;
}
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LeaveVO, LeaveQuery, LeaveForm } from '@/api/workflow/leave/types';
import { PageResult } from '@/api/types';
/**
*
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { SpelForm, SpelQuery, SpelVO } from '@/api/workflow/spel/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SpelVO, SpelForm, SpelQuery } from '@/api/workflow/spel/types';
import { PageResult } from '@/api/types';
/**
* spel表达式定义列表
+3 -3
View File
@@ -1,7 +1,7 @@
import type { PageResult } from '@/api/types';
import type { FlowTaskVO, TaskOperationBo, TaskQuery } from '@/api/workflow/task/types';
import type { AxiosPromise } from '@/utils/api-types';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TaskQuery, FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types';
import { PageResult } from '@/api/types';
/**
*
+1 -1
View File
@@ -2,7 +2,7 @@ export interface TaskQuery extends PageQuery {
nodeName?: string;
flowCode?: string;
flowName?: string;
createByIds?: string[] | number[];
createByIds?: Array<string | number>;
}
export interface ParticipantVo {
+6 -4
View File
@@ -1,9 +1,11 @@
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
import type { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
import tab from '@/plugins/tab';
import router from '@/router';
export default {
routerJump(routerJumpVo: RouterJumpVo, proxy) {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
routerJump(routerJumpVo: RouterJumpVo) {
tab.closePage(router.currentRoute.value);
router.push({
path: routerJumpVo.formPath,
query: {
id: routerJumpVo.businessId,
+1 -1
View File
@@ -4,7 +4,7 @@
<template v-if="isValueMatch(item.value)">
<span
v-if="
(item.elTagType === 'default' || item.elTagType === '') &&
((item.elTagType as string) === 'default' || (item.elTagType as string) === '') &&
(item.elTagClass === '' || item.elTagClass == null)
"
:key="item.value"
+20 -22
View File
@@ -15,15 +15,14 @@
<script setup lang="ts">
import '@wangeditor-next/editor/dist/css/style.css';
import { Editor as WangEditor, Toolbar as EditorToolbar } from '@wangeditor-next/editor-for-vue';
import type { IDomEditor, IEditorConfig, IToolbarConfig } from '@wangeditor-next/editor';
import { Editor as WangEditor, Toolbar as EditorToolbar } from '@wangeditor-next/editor-for-vue';
import { listByIds } from '@/api/system/oss';
import modal from '@/plugins/modal';
import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request';
import { listByIds } from '@/api/system/oss';
const OSS_MARKER_RE = /oss:\/\/([\w-]+)/g;
const props = defineProps({
/* 编辑器的内容 */
modelValue: propTypes.string,
@@ -42,7 +41,6 @@ const props = defineProps({
});
const emit = defineEmits(['update:modelValue']);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const editorRef = shallowRef<IDomEditor>();
const content = ref('');
@@ -123,7 +121,7 @@ const decodeOssContent = async (html: string): Promise<string> => {
const matches = [...html.matchAll(OSS_MARKER_RE)];
if (matches.length === 0) return html;
const ossIds = [...new Set(matches.map((m) => m[1]))];
const ossIds = [...new Set(matches.map(m => m[1]))];
try {
const res = await listByIds(ossIds.join(','));
@@ -144,14 +142,14 @@ const decodeOssContent = async (html: string): Promise<string> => {
const validateImageFile = (file: File) => {
const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png', 'image/svg', 'image/svg+xml'];
if (!allowedTypes.includes(file.type)) {
proxy?.$modal.msgError('图片格式错误!');
modal.msgError('图片格式错误!');
return false;
}
if (props.fileSize) {
const isLt = file.size / 1024 / 1024 < props.fileSize;
if (!isLt) {
proxy?.$modal.msgError(`上传图片大小不能超过 ${props.fileSize} MB!`);
modal.msgError(`上传图片大小不能超过 ${props.fileSize} MB!`);
return false;
}
}
@@ -162,14 +160,14 @@ const validateImageFile = (file: File) => {
const validateVideoFile = (file: File) => {
const allowedTypes = ['video/mp4', 'video/webm', 'video/ogg'];
if (!allowedTypes.includes(file.type)) {
proxy?.$modal.msgError('视频格式错误, 请上传 mp4/webm/ogg 格式!');
modal.msgError('视频格式错误, 请上传 mp4/webm/ogg 格式!');
return false;
}
if (props.videoSize) {
const isLt = file.size / 1024 / 1024 < props.videoSize;
if (!isLt) {
proxy?.$modal.msgError(`上传视频大小不能超过 ${props.videoSize} MB!`);
modal.msgError(`上传视频大小不能超过 ${props.videoSize} MB!`);
return false;
}
}
@@ -186,17 +184,17 @@ const getUploadImageMenuConfig = () => {
customUpload(file: File, insertFn: (url: string, alt?: string, href?: string) => void) {
if (!validateImageFile(file)) return;
proxy?.$modal.loading('正在上传图片,请稍候...');
modal.loading('正在上传图片,请稍候...');
const reader = new FileReader();
reader.onload = () => {
insertFn(reader.result as string, file.name);
proxy?.$modal.closeLoading();
modal.closeLoading();
};
reader.onerror = () => {
proxy?.$modal.msgError('图片插入失败');
proxy?.$modal.closeLoading();
modal.msgError('图片插入失败');
modal.closeLoading();
};
reader.readAsDataURL(file);
@@ -209,14 +207,14 @@ const getUploadImageMenuConfig = () => {
async customUpload(file: File, insertFn: (url: string, alt?: string, href?: string) => void) {
if (!validateImageFile(file)) return;
proxy?.$modal.loading('正在上传图片,请稍候...');
modal.loading('正在上传图片,请稍候...');
try {
const result = await uploadToOss(file);
insertFn(result.url, file.name, result.url);
} catch {
proxy?.$modal.msgError('图片上传失败');
modal.msgError('图片上传失败');
} finally {
proxy?.$modal.closeLoading();
modal.closeLoading();
}
}
};
@@ -227,14 +225,14 @@ const getUploadVideoMenuConfig = () => ({
async customUpload(file: File, insertFn: (url: string, poster?: string) => void) {
if (!validateVideoFile(file)) return;
proxy?.$modal.loading('正在上传视频,请稍候...');
modal.loading('正在上传视频,请稍候...');
try {
const result = await uploadToOss(file);
insertFn(result.url);
} catch {
proxy?.$modal.msgError('视频上传失败');
modal.msgError('视频上传失败');
} finally {
proxy?.$modal.closeLoading();
modal.closeLoading();
}
}
});
@@ -265,7 +263,7 @@ const syncReadOnly = () => {
watch(
() => props.modelValue,
async (value) => {
async value => {
const nextValue = value || '';
// emit
@@ -283,7 +281,7 @@ watch(
{ immediate: true }
);
watch(content, (value) => {
watch(content, value => {
if (isResolvingContent.value) return;
const encoded = encodeOssContent(value);
+14 -12
View File
@@ -47,8 +47,9 @@
</template>
<script setup lang="ts">
import { propTypes } from '@/utils/propTypes';
import { delOss, listByIds } from '@/api/system/oss';
import modal from '@/plugins/modal';
import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request';
const props = defineProps({
@@ -68,7 +69,6 @@ const props = defineProps({
disabled: propTypes.bool.def(false)
});
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const emit = defineEmits(['update:modelValue']);
const number = ref(0);
const uploadList = ref<any[]>([]);
@@ -94,7 +94,7 @@ watch(
let list: any[] = [];
if (Array.isArray(val)) {
list = val;
} else {
} else if (typeof val === 'string' || typeof val === 'number') {
const res = await listByIds(val);
list = res.data.map(oss => {
return {
@@ -103,6 +103,8 @@ watch(
ossId: oss.ossId
};
});
} else {
list = [];
}
//
fileList.value = list.map(item => {
@@ -126,36 +128,36 @@ const handleBeforeUpload = (file: any) => {
const fileExt = fileName[fileName.length - 1];
const isTypeOk = props.fileType.indexOf(fileExt) >= 0;
if (!isTypeOk) {
proxy?.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}格式文件!`);
modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}格式文件!`);
return false;
}
}
//
if (file.name.includes(',')) {
proxy?.$modal.msgError('文件名不正确,不能包含英文逗号!');
modal.msgError('文件名不正确,不能包含英文逗号!');
return false;
}
//
if (props.fileSize) {
const isLt = file.size / 1024 / 1024 < props.fileSize;
if (!isLt) {
proxy?.$modal.msgError(`上传文件大小不能超过 ${props.fileSize} MB!`);
modal.msgError(`上传文件大小不能超过 ${props.fileSize} MB!`);
return false;
}
}
proxy?.$modal.loading('正在上传文件,请稍候...');
modal.loading('正在上传文件,请稍候...');
number.value++;
return true;
};
//
const handleExceed = () => {
proxy?.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
};
//
const handleUploadError = () => {
proxy?.$modal.msgError('上传文件失败');
modal.msgError('上传文件失败');
};
//
@@ -169,8 +171,8 @@ const handleUploadSuccess = (res: any, file: UploadFile) => {
uploadedSuccessfully();
} else {
number.value--;
proxy?.$modal.closeLoading();
proxy?.$modal.msgError(res.msg);
modal.closeLoading();
modal.msgError(res.msg);
fileUploadRef.value?.handleRemove(file);
uploadedSuccessfully();
}
@@ -191,7 +193,7 @@ const uploadedSuccessfully = () => {
uploadList.value = [];
number.value = 0;
emit('update:modelValue', listToString(fileList.value));
proxy?.$modal.closeLoading();
modal.closeLoading();
}
};
+18 -14
View File
@@ -43,11 +43,12 @@
</template>
<script setup lang="ts">
import { compressAccurately } from 'image-conversion';
import { listByIds, delOss } from '@/api/system/oss';
import { OssVO } from '@/api/system/oss/types';
import modal from '@/plugins/modal';
import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request';
import { compressAccurately } from 'image-conversion';
const props = defineProps({
modelValue: {
@@ -74,7 +75,6 @@ const props = defineProps({
compressTargetSize: propTypes.number.def(300)
});
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const emit = defineEmits(['update:modelValue']);
const number = ref(0);
const uploadList = ref<any[]>([]);
@@ -142,46 +142,50 @@ const handleBeforeUpload = (file: any) => {
isImg = file.type.indexOf('image') > -1;
}
if (!isImg) {
proxy?.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}图片格式文件!`);
modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}图片格式文件!`);
return false;
}
if (file.name.includes(',')) {
proxy?.$modal.msgError('文件名不正确,不能包含英文逗号!');
modal.msgError('文件名不正确,不能包含英文逗号!');
return false;
}
if (props.fileSize) {
const isLt = file.size / 1024 / 1024 < props.fileSize;
if (!isLt) {
proxy?.$modal.msgError(`上传头像图片大小不能超过 ${props.fileSize} MB!`);
modal.msgError(`上传头像图片大小不能超过 ${props.fileSize} MB!`);
return false;
}
}
//
if (props.compressSupport && file.size / 1024 > props.compressTargetSize) {
proxy?.$modal.loading('正在上传图片,请稍候...');
modal.loading('正在上传图片,请稍候...');
number.value++;
return compressAccurately(file, props.compressTargetSize);
} else {
proxy?.$modal.loading('正在上传图片,请稍候...');
modal.loading('正在上传图片,请稍候...');
number.value++;
}
};
//
const handleExceed = () => {
proxy?.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
};
//
const handleUploadSuccess = (res: any, file: UploadFile) => {
if (res.code === 200) {
uploadList.value.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId });
uploadList.value.push({
name: res.data.fileName,
url: res.data.url,
ossId: res.data.ossId
});
uploadedSuccessfully();
} else {
number.value--;
proxy?.$modal.closeLoading();
proxy?.$modal.msgError(res.msg);
modal.closeLoading();
modal.msgError(res.msg);
imageUploadRef.value?.handleRemove(file);
uploadedSuccessfully();
}
@@ -207,14 +211,14 @@ const uploadedSuccessfully = () => {
uploadList.value = [];
number.value = 0;
emit('update:modelValue', listToString(fileList.value));
proxy?.$modal.closeLoading();
modal.closeLoading();
}
};
//
const handleUploadError = () => {
proxy?.$modal.msgError('上传图片失败');
proxy?.$modal.closeLoading();
modal.msgError('上传图片失败');
modal.closeLoading();
};
//
+1 -1
View File
@@ -14,8 +14,8 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { useAppStore } from '@/store/modules/app';
import SvgIcon from '@/components/SvgIcon/index.vue';
import { useAppStore } from '@/store/modules/app';
const appStore = useAppStore();
const { locale } = useI18n();
+1 -1
View File
@@ -15,8 +15,8 @@
</template>
<script setup name="Pagination" lang="ts">
import { scrollTo } from '@/utils/scroll-to';
import { propTypes } from '@/utils/propTypes';
import { scrollTo } from '@/utils/scroll-to';
const props = defineProps({
total: propTypes.number,
+2 -3
View File
@@ -29,10 +29,9 @@
</el-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ComponentInternalInstance } from 'vue';
import { ElForm, FormInstance } from 'element-plus';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { ref } from 'vue';
const emits = defineEmits(['submitCallback', 'cancelCallback']);
const props = defineProps({
title: {
+7 -3
View File
@@ -26,8 +26,12 @@
</div>
</template>
<script setup lang="ts">
import { useRoute } from 'vue-router';
import tab from '@/plugins/tab';
import router from '@/router';
import { propTypes } from '@/utils/propTypes';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const props = defineProps({
status: propTypes.string.def(''),
pageType: propTypes.string.def(''),
@@ -66,7 +70,7 @@ const approvalButtonShow = computed(() => {
//
const goBack = () => {
proxy.$tab.closePage(proxy.$route);
proxy.$router.go(-1);
tab.closePage(route);
router.go(-1);
};
</script>
+7 -5
View File
@@ -98,12 +98,14 @@
</div>
</template>
<script setup lang="ts">
import { flowHisTaskList } from '@/api/workflow/instance';
import { propTypes } from '@/utils/propTypes';
import { listByIds } from '@/api/system/oss';
import { flowHisTaskList } from '@/api/workflow/instance';
import FlowChart from '@/components/Process/flowChart.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_task_status } = toRefs<any>(proxy?.useDict('wf_task_status'));
import download from '@/plugins/download';
import { useDict } from '@/utils/dict';
import { propTypes } from '@/utils/propTypes';
const { wf_task_status } = toRefs<any>(useDict('wf_task_status'));
const props = defineProps({
width: propTypes.string.def('80%'),
height: propTypes.string.def('100%')
@@ -146,7 +148,7 @@ const getIds = async (ids: string | number) => {
/** 下载按钮操作 */
const handleDownload = (ossId: string) => {
proxy?.$download.oss(ossId);
download.oss(ossId);
};
/**
+7 -1
View File
@@ -111,7 +111,13 @@ const applyTransform = () => {
};
const getBounds = () => {
if (!imageWrapperRef.value) return { minTranslateX: 0, maxTranslateX: 0, minTranslateY: 0, maxTranslateY: 0 };
if (!imageWrapperRef.value)
return {
minTranslateX: 0,
maxTranslateX: 0,
minTranslateY: 0,
maxTranslateY: 0
};
const imgRect = imageWrapperRef.value.getBoundingClientRect();
const containerRect = imageWrapperRef.value.parentElement?.getBoundingClientRect() ?? imgRect;
+19 -16
View File
@@ -87,11 +87,12 @@
</el-dialog>
</template>
<script setup lang="ts">
import { propTypes } from '@/utils/propTypes';
import { FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types';
import UserSelect from '@/components/UserSelect';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { getTask, taskOperation, currentTaskAllUser, terminationTask } from '@/api/workflow/task';
import { FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types';
import UserSelect from '@/components/UserSelect/index.vue';
import modal from '@/plugins/modal';
import { propTypes } from '@/utils/propTypes';
const props = defineProps({
width: propTypes.string.def('50%'),
height: propTypes.string.def('100%')
@@ -128,8 +129,10 @@ const task = ref<FlowTaskVO>({
nodeRatio: undefined,
version: undefined,
applyNode: undefined,
buttonList: []
});
buttonList: [],
businessCode: '',
businessTitle: ''
} as FlowTaskVO);
const open = (taskId: string) => {
visible.value = true;
@@ -153,7 +156,7 @@ const handleTransferTask = async data => {
message: '',
messageType: ['1']
});
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
loading.value = true;
buttonDisabled.value = true;
await taskOperation(taskOperationBo, 'transferTask').finally(() => {
@@ -162,9 +165,9 @@ const handleTransferTask = async data => {
});
visible.value = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
} else {
proxy?.$modal.msgWarning('请选择用户!');
modal.msgWarning('请选择用户!');
}
};
//
@@ -180,7 +183,7 @@ const addMultiInstanceUser = async data => {
message: '',
messageType: ['1']
});
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
loading.value = true;
buttonDisabled.value = true;
await taskOperation(taskOperationBo, 'addSignature').finally(() => {
@@ -189,14 +192,14 @@ const addMultiInstanceUser = async data => {
});
visible.value = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
} else {
proxy?.$modal.msgWarning('请选择用户!');
modal.msgWarning('请选择用户!');
}
};
//
const deleteMultiInstanceUser = async row => {
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
loading.value = true;
buttonDisabled.value = true;
const taskOperationBo = reactive<TaskOperationBo>({
@@ -211,7 +214,7 @@ const deleteMultiInstanceUser = async row => {
});
visible.value = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
};
//
const handleTaskUser = async () => {
@@ -231,7 +234,7 @@ const handleTerminationTask = async () => {
taskId: task.value.id,
comment: ''
};
await proxy?.$modal.confirm('是否确认终止?');
await modal.confirm('是否确认终止?');
loading.value = true;
buttonDisabled.value = true;
await terminationTask(params).finally(() => {
@@ -240,7 +243,7 @@ const handleTerminationTask = async () => {
});
visible.value = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
};
/**
* 对外暴露子组件方法
+22 -24
View File
@@ -196,9 +196,8 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ComponentInternalInstance } from 'vue';
import { ElForm } from 'element-plus';
import { ref } from 'vue';
import {
completeTask,
backProcess,
@@ -209,10 +208,9 @@ import {
currentTaskAllUser,
getNextNodeList
} from '@/api/workflow/task';
import UserSelect from '@/components/UserSelect';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { FlowCopyVo, FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types';
import UserSelect from '@/components/UserSelect/index.vue';
import modal from '@/plugins/modal';
const userSelectCopyRef = ref<InstanceType<typeof UserSelect>>();
const transferTaskRef = ref<InstanceType<typeof UserSelect>>();
@@ -362,7 +360,7 @@ const handleCompleteTask = async () => {
}
});
if (verify) {
proxy?.$modal.msgWarning('请选择审批人!');
modal.msgWarning('请选择审批人!');
return false;
}
} else {
@@ -379,14 +377,14 @@ const handleCompleteTask = async () => {
});
form.value.flowCopyList = flowCopyList;
}
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
loading.value = true;
buttonDisabled.value = true;
try {
await completeTask(form.value);
dialog.visible = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
} finally {
loading.value = false;
buttonDisabled.value = false;
@@ -409,7 +407,7 @@ const handleBackProcessOpen = async () => {
/** 驳回流程 */
const handleBackProcess = async () => {
backForm.value.taskId = taskId.value;
await proxy?.$modal.confirm('是否确认驳回到申请人?');
await modal.confirm('是否确认驳回到申请人?');
loading.value = true;
backLoading.value = true;
backButtonDisabled.value = true;
@@ -421,7 +419,7 @@ const handleBackProcess = async () => {
backLoading.value = false;
backButtonDisabled.value = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
};
//
const cancel = async () => {
@@ -463,7 +461,7 @@ const addMultiInstanceUser = async data => {
message: form.value.message,
messageType: ['1']
});
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
loading.value = true;
buttonDisabled.value = true;
await taskOperation(taskOperationBo, 'addSignature').finally(() => {
@@ -472,14 +470,14 @@ const addMultiInstanceUser = async data => {
});
dialog.visible = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
} else {
proxy?.$modal.msgWarning('请选择用户!');
modal.msgWarning('请选择用户!');
}
};
//
const deleteMultiInstanceUser = async row => {
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
loading.value = true;
buttonDisabled.value = true;
const taskOperationBo = reactive<TaskOperationBo>({
@@ -494,7 +492,7 @@ const deleteMultiInstanceUser = async row => {
});
dialog.visible = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
};
//
const openTransferTask = () => {
@@ -509,7 +507,7 @@ const handleTransferTask = async data => {
message: form.value.message,
messageType: ['1']
});
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
loading.value = true;
buttonDisabled.value = true;
await taskOperation(taskOperationBo, 'transferTask').finally(() => {
@@ -518,9 +516,9 @@ const handleTransferTask = async data => {
});
dialog.visible = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
} else {
proxy?.$modal.msgWarning('请选择用户!');
modal.msgWarning('请选择用户!');
}
};
@@ -537,7 +535,7 @@ const handleDelegateTask = async data => {
message: form.value.message,
messageType: ['1']
});
await proxy?.$modal.confirm('是否确认提交?');
await modal.confirm('是否确认提交?');
loading.value = true;
buttonDisabled.value = true;
await taskOperation(taskOperationBo, 'delegateTask').finally(() => {
@@ -546,9 +544,9 @@ const handleDelegateTask = async data => {
});
dialog.visible = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
} else {
proxy?.$modal.msgWarning('请选择用户!');
modal.msgWarning('请选择用户!');
}
};
//
@@ -557,7 +555,7 @@ const handleTerminationTask = async () => {
taskId: taskId.value,
comment: form.value.message
};
await proxy?.$modal.confirm('是否确认终止?');
await modal.confirm('是否确认终止?');
loading.value = true;
buttonDisabled.value = true;
await terminationTask(params).finally(() => {
@@ -566,7 +564,7 @@ const handleTerminationTask = async () => {
});
dialog.visible = false;
emits('submitCallback');
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
};
const handleTaskUser = async () => {
const data = await currentTaskAllUser(taskId.value);
@@ -581,7 +579,7 @@ const handleTaskUser = async () => {
//
const choosePeople = async data => {
if (!data.permissionFlag) {
proxy?.$modal.msgError('没有可选择的人员,请联系管理员!');
modal.msgError('没有可选择的人员,请联系管理员!');
}
popUserIds.value = data.permissionFlag;
nodeCode.value = data.nodeCode;
+1 -1
View File
@@ -36,8 +36,8 @@
</template>
<script setup lang="ts">
import { propTypes } from '@/utils/propTypes';
import cache from '@/plugins/cache';
import { propTypes } from '@/utils/propTypes';
const props = defineProps({
showSearch: propTypes.bool.def(true),
+12 -9
View File
@@ -9,8 +9,8 @@
>
<div class="p-2 role-select-shell">
<transition
:enter-active-class="proxy?.animate.searchAnimate.enter"
:leave-active-class="proxy?.animate.searchAnimate.leave"
:enter-active-class="animateConfig.searchAnimate.enter"
:leave-active-class="animateConfig.searchAnimate.leave"
>
<div v-show="showSearch">
<el-card shadow="hover" class="search-panel selector-card">
@@ -81,7 +81,7 @@
</vxe-column>
<vxe-column field="createTime" title="创建时间" align="center">
<template #default="scope">
<span>{{ proxy.parseTime(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</vxe-column>
</vxe-table>
@@ -104,10 +104,14 @@
</template>
<script setup lang="ts">
import { RoleVO, RoleQuery } from '@/api/system/role/types';
import { VxeTableInstance } from 'vxe-table';
import useDialog from '@/hooks/useDialog';
import animateConfig from '@/animate';
import api from '@/api/system/role';
import { RoleVO, RoleQuery } from '@/api/system/role/types';
import useDialog from '@/hooks/useDialog';
import { useDict } from '@/utils/dict';
import { parseTime, addDateRange } from '@/utils/ruoyi';
interface PropType {
modelValue?: RoleVO[] | RoleVO | undefined;
multiple?: boolean;
@@ -120,14 +124,13 @@ const prop = withDefaults(defineProps<PropType>(), {
});
const emit = defineEmits(['update:modelValue', 'confirmCallBack']);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const roleList = ref<RoleVO[]>();
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const selectRoleList = ref<RoleVO[]>([]);
const roleDialog = useDialog({
@@ -171,7 +174,7 @@ const computedIds = data => {
*/
const getList = () => {
loading.value = true;
api.listRole(proxy?.addDateRange(queryParams.value, dateRange.value)).then(res => {
api.listRole(addDateRange(queryParams.value, dateRange.value)).then(res => {
roleList.value = res.data?.rows;
total.value = res.data?.total;
loading.value = false;
+5 -5
View File
@@ -35,12 +35,12 @@
</template>
<script setup lang="ts">
import { constantRoutes } from '@/router';
import { isHttp } from '@/utils/validate';
import { useAppStore } from '@/store/modules/app';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission';
import { RouteRecordRaw } from 'vue-router';
import { constantRoutes } from '@/router';
import { useAppStore } from '@/store/modules/app';
import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import { isHttp } from '@/utils/validate';
//
const visibleNumber = ref<number>(-1);
+1 -1
View File
@@ -24,7 +24,7 @@
class="mt-2 dept-tree"
:node-key="nodeKey"
:data="data"
:props="(treeProps as any)"
:props="treeProps as any"
:expand-on-click-node="false"
:filter-node-method="internalFilterNode"
highlight-current
+10 -8
View File
@@ -63,8 +63,8 @@
>
<div class="p-2user-select-main">
<transition
:enter-active-class="proxy?.animate.searchAnimate.enter"
:leave-active-class="proxy?.animate.searchAnimate.leave"
:enter-active-class="animateConfig.searchAnimate.enter"
:leave-active-class="animateConfig.searchAnimate.leave"
>
<div v-show="showSearch">
<el-card shadow="hover" class="search-panel selector-card">
@@ -167,11 +167,14 @@
</template>
<script setup lang="ts">
import { VxeTableInstance } from 'vxe-table';
import animateConfig from '@/animate';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import api from '@/api/system/user';
import { UserQuery, UserVO } from '@/api/system/user/types';
import { DeptTreeVO, DeptVO } from '@/api/system/dept/types';
import { VxeTableInstance } from 'vxe-table';
import useDialog from '@/hooks/useDialog';
import { useDict } from '@/utils/dict';
import { addDateRange } from '@/utils/ruoyi';
interface PropType {
modelValue?: UserVO[] | UserVO | undefined;
@@ -187,14 +190,13 @@ const prop = withDefaults(defineProps<PropType>(), {
});
const emit = defineEmits(['update:modelValue', 'confirmCallBack']);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
const { sys_normal_disable } = toRefs<any>(useDict('sys_normal_disable'));
const userList = ref<UserVO[]>();
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
const dateRange = ref<any>(['', '']);
const deptName = ref('');
const treeCollapsed = ref(false);
const deptOptions = ref<DeptTreeVO[]>([]);
@@ -269,7 +271,7 @@ const getTreeSelect = async () => {
const getList = async () => {
loading.value = true;
queryParams.value.userIds = prop.userIds;
const res = await api.listUser(proxy?.addDateRange(queryParams.value, dateRange.value));
const res = await api.listUser(addDateRange(queryParams.value, dateRange.value));
loading.value = false;
userList.value = res.data?.rows;
total.value = res.data?.total;
+1 -1
View File
@@ -2,7 +2,7 @@
* v-copyText
* Copyright (c) 2022 ruoyi
*/
import { DirectiveBinding } from 'vue';
import type { DirectiveBinding } from 'vue';
export default {
beforeMount(el: any, { value, arg }: DirectiveBinding) {
+1 -1
View File
@@ -1,6 +1,6 @@
import type { App } from 'vue';
import copyText from './common/copyText';
import { hasPermi, hasRoles } from './permission';
import { App } from 'vue';
export default (app: App) => {
app.directive('copyText', copyText);
+1 -1
View File
@@ -1,4 +1,4 @@
import { Directive, DirectiveBinding } from 'vue';
import type { Directive, DirectiveBinding } from 'vue';
import { useUserStore } from '@/store/modules/user';
/**
*
+1 -1
View File
@@ -1,4 +1,4 @@
import { Ref } from 'vue';
import type { Ref } from 'vue';
interface Options {
title?: string;
+1 -2
View File
@@ -1,9 +1,8 @@
// 自定义国际化配置
import { createI18n } from 'vue-i18n';
import { LanguageEnum } from '@/enums/LanguageEnum';
import zh_CN from '@/lang/zh_CN';
import en_US from '@/lang/en_US';
import zh_CN from '@/lang/zh_CN';
/**
*
+4 -6
View File
@@ -12,11 +12,11 @@
</template>
<script setup name="AppMain" lang="ts">
import animateConfig from '@/animate';
import { useSettingsStore } from '@/store/modules/settings';
import { useTagsViewStore } from '@/store/modules/tagsView';
import IframeToggle from './IframeToggle/index.vue';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const tagsViewStore = useTagsViewStore();
@@ -26,11 +26,9 @@ watch(
() => useSettingsStore().animationEnable,
(val: boolean) => {
if (val) {
animate.value = proxy?.animate.animateList[
Math.floor(Math.random() * proxy?.animate.animateList.length)
] as string;
animate.value = animateConfig.animateList[Math.floor(Math.random() * animateConfig.animateList.length)] as string;
} else {
animate.value = proxy?.animate.defaultAnimate as string;
animate.value = animateConfig.defaultAnimate as string;
}
},
{ immediate: true }
+1 -2
View File
@@ -9,9 +9,8 @@
</template>
<script setup lang="ts">
import InnerLink from '../InnerLink/index.vue';
import { useTagsViewStore } from '@/store/modules/tagsView';
import InnerLink from '../InnerLink/index.vue';
const route = useRoute();
const tagsViewStore = useTagsViewStore();
+19 -20
View File
@@ -31,7 +31,7 @@
</div>
</el-tooltip>
<!-- 消息 -->
<el-tooltip :content="proxy.$t('navbar.message')" effect="dark" placement="bottom">
<el-tooltip :content="$t('navbar.message')" effect="dark" placement="bottom">
<div>
<el-popover placement="bottom" trigger="click" transition="el-zoom-in-top" :width="300" :persistent="false">
<template #reference>
@@ -51,19 +51,19 @@
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
</el-tooltip>
<el-tooltip :content="proxy.$t('navbar.document')" effect="dark" placement="bottom">
<el-tooltip :content="$t('navbar.document')" effect="dark" placement="bottom">
<ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
</el-tooltip>
<el-tooltip :content="proxy.$t('navbar.full')" effect="dark" placement="bottom">
<el-tooltip :content="$t('navbar.full')" effect="dark" placement="bottom">
<screenfull id="screenfull" class="right-menu-item hover-effect" />
</el-tooltip>
<el-tooltip :content="proxy.$t('navbar.language')" effect="dark" placement="bottom">
<el-tooltip :content="$t('navbar.language')" effect="dark" placement="bottom">
<lang-select id="lang-select" class="right-menu-item hover-effect" />
</el-tooltip>
<el-tooltip :content="proxy.$t('navbar.layoutSize')" effect="dark" placement="bottom">
<el-tooltip :content="$t('navbar.layoutSize')" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>
</template>
@@ -80,13 +80,13 @@
<template #dropdown>
<el-dropdown-menu>
<router-link to="/user/profile">
<el-dropdown-item>{{ proxy.$t('navbar.personalCenter') }}</el-dropdown-item>
<el-dropdown-item>{{ $t('navbar.personalCenter') }}</el-dropdown-item>
</router-link>
<el-dropdown-item v-if="settingsStore.showSettings" command="setLayout">
<span>{{ proxy.$t('navbar.layoutSetting') }}</span>
<span>{{ $t('navbar.layoutSetting') }}</span>
</el-dropdown-item>
<el-dropdown-item divided command="logout">
<span>{{ proxy.$t('navbar.logout') }}</span>
<span>{{ $t('navbar.logout') }}</span>
</el-dropdown-item>
</el-dropdown-menu>
</template>
@@ -97,26 +97,25 @@
</template>
<script setup lang="ts">
import SearchMenu from './TopBar/search.vue';
import { useAppStore } from '@/store/modules/app';
import { useUserStore } from '@/store/modules/user';
import { useSettingsStore } from '@/store/modules/settings';
import { useNoticeStore } from '@/store/modules/notice';
import notice from './notice/index.vue';
import router from '@/router';
import type { ElMessageBoxOptions } from 'element-plus';
import { NavTypeEnum } from '@/enums/NavTypeEnum';
import TopBar from './TopBar/index.vue';
import { CaretBottom } from '@element-plus/icons-vue';
import appLogo from '@/assets/logo/logo.png';
import { NavTypeEnum } from '@/enums/NavTypeEnum';
import tab from '@/plugins/tab';
import router from '@/router';
import { useAppStore } from '@/store/modules/app';
import { useNoticeStore } from '@/store/modules/notice';
import { useSettingsStore } from '@/store/modules/settings';
import { useUserStore } from '@/store/modules/user';
import notice from './notice/index.vue';
import TopBar from './TopBar/index.vue';
import SearchMenu from './TopBar/search.vue';
const appStore = useAppStore();
const userStore = useUserStore();
const settingsStore = useSettingsStore();
const noticeStore = storeToRefs(useNoticeStore());
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const navType = computed(() => settingsStore.navType);
const showLogo = computed(() => settingsStore.sidebarLogo);
const displayName = computed(() => userStore.nickname || '管理员');
@@ -145,7 +144,7 @@ const logout = async () => {
redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/')
}
});
proxy?.$tab.closeAllPage();
tab.closeAllPage();
});
};
+10 -10
View File
@@ -162,16 +162,16 @@
</template>
<script setup lang="ts">
import { useDynamicTitle } from '@/utils/dynamicTitle';
import { useAppStore } from '@/store/modules/app';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission';
import { handleThemeStyle } from '@/utils/theme';
import { SideThemeEnum } from '@/enums/SideThemeEnum';
import { NavTypeEnum } from '@/enums/NavTypeEnum';
import { SideThemeEnum } from '@/enums/SideThemeEnum';
import modal from '@/plugins/modal';
import defaultSettings from '@/settings';
import { useAppStore } from '@/store/modules/app';
import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import { useDynamicTitle } from '@/utils/dynamicTitle';
import { handleThemeStyle } from '@/utils/theme';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const appStore = useAppStore();
const settingsStore = useSettingsStore();
const permissionStore = usePermissionStore();
@@ -245,7 +245,7 @@ const handleTheme = (val: string) => {
settingsStore.sideTheme = val;
};
const saveSetting = () => {
proxy?.$modal.loading('正在保存到本地,请稍候...');
modal.loading('正在保存到本地,请稍候...');
const settings = useStorage<LayoutSetting>('layout-setting', defaultSettings);
if (!storeSettings.value.tagsViewPersist) {
localStorage.removeItem('tags-view-visited');
@@ -261,11 +261,11 @@ const saveSetting = () => {
settings.value.navType = storeSettings.value.navType;
settings.value.radiusBase = storeSettings.value.radiusBase;
setTimeout(() => {
proxy?.$modal.closeLoading();
modal.closeLoading();
}, 1000);
};
const resetSetting = () => {
proxy?.$modal.loading('正在清除设置缓存并刷新,请稍候...');
modal.loading('正在清除设置缓存并刷新,请稍候...');
localStorage.removeItem('tags-view-visited');
useStorage<any>('layout-setting', null).value = null;
setTimeout('window.location.reload()', 1000);
+3 -3
View File
@@ -1,6 +1,6 @@
<template>
<div class="sidebar-logo-container" :class="{ collapse: collapse }">
<transition :enter-active-class="proxy?.animate.logoAnimate.enter" mode="out-in">
<transition :enter-active-class="animateConfig.logoAnimate.enter" mode="out-in">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 v-else class="sidebar-title">
@@ -18,10 +18,10 @@
</template>
<script setup lang="ts">
import animateConfig from '@/animate';
import logo from '@/assets/logo/logo.png';
import { useSettingsStore } from '@/store/modules/settings';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { NavTypeEnum } from '@/enums/NavTypeEnum';
import { useSettingsStore } from '@/store/modules/settings';
defineProps({
collapse: {
@@ -44,10 +44,10 @@
</template>
<script setup lang="ts">
import { RouteRecordRaw } from 'vue-router';
import { getNormalPath } from '@/utils/ruoyi';
import { isExternal } from '@/utils/validate';
import AppLink from './Link.vue';
import { getNormalPath } from '@/utils/ruoyi';
import { RouteRecordRaw } from 'vue-router';
const props = defineProps({
item: {
@@ -105,7 +105,10 @@ const resolvePath = (routePath: string, routeQuery?: string): any => {
}
if (routeQuery) {
const query = JSON.parse(routeQuery);
return { path: getNormalPath(props.basePath + '/' + routePath), query: query };
return {
path: getNormalPath(props.basePath + '/' + routePath),
query: query
};
}
return getNormalPath(props.basePath + '/' + routePath);
};
+6 -7
View File
@@ -2,7 +2,7 @@
<div class="sidebar-shell" :class="{ 'has-logo': showLogo }" :style="{ backgroundColor: bgColor }">
<logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar :class="sideTheme" wrap-class="scrollbar-wrapper">
<transition :enter-active-class="proxy?.animate.menuSearchAnimate.enter" mode="out-in">
<transition :enter-active-class="animateConfig.menuSearchAnimate.enter" mode="out-in">
<el-menu
:default-active="activeMenu"
:collapse="isCollapse"
@@ -22,14 +22,13 @@
</template>
<script setup lang="ts">
import { RouteRecordRaw } from 'vue-router';
import animateConfig from '@/animate';
import { useAppStore } from '@/store/modules/app';
import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import Logo from './Logo.vue';
import SidebarItem from './SidebarItem.vue';
import { useAppStore } from '@/store/modules/app';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission';
import { RouteRecordRaw } from 'vue-router';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const appStore = useAppStore();
@@ -4,8 +4,8 @@
<script setup lang="ts">
import { login, callback } from '@/api/login';
import { setToken, getToken } from '@/utils/auth';
import { LoginData } from '@/api/types';
import { setToken, getToken } from '@/utils/auth';
const route = useRoute();
const loading = ref(true);
@@ -13,8 +13,7 @@ const emits = defineEmits(['scroll', 'updateArrows']);
const scrollContainerRef = ref<ElScrollbarInstance>();
const getScrollWrapper = (): HTMLElement | null => {
const scrollbar = scrollContainerRef.value as any;
return scrollbar?.wrapRef || scrollbar?.$refs?.wrapRef || null;
return scrollContainerRef.value?.wrapRef ?? null;
};
const emitScroll = () => {
+11 -11
View File
@@ -88,6 +88,7 @@
</template>
<script setup lang="ts">
import type { RouteLocationNormalized, RouteRecordRaw } from 'vue-router';
import {
ArrowDown,
ArrowLeft,
@@ -100,12 +101,12 @@ import {
RefreshRight,
Right
} from '@element-plus/icons-vue';
import ScrollPane from './ScrollPane.vue';
import { getNormalPath } from '@/utils/ruoyi';
import { useSettingsStore } from '@/store/modules/settings';
import tab from '@/plugins/tab';
import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import { useTagsViewStore } from '@/store/modules/tagsView';
import type { RouteLocationNormalized, RouteRecordRaw } from 'vue-router';
import { getNormalPath } from '@/utils/ruoyi';
import ScrollPane from './ScrollPane.vue';
const visible = ref(false);
const top = ref(0);
@@ -118,7 +119,6 @@ const isFullscreen = ref(false);
const scrollPaneRef = ref<InstanceType<typeof ScrollPane>>();
const fullscreenModeClass = 'tags-fullscreen-mode';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const router = useRouter();
const settingsStore = useSettingsStore();
@@ -267,7 +267,7 @@ const refreshSelectedTag = (view?: RouteLocationNormalized) => {
if (!view) {
return;
}
proxy?.$tab.refreshPage(view);
tab.refreshPage(view);
if (route.meta.link) {
tagsViewStore.delIframeView(route as RouteLocationNormalized);
}
@@ -277,7 +277,7 @@ const closeSelectedTag = (view?: RouteLocationNormalized) => {
if (!view) {
return;
}
proxy?.$tab.closePage(view).then(({ visitedViews }: { visitedViews: RouteLocationNormalized[] }) => {
tab.closePage(view).then(({ visitedViews }: { visitedViews: RouteLocationNormalized[] }) => {
if (isActive(view)) {
toLastView(visitedViews, view);
}
@@ -289,7 +289,7 @@ const closeRightTags = () => {
if (!tag) {
return;
}
proxy?.$tab.closeRightPage(tag).then((views: RouteLocationNormalized[]) => {
tab.closeRightPage(tag).then((views: RouteLocationNormalized[]) => {
if (!views.find(item => item.fullPath === route.fullPath)) {
toLastView(views);
}
@@ -301,7 +301,7 @@ const closeLeftTags = () => {
if (!tag) {
return;
}
proxy?.$tab.closeLeftPage(tag).then((views: RouteLocationNormalized[]) => {
tab.closeLeftPage(tag).then((views: RouteLocationNormalized[]) => {
if (!views.find(item => item.fullPath === route.fullPath)) {
toLastView(views);
}
@@ -314,13 +314,13 @@ const closeOthersTags = () => {
return;
}
router.push(tag.fullPath || tag.path || '/').catch(() => {});
proxy?.$tab.closeOtherPage(tag).then(() => {
tab.closeOtherPage(tag).then(() => {
moveToCurrentTag();
});
};
const closeAllTags = (view?: RouteLocationNormalized) => {
proxy?.$tab.closeAllPage().then(({ visitedViews: views }: { visitedViews: RouteLocationNormalized[] }) => {
tab.closeAllPage().then(({ visitedViews: views }: { visitedViews: RouteLocationNormalized[] }) => {
if (affixTags.value.some(tag => tag.path === route.path)) {
return;
}
+15 -14
View File
@@ -7,10 +7,10 @@
mode="horizontal"
>
<sidebar-item
:key="route.path + index"
v-for="(route, index) in topMenus"
:item="route"
:base-path="route.path"
:key="menuRoute.path + index"
v-for="(menuRoute, index) in topMenus"
:item="menuRoute"
:base-path="menuRoute.path"
popper-class="topbar-menu-popper"
/>
@@ -24,10 +24,10 @@
<span>更多菜单</span>
</template>
<sidebar-item
:key="route.path + index"
v-for="(route, index) in moreRoutes"
:item="route"
:base-path="route.path"
:key="menuRoute.path + index"
v-for="(menuRoute, index) in moreRoutes"
:item="menuRoute"
:base-path="menuRoute.path"
popper-class="topbar-menu-popper"
/>
</el-sub-menu>
@@ -35,9 +35,10 @@
</template>
<script setup lang="ts">
import SidebarItem from '../Sidebar/SidebarItem';
import { useSettingsStore } from '@/store/modules/settings';
import type { RouteRecordRaw } from 'vue-router';
import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import SidebarItem from '../Sidebar/SidebarItem.vue';
const route = useRoute();
const settingsStore = useSettingsStore();
@@ -53,11 +54,11 @@ const activeMenu = computed(() => {
});
const visibleNumber = ref(5);
const topMenus = computed(() => {
return permissionStore.sidebarRouters.filter(f => !f.hidden).slice(0, visibleNumber.value);
const topMenus = computed((): RouteRecordRaw[] => {
return permissionStore.sidebarRouters.filter(f => !f.hidden).slice(0, visibleNumber.value) as RouteRecordRaw[];
});
const moreRoutes = computed(() => {
return permissionStore.sidebarRouters.filter(f => !f.hidden).slice(visibleNumber.value);
const moreRoutes = computed((): RouteRecordRaw[] => {
return permissionStore.sidebarRouters.filter(f => !f.hidden).slice(visibleNumber.value) as RouteRecordRaw[];
});
function setVisibleNumber() {
let width = document.body.getBoundingClientRect().width;
+3 -3
View File
@@ -88,12 +88,12 @@
</template>
<script setup lang="ts" name="layoutBreadcrumbSearch">
import type { RouteRecordRaw } from 'vue-router';
import { Search } from '@element-plus/icons-vue';
import { getNormalPath } from '@/utils/ruoyi';
import { isHttp } from '@/utils/validate';
import { usePermissionStore } from '@/store/modules/permission';
import { useSettingsStore } from '@/store/modules/settings';
import type { RouteRecordRaw } from 'vue-router';
import { getNormalPath } from '@/utils/ruoyi';
import { isHttp } from '@/utils/validate';
type SearchMenuItem = {
path: string;
+2 -2
View File
@@ -29,10 +29,10 @@
</template>
<script setup lang="ts" name="layoutBreadcrumbUserNews">
import { useNoticeStore } from '@/store/modules/notice';
import router from '@/router';
import { markMessageRead, markMessageReadBatch } from '@/utils/message-read';
import { useNoticeStore } from '@/store/modules/notice';
import { useUserStore } from '@/store/modules/user';
import { markMessageRead, markMessageReadBatch } from '@/utils/message-read';
import { NOTICE_GROUP } from '@/utils/push-message';
const noticeStore = useNoticeStore();
+9 -5
View File
@@ -14,12 +14,12 @@
</template>
<script setup lang="ts">
import SideBar from './components/Sidebar/index.vue';
import { AppMain, Navbar, Settings, TagsView } from './components';
import { NavTypeEnum } from '@/enums/NavTypeEnum';
import { useAppStore } from '@/store/modules/app';
import { useSettingsStore } from '@/store/modules/settings';
import { NavTypeEnum } from '@/enums/NavTypeEnum';
import { initMessageBox, initPush } from '@/utils/push';
import { AppMain, Navbar, Settings, TagsView } from './components';
import SideBar from './components/Sidebar/index.vue';
const settingsStore = useSettingsStore();
const theme = computed(() => settingsStore.theme);
@@ -45,14 +45,18 @@ const classObj = computed(() => ({
const { width } = useWindowSize();
const WIDTH = 992; // refer to Bootstrap's responsive design
watch(width, (w) => {
watch(
width,
w => {
if (w - 1 < WIDTH) {
useAppStore().toggleDevice('mobile');
useAppStore().closeSideBar({ withoutAnimation: true });
} else {
useAppStore().toggleDevice('desktop');
}
}, { immediate: true });
},
{ immediate: true }
);
const settingRef = ref<InstanceType<typeof Settings>>();
+12 -31
View File
@@ -1,45 +1,27 @@
import HighLight from '@highlightjs/vue-plugin';
import { ElDialog } from 'element-plus';
import { createApp } from 'vue';
// global css
import VXETable from 'vxe-table';
import 'virtual:uno.css';
import 'element-plus/theme-chalk/dark/css-vars.css';
import '@/assets/styles/index.scss';
// App、router、store
import App from './App.vue';
import store from './store';
import router from './router';
// 自定义指令
import directive from './directive';
// 注册插件
import plugins from './plugins/index'; // plugins
// 高亮组件
// import 'highlight.js/styles/a11y-light.css';
import 'highlight.js/styles/atom-one-dark.css';
import 'highlight.js/lib/common';
import HighLight from '@highlightjs/vue-plugin';
// svg图标
import 'virtual:svg-icons-register';
import ElementIcons from '@/plugins/svgicon';
// permission control
import './permission';
// 国际化
import i18n from '@/lang/index';
// vxeTable
import VXETable from 'vxe-table';
import 'vxe-table/lib/style.css';
import i18n from '@/lang/index';
import ElementIcons from '@/plugins/svgicon';
import App from './App.vue';
import directive from './directive';
import plugins from './plugins/index';
import './permission';
import router from './router';
import store from './store';
VXETable.setConfig({
zIndex: 999999
});
// 修改 el-dialog 默认点击遮照为不关闭
import { ElDialog } from 'element-plus';
ElDialog.props.closeOnClickModal.default = false;
const app = createApp(App);
@@ -51,7 +33,6 @@ app.use(store);
app.use(i18n);
app.use(VXETable);
app.use(plugins);
// 自定义指令
directive(app);
app.mount('#app');
+7 -7
View File
@@ -1,14 +1,14 @@
import { to as tos } from 'await-to-js';
import router from './router';
import { ElMessage } from 'element-plus/es';
import * as NProgressModule from 'nprogress';
import 'nprogress/nprogress.css';
import { getToken } from '@/utils/auth';
import { isHttp, isPathMatch } from '@/utils/validate';
import { isRelogin } from '@/utils/request';
import { useUserStore } from '@/store/modules/user';
import { useSettingsStore } from '@/store/modules/settings';
import { usePermissionStore } from '@/store/modules/permission';
import { ElMessage } from 'element-plus/es';
import { useSettingsStore } from '@/store/modules/settings';
import { useUserStore } from '@/store/modules/user';
import { getToken } from '@/utils/auth';
import { isRelogin } from '@/utils/request';
import { isHttp, isPathMatch } from '@/utils/validate';
import router from './router';
const NProgress = ('default' in NProgressModule ? NProgressModule.default : NProgressModule) as typeof NProgressModule;
+6 -5
View File
@@ -1,10 +1,11 @@
import axios from 'axios';
import errorCode from '@/utils/errorCode';
import { blobValidate } from '@/utils/ruoyi';
import { extractErrorMessage, globalHeaders } from '@/utils/request';
import { saveBlob } from '@/utils/save';
import type { LoadingInstance } from 'element-plus';
import axiosModule from 'axios';
import errorCode from '@/utils/errorCode';
import { extractErrorMessage, globalHeaders } from '@/utils/request';
import { blobValidate } from '@/utils/ruoyi';
import { saveBlob } from '@/utils/save';
const axios = axiosModule as any;
const baseURL = import.meta.env.VITE_APP_BASE_API;
let downloadLoadingInstance: LoadingInstance | undefined;
export default {
+8 -33
View File
@@ -1,43 +1,18 @@
import type { App } from 'vue';
import auth from './auth';
import cache from './cache';
import download from './download';
import modal from './modal';
import tab from './tab';
import download from './download';
import cache from './cache';
import auth from './auth';
// 预设动画
import animate from '@/animate';
import { download as dl } from '@/utils/request';
import { useDict } from '@/utils/dict';
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
import { parseTime, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi';
import { App } from 'vue';
/**
* import API
* setup @/utils@/api
*/
export default function installPlugin(app: App) {
// 页签操作
app.config.globalProperties.$tab = tab;
// 模态框对象
app.config.globalProperties.$modal = modal;
// 缓存对象
app.config.globalProperties.$cache = cache;
// 下载文件
app.config.globalProperties.$download = download;
// 认证对象
app.config.globalProperties.$auth = auth;
// 全局方法挂载
app.config.globalProperties.useDict = useDict;
app.config.globalProperties.getConfigKey = getConfigKey;
app.config.globalProperties.updateConfigByKey = updateConfigByKey;
app.config.globalProperties.download = dl;
app.config.globalProperties.parseTime = parseTime;
app.config.globalProperties.handleTree = handleTree;
app.config.globalProperties.addDateRange = addDateRange;
app.config.globalProperties.selectDictLabel = selectDictLabel;
app.config.globalProperties.selectDictLabels = selectDictLabels;
app.config.globalProperties.animate = animate;
}
+1 -1
View File
@@ -1,5 +1,5 @@
import type { App } from 'vue';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import { App } from 'vue';
export default {
install: (app: App) => {
+4 -2
View File
@@ -1,5 +1,5 @@
import type { RouteLocationMatched, RouteLocationNormalized, RouteLocationRaw } from 'vue-router';
import router from '@/router';
import { RouteLocationMatched, RouteLocationNormalized, RouteLocationRaw } from 'vue-router';
import { useTagsViewStore } from '@/store/modules/tagsView';
export default {
@@ -57,7 +57,9 @@ export default {
): Promise<{ visitedViews: RouteLocationNormalized[]; cachedViews: string[] } | any> {
if (obj === undefined) {
// prettier-ignore
const { visitedViews } = await useTagsViewStore().delView(router.currentRoute.value)
const { visitedViews } = await useTagsViewStore().delView(
router.currentRoute.value,
);
const latestView = visitedViews.slice(-1)[0];
if (latestView) {
return router.push(latestView.fullPath);
+1 -1
View File
@@ -1,4 +1,4 @@
import { createWebHistory, createRouter, RouteRecordRaw } from 'vue-router';
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
/* Layout */
import Layout from '@/layout/index.vue';
+4 -4
View File
@@ -1,8 +1,8 @@
import zhCN from 'element-plus/es/locale/lang/zh-cn';
import enUS from 'element-plus/es/locale/lang/en';
import { defineStore } from 'pinia';
import { useStorage } from '@vueuse/core';
import { ref, reactive, computed } from 'vue';
import enUS from 'element-plus/es/locale/lang/en';
import zhCN from 'element-plus/es/locale/lang/zh-cn';
import { defineStore } from 'pinia';
import { computed, reactive, ref } from 'vue';
export const useAppStore = defineStore('app', () => {
const sidebarStatus = useStorage('sidebarStatus', '1');
+6 -6
View File
@@ -1,13 +1,13 @@
import type { RouteRecordRaw } from 'vue-router';
import { defineStore } from 'pinia';
import router, { constantRoutes, dynamicRoutes } from '@/router';
import store from '@/store';
import { ref } from 'vue';
import { getRouters } from '@/api/menu';
import auth from '@/plugins/auth';
import { RouteRecordRaw } from 'vue-router';
import Layout from '@/layout/index.vue';
import ParentView from '@/components/ParentView/index.vue';
import InnerLink from '@/layout/components/InnerLink/index.vue';
import { ref } from 'vue';
import Layout from '@/layout/index.vue';
import auth from '@/plugins/auth';
import router, { constantRoutes, dynamicRoutes } from '@/router';
import store from '@/store';
import { createCustomNameComponent } from '@/utils/createCustomNameComponent';
// 匹配views里面所有的.vue文件,预建查找表避免每次 O(n) 扫描
+3 -3
View File
@@ -1,9 +1,9 @@
import { defineStore } from 'pinia';
import defaultSettings from '@/settings';
import { useDynamicTitle } from '@/utils/dynamicTitle';
import { useStorage } from '@vueuse/core';
import { defineStore } from 'pinia';
import { ref } from 'vue';
import { NavTypeEnum } from '@/enums/NavTypeEnum';
import defaultSettings from '@/settings';
import { useDynamicTitle } from '@/utils/dynamicTitle';
export const useSettingsStore = defineStore('setting', () => {
const storageSetting = useStorage<LayoutSetting>('layout-setting', {
+14 -6
View File
@@ -1,10 +1,12 @@
import { to } from 'await-to-js';
import { getToken, removeToken, setToken } from '@/utils/auth';
import { login as loginApi, logout as logoutApi, getInfo as getUserInfo } from '@/api/login';
import { LoginData } from '@/api/types';
import defAva from '@/assets/images/profile.jpg';
import { defineStore } from 'pinia';
import { ref } from 'vue';
import type { UserInfo } from '@/api/system/user/types';
import type { LoginData, LoginResult } from '@/api/types';
import type { RuoYiAjaxResult } from '@/utils/api-types';
import { getInfo as getUserInfo, login as loginApi, logout as logoutApi } from '@/api/login';
import defAva from '@/assets/images/profile.jpg';
import { getToken, removeToken, setToken } from '@/utils/auth';
export const useUserStore = defineStore('user', () => {
const token = ref(getToken());
@@ -23,7 +25,10 @@ export const useUserStore = defineStore('user', () => {
const login = async (userInfo: LoginData): Promise<void> => {
const [err, res] = await to(loginApi(userInfo));
if (res) {
const data = res.data;
const data = (res as RuoYiAjaxResult<LoginResult>).data;
if (!data?.access_token) {
return Promise.reject(err);
}
setToken(data.access_token);
token.value = data.access_token;
return Promise.resolve();
@@ -35,7 +40,10 @@ export const useUserStore = defineStore('user', () => {
const getInfo = async (): Promise<void> => {
const [err, res] = await to(getUserInfo());
if (res) {
const data = res.data;
const data = (res as RuoYiAjaxResult<UserInfo>).data;
if (!data?.user) {
return Promise.reject(err);
}
const user = data.user;
const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar;
-1
View File
@@ -1,4 +1,3 @@
export {};
declare module 'axios' {
interface AxiosResponse<T = any> {
code: number;
+1 -2
View File
@@ -1,4 +1,4 @@
import type { PropType as VuePropType, ComponentInternalInstance as ComponentInstance } from 'vue';
import type { ComponentInternalInstance as ComponentInstance } from 'vue';
import { LanguageEnum } from '@/enums/LanguageEnum';
import { NavTypeEnum } from '@/enums/NavTypeEnum';
@@ -172,4 +172,3 @@ declare global {
dark: boolean;
}
}
export {};
+4 -21
View File
@@ -1,39 +1,22 @@
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
import download from '@/plugins/download';
import type { LanguageType } from '@/lang';
import auth from '@/plugins/auth';
import cache from '@/plugins/cache';
import animate from '@/animate';
import { useDict } from '@/utils/dict';
import { handleTree, addDateRange, selectDictLabel, selectDictLabels, parseTime } from '@/utils/ruoyi';
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
import { download as rd } from '@/utils/request';
import type { LanguageType } from '@/lang';
import download from '@/plugins/download';
import modal from '@/plugins/modal';
import tab from '@/plugins/tab';
declare module 'vue' {
interface ComponentCustomProperties {
// 全局方法声明
$modal: typeof modal;
$tab: typeof tab;
$download: typeof download;
$auth: typeof auth;
$cache: typeof cache;
animate: typeof animate;
/**
* i18n $t方法支持ts类型提示
* @param key i18n key
*/
$t(key: ObjKeysToUnion<LanguageType>): string;
useDict: typeof useDict;
addDateRange: typeof addDateRange;
download: typeof rd;
handleTree: typeof handleTree;
getConfigKey: typeof getConfigKey;
updateConfigByKey: typeof updateConfigByKey;
selectDictLabel: typeof selectDictLabel;
selectDictLabels: typeof selectDictLabels;
parseTime: typeof parseTime;
}
}
-2
View File
@@ -34,5 +34,3 @@ declare module 'vue-router' {
query?: LocationQuery;
}
}
export {};
+11
View File
@@ -0,0 +1,11 @@
/**
* `src/utils/request` resolve JSON `{ code, msg, data }`
* axios 1.13 + TS6 `axios` AxiosPromise
*/
export interface RuoYiAjaxResult<T = unknown> {
code?: number;
msg?: string;
data?: T;
}
export type AxiosPromise<T = unknown> = Promise<RuoYiAjaxResult<T>>;
+1
View File
@@ -1,4 +1,5 @@
import { JSEncrypt } from 'jsencrypt';
// 密钥对生成 http://web.chacuo.net/netrsakeypair
const publicKey = import.meta.env.VITE_APP_RSA_PUBLIC_KEY;
+1 -1
View File
@@ -16,7 +16,7 @@ export async function resolveOssContent(html: string): Promise<string> {
const matches = [...html.matchAll(OSS_MARKER_RE)];
if (matches.length === 0) return html;
const ossIds = [...new Set(matches.map((m) => m[1]))];
const ossIds = [...new Set(matches.map(m => m[1]))];
try {
const res = await listByIds(ossIds.join(','));
+2 -2
View File
@@ -1,5 +1,5 @@
import { CSSProperties } from 'vue';
import VueTypes, { createTypes, toValidableType, VueTypeValidableDef, VueTypesInterface } from 'vue-types';
import type { CSSProperties } from 'vue';
import VueTypes, { createTypes, toValidableType, type VueTypesInterface, type VueTypeValidableDef } from 'vue-types';
type PropTypes = VueTypesInterface & {
readonly style: VueTypeValidableDef<CSSProperties>;
+3 -3
View File
@@ -1,9 +1,9 @@
import { getMessageBox } from '@/api/system/message';
import { ElNotification } from 'element-plus';
import type { MessageVO } from '@/api/system/message/types';
import { getMessageBox } from '@/api/system/message';
import { useNoticeStore } from '@/store/modules/notice';
import { useUserStore } from '@/store/modules/user';
import { getToken } from '@/utils/auth';
import { ElNotification } from 'element-plus';
import { useNoticeStore } from '@/store/modules/notice';
import { isMessageRead } from '@/utils/message-read';
import { parsePushMessage, resolveNoticeGroup, resolveNoticeTitle, shouldAppendNotice } from '@/utils/push-message';
+46 -29
View File
@@ -1,16 +1,19 @@
import axios, { AxiosResponse, InternalAxiosRequestConfig } from 'axios';
import type { LoadingInstance } from 'element-plus';
import axiosModule from 'axios';
import { HttpStatus } from '@/enums/RespEnum';
import { getLanguage } from '@/lang';
import cache from '@/plugins/cache';
import router from '@/router';
import { useUserStore } from '@/store/modules/user';
import { getToken } from '@/utils/auth';
import { tansParams, blobValidate } from '@/utils/ruoyi';
import cache from '@/plugins/cache';
import { HttpStatus } from '@/enums/RespEnum';
import { decryptBase64, decryptWithAes, encryptBase64, encryptWithAes, generateAesKey } from '@/utils/crypto';
import { errorCode } from '@/utils/errorCode';
import { getLanguage } from '@/lang';
import { encryptBase64, encryptWithAes, generateAesKey, decryptWithAes, decryptBase64 } from '@/utils/crypto';
import { encrypt, decrypt } from '@/utils/jsencrypt';
import router from '@/router';
import { decrypt, encrypt } from '@/utils/jsencrypt';
import { blobValidate, tansParams } from '@/utils/ruoyi';
import { saveBlob } from '@/utils/save';
import type { LoadingInstance } from 'element-plus';
/** axios 1.13 + TS6:默认导出在类型上会被解析为不可调用的 export= 形态 */
const axios = axiosModule as any;
const encryptHeader = 'encrypt-key';
let downloadLoadingInstance: LoadingInstance | undefined;
@@ -95,7 +98,7 @@ const service = axios.create({
// 请求拦截器
service.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
(config: any) => {
// 对应国际化资源文件后缀
config.headers['Content-Language'] = getLanguage();
@@ -164,7 +167,7 @@ service.interceptors.request.use(
// 响应拦截器
service.interceptors.response.use(
(res: AxiosResponse) => {
(res: any) => {
if (import.meta.env.VITE_APP_ENCRYPT === 'true') {
// 加密后的 AES 秘钥
const keyStr = res.headers[encryptHeader];
@@ -193,21 +196,31 @@ service.interceptors.response.use(
// prettier-ignore
if (!isRelogin.show) {
isRelogin.show = true;
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
confirmButtonText: '重新登录',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
ElMessageBox.confirm(
"登录状态已过期,您可以继续留在该页面,或者重新登录",
"系统提示",
{
confirmButtonText: "重新登录",
cancelButtonText: "取消",
type: "warning",
},
)
.then(() => {
isRelogin.show = false;
useUserStore().logout().then(() => {
useUserStore()
.logout()
.then(() => {
router.replace({
path: '/login',
path: "/login",
query: {
redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/')
}
})
redirect: encodeURIComponent(
router.currentRoute.value.fullPath || "/",
),
},
});
}).catch(() => {
});
})
.catch(() => {
isRelogin.show = false;
});
}
@@ -238,15 +251,17 @@ export function download(url: string, params: any, fileName: string) {
background: 'rgba(0, 0, 0, 0.7)'
});
// prettier-ignore
return service.post(url, params, {
return service
.post(url, params, {
transformRequest: [
(params: any) => {
return tansParams(params);
}
},
],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob'
}).then(async (resp: any) => {
headers: { "Content-Type": "application/x-www-form-urlencoded" },
responseType: "blob",
})
.then(async (resp: any) => {
const isLogin = blobValidate(resp);
if (isLogin) {
const blob = new Blob([resp]);
@@ -255,11 +270,13 @@ export function download(url: string, params: any, fileName: string) {
const blob = new Blob([resp]);
const resText = await blob.text();
const rspObj = JSON.parse(resText);
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'];
const errMsg =
errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
ElMessage.error(errMsg);
}
downloadLoadingInstance?.close();
}).catch((r: any) => {
})
.catch((r: any) => {
console.error(r);
downloadLoadingInstance?.close();
});
+4 -7
View File
@@ -8,16 +8,13 @@ const easeInOutQuad = (t: number, b: number, c: number, d: number) => {
};
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
const requestAnimFrame = (function () {
return (
const requestAnimFrame = (() =>
window.requestAnimationFrame ||
(window as any).webkitRequestAnimationFrame ||
(window as any).mozRequestAnimationFrame ||
function (callback) {
(callback => {
window.setTimeout(callback, 1000 / 60);
}
);
})();
}))();
/**
* Because it's so fucking difficult to detect the scrolling element, just move them all
@@ -46,7 +43,7 @@ export const scrollTo = (to: number, duration: number, callback?: any) => {
const increment = 20;
let currentTime = 0;
duration = typeof duration === 'undefined' ? 500 : duration;
const animateScroll = function () {
const animateScroll = () => {
// increment the time
currentTime += increment;
// find the value with the quadratic in-out easing function
+6 -8
View File
@@ -138,8 +138,8 @@
<script setup name="Demo" lang="ts">
import { listDemo, getDemo, delDemo, addDemo, updateDemo } from '@/api/demo/demo';
import { DemoVO, DemoQuery, DemoForm } from '@/api/demo/demo/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import modal from '@/plugins/modal';
import { download as requestDownload } from '@/utils/request';
const demoList = ref<DemoVO[]>([]);
const buttonLoading = ref(false);
@@ -256,7 +256,7 @@ const submitForm = () => {
} else {
await addDemo(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('修改成功');
modal.msgSuccess('修改成功');
dialog.visible = false;
await getList();
}
@@ -266,17 +266,15 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: DemoVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal
.confirm('是否确认删除测试单编号为"' + _ids + '"的数据项?')
.finally(() => (loading.value = false));
await modal.confirm('是否确认删除测试单编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delDemo(_ids);
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(
requestDownload(
'demo/demo/export',
{
...queryParams.value
+7 -7
View File
@@ -116,6 +116,8 @@
<script setup name="Tree" lang="ts">
import { listTree, getTree, delTree, addTree, updateTree } from '@/api/demo/tree';
import { TreeVO, TreeQuery, TreeForm } from '@/api/demo/tree/types';
import modal from '@/plugins/modal';
import { handleTree } from '@/utils/ruoyi';
type TreeOption = {
id: number;
@@ -123,8 +125,6 @@ type TreeOption = {
children?: TreeOption[];
};
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const treeList = ref<TreeVO[]>([]);
const treeOptions = ref<TreeOption[]>([]);
const buttonLoading = ref(false);
@@ -172,7 +172,7 @@ const { queryParams, form, rules } = toRefs(data);
const getList = async () => {
loading.value = true;
const res = await listTree(queryParams.value);
const data = proxy?.handleTree<TreeVO>(res.data, 'id', 'parentId');
const data = handleTree<TreeVO>(res.data, 'id', 'parentId');
if (data) {
treeList.value = data;
loading.value = false;
@@ -184,7 +184,7 @@ const getTreeselect = async () => {
const res = await listTree();
treeOptions.value = [];
const data: TreeOption = { id: 0, treeName: '顶级节点', children: [] };
data.children = proxy?.handleTree<TreeOption>(res.data, 'id', 'parentId');
data.children = handleTree<TreeOption>(res.data, 'id', 'parentId');
treeOptions.value.push(data);
};
@@ -261,7 +261,7 @@ const submitForm = () => {
} else {
await addTree(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
modal.msgSuccess('操作成功');
dialog.visible = false;
await getList();
}
@@ -270,11 +270,11 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row: TreeVO) => {
await proxy?.$modal.confirm('是否确认删除测试树编号为"' + row.id + '"的数据项?');
await modal.confirm('是否确认删除测试树编号为"' + row.id + '"的数据项?');
loading.value = true;
await delTree(row.id).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('删除成功');
modal.msgSuccess('删除成功');
};
onMounted(() => {
+6 -4
View File
@@ -20,17 +20,19 @@
</template>
<script setup lang="ts">
import { useRoute, useRouter } from 'vue-router';
import errImage from '@/assets/401_images/401.gif';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute();
const router = useRouter();
const errGif = ref(errImage + '?' + +new Date());
function back() {
if (proxy?.$route.query.noGoBack) {
proxy.$router.push({ path: '/' });
if (route.query.noGoBack) {
router.push({ path: '/' });
} else {
proxy?.$router.go(-1);
router.go(-1);
}
}
</script>
+2 -6
View File
@@ -129,9 +129,7 @@ const goTarget = (url: string) => {
grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
gap: 18px;
padding: 30px;
background:
radial-gradient(circle at top left, rgba(53, 109, 255, 0.16), transparent 30%),
var(--app-surface-bg);
background: radial-gradient(circle at top left, rgba(53, 109, 255, 0.16), transparent 30%), var(--app-surface-bg);
}
.hero-copy {
@@ -366,9 +364,7 @@ const goTarget = (url: string) => {
:global(html.dark) {
.hero-panel {
background:
radial-gradient(circle at top left, rgba(53, 109, 255, 0.18), transparent 30%),
var(--app-surface-bg);
background: radial-gradient(circle at top left, rgba(53, 109, 255, 0.18), transparent 30%), var(--app-surface-bg);
}
}
</style>
+36 -21
View File
@@ -36,7 +36,7 @@
type="text"
size="large"
auto-complete="off"
:placeholder="proxy.$t('login.username')"
:placeholder="$t('login.username')"
>
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
</el-input>
@@ -48,7 +48,7 @@
type="password"
size="large"
auto-complete="off"
:placeholder="proxy.$t('login.password')"
:placeholder="$t('login.password')"
@keyup.enter="handleLogin"
>
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
@@ -60,7 +60,7 @@
v-model="loginForm.code"
size="large"
auto-complete="off"
:placeholder="proxy.$t('login.code')"
:placeholder="$t('login.code')"
@keyup.enter="handleLogin"
>
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
@@ -71,28 +71,28 @@
</el-form-item>
<div class="form-meta">
<el-checkbox v-model="loginForm.rememberMe">{{ proxy.$t('login.rememberPassword') }}</el-checkbox>
<el-checkbox v-model="loginForm.rememberMe">{{ $t('login.rememberPassword') }}</el-checkbox>
<router-link v-if="register" class="link-type" :to="'/register'">
{{ proxy.$t('login.switchRegisterPage') }}
{{ $t('login.switchRegisterPage') }}
</router-link>
</div>
<div class="social-panel">
<span class="social-label">第三方登录</span>
<div class="social-actions">
<el-button circle :title="proxy.$t('login.social.wechat')" @click="doSocialLogin('wechat')">
<el-button circle :title="$t('login.social.wechat')" @click="doSocialLogin('wechat')">
<svg-icon icon-class="wechat" />
</el-button>
<el-button circle :title="proxy.$t('login.social.maxkey')" @click="doSocialLogin('maxkey')">
<el-button circle :title="$t('login.social.maxkey')" @click="doSocialLogin('maxkey')">
<svg-icon icon-class="maxkey" />
</el-button>
<el-button circle :title="proxy.$t('login.social.topiam')" @click="doSocialLogin('topiam')">
<el-button circle :title="$t('login.social.topiam')" @click="doSocialLogin('topiam')">
<svg-icon icon-class="topiam" />
</el-button>
<el-button circle :title="proxy.$t('login.social.gitee')" @click="doSocialLogin('gitee')">
<el-button circle :title="$t('login.social.gitee')" @click="doSocialLogin('gitee')">
<svg-icon icon-class="gitee" />
</el-button>
<el-button circle :title="proxy.$t('login.social.github')" @click="doSocialLogin('github')">
<el-button circle :title="$t('login.social.github')" @click="doSocialLogin('github')">
<svg-icon icon-class="github" />
</el-button>
</div>
@@ -100,8 +100,8 @@
<el-form-item class="submit-row">
<el-button :loading="loading" size="large" type="primary" class="submit-button" @click.prevent="handleLogin">
<span v-if="!loading">{{ proxy.$t('login.login') }}</span>
<span v-else>{{ proxy.$t('login.logging') }}</span>
<span v-if="!loading">{{ $t('login.login') }}</span>
<span v-else>{{ $t('login.logging') }}</span>
</el-button>
</el-form-item>
</el-form>
@@ -114,15 +114,13 @@
</template>
<script setup lang="ts">
import { to } from 'await-to-js';
import { useI18n } from 'vue-i18n';
import { getCodeImg } from '@/api/login';
import { authRouterUrl } from '@/api/system/social/auth';
import { useUserStore } from '@/store/modules/user';
import { LoginData } from '@/api/types';
import { to } from 'await-to-js';
import { HttpStatus } from '@/enums/RespEnum';
import { useI18n } from 'vue-i18n';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { useUserStore } from '@/store/modules/user';
const title = import.meta.env.VITE_APP_TITLE;
const currentYear = new Date().getFullYear();
@@ -145,9 +143,27 @@ const loginForm = ref<LoginData>({
} as LoginData);
const loginRules: ElFormRules = {
username: [{ required: true, trigger: 'blur', message: t('login.rule.username.required') }],
password: [{ required: true, trigger: 'blur', message: t('login.rule.password.required') }],
code: [{ required: true, trigger: 'change', message: t('login.rule.code.required') }]
username: [
{
required: true,
trigger: 'blur',
message: t('login.rule.username.required')
}
],
password: [
{
required: true,
trigger: 'blur',
message: t('login.rule.password.required')
}
],
code: [
{
required: true,
trigger: 'change',
message: t('login.rule.code.required')
}
]
};
const codeUrl = ref('');
@@ -561,5 +577,4 @@ onMounted(() => {
grid-template-columns: 1fr;
}
}
</style>

Some files were not shown because too many files have changed in this diff Show More