提交 4343a5d4 authored 作者: pengxiaohui's avatar pengxiaohui

权限

上级 ae80b525
VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index
VITE_BASE_URL=https://learn-api.ezijing.com
VITE_BASE_URL=
VITE_SECRET_ID=ezijing_f807b4fa39afd0f535260ebca7932676
VITE_SECRET_KEY=1c0bf69718c780bed64d522a76942dd2
VITE_LOGIN_URL=https://login.ezijing.com/auth/login/index
VITE_BASE_URL=https://learn-api.ezijing.com
VITE_SECRET_ID=ezijing_f807b4fa39afd0f535260ebca7932676
VITE_SECRET_KEY=1c0bf69718c780bed64d522a76942dd2
VITE_LOGIN_URL=https://login2.ezijing.com/auth/login/index
VITE_BASE_URL=https://learn-api2.ezijing.com
VITE_SECRET_ID=ezijing_f807b4fa39afd0f535260ebca7932676
VITE_SECRET_KEY=1c0bf69718c780bed64d522a76942dd2
......@@ -51,8 +51,8 @@ const store = new Vuex.Store({
// 获取所有权限列表
getPermissions({ commit }) {
getPermissions({ type: 1 }).then(res => {
if (res.data && res.data.permissions) {
commit('setPermissions', res.data.permissions)
if (res.data && res.data.items) {
commit('setPermissions', res.data.items)
}
})
}
......
......@@ -15,6 +15,17 @@ const httpRequest = axios.create({
// 请求拦截
httpRequest.interceptors.request.use(
function (config) {
if (/^\/api\/permissions/.test(config.url)) {
// 默认参数
const defaultHeaders = {
timestamp: parseInt(Date.now() / 1000),
nonce: Math.random().toString(36).slice(-8),
'secret-id': import.meta.env.VITE_SECRET_ID,
'secret-key': import.meta.env.VITE_SECRET_KEY,
signature: 'UG7wBenexQhiuD2wpCwuxkU0jqcj006d'
}
config.headers = Object.assign(config.headers, defaultHeaders)
}
if (config.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
config.data = queryString.stringify(config.data)
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论