Commit 31fe2001 authored by liwenhong's avatar liwenhong

add

parent 217537d0
......@@ -21,6 +21,7 @@ module.exports = {
API_INTERNAL_URI: API_INTERNAL_URI[env],
PANDORA_URI: PANDORA_URI[env],
GOODS_URI: API_INTERNAL_URI[env],
ACTIVITY_URI: API_INTERNAL_URI[env],
GROUPMEAL_URI: API_INTERNAL_URI[env],
WITHDRAWAL_URI: API_INTERNAL_URI[env],
API_YD_LOGIN
......
......@@ -10,29 +10,33 @@
</template>
<script>
// import { fetchCurrentUser } from "./service/user";
import { fetchCurrentUser } from "./service/user";
import { getCookie, redirectToLogin } from "@/utils/util";
export default {
mounted() {
async mounted() {
console.log(getCookie('username'));
if(!getCookie('username')) {
this.$message('请先登录');
redirectToLogin();
}
// if (this.$store.state.permissions && this.$store.state.userInfo) return;
// const { status, user } = await fetchCurrentUser();
// if (status === "success") {
// this.$store.commit("updateUserInfo", user);
// console.log('user',user)
// this.$store.dispatch("updateUserPermission", { email: user.email });
// // 无奈之举,后期需要重构到提现管理中
// this.$store.dispatch("fetchPermission", {
// appId: "merchant-op-auditing",
// });
// } else {
// redirectToLogin();
// }
if (this.$store.state.permissions && this.$store.state.userInfo) return;
let isDefault = window.localStorage.getItem('isDefault');
if(isDefault == 2) {
user.email = getCookie('username');
}
const { status, user } = await fetchCurrentUser();
if (status === "success") {
this.$store.commit("updateUserInfo", user);
console.log('user',user)
this.$store.dispatch("updateUserPermission", { email: user.email });
// 无奈之举,后期需要重构到提现管理中
this.$store.dispatch("fetchPermission", {
appId: "merchant-op-auditing",
});
} else {
redirectToLogin();
}
},
computed: {
......
......@@ -7,10 +7,11 @@ import ElementPlus from "element-plus";
import "element-plus/lib/theme-chalk/index.css";
import "dayjs/locale/zh-cn";
import locale from "element-plus/lib/locale/lang/zh-cn";
import { ElMessage } from "element-plus";
import { fetchCurrentUser } from "./service/user";
// import { fetchCurrentUser } from "./service/user";
import { checkPathAuth } from "./utils/authUtil";
import { redirectToLogin, getCookie } from "./utils/util";
import { redirectToLogin } from "./utils/util";
// 处理路由权限
router.beforeResolve(async (to, from, next) => {
......@@ -21,28 +22,31 @@ router.beforeResolve(async (to, from, next) => {
if(!store.state.permissions && !store.state.userInfo) {
redirectToLogin();
// location.href = '/'
next();
}
if (!store.state.permissions) {
this.$message('您暂无权限');
let isDefault = window.localStorage.getItem('isDefault');
if(isDefault == 2) {
user.email = getCookie('username');
}
const { status, user } = await fetchCurrentUser();
if (status === 'success') {
store.commit('updateUserInfo', user);
await store.dispatch('updateUserPermission', { email: user.email })
} else {
redirectToLogin();
return false;
}
// next();
// return this.$message("您没有权限");
// return ElMessage.error('您没有权限');
}
// if (!store.state.permissions) {
// ElMessage.error('您没有权限');
// // this.$message('您暂无权限');
// let isDefault = window.localStorage.getItem('isDefault');
// if(isDefault == 2) {
// user.email = getCookie('username');
// }
// const { status, user } = await fetchCurrentUser();
// if (status === 'success') {
// store.commit('updateUserInfo', user);
// await store.dispatch('updateUserPermission', { email: user.email })
// } else {
// redirectToLogin();
// return false;
// }
// }
if (!checkPathAuth(to.path)) {
router.push('/op/login');
return this.$message("您没有权限");
redirectToLogin();
return ElMessage.error('您没有权限');
} else {
next();
}
......
.tab-show {
width: 100%;
height: 100%;
// height: 100%;
padding: 0px 55px;
background-color: white;
.el-tabs__nav-wrap::after {
......
......@@ -6,14 +6,14 @@ const headerConfig = [
{
path: "/op/withdrawal/roleManageRole",
name: "角色管理",
requireAuthentication: true,
requiredPermission: "role_management"
// requireAuthentication: true,
// requiredPermission: "role_management"
},
{
path: "/op/withdrawal/user",
name: "用户管理",
requireAuthentication: true,
requiredPermission: "user_management"
// requireAuthentication: true,
// requiredPermission: "user_management"
}
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment