|
@@ -0,0 +1,77 @@
|
|
|
+<template>
|
|
|
+ <div id="webLogin">
|
|
|
+ <login-detail :form="form" @submitDate="submitnewLogin" :forms="forms" @submitDates="submitRegisters"></login-detail>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import loginDetail from '@/layout/login/webLogin.vue';
|
|
|
+import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
|
|
|
+const { mapActions: mapMarket } = createNamespacedHelpers('market');
|
|
|
+const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
|
|
|
+const { mapActions: login } = createNamespacedHelpers('login');
|
|
|
+
|
|
|
+expertsuser;
|
|
|
+export default {
|
|
|
+ name: 'webLogin',
|
|
|
+ props: {},
|
|
|
+ components: { loginDetail },
|
|
|
+ data: () => {
|
|
|
+ return {
|
|
|
+ // 个人
|
|
|
+ form: {},
|
|
|
+ // 注册
|
|
|
+ forms: {},
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ ...mapMarket({ userFetch: 'fetch', userCreate: 'create', userUpdate: 'update' }),
|
|
|
+ ...login({ toLogin: 'login' }),
|
|
|
+ ...expertsuser({ expertsuserCreate: 'create' }),
|
|
|
+ // 用户登录
|
|
|
+ async submitnewLogin(form) {
|
|
|
+ let res = await this.toLogin({ user: form });
|
|
|
+ if (res.uid) {
|
|
|
+ if (res.role == '2') {
|
|
|
+ this.$router.push('/market/index');
|
|
|
+ } else {
|
|
|
+ this.$router.push({ path: '/userCenter/index', query: { num: '1' } });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 注册
|
|
|
+ async submitRegisters({ data }) {
|
|
|
+ if (data.role == '4' || data.role == '5') {
|
|
|
+ let res = await this.userCreate(data);
|
|
|
+ console.log(res.data);
|
|
|
+ let msg = `注册成功,等待管理员审核,方可登录`;
|
|
|
+ this.$checkRes(res, msg);
|
|
|
+ } else if (data.role == '6') {
|
|
|
+ let res = await this.expertsuserCreate(data);
|
|
|
+ let msg = `注册成功,等待管理员审核,方可登录`;
|
|
|
+ this.$checkRes(res, msg);
|
|
|
+ } else if (data.role == '7') {
|
|
|
+ data.status = '3';
|
|
|
+ let res = await this.userCreate(data);
|
|
|
+ let msg = `注册成功,等待管理员审核,方可登录`;
|
|
|
+ }
|
|
|
+ window.location.reload();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ pageTitle() {
|
|
|
+ return `${this.$route.meta.title}`;
|
|
|
+ },
|
|
|
+ redirect_uri() {
|
|
|
+ return `${this.$route.query.redirect_uri}`;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|