| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <template>
- <div id="app" ref="app">
- <router-view :key="$route.fullPath"></router-view>
- </div>
- </template>
- <script>
- import user from "@/http/api/user";
- import { setToken,getToken } from "@/utils/auth";
- import { encrypt } from "@/utils/jsencrypt";
- export default {
- name: "App",
- mounted() {
- // INFO: 本地调试,自动登录
- if (process.env.NODE_ENV === 'development') {
- // this.SubmitLogin();
- }
- },
- methods: {
- SubmitLogin() {
- const username = '376050cy_xiyanzuo_6';
- const password = '123456';
- // const type = '1';
- const schoolType = sessionStorage.getItem('schoolType');
- if(getToken() && schoolType){
- return
- }
- sessionStorage.setItem('schoolType', schoolType || 1);
- user.loginEmailPass({
- username: username,
- password: encrypt(password),
- }).then((res) => {
- if (res.code === 200) {
- this.$store.dispatch("user/CLEAR_LOCAL_STORAGE");//清空本地存储
- setToken(res.data.tokenValue);
- this.$store.dispatch("user/SET_TOKEN", res.data.tokenValue);
- this.$store.dispatch("user/SET_SCHOOL_LOGO", res.data.schoolLogoUrl);//设置学校logo
- this.$store.dispatch("user/SET_SCHOOL_WEB_SITE_ID", res.data.cloudMonitorSiteId || '');//设置学校网站id
- this.$store.dispatch("user/getUserInfoByToken");//获取用户登录信息
- this.$router.push("/studentAnalysisReport/list");
- }
- });
- },
- }
- };
- </script>
- <style lang="scss">
- @use "@/styles/setting.scss";
- #app {
- height: 100%;
- width: 100%;
- }
- </style>
|