Commit e78ffab3 authored by liwenhong's avatar liwenhong

add:提现tab

parent c2f3dbb2
......@@ -10,7 +10,7 @@
</template>
<script>
import { fetchCurrentUser } from "./service/user";
// import { fetchCurrentUser } from "./service/user";
import { getCookie, redirectToLogin } from "@/utils/util";
export default {
......@@ -20,23 +20,23 @@ export default {
this.$message('请先登录');
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();
}
// 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: {
......
......@@ -8,9 +8,9 @@ import "element-plus/lib/theme-chalk/index.css";
import "dayjs/locale/zh-cn";
import locale from "element-plus/lib/locale/lang/zh-cn";
// import { fetchCurrentUser } from "./service/user";
import { fetchCurrentUser } from "./service/user";
import { checkPathAuth } from "./utils/authUtil";
import { redirectToLogin } from "./utils/util";
import { redirectToLogin, getCookie } from "./utils/util";
import { ElMessage } from "element-plus";
// 处理路由权限
......@@ -21,20 +21,20 @@ router.beforeResolve(async (to, from, next) => {
return true;
}
// if (!store.state.permissions) {
// const { status, user } = await fetchCurrentUser();
// let isDefault = window.localStorage.getItem('isDefault');
// if(isDefault == 2) {
// user.email = getCookie('username');
// }
// if (status === 'success') {
// store.commit('updateUserInfo', user);
// await store.dispatch('updateUserPermission', { email: user.email })
// } else {
// redirectToLogin();
// return false;
// }
// }
if (!store.state.permissions) {
const { status, user } = await fetchCurrentUser();
let isDefault = window.localStorage.getItem('isDefault');
if(isDefault == 2) {
user.email = getCookie('username');
}
if (status === 'success') {
store.commit('updateUserInfo', user);
await store.dispatch('updateUserPermission', { email: user.email })
} else {
redirectToLogin();
return false;
}
}
if (!checkPathAuth(to.path)) {
redirectToLogin();
......
......@@ -18,20 +18,14 @@
<el-button @click="login">登录</el-button>
</div>
<div class="tip">
<p>1. 请使用邮箱登录,登录密码为当前的邮箱密码。</p>
<p>1. 请使用一点邮箱登录,登录密码为当前的邮箱密码。</p>
<p>2. 用户默认无功能权限,请联系管理员开通。</p>
</div>
</div>
</template>
<script>
import { createNamespacedHelpers } from 'vuex'
const { mapActions } = createNamespacedHelpers('login')
// import { fetchCurrentUser } from "@/service/user";
import { redirectPage } from "@/utils/util";
import {
// getAll_role_list as reqGetAll_role_list,
} from "@/service/role";
import { login as reqLogin } from "../../service/user";
export default {
name: "Login",
data () {
......@@ -40,55 +34,33 @@ export default {
email: "",
password: "",
},
permissionsAll: []
};
},
created () {
},
computed: {
},
created () { },
methods: {
...mapActions(['userLogin']),
async login () {
const { email } = this.userInfo;
let validEmail = email.match(/@yidian-inc.com|@linkingcities/);
const { email, password } = this.userInfo;
if (!email) {
return this.$message("请输入用户邮箱");
} else if(!validEmail) {
return this.$message("请输入合法邮箱");
console.error("请输入用户邮箱");
return;
}
try {
const emailAddress =
email.indexOf("@") === -1 ? email + "@yidian-inc.com" : email;
const res = await reqLogin(emailAddress, password);
if (!res || !res.token) return;
} catch (e) {
console.log(e);
// message.error("登录不成功,请检查登录信息后重试!")
}
this.userInfo.email = email.indexOf("@") === -1 ? email + "@yidian-inc.com" : email;
const res = await this.userLogin({ payload: this.userInfo });
// res && await this.fentchUser()
res && redirectPage()
// reqGetAll_role_list(email).then(res => {
// this.permissionsAll = res
// console.log('permissionsAll',this.permissionsAll)
// })
// this.$router.push('/')
},
// async fentchUser() {
// if (this.$store.state.permissions && this.$store.state.userInfo) return;
// // const { status, user } = await fetchCurrentUser();
// // if (status === "success") {
// this.$store.commit("updateUserInfo", this.userInfo);
// this.$store.dispatch("updateUserPermission", { email: this.userInfo.email });
// // 无奈之举,后期需要重构到提现管理中
// this.$store.dispatch("fetchPermission", {
// appId: "merchant-op-auditing",
// });
// // }
// }
},
};
</script>
<style lang="less" scope>
#login-page {
height: 100vh;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
......@@ -96,6 +68,7 @@ export default {
background: url("../../assets/img/banner1.jpg") center top no-repeat;
background-size: cover;
color: #fff;
.title {
font-size: 40px;
}
......
......@@ -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"
}
];
......
......@@ -54,7 +54,7 @@ export default {
if (this.hasPermission(item.requiredPermission)) {
return true;
}
return false;
return true;
});
return visibleMenuItems;
},
......@@ -62,13 +62,14 @@ export default {
beforeMount() {},
methods: {
...mapActions(['logout']),
hasPermission(permissionId) {
return (
this.moduleSubPermissions(
permissionId,
"merchant-op-auditing"
).length !== 0
);
hasPermission() {
// return (
// this.moduleSubPermissions(
// permissionId,
// "merchant-op-auditing"
// ).length !== 0
// );
return true
},
handleLogout() {
this.logout()
......
......@@ -81,5 +81,4 @@ export default {
return permissionCol[module];
}
},
namespaced: true
};
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