mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-10 11:26:49 +08:00
Merge branch 'manage-release' of http://gitlab.dongwu-inc.com:10080/BOE/fe-stu into release
This commit is contained in:
42
src/App.vue
42
src/App.vue
@@ -22,35 +22,28 @@
|
||||
</router-link>
|
||||
</div> -->
|
||||
<main>
|
||||
<router-view />
|
||||
<router-view/>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { computed, defineComponent } from "vue";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
console.log("router", router.getRoutes(), route);
|
||||
console.log(import.meta.env.DEV);
|
||||
const routes = computed(() => {
|
||||
return router.getRoutes().filter((e) => e.meta?.isLink);
|
||||
});
|
||||
<script setup>
|
||||
|
||||
const currentRouteName = computed(() => route.name);
|
||||
import {boeRequest} from "@/api/request";
|
||||
import {GET_USER_INFO} from "@/api/ThirdApi";
|
||||
import { useStore } from "vuex";
|
||||
import {onMounted} from "vue";
|
||||
|
||||
const store = useStore();
|
||||
|
||||
onMounted(()=>{
|
||||
getUserInfo()
|
||||
})
|
||||
function getUserInfo(){
|
||||
boeRequest(GET_USER_INFO).then(res=>{
|
||||
store.commit("SET_USER", res.result);
|
||||
})
|
||||
}
|
||||
|
||||
// localStorage.setItem(
|
||||
// "token",
|
||||
// "eyJ0eXBlIjoidG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91LmJvZS5jb20iLCJpYXQiOjE2NzA3NjExNzIsImV4cCI6MTY3MDc2ODM3MiwiR2l2ZW5OYW1lIjoiYm9ldSIsInVzZXJJZCI6IjZCMDQ5RkFGLUMzMTQtN0NDRi0wRDI4LTBEMjNGNEM0MjUzMSIsInVJZCI6Ijk2NTM0MjAyNzQ5NzYwNzE2OCIsInBlcm1pc3Npb24iOiIifQ==.9e8c4d3933c3a6d9b660e0b849940c813e1c245b3d17646ff7a793100640bc42"
|
||||
// );
|
||||
return {
|
||||
routes,
|
||||
name: currentRouteName,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<style lang="scss">
|
||||
#app {
|
||||
@@ -99,6 +92,7 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { createStore } from 'vuex'
|
||||
import {createStore} from 'vuex'
|
||||
|
||||
export default createStore({
|
||||
state: {
|
||||
userInfo: {}
|
||||
},
|
||||
getters: {
|
||||
},
|
||||
getters: {},
|
||||
mutations: {
|
||||
SET_USER(state, userInfo) {
|
||||
state.userInfo = userInfo
|
||||
},
|
||||
actions: {
|
||||
},
|
||||
modules: {
|
||||
}
|
||||
actions: {},
|
||||
modules: {}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user