|
|
@@ -4,10 +4,13 @@
|
|
|
<h1 class="title">
|
|
|
SEEC 课堂助手
|
|
|
</h1>
|
|
|
+ <router-link :to="{name: userInfo.role === 'TEACHER' ? 'teacher' : 'student'}">
|
|
|
+ <c-button v-if="userInfo.name" icon="face" block theme="green" class="mb-32">已登录用户:{{userInfo.name}}</c-button>
|
|
|
+ </router-link>
|
|
|
<!-- <c-button @click="handleLogin" standout block theme="blue" class="mb-12">去登录</c-button>-->
|
|
|
<!-- <c-button block theme="blue" @click="handleRegister">去注册</c-button>-->
|
|
|
- <c-button icon="face" no-bold block theme="blue" standout @click="jumpToLogin">统一认证 - 登录</c-button>
|
|
|
- <c-button icon="assignment_ind" block theme="green" class="mt-16" @click="jumpToRegister">统一认证 - 注册</c-button>
|
|
|
+ <c-button icon="people" no-bold block theme="blue" standout @click="jumpToLogin">统一认证 - 登录</c-button>
|
|
|
+ <c-button icon="assignment_ind" block theme="blue" class="mt-16" @click="jumpToRegister">统一认证 - 注册</c-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -15,9 +18,22 @@
|
|
|
<script>
|
|
|
import CButton from '@/components/Basic/CButton'
|
|
|
import { jumpToLogin, jumpToRegister } from '@/server/auth'
|
|
|
+import { getUserInfo } from '@/server/user'
|
|
|
+import { SET_USER_INFO } from '@/store/types/main-types'
|
|
|
+import { mapState } from 'vuex'
|
|
|
|
|
|
export default {
|
|
|
components: { CButton },
|
|
|
+ computed: {
|
|
|
+ ...mapState({
|
|
|
+ userInfo: state => state.main.userInfo
|
|
|
+ })
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ getUserInfo().then(res => {
|
|
|
+ this.$store.commit(SET_USER_INFO, { userInfo: res })
|
|
|
+ })
|
|
|
+ },
|
|
|
methods: {
|
|
|
// handleLogin () {
|
|
|
// this.$router.push({ name: 'login' })
|
|
|
@@ -42,5 +58,6 @@ export default {
|
|
|
|
|
|
.content {
|
|
|
z-index: 1;
|
|
|
+ width: 280px;
|
|
|
}
|
|
|
</style>
|