|
@@ -13,6 +13,7 @@
|
|
|
<script>
|
|
|
import adminFrame from '@common/src/components/mobile-frame/mobile-main.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions } = createNamespacedHelpers('login');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -79,8 +80,20 @@ export default {
|
|
|
],
|
|
|
};
|
|
|
},
|
|
|
- async created() {},
|
|
|
- methods: {},
|
|
|
+ async created() {
|
|
|
+ this.toLogin();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions(['login']),
|
|
|
+ async toLogin() {
|
|
|
+ const obj = { username: 'wxyk', password: 'wxyk' };
|
|
|
+ const res = await this.login(obj);
|
|
|
+ if (res.code === 200) {
|
|
|
+ const token = res.token;
|
|
|
+ sessionStorage.setItem('token', token);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
},
|