first
This commit is contained in:
42
src/api/user-boot/function.ts
Normal file
42
src/api/user-boot/function.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import createAxios from '@/utils/request'
|
||||
|
||||
export const functionTree = () => {
|
||||
return createAxios({
|
||||
url: '/user-boot/function/functionTree'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增菜单接口
|
||||
export function add(data: anyObj) {
|
||||
return createAxios({
|
||||
url: '/user-boot/function/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改菜单接口
|
||||
export function update(data: anyObj) {
|
||||
return createAxios({
|
||||
url: '/user-boot/function/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除菜单接口
|
||||
export function deleteMenu(id: string) {
|
||||
return createAxios({
|
||||
url: '/user-boot/function/delete?id=' + id,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
// 更新角色菜单
|
||||
export function updateRoleMenu(data:any) {
|
||||
return createAxios({
|
||||
url: '/user-boot/function/assignFunctionByRoleIndexes',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
8
src/api/user-boot/referralCode.ts
Normal file
8
src/api/user-boot/referralCode.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import createAxios from '@/utils/request'
|
||||
|
||||
export const refreshReferralCode = () => {
|
||||
return createAxios({
|
||||
url: '/user-boot/referralCode/refreshReferralCode',
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
33
src/api/user-boot/role.ts
Normal file
33
src/api/user-boot/role.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import createAxios from '@/utils/request'
|
||||
|
||||
export function add(data: any) {
|
||||
return createAxios({
|
||||
url: '/user-boot/role/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function update(data: any) {
|
||||
return createAxios({
|
||||
url: '/user-boot/role/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(data: any) {
|
||||
return createAxios({
|
||||
url: '/user-boot/role/delete',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function roleList(id: number) {
|
||||
return createAxios({
|
||||
url: '/user-boot/role/selectRoleDetail?id=' + id,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
21
src/api/user-boot/roleFuction.ts
Normal file
21
src/api/user-boot/roleFuction.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import createAxios from '@/utils/request'
|
||||
|
||||
export function getFunctionsByRoleIndex(data) {
|
||||
return createAxios({
|
||||
url: '/user-boot/roleFunction/getFunctionsByRoleIndex',
|
||||
method: 'post',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateRoleMenu(data:any) {
|
||||
return createAxios({
|
||||
url: '/user-boot/function/assignFunctionByRoleIndexes',
|
||||
method: 'post',
|
||||
data: data
|
||||
// params: roleIndex,functionIndexList
|
||||
// data:{
|
||||
// roleIndex,functionIndexList
|
||||
// }
|
||||
})
|
||||
}
|
||||
142
src/api/user-boot/user.ts
Normal file
142
src/api/user-boot/user.ts
Normal file
@@ -0,0 +1,142 @@
|
||||
import request from '@/utils/request'
|
||||
import { LoginData } from '@/api/types'
|
||||
import { useAdminInfo } from '@/stores/adminInfo'
|
||||
import { sm3Digest } from '@/assets/commjs/sm3.js'
|
||||
import { sm2, encrypt } from '@/assets/commjs/sm2.js'
|
||||
|
||||
// 获取公钥
|
||||
export function gongkey(params?: any) {
|
||||
if (!params) {
|
||||
const adminInfo = useAdminInfo()
|
||||
params = {
|
||||
loginName: encrypt(adminInfo.$state.loginName)
|
||||
}
|
||||
}
|
||||
return request({
|
||||
url: '/user-boot/user/generateSm2Key',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export async function pwdSm3(pwd: any, loginName?: string) {
|
||||
let publicKey = await gongkey(
|
||||
loginName
|
||||
? {
|
||||
loginName: encrypt(loginName)
|
||||
}
|
||||
: false
|
||||
)
|
||||
let sm3Pwd = sm3Digest(pwd) //SM3加密
|
||||
return sm2(sm3Pwd + '|' + pwd, publicKey.data, 0)
|
||||
}
|
||||
|
||||
//登录获取token
|
||||
export async function login(params: any) {
|
||||
params.password = await pwdSm3(params.password, params.username)
|
||||
params.username = encrypt(params.username)
|
||||
return request({
|
||||
url: '/pqs-auth/oauth/token',
|
||||
method: 'post',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
//获取用户信息
|
||||
export function getUserById() {
|
||||
const adminInfo = useAdminInfo()
|
||||
return request({
|
||||
url: '/user-boot/user/getUserById?id=' + adminInfo.userIndex,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 刷新token
|
||||
export function refreshToken(): Promise<any> {
|
||||
const adminInfo = useAdminInfo()
|
||||
return login({
|
||||
grant_type: 'refresh_token',
|
||||
refresh_token: adminInfo.refresh_token,
|
||||
username: adminInfo.loginName
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营销用户列表
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
export const getMarketList = () => {
|
||||
return request({
|
||||
url: '/user-boot/user/getMarketList',
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function add(data: any) {
|
||||
return request({
|
||||
url: '/user-boot/user/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data: any) {
|
||||
return request({
|
||||
url: '/user-boot/user/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export async function passwordConfirm(pwd: string) {
|
||||
return request({
|
||||
url: '/user-boot/user/passwordConfirm?password=' + (await pwdSm3(pwd)),
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function deluser(data: any) {
|
||||
return request({
|
||||
url: '/user-boot/user/delete',
|
||||
method: 'delete',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
export function activateUser(data: any) {
|
||||
return request({
|
||||
url: '/user-boot/user/activateUser',
|
||||
method: 'put',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
export async function updatePassword(params: any) {
|
||||
return request({
|
||||
url: '/user-boot/user/updatePassword',
|
||||
method: 'put',
|
||||
params: {
|
||||
id: params.id,
|
||||
newPassword: await pwdSm3(params.newPassword)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateFirstPassword(params: any) {
|
||||
return request({
|
||||
url: '/user-boot/user/updateFirstPassword',
|
||||
method: 'put',
|
||||
data: {
|
||||
name: encrypt(params.name),
|
||||
password: await pwdSm3(params.password, params.name)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function checkUser(data: any) {
|
||||
return request({
|
||||
url: '/user-boot/user/check',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user