Blame view

src/views/basic/askTestQuestion/view.vue 3.06 KB
f45b3c05   LH_PC   云平台新UI界面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
  <template>
      <el-container class="default-body">
          <el-header>
              <back-box class="detailBack">
                  <template slot="title">
                      <span class="default-title">查看课件</span>
                  </template>
              </back-box>
          </el-header>
          <div class="default-filter">
              <div class="default-title">
                  {{ detail.title }}
              </div>
          </div>
          <el-main>
              <div class="question-box">
                  <template v-for="question in detail.questionList">
                      <template v-if="!question.subQuestions">
                          <div class="screenshot-box" v-if="question.screenshot">
                              <iframe @load="adjustIframe" class="screenshot" :src="question.screenshot"></iframe>
                          </div>
                      </template>
                      <template v-else>
                          <div v-for="subQuestions in question.subQuestions">
                              <div class="screenshot-box" v-if="subQuestions.screenshot">
                                  <iframe class="screenshot" :src="subQuestions.screenshot"></iframe>
                              </div>
                          </div>
                      </template>
                  </template>
              </div>
          </el-main>
      </el-container>
  </template>
  <script>
  export default {
      data() {
          return {
              query: null,
              detail: {}
          }
      },
      async created() {
          this.query = this.$route.query
          await this._loadQuestion();
      },
      mounted() {
          // this.$nextTick(() => {
          //     var screents = document.getElementsByClassName('screenshot');
          //     console.log(screents,screents.length)
          //     for (var isc = 0; isc < screents.length; isc++) {
          //         var currentIsc = screents[isc]
  
          //         console.log(currentIsc.scrollHeight, currentIsc.clientHeight);
          //         if (currentIsc.scrollHeight > currentIsc.clientHeight) {
          //             console.log(currentIsc.scrollHeight, currentIsc.clientHeight);
          //         }
          //     }
          // }); 
      },
      methods: {
          adjustIframe(){},
          async _loadQuestion() {
              this.$loading.open();
              const { data, status, info } = await this.$request.tPaperDetail({
                  paperId: this.query.id
              });
              this.$loading.close();
              if (status != 0) {
                  this.$message.error(info);
                  return;
              }
              this.detail = data;
          }
      }
  }
  </script>
  <style scoped>
  .default-filter {
      margin-bottom: 0px !important;
  
      .default-title {
          text-align: center;
          height: 80px;
          line-height: 80px;
      }
  }
  
  .question-box {
      margin-bottom: 20px;
      padding: 20px;
  
      .screenshot-box {
          width: 100%;
          border: 1px solid #e2e2e2;
          margin-bottom: 20px;
  
          .screenshot-img {
              margin: 0;
          }
  
          .screenshot {
              min-height: 40px;
          }
      }
  }
  </style>