Mine.vue 2.72 KB
<template>
    <v-content style="margin-top: 20%">
        <v-container fluid fill-height>
            <v-layout align-center justify-center>
                <v-flex>
                    <div class="v-card-profile">
                        <v-avatar
                                slot="offset"
                                class="mx-auto d-block"
                                size="130"
                        >
                            <img src="https://demos.creative-tim.com/vue-material-dashboard/img/marc.aba54d65.jpg">
                        </v-avatar>
                        <v-card-text class="text-xs-center">
                            <h6 class="category text-gray font-weight-thin mb-9"></h6>
                            <h4 class="card-title" v-text="userName"></h4>
                            <!--                        <p class="card-description font-weight-light">Don't be scared of the truth because we need to-->
                            <!--                            restart the human foundation in truth And I love you like Kanye loves Kanye I love Rick-->
                            <!--                            Owens’ bed design but the back is...</p>-->
                            <!--                        <v-btn-->
                            <!--                                color="success"-->
                            <!--                                round-->
                            <!--                                class="font-weight-light"-->
                            <!--                        >Follow-->
                            <!--                        </v-btn>-->
                        </v-card-text>
                    </div>
                </v-flex>
            </v-layout>
        </v-container>
    </v-content>
</template>

<script>
    export default {
        name: 'Mine',
        methods: {
            getUrlKey(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null)
                    return unescape(r[2]);
                return null;
            },
            getUserInfo() {
                this.$axios({
                    method: 'get',
                    url: '/sso/getUser?ticket=' + this.ticketStr,
                }).then((response) => {
                    //这里使用了ES6的语法
                    this.userName = response.data.data.ddUserInfo.username    //请求成功返回的数据

                })
            }
        },
        mounted() {
            this.ticketStr = this.getUrlKey("ticketStr");
            this.getUserInfo();
        },
        data: () => ({
            userName: ''
        })

    }
</script>