Commit e78ffab3 authored by liwenhong's avatar liwenhong

add:提现tab

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