mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-20 17:37:23 +08:00
reset-admin
This commit is contained in:
Vendored
-50
@@ -1,50 +0,0 @@
|
||||
import axios from "./axios";
|
||||
|
||||
const baseUrl = 'http://nexus-php8.tinyhd.net/api/';
|
||||
|
||||
|
||||
const api = {
|
||||
listAllowAgent: (params = {}) => {
|
||||
return axios.get(baseUrl + 'agent-allow', {params: params});
|
||||
},
|
||||
storeAllowAgent: (params = {}) => {
|
||||
return axios.post(baseUrl + 'agent-allow', params);
|
||||
},
|
||||
updateAllowAgent: (id, params = {}) => {
|
||||
return axios.put(baseUrl + 'agent-allow/' + id, params);
|
||||
},
|
||||
getAllowAgent: (id) => {
|
||||
return axios.get(baseUrl + 'agent-allow/' + id);
|
||||
},
|
||||
deleteAllowAgent: (id) => {
|
||||
return axios.delete(baseUrl + 'agent-allow/' + id);
|
||||
},
|
||||
|
||||
listUser: (params = {}) => {
|
||||
return axios.get(baseUrl + 'user', {params: params});
|
||||
},
|
||||
storeUser: (params = {}) => {
|
||||
return axios.post(baseUrl + 'user', params);
|
||||
},
|
||||
|
||||
listExam: (params = {}) => {
|
||||
return axios.get(baseUrl + 'exam', {params: params});
|
||||
},
|
||||
storeExam: (params = {}) => {
|
||||
return axios.post(baseUrl + 'exam', params);
|
||||
},
|
||||
updateExam: (id, params = {}) => {
|
||||
return axios.put(baseUrl + 'exam/' + id, params);
|
||||
},
|
||||
getExam: (id) => {
|
||||
return axios.get(baseUrl + 'exam/' + id);
|
||||
},
|
||||
deleteExam: (id) => {
|
||||
return axios.delete(baseUrl + 'exam/' + id);
|
||||
},
|
||||
listClass: (params = {}) => {
|
||||
return axios.get(baseUrl + 'class', {params: params});
|
||||
},
|
||||
}
|
||||
|
||||
export default api
|
||||
Vendored
-43
@@ -1,43 +0,0 @@
|
||||
import axios from 'axios'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import router from '@/router/index'
|
||||
import { localGet } from './index'
|
||||
import config from '~/config'
|
||||
|
||||
|
||||
// 这边由于后端没有区分测试和正式,姑且都写成一个接口。
|
||||
axios.defaults.baseURL = config[import.meta.env.MODE].baseUrl
|
||||
// 携带 cookie,对目前的项目没有什么作用,因为我们是 token 鉴权
|
||||
axios.defaults.withCredentials = true
|
||||
// 请求头,headers 信息
|
||||
axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest'
|
||||
axios.defaults.headers['token'] = localGet('token') || ''
|
||||
// 默认 post 请求,使用 application/json 形式
|
||||
axios.defaults.headers.post['Content-Type'] = 'application/json'
|
||||
|
||||
// 请求拦截器,内部根据返回值,重新组装,统一管理。
|
||||
axios.interceptors.response.use(res => {
|
||||
console.log(res)
|
||||
if (typeof res.data !== 'object') {
|
||||
ElMessage.error('服务端异常!')
|
||||
return Promise.reject(res)
|
||||
}
|
||||
if (res.data.ret && res.data.ret != 0) {
|
||||
ElMessage.error(res.data.msg)
|
||||
return Promise.reject(res)
|
||||
}
|
||||
if (res.data.resultCode && res.data.resultCode != 200) {
|
||||
if (res.data.message) ElMessage.error(res.data.message)
|
||||
if (res.data.resultCode == 419) {
|
||||
router.push({ path: '/login' })
|
||||
}
|
||||
return Promise.reject(res.data)
|
||||
}
|
||||
return res.data.data
|
||||
}, (error) => {
|
||||
console.log(error.response)
|
||||
ElMessage.error(error.response.data.msg || '500 Server Error')
|
||||
return Promise.reject(error)
|
||||
})
|
||||
|
||||
export default axios
|
||||
Vendored
-52
@@ -1,52 +0,0 @@
|
||||
export function localGet (key) {
|
||||
const value = window.localStorage.getItem(key)
|
||||
try {
|
||||
return JSON.parse(window.localStorage.getItem(key))
|
||||
} catch (error) {
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
export function localSet (key, value) {
|
||||
window.localStorage.setItem(key, JSON.stringify(value))
|
||||
}
|
||||
|
||||
export function localRemove (key) {
|
||||
window.localStorage.removeItem(key)
|
||||
}
|
||||
|
||||
// 判断内容是否含有表情字符,现有数据库不支持。
|
||||
export function hasEmoji (str = '') {
|
||||
const reg = /[^\u0020-\u007E\u00A0-\u00BE\u2E80-\uA4CF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF\u0080-\u009F\u2000-\u201f\u2026\u2022\u20ac\r\n]/g;
|
||||
return str.match(reg) && str.match(reg).length
|
||||
}
|
||||
|
||||
// 单张图片上传
|
||||
export const uploadImgServer = 'http://backend-api-02.newbee.ltd/manage-api/v1/upload/file'
|
||||
// 多张图片上传
|
||||
export const uploadImgsServer = 'http://backend-api-02.newbee.ltd/manage-api/v1/upload/files'
|
||||
|
||||
export const pathMap = {
|
||||
login: '登录',
|
||||
introduce: '系统介绍',
|
||||
dashboard: '大盘数据',
|
||||
add: '添加商品',
|
||||
swiper: '轮播图配置',
|
||||
hot: '热销商品配置',
|
||||
new: '新品上线配置',
|
||||
recommend: '为你推荐配置',
|
||||
category: '分类管理',
|
||||
level2: '分类二级管理',
|
||||
level3: '分类三级管理',
|
||||
good: '商品管理',
|
||||
guest: '会员管理',
|
||||
order: '订单管理',
|
||||
order_detail: '订单详情',
|
||||
account: '修改账户',
|
||||
"agent-allow": "允许客户端",
|
||||
"agent-allow-form": "允许客户端表单",
|
||||
"user": "用户",
|
||||
"user-form": "用户表单",
|
||||
"exam": "考核",
|
||||
"exam-form": "考核表单",
|
||||
}
|
||||
Reference in New Issue
Block a user