闫增涛
2024-11-06 4e236a15226b5341cebc480c4798069b9f90919a
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<template>
  <div class="table-fill">
    <div class="title-txt">
      <p v-html="tableData.stemTxt"></p>
      <span class="btn-box" @click="isShowAnswer = !isShowAnswer">
        <svg xmlns="http://www.w3.org/2000/svg" width="16.501" height="16.501" viewBox="0 0 20.501 20.501">
          <path class="a"
            d="M3344.717-15308.5H3337.4a10.186,10.186,0,0,1-7.25-3,10.185,10.185,0,0,1-3-7.25A10.262,10.262,0,0,1,3337.4-15329a10.26,10.26,0,0,1,10.249,10.248,10.129,10.129,0,0,1-2.2,6.341v3.177A.734.734,0,0,1,3344.717-15308.5Zm-9.606-7.29h4.493l.527,1.419c.071.182.156.386.254.608a2.428,2.428,0,0,0,.273.512.986.986,0,0,0,.315.262.971.971,0,0,0,.454.1,1.05,1.05,0,0,0,.773-.327,1.025,1.025,0,0,0,.319-.723,3.3,3.3,0,0,0-.277-1.051l-.062-.161-2.889-7.313c-.119-.321-.228-.607-.335-.873a2.972,2.972,0,0,0-.323-.616,1.56,1.56,0,0,0-.5-.469,1.552,1.552,0,0,0-.781-.181,1.535,1.535,0,0,0-.773.181,1.475,1.475,0,0,0-.5.477,3.674,3.674,0,0,0-.362.739l-.239.627-.054.135-2.824,7.355c-.095.229-.179.46-.25.688a1.529,1.529,0,0,0-.073.477.978.978,0,0,0,.323.72,1.039,1.039,0,0,0,.746.315.838.838,0,0,0,.716-.3,4.676,4.676,0,0,0,.466-.985l.062-.165.527-1.449Zm3.747-1.5h-3.293l1.812-5.124,1.481,5.123Z"
            transform="translate(-3327.144 15329)" />
        </svg>
      </span>
    </div>
    <table id="tables" align="center" border="1" cellpadding="10" cellspacing="0" class="w100 table-br-color"
      :style="{ borderColor:borderColor }">
      <tr v-for="(item, index) in tableData.showData">
        <td v-for="(citem, cindex) in item">
          <span v-if="citem" v-html="citem"></span>
          <input v-else type="text" class="table-input"
            :style="{ backgroundColor: inputBc }">
        </td>
      </tr>
    </table>
    <ul class="answer-box" v-if="isShowAnswer" :style="{borderColor:borderColor}" >
      <li>答案:</li>
      <li v-html="tableData.answer" >
      </li>
    </ul>
  </div>
</template>
 
<script>
export default {
  props: {
    queryData: {
      type: Object,
    },
    inputBc:{
      type:String,
      default:"#d3edfa"
    },
    borderColor:{
      type:String,
      default:"#00adee"
    },
  },
  data() {
    return {
      tableData: {},
      isShowAnswer: false
    };
  },
  created() {
    this.tableData = this.queryData
    console.log(1, this.tableData);
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      const tableDom = document.querySelector("#tables")
      console.log(2, tableDom);
 
    }
  }
};
</script>
 
<style lang="less" scoped>
.table-fill {
  user-select:none;
}
.title-txt {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  p {
    width: 100%;
    margin-bottom: 0;
  }
}
 
.table-input {
  width: 50px;
  outline: none;
  border: none;
}
 
// 显示答案按钮
.btn-box {
  margin-left: 5px;
  cursor: pointer;
  text-indent: 0;
  display: flex;
  align-items: center;
  border: 1px solid #00a1e9;
  height: 22px;
  width: 17px;
  padding: 2px 4px;
  background-color: #00a1e9;
  border-radius: 5px;
  margin-bottom:10px ;
  svg {
    fill: #fff;
  }
 
  &:hover {
    background-color: #fff;
 
    svg {
      fill: #00a1e9;
    }
  }
}
.answer-box {
  padding: 4px;
  border: 1px solid;
  display: flex;
}
td {
  text-align: center;
}
</style>