Li-ExamWidght.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view class="exam-list-row">
  3. <view class="">
  4. <!-- <view class="TitleFontWeight" style="min-height: 20px">
  5. {{ currentIndex + 1 }}:{{ QuestionList.answer }}
  6. </view> -->
  7. <view class="TitleFontWeight">
  8. {{ QuestionList.answer }}
  9. </view>
  10. <view class="exam-list-content fontSize16">
  11. <!-- <scroll-view> -->
  12. <view v-if="QuestionList.questionType == 0">
  13. <view class='question_select'>
  14. <view v-for="(item, i) in QuestionList.QuestionOptionList" :key="i" class="disRowAroundStart"
  15. :class="
  16. QuestionList.fldAnswer == item.fldOptionText
  17. ? 'checked_user'
  18. : 'checked_'
  19. " @click.stop="onListItem(item)">
  20. <view style='display: flex;align-items: center;'>
  21. <view class='question_circle'>
  22. </view>
  23. <view class="question_txt"
  24. :style="{color:QuestionList.fldAnswer == item.fldOptionText?'#ffffff':'#656C74'}">
  25. {{ item.fldOptionText }}
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="question_select" v-if="QuestionList.questionType == 2"><input class="ans_input"
  32. @input="onKeyInput" placeholder="请输入答案" /></view>
  33. <view class="question_select" v-if="QuestionList.questionType == 5">
  34. <picker-view :indicator-style="indicatorStyle" :value="selectVal" @change="bindChange"
  35. class="picker-view">
  36. <picker-view-column>
  37. <view class="item" v-for="(item,index) in selectArr" :key="index">{{item.name}}</view>
  38. </picker-view-column>
  39. </picker-view>
  40. </view>
  41. <view v-if="QuestionList.questionType == 8">
  42. <view class="image_wrap">
  43. <image style="width: 46%;" v-for="(item,index) in getAnswerImg(QuestionList.questionParam)"
  44. :src="item" :key="index" alt="" mode="widthFix"></image>
  45. </view>
  46. <view class='question_select'>
  47. <view v-for="(item, i) in QuestionList.QuestionOptionList" :key="i" class="disRowAroundStart"
  48. :class="
  49. QuestionList.fldAnswer == item.fldOptionText
  50. ? 'checked_user'
  51. : 'checked_'
  52. " @click.stop="onListItem(item)">
  53. <view style='display: flex;align-items: center;'>
  54. <view class='question_circle'>
  55. </view>
  56. <view class="question_txt"
  57. :style="{color:QuestionList.fldAnswer == item.fldOptionText?'#ffffff':'#656C74'}">
  58. {{ item.fldOptionText }}
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="exam-list-button">
  65. <button v-if="currentIndex > 0" @click="goPrev" class="answer_button">
  66. 上一题
  67. </button>
  68. <button v-if="currentIndex < total - 1 && QuestionList.questionType == 5" @click="goNext"
  69. class="answer_button">
  70. 下一题
  71. </button>
  72. <button v-if="currentIndex + 1 == total" @click="subMit" class="answer_button">
  73. 提交
  74. </button>
  75. </view>
  76. </view>
  77. </view>
  78. <!-- 按钮区域 -->
  79. </view>
  80. </template>
  81. <script>
  82. export default {
  83. name: "Li-ExamWidght",
  84. props: ["QuestionList", "total", "currentIndex"],
  85. data() {
  86. return {
  87. checked_user: '',
  88. checked_: '',
  89. // checked_user: this.$imageUrl.urls.checked_user,
  90. // checked_: this.$imageUrl.urls.checked_,
  91. isShowBtn: true,
  92. blankAnswer: "",
  93. indicatorStyle: `height: 50px;`,
  94. selectVal: [0],
  95. };
  96. },
  97. computed: {
  98. selectArr() {
  99. let arr = [];
  100. if (this.QuestionList.questionType == 5) {
  101. arr = JSON.parse(this.QuestionList.questionParam)
  102. }
  103. return arr;
  104. }
  105. },
  106. mounted() {
  107. this.isShowBtn = true;
  108. },
  109. methods: {
  110. goPrev() {
  111. this.$emit("goPrevAnswer");
  112. },
  113. goNext() {
  114. if (this.QuestionList.questionType == '5') {
  115. this.$emit("goNextAnswer", this.selectVal[0]);
  116. this.selectVal = [0];
  117. } else {
  118. this.$emit("goNextAnswer", this.blankAnswer);
  119. this.this.blankAnswer = "";
  120. }
  121. },
  122. onItem(item) {
  123. this.$emit("onItemAnswer", item);
  124. },
  125. onListItem(item) {
  126. this.$emit("onListItemAnswer", item);
  127. },
  128. subMit() {
  129. console.log("=1=====>", this.isShowBtn);
  130. // if(!this.isShowBtn) return;
  131. // this.isShowBtn=false;
  132. this.$emit("subMitList");
  133. console.log("=2=====>", this.isShowBtn);
  134. // setTimeout(()=>{
  135. // this.isShowBtn=true;
  136. // },2000)
  137. },
  138. // 填空输入
  139. onKeyInput: function(event) {
  140. this.blankAnswer = event.target.value;
  141. },
  142. bindChange(e) {
  143. this.selectVal = e.detail.value;
  144. },
  145. // 对应返回备选答案图片地址
  146. getAnswerImg(param) {
  147. param = JSON.parse(param);
  148. let imgArr = [];
  149. param.forEach(item => {
  150. imgArr.push(`/static/scaleImages/${item.imgUrl}`)
  151. })
  152. return imgArr;
  153. },
  154. },
  155. };
  156. </script>
  157. <style scoped>
  158. .exam-list-content-img {
  159. width: 60rpx;
  160. height: 60rpx;
  161. }
  162. .exam-list-row {
  163. /* padding-top: 10px; */
  164. }
  165. .exam-list-content {
  166. /* padding-top: 30px; */
  167. }
  168. .checked_ {
  169. display: flex;
  170. align-items: center;
  171. background: #E3FDFF;
  172. border-radius: 10px 10px 10px 10px;
  173. opacity: 1;
  174. margin-bottom: 18px;
  175. min-height: 40px;
  176. }
  177. .checked_user {
  178. background: #00D8E7;
  179. color: #ffffff;
  180. border-radius: 10px 10px 10px 10px;
  181. opacity: 1;
  182. margin-bottom: 18px;
  183. /* color: #3fb4c9;
  184. padding: 15px 0;
  185. padding-left: 20px;
  186. background-color: #d4f3f8;
  187. border-radius: 50px;
  188. margin-bottom: 10px;
  189. font-weight: bold; */
  190. min-height: 40px;
  191. }
  192. .exam-list-button {
  193. display: flex;
  194. flex-direction: row;
  195. justify-content: space-around;
  196. margin-top: 40px;
  197. }
  198. .ans_input {
  199. width: 80%;
  200. height: 36px;
  201. line-height: 36px;
  202. border: 1px solid #ddd;
  203. border-radius: 5px;
  204. padding-left: 5px;
  205. }
  206. .TitleFontWeight {
  207. padding-left: 10px;
  208. padding-right: 10px;
  209. font-size: 18px;
  210. font-family: Source Han Sans-Regular, Source Han Sans;
  211. font-weight: 400;
  212. color: #040000;
  213. line-height: 26px;
  214. background-color: #ffffff;
  215. padding-top: 10px;
  216. padding: 20rpx 40rpx 0 40rpx;
  217. }
  218. .answer_button {
  219. flex: 1;
  220. background-color: #03A2AD;
  221. color: #ffffff;
  222. font-size: 16px;
  223. margin: 0 20rpx;
  224. }
  225. .question_circle {
  226. width: 28rpx;
  227. height: 28rpx;
  228. border-radius: 50%;
  229. border: 2px solid #03A2AD;
  230. background: #ffffff;
  231. margin: 0 28rpx;
  232. }
  233. .question_select {
  234. background-color: #ffffff;
  235. padding-left: 10px;
  236. padding-right: 10px;
  237. padding: 60rpx 40rpx 80rpx 40rpx;
  238. }
  239. .question_txt {
  240. box-sizing: border-box;
  241. padding: 10rpx 10rpx 10rpx 0;
  242. flex: 1;
  243. line-height: 1.8;
  244. letter-spacing: 2px;
  245. }
  246. .picker-view {
  247. width: 100%;
  248. height: 500rpx;
  249. margin-top: 20rpx;
  250. }
  251. .item {
  252. line-height: 100rpx;
  253. text-align: center;
  254. }
  255. .image_wrap {
  256. width: 100%;
  257. display: flex;
  258. justify-content: space-around;
  259. background: #ffffff;
  260. padding-top: 20rpx;
  261. }
  262. </style>