Commit 19109ed5 authored by liwenhong's avatar liwenhong

fix:login 空白页

parent e78ffab3
......@@ -218,7 +218,7 @@ export default {
});
},
getPermissionsAll() {
let { email } = this.$store.state.userInfo;
let email = this.$store.state.userInfo;
reqGetAll_role_list(email, this.appId).then((res) => {
this.permissionsAll = res.permissions;
});
......
......@@ -18,14 +18,20 @@
<el-button @click="login">登录</el-button>
</div>
<div class="tip">
<p>1. 请使用一点邮箱登录,登录密码为当前的邮箱密码。</p>
<p>1. 请使用邮箱登录,登录密码为当前的邮箱密码。</p>
<p>2. 用户默认无功能权限,请联系管理员开通。</p>
</div>
</div>
</template>
<script>
import { login as reqLogin } from "../../service/user";
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";
export default {
name: "Login",
data () {
......@@ -34,33 +40,55 @@ export default {
email: "",
password: "",
},
permissionsAll: []
};
},
created () { },
created () {
},
computed: {
},
methods: {
...mapActions(['userLogin']),
async login () {
const { email, password } = this.userInfo;
const { email } = this.userInfo;
let validEmail = email.match(/@yidian-inc.com|@linkingcities/);
if (!email) {
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("登录不成功,请检查登录信息后重试!")
return this.$message("请输入用户邮箱");
} else if(!validEmail) {
return this.$message("请输入合法邮箱");
}
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: 100%;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
......@@ -68,7 +96,6 @@ export default {
background: url("../../assets/img/banner1.jpg") center top no-repeat;
background-size: cover;
color: #fff;
.title {
font-size: 40px;
}
......
......@@ -8,7 +8,7 @@ import Layout from "@/layouts";
import RoleList from "@/components/Roles/RoleList";
export default {
name: 'KeepRoleManagement',
// name: 'KeepRoleManagement',
components: {
Layout,
RoleList
......
......@@ -12,7 +12,7 @@ import Layout from "../layout";
import RoleList from "../../../components/Roles/RoleList";
export default {
name: "KeepRoleManagement",
name: "RoleManagement",
components: {
Layout,
RoleList,
......
......@@ -19,25 +19,25 @@ const withdrawalRoutes = [
/* webpackChunkName: "Withdrawal" */ "@/pages/Withdrawal/User/userList"
)
},
//角色管理
{
path: "/op/withdrawal/roleAddRole",
name: "AddRole",
path: "/op/withdrawal/roleManageRole",
name: "KeepRoleManagement",
component: () =>
import(
/* webpackChunkName: "Withdrawal" */ "@/pages/Withdrawal/Role/add-role"
/* webpackChunkName: "Withdrawal" */ "@/pages/Withdrawal/Role/manage-role"
),
meta: {
requireAuth: true,
keepAlive: true
}
// meta: {
// requireAuth: true,
// keepAlive: true
// }
},
//角色管理
{
path: "/op/withdrawal/roleManageRole",
name: "withdrawalManageRole",
path: "/op/withdrawal/roleAddRole",
name: "AddRole",
component: () =>
import(
/* webpackChunkName: "Withdrawal" */ "@/pages/Withdrawal/Role/manage-role"
/* webpackChunkName: "Withdrawal" */ "@/pages/Withdrawal/Role/add-role"
),
meta: {
requireAuth: true,
......
......@@ -7,8 +7,9 @@ import User from "../pages/User/userList";
// import UserDetail from "../pages/User/user-detail.vue";
// import AddRole from "../pages/Role/add-role.vue";
import ManageRole from "../pages/Role/manage-role.vue";
import RoleDetail from "../pages/Role/role-detail.vue";
import ManageRole from "../pages/Role/manage-role";
// import ManageRole from "@/pages/Withdrawal/Role/manage-role.vue";
import RoleDetail from "../pages/Withdrawal/Role/role-detail.vue";
import goodsRouter from "./Goods/index";
import withdrawalRoutes from "./Withdrawal/index";
import groupmealRouters from "./Groupmeal/index";
......@@ -91,11 +92,11 @@ const routes = [
},
{
path: "/op/roleManageRole",
name: "ManageRole",
name: "/op/ManageRole",
component: ManageRole,
meta: {
requireAuth: true
}
// meta: {
// requireAuth: true
// }
},
{
path: "/op/roleRoleDetail",
......
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