| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- // import Captcha from '@/components/common/captcha';
- export default {
- // components: {
- // Captcha
- // },
- data() {
- return {
- form: {
- mobile: null,
- password: null,
- // captchaId: '',
- verifyCode: ''
- },
- saving: false,
- loading: true
- };
- },
- mounted() {
- this.loading = false;
- if (process.env.NODE_ENV === 'development') {
- this.form.mobile = '15280215347';
- this.form.password = '123456';
- }
- },
- methods: {
- captchaChange() {
- this.form.verifyCode = '';
- },
- async next() {
- const { mobile, password } = this.form;
- if (!mobile) {
- return this.$message.warning('用户名不能为空');
- }
- if (!password) {
- return this.$message.warning('密码不能为空');
- }
- this.saving = true;
- try {
- // 登录
- await this.$store.dispatch('userLogin', this.form);
- if (this.$projectName == 'business') {
- // 用户信息
- await this.$store.dispatch('userInfo');
- // 商户信息
- await this.$store.dispatch('shopInfo');
- } else {
- // 后台信息
- await this.$store.dispatch('adminInfo');
- }
- // 权限菜单
- const [first] = await this.$store.dispatch('permMenu');
- this.saving = false;
- if (!first) {
- this.$message.error('该账号没有权限');
- } else {
- this.$nextTick(() => {
- if (this.$projectName == 'business') {
- this.$router.push('/');
- } else {
- this.$router.push('/');
- }
- });
- }
- } catch (err) {
- // this.$refs.captcha.refresh();
- this.saving = false;
- }
- }
- }
- };
|