SingleChooseRadical.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. <template>
  2. <div class="singleNovoice singleHasvoice singleChooseRadical">
  3. <div :key="item.con + index" class="Book_content" v-for="(item, index) in cur.stem">
  4. <Audio :mp3="item.mp3_url" :pinyin="item.pinyin"/>
  5. <div :class="['content-top','pic-box',uiType]">
  6. <span
  7. v-if="uiType == 'SINGLE_03'||uiType == 'SINGLE_04'||uiType == 'SINGLE_08'"
  8. >{{ cur.stem[0].con }}</span>
  9. <template v-else-if="uiType == 'SINGLE_10'">
  10. <Strockplay
  11. :Book_text="items"
  12. :key="items + index+indexs"
  13. :playStorkes="cur.playStorkes"
  14. :targetDiv="items + index+indexs"
  15. v-for="(items,indexs) in item.con"
  16. />
  17. </template>
  18. </div>
  19. <!-- <ul class="content-bottom single08" v-if="uiType === 'SINGLE_08'">
  20. <li
  21. :class="activeIndexArr.indexOf(index) > -1 ? 'active' : ''"
  22. :key="index"
  23. @click="handleClickArr(item.con, index)"
  24. v-for="(item, index) in cur.option"
  25. >{{ item.con }}</li>
  26. </ul>-->
  27. <ul :class="['content-bottom single10',cur.optionPlace&&cur.optionPlace=='true'?'optionVertical':'']" v-if="uiType === 'SINGLE_10'">
  28. <!-- 字符不限长度 -->
  29. <li
  30. :class="[activeIndex === index ? 'active' : '','option'+cur.option.length,activeIndex === index && isJudgeOption ?userResultJudge:'']"
  31. :key="index"
  32. @click="handleClick(item.con, index)"
  33. v-for="(item, index) in cur.option"
  34. >{{ item.con }}</li>
  35. </ul>
  36. <ul class="content-bottom" v-if="uiType === 'SINGLE_03'||uiType==='SINGLE_08'">
  37. <!-- 图片 -->
  38. <li
  39. :class="[activeIndex === index ? 'structure active' : 'structure',activeIndex === index && isJudgeOption ?userResultJudge:'']"
  40. :key="index"
  41. @click="handleClick(item.con, index)"
  42. v-for="(item, index) in cur.option"
  43. >
  44. <img :src="item.img_url" class="img_url" v-if="item.img_url">
  45. </li>
  46. </ul>
  47. <ul :class="['content-bottom single04',cur.optionPlace&&cur.optionPlace=='true'?'optionVertical':'']" v-if="uiType === 'SINGLE_04'">
  48. <!-- 笔顺 -->
  49. <li
  50. :class="[activeIndex === index ? 'active' : '',activeIndex === index && isJudgeOption ?userResultJudge:'']"
  51. :key="index"
  52. @click="handleClick(item, index)"
  53. v-for="(item, index) in cur.upsetOption"
  54. >
  55. <b :key="indexs" v-for="(items, indexs) in item">{{ items.shape }}</b>
  56. </li>
  57. </ul>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import Audio from "../../components/common/Audio";
  63. import Strockplay from "../common/Strockplay";
  64. export default {
  65. name: "singleChooseRadical",
  66. props: ["cur", "getAnswer", "queIndex", "answer", "uiType", "watchIndex","TaskModel"],
  67. data () {
  68. return {
  69. userAnswer: [],
  70. activeIndex: null,
  71. optionArr: [],
  72. arrlength: 3,
  73. activeIndexArr: [], // 多个选项存数组
  74. userResultJudge:'',
  75. isJudgeOption:false,// 是否为最后选择的选项
  76. };
  77. },
  78. components: {
  79. Audio,
  80. Strockplay
  81. },
  82. created () {
  83. this.handleActive();
  84. if (this.cur.Bookanswer) {
  85. this.activeIndexArr = this.cur.Bookanswer;
  86. } else {
  87. this.activeIndexArr = [];
  88. }
  89. },
  90. watch: {
  91. watchIndex: {
  92. handler: function (val, oldVal) {
  93. let _this = this;
  94. if (val) {
  95. this.handleActive();
  96. if (this.cur.Bookanswer) {
  97. this.activeIndexArr = this.cur.Bookanswer;
  98. } else {
  99. this.activeIndexArr = [];
  100. }
  101. }
  102. },
  103. // 深度观察监听
  104. deep: true,
  105. },
  106. },
  107. mounted () { },
  108. methods: {
  109. handleClick (obj, index) {
  110. this.isJudgeOption = false
  111. this.activeIndex = index;
  112. this.userAnswer = [];
  113. this.userAnswer.push(obj);
  114. this.getAnswer(this.userAnswer, this.queIndex);
  115. this.cur.Bookanswer = this.userAnswer;
  116. },
  117. // 高亮初始值
  118. handleActive () {
  119. if (this.cur.Bookanswer) {
  120. this.cur.Bookanswer.forEach((item, index) => {
  121. if (this.uiType !== "SINGLE_04") {
  122. this.cur.option.forEach((items, indexs) => {
  123. if (item === items.con) {
  124. this.activeIndex = indexs;
  125. return false;
  126. }
  127. });
  128. } else {
  129. this.cur.upsetOption.forEach((items, indexs) => {
  130. if (item === items) {
  131. this.activeIndex = indexs;
  132. return false;
  133. }
  134. });
  135. }
  136. });
  137. if(this.TaskModel=="PRACTICE") this.practiceJudge()
  138. } else {
  139. this.activeIndex = null;
  140. }
  141. },
  142. // 判断对错
  143. practiceJudge () {
  144. this.isJudgeOption = true
  145. if(this.cur.Bookanswer){
  146. if (this.uiType == "SINGLE_04") {
  147. if(this.cur.stem[0].stroke_text&&JSON.stringify(this.cur.Bookanswer[0])==JSON.stringify(this.cur.stem[0].stroke_text)){
  148. this.userResultJudge = 'userRight'
  149. return true
  150. }else if(!this.cur.stem[0].stroke_text){
  151. this.userResultJudge = ''
  152. return true
  153. }else{
  154. this.userResultJudge = 'userError'
  155. return false
  156. }
  157. }else if(this.uiType == "SINGLE_03"||this.uiType=='SINGLE_08'||this.uiType == 'SINGLE_10'){
  158. if(this.cur.correct[0]&&this.cur.Bookanswer[0]==this.cur.correct[0]){
  159. this.userResultJudge = 'userRight'
  160. return true
  161. }else if(!this.cur.correct[0]){
  162. this.userResultJudge = ''
  163. return true
  164. }else{
  165. this.userResultJudge = 'userError'
  166. return false
  167. }
  168. }
  169. }else{
  170. return false
  171. }
  172. }
  173. },
  174. };
  175. </script>
  176. <style lang="scss" scoped>
  177. .Book_content{
  178. width:100%;
  179. }
  180. .singleHasvoice {
  181. width: 100%;
  182. text-align: center;
  183. padding-top: 52px !important;
  184. li {
  185. background: #ffffff;
  186. line-height: 112px; // 和拼音的行高不一样
  187. font-family: FZJCGFKTK;
  188. }
  189. }
  190. .pic-box {
  191. position: relative;
  192. img {
  193. position: absolute;
  194. width: 444px;
  195. height: 444px;
  196. top: 0;
  197. left: 0;
  198. margin: 0;
  199. }
  200. }
  201. .SINGLE_03,
  202. .SINGLE_04,
  203. .SINGLE_08 {
  204. margin-top: 24px !important;
  205. }
  206. .single {
  207. .singleChooseRadical {
  208. .content-top {
  209. span {
  210. font-size: 360px;
  211. line-height: 392px;
  212. font-family: FZJCGFKTK;
  213. color: #404040;
  214. padding: 37px 0 11px 0;
  215. display: block;
  216. }
  217. &.SINGLE_10 {
  218. width: 100%;
  219. background: none;
  220. box-shadow: none;
  221. display: flex;
  222. justify-content: center;
  223. .strockplayInner {
  224. width: 444px;
  225. height: 444px;
  226. border-radius: 24px;
  227. box-shadow: 0px 6px 0px rgba(239, 167, 28, 0.4);
  228. margin: 0;
  229. }
  230. }
  231. }
  232. .content-bottom {
  233. height: 264px;
  234. overflow: auto;
  235. li {
  236. background: #ffffff !important;
  237. line-height: 112px !important;
  238. width: 406px;
  239. font-family: iconFont !important;
  240. }
  241. li.active {
  242. background: #fff3d5 !important;
  243. }
  244. .structure {
  245. width: 300px;
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. padding: 0;
  250. img {
  251. height: 84px;
  252. }
  253. }
  254. li.structure.userRight{
  255. background: #31D486 !important;
  256. color: #FFFFFF !important;
  257. }
  258. li.structure.userError{
  259. background: #FF6666 !important;
  260. color: #FFFFFF !important;
  261. }
  262. }
  263. .single04 {
  264. padding-left: 0;
  265. li {
  266. min-height: 120px;
  267. height: auto !important;
  268. width: 408px;
  269. font-size: 48px;
  270. line-height: 1.5 !important;
  271. padding: 24px 36px;
  272. }
  273. li.userRight{
  274. background: #31D486 !important;
  275. color: #FFFFFF !important;
  276. }
  277. li.userError{
  278. background: #FF6666 !important;
  279. color: #FFFFFF !important;
  280. }
  281. &.optionVertical{
  282. display: block;
  283. width: 1200px;
  284. height: auto;
  285. margin: 0 auto;
  286. li{
  287. width: 920px;
  288. margin-left: auto;
  289. margin-right: auto;
  290. }
  291. }
  292. }
  293. .single08 {
  294. li {
  295. width: 211px !important;
  296. }
  297. }
  298. .single10 {
  299. align-items: stretch;
  300. height: auto;
  301. margin: 12px auto;
  302. li {
  303. width: 408px;
  304. padding: 0 50px;
  305. display: flex;
  306. align-items: center;
  307. justify-content: center;
  308. &.option2 {
  309. width: 624px;
  310. }
  311. &.option4 {
  312. width: 300px;
  313. }
  314. &.active.userRight{
  315. background: #31D486 !important;
  316. color: #FFFFFF !important;
  317. }
  318. &.active.userError{
  319. background: #FF6666 !important;
  320. color: #FFFFFF !important;
  321. }
  322. }
  323. &.optionVertical{
  324. display: block;
  325. width: 1200px;
  326. height: auto;
  327. margin: 0 auto;
  328. li{
  329. width: 920px;
  330. margin-left: auto;
  331. margin-right: auto;
  332. }
  333. }
  334. }
  335. }
  336. }
  337. .questionMiddle {
  338. .singleHasvoice {
  339. width: 100%;
  340. text-align: center;
  341. padding-top: 28px !important;
  342. li {
  343. background: #ffffff;
  344. line-height: 74px; // 和拼音的行高不一样
  345. font-family: FZJCGFKTK;
  346. }
  347. }
  348. .pic-box {
  349. position: relative;
  350. img {
  351. position: absolute;
  352. width: 296px;
  353. height: 296px;
  354. top: 0;
  355. left: 0;
  356. margin: 0;
  357. }
  358. }
  359. .SINGLE_03,
  360. .SINGLE_04,
  361. .SINGLE_08 {
  362. margin-top: 16px !important;
  363. }
  364. .single {
  365. .singleChooseRadical {
  366. .content-top {
  367. span {
  368. font-size: 240px;
  369. line-height: 260px;
  370. padding: 24px 0 8px 0;
  371. }
  372. &.SINGLE_10 {
  373. .strockplayInner {
  374. width: 296px;
  375. height: 296px;
  376. border-radius: 16px;
  377. box-shadow: 0px 4px 0px rgba(239, 167, 28, 0.4);
  378. margin: 0;
  379. }
  380. }
  381. }
  382. .content-bottom {
  383. height: 176px;
  384. overflow: auto;
  385. li {
  386. background: #ffffff !important;
  387. line-height: 74px !important;
  388. width: 272px;
  389. font-family: iconFont !important;
  390. }
  391. li.active {
  392. background: #fff3d5 !important;
  393. }
  394. .structure {
  395. width: 200px;
  396. padding: 0;
  397. img {
  398. height: 56px;
  399. }
  400. }
  401. li.structure.userRight{
  402. background: #31D486 !important;
  403. color: #FFFFFF !important;
  404. }
  405. li.structure.userError{
  406. background: #FF6666 !important;
  407. color: #FFFFFF !important;
  408. }
  409. }
  410. .single04 {
  411. padding-left: 0;
  412. li {
  413. min-height: 80px;
  414. height: auto !important;
  415. width: 272px;
  416. font-size: 32px;
  417. line-height: 1.5 !important;
  418. padding: 16px 24px;
  419. }
  420. li.userRight{
  421. background: #31D486 !important;
  422. color: #FFFFFF !important;
  423. }
  424. li.userError{
  425. background: #FF6666 !important;
  426. color: #FFFFFF !important;
  427. }
  428. &.optionVertical{
  429. width: 800px;
  430. height: auto;
  431. li{
  432. width: 700px;
  433. }
  434. }
  435. }
  436. .single08 {
  437. li {
  438. width: 140px !important;
  439. }
  440. }
  441. .single10 {
  442. align-items: stretch;
  443. height: auto;
  444. margin: 12px auto;
  445. li {
  446. width: 272px;
  447. padding: 0 33px;
  448. &.option2 {
  449. width: 416px;
  450. }
  451. &.option4 {
  452. width: 200px;
  453. }
  454. &.active.userRight{
  455. background: #31D486 !important;
  456. color: #FFFFFF !important;
  457. }
  458. &.active.userError{
  459. background: #FF6666 !important;
  460. color: #FFFFFF !important;
  461. }
  462. }
  463. &.optionVertical{
  464. width: 800px;
  465. height: auto;
  466. li{
  467. width: 700px;
  468. }
  469. }
  470. }
  471. }
  472. }
  473. }
  474. .questionSmall {
  475. .singleHasvoice {
  476. padding-top: 16px !important;
  477. li {
  478. line-height: 56px; // 和拼音的行高不一样
  479. }
  480. }
  481. .pic-box {
  482. img {
  483. width: 222px;
  484. height: 222px;
  485. }
  486. }
  487. .SINGLE_03,
  488. .SINGLE_04,
  489. .SINGLE_08 {
  490. margin-top: 12px !important;
  491. }
  492. .single {
  493. .singleChooseRadical {
  494. .content-top {
  495. span {
  496. font-size: 180px;
  497. line-height: 196px;
  498. padding: 18px 0 6px 0;
  499. }
  500. &.SINGLE_10 {
  501. .strockplayInner {
  502. width: 222px;
  503. height: 222px;
  504. border-radius: 12px;
  505. box-shadow: 0px 3px 0px rgba(239, 167, 28, 0.4);
  506. }
  507. }
  508. }
  509. .content-bottom {
  510. height: 132px;
  511. li {
  512. background: #ffffff !important;
  513. line-height: 56px !important;
  514. width: 203px;
  515. font-family: iconFont !important;
  516. }
  517. li.active {
  518. background: #fff3d5 !important;
  519. }
  520. .structure {
  521. width: 150px;
  522. img {
  523. height: 42px;
  524. }
  525. }
  526. li.structure.userRight{
  527. background: #31D486 !important;
  528. color: #FFFFFF !important;
  529. }
  530. li.structure.userError{
  531. background: #FF6666 !important;
  532. color: #FFFFFF !important;
  533. }
  534. }
  535. .single04 {
  536. li {
  537. min-height: 60px;
  538. height: auto !important;
  539. width: 204px;
  540. font-size: 24px;
  541. line-height: 1.5 !important;
  542. padding: 12px 18px;
  543. }
  544. li.userRight{
  545. background: #31D486 !important;
  546. color: #FFFFFF !important;
  547. }
  548. li.userError{
  549. background: #FF6666 !important;
  550. color: #FFFFFF !important;
  551. }
  552. &.optionVertical{
  553. width: 600px;
  554. height: auto;
  555. li{
  556. width: 460px;
  557. }
  558. }
  559. }
  560. .single08 {
  561. li {
  562. width: 105px !important;
  563. }
  564. }
  565. .single10 {
  566. align-items: stretch;
  567. height: auto;
  568. margin: 12px auto;
  569. li {
  570. width: 204px;
  571. padding: 0 25px;
  572. &.option2 {
  573. width: 312px;
  574. }
  575. &.option4 {
  576. width: 150px;
  577. }
  578. &.active.userRight{
  579. background: #31D486 !important;
  580. color: #FFFFFF !important;
  581. }
  582. &.active.userError{
  583. background: #FF6666 !important;
  584. color: #FFFFFF !important;
  585. }
  586. }
  587. &.optionVertical{
  588. width: 600px;
  589. height: auto;
  590. li{
  591. width: 460px;
  592. }
  593. }
  594. }
  595. }
  596. }
  597. }
  598. </style>