123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <template>
- <view class="client-my-page">
- <view class="my-head-box">
- <img class="head-img-box" :src="myInfoData.userImg" v-if="myInfoData.userImg">
- <icon class="head-icon-box" v-else></icon>
- <view class="head-content-box">
- <text>{{myInfoData.realName}}</text>
- <view class="idcard-row-box" v-if="myInfoData.idcard">
- <icon class="idcard-icon"></icon>
- <text class="idcard-text" >{{myInfoData.idcard}}</text>
- </view>
- </view>
- </view>
-
- <view class="my-num-box">
- <view class="num-item-box" @click="goToPage('ks')">
- <uni-badge class="uni-badge-left-margin my-num-badge" v-if="myInfoData.kaoshiCount"
- :customStyle="{background: '#ff2527'}" :text="myInfoData.kaoshiCount" />
- <icon class="ks-icon"></icon>
- <text class="num-title">考试管理</text>
- </view>
- <view class="num-item-box" @click="goToPage('lx')">
- <uni-badge class="uni-badge-left-margin my-num-badge" v-if="myInfoData.lianxiCount"
- :customStyle="{background: '#ff2527'}" :text="myInfoData.lianxiCount" />
- <icon class="lx-icon"></icon>
- <text class="num-title">练习管理</text>
- </view>
- <view class="num-item-box" @click="goToPage('kc')">
- <uni-badge class="uni-badge-left-margin my-num-badge" v-if="myInfoData.kechengCount"
- :customStyle="{background: '#ff2527'}" :text="myInfoData.kechengCount" />
- <icon class="kc-icon"></icon>
- <text class="num-title">课程管理</text>
- </view>
- </view>
-
- <view class="my-list-box">
- <view class="list-row" @click="goToPage('grcj')">
- <icon class="list-icon user-icon"></icon>
- <text>修改个人信息</text>
- </view>
- <view class="list-row" @click="goToPage('cj')">
- <icon class="list-icon score-icon"></icon>
- <text>成绩列表</text>
- </view>
- <view class="list-row" @click="exitLogin">
- <icon class="list-icon login-out-icon"></icon>
- <text>退出登录</text>
- </view>
- </view>
- <!-- 底部区域 -->
- <customTabbarClient :currentTab="1"></customTabbarClient>
- <common-dialog ref="commonDialogRef" :title="exitTitle" :content="exitContent"@confirm-btn="exitBtn"></common-dialog>
- </view>
- </template>
- <script setup>
- import {toast} from "@/utils/common";
- import {onLoad} from '@dcloudio/uni-app';
- import cacheManager from '@/utils/cacheManager.js';
- import {getMineUser,getMineInfo,getMineLogout} from '@/api/my.js'
- import {reactive,ref} from "vue";
- import customTabbarClient from "@/components/custom-tabbar/custom-tabbar-client.vue"
- import commonDialog from '@/components/dialog/commonDialog.vue';
- let myInfoData = reactive({
- userImg: '',
- realName: '',
- idcard: '',
- kaoshiCount: '',
- kechengCount: '',
- lianxiCount: '',
- });
- const commonDialogRef = ref(null);
- const exitContent = '你确定要执行这个操作吗?';
- const exitTitle = '退出登录';
- function getMyInit() {
- getUserInfo();
- getNumInfo();
- }
- // 获取用户头像
- function goToPage(data){
- switch (data) {
- case 'ks':
- uni.redirectTo({
- url:'/pages/client/Kaoshi/list?from=my'
- })
- break;
- case 'lx':
- uni.redirectTo({
- url:'/pages/client/Lianxi/list?from=my'
- })
- break;
- case 'kc':
- uni.redirectTo({
- url:'/pages/client/Kecheng/list?from=my'
- })
- break;
- case 'cj':
- uni.redirectTo({
- url:'/pages/client/Chengji/list?from=my'
- })
- break;
- case 'grcj':
- uni.redirectTo({
- url:'/pages/client/my/myInfo?from=my'
- })
- break;
- }
- }
- function getUserInfo(){
- getMineUser({}).then(res => {
- myInfoData.userImg= res.data.icon;
- myInfoData.realName = res.data.realName;
- myInfoData.idcard = res.data.idcard;
- })
- }
- function getNumInfo(){
- getMineInfo({}).then(res => {
- myInfoData.kaoshiCount = res.data.kaoshiCount;
- myInfoData.kechengCount = res.data.kechengCount;
- myInfoData.lianxiCount = res.data.lianxiCount;
- })
- }
- function exitLogin(){
- commonDialogRef.value.handleShow();
-
- }
- function exitBtn(){
- getMineLogout().then(res => {
- console.log(res,'res');
- toast('退出登录成功')
- cacheManager.clearAll();
- uni.reLaunch({
- url: '/pages/Login/index'
- });
- }).catch(err => {
- toast('退出登录失败,请稍后重试')
- })
- }
- onLoad(() => {
- getMyInit()
- })
- </script>
- <style>
- </style>
|