Tang 3 years ago
parent
commit
de8de3c599
1 changed files with 61 additions and 19 deletions
  1. 61 19
      src/pages/person-center/my-bank/bank-detail/index.vue

+ 61 - 19
src/pages/person-center/my-bank/bank-detail/index.vue

@@ -8,7 +8,6 @@
               <div class="goods-menu">
                 <div class="goods-menu__header">
                   <div class="title">{{ goodsDetail.goodsName }}</div>
-                  <span class="question-num">已做/总数</span>
                   <span class="question-do"></span>
                 </div>
                 <div class="goods-menu__body">
@@ -56,14 +55,22 @@
                                 <div class="bank-section__item__text">
                                   {{ section.examName }}
                                 </div>
-                                <el-button
-                                  type="text"
-                                  class="btn"
-                                  style="width: auto"
-                                  >{{ section.questionNum || 0 }}/{{
-                                    section.totalQuestionNum || 0
-                                  }}</el-button
-                                >
+                                <div class="btn_div">
+                                  正确率
+                                  <span style="color: rgb(52, 216, 71)"
+                                    >{{
+                                      computedNums(
+                                        section.questionNum,
+                                        section.totalQuestionNum
+                                      )
+                                    }}%</span
+                                  ><span style="margin-left: 6px">已完成 </span
+                                  ><span style="color: blue">{{
+                                    section.questionNum || 0
+                                  }}</span>
+                                  /
+                                  {{ section.totalQuestionNum || 0 }}
+                                </div>
                                 <el-button
                                   v-if="section.recordStatus == -1"
                                   type="primary"
@@ -149,12 +156,22 @@
                                   {{ section.examName }}
                                 </div>
                                 <el-button
-                                  type="text"
+                                  style="width: auto; padding: 0px 14px"
                                   class="btn"
-                                  style="width: auto"
-                                  >{{ section.questionNum || 0 }}/{{
-                                    section.totalQuestionNum || 0
-                                  }}</el-button
+                                  >正确率
+                                  <span style="color: rgb(52, 216, 71)"
+                                    >{{
+                                      computedNums(
+                                        section.questionNum,
+                                        section.totalQuestionNum
+                                      )
+                                    }}%</span
+                                  ><span style="margin-left: 6px">已完成 </span
+                                  ><span style="color: blue">{{
+                                    section.questionNum || 0
+                                  }}</span>
+                                  /
+                                  {{ section.totalQuestionNum || 0 }}</el-button
                                 >
                                 <el-button
                                   v-if="section.recordStatus == -1"
@@ -204,12 +221,21 @@
                               {{ item.name }}
                             </div>
                             <el-button
-                              type="text"
+                              style="width: auto; padding: 0px 14px"
                               class="btn"
-                              style="width: auto"
-                              >{{ section.questionNum || 0 }}/{{
-                                section.totalQuestionNum || 0
-                              }}</el-button
+                              >正确率
+                              <span style="color: rgb(52, 216, 71)"
+                                >{{
+                                  computedNums(
+                                    item.questionNum,
+                                    item.totalQuestionNum
+                                  )
+                                }}%</span
+                              ><span style="margin-left: 6px">已完成 </span
+                              ><span style="color: blue">{{
+                                item.questionNum || 0
+                              }}</span>
+                              / {{ item.totalQuestionNum || 0 }}</el-button
                             >
                             <el-button
                               v-if="item.recordStatus == -1"
@@ -664,6 +690,15 @@ export default {
         return ary;
       };
     },
+    computedNums: function () {
+      return function (doNum, totalNum) {
+        let ary = 0;
+        if (doNum && totalNum) {
+          ary = parseInt(doNum) / parseInt(totalNum);
+        }
+        return ary.toFixed(0);
+      };
+    },
   },
   methods: {
     /**
@@ -1062,6 +1097,13 @@ export default {
 
 <!-- Add "scoped" attribute to limit CSS to this component only -->
 <style scoped lang="scss">
+.btn_div {
+  color: #666666;
+  margin-right: 10px;
+  padding: 0px 14px;
+  height: 32px;
+  line-height: 32px;
+}
 .bank-detail {
   .section {
     &__header {