提交 2018f395 作者: 方治民

feat: 重新规范 pont 模板、Mock 接口、登录参数、环境配置同步、示例接口重新生成等

上级 5e78249b
...@@ -14,10 +14,11 @@ VITE_DROP_CONSOLE = false ...@@ -14,10 +14,11 @@ VITE_DROP_CONSOLE = false
# Basic interface address SPA # Basic interface address SPA
VITE_GLOB_API_URL=/basic-api VITE_GLOB_API_URL=/basic-api
# VITE_GLOB_API_URL=http://localhost:8181/basic-api # VITE_GLOB_API_URL=http://localhost:8181
# File upload address, optional
VITE_GLOB_UPLOAD_URL=/upload
# Interface prefix # Interface prefix
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
# VITE_GLOB_API_URL_PREFIX=/api
# File upload address, optional
VITE_GLOB_UPLOAD_URL=/upload
...@@ -18,13 +18,13 @@ VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false ...@@ -18,13 +18,13 @@ VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
# Basic interface address SPA # Basic interface address SPA
VITE_GLOB_API_URL=/basic-api VITE_GLOB_API_URL=/basic-api
# Interface prefix
VITE_GLOB_API_URL_PREFIX=
# File upload address, optional # File upload address, optional
# It can be forwarded by nginx or write the actual address directly # It can be forwarded by nginx or write the actual address directly
VITE_GLOB_UPLOAD_URL=/upload VITE_GLOB_UPLOAD_URL=/upload
# Interface prefix
VITE_GLOB_API_URL_PREFIX=
# Whether to enable image compression # Whether to enable image compression
VITE_USE_IMAGEMIN= true VITE_USE_IMAGEMIN= true
......
...@@ -225,7 +225,7 @@ const linkRoute = { ...@@ -225,7 +225,7 @@ const linkRoute = {
export default [ export default [
{ {
url: '/basic-api/getMenuList', url: '/basic-api/user/getMenuList',
timeout: 1000, timeout: 1000,
method: 'get', method: 'get',
response: (request: Request) => { response: (request: Request) => {
......
import { IncomingMessage } from 'http'
import Mock from 'mockjs'
import qs from 'qs'
import { MockMethod } from 'vite-plugin-mock' import { MockMethod } from 'vite-plugin-mock'
import { Response, Request } from '../_util' import { Response, Request } from '../_util'
const parseFormParams = (req: IncomingMessage): Promise<Recordable> => {
return new Promise((resolve) => {
let body = ''
req.on('data', function (chunk) {
body += chunk
})
req.on('end', function () {
resolve(qs.parse(body) as any)
return
})
})
}
export function createFakeUserList() { export function createFakeUserList() {
return [ return [
{ {
userId: '1', userId: '1',
username: 'basic', account: 'admin',
realName: 'Basic Admin', realName: 'Basic Admin',
avatar: 'https://q1.qlogo.cn/g?b=qq&nk=190848757&s=640', avatar: 'https://q1.qlogo.cn/g?b=qq&nk=190848757&s=640',
desc: 'manager', desc: 'manager',
...@@ -14,14 +30,15 @@ export function createFakeUserList() { ...@@ -14,14 +30,15 @@ export function createFakeUserList() {
homePath: '/dashboard/workbench', homePath: '/dashboard/workbench',
roles: [ roles: [
{ {
roleName: 'Super Admin', name: 'Super Admin',
value: 'super', uid: 'super',
id: '1',
}, },
], ],
}, },
{ {
userId: '2', userId: '2',
username: 'test', account: 'test',
password: '123456', password: '123456',
realName: 'test user', realName: 'test user',
avatar: 'https://q1.qlogo.cn/g?b=qq&nk=339449197&s=640', avatar: 'https://q1.qlogo.cn/g?b=qq&nk=339449197&s=640',
...@@ -30,8 +47,9 @@ export function createFakeUserList() { ...@@ -30,8 +47,9 @@ export function createFakeUserList() {
homePath: '/dashboard/workbench', homePath: '/dashboard/workbench',
roles: [ roles: [
{ {
roleName: 'Tester', name: 'Tester',
value: 'test', uid: 'test',
id: '2',
}, },
], ],
}, },
...@@ -46,30 +64,53 @@ const fakeCodeList: any = { ...@@ -46,30 +64,53 @@ const fakeCodeList: any = {
export default [ export default [
// mock user login // mock user login
{ {
url: '/basic-api/login', url: '/basic-api/auth/login',
timeout: 200, timeout: 200,
method: 'post', method: 'post',
response: ({ body }) => { // response: ({ query }) => {
const { username, password } = body // const { account, password } = query
// console.log(JSON.stringify(query))
// const checkUser = createFakeUserList().find(
// (item) => item.account === account && password === item.password,
// )
// if (!checkUser) {
// return Response.no('Incorrect account or password!')
// }
// const { userId, account: _account, token, realName, desc, roles } = checkUser
// return Response.ok({
// roles,
// userId,
// account: _account,
// token,
// realName,
// desc,
// })
// },
rawResponse: async (req, res) => {
const { account, password } = await parseFormParams(req)
const checkUser = createFakeUserList().find( const checkUser = createFakeUserList().find(
(item) => item.username === username && password === item.password, (item) => item.account === account && password === item.password,
) )
if (!checkUser) { if (!checkUser) {
return Response.no('Incorrect account or password!') return Response.no('Incorrect account or password!')
} }
const { userId, username: _username, token, realName, desc, roles } = checkUser const { userId, account: _account, token, realName, desc, roles } = checkUser
return Response.ok({ const response = Response.ok({
roles, roles,
userId, userId,
username: _username, account: _account,
token, token,
realName, realName,
desc, desc,
}) })
res.setHeader('Content-Type', 'application/json')
res.statusCode = 200
res.end(JSON.stringify(Mock.mock(response)))
}, },
}, },
{ {
url: '/basic-api/getUserInfo', url: '/basic-api/user/getUserInfo',
method: 'get', method: 'get',
response: (request: Request) => { response: (request: Request) => {
const token = Request.getRequestToken(request) const token = Request.getRequestToken(request)
...@@ -82,7 +123,7 @@ export default [ ...@@ -82,7 +123,7 @@ export default [
}, },
}, },
{ {
url: '/basic-api/getPermCode', url: '/basic-api/auth/getPermCode',
timeout: 200, timeout: 200,
method: 'get', method: 'get',
response: (request: Request) => { response: (request: Request) => {
...@@ -98,7 +139,7 @@ export default [ ...@@ -98,7 +139,7 @@ export default [
}, },
}, },
{ {
url: '/basic-api/logout', url: '/basic-api/auth/logout',
timeout: 200, timeout: 200,
method: 'get', method: 'get',
response: (request: Request) => { response: (request: Request) => {
...@@ -112,7 +153,7 @@ export default [ ...@@ -112,7 +153,7 @@ export default [
}, },
}, },
{ {
url: '/basic-api/testRetry', url: '/basic-api/auth/testRetry',
statusCode: 405, statusCode: 405,
method: 'get', method: 'get',
response: () => { response: () => {
......
{ {
"originUrl": "http://localhost:8181/basic-api/v2/api-docs", "originUrl": "http://localhost:8181/api/v2/api-docs",
"templatePath": "./pont.template", "templatePath": "./pont.template",
"outDir": "./src/api/services", "outDir": "./src/api/services",
"surrounding": "typeScript", "surrounding": "typeScript",
......
import { Interface, BaseClass, Property, CodeGenerator } from 'pont-engine' import { Interface, BaseClass, Property, CodeGenerator } from 'pont-engine'
// 接口 API 前缀
// 通常与项目的 env 配置中的 VITE_GLOB_API_URL_PREFIX 相同
const API_URL_PREFIX = '/api'
export default class BasicGenerator extends CodeGenerator { export default class BasicGenerator extends CodeGenerator {
getParams(inter: Interface) { getParams(inter: Interface) {
const requestParams = inter.getRequestParams(this.surrounding) const requestParams = inter.getRequestParams(this.surrounding)
...@@ -52,15 +56,15 @@ export default class BasicGenerator extends CodeGenerator { ...@@ -52,15 +56,15 @@ export default class BasicGenerator extends CodeGenerator {
*/ */
import * as defs from '../../baseClass'; import * as defs from '../../baseClass';
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export ${paramsCode} export ${paramsCode}
export const init = ${inter.response.getInitialValue()}; export const init = ${inter.response.getInitialValue()};
export function request(${requestParams}) { export function request(${requestParams}) {
return Http.request({ return defHttp.request({
url: "${inter.path}", url: "${inter.path.replace(API_URL_PREFIX, '')}",
method: '${method}', method: '${method}',
${ ${
method === 'GET' method === 'GET'
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
"mods": [ "mods": [
{ {
"description": "", "description": "",
"name": "auth",
"interfaces": [ "interfaces": [
{ {
"consumes": [ "consumes": [
...@@ -12,7 +11,7 @@ ...@@ -12,7 +11,7 @@
"description": "登录", "description": "登录",
"name": "login", "name": "login",
"method": "post", "method": "post",
"path": "/basic-api/auth/login", "path": "/api/auth/login",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -69,7 +68,7 @@ ...@@ -69,7 +68,7 @@
"description": "登出", "description": "登出",
"name": "logout", "name": "logout",
"method": "get", "method": "get",
"path": "/basic-api/auth/logout", "path": "/api/auth/logout",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -98,7 +97,7 @@ ...@@ -98,7 +97,7 @@
"description": "注册", "description": "注册",
"name": "register", "name": "register",
"method": "post", "method": "post",
"path": "/basic-api/auth/register", "path": "/api/auth/register",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -166,9 +165,9 @@ ...@@ -166,9 +165,9 @@
}, },
{ {
"in": "query", "in": "query",
"description": "手机号", "description": "简介",
"name": "mobile", "name": "introduction",
"required": true, "required": false,
"dataType": { "dataType": {
"typeArgs": [], "typeArgs": [],
"typeName": "string", "typeName": "string",
...@@ -181,8 +180,8 @@ ...@@ -181,8 +180,8 @@
}, },
{ {
"in": "query", "in": "query",
"description": "密码", "description": "手机号",
"name": "password", "name": "mobile",
"required": true, "required": true,
"dataType": { "dataType": {
"typeArgs": [], "typeArgs": [],
...@@ -196,8 +195,8 @@ ...@@ -196,8 +195,8 @@
}, },
{ {
"in": "query", "in": "query",
"description": "真实姓名", "description": "密码",
"name": "realName", "name": "password",
"required": true, "required": true,
"dataType": { "dataType": {
"typeArgs": [], "typeArgs": [],
...@@ -211,9 +210,9 @@ ...@@ -211,9 +210,9 @@
}, },
{ {
"in": "query", "in": "query",
"description": "职称", "description": "真实姓名",
"name": "title", "name": "realName",
"required": false, "required": true,
"dataType": { "dataType": {
"typeArgs": [], "typeArgs": [],
"typeName": "string", "typeName": "string",
...@@ -241,17 +240,17 @@ ...@@ -241,17 +240,17 @@
} }
] ]
} }
] ],
"name": "auth"
}, },
{ {
"description": "", "description": "",
"name": "hello",
"interfaces": [ "interfaces": [
{ {
"description": "hello", "description": "hello",
"name": "hello", "name": "hello",
"method": "get", "method": "get",
"path": "/basic-api/hello/", "path": "/api/hello/",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -277,7 +276,7 @@ ...@@ -277,7 +276,7 @@
"description": "fail", "description": "fail",
"name": "fail", "name": "fail",
"method": "get", "method": "get",
"path": "/basic-api/hello/fail", "path": "/api/hello/fail",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -303,7 +302,7 @@ ...@@ -303,7 +302,7 @@
"description": "page", "description": "page",
"name": "page", "name": "page",
"method": "get", "method": "get",
"path": "/basic-api/hello/page", "path": "/api/hello/page",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -399,11 +398,11 @@ ...@@ -399,11 +398,11 @@
} }
] ]
} }
] ],
"name": "hello"
}, },
{ {
"description": "", "description": "",
"name": "minio",
"interfaces": [ "interfaces": [
{ {
"consumes": [ "consumes": [
...@@ -412,7 +411,7 @@ ...@@ -412,7 +411,7 @@
"description": "文件上传", "description": "文件上传",
"name": "upload", "name": "upload",
"method": "post", "method": "post",
"path": "/basic-api/common/minio/upload", "path": "/api/common/minio/upload",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -450,11 +449,11 @@ ...@@ -450,11 +449,11 @@
} }
] ]
} }
] ],
"name": "minio"
}, },
{ {
"description": "", "description": "",
"name": "permission",
"interfaces": [ "interfaces": [
{ {
"consumes": [ "consumes": [
...@@ -463,7 +462,7 @@ ...@@ -463,7 +462,7 @@
"description": "新增", "description": "新增",
"name": "add", "name": "add",
"method": "post", "method": "post",
"path": "/basic-api/manage/permission/add", "path": "/api/manage/permission/add",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -546,6 +545,21 @@ ...@@ -546,6 +545,21 @@
}, },
{ {
"in": "query", "in": "query",
"description": "元数据",
"name": "meta",
"required": false,
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
},
{
"in": "query",
"description": "名称", "description": "名称",
"name": "name", "name": "name",
"required": true, "required": true,
...@@ -616,6 +630,7 @@ ...@@ -616,6 +630,7 @@
"templateIndex": -1, "templateIndex": -1,
"compileTemplateKeyword": "#/definitions/", "compileTemplateKeyword": "#/definitions/",
"enum": [ "enum": [
"'DIR'",
"'MENU'", "'MENU'",
"'BUTTON'" "'BUTTON'"
], ],
...@@ -646,7 +661,7 @@ ...@@ -646,7 +661,7 @@
"description": "删除", "description": "删除",
"name": "deleted", "name": "deleted",
"method": "post", "method": "post",
"path": "/basic-api/manage/permission/deleted", "path": "/api/manage/permission/deleted",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -688,7 +703,7 @@ ...@@ -688,7 +703,7 @@
"description": "查询", "description": "查询",
"name": "find", "name": "find",
"method": "get", "method": "get",
"path": "/basic-api/manage/permission/find", "path": "/api/manage/permission/find",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -733,7 +748,7 @@ ...@@ -733,7 +748,7 @@
"description": "修改", "description": "修改",
"name": "modify", "name": "modify",
"method": "post", "method": "post",
"path": "/basic-api/manage/permission/modify", "path": "/api/manage/permission/modify",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -831,6 +846,21 @@ ...@@ -831,6 +846,21 @@
}, },
{ {
"in": "query", "in": "query",
"description": "元数据",
"name": "meta",
"required": false,
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
},
{
"in": "query",
"description": "名称", "description": "名称",
"name": "name", "name": "name",
"required": true, "required": true,
...@@ -901,6 +931,7 @@ ...@@ -901,6 +931,7 @@
"templateIndex": -1, "templateIndex": -1,
"compileTemplateKeyword": "#/definitions/", "compileTemplateKeyword": "#/definitions/",
"enum": [ "enum": [
"'DIR'",
"'MENU'", "'MENU'",
"'BUTTON'" "'BUTTON'"
], ],
...@@ -928,7 +959,7 @@ ...@@ -928,7 +959,7 @@
"description": "分页查询", "description": "分页查询",
"name": "page", "name": "page",
"method": "get", "method": "get",
"path": "/basic-api/manage/permission/page", "path": "/api/manage/permission/page",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1031,7 +1062,7 @@ ...@@ -1031,7 +1062,7 @@
"description": "树结构查询", "description": "树结构查询",
"name": "tree", "name": "tree",
"method": "get", "method": "get",
"path": "/basic-api/manage/permission/tree", "path": "/api/manage/permission/tree",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1079,11 +1110,11 @@ ...@@ -1079,11 +1110,11 @@
} }
] ]
} }
] ],
"name": "permission"
}, },
{ {
"description": "", "description": "",
"name": "role",
"interfaces": [ "interfaces": [
{ {
"consumes": [ "consumes": [
...@@ -1092,7 +1123,7 @@ ...@@ -1092,7 +1123,7 @@
"description": "新增", "description": "新增",
"name": "add", "name": "add",
"method": "post", "method": "post",
"path": "/basic-api/manage/role/add", "path": "/api/manage/role/add",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1152,7 +1183,7 @@ ...@@ -1152,7 +1183,7 @@
"description": "分配权限", "description": "分配权限",
"name": "assign", "name": "assign",
"method": "post", "method": "post",
"path": "/basic-api/manage/role/assign", "path": "/api/manage/role/assign",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1212,7 +1243,7 @@ ...@@ -1212,7 +1243,7 @@
"description": "删除", "description": "删除",
"name": "deleted", "name": "deleted",
"method": "post", "method": "post",
"path": "/basic-api/manage/role/deleted", "path": "/api/manage/role/deleted",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1254,7 +1285,7 @@ ...@@ -1254,7 +1285,7 @@
"description": "查询", "description": "查询",
"name": "find", "name": "find",
"method": "get", "method": "get",
"path": "/basic-api/manage/role/find", "path": "/api/manage/role/find",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1299,7 +1330,7 @@ ...@@ -1299,7 +1330,7 @@
"description": "修改", "description": "修改",
"name": "modify", "name": "modify",
"method": "post", "method": "post",
"path": "/basic-api/manage/role/modify", "path": "/api/manage/role/modify",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1371,7 +1402,7 @@ ...@@ -1371,7 +1402,7 @@
"description": "分页查询", "description": "分页查询",
"name": "page", "name": "page",
"method": "get", "method": "get",
"path": "/basic-api/manage/role/page", "path": "/api/manage/role/page",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1471,7 +1502,7 @@ ...@@ -1471,7 +1502,7 @@
"description": "选项查询", "description": "选项查询",
"name": "selector", "name": "selector",
"method": "get", "method": "get",
"path": "/basic-api/manage/role/selector", "path": "/api/manage/role/selector",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1503,17 +1534,53 @@ ...@@ -1503,17 +1534,53 @@
}, },
"parameters": [] "parameters": []
} }
] ],
"name": "role"
}, },
{ {
"description": "", "description": "",
"name": "user",
"interfaces": [ "interfaces": [
{ {
"description": "获取用户权限",
"name": "getMenuList",
"method": "get",
"path": "/api/user/getMenuList",
"response": {
"typeArgs": [
{
"typeArgs": [
{
"typeArgs": [],
"typeName": "MenuVo",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "Array",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "Result",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"parameters": []
},
{
"description": "获取登录用户信息", "description": "获取登录用户信息",
"name": "info", "name": "getUserInfo",
"method": "get", "method": "get",
"path": "/basic-api/user/info", "path": "/api/user/getUserInfo",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1542,7 +1609,7 @@ ...@@ -1542,7 +1609,7 @@
"description": "分配角色", "description": "分配角色",
"name": "assign", "name": "assign",
"method": "post", "method": "post",
"path": "/basic-api/user/manage/assign", "path": "/api/user/manage/assign",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1599,7 +1666,7 @@ ...@@ -1599,7 +1666,7 @@
"description": "分页查询", "description": "分页查询",
"name": "page", "name": "page",
"method": "get", "method": "get",
"path": "/basic-api/user/manage/page", "path": "/api/user/manage/page",
"response": { "response": {
"typeArgs": [ "typeArgs": [
{ {
...@@ -1695,13 +1762,13 @@ ...@@ -1695,13 +1762,13 @@
} }
] ]
} }
] ],
"name": "user"
} }
], ],
"baseClasses": [ "baseClasses": [
{ {
"name": "LoginVo", "name": "LoginVo",
"templateArgs": [],
"properties": [ "properties": [
{ {
"dataType": { "dataType": {
...@@ -1716,15 +1783,33 @@ ...@@ -1716,15 +1783,33 @@
"name": "token", "name": "token",
"description": "token", "description": "token",
"required": false "required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "number",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "userId",
"description": "主键",
"required": false
} }
] ],
"templateArgs": []
}, },
{ {
"name": "PageVo", "name": "MenuVo",
"templateArgs": [ "properties": [
{
"dataType": {
"typeArgs": [
{ {
"typeArgs": [], "typeArgs": [],
"typeName": "PermissionVo", "typeName": "MenuVo",
"isDefsType": true, "isDefsType": true,
"templateIndex": -1, "templateIndex": -1,
"compileTemplateKeyword": "#/definitions/", "compileTemplateKeyword": "#/definitions/",
...@@ -1732,6 +1817,115 @@ ...@@ -1732,6 +1817,115 @@
"typeProperties": [] "typeProperties": []
} }
], ],
"typeName": "Array",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "children",
"description": "子权限",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "component",
"description": "组件",
"required": false
},
{
"dataType": {
"typeArgs": [
{
"typeArgs": [],
"typeName": "",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
{
"typeArgs": [],
"typeName": "object",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "ObjectMap",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "meta",
"description": "元数据",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "name",
"description": "标识",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "path",
"description": "路径",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [
"'DIR'",
"'MENU'",
"'BUTTON'"
],
"typeProperties": []
},
"name": "type",
"description": "权限类型",
"required": false
}
],
"templateArgs": []
},
{
"name": "PageVo",
"properties": [ "properties": [
{ {
"dataType": { "dataType": {
...@@ -1785,11 +1979,21 @@ ...@@ -1785,11 +1979,21 @@
"description": "数据总数", "description": "数据总数",
"required": false "required": false
} }
],
"templateArgs": [
{
"typeArgs": [],
"typeName": "PermissionVo",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
] ]
}, },
{ {
"name": "PermissionVo", "name": "PermissionVo",
"templateArgs": [],
"properties": [ "properties": [
{ {
"dataType": { "dataType": {
...@@ -1887,6 +2091,39 @@ ...@@ -1887,6 +2091,39 @@
}, },
{ {
"dataType": { "dataType": {
"typeArgs": [
{
"typeArgs": [],
"typeName": "",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
{
"typeArgs": [],
"typeName": "object",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "ObjectMap",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "meta",
"description": "元数据",
"required": false
},
{
"dataType": {
"typeArgs": [], "typeArgs": [],
"typeName": "string", "typeName": "string",
"isDefsType": false, "isDefsType": false,
...@@ -1949,6 +2186,7 @@ ...@@ -1949,6 +2186,7 @@
"templateIndex": -1, "templateIndex": -1,
"compileTemplateKeyword": "#/definitions/", "compileTemplateKeyword": "#/definitions/",
"enum": [ "enum": [
"'DIR'",
"'MENU'", "'MENU'",
"'BUTTON'" "'BUTTON'"
], ],
...@@ -1972,21 +2210,11 @@ ...@@ -1972,21 +2210,11 @@
"description": "标识", "description": "标识",
"required": false "required": false
} }
] ],
"templateArgs": []
}, },
{ {
"name": "Result", "name": "Result",
"templateArgs": [
{
"typeArgs": [],
"typeName": "LoginVo",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"properties": [ "properties": [
{ {
"dataType": { "dataType": {
...@@ -2100,11 +2328,21 @@ ...@@ -2100,11 +2328,21 @@
"description": "响应时间", "description": "响应时间",
"required": false "required": false
} }
],
"templateArgs": [
{
"typeArgs": [],
"typeName": "LoginVo",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
] ]
}, },
{ {
"name": "RoleVo", "name": "RoleVo",
"templateArgs": [],
"properties": [ "properties": [
{ {
"dataType": { "dataType": {
...@@ -2172,11 +2410,11 @@ ...@@ -2172,11 +2410,11 @@
"description": "标识", "description": "标识",
"required": false "required": false
} }
] ],
"templateArgs": []
}, },
{ {
"name": "UserInfo", "name": "UserInfo",
"templateArgs": [],
"properties": [ "properties": [
{ {
"dataType": { "dataType": {
...@@ -2202,8 +2440,8 @@ ...@@ -2202,8 +2440,8 @@
"enum": [], "enum": [],
"typeProperties": [] "typeProperties": []
}, },
"name": "email", "name": "desc",
"description": "邮箱", "description": "介绍",
"required": false "required": false
}, },
{ {
...@@ -2217,45 +2455,7 @@ ...@@ -2217,45 +2455,7 @@
"typeProperties": [] "typeProperties": []
}, },
"name": "homePath", "name": "homePath",
"description": "主页地址", "description": "用户主页",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "mobile",
"description": "手机号",
"required": false
},
{
"dataType": {
"typeArgs": [
{
"typeArgs": [],
"typeName": "PermissionVo",
"isDefsType": true,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
}
],
"typeName": "Array",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "permissions",
"description": "权限",
"required": false "required": false
}, },
{ {
...@@ -2299,20 +2499,6 @@ ...@@ -2299,20 +2499,6 @@
{ {
"dataType": { "dataType": {
"typeArgs": [], "typeArgs": [],
"typeName": "string",
"isDefsType": false,
"templateIndex": -1,
"compileTemplateKeyword": "#/definitions/",
"enum": [],
"typeProperties": []
},
"name": "title",
"description": "职称",
"required": false
},
{
"dataType": {
"typeArgs": [],
"typeName": "number", "typeName": "number",
"isDefsType": false, "isDefsType": false,
"templateIndex": -1, "templateIndex": -1,
...@@ -2338,11 +2524,11 @@ ...@@ -2338,11 +2524,11 @@
"description": "用户名", "description": "用户名",
"required": false "required": false
} }
] ],
"templateArgs": []
}, },
{ {
"name": "UserVo", "name": "UserVo",
"templateArgs": [],
"properties": [ "properties": [
{ {
"dataType": { "dataType": {
...@@ -2512,7 +2698,8 @@ ...@@ -2512,7 +2698,8 @@
"description": "用户名", "description": "用户名",
"required": false "required": false
} }
] ],
"templateArgs": []
} }
], ],
"name": "" "name": ""
......
...@@ -6,6 +6,29 @@ declare namespace defs { ...@@ -6,6 +6,29 @@ declare namespace defs {
export class LoginVo { export class LoginVo {
/** token */ /** token */
token?: string token?: string
/** 主键 */
userId?: number
}
export class MenuVo {
/** 子权限 */
children?: Array<defs.MenuVo>
/** 组件 */
component?: string
/** 元数据 */
meta?: ObjectMap<any, object>
/** 标识 */
name?: string
/** 路径 */
path?: string
/** 权限类型 */
type?: 'DIR' | 'MENU' | 'BUTTON'
} }
export class PageVo<T0 = any> { export class PageVo<T0 = any> {
...@@ -38,6 +61,9 @@ declare namespace defs { ...@@ -38,6 +61,9 @@ declare namespace defs {
/** 主键 */ /** 主键 */
id?: number id?: number
/** 元数据 */
meta?: ObjectMap<any, object>
/** 名称 */ /** 名称 */
name?: string name?: string
...@@ -51,7 +77,7 @@ declare namespace defs { ...@@ -51,7 +77,7 @@ declare namespace defs {
serial?: number serial?: number
/** 权限类型 */ /** 权限类型 */
type?: 'MENU' | 'BUTTON' type?: 'DIR' | 'MENU' | 'BUTTON'
/** 标识 */ /** 标识 */
uid?: string uid?: string
...@@ -101,27 +127,18 @@ declare namespace defs { ...@@ -101,27 +127,18 @@ declare namespace defs {
/** 头像 */ /** 头像 */
avatar?: string avatar?: string
/** 邮箱 */ /** 介绍 */
email?: string desc?: string
/** 主页地址 */ /** 用户主页 */
homePath?: string homePath?: string
/** 手机号 */
mobile?: string
/** 权限 */
permissions?: Array<defs.PermissionVo>
/** 真实姓名 */ /** 真实姓名 */
realName?: string realName?: string
/** 角色 */ /** 角色 */
roles?: Array<defs.RoleVo> roles?: Array<defs.RoleVo>
/** 职称 */
title?: string
/** 主键 */ /** 主键 */
userId?: number userId?: number
...@@ -175,7 +192,7 @@ declare namespace API { ...@@ -175,7 +192,7 @@ declare namespace API {
export namespace auth { export namespace auth {
/** /**
* 登录 * 登录
* /basic-api/auth/login * /api/auth/login
*/ */
export namespace login { export namespace login {
export class Params { export class Params {
...@@ -198,7 +215,7 @@ declare namespace API { ...@@ -198,7 +215,7 @@ declare namespace API {
/** /**
* 登出 * 登出
* /basic-api/auth/logout * /api/auth/logout
*/ */
export namespace logout { export namespace logout {
export class Params {} export class Params {}
...@@ -216,7 +233,7 @@ declare namespace API { ...@@ -216,7 +233,7 @@ declare namespace API {
/** /**
* 注册 * 注册
* /basic-api/auth/register * /api/auth/register
*/ */
export namespace register { export namespace register {
export class Params { export class Params {
...@@ -226,14 +243,14 @@ declare namespace API { ...@@ -226,14 +243,14 @@ declare namespace API {
email?: string email?: string
/** 是否启用 */ /** 是否启用 */
enable?: boolean enable?: boolean
/** 简介 */
introduction?: string
/** 手机号 */ /** 手机号 */
mobile: string mobile: string
/** 密码 */ /** 密码 */
password: string password: string
/** 真实姓名 */ /** 真实姓名 */
realName: string realName: string
/** 职称 */
title?: string
/** 用户名 */ /** 用户名 */
username: string username: string
} }
...@@ -256,7 +273,7 @@ declare namespace API { ...@@ -256,7 +273,7 @@ declare namespace API {
export namespace hello { export namespace hello {
/** /**
* hello * hello
* /basic-api/hello/ * /api/hello/
*/ */
export namespace hello { export namespace hello {
export class Params {} export class Params {}
...@@ -274,7 +291,7 @@ declare namespace API { ...@@ -274,7 +291,7 @@ declare namespace API {
/** /**
* fail * fail
* /basic-api/hello/fail * /api/hello/fail
*/ */
export namespace fail { export namespace fail {
export class Params {} export class Params {}
...@@ -292,7 +309,7 @@ declare namespace API { ...@@ -292,7 +309,7 @@ declare namespace API {
/** /**
* page * page
* /basic-api/hello/page * /api/hello/page
*/ */
export namespace page { export namespace page {
export class Params { export class Params {
...@@ -324,7 +341,7 @@ declare namespace API { ...@@ -324,7 +341,7 @@ declare namespace API {
export namespace minio { export namespace minio {
/** /**
* 文件上传 * 文件上传
* /basic-api/common/minio/upload * /api/common/minio/upload
*/ */
export namespace upload { export namespace upload {
export class Params {} export class Params {}
...@@ -348,7 +365,7 @@ declare namespace API { ...@@ -348,7 +365,7 @@ declare namespace API {
export namespace permission { export namespace permission {
/** /**
* 新增 * 新增
* /basic-api/manage/permission/add * /api/manage/permission/add
*/ */
export namespace add { export namespace add {
export class Params { export class Params {
...@@ -360,6 +377,8 @@ declare namespace API { ...@@ -360,6 +377,8 @@ declare namespace API {
hidden?: boolean hidden?: boolean
/** 图标 */ /** 图标 */
icon?: string icon?: string
/** 元数据 */
meta?: string
/** 名称 */ /** 名称 */
name: string name: string
/** 路径 */ /** 路径 */
...@@ -369,7 +388,7 @@ declare namespace API { ...@@ -369,7 +388,7 @@ declare namespace API {
/** 序号 */ /** 序号 */
serial?: number serial?: number
/** 权限类型 */ /** 权限类型 */
type: 'MENU' | 'BUTTON' type: 'DIR' | 'MENU' | 'BUTTON'
/** 标识 */ /** 标识 */
uid: string uid: string
} }
...@@ -387,7 +406,7 @@ declare namespace API { ...@@ -387,7 +406,7 @@ declare namespace API {
/** /**
* 删除 * 删除
* /basic-api/manage/permission/deleted * /api/manage/permission/deleted
*/ */
export namespace deleted { export namespace deleted {
export class Params { export class Params {
...@@ -408,7 +427,7 @@ declare namespace API { ...@@ -408,7 +427,7 @@ declare namespace API {
/** /**
* 查询 * 查询
* /basic-api/manage/permission/find * /api/manage/permission/find
*/ */
export namespace find { export namespace find {
export class Params { export class Params {
...@@ -429,7 +448,7 @@ declare namespace API { ...@@ -429,7 +448,7 @@ declare namespace API {
/** /**
* 修改 * 修改
* /basic-api/manage/permission/modify * /api/manage/permission/modify
*/ */
export namespace modify { export namespace modify {
export class Params { export class Params {
...@@ -443,6 +462,8 @@ declare namespace API { ...@@ -443,6 +462,8 @@ declare namespace API {
icon?: string icon?: string
/** id */ /** id */
id: number id: number
/** 元数据 */
meta?: string
/** 名称 */ /** 名称 */
name: string name: string
/** 路径 */ /** 路径 */
...@@ -452,7 +473,7 @@ declare namespace API { ...@@ -452,7 +473,7 @@ declare namespace API {
/** 序号 */ /** 序号 */
serial?: number serial?: number
/** 权限类型 */ /** 权限类型 */
type: 'MENU' | 'BUTTON' type: 'DIR' | 'MENU' | 'BUTTON'
/** 标识 */ /** 标识 */
uid: string uid: string
} }
...@@ -470,7 +491,7 @@ declare namespace API { ...@@ -470,7 +491,7 @@ declare namespace API {
/** /**
* 分页查询 * 分页查询
* /basic-api/manage/permission/page * /api/manage/permission/page
*/ */
export namespace page { export namespace page {
export class Params { export class Params {
...@@ -497,7 +518,7 @@ declare namespace API { ...@@ -497,7 +518,7 @@ declare namespace API {
/** /**
* 树结构查询 * 树结构查询
* /basic-api/manage/permission/tree * /api/manage/permission/tree
*/ */
export namespace tree { export namespace tree {
export class Params { export class Params {
...@@ -523,7 +544,7 @@ declare namespace API { ...@@ -523,7 +544,7 @@ declare namespace API {
export namespace role { export namespace role {
/** /**
* 新增 * 新增
* /basic-api/manage/role/add * /api/manage/role/add
*/ */
export namespace add { export namespace add {
export class Params { export class Params {
...@@ -546,7 +567,7 @@ declare namespace API { ...@@ -546,7 +567,7 @@ declare namespace API {
/** /**
* 分配权限 * 分配权限
* /basic-api/manage/role/assign * /api/manage/role/assign
*/ */
export namespace assign { export namespace assign {
export class Params { export class Params {
...@@ -569,7 +590,7 @@ declare namespace API { ...@@ -569,7 +590,7 @@ declare namespace API {
/** /**
* 删除 * 删除
* /basic-api/manage/role/deleted * /api/manage/role/deleted
*/ */
export namespace deleted { export namespace deleted {
export class Params { export class Params {
...@@ -590,7 +611,7 @@ declare namespace API { ...@@ -590,7 +611,7 @@ declare namespace API {
/** /**
* 查询 * 查询
* /basic-api/manage/role/find * /api/manage/role/find
*/ */
export namespace find { export namespace find {
export class Params { export class Params {
...@@ -611,7 +632,7 @@ declare namespace API { ...@@ -611,7 +632,7 @@ declare namespace API {
/** /**
* 修改 * 修改
* /basic-api/manage/role/modify * /api/manage/role/modify
*/ */
export namespace modify { export namespace modify {
export class Params { export class Params {
...@@ -636,7 +657,7 @@ declare namespace API { ...@@ -636,7 +657,7 @@ declare namespace API {
/** /**
* 分页查询 * 分页查询
* /basic-api/manage/role/page * /api/manage/role/page
*/ */
export namespace page { export namespace page {
export class Params { export class Params {
...@@ -663,7 +684,7 @@ declare namespace API { ...@@ -663,7 +684,7 @@ declare namespace API {
/** /**
* 选项查询 * 选项查询
* /basic-api/manage/role/selector * /api/manage/role/selector
*/ */
export namespace selector { export namespace selector {
export class Params {} export class Params {}
...@@ -685,10 +706,28 @@ declare namespace API { ...@@ -685,10 +706,28 @@ declare namespace API {
*/ */
export namespace user { export namespace user {
/** /**
* 获取用户权限
* /api/user/getMenuList
*/
export namespace getMenuList {
export class Params {}
export type Response = Array<defs.MenuVo>
export const init: Response
export function request(
params: Params,
config?: http.RequestConfig<Params>,
options?: http.RequestOptions,
): Promise<Response>
}
/**
* 获取登录用户信息 * 获取登录用户信息
* /basic-api/user/info * /api/user/getUserInfo
*/ */
export namespace info { export namespace getUserInfo {
export class Params {} export class Params {}
export type Response = defs.UserInfo export type Response = defs.UserInfo
...@@ -704,7 +743,7 @@ declare namespace API { ...@@ -704,7 +743,7 @@ declare namespace API {
/** /**
* 分配角色 * 分配角色
* /basic-api/user/manage/assign * /api/user/manage/assign
*/ */
export namespace assign { export namespace assign {
export class Params { export class Params {
...@@ -727,7 +766,7 @@ declare namespace API { ...@@ -727,7 +766,7 @@ declare namespace API {
/** /**
* 分页查询 * 分页查询
* /basic-api/user/manage/page * /api/user/manage/page
*/ */
export namespace page { export namespace page {
export class Params { export class Params {
......
export class LoginVo { export class LoginVo {
/** token */ /** token */
token = '' token = ''
/** 主键 */
userId = undefined
}
export class MenuVo {
/** 子权限 */
children = []
/** 组件 */
component = ''
/** 元数据 */
meta = undefined
/** 标识 */
name = ''
/** 路径 */
path = ''
/** 权限类型 */
type = 'DIR'
} }
export class PageVo { export class PageVo {
...@@ -33,6 +56,9 @@ export class PermissionVo { ...@@ -33,6 +56,9 @@ export class PermissionVo {
/** 主键 */ /** 主键 */
id = undefined id = undefined
/** 元数据 */
meta = undefined
/** 名称 */ /** 名称 */
name = '' name = ''
...@@ -46,7 +72,7 @@ export class PermissionVo { ...@@ -46,7 +72,7 @@ export class PermissionVo {
serial = undefined serial = undefined
/** 权限类型 */ /** 权限类型 */
type = 'MENU' type = 'DIR'
/** 标识 */ /** 标识 */
uid = '' uid = ''
...@@ -96,27 +122,18 @@ export class UserInfo { ...@@ -96,27 +122,18 @@ export class UserInfo {
/** 头像 */ /** 头像 */
avatar = '' avatar = ''
/** 邮箱 */ /** 介绍 */
email = '' desc = ''
/** 主页地址 */ /** 用户主页 */
homePath = '' homePath = ''
/** 手机号 */
mobile = ''
/** 权限 */
permissions = []
/** 真实姓名 */ /** 真实姓名 */
realName = '' realName = ''
/** 角色 */ /** 角色 */
roles = [] roles = []
/** 职称 */
title = ''
/** 主键 */ /** 主键 */
userId = undefined userId = undefined
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 账号(支持用户名/手机号/邮箱) */ /** 账号(支持用户名/手机号/邮箱) */
...@@ -15,9 +15,9 @@ export class Params { ...@@ -15,9 +15,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/auth/login', url: '/auth/login',
method: 'POST', method: 'POST',
data: params, data: params,
......
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/auth/logout', url: '/auth/logout',
method: 'GET', method: 'GET',
params, params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 头像 */ /** 头像 */
...@@ -12,14 +12,14 @@ export class Params { ...@@ -12,14 +12,14 @@ export class Params {
email?: string email?: string
/** 是否启用 */ /** 是否启用 */
enable?: boolean enable?: boolean
/** 简介 */
introduction?: string
/** 手机号 */ /** 手机号 */
mobile: string mobile: string
/** 密码 */ /** 密码 */
password: string password: string
/** 真实姓名 */ /** 真实姓名 */
realName: string realName: string
/** 职称 */
title?: string
/** 用户名 */ /** 用户名 */
username: string username: string
} }
...@@ -27,9 +27,9 @@ export class Params { ...@@ -27,9 +27,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/auth/register', url: '/auth/register',
method: 'POST', method: 'POST',
data: params, data: params,
......
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/hello/fail', url: '/hello/fail',
method: 'GET', method: 'GET',
params, params,
......
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/hello/', url: '/hello/',
method: 'GET', method: 'GET',
params, params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 当前页数 */ /** 当前页数 */
...@@ -19,9 +19,9 @@ export class Params { ...@@ -19,9 +19,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/hello/page', url: '/hello/page',
method: 'GET', method: 'GET',
params, params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
...@@ -15,9 +15,9 @@ export function request( ...@@ -15,9 +15,9 @@ export function request(
config?: http.RequestConfig<Params | FormData>, config?: http.RequestConfig<Params | FormData>,
options?: http.RequestOptions, options?: http.RequestOptions,
) { ) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/common/minio/upload', url: '/common/minio/upload',
method: 'POST', method: 'POST',
data: form || params, data: form || params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 组件 */ /** 组件 */
...@@ -14,6 +14,8 @@ export class Params { ...@@ -14,6 +14,8 @@ export class Params {
hidden?: boolean hidden?: boolean
/** 图标 */ /** 图标 */
icon?: string icon?: string
/** 元数据 */
meta?: string
/** 名称 */ /** 名称 */
name: string name: string
/** 路径 */ /** 路径 */
...@@ -23,7 +25,7 @@ export class Params { ...@@ -23,7 +25,7 @@ export class Params {
/** 序号 */ /** 序号 */
serial?: number serial?: number
/** 权限类型 */ /** 权限类型 */
type: 'MENU' | 'BUTTON' type: 'DIR' | 'MENU' | 'BUTTON'
/** 标识 */ /** 标识 */
uid: string uid: string
} }
...@@ -31,9 +33,9 @@ export class Params { ...@@ -31,9 +33,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/permission/add', url: '/manage/permission/add',
method: 'POST', method: 'POST',
data: params, data: params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** id */ /** id */
...@@ -13,9 +13,9 @@ export class Params { ...@@ -13,9 +13,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/permission/deleted', url: '/manage/permission/deleted',
method: 'POST', method: 'POST',
data: params, data: params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** id */ /** id */
...@@ -13,9 +13,9 @@ export class Params { ...@@ -13,9 +13,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/permission/find', url: '/manage/permission/find',
method: 'GET', method: 'GET',
params, params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 组件 */ /** 组件 */
...@@ -16,6 +16,8 @@ export class Params { ...@@ -16,6 +16,8 @@ export class Params {
icon?: string icon?: string
/** id */ /** id */
id: number id: number
/** 元数据 */
meta?: string
/** 名称 */ /** 名称 */
name: string name: string
/** 路径 */ /** 路径 */
...@@ -25,7 +27,7 @@ export class Params { ...@@ -25,7 +27,7 @@ export class Params {
/** 序号 */ /** 序号 */
serial?: number serial?: number
/** 权限类型 */ /** 权限类型 */
type: 'MENU' | 'BUTTON' type: 'DIR' | 'MENU' | 'BUTTON'
/** 标识 */ /** 标识 */
uid: string uid: string
} }
...@@ -33,9 +35,9 @@ export class Params { ...@@ -33,9 +35,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/permission/modify', url: '/manage/permission/modify',
method: 'POST', method: 'POST',
data: params, data: params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 当前页数 */ /** 当前页数 */
...@@ -19,9 +19,9 @@ export class Params { ...@@ -19,9 +19,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/permission/page', url: '/manage/permission/page',
method: 'GET', method: 'GET',
params, params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 父级 id */ /** 父级 id */
...@@ -13,9 +13,9 @@ export class Params { ...@@ -13,9 +13,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/permission/tree', url: '/manage/permission/tree',
method: 'GET', method: 'GET',
params, params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 名称 */ /** 名称 */
...@@ -15,9 +15,9 @@ export class Params { ...@@ -15,9 +15,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/role/add', url: '/manage/role/add',
method: 'POST', method: 'POST',
data: params, data: params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** id */ /** id */
...@@ -15,9 +15,9 @@ export class Params { ...@@ -15,9 +15,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/role/assign', url: '/manage/role/assign',
method: 'POST', method: 'POST',
data: params, data: params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** id */ /** id */
...@@ -13,9 +13,9 @@ export class Params { ...@@ -13,9 +13,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/role/deleted', url: '/manage/role/deleted',
method: 'POST', method: 'POST',
data: params, data: params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** id */ /** id */
...@@ -13,9 +13,9 @@ export class Params { ...@@ -13,9 +13,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/role/find', url: '/manage/role/find',
method: 'GET', method: 'GET',
params, params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** id */ /** id */
...@@ -17,9 +17,9 @@ export class Params { ...@@ -17,9 +17,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/role/modify', url: '/manage/role/modify',
method: 'POST', method: 'POST',
data: params, data: params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 当前页数 */ /** 当前页数 */
...@@ -19,9 +19,9 @@ export class Params { ...@@ -19,9 +19,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/role/page', url: '/manage/role/page',
method: 'GET', method: 'GET',
params, params,
......
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/manage/role/selector', url: '/manage/role/selector',
method: 'GET', method: 'GET',
params, params,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** id */ /** id */
...@@ -15,9 +15,9 @@ export class Params { ...@@ -15,9 +15,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/user/manage/assign', url: '/user/manage/assign',
method: 'POST', method: 'POST',
data: params, data: params,
......
/**
* @desc 获取用户权限
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {}
export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/user/getMenuList',
method: 'GET',
params,
...config,
},
options,
)
}
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/user/info', url: '/user/getUserInfo',
method: 'GET', method: 'GET',
params, params,
......
/** /**
* @description * @description
*/ */
import * as info from './info' import * as getMenuList from './getMenuList'
import * as getUserInfo from './getUserInfo'
import * as assign from './assign' import * as assign from './assign'
import * as page from './page' import * as page from './page'
export { info, assign, page } export { getMenuList, getUserInfo, assign, page }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { Http } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 当前页数 */ /** 当前页数 */
...@@ -19,9 +19,9 @@ export class Params { ...@@ -19,9 +19,9 @@ export class Params {
export const init = new defs.Result() export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return Http.request( return defHttp.request(
{ {
url: '/basic-api/user/manage/page', url: '/user/manage/page',
method: 'GET', method: 'GET',
params, params,
......
...@@ -2,7 +2,7 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -2,7 +2,7 @@ import { defHttp } from '/@/utils/http/axios'
import { getMenuListResultModel } from './model/menuModel' import { getMenuListResultModel } from './model/menuModel'
enum Api { enum Api {
GetMenuList = '/getMenuList', GetMenuList = '/user/getMenuList',
} }
/** /**
......
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
* @description: Login interface parameters * @description: Login interface parameters
*/ */
export interface LoginParams { export interface LoginParams {
username: string account: string
password: string password: string
} }
export interface RoleInfo { export interface RoleInfo {
roleName: string id: string | number
value: string uid: string
name: string
} }
/** /**
...@@ -17,7 +18,7 @@ export interface RoleInfo { ...@@ -17,7 +18,7 @@ export interface RoleInfo {
export interface LoginResultModel { export interface LoginResultModel {
userId: string | number userId: string | number
token: string token: string
role: RoleInfo role?: RoleInfo
} }
/** /**
......
...@@ -4,11 +4,11 @@ import { LoginParams, LoginResultModel, GetUserInfoModel } from './model/userMod ...@@ -4,11 +4,11 @@ import { LoginParams, LoginResultModel, GetUserInfoModel } from './model/userMod
import { ErrorMessageMode } from '/#/axios' import { ErrorMessageMode } from '/#/axios'
enum Api { enum Api {
Login = '/login', Login = '/auth/login',
Logout = '/logout', Logout = '/auth/logout',
GetUserInfo = '/getUserInfo', GetUserInfo = '/user/getUserInfo',
GetPermCode = '/getPermCode', GetPermCode = '/auth/getPermCode',
TestRetry = '/testRetry', TestRetry = '/auth/testRetry',
} }
/** /**
......
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
loginSuccessDesc: 'Welcome back', loginSuccessDesc: 'Welcome back',
// placeholder // placeholder
accountPlaceholder: 'Please input username', accountPlaceholder: 'Please input account',
passwordPlaceholder: 'Please input password', passwordPlaceholder: 'Please input password',
smsPlaceholder: 'Please input sms code', smsPlaceholder: 'Please input sms code',
mobilePlaceholder: 'Please input mobile', mobilePlaceholder: 'Please input mobile',
......
...@@ -70,7 +70,7 @@ const setting: ProjectConfig = { ...@@ -70,7 +70,7 @@ const setting: ProjectConfig = {
// Whether to show the document button // Whether to show the document button
showDoc: true, showDoc: true,
// Whether to show the notification button // Whether to show the notification button
showNotice: true, showNotice: false,
// Whether to display the menu search // Whether to display the menu search
showSearch: true, showSearch: true,
}, },
......
...@@ -40,7 +40,7 @@ export const useLockStore = defineStore({ ...@@ -40,7 +40,7 @@ export const useLockStore = defineStore({
try { try {
const username = userStore.getUserInfo?.username const username = userStore.getUserInfo?.username
const res = await userStore.login({ const res = await userStore.login({
username, account: username,
password: password!, password: password!,
goHome: false, goHome: false,
mode: 'none', mode: 'none',
......
...@@ -214,9 +214,9 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) { ...@@ -214,9 +214,9 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
// 基础接口地址 // 基础接口地址
// baseURL: globSetting.apiUrl, // baseURL: globSetting.apiUrl,
headers: { 'Content-Type': ContentTypeEnum.JSON }, // headers: { 'Content-Type': ContentTypeEnum.JSON },
// 如果是form-data格式 // 如果是form-data格式
// headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED }, headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
// 数据处理方式 // 数据处理方式
transform: clone(transform), transform: clone(transform),
// 配置项,下面的选项都可以在独立的接口请求中覆盖 // 配置项,下面的选项都可以在独立的接口请求中覆盖
...@@ -260,13 +260,13 @@ export const defHttp = createAxios() ...@@ -260,13 +260,13 @@ export const defHttp = createAxios()
// 自定义配置 // 自定义配置
// TODO: 实际项目所需的请求配置 // TODO: 实际项目所需的请求配置
// const { apiUrl } = globSetting // const { apiUrl } = globSetting
const apiUrl = 'http://localhost:8181' // const apiUrl = 'http://localhost:8181'
export const Http = createAxios({ // export const Http = createAxios({
headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED }, // headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
requestOptions: { // requestOptions: {
apiUrl, // apiUrl,
}, // },
}) // })
// other api url // other api url
// export const otherHttp = createAxios({ // export const otherHttp = createAxios({
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
const rememberMe = ref(false) const rememberMe = ref(false)
const formData = reactive({ const formData = reactive({
account: 'basic', account: 'admin',
password: '123456', password: '123456',
}) })
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
loading.value = true loading.value = true
const userInfo = await userStore.login({ const userInfo = await userStore.login({
password: data.password, password: data.password,
username: data.account, account: data.account,
mode: 'none', //不要默认的错误提示 mode: 'none', //不要默认的错误提示
}) })
if (userInfo) { if (userInfo) {
......
...@@ -2,7 +2,7 @@ import { Result } from '../utils' ...@@ -2,7 +2,7 @@ import { Result } from '../utils'
const fakeUserInfo = { const fakeUserInfo = {
userId: '1', userId: '1',
username: 'vben', account: 'vben',
realName: 'Vben Admin', realName: 'Vben Admin',
desc: 'manager', desc: 'manager',
password: '123456', password: '123456',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论