Blame view

src/views/analysis/page/components/aswdetail.vue 1.48 KB
a61d16e2   jack   1.更新文件
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
  <template>
    <div class="aswdbox">
      <div v-for="(item,index) in data" :key="index" class="aswlist">
        <div class="bl">
          <p>{{ item.num }}</p>
          <p>({{ (item.num*100/item.total).toFixed(2) }}%)</p>
        </div>
        <div class="bar">
          <div class="barbg" />
          <div v-if="item.right!=-1" class="colorbar" :class="item.right==1?'green':'red'" :style="'height:'+(item.num*100/item.total).toFixed(2)+'%'" />
          <div v-else class="colorbar gary" :style="'height:'+(item.num*100/item.total).toFixed(2)+'%'" />
        </div>
        <div class="asw">
          <p>{{ item.answer }}</p>
        </div>
      </div>
    </div>
  
  </template>
  <script>
  export default {
    name: 'Aswdetail',
    props: {
      data: {
        type: Array,
        default: () => {
          return []
        }
      }
    },
    data() {
      return {
        contnet: ''
      }
    }
  }
  </script>
  <style scoped>
  
  .aswlist{
      float:left;
      width:100px;
  }
  .bl{
      text-align: center;
  }
  .bl p{
      margin:0;
  }
  .asw{
      text-align: center
  }
  .asw p{
      word-wrap: break-word;
  }
  .bar{
      width:100px;
      height:200px;
      position: relative;
      border-bottom:1px solid #ccc;
  }
  .barbg{
      width:20px;
      height:100%;
      margin: 0 auto;
      background: #ccc;
      border-radius:10px 10px 0 0;
  }
  .colorbar{
      width:20px;
      height:100px;
      border-radius: 10px 10px 0 0;
      position: absolute;
      left:40px;
      bottom:0;
  }
  .red{
      background: #f00;
  }
  .green{
      background: #0f0;
  }
  .gary{
      background: #888;
  }
  </style>