Browse Source

修改退出登录时跳转至首页

plg 6 months ago
parent
commit
f119966541
3 changed files with 27 additions and 8 deletions
  1. 4 0
      src/components/CpmdHeader.vue
  2. 4 3
      src/views/HomeView.vue
  3. 19 5
      src/views/Plan.vue

+ 4 - 0
src/components/CpmdHeader.vue

@@ -57,10 +57,14 @@ const exitFun = () => {
     //退出登录清除缓存
     visible.value = true
     // userInfo.clearUserInfo()
+    //跳转到首页
+
 }
 const comT = () => {
     visible.value = false
     userInfo.clearUserInfo()
+    //跳转到首页
+    router.push({ name: 'homeView' })
 }
 </script>
 

+ 4 - 3
src/views/HomeView.vue

@@ -28,7 +28,8 @@ const taskCircleFlag = ref<boolean>(true)
 
 //打开任务去看看
 const openSquare = () => {
-  taskSequareFlag.value = true
+  // taskSequareFlag.value = true
+  goView()
 }
 //点击关闭按钮触发
 const closeSquare = () => {
@@ -173,7 +174,7 @@ const planNumGet = async () => {
         </div>
       </div>
     </div>
-    <div class="home_mid_plan_des" v-show="taskSequareFlag">
+    <!-- <div class="home_mid_plan_des" v-show="taskSequareFlag">
       <div class="home_mid_plan_close">
         <img style="right:0" width="20px" src="../assets/home/close.png" @click="closeSquare" />
       </div>
@@ -185,7 +186,7 @@ const planNumGet = async () => {
       <div class="home_mid_plan_button">
         <div class="see_button" @click="goView">去看看</div>
       </div>
-    </div>
+    </div> -->
   </div>
   <div class="home_mid">
 

+ 19 - 5
src/views/Plan.vue

@@ -9,11 +9,15 @@ const router = useRouter()
 import { menuStatusStore, userInfoStore } from '@/stores'
 import { isHaveManage } from '@/utils/test';
 import { userPlanApi, userPlanDetailApi } from '@/api/home';
+import { ElMessage } from 'element-plus';
 const userInfo = userInfoStore();
 const menuStatus = menuStatusStore();
 menuStatus.saveActiveIndex('4')
 
 
+//标志  设置--方法是否结束的标志
+const isFinshed = ref<boolean>(false)
+
 //定义计划列表数据
 const planList = ref<any>([
 
@@ -30,6 +34,16 @@ const planList = ref<any>([
 // }
 //点击了开始测试--跳转到测试页面
 const startPlan = (val: any) => {
+    //判断是否登录了
+    console.log(userInfo.token == '')
+    if (userInfo.token == '') {
+        ElMessage({
+            message: '请先登录',
+            type: 'error'
+        })
+        return
+    }
+
     let flag = ''
     let num = 1
     let flagName = ''
@@ -104,6 +118,7 @@ const startPlan = (val: any) => {
 }
 
 const planNumGet = async () => {
+    isFinshed.value = false
     //如果在就是登录了
     if (userInfo.token) {
         let userNo = ''
@@ -129,9 +144,8 @@ const planNumGet = async () => {
             planList.value[i].list = temp.data
         }
         console.log(planList.value)
-
-
     }
+    isFinshed.value = true
 }
 //刚进入页面就将高度设置为页面需要的
 onMounted(() => {
@@ -163,8 +177,8 @@ onUnmounted(() => {
         <div class="kply">
             <div class="kply_inner">
                 <div>
-                    <div style="padding: 20px 40px;" v-show="planList.length == 0">
-                        <div style="padding:10% 20% ;" v-show="planList.length == 0">
+                    <div style="padding: 20px 40px;" v-show="planList.length == 0 && isFinshed">
+                        <div style="padding:10% 20% ;" v-show="planList.length == 0 && isFinshed">
                             <img width="100%" src="../assets/planNo.png">
                         </div>
                     </div>
@@ -318,7 +332,7 @@ onUnmounted(() => {
             right: 0;
             margin: auto;
             width: 1200px;
-            min-height: 500px;
+            min-height: 600px;
             background-color: #FAFAFA;
             border-radius: 40px;
             // height: 1000px;