aaa 4 yıl önce
ebeveyn
işleme
5845230bdb

+ 7 - 0
src/router/index.js

@@ -9,6 +9,7 @@ let routes = [
     path: "/Home",
     name: "home",
     meta: { keepAlive: true },
+    props: true,
     component: () => import("@/views/home")
   },
   {
@@ -36,6 +37,12 @@ let routes = [
     name: "ExamResult",
     component: () => import("@/views/home/exam/page-exam-item-result")
   }, // 单个考试的试卷页
+  {
+    path: "/page-learn",
+    name: "page-learn",
+    props: true,
+    component: () => import("@/views/home/learn/page-learn")
+  }, // 学习页面
   {
     path: "/learn-content/:materialId",
     name: "learn-content",

+ 8 - 1
src/views/home/index.vue

@@ -50,10 +50,17 @@ import { mapState } from "vuex";
 export default {
   name: "home",
   components: { PageLearn, PageAnswer, PageExam, PagePerson },
+  props: {
+    // 分组的数据列表
+    propPcomponents: {
+      type: String,
+      default: "pageLearn"
+    }
+  },
   data() {
     return {
-      activeTabName: 0,
       currentComponents: "pageLearn",
+      activeTabName: 0,
       tabbars: [
         {
           title: "学习",

+ 4 - 2
src/views/home/person/exam-history.vue

@@ -3,7 +3,9 @@
     <van-nav-bar title="考试" left-arrow @click-left="onClickLeft" />
     <div class="exam-history-div">
       <div class="exam-history-grades-div">
-        <div class="exam-history-grades">{{ userTotalPonits }}</div>
+        <div class="exam-history-grades">
+          {{ this.user.userInfo.examPoints }}
+        </div>
       </div>
 
       <div class="exam-history-list">
@@ -22,7 +24,7 @@
                 />
               </div>
               <div class="exam-history-item-left-schedule-text">
-                {{ item.points }}分 / 满分10分
+                {{ item.earnedpoints }}分 / 满分10分
               </div>
             </div>
           </div>

+ 55 - 15
src/views/home/person/user-manual.vue

@@ -3,7 +3,7 @@
     <van-nav-bar title="学习积分" left-arrow @click-left="onClickLeft" />
     <div class="user-manual-div">
       <div class="user-manual-grades-div">
-        <div class="user-manual-grades">{{ userTotalPonits }}</div>
+        <div class="user-manual-grades">{{ this.user.userInfo.points }}</div>
         <div class="user-manual-description" @click="clickLearnRule">
           积分说明
         </div>
@@ -67,7 +67,8 @@ export default {
           isFinish: false,
           getPoints: 2,
           totaPonits: 6,
-          rightButton: "去答题"
+          rightButton: "去答题",
+          router: ""
         },
         {
           name: "今日必读",
@@ -75,23 +76,26 @@ export default {
           isFinish: false,
           getPoints: 0,
           totaPonits: 6,
-          rightButton: "去看看"
-        },
-        {
-          name: "每周必答",
-          rule: "2分/每发表一个有效观点",
-          isFinish: false,
-          getPoints: 0,
-          totaPonits: 6,
-          rightButton: "去答题"
+          rightButton: "去看看",
+          router: ""
         }
+        // ,
+        // {
+        //   name: "每周必答",
+        //   rule: "2分/每发表一个有效观点",
+        //   isFinish: false,
+        //   getPoints: 0,
+        //   totaPonits: 6,
+        //   rightButton: "去答题"
+        // }
       ],
-      userTotalPonits: 165, // 用户的总积分
-      todayEarnPoints: 6 // 今日已累计的积分
+      userTotalPonits: 0, // 用户的总积分
+      todayEarnPoints: 0 // 今日已累计的积分
     };
   },
   mounted() {
     this.getEvents();
+    this.getDailyPoints();
   },
   computed: {
     ...mapState({
@@ -108,7 +112,34 @@ export default {
         .get(this.$pathParams(this.$_API.JTXT_GET_EVENTS_USERNAME_DATE, path))
         .then(res => {
           console.log("--event--" + JSON.stringify(res));
-          this.todayPoints = res.data;
+        })
+        .catch(() => {
+          this.$store.commit("toggleLoading", false);
+        });
+    },
+    //   获取今日分数
+    getDailyPoints() {
+      let path = {
+        userName: this.user.userInfo.userName
+      };
+      this.$_http
+        .get(this.$pathParams(this.$_API.JTXT_GET_USER_DAIYL_POINTS, path))
+        .then(res => {
+          this.todayEarnPoints = res.data;
+        })
+        .catch(() => {
+          this.$store.commit("toggleLoading", false);
+        });
+    },
+    //   查询总积分
+    getAllPoints() {
+      let path = {
+        userName: this.user.userInfo.userName
+      };
+      this.$_http
+        .get(this.$pathParams(this.$_API.JTXT_GET_USER_ALL_POINTS, path))
+        .then(res => {
+          this.userTotalPonits = res.data;
         })
         .catch(() => {
           this.$store.commit("toggleLoading", false);
@@ -128,7 +159,16 @@ export default {
     },
     // 操作:点击了去看看、去学习、去训练
     toManualEarnFun(item) {
-      console.log(item);
+      console.log("item" + JSON.stringify(item));
+      if (item.name === "今日必答") {
+        this.$store.commit("updateAnswerItemStore", {
+          field: "answerRecruitId",
+          value: "daily-questions" // item.id
+        });
+        this.$router.push({ name: "answerRecruit" });
+      } else if (item.name === "今日必读") {
+        this.$router.back(-1);
+      }
     }
   }
 };