Li-ExamWidght.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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(
  151. `https://test.jue-ming.com:8849/api/show?filePath=./webo/scaleImages/${item.imgUrl}`
  152. )
  153. })
  154. return imgArr;
  155. },
  156. },
  157. };
  158. </script>
  159. <style scoped>
  160. .exam-list-content-img {
  161. width: 60rpx;
  162. height: 60rpx;
  163. }
  164. .exam-list-row {
  165. /* padding-top: 10px; */
  166. }
  167. .exam-list-content {
  168. /* padding-top: 30px; */
  169. }
  170. .checked_ {
  171. display: flex;
  172. align-items: center;
  173. background: #E3FDFF;
  174. border-radius: 10px 10px 10px 10px;
  175. opacity: 1;
  176. margin-bottom: 18px;
  177. min-height: 40px;
  178. }
  179. .checked_user {
  180. background: #00D8E7;
  181. color: #ffffff;
  182. border-radius: 10px 10px 10px 10px;
  183. opacity: 1;
  184. margin-bottom: 18px;
  185. /* color: #3fb4c9;
  186. padding: 15px 0;
  187. padding-left: 20px;
  188. background-color: #d4f3f8;
  189. border-radius: 50px;
  190. margin-bottom: 10px;
  191. font-weight: bold; */
  192. min-height: 40px;
  193. }
  194. .exam-list-button {
  195. display: flex;
  196. flex-direction: row;
  197. justify-content: space-around;
  198. margin-top: 40px;
  199. }
  200. .ans_input {
  201. width: 80%;
  202. height: 36px;
  203. line-height: 36px;
  204. border: 1px solid #ddd;
  205. border-radius: 5px;
  206. padding-left: 5px;
  207. }
  208. .TitleFontWeight {
  209. padding-left: 10px;
  210. padding-right: 10px;
  211. font-size: 18px;
  212. font-family: Source Han Sans-Regular, Source Han Sans;
  213. font-weight: 400;
  214. color: #040000;
  215. line-height: 26px;
  216. background-color: #ffffff;
  217. padding-top: 10px;
  218. padding: 20rpx 40rpx 0 40rpx;
  219. }
  220. .answer_button {
  221. flex: 1;
  222. background-color: #03A2AD;
  223. color: #ffffff;
  224. font-size: 16px;
  225. margin: 0 20rpx;
  226. }
  227. .question_circle {
  228. width: 28rpx;
  229. height: 28rpx;
  230. border-radius: 50%;
  231. border: 2px solid #03A2AD;
  232. background: #ffffff;
  233. margin: 0 28rpx;
  234. }
  235. .question_select {
  236. background-color: #ffffff;
  237. padding-left: 10px;
  238. padding-right: 10px;
  239. padding: 60rpx 40rpx 80rpx 40rpx;
  240. }
  241. .question_txt {
  242. box-sizing: border-box;
  243. padding: 10rpx 10rpx 10rpx 0;
  244. flex: 1;
  245. line-height: 1.8;
  246. letter-spacing: 2px;
  247. }
  248. .picker-view {
  249. width: 100%;
  250. height: 500rpx;
  251. margin-top: 20rpx;
  252. }
  253. .item {
  254. line-height: 100rpx;
  255. text-align: center;
  256. }
  257. .image_wrap {
  258. width: 100%;
  259. display: flex;
  260. justify-content: space-around;
  261. background: #ffffff;
  262. padding-top: 20rpx;
  263. }
  264. </style>