45 changed files with 1850 additions and 374 deletions
@ -1,3 +1,4 @@ |
|||||||
VITE_BASE_API = '/remoteServer/admin-api/' |
VITE_BASE_API = '/remoteServer/admin-api/' |
||||||
|
VITE_BASE_API_SYSTEM = '/remote/admin-api/system/' |
||||||
VITE_SHOW_ONLINE_DEVICE = true |
VITE_SHOW_ONLINE_DEVICE = true |
||||||
VITE_BASE_URL = 'http://43.140.245.32:48081' |
VITE_BASE_URL = 'http://43.140.245.32:48089' |
||||||
@ -1,24 +0,0 @@ |
|||||||
{ |
|
||||||
"channel": [ |
|
||||||
{ |
|
||||||
"name": "名称,唯一标识不可重复,不能为中文或特殊符号,长度32字节", |
|
||||||
"ip": "设备IP地址,字符串", |
|
||||||
"port": "端口号,整形数字,0~65535,一般为502" |
|
||||||
}, |
|
||||||
{ |
|
||||||
"name": "modbustcp_ch1", |
|
||||||
"ip": "192.168.10.123", |
|
||||||
"port": 502 |
|
||||||
}, |
|
||||||
{ |
|
||||||
"name": "xxxx", |
|
||||||
"ip": "192.168.10.133", |
|
||||||
"port": 1502 |
|
||||||
}, |
|
||||||
{ |
|
||||||
"name": "xxxxxx", |
|
||||||
"ip": "192.168.10.143", |
|
||||||
"port": 2502 |
|
||||||
} |
|
||||||
] |
|
||||||
} |
|
||||||
@ -1,34 +0,0 @@ |
|||||||
{ |
|
||||||
"dev": [ |
|
||||||
{ |
|
||||||
"name": "名称,唯一标识不可重复,不能为中文或特殊符号,长度32字节", |
|
||||||
"ch": "所在通道名称,特指ModbusRtu通道的名称,字符串", |
|
||||||
"point": "使用点表名称,特指Modbus点表的名称,字符串", |
|
||||||
"addr": "站地址,字符串,0 ~ 255" |
|
||||||
}, |
|
||||||
{ |
|
||||||
"name": "xxxx1", |
|
||||||
"ch": "modbustcp_ch1", |
|
||||||
"point": "pcs", |
|
||||||
"addr": "1" |
|
||||||
}, |
|
||||||
{ |
|
||||||
"name": "xxxx2", |
|
||||||
"ch": "modbustcp_ch1", |
|
||||||
"point": "pcs", |
|
||||||
"addr": "2" |
|
||||||
}, |
|
||||||
{ |
|
||||||
"name": "xxxx3", |
|
||||||
"ch": "xxxx", |
|
||||||
"point": "bms", |
|
||||||
"addr": "1" |
|
||||||
}, |
|
||||||
{ |
|
||||||
"name": "xxxx4", |
|
||||||
"ch": "xxxxxx", |
|
||||||
"point": "tms", |
|
||||||
"addr": "1" |
|
||||||
} |
|
||||||
] |
|
||||||
} |
|
||||||
@ -1,22 +0,0 @@ |
|||||||
{ |
|
||||||
"name": "工程名xxxx", |
|
||||||
"commun_channel": { |
|
||||||
"通讯通道类型,固定如下": "通讯通道配置文件路径", |
|
||||||
"modbustcp": "commun_channel_moebustcp.json" |
|
||||||
}, |
|
||||||
"commun_dev": { |
|
||||||
"通讯设备类型,固定如下": "通讯设备配置文件路径", |
|
||||||
"modbustcp": "commun_dev_moebustcp.json" |
|
||||||
}, |
|
||||||
"point_table": { |
|
||||||
"通讯点表类型,固定如下": { |
|
||||||
"名称": "路径" |
|
||||||
}, |
|
||||||
"modbus": { |
|
||||||
"modbus点表名称,自定义,非中文、非特殊字符,32字节": "modbus点表文件路径", |
|
||||||
"pcs2": "point_table_modbus_01.json", |
|
||||||
"bms": "point_table_modbus_02.json", |
|
||||||
"tms": "point_table_modbus_03.json" |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,61 +0,0 @@ |
|||||||
{ |
|
||||||
"name": "p12312cs", |
|
||||||
"point": [ |
|
||||||
[ |
|
||||||
"点起始地址,进制字符串, 范围 0x0000~0xFFFF 或 0~65535", |
|
||||||
"点数量,字符串, 范围 0x0001~0x10000 或 1~65536", |
|
||||||
"功能码,字符串,可选项: '0x01' '0x02' '0x03' '0x04' 或 '1' '2' '3' '4'", |
|
||||||
"数据类型,字符串,可选 'U16' 'S16' 'U32' 'S32'", |
|
||||||
"点读取周期ms,整形数字,-1时标志该点位未启用", |
|
||||||
"点位段名称,字符串,可设为空字符串" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0001", |
|
||||||
"0x0010", |
|
||||||
"0x03", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称1" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0100", |
|
||||||
"0x0020", |
|
||||||
"0x03", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称2" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0120", |
|
||||||
"0x0020", |
|
||||||
"0x03", |
|
||||||
"U32", |
|
||||||
1000, |
|
||||||
"" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0000", |
|
||||||
"0x0020", |
|
||||||
"0x04", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0020", |
|
||||||
"0x0010", |
|
||||||
"0x04", |
|
||||||
"U32", |
|
||||||
1000, |
|
||||||
"-" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0040", |
|
||||||
"0x0020", |
|
||||||
"0x04", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称" |
|
||||||
] |
|
||||||
] |
|
||||||
} |
|
||||||
@ -1,61 +0,0 @@ |
|||||||
{ |
|
||||||
"name": "xxxx", |
|
||||||
"point": [ |
|
||||||
[ |
|
||||||
"点起始地址,进制字符串, 范围 0x0000~0xFFFF 或 0~65535", |
|
||||||
"点数量,字符串, 范围 0x0001~0x10000 或 1~65536", |
|
||||||
"功能码,字符串,可选项: '0x01' '0x02' '0x03' '0x04' 或 '1' '2' '3' '4'", |
|
||||||
"数据类型,字符串,可选 'U16' 'S16' 'U32' 'S32'", |
|
||||||
"点读取周期ms,整形数字,-1时标志该点位未启用", |
|
||||||
"点位段名称,字符串,可设为空字符串" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0001", |
|
||||||
"0x0010", |
|
||||||
"0x03", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称1" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0100", |
|
||||||
"0x0020", |
|
||||||
"0x03", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称2" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0120", |
|
||||||
"0x0020", |
|
||||||
"0x03", |
|
||||||
"U32", |
|
||||||
1000, |
|
||||||
"" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0000", |
|
||||||
"0x0020", |
|
||||||
"0x04", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0020", |
|
||||||
"0x0010", |
|
||||||
"0x04", |
|
||||||
"U32", |
|
||||||
1000, |
|
||||||
"-" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0040", |
|
||||||
"0x0020", |
|
||||||
"0x04", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称" |
|
||||||
] |
|
||||||
] |
|
||||||
} |
|
||||||
@ -1,61 +0,0 @@ |
|||||||
{ |
|
||||||
"name": "xxxx", |
|
||||||
"point": [ |
|
||||||
[ |
|
||||||
"点起始地址,进制字符串, 范围 0x0000~0xFFFF 或 0~65535", |
|
||||||
"点数量,字符串, 范围 0x0001~0x10000 或 1~65536", |
|
||||||
"功能码,字符串,可选项: '0x01' '0x02' '0x03' '0x04' 或 '1' '2' '3' '4'", |
|
||||||
"数据类型,字符串,可选 'U16' 'S16' 'U32' 'S32'", |
|
||||||
"点读取周期ms,整形数字,-1时标志该点位未启用", |
|
||||||
"点位段名称,字符串,可设为空字符串" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0001", |
|
||||||
"0x0010", |
|
||||||
"0x03", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称1" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0100", |
|
||||||
"0x0020", |
|
||||||
"0x03", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称2" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0120", |
|
||||||
"0x0020", |
|
||||||
"0x03", |
|
||||||
"U32", |
|
||||||
1000, |
|
||||||
"" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0000", |
|
||||||
"0x0020", |
|
||||||
"0x04", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0020", |
|
||||||
"0x0010", |
|
||||||
"0x04", |
|
||||||
"U32", |
|
||||||
1000, |
|
||||||
"-" |
|
||||||
], |
|
||||||
[ |
|
||||||
"0x0040", |
|
||||||
"0x0020", |
|
||||||
"0x04", |
|
||||||
"U16", |
|
||||||
1000, |
|
||||||
"点位段名称" |
|
||||||
] |
|
||||||
] |
|
||||||
} |
|
||||||
@ -1,53 +0,0 @@ |
|||||||
|
|
||||||
|
|
||||||
## 创建工程 |
|
||||||
|
|
||||||
填写工程名,用户自定义输入 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 通讯点表 |
|
||||||
|
|
||||||
1. 展示目前工程中已有的通讯点表 |
|
||||||
|
|
||||||
2. 导入新的通讯点表 |
|
||||||
|
|
||||||
``` |
|
||||||
自定义名称:设置点表自定义名字,用户自定义输入,需检查唯一性,禁止中文、特殊字符 |
|
||||||
通讯点表类型:通过下拉菜单选择,目前只支持ModbusTcp(预留支持其他类型,不同类型的点表需要分类保存) |
|
||||||
``` |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 通讯通道 |
|
||||||
|
|
||||||
1. 展示目前工程中已有的通讯通道 |
|
||||||
|
|
||||||
2. 创建新的通讯通道 |
|
||||||
|
|
||||||
``` |
|
||||||
自定义名称:设置通讯通道自定义名字,用户自定义输入,需检查唯一性,禁止中文、特殊字符 |
|
||||||
通讯通道类型:通过下拉菜单选择,目前只支持ModbusTcp(预留支持其他类型,不同类型的通讯通道分类保存) |
|
||||||
设备IP地址:用户自定义输入,须符合IP地址的格式,如192.168.10.123 |
|
||||||
设备端口:用户自定义输入,范围0~65535,一般为502 |
|
||||||
``` |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 通讯设备 |
|
||||||
|
|
||||||
1. 展示目前工程中已有的通讯设备 |
|
||||||
|
|
||||||
2. 创建新的通讯设备 |
|
||||||
|
|
||||||
``` |
|
||||||
自定义名称:设置通讯设备自定义名字,用户自定义输入,需检查唯一性,禁止中文、特殊字符 |
|
||||||
通讯设备类型:通过下拉菜单选择,目前只支持ModbusTcp(预留支持其他类型,不同类型的通讯设备分类保存) |
|
||||||
通讯通道选择:通过下拉菜单选择,选项为已选择的类型(目前只有ModbusTcp)的所有通讯通道(是否支持在此处新建通道) |
|
||||||
通讯点表选择:通过下拉菜单选择,选项为已选择的类型(目前只有ModbusTcp)的所有通讯点表(是否支持在此处新建点表) |
|
||||||
通讯地址:用户自定义输入通讯站地址,范围0~255,一般为1 |
|
||||||
``` |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,57 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
export interface DeptVO { |
||||||
|
id?: number |
||||||
|
name: string |
||||||
|
parentId: number |
||||||
|
status: number |
||||||
|
sort: number |
||||||
|
leaderUserId: number |
||||||
|
phone: string |
||||||
|
email: string |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
// 查询部门(精简)列表
|
||||||
|
export const getSimpleDeptList = async () => |
||||||
|
systemServer<DeptVO[]>({ |
||||||
|
url: '/dept/simple-list', |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询部门列表
|
||||||
|
export const getDeptPage = async (params: PageParam) => |
||||||
|
systemServer({ |
||||||
|
url: '/dept/page', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询部门详情
|
||||||
|
export const getDept = async (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/dept/get?id=' + id, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 新增部门
|
||||||
|
export const createDept = async (data: DeptVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/dept/create', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改部门
|
||||||
|
export const updateDept = async (params: DeptVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/dept/update', |
||||||
|
method: 'put', |
||||||
|
data: params, |
||||||
|
}) |
||||||
|
|
||||||
|
// 删除部门
|
||||||
|
export const deleteDept = async (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/dept/delete?id=' + id, |
||||||
|
method: 'delete', |
||||||
|
}) |
||||||
@ -0,0 +1,68 @@ |
|||||||
|
|
||||||
|
import { systemServer } from '../../index' |
||||||
|
|
||||||
|
export type DictDataVO = { |
||||||
|
id: number | undefined |
||||||
|
sort: number | undefined |
||||||
|
label: string |
||||||
|
value: string |
||||||
|
dictType: string |
||||||
|
status: number |
||||||
|
colorType: string |
||||||
|
cssClass: string |
||||||
|
remark: string |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
// 查询字典数据(精简)列表
|
||||||
|
export const getSimpleDictDataList = () => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-data/simple-list', |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询字典数据列表
|
||||||
|
export const getDictDataPage = (params: PageParam) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-data/page', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
}) |
||||||
|
// 查询字典数据详情
|
||||||
|
export const getDictData = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-data/get?id=' + id, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 新增字典数据
|
||||||
|
export const createDictData = (data: DictDataVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-data/create', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改字典数据
|
||||||
|
export const updateDictData = (data: DictDataVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-data/update', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 删除字典数据
|
||||||
|
export const deleteDictData = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-data/delete?id=' + id, |
||||||
|
method: 'delete', |
||||||
|
}) |
||||||
|
|
||||||
|
// 导出字典类型数据
|
||||||
|
export const exportDictData = (params:any) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-data/export', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
responseType: 'blob', |
||||||
|
}) |
||||||
@ -0,0 +1,65 @@ |
|||||||
|
|
||||||
|
import { systemServer } from '../../index' |
||||||
|
|
||||||
|
export type DictTypeVO = { |
||||||
|
id: number | undefined |
||||||
|
name: string |
||||||
|
type: string |
||||||
|
status: number |
||||||
|
remark: string |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
// 查询字典(精简)列表
|
||||||
|
export const getSimpleDictTypeList = () => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-type/list-all-simple', |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询字典列表
|
||||||
|
export const getDictTypePage = (params: PageParam) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-type/page', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询字典详情
|
||||||
|
export const getDictType = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-type/get?id=' + id, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 新增字典
|
||||||
|
export const createDictType = (data: DictTypeVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-type/create', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改字典
|
||||||
|
export const updateDictType = (data: DictTypeVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-type/update', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 删除字典
|
||||||
|
export const deleteDictType = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-type/delete?id=' + id, |
||||||
|
method: 'delete', |
||||||
|
}) |
||||||
|
|
||||||
|
// 导出字典类型
|
||||||
|
export const exportDictType = (params: any) => |
||||||
|
systemServer({ |
||||||
|
url: '/dict-type/export', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
responseType: 'blob', |
||||||
|
}) |
||||||
@ -0,0 +1,50 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
export interface FilePageReqVO extends PageParam { |
||||||
|
path?: string |
||||||
|
type?: string |
||||||
|
createTime?: Date[] |
||||||
|
} |
||||||
|
|
||||||
|
// 文件预签名地址 Response VO
|
||||||
|
export interface FilePresignedUrlRespVO { |
||||||
|
// 文件配置编号
|
||||||
|
configId: number |
||||||
|
// 文件上传 URL
|
||||||
|
uploadUrl: string |
||||||
|
// 文件 URL
|
||||||
|
url: string |
||||||
|
} |
||||||
|
|
||||||
|
// 查询文件列表
|
||||||
|
export const getFilePage = (params: FilePageReqVO) => { |
||||||
|
return systemServer({ url: '/infra/file/page', params, method: 'get' }) |
||||||
|
} |
||||||
|
|
||||||
|
// 删除文件
|
||||||
|
export const deleteFile = (id: number) => { |
||||||
|
return systemServer({ url: '/infra/file/delete?id=' + id, method: 'delete' }) |
||||||
|
} |
||||||
|
|
||||||
|
// 获取文件预签名地址
|
||||||
|
export const getFilePresignedUrl = (path: string) => { |
||||||
|
return systemServer<FilePresignedUrlRespVO>({ |
||||||
|
url: '/infra/file/presigned-url', |
||||||
|
params: { path }, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
// 创建文件
|
||||||
|
export const createFile = (data: any) => { |
||||||
|
return systemServer({ url: '/infra/file/create', data, method: 'post' }) |
||||||
|
} |
||||||
|
|
||||||
|
// 上传文件
|
||||||
|
export const updateFile = (data: any) => { |
||||||
|
return systemServer({ |
||||||
|
url: '/infra/file/upload', |
||||||
|
data, |
||||||
|
method: 'post', |
||||||
|
headers: { 'Content-Type': 'multipart/form-data' }, |
||||||
|
}) |
||||||
|
} |
||||||
@ -0,0 +1,106 @@ |
|||||||
|
import { getRefreshToken } from '@/utils/auth' |
||||||
|
import { systemServer } from '../../index' |
||||||
|
|
||||||
|
type UserLoginVO = { |
||||||
|
username: string |
||||||
|
password: string |
||||||
|
captchaVerification: string |
||||||
|
socialType?: string |
||||||
|
socialCode?: string |
||||||
|
socialState?: string |
||||||
|
} |
||||||
|
|
||||||
|
export interface LoginRequestData { |
||||||
|
username: string |
||||||
|
password: string |
||||||
|
// tenantName: string
|
||||||
|
// captchaVerification: string
|
||||||
|
// rememberMe: boolean
|
||||||
|
} |
||||||
|
export interface SmsCodeVO { |
||||||
|
mobile: string |
||||||
|
scene: number |
||||||
|
} |
||||||
|
|
||||||
|
export interface SmsLoginVO { |
||||||
|
mobile: string |
||||||
|
code: string |
||||||
|
} |
||||||
|
interface LoginResponse { |
||||||
|
accessToken: string |
||||||
|
expiresTime: number |
||||||
|
refreshToken: string |
||||||
|
userId: number |
||||||
|
} |
||||||
|
|
||||||
|
export const getTenantId = (name: string) => |
||||||
|
systemServer<number>({ |
||||||
|
url: '/tenant/get-id-by-name', |
||||||
|
method: 'get', |
||||||
|
params: { |
||||||
|
name, |
||||||
|
}, |
||||||
|
}) |
||||||
|
|
||||||
|
export const login = (data: any) => |
||||||
|
systemServer<LoginResponse>({ |
||||||
|
method: 'post', |
||||||
|
url: '/auth/login', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 刷新访问令牌
|
||||||
|
export const refreshToken = () => |
||||||
|
systemServer({ |
||||||
|
url: '/auth/refresh-token?refreshToken=' + getRefreshToken(), |
||||||
|
method: 'post', |
||||||
|
}) |
||||||
|
|
||||||
|
// // 使用租户域名,获得租户信息
|
||||||
|
// export const getTenantByWebsite = (website: string) => {
|
||||||
|
// return request.get({ url: '/tenant/get-by-website?website=' + website })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 登出
|
||||||
|
export const loginOut = () => systemServer({ url: '/auth/logout', method: 'post' }) |
||||||
|
|
||||||
|
export const getInfo = () => |
||||||
|
systemServer({ url: '/auth/get-permission-info', method: 'get' }) |
||||||
|
|
||||||
|
// //获取登录验证码
|
||||||
|
export const sendSmsCode = (data: SmsCodeVO) => { |
||||||
|
return systemServer({ url: '/auth/send-sms-code', method: 'post', data }) |
||||||
|
} |
||||||
|
|
||||||
|
// // 短信验证码登录
|
||||||
|
export const smsLogin = (data: SmsLoginVO) => { |
||||||
|
return systemServer({ url: '/auth/sms-login', method: 'post', data }) |
||||||
|
} |
||||||
|
|
||||||
|
// // 社交快捷登录,使用 code 授权码
|
||||||
|
// export function socialLogin(type: string, code: string, state: string) {
|
||||||
|
// return request.post({
|
||||||
|
// url: '/auth/social-login',
|
||||||
|
// data: {
|
||||||
|
// type,
|
||||||
|
// code,
|
||||||
|
// state
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 社交授权的跳转
|
||||||
|
// export const socialAuthRedirect = (type: number, redirectUri: string) => {
|
||||||
|
// return request.get({
|
||||||
|
// url: '/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// // 获取验证图片以及 token
|
||||||
|
// export const getCode = (data) => {
|
||||||
|
// return request.postOriginal({ url: 'system/captcha/get', data })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 滑动或者点选验证
|
||||||
|
// export const reqCheck = (data) => {
|
||||||
|
// return request.postOriginal({ url: 'system/captcha/check', data })
|
||||||
|
// }
|
||||||
@ -0,0 +1,33 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
export interface LoginLogVO { |
||||||
|
id: number |
||||||
|
logType: number |
||||||
|
traceId: number |
||||||
|
userId: number |
||||||
|
userType: number |
||||||
|
username: string |
||||||
|
result: number |
||||||
|
status: number |
||||||
|
userIp: string |
||||||
|
userAgent: string |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
// 查询登录日志列表
|
||||||
|
export const getLoginLogPage = (params: PageParam) => { |
||||||
|
return systemServer({ |
||||||
|
url: '/login-log/page', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
// 导出登录日志
|
||||||
|
export const exportLoginLog = (params: any) => { |
||||||
|
return systemServer({ |
||||||
|
url: '/login-log/export', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
responseType: 'blob', |
||||||
|
}) |
||||||
|
} |
||||||
@ -0,0 +1,63 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
export interface MenuVO { |
||||||
|
id: number |
||||||
|
name: string |
||||||
|
permission: string |
||||||
|
type: number |
||||||
|
sort: number |
||||||
|
parentId: number |
||||||
|
path: string |
||||||
|
icon: string |
||||||
|
component: string |
||||||
|
componentName?: string |
||||||
|
status: number |
||||||
|
visible: boolean |
||||||
|
keepAlive: boolean |
||||||
|
alwaysShow?: boolean |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
// 查询菜单(精简)列表
|
||||||
|
export const getSimpleMenusList = () => |
||||||
|
systemServer({ |
||||||
|
url: '/menu/simple-list', |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询菜单列表
|
||||||
|
export const getMenuList = (params: any) => |
||||||
|
systemServer({ |
||||||
|
url: '/menu/list', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
}) |
||||||
|
|
||||||
|
// 获取菜单详情
|
||||||
|
export const getMenu = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/menu/get?id=' + id, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 新增菜单
|
||||||
|
export const createMenu = (data: MenuVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/menu/create', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改菜单
|
||||||
|
export const updateMenu = (data: MenuVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/menu/update', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 删除菜单
|
||||||
|
export const deleteMenu = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/menu/delete?id=' + id, |
||||||
|
method: 'delete', |
||||||
|
}) |
||||||
@ -0,0 +1,51 @@ |
|||||||
|
|
||||||
|
import { systemServer } from '../../index' |
||||||
|
|
||||||
|
export enum Action { |
||||||
|
//用户个人操作
|
||||||
|
USER_LOGIN = '登录', |
||||||
|
USER_LOGOUT = '登出', |
||||||
|
//用户管理
|
||||||
|
USERMGR_ADD = '添加用户', |
||||||
|
USERMGR_DEL = '删除用户', |
||||||
|
USERMGR_MODIFY = '更改用户', |
||||||
|
//zmq命令
|
||||||
|
ZMQ_CMD_PUBLISH = '设备命令下发', |
||||||
|
//ssh
|
||||||
|
SSH_LOGIN = 'SSH连接', |
||||||
|
SSH_LOGOUT = 'SSH中断连接' |
||||||
|
} |
||||||
|
|
||||||
|
export type OperateLogVO = { |
||||||
|
id: number |
||||||
|
traceId: string |
||||||
|
userType: number |
||||||
|
userId: number |
||||||
|
userName: string |
||||||
|
type: string |
||||||
|
subType: string |
||||||
|
bizId: number |
||||||
|
action: string |
||||||
|
extra: string |
||||||
|
requestMethod: string |
||||||
|
requestUrl: string |
||||||
|
userIp: string |
||||||
|
userAgent: string |
||||||
|
creator: string |
||||||
|
creatorName: string |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
// 查询操作日志列表
|
||||||
|
export const getOperateLogPage = (params: PageParam) => { |
||||||
|
return systemServer({ url: '/operate-log/page', method: 'get', params }) |
||||||
|
} |
||||||
|
// 导出操作日志
|
||||||
|
export const exportOperateLog = (params: any) => { |
||||||
|
return systemServer({ |
||||||
|
url: '/operate-log/export', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
responseType: 'blob', |
||||||
|
}) |
||||||
|
} |
||||||
@ -0,0 +1,54 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
export interface PermissionAssignUserRoleReqVO { |
||||||
|
userId: number |
||||||
|
roleIds: number[] |
||||||
|
} |
||||||
|
|
||||||
|
export interface PermissionAssignRoleMenuReqVO { |
||||||
|
roleId: number |
||||||
|
menuIds: number[] |
||||||
|
} |
||||||
|
|
||||||
|
export interface PermissionAssignRoleDataScopeReqVO { |
||||||
|
roleId: number |
||||||
|
dataScope: number |
||||||
|
dataScopeDeptIds: number[] |
||||||
|
} |
||||||
|
|
||||||
|
// 查询角色拥有的菜单权限
|
||||||
|
export const getRoleMenuList = async (roleId: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/permission/list-role-menus?roleId=' + roleId, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 赋予角色菜单权限
|
||||||
|
export const assignRoleMenu = async (data: PermissionAssignRoleMenuReqVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/permission/assign-role-menu', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 赋予角色数据权限
|
||||||
|
export const assignRoleDataScope = async (data: PermissionAssignRoleDataScopeReqVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/permission/assign-role-data-scope', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询用户拥有的角色数组
|
||||||
|
export const getUserRoleList = async (userId: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/permission/list-user-roles?userId=' + userId, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 赋予用户角色
|
||||||
|
export const assignUserRole = async (data: PermissionAssignUserRoleReqVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/permission/assign-user-role', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
@ -0,0 +1,64 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
export interface PostVO { |
||||||
|
id?: number |
||||||
|
name: string |
||||||
|
code: string |
||||||
|
sort: number |
||||||
|
status: number |
||||||
|
remark: string |
||||||
|
createTime?: Date |
||||||
|
} |
||||||
|
|
||||||
|
// 查询岗位列表
|
||||||
|
export const getPostPage = async (params: PageParam) => |
||||||
|
systemServer({ |
||||||
|
url: '/post/page', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
}) |
||||||
|
|
||||||
|
// 获取岗位精简信息列表
|
||||||
|
export const getSimplePostList = async () => |
||||||
|
systemServer<PostVO[]>({ |
||||||
|
url: '/post/simple-list', |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询岗位详情
|
||||||
|
export const getPost = async (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/post/get?id=' + id, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 新增岗位
|
||||||
|
export const createPost = async (data: PostVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/post/create', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改岗位
|
||||||
|
export const updatePost = async (data: PostVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/post/update', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 删除岗位
|
||||||
|
export const deletePost = async (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/post/delete?id=' + id, |
||||||
|
method: 'delete', |
||||||
|
}) |
||||||
|
|
||||||
|
// 导出岗位
|
||||||
|
export const exportPost = async (params: any) => |
||||||
|
systemServer({ |
||||||
|
url: '/post/export', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
responseType: 'blob', |
||||||
|
}) |
||||||
@ -0,0 +1,79 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
export interface RoleVO { |
||||||
|
id: number |
||||||
|
name: string |
||||||
|
code: string |
||||||
|
sort: number |
||||||
|
status: number |
||||||
|
type: number |
||||||
|
dataScope: number |
||||||
|
dataScopeDeptIds: number[] |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
export interface UpdateStatusReqVO { |
||||||
|
id: number |
||||||
|
status: number |
||||||
|
} |
||||||
|
|
||||||
|
// 查询角色列表
|
||||||
|
export const getRolePage = async (params: PageParam) => |
||||||
|
systemServer({ |
||||||
|
url: '/role/page', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询角色(精简)列表
|
||||||
|
export const getSimpleRoleList = async () => |
||||||
|
systemServer<RoleVO[]>({ |
||||||
|
url: '/role/simple-list', |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询角色详情
|
||||||
|
export const getRole = async (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/role/get?id=' + id, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 新增角色
|
||||||
|
export const createRole = async (data: RoleVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/role/create', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改角色
|
||||||
|
export const updateRole = async (data: RoleVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/role/update', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改角色状态
|
||||||
|
export const updateRoleStatus = async (data: UpdateStatusReqVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/role/update-status', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 删除角色
|
||||||
|
export const deleteRole = async (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/role/delete?id=' + id, |
||||||
|
method: 'delete', |
||||||
|
}) |
||||||
|
|
||||||
|
// 导出角色
|
||||||
|
export const exportRole = (params: any) => |
||||||
|
systemServer({ |
||||||
|
url: '/role/export-excel', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
responseType: 'blob', |
||||||
|
}) |
||||||
@ -0,0 +1,80 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
|
||||||
|
|
||||||
|
export interface TenantVO { |
||||||
|
id: number |
||||||
|
name: string |
||||||
|
contactName: string |
||||||
|
contactMobile: string |
||||||
|
status: number |
||||||
|
domain: string |
||||||
|
packageId: number |
||||||
|
username: string |
||||||
|
password: string |
||||||
|
expireTime: Date |
||||||
|
accountCount: number |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
export interface TenantPageReqVO extends PageParam { |
||||||
|
name?: string |
||||||
|
contactName?: string |
||||||
|
contactMobile?: string |
||||||
|
status?: number |
||||||
|
createTime?: Date[] |
||||||
|
} |
||||||
|
|
||||||
|
export interface TenantExportReqVO { |
||||||
|
name?: string |
||||||
|
contactName?: string |
||||||
|
contactMobile?: string |
||||||
|
status?: number |
||||||
|
createTime?: Date[] |
||||||
|
} |
||||||
|
|
||||||
|
// 查询租户列表
|
||||||
|
export const getTenantPage = (params: TenantPageReqVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant/page', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询租户详情
|
||||||
|
export const getTenant = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant/get?id=' + id, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 新增租户
|
||||||
|
export const createTenant = (data: TenantVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant/create', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改租户
|
||||||
|
export const updateTenant = (data: TenantVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant/update', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 删除租户
|
||||||
|
export const deleteTenant = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant/delete?id=' + id, |
||||||
|
method: 'delete', |
||||||
|
}) |
||||||
|
|
||||||
|
// 导出租户
|
||||||
|
export const exportTenant = (params: TenantExportReqVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant/export-excel', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
responseType: 'blob', |
||||||
|
}) |
||||||
@ -0,0 +1,58 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
|
||||||
|
export interface TenantPackageVO { |
||||||
|
id: number |
||||||
|
name: string |
||||||
|
status: number |
||||||
|
remark: string |
||||||
|
creator: string |
||||||
|
updater: string |
||||||
|
updateTime: string |
||||||
|
menuIds: number[] |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
// 查询租户套餐列表
|
||||||
|
export const getTenantPackagePage = (params: PageParam) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant-package/page', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
}) |
||||||
|
|
||||||
|
// 获得租户
|
||||||
|
export const getTenantPackage = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant-package/get?id=' + id, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 新增租户套餐
|
||||||
|
export const createTenantPackage = (data: TenantPackageVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant-package/create', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改租户套餐
|
||||||
|
export const updateTenantPackage = (data: TenantPackageVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant-package/update', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 删除租户套餐
|
||||||
|
export const deleteTenantPackage = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant-package/delete?id=' + id, |
||||||
|
method: 'delete', |
||||||
|
}) |
||||||
|
|
||||||
|
// 获取租户套餐精简信息列表
|
||||||
|
export const getTenantPackageList = () => |
||||||
|
systemServer({ |
||||||
|
url: '/tenant-package/simple-list', |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
@ -0,0 +1,121 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
|
||||||
|
export interface UserVO { |
||||||
|
id: number |
||||||
|
username: string |
||||||
|
nickname: string |
||||||
|
deptId: number |
||||||
|
postIds: string[] |
||||||
|
email: string |
||||||
|
mobile: string |
||||||
|
sex: number |
||||||
|
avatar: string |
||||||
|
loginIp: string |
||||||
|
status: number |
||||||
|
remark: string |
||||||
|
loginDate: Date |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
export interface UserSimple { |
||||||
|
id: number; |
||||||
|
nickname: string; |
||||||
|
deptId: number; |
||||||
|
deptName: string; |
||||||
|
} |
||||||
|
|
||||||
|
// 查询用户管理列表
|
||||||
|
export const getUserPage = (params: PageParam) => |
||||||
|
systemServer({ |
||||||
|
url: '/user/page', |
||||||
|
method: 'get', |
||||||
|
params, |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询所有用户列表
|
||||||
|
export const getAllUser = () => |
||||||
|
systemServer({ |
||||||
|
url: '/user/all', |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 查询用户详情
|
||||||
|
export const getUser = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/user/get?id=' + id, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 新增用户
|
||||||
|
export const createUser = (data: UserVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/user/create', |
||||||
|
method: 'post', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改用户
|
||||||
|
export const updateUser = (data: UserVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/user/update', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 删除用户
|
||||||
|
export const deleteUser = (id: number) => |
||||||
|
systemServer({ |
||||||
|
url: '/user/delete?id=' + id, |
||||||
|
method: 'delete', |
||||||
|
}) |
||||||
|
|
||||||
|
// 导出用户
|
||||||
|
export const exportUser = (params: any) => |
||||||
|
systemServer({ |
||||||
|
url: '/user/export', |
||||||
|
method: 'get', |
||||||
|
responseType: 'blob', |
||||||
|
params, |
||||||
|
}) |
||||||
|
|
||||||
|
// 下载用户导入模板
|
||||||
|
export const importUserTemplate = () => |
||||||
|
systemServer({ |
||||||
|
url: '/user/get-import-template', |
||||||
|
method: 'get', |
||||||
|
responseType: 'blob', |
||||||
|
}) |
||||||
|
|
||||||
|
// 用户密码重置
|
||||||
|
export const resetUserPwd = (id: number, password: string) => { |
||||||
|
const data = { |
||||||
|
id, |
||||||
|
password, |
||||||
|
} |
||||||
|
return systemServer({ |
||||||
|
url: '/user/reset-password', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
// 用户状态修改
|
||||||
|
export const updateUserStatus = (id: number, status: number) => { |
||||||
|
const data = { |
||||||
|
id, |
||||||
|
status, |
||||||
|
} |
||||||
|
return systemServer({ |
||||||
|
url: '/user/update-status', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
// 获取用户精简信息列表
|
||||||
|
export const getSimpleUserList = () => { |
||||||
|
return systemServer<UserSimple[]>({ |
||||||
|
url: '/user/simple-list', |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
} |
||||||
@ -0,0 +1,75 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
export interface ProfileVO { |
||||||
|
id: number |
||||||
|
username: string |
||||||
|
nickname: string |
||||||
|
dept: { |
||||||
|
id: number |
||||||
|
name: string |
||||||
|
} |
||||||
|
roles: { |
||||||
|
id: number |
||||||
|
name: string |
||||||
|
}[] |
||||||
|
posts: { |
||||||
|
id: number |
||||||
|
name: string |
||||||
|
}[] |
||||||
|
socialUsers: { |
||||||
|
type: number |
||||||
|
openid: string |
||||||
|
}[] |
||||||
|
email: string |
||||||
|
mobile: string |
||||||
|
sex: number |
||||||
|
avatar: string |
||||||
|
status: number |
||||||
|
remark: string |
||||||
|
loginIp: string |
||||||
|
loginDate: Date |
||||||
|
createTime: Date |
||||||
|
} |
||||||
|
|
||||||
|
export interface UserProfileUpdateReqVO { |
||||||
|
nickname: string |
||||||
|
email: string |
||||||
|
mobile: string |
||||||
|
sex: number |
||||||
|
} |
||||||
|
|
||||||
|
// 查询用户个人信息
|
||||||
|
export const getUserProfile = () => |
||||||
|
systemServer({ |
||||||
|
url: '/user/profile/get', |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
|
||||||
|
// 修改用户个人信息
|
||||||
|
export const updateUserProfile = (data: UserProfileUpdateReqVO) => |
||||||
|
systemServer({ |
||||||
|
url: '/user/profile/update', |
||||||
|
method: 'put', |
||||||
|
data, |
||||||
|
}) |
||||||
|
|
||||||
|
// 用户密码重置
|
||||||
|
export const updateUserPassword = (oldPassword: string, newPassword: string) => |
||||||
|
systemServer({ |
||||||
|
url: '/user/profile/update-password', |
||||||
|
method: 'put', |
||||||
|
data: { |
||||||
|
oldPassword, |
||||||
|
newPassword, |
||||||
|
}, |
||||||
|
}) |
||||||
|
|
||||||
|
// 用户头像上传
|
||||||
|
export const uploadAvatar = (data: any) => |
||||||
|
systemServer({ |
||||||
|
url: '/user/profile/update-avatar', |
||||||
|
data, |
||||||
|
method: 'post', |
||||||
|
headers: { |
||||||
|
'Content-Type': 'multipart/form-data', |
||||||
|
}, |
||||||
|
}) |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
import { systemServer } from '../../index' |
||||||
|
// 社交绑定,使用 code 授权码
|
||||||
|
export const socialBind = (type: any, code: any, state: any) => |
||||||
|
systemServer({ |
||||||
|
url: '/social-user/bind', |
||||||
|
method: 'post', |
||||||
|
data: { |
||||||
|
type, |
||||||
|
code, |
||||||
|
state, |
||||||
|
}, |
||||||
|
}) |
||||||
|
|
||||||
|
// 取消社交绑定
|
||||||
|
export const socialUnbind = (type: any, openid: any) => |
||||||
|
systemServer({ |
||||||
|
url: '/social-user/unbind', |
||||||
|
method: 'delete', |
||||||
|
data: { |
||||||
|
type, |
||||||
|
openid, |
||||||
|
}, |
||||||
|
}) |
||||||
|
|
||||||
|
// 社交授权的跳转
|
||||||
|
export const socialAuthRedirect = (type: any, redirectUri: any) => |
||||||
|
systemServer({ |
||||||
|
url: '/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri, |
||||||
|
method: 'get', |
||||||
|
}) |
||||||
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 356 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,38 @@ |
|||||||
|
/** |
||||||
|
* 配置浏览器本地存储的方式,可直接存储对象数组。 |
||||||
|
*/ |
||||||
|
|
||||||
|
import Keys from '@/api/Keys' |
||||||
|
import WebStorageCache from 'web-storage-cache' |
||||||
|
|
||||||
|
type CacheType = 'localStorage' | 'sessionStorage' |
||||||
|
|
||||||
|
export const useCache = (type: CacheType = 'localStorage') => { |
||||||
|
const wsCache: WebStorageCache = new WebStorageCache({ |
||||||
|
storage: type, |
||||||
|
}) |
||||||
|
|
||||||
|
return { |
||||||
|
wsCache, |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export const deleteUserCache = () => { |
||||||
|
const { wsCache } = useCache() |
||||||
|
wsCache.delete(Keys.STORAGE_USER_INFO) |
||||||
|
wsCache.delete(Keys.STORAGE_ROLE_ROUTERS) |
||||||
|
wsCache.delete(Keys.STORAGE_STATIONID) |
||||||
|
} |
||||||
|
|
||||||
|
export function getCacheStationId( |
||||||
|
stationId: number | string, |
||||||
|
type: 'get' | 'set' = 'get' |
||||||
|
) { |
||||||
|
const { wsCache } = useCache() |
||||||
|
const id = wsCache.get(Keys.STORAGE_STATIONID) |
||||||
|
if (!id || type === 'set') { |
||||||
|
wsCache.set(Keys.STORAGE_STATIONID, stationId) |
||||||
|
return Number(stationId) |
||||||
|
} |
||||||
|
return Number(id) |
||||||
|
} |
||||||
@ -0,0 +1,148 @@ |
|||||||
|
import Keys from '@/api/Keys' |
||||||
|
import type { Result } from '@/api/basic/httpTypes' |
||||||
|
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus' |
||||||
|
export const useMessage = () => { |
||||||
|
return { |
||||||
|
// 消息提示
|
||||||
|
info(content: string) { |
||||||
|
ElMessage.info(content) |
||||||
|
}, |
||||||
|
// 错误消息
|
||||||
|
error(content: string) { |
||||||
|
ElMessage.error(content) |
||||||
|
}, |
||||||
|
// 成功消息
|
||||||
|
success(content: string) { |
||||||
|
ElMessage.success(content) |
||||||
|
}, |
||||||
|
// 警告消息
|
||||||
|
warning(content: string) { |
||||||
|
ElMessage.warning(content) |
||||||
|
}, |
||||||
|
// 弹出提示
|
||||||
|
alert(content: string) { |
||||||
|
ElMessageBox.alert(content, '系统提示') |
||||||
|
}, |
||||||
|
// 错误提示
|
||||||
|
alertError(content: string) { |
||||||
|
ElMessageBox.alert(content, '系统提示', { type: 'error' }) |
||||||
|
}, |
||||||
|
// 成功提示
|
||||||
|
alertSuccess(content: string) { |
||||||
|
ElMessageBox.alert(content, '系统提示', { type: 'success' }) |
||||||
|
}, |
||||||
|
// 警告提示
|
||||||
|
alertWarning(content: string) { |
||||||
|
ElMessageBox.alert(content, '系统提示', { type: 'warning' }) |
||||||
|
}, |
||||||
|
// 通知提示
|
||||||
|
notify(content: string) { |
||||||
|
ElNotification.info(content) |
||||||
|
}, |
||||||
|
// 错误通知
|
||||||
|
notifyError(content: string, tip?: string) { |
||||||
|
ElNotification.error({ |
||||||
|
title: tip ? tip : '系统提示', |
||||||
|
message: content, |
||||||
|
}) |
||||||
|
}, |
||||||
|
// 成功通知
|
||||||
|
notifySuccess(content: string) { |
||||||
|
ElNotification.success(content) |
||||||
|
}, |
||||||
|
// 警告通知
|
||||||
|
notifyWarning(content: string) { |
||||||
|
ElNotification.warning(content) |
||||||
|
}, |
||||||
|
// 确认窗体
|
||||||
|
confirm(content: string, tip?: string) { |
||||||
|
return ElMessageBox.confirm(content, tip ? tip : '系统提示', { |
||||||
|
confirmButtonText: '确定', |
||||||
|
cancelButtonText: '取消', |
||||||
|
confirmButtonClass: 'el-button--success', |
||||||
|
cancelButtonClass: 'el-button--default', |
||||||
|
type: 'warning', |
||||||
|
}) |
||||||
|
}, |
||||||
|
forceConfirm(content: string, tip?: string, buttonText?: string) { |
||||||
|
return ElMessageBox.confirm(content, tip ? tip : '系统提示', { |
||||||
|
confirmButtonText: buttonText ?? '确定', |
||||||
|
showCancelButton: false, |
||||||
|
closeOnClickModal: false, |
||||||
|
closeOnPressEscape: false, |
||||||
|
confirmButtonClass: 'el-button--success', |
||||||
|
cancelButtonClass: 'el-button--default', |
||||||
|
showClose: false, |
||||||
|
type: 'warning', |
||||||
|
}) |
||||||
|
}, |
||||||
|
// 删除窗体
|
||||||
|
delConfirm(content?: string, tip?: string) { |
||||||
|
return new Promise((resolve, reject) => { |
||||||
|
ElMessageBox.confirm( |
||||||
|
content ? content : '是否确认删除数据项?', |
||||||
|
tip ? tip : '系统提示', |
||||||
|
{ |
||||||
|
confirmButtonText: '确定', |
||||||
|
cancelButtonText: '取消', |
||||||
|
type: 'warning', |
||||||
|
confirmButtonClass: 'el-button--success', |
||||||
|
cancelButtonClass: 'el-button--default', |
||||||
|
} |
||||||
|
) |
||||||
|
.then(() => { |
||||||
|
resolve('') |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
reject('') |
||||||
|
}) |
||||||
|
}) |
||||||
|
}, |
||||||
|
// 导出窗体
|
||||||
|
exportConfirm(content?: string, tip?: string) { |
||||||
|
return ElMessageBox.confirm( |
||||||
|
content ? content : '是否确认导出数据项?', |
||||||
|
tip ? tip : '系统提示', |
||||||
|
{ |
||||||
|
confirmButtonText: '确定', |
||||||
|
cancelButtonText: '取消', |
||||||
|
confirmButtonClass: 'el-button--success', |
||||||
|
cancelButtonClass: 'el-button--default', |
||||||
|
type: 'warning', |
||||||
|
} |
||||||
|
) |
||||||
|
}, |
||||||
|
// 提交内容
|
||||||
|
prompt(content: string, tip: string) { |
||||||
|
return ElMessageBox.prompt(content, tip, { |
||||||
|
confirmButtonText: '确定', |
||||||
|
cancelButtonText: '取消', |
||||||
|
confirmButtonClass: 'el-button--success', |
||||||
|
cancelButtonClass: 'el-button--default', |
||||||
|
type: 'warning', |
||||||
|
}) |
||||||
|
}, |
||||||
|
|
||||||
|
promptVerify(content: string, tip: string, pattern: string, inputErrorMessage = '') { |
||||||
|
const PatternRegExp = new RegExp( |
||||||
|
`^${pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}$` |
||||||
|
) |
||||||
|
return ElMessageBox.prompt(content, tip, { |
||||||
|
confirmButtonText: '确定', |
||||||
|
cancelButtonText: '取消', |
||||||
|
confirmButtonClass: 'el-button--success', |
||||||
|
cancelButtonClass: 'el-button--default', |
||||||
|
inputPattern: PatternRegExp, |
||||||
|
inputErrorMessage: inputErrorMessage, |
||||||
|
type: 'warning', |
||||||
|
}) |
||||||
|
}, |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export function isResError(res: Result<any>, msg?: string) { |
||||||
|
if (res.code === Keys.CODE_SUCCEED || res.status === 200 || res.code === 200) |
||||||
|
return false |
||||||
|
ElMessage.error(res?.msg ?? msg) |
||||||
|
return true |
||||||
|
} |
||||||
@ -0,0 +1,38 @@ |
|||||||
|
import Keys from "@/api/Keys"; |
||||||
|
// @ts-ignore
|
||||||
|
import { useCache } from "@/hooks/useCache"; |
||||||
|
const { wsCache } = useCache(); |
||||||
|
|
||||||
|
export const getToken = () => wsCache.get(Keys.STORAGE_TOKEN); |
||||||
|
|
||||||
|
export const setToken = (token: string) => { |
||||||
|
wsCache.set(Keys.STORAGE_TOKEN, token); |
||||||
|
}; |
||||||
|
|
||||||
|
export const setRefreshToken = (refreshToken: any) => { |
||||||
|
wsCache.set(Keys.STORAGE_REFRESH_TOKEN, refreshToken); |
||||||
|
}; |
||||||
|
|
||||||
|
export const getRefreshToken = () => wsCache.get(Keys.STORAGE_REFRESH_TOKEN); |
||||||
|
|
||||||
|
export const removeToken = () => { |
||||||
|
wsCache.delete(Keys.STORAGE_TOKEN); |
||||||
|
wsCache.delete(Keys.STORAGE_REFRESH_TOKEN); |
||||||
|
}; |
||||||
|
|
||||||
|
export const getLocalUserInfo = () => wsCache.get(Keys.STORAGE_USER_INFO); |
||||||
|
|
||||||
|
export const setUserInfo = (userInfo: any) => |
||||||
|
wsCache.set(Keys.STORAGE_USER_INFO, userInfo); |
||||||
|
|
||||||
|
// ========== 权限路由相关 ==========
|
||||||
|
export const getRoleRouters = () => wsCache.get(Keys.STORAGE_ROLE_ROUTERS); |
||||||
|
|
||||||
|
export const setRoleRouters = (roleRouters: any) => |
||||||
|
wsCache.set(Keys.STORAGE_ROLE_ROUTERS, roleRouters); |
||||||
|
|
||||||
|
// ========== 租户相关 ==========
|
||||||
|
export const getTenantId = () => wsCache.get(Keys.STORAGE_TENANT_ID); |
||||||
|
|
||||||
|
export const setTenantId = (tenantId: number) => |
||||||
|
wsCache.set(Keys.STORAGE_TENANT_ID, tenantId); |
||||||
@ -0,0 +1,124 @@ |
|||||||
|
import { debounce } from 'lodash-es' |
||||||
|
import { onScopeDispose } from 'vue' |
||||||
|
|
||||||
|
export function useWindowKeyEnter(fn: Function) { |
||||||
|
let isComposing = false |
||||||
|
|
||||||
|
window.addEventListener('compositionstart', () => { |
||||||
|
isComposing = true |
||||||
|
}) |
||||||
|
window.addEventListener('compositionend', () => { |
||||||
|
isComposing = false |
||||||
|
}) |
||||||
|
window.addEventListener('keydown', handleKeyDown) |
||||||
|
|
||||||
|
function handleKeyDown(e: KeyboardEvent) { |
||||||
|
if (!isComposing && e.key === 'Enter') { |
||||||
|
fn() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
onScopeDispose(() => { |
||||||
|
window.removeEventListener('compositionstart', () => { |
||||||
|
isComposing = true |
||||||
|
}) |
||||||
|
window.removeEventListener('compositionend', () => { |
||||||
|
isComposing = false |
||||||
|
}) |
||||||
|
window.removeEventListener('keydown', handleKeyDown) |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
export function useWindowResize(fn: (...args: any[]) => any, delay: number = 300) { |
||||||
|
const handleResize = debounce(fn, delay) |
||||||
|
|
||||||
|
window.addEventListener('resize', handleResize) |
||||||
|
|
||||||
|
return () => { |
||||||
|
window.removeEventListener('resize', handleResize) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export function useFlatArray(data: Array<any>, flatKey: string = 'children') { |
||||||
|
const result: any[] = [] |
||||||
|
|
||||||
|
function flat(items: any[]) { |
||||||
|
for (const item of items) { |
||||||
|
result.push(item) |
||||||
|
if (item[flatKey] && item[flatKey].length > 0) { |
||||||
|
flat(item[flatKey]) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
flat(data) |
||||||
|
return result |
||||||
|
} |
||||||
|
|
||||||
|
export const ipPattern = |
||||||
|
/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ |
||||||
|
|
||||||
|
export function getColor(percentageStr: string) { |
||||||
|
let percentage |
||||||
|
if (!percentageStr.includes('%')) { |
||||||
|
percentage = parseFloat(percentageStr.replace('%', '')) |
||||||
|
} else { |
||||||
|
percentage = parseFloat(percentageStr) |
||||||
|
} |
||||||
|
|
||||||
|
if (percentage >= 0 && percentage <= 33.33) { |
||||||
|
return '#D51B60' |
||||||
|
} else if (percentage > 33.33 && percentage <= 66.66) { |
||||||
|
return '#FC861B' |
||||||
|
} else if (percentage > 66.66 && percentage <= 100) { |
||||||
|
return '#00CD35' |
||||||
|
} else { |
||||||
|
return null // 超出范围
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export function useParseHexToJson(hexString: string): object { |
||||||
|
// 如果十六进制字符串长度是奇数,则在前面加零
|
||||||
|
if (hexString.length % 2 !== 0) { |
||||||
|
hexString = '0' + hexString |
||||||
|
} |
||||||
|
|
||||||
|
// 将十六进制字符串转换为 ASCII 字符串
|
||||||
|
function hexToAscii(hex: string) { |
||||||
|
let asciiStr = '' |
||||||
|
for (let i = 0; i < hex.length; i += 2) { |
||||||
|
asciiStr += String.fromCharCode(parseInt(hex.substring(i, i + 2), 16)) |
||||||
|
} |
||||||
|
return asciiStr |
||||||
|
} |
||||||
|
|
||||||
|
// 解析十六进制字符串并转换为 JSON 对象
|
||||||
|
const asciiString = hexToAscii(hexString) |
||||||
|
return JSON.parse(asciiString) |
||||||
|
} |
||||||
|
|
||||||
|
interface ItemWithChildren { |
||||||
|
children?: ItemWithChildren[] |
||||||
|
} |
||||||
|
|
||||||
|
export function useFilterArray<T extends ItemWithChildren, K extends keyof T>( |
||||||
|
data: T[], |
||||||
|
idToFilter: T[K], |
||||||
|
idKey: K |
||||||
|
): T[] { |
||||||
|
return data |
||||||
|
.map(item => { |
||||||
|
if (item[idKey] === idToFilter) { |
||||||
|
return null |
||||||
|
} |
||||||
|
|
||||||
|
// 递归处理子节点
|
||||||
|
const filteredChildren = Array.isArray(item.children) |
||||||
|
? useFilterArray(item.children as T[], idToFilter, idKey) |
||||||
|
: null |
||||||
|
|
||||||
|
// 返回一个新的对象,包含过滤后的子节点
|
||||||
|
return { ...item, children: filteredChildren } |
||||||
|
}) |
||||||
|
.filter(Boolean) as T[] |
||||||
|
} |
||||||
@ -0,0 +1,244 @@ |
|||||||
|
<template> |
||||||
|
<div class="main"> |
||||||
|
<div class="header"> |
||||||
|
<img :src="Logo" class="icon" /> |
||||||
|
<div class="sys-title"> |
||||||
|
<span class="title-cn">比特电科-工程管理平台</span> |
||||||
|
<span class="title-en">BTDK-ES Engineering Management Platform</span> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="body"> |
||||||
|
<img :src="bg" class="bg" alt="" /> |
||||||
|
<div class="form"> |
||||||
|
<div class="title">账号登录</div> |
||||||
|
<el-form label-position="top" :model="account"> |
||||||
|
<el-form-item class="label"> |
||||||
|
<el-input v-model="account.username" class="input" placeholder="请输入账号" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item class="label"> |
||||||
|
<el-input |
||||||
|
type="password" |
||||||
|
v-model="account.password" |
||||||
|
class="input" |
||||||
|
placeholder="请输入密码" |
||||||
|
/> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<el-button color="#08a4f0" class="login-btn" @click="onLogin" :loading="isLoading" |
||||||
|
>登录</el-button |
||||||
|
> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script setup lang="ts"> |
||||||
|
import { |
||||||
|
login, |
||||||
|
getTenantId, |
||||||
|
sendSmsCode, |
||||||
|
smsLogin, |
||||||
|
type LoginRequestData, |
||||||
|
} from '@/api/module/system/login' |
||||||
|
import Logo from '@/assets/images/login/logo.png' |
||||||
|
import bg from '@/assets/images/login/bg.png' |
||||||
|
import { setRefreshToken, setTenantId } from '@/utils/auth' |
||||||
|
import { setToken } from '@/utils/auth' |
||||||
|
import { isResError, useMessage } from '@/hooks/useMessage' |
||||||
|
import { useWindowKeyEnter } from '@/utils/hooks' |
||||||
|
import { useRouter } from 'vue-router' |
||||||
|
|
||||||
|
const isLoading = ref(false) |
||||||
|
const router = useRouter() |
||||||
|
const message = useMessage() |
||||||
|
|
||||||
|
const activeName = ref('account') |
||||||
|
const account = reactive<LoginRequestData>({ |
||||||
|
username: '', |
||||||
|
password: '', |
||||||
|
}) |
||||||
|
|
||||||
|
const mobile = reactive({ |
||||||
|
tenantName: '', |
||||||
|
number: '', |
||||||
|
code: '', |
||||||
|
captchaVerification: '', |
||||||
|
rememberMe: true, |
||||||
|
}) |
||||||
|
|
||||||
|
async function onLogin() { |
||||||
|
isLoading.value = true |
||||||
|
try { |
||||||
|
switch (activeName.value) { |
||||||
|
case 'account': |
||||||
|
await loginByAccount() |
||||||
|
break |
||||||
|
case 'mobile': |
||||||
|
await loginByMobile() |
||||||
|
break |
||||||
|
} |
||||||
|
} catch (e) { |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
isLoading.value = false |
||||||
|
router.push('/engineering') |
||||||
|
} |
||||||
|
|
||||||
|
async function loginByAccount() { |
||||||
|
if (!account.username || !account.password) { |
||||||
|
message.error('用户名或密码不能为空') |
||||||
|
isLoading.value = false |
||||||
|
return Promise.reject() |
||||||
|
} |
||||||
|
|
||||||
|
const loginRes = await login({ |
||||||
|
username: account.username, |
||||||
|
password: account.password, |
||||||
|
}) |
||||||
|
|
||||||
|
if (isResError(loginRes)) { |
||||||
|
isLoading.value = false |
||||||
|
return Promise.reject(loginRes) |
||||||
|
} |
||||||
|
|
||||||
|
setToken(loginRes.data.accessToken) |
||||||
|
setRefreshToken(loginRes.data.refreshToken) |
||||||
|
} |
||||||
|
|
||||||
|
const smsVO = reactive({ |
||||||
|
smsCode: { |
||||||
|
mobile: '', |
||||||
|
scene: 21, |
||||||
|
}, |
||||||
|
loginSms: { |
||||||
|
mobile: '', |
||||||
|
code: '', |
||||||
|
}, |
||||||
|
}) |
||||||
|
const mobileCodeTimer = ref(0) |
||||||
|
const getSmsCode = async () => { |
||||||
|
const tenantRes = await getTenantId(mobile.tenantName) |
||||||
|
if (isResError(tenantRes)) { |
||||||
|
isLoading.value = false |
||||||
|
return |
||||||
|
} |
||||||
|
smsVO.smsCode.mobile = mobile.number |
||||||
|
|
||||||
|
const res = await sendSmsCode(smsVO.smsCode) |
||||||
|
|
||||||
|
if (isResError(res)) { |
||||||
|
return |
||||||
|
} |
||||||
|
message.success('验证码已发送') |
||||||
|
mobileCodeTimer.value = 60 |
||||||
|
let msgTimer = setInterval(() => { |
||||||
|
mobileCodeTimer.value = mobileCodeTimer.value - 1 |
||||||
|
if (mobileCodeTimer.value <= 0) { |
||||||
|
clearInterval(msgTimer) |
||||||
|
} |
||||||
|
}, 1000) |
||||||
|
} |
||||||
|
|
||||||
|
async function loginByMobile() { |
||||||
|
smsVO.loginSms.mobile = mobile.number |
||||||
|
smsVO.loginSms.code = mobile.code |
||||||
|
|
||||||
|
const res = await smsLogin(smsVO.loginSms) |
||||||
|
if (isResError(res)) { |
||||||
|
isLoading.value = false |
||||||
|
return Promise.reject(res) |
||||||
|
} |
||||||
|
setToken(res.data.accessToken) |
||||||
|
setRefreshToken(res.data.refreshToken) |
||||||
|
} |
||||||
|
|
||||||
|
async function settingTenantId(tenantName: string) { |
||||||
|
const tenantRes = await getTenantId(tenantName) |
||||||
|
if (isResError(tenantRes)) { |
||||||
|
isLoading.value = false |
||||||
|
return Promise.reject() |
||||||
|
} |
||||||
|
setTenantId(tenantRes.data) |
||||||
|
} |
||||||
|
|
||||||
|
useWindowKeyEnter(onLogin) |
||||||
|
onMounted(() => { |
||||||
|
// verifyCode.value.showCode() |
||||||
|
// getVerCode() |
||||||
|
}) |
||||||
|
</script> |
||||||
|
|
||||||
|
<style scoped lang="scss"> |
||||||
|
.main { |
||||||
|
position: relative; |
||||||
|
width: 100%; |
||||||
|
height: 100%; |
||||||
|
background: linear-gradient(to bottom right, #08a4f0, #7f80fe); |
||||||
|
.header { |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
height: 110px; |
||||||
|
padding-left: 26px; |
||||||
|
.icon { |
||||||
|
width: 52px; |
||||||
|
height: 52px; |
||||||
|
margin-right: 12px; |
||||||
|
} |
||||||
|
|
||||||
|
.sys-title { |
||||||
|
display: flex; |
||||||
|
flex-direction: column; |
||||||
|
font-size: 26px; |
||||||
|
color: #ffffff; |
||||||
|
font-weight: 700; |
||||||
|
|
||||||
|
.title-cn { |
||||||
|
margin-bottom: 8px; |
||||||
|
} |
||||||
|
|
||||||
|
.title-en { |
||||||
|
font-size: 16px; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.body { |
||||||
|
height: calc(100% - 110px); |
||||||
|
display: flex; |
||||||
|
justify-content: space-around; |
||||||
|
.bg { |
||||||
|
// max-width: 1010px; |
||||||
|
// max-height: 1010px; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.form { |
||||||
|
width: 440px; |
||||||
|
padding: 64px 44px; |
||||||
|
background-color: #ffffff; |
||||||
|
border-radius: 3px; |
||||||
|
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1); |
||||||
|
margin: auto 0; |
||||||
|
display: flex; |
||||||
|
flex-direction: column; |
||||||
|
box-sizing: border-box; |
||||||
|
.title { |
||||||
|
font-size: 24px; |
||||||
|
font-weight: 600; |
||||||
|
text-align: center; |
||||||
|
color: #333333; |
||||||
|
margin-bottom: 48px; |
||||||
|
} |
||||||
|
:deep(.el-form-item) { |
||||||
|
margin-bottom: 26px; |
||||||
|
} |
||||||
|
:deep(.el-input) { |
||||||
|
height: 40px; |
||||||
|
} |
||||||
|
:deep(.el-button) { |
||||||
|
height: 40px; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
||||||
Loading…
Reference in new issue