jeecgBootUniapp/src/api/system/index.ts

123 lines
2.4 KiB
Vue
Raw Normal View History

2025-04-29 08:37:17 +00:00
import { http } from '@/utils/http'; // @/ 已经映射到 ./src/
// ts对 HTTP 方法名称的大小写敏感。在 TypeScript 的类型定义中HTTP 方法通常被定义为全大写的字符串字面量类型,如 "POST",而非"post"。
interface LoginParams {
2025-05-22 07:30:36 +00:00
username : string;
password : string;
captcha ?: string; //非必填字段
2025-04-29 08:37:17 +00:00
}
/**
* 统一的登录方法
* @param config 登录参数
* @returns 登录请求的 Promise
*/
export function loginApi(config : LoginParams) {
2025-05-22 07:30:36 +00:00
// 如果传了 captcha走本地登录/sys/login,否则走单点登录(/sys/sinopecLogin
const url = config.captcha ? '/sys/login' : '/sys/sinopecLogin';
return http({
url,
method: 'POST',
data: config,
});
2025-04-29 08:37:17 +00:00
}
2025-04-30 01:16:10 +00:00
/**
* 热更新
* @param
* @returns
*/
2025-06-17 09:34:45 +00:00
export function upDateAppApi(path : string) {
2025-04-30 01:16:10 +00:00
return http({
url: '/sys/common/upDateApp',
2025-06-17 09:34:45 +00:00
method: 'GET',
data: {
path
}
2025-04-30 01:16:10 +00:00
})
}
2025-04-29 08:37:17 +00:00
/**
* 获取是否灰化
2025-05-09 01:42:19 +00:00
* @param id 权限id
2025-04-29 08:37:17 +00:00
* @returns 0正常 1灰化
*/
2025-05-09 01:42:19 +00:00
export function jurisdictionApi(id : string) {
2025-04-29 08:37:17 +00:00
return http({
url: '/CxcJurisdiction/cxcJurisdiction/queryById',
method: 'GET',
data: {
id
}
2025-04-30 01:16:10 +00:00
});
}
2025-05-22 07:30:36 +00:00
export function getUserPermissionApi(config : object) { // 获取权限
2025-05-09 01:42:19 +00:00
return http({
url: '/sys/permission/getUserPermissionByToken',
method: 'GET',
data: config
})
}
/**
* 获取首页轮播图
*/
2025-05-22 07:30:36 +00:00
export function queryCarouselApi(config : object) {
2025-05-09 01:42:19 +00:00
return http({
url: '/CxcDaping/cxcDaping/list',
method: 'GET',
data: config
});
2025-05-16 03:01:27 +00:00
}
/**
* 获取分类字典
*/
2025-05-22 07:30:36 +00:00
export function getCategoryItemsApi(pid : string) {
2025-05-16 03:01:27 +00:00
return http({
url: '/sys/category/findtree',
method: 'GET',
data: {
pid
}
})
2025-05-22 07:30:36 +00:00
}
export function getDictItemsApi(dictCode : string) { // 字典标签专用
return http({
url: `/sys/dict/getDictItems/${dictCode}`,
method: 'GET'
})
2025-05-27 06:49:17 +00:00
}
2025-06-25 01:07:54 +00:00
export function deleteFile(config : object) {//删除文件 by 闵
2025-05-27 06:49:17 +00:00
return http({
url: `/sys/common/deleteFileAndCache`,
method: 'GET',
data: config
})
}
2025-06-25 01:07:54 +00:00
/*根据经纬度获取地理位置*/
export function getLocationApi(longitude : number, latitude : number) {
return http({
url: `/sys/common/getLocation`,
method: 'GET',
data: {
longitude,
latitude
}
})
}
/*根据经纬度或城市名称获取天气信息*/
export function getWeatherApi(longitude : number, latitude : number) {
return http({
url: `/sys/common/getWeather`,
method: 'GET',
data: {
longitude,
latitude
}
})
}