123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <view class="percon-area">
- <navbar />
- <view style="height:92rpx;"></view>
- <view class="head-card">
- <view class="head-box">
- <image :src="user_head_img"></image>
- </view>
- <text class="user-text">{{user_name}}</text>
- <button class="quit-btn" @click="signOut">退出登录</button>
- </view>
- <view class="head-card book-card">
- <uni-grid :column="3" :showBorder="false" :square="false">
- <uni-grid-item v-for="(item, index) in pageList" :key="index">
- <view class="book-box" @click="linkBook(item.book_id)">
- <image :src="item.book_picture_url"></image>
- </view>
- <text class="text" @click="linkBook(item.book_id)">{{item.book_name}}</text>
- </uni-grid-item>
- </uni-grid>
- </view>
- <view style="height:120rpx;"></view>
- </view>
- </template>
- <script>
- import {
- GetMyBookList_JoinCourse_Student,
- } from '@/api/exercise.js';
- import {
- GetMyUserInfo,
- } from '@/api/user.js';
- export default {
- data() {
- return {
- user_head_img: '', // 用户头像
- user_name: '用户名',
- pageList: [],
- }
- },
- onLoad() {
- this.getMyUserInfo();
- this.loadMoreData();
- },
- methods: {
- getMyUserInfo() {
- GetMyUserInfo().then((res) => {
- if (res.status) {
- this.user_name = res.real_name;
- this.user_head_img = res.image_url;
- }
- });
- },
- //加载数据
- loadMoreData() {
- GetMyBookList_JoinCourse_Student().then((res) => {
- if (res.status) {
- this.pageList = res.book_list;
- }
- })
- },
- //退出
- signOut() {
- this.$store.dispatch('user/signOut');
- window.location.href = '/';
- },
- linkBook(book_id) {
- let baseUrl = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '');
- let url = baseUrl + '/GCLS-Book/#/courseview?showCourse=true&invok_module=GCLS-LC&bookId=' + book_id;
- window.open(url, 'target');
- },
- }
- }
- </script>
- <style lang="scss">
- .percon-area {
- .head-card {
- margin: 16rpx;
- background-color: #fff;
- border-radius: 16rpx;
- height: 400rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- row-gap: 32rpx;
- font-weight: 500;
- font-size: 13pt;
- .head-box {
- width: 160rpx;
- height: 160rpx;
- background-color: #d9d9d9;
- margin: 0 auto;
- border-radius: 80rpx;
- uni-image {
- width: 100%;
- height: 100%;
- border-radius: 80rpx;
- }
- }
- .quit-btn {
- font-size: 16px;
- border: 1px solid #ed5c5c;
- color: #ed5c5c;
- background-color: #fff;
- padding: 0 40rpx;
- }
- }
- .book-card {
- padding: 16px 22px;
- height: auto;
- margin-bottom: 120px;
- .book-box {
- width: 85%;
- aspect-ratio: 3 / 4;
- background-color: #d9d9d9;
- uni-image {
- width: 100%;
- height: 100%;
- }
- }
- .book-box::before {
- display: inline-block;
- padding-bottom: 120%;
- content: '';
- }
- .text {
- margin: 16rpx 0 32rpx 0;
- width: 85%;
- font-size: 13pt;
- }
- /deep/ .uni-grid-item {
- width: 33% !important;
- .uni-grid-item__box {
- align-items: center;
- }
- }
- }
- }
- </style>
|