|
@@ -0,0 +1,98 @@
|
|
|
+<template>
|
|
|
+ <div id="detail">
|
|
|
+ <mobileMain :useNav="false" :usePage="false" topType="2" :rightArrow="false" :leftArrow="false">
|
|
|
+ <template v-slot:info>
|
|
|
+ <van-tabs v-model="active">
|
|
|
+ <van-tab title="平台登录">
|
|
|
+ <van-col span="24" class="one">
|
|
|
+ <van-form @submit="onSubmit">
|
|
|
+ <van-field v-model="form.phone" name="phone" label="用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
|
|
|
+ <van-field v-model="form.password" type="password" name="password" label="密码" :rules="[{ required: true, message: '请填写密码' }]" />
|
|
|
+ <van-field name="role" label="用户类别">
|
|
|
+ <template #input>
|
|
|
+ <van-radio-group v-model="form.role" direction="horizontal">
|
|
|
+ <van-radio name="4">个人登录</van-radio>
|
|
|
+ <van-radio name="5">企业登录</van-radio>
|
|
|
+ </van-radio-group>
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
+ <div style="margin: 16px;">
|
|
|
+ <van-button round block type="info" native-type="submit">提交</van-button>
|
|
|
+ </div>
|
|
|
+ </van-form>
|
|
|
+ </van-col>
|
|
|
+ </van-tab>
|
|
|
+ </van-tabs>
|
|
|
+ </template>
|
|
|
+ </mobileMain>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: personal } = createNamespacedHelpers('personal');
|
|
|
+const { mapActions: organization } = createNamespacedHelpers('organization');
|
|
|
+export default {
|
|
|
+ name: 'detail',
|
|
|
+ props: {},
|
|
|
+ components: {},
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ active: 0,
|
|
|
+ form: {},
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ ...personal(['perLogin']),
|
|
|
+ ...organization(['orgLogin']),
|
|
|
+ async onSubmit(values) {
|
|
|
+ if (values.role == '4') {
|
|
|
+ let res = await this.perLogin({ user: values });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$notify({
|
|
|
+ message: '登录成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.$router.push({ path: '/user/account/index' });
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'danger',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else if (values.role == '5') {
|
|
|
+ values.institution_code = values.phone;
|
|
|
+ let res = await this.orgLogin({ user: values });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$notify({
|
|
|
+ message: '登录成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.$router.push('/user/account/index');
|
|
|
+ } else {
|
|
|
+ this.$notify({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'danger',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ test: {
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ handler(val) {},
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|