2025-03-26
This commit is contained in:
3
src/api/config/servicePort.ts
Normal file
3
src/api/config/servicePort.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// 后端微服务模块前缀
|
||||
export const PORT1 = "/api";
|
||||
export const PORT2 = "/hooks";
|
||||
47
src/api/helper/axiosCancel.ts
Normal file
47
src/api/helper/axiosCancel.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
// ? 暂未使用,目前使用全局 Loading 来控制重复请求
|
||||
import { CustomAxiosRequestConfig } from "../index";
|
||||
import qs from "qs";
|
||||
|
||||
// 声明一个 Map 用于存储每个请求的标识 和 取消函数
|
||||
let pendingMap = new Map<string, AbortController>();
|
||||
|
||||
// 序列化参数
|
||||
export const getPendingUrl = (config: CustomAxiosRequestConfig) =>
|
||||
[config.method, config.url, qs.stringify(config.data), qs.stringify(config.params)].join("&");
|
||||
|
||||
export class AxiosCanceler {
|
||||
/**
|
||||
* @description: 添加请求
|
||||
* @param {Object} config
|
||||
* @return void
|
||||
*/
|
||||
addPending(config: CustomAxiosRequestConfig) {
|
||||
// 在请求开始前,对之前的请求做检查取消操作
|
||||
this.removePending(config);
|
||||
const url = getPendingUrl(config);
|
||||
const controller = new AbortController();
|
||||
config.signal = controller.signal;
|
||||
pendingMap.set(url, controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 移除请求
|
||||
* @param {Object} config
|
||||
*/
|
||||
removePending(config: CustomAxiosRequestConfig) {
|
||||
const url = getPendingUrl(config);
|
||||
// 如果在 pending 中存在当前请求标识,需要取消当前请求
|
||||
const controller = pendingMap.get(url);
|
||||
controller && controller.abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 清空所有pending
|
||||
*/
|
||||
removeAllPending() {
|
||||
pendingMap.forEach(controller => {
|
||||
controller && controller.abort();
|
||||
});
|
||||
pendingMap.clear();
|
||||
}
|
||||
}
|
||||
47
src/api/helper/checkStatus.ts
Normal file
47
src/api/helper/checkStatus.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { ElMessage } from "element-plus";
|
||||
import { outLogin } from "@/utils/outLogin";
|
||||
/**
|
||||
* @description: 校验网络请求状态码
|
||||
* @param {Number} status
|
||||
* @return void
|
||||
*/
|
||||
export const checkStatus = (status: number, msg?: any) => {
|
||||
switch (status) {
|
||||
case 400:
|
||||
ElMessage.error("请求失败!请您稍后重试");
|
||||
break;
|
||||
case 401:
|
||||
ElMessage.error("登录失效!请您重新登录");
|
||||
outLogin();
|
||||
break;
|
||||
case 403:
|
||||
ElMessage.error("当前账号无权限访问!");
|
||||
break;
|
||||
case 404:
|
||||
ElMessage.error("你所访问的资源不存在!");
|
||||
break;
|
||||
case 405:
|
||||
ElMessage.error("请求方式错误!请您稍后重试");
|
||||
break;
|
||||
case 408:
|
||||
ElMessage.error("请求超时!请您稍后重试");
|
||||
break;
|
||||
case 429: //这个是图片验证接口的报错,不具备通用性
|
||||
ElMessage.error(msg);
|
||||
break;
|
||||
case 500:
|
||||
ElMessage.error("服务异常!");
|
||||
break;
|
||||
case 502:
|
||||
ElMessage.error("网关错误!");
|
||||
break;
|
||||
case 503:
|
||||
ElMessage.error("服务不可用!");
|
||||
break;
|
||||
case 504:
|
||||
ElMessage.error("网关超时!");
|
||||
break;
|
||||
default:
|
||||
ElMessage.error("请求失败!");
|
||||
}
|
||||
};
|
||||
132
src/api/index.ts
Normal file
132
src/api/index.ts
Normal file
@@ -0,0 +1,132 @@
|
||||
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from "axios";
|
||||
import qs from "qs";
|
||||
//endLoading
|
||||
import { showFullScreenLoading, tryHideFullScreenLoading } from "@/config/serviceLoading";
|
||||
|
||||
import { ElMessage } from "element-plus";
|
||||
import { ResultData } from "@/api/interface";
|
||||
import { ResultEnum } from "@/enums/httpEnum";
|
||||
import { checkStatus } from "./helper/checkStatus";
|
||||
import { useUserStore } from "@/stores/modules/user";
|
||||
import router from "@/routers";
|
||||
//获取导出表格name
|
||||
const getDispositionName = (response: any) => {
|
||||
//导出表格,从content-disposition获取表格的名称 只有导出服务端才会返回该字段
|
||||
const contentDisposition = response.headers["content-disposition"];
|
||||
if (contentDisposition) {
|
||||
// 解析 Content-Disposition 以提取文件名
|
||||
const filenameMatch = contentDisposition.match(/filename=(.*)/i);
|
||||
if (filenameMatch && filenameMatch[1]) {
|
||||
let filename = filenameMatch[1].trim();
|
||||
localStorage.setItem("filename", filename);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//登出地址
|
||||
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
|
||||
noLoading?: boolean;
|
||||
}
|
||||
|
||||
const config = {
|
||||
// 默认地址请求地址,可在 .env.** 文件中修改
|
||||
baseURL: import.meta.env.VITE_APP_API_BASEURL as string,
|
||||
// 设置超时时间
|
||||
timeout: ResultEnum.TIMEOUT as number,
|
||||
// 跨域时候允许携带凭证
|
||||
withCredentials: true
|
||||
};
|
||||
|
||||
class RequestHttp {
|
||||
service: AxiosInstance;
|
||||
public constructor(config: AxiosRequestConfig) {
|
||||
// instantiation
|
||||
this.service = axios.create(config);
|
||||
|
||||
/**
|
||||
* @description 请求拦截器
|
||||
* 客户端发送请求 -> [请求拦截器] -> 服务器
|
||||
* token校验(JWT) : 接受服务器返回的 token,存储到 vuex/pinia/本地储存当中
|
||||
*/
|
||||
this.service.interceptors.request.use(
|
||||
(config: CustomAxiosRequestConfig) => {
|
||||
const userStore = useUserStore();
|
||||
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { noLoading: true } 来控制
|
||||
config.noLoading || showFullScreenLoading();
|
||||
if (config.headers && typeof config.headers.set === "function") {
|
||||
config.headers.set("Authorization", "Bearer" + " " + userStore.token);
|
||||
}
|
||||
return config;
|
||||
},
|
||||
(error: AxiosError) => {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* @description 响应拦截器
|
||||
* 服务器换返回信息 -> [拦截统一处理] -> 客户端JS获取到信息
|
||||
*/
|
||||
this.service.interceptors.response.use(
|
||||
(response: AxiosResponse) => {
|
||||
const { data } = response;
|
||||
tryHideFullScreenLoading();
|
||||
//获取导出表格名称
|
||||
getDispositionName(response);
|
||||
//0正常,1非正常
|
||||
if (data.code == 1) {
|
||||
ElMessage.error(data.msg);
|
||||
}
|
||||
//请求超时
|
||||
if (data.code == 504) {
|
||||
ElMessage.error("请求超时!请您稍后重试");
|
||||
}
|
||||
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
|
||||
return data;
|
||||
},
|
||||
//请求错误
|
||||
async (error: AxiosError) => {
|
||||
const { response } = error;
|
||||
tryHideFullScreenLoading();
|
||||
// 请求超时 && 网络错误单独判断,没有 response
|
||||
if (error.message.indexOf("timeout") !== -1) ElMessage.error("请求超时!请您稍后重试");
|
||||
if (error.message.indexOf("Network Error") !== -1) ElMessage.error("网络错误!请您稍后重试");
|
||||
// 根据服务器响应的错误状态码,做不同的处理
|
||||
if (response) {
|
||||
console.log("error-走到了这里", response.status);
|
||||
checkStatus(response.status, response.data);
|
||||
}
|
||||
// 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面
|
||||
if (!window.navigator.onLine) router.replace("/500");
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 常用请求方法封装
|
||||
*/
|
||||
get<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.get(url, { params, ..._object });
|
||||
}
|
||||
post<T>(url: string, params?: object | string, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.post(url, params, _object);
|
||||
}
|
||||
put<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||
// console.log(JSON.stringify(params), "=qs.stringify(params)=");
|
||||
return this.service.put(url, qs.stringify(params), {
|
||||
..._object,
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}
|
||||
});
|
||||
}
|
||||
delete<T>(url: string, params?: any, _object = {}): Promise<ResultData<T>> {
|
||||
return this.service.delete(url, { params, ..._object });
|
||||
}
|
||||
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||
return this.service.post(url, params, { ..._object, responseType: "blob" });
|
||||
}
|
||||
}
|
||||
|
||||
export default new RequestHttp(config);
|
||||
25
src/api/interface/global.ts
Normal file
25
src/api/interface/global.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
// 全局模块
|
||||
export namespace Global {
|
||||
//供应链
|
||||
export interface ResSupplier {
|
||||
id: number;
|
||||
code: string;
|
||||
name: string;
|
||||
disable: boolean;
|
||||
}
|
||||
|
||||
//用户
|
||||
export interface ResUserList {
|
||||
id: number;
|
||||
code: null;
|
||||
name: string;
|
||||
number: number;
|
||||
disable: boolean;
|
||||
}
|
||||
interface ResDropDownAllItem {
|
||||
id: 15756737;
|
||||
level: 2;
|
||||
name: "jx_cs_15_01";
|
||||
number: "123456";
|
||||
}
|
||||
}
|
||||
7
src/api/interface/index.ts
Normal file
7
src/api/interface/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Global } from "./global";
|
||||
import { User } from "./user";
|
||||
import { Login } from "./login";
|
||||
import { Result, ResultData } from "./result";
|
||||
import { ResPage, ReqPage } from "./page";
|
||||
import { Upload } from "./upload";
|
||||
export type { Global, User, Login, ResultData, Result, ResPage, ReqPage, Upload };
|
||||
61
src/api/interface/login.ts
Normal file
61
src/api/interface/login.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
// 登录模块
|
||||
export interface Dept {
|
||||
id: number;
|
||||
deptCode: string;
|
||||
deptName: string;
|
||||
managerId: null;
|
||||
}
|
||||
|
||||
export namespace Login {
|
||||
//登录要传的参数
|
||||
export interface ReqLoginCode {
|
||||
code: string;
|
||||
}
|
||||
//登录返回的参数
|
||||
interface Dept {
|
||||
id: number;
|
||||
deptCode: string;
|
||||
deptName: string;
|
||||
managerId: null;
|
||||
}
|
||||
export interface ResLogin {
|
||||
isSuccess: boolean;
|
||||
message: string;
|
||||
status: number;
|
||||
data: {
|
||||
accessToken: {
|
||||
token: string;
|
||||
phpToken: string;
|
||||
tokenType: string;
|
||||
refreshToken: string;
|
||||
expired: string;
|
||||
};
|
||||
signedIn: boolean;
|
||||
userInfo: {
|
||||
seesionId: string;
|
||||
ucId: number;
|
||||
depts: Dept[];
|
||||
staffId: number;
|
||||
staff_code: string;
|
||||
business_code: null;
|
||||
avatar: null;
|
||||
closed: number;
|
||||
createdAt: string;
|
||||
email: null;
|
||||
mobile: string;
|
||||
nickname: string;
|
||||
roleId: string;
|
||||
signinAt: string;
|
||||
updatedAt: string;
|
||||
companyId: number;
|
||||
companyName: string;
|
||||
orgId: number;
|
||||
supplierId: null;
|
||||
supplierName: null;
|
||||
customerId: null;
|
||||
customerName: null;
|
||||
identity: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
15
src/api/interface/page.ts
Normal file
15
src/api/interface/page.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
//分页
|
||||
import { Result } from "./result";
|
||||
// 分页响应参数
|
||||
export interface ResPage<T = any> extends Result {
|
||||
data: {
|
||||
list: T[];
|
||||
total: number;
|
||||
};
|
||||
}
|
||||
|
||||
// 分页请求参数
|
||||
export interface ReqPage {
|
||||
page: number;
|
||||
size: number;
|
||||
}
|
||||
12
src/api/interface/result.ts
Normal file
12
src/api/interface/result.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// 请求响应参数(不包含data)
|
||||
export interface Result {
|
||||
isSuccess: boolean;
|
||||
message: string;
|
||||
status: number;
|
||||
}
|
||||
|
||||
// 请求响应参数(包含data)
|
||||
export interface ResultData<T = any> extends Result {
|
||||
[x: string]: any;
|
||||
data: T;
|
||||
}
|
||||
6
src/api/interface/upload.ts
Normal file
6
src/api/interface/upload.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// 文件上传模块
|
||||
export namespace Upload {
|
||||
export interface ResFileUrl {
|
||||
fileUrl: string;
|
||||
}
|
||||
}
|
||||
44
src/api/interface/user.ts
Normal file
44
src/api/interface/user.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
// 用户管理模块
|
||||
export namespace User {
|
||||
// 获取组织list
|
||||
export interface ResUserOrgs {
|
||||
id: number;
|
||||
orgCode: string;
|
||||
name: string;
|
||||
orgType: string;
|
||||
standardCoin: string;
|
||||
standardCoinId: number;
|
||||
autoDetaultStockId: number;
|
||||
disable: boolean;
|
||||
}
|
||||
export interface ResUserDept {
|
||||
id: number;
|
||||
name: string;
|
||||
pid: number;
|
||||
managerId: null;
|
||||
disable: boolean;
|
||||
children: ResUserDept[];
|
||||
}
|
||||
export interface ResWarehouse {
|
||||
id: number;
|
||||
name: string;
|
||||
code: null;
|
||||
contacts: string;
|
||||
contactsId: number;
|
||||
useOrgId: null;
|
||||
customerWarehouseTag: boolean;
|
||||
tempTransferWarehouse: number;
|
||||
defaultReplenishCustomer: number;
|
||||
customerId: number;
|
||||
stockType: number;
|
||||
disable: boolean;
|
||||
}
|
||||
//获取组织下的用户
|
||||
export interface ResUserList {
|
||||
id: number;
|
||||
code: null;
|
||||
name: string;
|
||||
number: number;
|
||||
disable: boolean;
|
||||
}
|
||||
}
|
||||
29
src/api/modules/QAList.ts
Normal file
29
src/api/modules/QAList.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import http from "@/api";
|
||||
const QA = `/faq`;
|
||||
//列表
|
||||
export const getQAListApi = (params: any) => {
|
||||
return http.get<any>(`${QA}/index`, params);
|
||||
};
|
||||
//详情
|
||||
export const getQAListDetailsApi = (params: any) => {
|
||||
return http.get<any>(`${QA}/read/${params}`);
|
||||
};
|
||||
//删除
|
||||
export const getQAListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${QA}/delete/${params}`);
|
||||
};
|
||||
|
||||
//更新
|
||||
export const getQAListEditUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
return http.put<any>(`${QA}/update/${id}`, params);
|
||||
};
|
||||
|
||||
//新增
|
||||
export const getQAListSaveApi = (params: any) => {
|
||||
return http.post<any>(`${QA}/save`, params);
|
||||
};
|
||||
//排序
|
||||
export const getQASortApi = (params: any) => {
|
||||
return http.post<any>(`${QA}/sort/${params.id}`, { sort: params.sort });
|
||||
};
|
||||
16
src/api/modules/agent.ts
Normal file
16
src/api/modules/agent.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import http from "@/api";
|
||||
const G = `/agent`;
|
||||
// 联系我们列表
|
||||
export const getAgentListApi = (params: any) => {
|
||||
return http.get<any>(`${G}/index`, params);
|
||||
};
|
||||
//导出
|
||||
export const getAgentListExportApi = (params: any) => {
|
||||
return http.get<any>(`${G}/export`, params, {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
//代理企业规模
|
||||
export const getAgentTypesListApi = () => {
|
||||
return http.get<any>(`${G}/enterprise_size_types`);
|
||||
};
|
||||
32
src/api/modules/articleClass.ts
Normal file
32
src/api/modules/articleClass.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import http from "@/api";
|
||||
// import qs from "qs";
|
||||
const ARTICLE_CATEGORY = `/article/category`;
|
||||
//文章分类列表
|
||||
export const getArticleClassListApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE_CATEGORY}/index`, params);
|
||||
};
|
||||
//文章分类新增
|
||||
export const getArticleClassAddSaveApi = (params: any) => {
|
||||
return http.post<any>(`${ARTICLE_CATEGORY}/save`, params);
|
||||
};
|
||||
//文章分类删除
|
||||
export const getArticleClassDelApi = (params: any) => {
|
||||
return http.delete<any>(`${ARTICLE_CATEGORY}/delete/${params}`);
|
||||
};
|
||||
//文章分类更新(用于编辑后)
|
||||
export const getArticleClassEditUpApi = (params: any) => {
|
||||
const { id, name, sort, is_show, seo_title, seo_keywords, seo_desc } = params;
|
||||
|
||||
return http.put<any>(`/article/category/update/${id}`, {
|
||||
name,
|
||||
sort,
|
||||
is_show,
|
||||
seo_title,
|
||||
seo_keywords,
|
||||
seo_desc
|
||||
});
|
||||
};
|
||||
//文章分类详情(用于编辑)
|
||||
export const getArticleClassDetailsApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE_CATEGORY}/read/${params}`);
|
||||
};
|
||||
39
src/api/modules/articleList.ts
Normal file
39
src/api/modules/articleList.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import http from "@/api";
|
||||
const ARTICLE = `article`;
|
||||
//文章列表
|
||||
export const getArticleListApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE}/index`, params);
|
||||
};
|
||||
//文章分类接口
|
||||
export const getArticleClassDataApi = (params?: any) => {
|
||||
return http.get<any>(`${ARTICLE}/categorys`, params);
|
||||
};
|
||||
//文章删除接口
|
||||
export const getArticleListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${ARTICLE}/delete/${params}`);
|
||||
};
|
||||
//文章导出
|
||||
|
||||
// responseType: 'arraybuffer' 表示期望服务器返回的数据类型为 ArrayBuffer。
|
||||
// ArrayBuffer 是一个用于存储二进制数据的对象,当服务器返回的数据是二进制数据(如文件数据,包括 Excel 文件、图片文件等)时,将 responseType 设置为 arraybuffer 可以正确地接收和处理这些二进制数据。
|
||||
// 在处理文件下载(例如,从服务器下载 Excel 文件)时,使用 arraybuffer 可以确保接收到的数据是二进制形式,以便后续操作,如将其转换为 Blob 对象进行文件下载。
|
||||
export const getArticleListExportApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE}/export`, params, {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
//文章更新
|
||||
export const getArticleListUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
delete params.id;
|
||||
|
||||
return http.put<any>(`${ARTICLE}/update/${id}`, params);
|
||||
};
|
||||
//文章分类新增
|
||||
export const getArticleListAddSaveApi = (params: any) => {
|
||||
return http.post<any>(`${ARTICLE}/save`, params);
|
||||
};
|
||||
//文章详情
|
||||
export const getArticleListDetailsApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE}/read/${params}`);
|
||||
};
|
||||
14
src/api/modules/articleRecycle.ts
Normal file
14
src/api/modules/articleRecycle.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import http from "@/api";
|
||||
const ARTICLE_TRASH = `article/trash`;
|
||||
//文章回收站列表接口
|
||||
export const getArticleTrashListApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE_TRASH}/index`, params);
|
||||
};
|
||||
//文章回收站删除接口
|
||||
export const getArticleTrashDelApi = (params: any) => {
|
||||
return http.delete<any>(`${ARTICLE_TRASH}/delete/${params}`);
|
||||
};
|
||||
//文章回收站恢复接口
|
||||
export const getArticleTrashRestoreApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE_TRASH}/restore/${params}`);
|
||||
};
|
||||
20
src/api/modules/articleRemark.ts
Normal file
20
src/api/modules/articleRemark.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import http from "@/api";
|
||||
const ARTICLE_MESSAGE = `/article/message`;
|
||||
//文章评论列表
|
||||
export const getArticleRemarkListApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE_MESSAGE}/index`, params);
|
||||
};
|
||||
//文章评论审核接口
|
||||
export const getArticleRemarkExamineApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE_MESSAGE}/audit/${params}`);
|
||||
};
|
||||
//文章评论删除接口
|
||||
export const getArticleRemarkDelApi = (params: any) => {
|
||||
return http.delete<any>(`${ARTICLE_MESSAGE}/delete/${params}`);
|
||||
};
|
||||
//
|
||||
export const getArticleRemarkExportApi = (params: any) => {
|
||||
return http.get<any>(`${ARTICLE_MESSAGE}/export`, params, {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
39
src/api/modules/banner.ts
Normal file
39
src/api/modules/banner.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import http from "@/api";
|
||||
const B = `/banner/items`;
|
||||
//分页
|
||||
export const getBannerListApi = (params: any) => {
|
||||
return http.get<any>(`${B}/index`, params);
|
||||
};
|
||||
//新增
|
||||
export const getBannerListSaveApi = (params: any) => {
|
||||
console.log("1232323");
|
||||
return http.post<any>(`${B}/save`, params, {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}
|
||||
});
|
||||
};
|
||||
//更新
|
||||
export const getBannerUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
return http.put<any>(`${B}/update/${id}`, params);
|
||||
};
|
||||
//详情
|
||||
export const getBannerReadApi = (params: any) => {
|
||||
return http.get<any>(`${B}/read/${params}`);
|
||||
};
|
||||
//删除
|
||||
export const getBannerDelApi = (params: any) => {
|
||||
return http.delete<any>(`${B}/delete/${params}`);
|
||||
};
|
||||
//排序
|
||||
export const getBannerListSortApi = (params: any) => {
|
||||
const { id, sort } = params;
|
||||
return http.post<any>(`${B}/sort/${id}`, { sort });
|
||||
};
|
||||
//导出
|
||||
export const getBannerListExportApi = (params: any) => {
|
||||
return http.get<any>(`${B}/export`, params, {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
23
src/api/modules/bannerClass.ts
Normal file
23
src/api/modules/bannerClass.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import http from "@/api";
|
||||
const BC = `/banner`;
|
||||
//分页
|
||||
export const getBannerClassListApi = (params: any) => {
|
||||
return http.get<any>(`${BC}/index`, params);
|
||||
};
|
||||
//新增
|
||||
export const getBannerClassListSaveApi = (params: any) => {
|
||||
return http.post<any>(`${BC}/save`, params);
|
||||
};
|
||||
//更新
|
||||
export const getBannerClassListUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
return http.put<any>(`${BC}/update/${id}`, params);
|
||||
};
|
||||
//详情
|
||||
export const getBannerClassListReadApi = (params: any) => {
|
||||
return http.get<any>(`${BC}/read/${params}`);
|
||||
};
|
||||
//删除
|
||||
export const getBannerClassListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${BC}/delete/${params}`);
|
||||
};
|
||||
35
src/api/modules/configuration.ts
Normal file
35
src/api/modules/configuration.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import http from "@/api";
|
||||
const CONFIG = `/config`;
|
||||
//配置列表分页
|
||||
export const getConfigListApi = (params: any) => {
|
||||
return http.get<any>(`${CONFIG}/index`, params);
|
||||
};
|
||||
//配置新增
|
||||
export const getConfigSaveApi = (params: any) => {
|
||||
return http.post<any>(`${CONFIG}/save`, params);
|
||||
};
|
||||
|
||||
//配置更新
|
||||
export const getConfigUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
return http.put<any>(`${CONFIG}/update/${id}`, params);
|
||||
};
|
||||
//配置详情
|
||||
export const getConfigReadApi = (params: any) => {
|
||||
return http.get<any>(`${CONFIG}/read/${params}`);
|
||||
};
|
||||
//配置删除
|
||||
export const getConfigDelApi = (params: any) => {
|
||||
return http.delete<any>(`${CONFIG}/delete/${params}`);
|
||||
};
|
||||
//分组 getConfigGroupsApi getConfigTypesApi
|
||||
export const getConfigGroupsApi = () => {
|
||||
return http.get<any>(`${CONFIG}/groups`);
|
||||
};
|
||||
//分类
|
||||
export const getConfigTypesApi = () => {
|
||||
return http.get<any>(`${CONFIG}/types`);
|
||||
};
|
||||
// export const getConfigListApi = (params: any) => {
|
||||
// return http.get<any>(`${CONFIG}/index`, params);
|
||||
// };
|
||||
12
src/api/modules/contact.ts
Normal file
12
src/api/modules/contact.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import http from "@/api";
|
||||
const L = `/leavemsg`;
|
||||
// 联系我们列表
|
||||
export const getLeaveMsgListApi = (params: any) => {
|
||||
return http.get<any>(`${L}/index`, params);
|
||||
};
|
||||
//导出 getLeaveMsgListExportApi getLeaveMsgListApi
|
||||
export const getLeaveMsgListExportApi = (params: any) => {
|
||||
return http.get<any>(`${L}/export`, params, {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
31
src/api/modules/downloadClass.ts
Normal file
31
src/api/modules/downloadClass.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import http from "@/api";
|
||||
///admin/v1/attachment/category/read/{id}
|
||||
const ATT_C = `/attachment/category`;
|
||||
// 下载分类分页列表
|
||||
export const getCategoryListApi = (params: any) => {
|
||||
return http.get<any>(`${ATT_C}/index`, params);
|
||||
};
|
||||
//下载分类详情
|
||||
export const getCategoryReadApi = (params: any) => {
|
||||
return http.get<any>(`${ATT_C}/read/${params}`);
|
||||
};
|
||||
//下载分类保存
|
||||
export const getCategorySaveApi = (params: any) => {
|
||||
return http.post<any>(`${ATT_C}/save`, params);
|
||||
};
|
||||
//下载分类更新
|
||||
export const getCategoryUpdateApi = (params: any) => {
|
||||
return http.put<any>(`${ATT_C}/update/${params.id}`, params);
|
||||
};
|
||||
//下载分类删除
|
||||
export const getCategoryDelApi = (params: any) => {
|
||||
return http.delete<any>(`${ATT_C}/delete/${params}`);
|
||||
};
|
||||
//下载分类排序
|
||||
export const getCategorySortApi = (params: any) => {
|
||||
return http.post<any>(`${ATT_C}/sort/${params.id}`, { sort: params.sort });
|
||||
};
|
||||
//下载分类下拉列表
|
||||
export const getCategorysApi = () => {
|
||||
return http.get<any>(`/attachment/categorys`);
|
||||
};
|
||||
39
src/api/modules/downloadList.ts
Normal file
39
src/api/modules/downloadList.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import http from "@/api";
|
||||
const ATT = `/attachment`;
|
||||
// 下载管理分页列表
|
||||
export const getAttachmentListApi = (params: any) => {
|
||||
return http.get<any>(`${ATT}/index`, params);
|
||||
};
|
||||
//下载管理详情
|
||||
export const getAttachmentReadApi = (params: any) => {
|
||||
return http.get<any>(`${ATT}/read/${params}`);
|
||||
};
|
||||
//下载管理保存
|
||||
export const getAttachmentSaveApi = (params: any) => {
|
||||
return http.post<any>(`${ATT}/save`, params, {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}
|
||||
});
|
||||
};
|
||||
//下载管理更新
|
||||
export const getAttachmentUpdateApi = (params: any) => {
|
||||
return http.put<any>(`${ATT}/update/${params.id}`, params);
|
||||
};
|
||||
//下载管理删除
|
||||
export const getAttachmentListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${ATT}/delete/${params}`);
|
||||
};
|
||||
//下载管理排序
|
||||
export const getAttachmentSortApi = (params: any) => {
|
||||
return http.post<any>(`${ATT}/sort/${params.id}`, { sort: params.sort });
|
||||
};
|
||||
//下载管理启动禁止
|
||||
export const getAttachmentEnableApi = (params: any) => {
|
||||
return http.get<any>(`${ATT}/enable/${params}`);
|
||||
};
|
||||
//下载管理附件上传
|
||||
export const getAttachmentUpFileApi = (params: any) => {
|
||||
return http.post<any>(`${ATT}/upload`, params);
|
||||
};
|
||||
///attachment/upload
|
||||
14
src/api/modules/downloadRecycle.ts
Normal file
14
src/api/modules/downloadRecycle.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import http from "@/api";
|
||||
const ATT_T = `/attachment/trash`;
|
||||
// 下载回收站分页列表
|
||||
export const getAttachmentTrashListApi = (params: any) => {
|
||||
return http.get<any>(`${ATT_T}/index`, params);
|
||||
};
|
||||
// 下载回收站分页列表
|
||||
export const getAttachmentTrashRestoreApi = (params: any) => {
|
||||
return http.get<any>(`${ATT_T}/restore/${params}`);
|
||||
};
|
||||
//下载回收站删除
|
||||
export const getAttachmentTrashDelApi = (params: any) => {
|
||||
return http.delete<any>(`${ATT_T}/delete/${params}`);
|
||||
};
|
||||
14
src/api/modules/global.ts
Normal file
14
src/api/modules/global.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import http from "@/api";
|
||||
|
||||
//语言列表
|
||||
export const getLanguageListApi = () => {
|
||||
return http.get<any>(`/language/list`);
|
||||
};
|
||||
//语言切换
|
||||
export const getLanguageCutoverApi = (params: any) => {
|
||||
return http.get<any>(`/language/cutover/${params}`);
|
||||
};
|
||||
//国家 country/list
|
||||
export const getCountryListApi = (params: any) => {
|
||||
return http.get<any>(`/country/list`, params);
|
||||
};
|
||||
14
src/api/modules/home.ts
Normal file
14
src/api/modules/home.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import http from "@/api";
|
||||
const USER = `/user`;
|
||||
// 路由
|
||||
export const getProductPlatformsListApi = () => {
|
||||
return http.get<any>(`${USER}/params/menu`);
|
||||
};
|
||||
//
|
||||
export const getSystemInfoApi = () => {
|
||||
return http.get<any>(`system/info`);
|
||||
};
|
||||
//获取官网各模块的url
|
||||
export const getSystemUrlsApi = (params?: any) => {
|
||||
return http.get<any>(`system/urls`, params);
|
||||
};
|
||||
5
src/api/modules/log.ts
Normal file
5
src/api/modules/log.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import http from "@/api";
|
||||
// 日志
|
||||
export const getLogsListApi = (params: any) => {
|
||||
return http.get<any>(`/logs/operate/index`, params);
|
||||
};
|
||||
37
src/api/modules/login.ts
Normal file
37
src/api/modules/login.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { ResultData, Login } from "@/api/interface/index";
|
||||
//import authMenuList from "@/assets/json/authMenuList.json";
|
||||
import http from "@/api";
|
||||
|
||||
// const USER = `/user`;
|
||||
/**
|
||||
* @name 登录模块
|
||||
*/
|
||||
// 用户登录
|
||||
export const loginApi = (params: Login.ReqLoginCode) => {
|
||||
return http.post<ResultData<Login.ResLogin>>(`/user/login`, params, {
|
||||
noLoading: true
|
||||
});
|
||||
// 正常 post json 请求 ==> application/json
|
||||
// return http.post<Login.ResLogin>(PORT1 + `/login`, params, { noLoading: true }); // 控制当前请求不显示 loading
|
||||
// return http.post<Login.ResLogin>(PORT1 + `/login`, {}, { params }); // post 请求携带 query 参数 ==> ?username=admin&password=123456
|
||||
// return http.post<Login.ResLogin>(PORT1 + `/login`, qs.stringify(params)); // post 请求携带表单参数 ==> application/x-www-form-urlencoded
|
||||
// return http.get<Login.ResLogin>(PORT1 + `/login?${qs.stringify(params, { arrayFormat: "repeat" })}`); // get 请求可以携带数组等复杂参数
|
||||
};
|
||||
export const loginCodeImgApi = (params?: any) => {
|
||||
return http.get<ResultData<Login.ResLogin>>(`/user/captcha`, params, {
|
||||
noLoading: true
|
||||
});
|
||||
};
|
||||
|
||||
// 获取菜单列表
|
||||
export const getAuthMenuListApi = (params: any) => {
|
||||
// return http.get<any>(`/Login/Menus`, {}, { noLoading: true });
|
||||
// console.log(params);
|
||||
// return authMenuList;
|
||||
return http.get<any>(`/user/${params}/menu`, {}, { noLoading: true });
|
||||
};
|
||||
|
||||
// 用户退出登录
|
||||
export const logoutApi = () => {
|
||||
return http.get(`/user/logout`);
|
||||
};
|
||||
31
src/api/modules/nav.ts
Normal file
31
src/api/modules/nav.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import http from "@/api";
|
||||
const ITEMS = `/navigation/items`;
|
||||
// 导航列表列接口
|
||||
export const getItemsListApi = (params: any) => {
|
||||
return http.get<any>(`${ITEMS}/index`, params);
|
||||
};
|
||||
// 导航链接类型接口
|
||||
export const getItemsLinkTypeApi = (params: any) => {
|
||||
return http.get<any>(`${ITEMS}/link/type`, params);
|
||||
};
|
||||
// 导航详情接口
|
||||
export const getItemsReadApi = (params: any) => {
|
||||
return http.get<any>(`${ITEMS}/read/${params}`);
|
||||
};
|
||||
// 导航新增接口
|
||||
export const getItemsSaveApi = (params: any) => {
|
||||
return http.post<any>(`${ITEMS}/save`, params);
|
||||
};
|
||||
// 导航更新接口
|
||||
export const getItemsListEditUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
return http.put<any>(`${ITEMS}/update/${id}`, params);
|
||||
};
|
||||
// 导航排序接口
|
||||
export const getItemsSortApi = (params: any) => {
|
||||
return http.post<any>(`${ITEMS}/sort/${params.id}`, { sort: params.sort });
|
||||
};
|
||||
// 导航删除接口
|
||||
export const getItemsDelApi = (params: any) => {
|
||||
return http.delete<any>(`${ITEMS}/delete/${params}`);
|
||||
};
|
||||
27
src/api/modules/navClass.ts
Normal file
27
src/api/modules/navClass.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import http from "@/api";
|
||||
const NAV_CLASS = `/navigation`;
|
||||
// 导航栏类型接口
|
||||
export const getNavClassListApi = () => {
|
||||
return http.get<any>(`${NAV_CLASS}/list`);
|
||||
};
|
||||
//列表
|
||||
export const getNavClassListIndexApi = (params: any) => {
|
||||
return http.get<any>(`${NAV_CLASS}/index`, params);
|
||||
};
|
||||
// 导航详情接口
|
||||
export const getNavClassListReadApi = (params: any) => {
|
||||
return http.get<any>(`${NAV_CLASS}/read/${params}`);
|
||||
};
|
||||
// 导航新增接口
|
||||
export const getNavClassListSaveApi = (params: any) => {
|
||||
return http.post<any>(`${NAV_CLASS}/save`, params);
|
||||
};
|
||||
// 导航更新接口
|
||||
export const getNavClassListEditUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
return http.put<any>(`${NAV_CLASS}/update/${id}`, params);
|
||||
};
|
||||
// 导航删除接口
|
||||
export const getNavClassListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${NAV_CLASS}/delete/${params}`);
|
||||
};
|
||||
6
src/api/modules/product.ts
Normal file
6
src/api/modules/product.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import http from "@/api";
|
||||
const P = `/product/inquiry`;
|
||||
// 联系我们列表
|
||||
export const getProductListApi = (params: any) => {
|
||||
return http.get<any>(`${P}/index`, params);
|
||||
};
|
||||
30
src/api/modules/productAttributeList.ts
Normal file
30
src/api/modules/productAttributeList.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import http from "@/api";
|
||||
|
||||
const PRODUCT_ATTR = `/product/attr`;
|
||||
// 产品属性列表
|
||||
export const getProductAttrListApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT_ATTR}/index`, params);
|
||||
};
|
||||
// 产品属性详情
|
||||
export const getProductAttrDetailsApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT_ATTR}/read/${params}`);
|
||||
};
|
||||
// 产品属性删除
|
||||
export const getProductAttrDelApi = (params: any) => {
|
||||
return http.delete<any>(`${PRODUCT_ATTR}/delete/${params}`);
|
||||
};
|
||||
// 产品属性更新
|
||||
export const getProductAttrUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
|
||||
return http.put<any>(`${PRODUCT_ATTR}/update/${id}`, params);
|
||||
};
|
||||
//产品属性新增
|
||||
export const getProductAttrAddApi = (params: any) => {
|
||||
return http.post<any>(`${PRODUCT_ATTR}/save`, params, {
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}
|
||||
});
|
||||
};
|
||||
//
|
||||
36
src/api/modules/productClass.ts
Normal file
36
src/api/modules/productClass.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import http from "@/api";
|
||||
const PRODUCT_CATEGORY = `/product/category`;
|
||||
//产品分类树接口
|
||||
export const getProductCategoryListApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT_CATEGORY}/index`, params);
|
||||
};
|
||||
//产品分类详情接口
|
||||
export const getProductClassCategoryReadApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT_CATEGORY}/read/${params}`);
|
||||
};
|
||||
//产品分类新增接口
|
||||
export const getArticleCategorySaveApi = (params: any) => {
|
||||
return http.post<any>(`${PRODUCT_CATEGORY}/save`, params);
|
||||
};
|
||||
// 产品分类更新
|
||||
export const getProductCategoryUpdateApi = (params: any) => {
|
||||
const { id } = params;
|
||||
return http.put<any>(`${PRODUCT_CATEGORY}/update/${id}`, params);
|
||||
};
|
||||
// 产品分类删除
|
||||
export const getProductCategoryDelApi = (params: any) => {
|
||||
return http.delete<any>(`${PRODUCT_CATEGORY}/delete/${params}`);
|
||||
};
|
||||
//产品分类排序
|
||||
export const getArticleCategorySortApi = (params: any) => {
|
||||
const { id, sort } = params;
|
||||
return http.post<any>(`${PRODUCT_CATEGORY}/sort/${id}`, { sort });
|
||||
};
|
||||
//成本系统
|
||||
export const getProductClassTcoTreeApi = () => {
|
||||
return http.get<any>(`${PRODUCT_CATEGORY}/tco/tree`);
|
||||
};
|
||||
|
||||
export const getProductClassCategoryShowApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT_CATEGORY}/show/${params}`);
|
||||
};
|
||||
8
src/api/modules/productEdit.ts
Normal file
8
src/api/modules/productEdit.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// import http from "@/api";
|
||||
import productEdit from "@/assets/json/productEdit.json";
|
||||
|
||||
// 获取菜单列表
|
||||
export const getProductEditRuleFormApi = () => {
|
||||
// return http.get<any>(`/Login/Menus`, {}, { noLoading: true });
|
||||
return productEdit;
|
||||
};
|
||||
25
src/api/modules/productLink.ts
Normal file
25
src/api/modules/productLink.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import http from "@/api";
|
||||
const PRODUCT_BUYPASS = `/product/buypass`;
|
||||
// 产品购买平台列表接口(下拉列表)
|
||||
export const getProductPlatformsListApi = () => {
|
||||
return http.get<any>(`${PRODUCT_BUYPASS}/platforms`);
|
||||
};
|
||||
// 产品购买平台列表接口
|
||||
export const getProductBuypassListApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT_BUYPASS}/index`, params);
|
||||
};
|
||||
//导出
|
||||
export const getProductBuypassListExportApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT_BUYPASS}/export`, params, {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
//导入
|
||||
export const getProductBuypassListImportApi = (params: any) => {
|
||||
return http.post<any>(`${PRODUCT_BUYPASS}/import`, params);
|
||||
};
|
||||
// 更新
|
||||
export const getProductBuypassUpdateApi = (params: any) => {
|
||||
const { id, param } = params;
|
||||
return http.put<any>(`${PRODUCT_BUYPASS}/update/${id}`, param);
|
||||
};
|
||||
38
src/api/modules/productList.ts
Normal file
38
src/api/modules/productList.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import http from "@/api";
|
||||
const PRODUCT = `/product`;
|
||||
// 产品列表
|
||||
export const getProductListApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT}/index`, params);
|
||||
};
|
||||
// 产品详情
|
||||
export const getProductDetailsApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT}/read/${params}`);
|
||||
};
|
||||
// 产品列表删除
|
||||
export const getProductDelApi = (params: any) => {
|
||||
return http.delete<any>(`${PRODUCT}/delete/${params}`);
|
||||
};
|
||||
// 产品列表上下架
|
||||
export const getProductUpOrShelvesApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT}/updown_shelves/${params}`);
|
||||
};
|
||||
// 产品列表详情
|
||||
export const getProductEditUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
return http.put<any>(`${PRODUCT}/update/${id}`, params);
|
||||
};
|
||||
// 产品属性特征列表
|
||||
export const getProductAttrsListApi = () => {
|
||||
return http.get<any>(`${PRODUCT}/attrs`);
|
||||
};
|
||||
// 导出
|
||||
export const getProductListExportApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT}/export`, params, {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
//产品列表排序
|
||||
export const getProductListSortApi = (params: any) => {
|
||||
const { id, sort } = params;
|
||||
return http.post<any>(`${PRODUCT}/sort/${id}`, { sort });
|
||||
};
|
||||
14
src/api/modules/productRecycle.ts
Normal file
14
src/api/modules/productRecycle.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import http from "@/api";
|
||||
const PRODUCT_TRASH = `/product/trash`;
|
||||
// 产品回收列表
|
||||
export const getProductTrashListApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT_TRASH}/index`, params);
|
||||
};
|
||||
// 产品回收恢复
|
||||
export const getProductTrashRestoreApi = (params: any) => {
|
||||
return http.get<any>(`${PRODUCT_TRASH}/restore/${params}`);
|
||||
};
|
||||
// 产品回收删除
|
||||
export const getProductTrashDelApi = (params: any) => {
|
||||
return http.delete<any>(`${PRODUCT_TRASH}/delete/${params}`);
|
||||
};
|
||||
16
src/api/modules/purchase.ts
Normal file
16
src/api/modules/purchase.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import http from "@/api";
|
||||
const BP = `/bp/inquiry`;
|
||||
// 列表
|
||||
export const getBPListApi = (params: any) => {
|
||||
return http.get<any>(`${BP}/index`, params);
|
||||
};
|
||||
//导出
|
||||
export const getBPListExportApi = (params: any) => {
|
||||
return http.get<any>(`${BP}/export`, params, {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
//选品列表
|
||||
export const getBPInterestedListApi = (params?: any) => {
|
||||
return http.get<any>(`${BP}/interested`, params);
|
||||
};
|
||||
29
src/api/modules/roleList.ts
Normal file
29
src/api/modules/roleList.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import http from "@/api";
|
||||
const ROLE = `/role`;
|
||||
// 角色列表
|
||||
export const getRoleListApi = (params: any) => {
|
||||
return http.get<any>(`${ROLE}/index`, params);
|
||||
};
|
||||
// 角色详情
|
||||
export const getRoleListDetailsApi = (params: any) => {
|
||||
return http.get<any>(`${ROLE}/read/${params}`);
|
||||
};
|
||||
// 角色列表删除
|
||||
export const getRoleListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${ROLE}/delete/${params}`);
|
||||
};
|
||||
|
||||
// 角色列表更新
|
||||
export const getRoleListEditUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
return http.put<any>(`${ROLE}/update/${id}`, params);
|
||||
};
|
||||
|
||||
//角色列表新增
|
||||
export const getRoleListSaveApi = (params: any) => {
|
||||
return http.post<any>(`${ROLE}/save`, params);
|
||||
};
|
||||
//角色列表接口
|
||||
export const getRolesListApi = () => {
|
||||
return http.get<any>(`roles`);
|
||||
};
|
||||
10
src/api/modules/set.ts
Normal file
10
src/api/modules/set.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import http from "@/api";
|
||||
const SET = `/site/config`;
|
||||
//获取站点配置
|
||||
export const getSetListApi = () => {
|
||||
return http.get<any>(`${SET}/index`);
|
||||
};
|
||||
//更新站点配置
|
||||
export const getConfigUpApi = (params: any) => {
|
||||
return http.put<any>(`${SET}/update`, params);
|
||||
};
|
||||
21
src/api/modules/upload.ts
Normal file
21
src/api/modules/upload.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Upload } from "@/api/interface/index";
|
||||
|
||||
// import { useRouter } from "vue-router";
|
||||
import http from "@/api";
|
||||
// const $router = useRouter();
|
||||
// const routeName: string = $router.currentRoute.value.name as string;
|
||||
// const routerObj: any = {
|
||||
// articleEditIndex: "article"
|
||||
// };
|
||||
/**
|
||||
* @name 文件上传模块
|
||||
*/
|
||||
// 图片上传
|
||||
export const uploadImg = (params: any, name?: any) => {
|
||||
return http.post<any>(`/images/${name}/upload`, params);
|
||||
};
|
||||
|
||||
// 视频上传
|
||||
export const uploadVideo = (params: FormData, name?: any) => {
|
||||
return http.post<Upload.ResFileUrl>(`video/${name}/upload`, params);
|
||||
};
|
||||
25
src/api/modules/userList.ts
Normal file
25
src/api/modules/userList.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import http from "@/api";
|
||||
const USER = `/user`;
|
||||
// 用户列表
|
||||
export const getUserListApi = (params: any) => {
|
||||
return http.get<any>(`${USER}/index`, params);
|
||||
};
|
||||
// 用户详情
|
||||
export const getUserListDetailsApi = (params: any) => {
|
||||
return http.get<any>(`${USER}/read/${params}`);
|
||||
};
|
||||
// 用户列表删除
|
||||
export const getUserListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${USER}/delete/${params}`);
|
||||
};
|
||||
|
||||
// 用户列表更新
|
||||
export const getUserListEditUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
return http.put<any>(`${USER}/update/${id}`, params);
|
||||
};
|
||||
|
||||
//用户列表新增
|
||||
export const getUserListSaveApi = (params: any) => {
|
||||
return http.post<any>(`${USER}/save`, params);
|
||||
};
|
||||
26
src/api/modules/videoClass.ts
Normal file
26
src/api/modules/videoClass.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import http from "@/api";
|
||||
const VIDEO_CATEGORY = `video/category`;
|
||||
// 视频分类分页列表
|
||||
export const getVideoClassListApi = (params: any) => {
|
||||
return http.get<any>(`${VIDEO_CATEGORY}/index`, params);
|
||||
};
|
||||
//视频分类详情
|
||||
export const getVideoClassReadApi = (params: any) => {
|
||||
return http.get<any>(`${VIDEO_CATEGORY}/read/${params}`);
|
||||
};
|
||||
//视频分类保存
|
||||
export const getVideoClassSaveApi = (params: any) => {
|
||||
return http.post<any>(`${VIDEO_CATEGORY}/save`, params);
|
||||
};
|
||||
//视频分类更新
|
||||
export const getVideoClassUpdateApi = (params: any) => {
|
||||
return http.put<any>(`${VIDEO_CATEGORY}/update/${params.id}`, params);
|
||||
};
|
||||
//视频分类删除
|
||||
export const getVideoClassListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${VIDEO_CATEGORY}/delete/${params}`);
|
||||
};
|
||||
//视频分类排序
|
||||
export const getVideoClassSortApi = (params: any) => {
|
||||
return http.post<any>(`${VIDEO_CATEGORY}/sort/${params.id}`, { sort: params.sort });
|
||||
};
|
||||
28
src/api/modules/videoList.ts
Normal file
28
src/api/modules/videoList.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import http from "@/api";
|
||||
const VIDEO = `/video`;
|
||||
// 视频分页列表
|
||||
export const getVideoListApi = (params: any) => {
|
||||
return http.get<any>(`${VIDEO}/index`, params);
|
||||
};
|
||||
//视频详情
|
||||
export const getVideoReadApi = (params: any) => {
|
||||
return http.get<any>(`${VIDEO}/read/${params}`);
|
||||
};
|
||||
//视频保存
|
||||
export const getVideoSaveApi = (params: any) => {
|
||||
return http.post<any>(`${VIDEO}/save`, params);
|
||||
};
|
||||
//视频更新
|
||||
export const getVideoUpdateApi = (params: any) => {
|
||||
return http.put<any>(`${VIDEO}/update/${params.id}`, params);
|
||||
};
|
||||
//视频删除
|
||||
export const getVideoListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${VIDEO}/delete/${params}`);
|
||||
};
|
||||
//视频导出
|
||||
export const getVideoListExportApi = (params: any) => {
|
||||
return http.get<any>(`${VIDEO}/export`, params, {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
14
src/api/modules/videoRecycle.ts
Normal file
14
src/api/modules/videoRecycle.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import http from "@/api";
|
||||
const VIDEO_TRASH = `/video/trash`;
|
||||
// 视频回收分页列表
|
||||
export const getVideoTrashListApi = (params: any) => {
|
||||
return http.get<any>(`${VIDEO_TRASH}/index`, params);
|
||||
};
|
||||
// 视频回收站恢复
|
||||
export const getVideoTrashRestoreApi = (params: any) => {
|
||||
return http.get<any>(`${VIDEO_TRASH}/restore/${params}`);
|
||||
};
|
||||
//视频回收站删除
|
||||
export const getVideoTrashListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${VIDEO_TRASH}/delete/${params}`);
|
||||
};
|
||||
44
src/api/modules/webMenusList.ts
Normal file
44
src/api/modules/webMenusList.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import http from "@/api";
|
||||
const MENUS = `/menus`;
|
||||
const MENU = "/menu";
|
||||
// 菜单树形
|
||||
export const getRoleMenusListApi = () => {
|
||||
return http.get<any>(`${MENUS}`);
|
||||
};
|
||||
//树状列表
|
||||
export const getMenusListApi = (params: any) => {
|
||||
return http.get<any>(`${MENU}/index`, params);
|
||||
};
|
||||
//删除
|
||||
export const getMenusListDelApi = (params: any) => {
|
||||
return http.delete<any>(`${MENU}/delete/${params}`);
|
||||
};
|
||||
// 详情
|
||||
export const getMenusListDetailsApi = (params: any) => {
|
||||
return http.get<any>(`${MENU}/read/${params}`);
|
||||
};
|
||||
//更新
|
||||
export const getMenusListUpApi = (params: any) => {
|
||||
const { id } = params;
|
||||
|
||||
return http.put<any>(`${MENU}/update/${id}`, params);
|
||||
};
|
||||
//新增
|
||||
export const getMenusLisSaveApi = (params: any) => {
|
||||
return http.post<any>(`${MENU}/save`, params);
|
||||
};
|
||||
//导出
|
||||
export const getMenusLisExportApi = (params: any) => {
|
||||
return http.get<any>(`${MENU}/export`, params, {
|
||||
responseType: "arraybuffer"
|
||||
});
|
||||
};
|
||||
//导入
|
||||
export const getMenusLisImportApi = (params: any) => {
|
||||
return http.post<any>(`${MENU}/import`, params);
|
||||
};
|
||||
//排序
|
||||
export const getMenusLisSortApi = (params: any) => {
|
||||
const { id, sort } = params;
|
||||
return http.post<any>(`${MENU}/sort/${id}`, { sort });
|
||||
};
|
||||
Reference in New Issue
Block a user