studyReportNew.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <template>
  2. <div class="m-containers">
  3. <img :src="imgList.topBanner" width="100%" class="topBanner" alt />
  4. <div class="paddingWrap">
  5. <div class="topCard">
  6. <img :src="imgList.note1" class="topNote" width="100%" alt />
  7. <p class="title">
  8. <img :src="imgList.squrt" class="squrts" alt />
  9. 授课内容
  10. </p>
  11. <div class="chioseList">
  12. <div class="theoryCell">
  13. <div class="left">
  14. <img :src="imgList.theoryIcon" class="theoryIcon" alt />
  15. 乐理
  16. </div>
  17. <div class="right">
  18. <div class="theoryItem" v-for="(item,index) in hasTheory" :key="index">
  19. <van-field
  20. readonly
  21. clickable
  22. :label="subjectName"
  23. placeholder="请选择乐理"
  24. :value="item.str"
  25. @click="item.show = true"
  26. />
  27. <van-popup v-model="item.show" position="bottom" :overlay="true" get-container="#app">
  28. <van-picker
  29. show-toolbar
  30. :columns="theoryList"
  31. @cancel="item.show = false"
  32. @confirm="(val)=>{ onConfirm(val,item)}"
  33. />
  34. </van-popup>
  35. <div class="iconWrap" v-if="index== 0" @click="addTheory(hasTheory)">
  36. <img :src="imgList.addIcon" class="smallIcon" alt />
  37. </div>
  38. <div class="iconWrap" v-else>
  39. <img
  40. :src="imgList.deteleIcon"
  41. class="smallIcon"
  42. alt
  43. @click="removeTheory(hasTheory,index)"
  44. />
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="musicCell">
  50. <div class="left">
  51. <img :src="imgList.muiscIcon" class="muiscIcon" alt />
  52. 曲子
  53. </div>
  54. <div class="right">
  55. <van-field v-model="testMusic" rows="1" autosize type="textarea" placeholder="请输入曲子" />
  56. </div>
  57. </div>
  58. <div class="theoryCell teachingCell">
  59. <div class="left">
  60. <img :src="imgList.bookIcon" class="bookIcon" alt />
  61. 教材
  62. </div>
  63. <div class="right">
  64. <div class="theoryItem" v-for="(item,index) in teaching" :key="index">
  65. <van-field
  66. readonly
  67. clickable
  68. :label="subjectName"
  69. placeholder="请选择教材"
  70. :value="item.str"
  71. @click="item.show = true"
  72. />
  73. <van-popup v-model="item.show" position="bottom" get-container="#app">
  74. <van-picker
  75. show-toolbar
  76. :columns="teachingList"
  77. @cancel="item.show = false"
  78. @confirm="(val)=>{ onTeacherConfirm(val,item)}"
  79. />
  80. </van-popup>
  81. <div class="iconWrap" v-if="index== 0" @click="addTheory(teaching)">
  82. <img :src="imgList.addIcon" class="smallIcon" alt />
  83. </div>
  84. <div class="iconWrap" v-else>
  85. <img
  86. :src="imgList.deteleIcon"
  87. class="smallIcon"
  88. alt
  89. @click="removeTheory(teaching,index)"
  90. />
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="nextCard">
  98. <img :src="imgList.note2" class="topNote" width="100%" alt />
  99. <p class="title">
  100. <img :src="imgList.squrt" class="squrts" alt />
  101. 必选项
  102. </p>
  103. <div class="chioseList">
  104. <p class="subTitle">1.{{subjectJson[1].title}}</p>
  105. <div class="cell" :class="one==1?'activce':''" @click="one=1">
  106. <img :src="imgList.excellent" class="icons" alt />
  107. {{subjectJson[1][1] }}
  108. </div>
  109. <div class="cell" :class="one==2?'activce':''" @click="one=2">
  110. <img :src="imgList.good" class="icons" alt />
  111. {{subjectJson[1][2] }}
  112. </div>
  113. <div class="cell" :class="one==3?'activce':''" @click="one=3">
  114. <img :src="imgList.normal" class="icons" alt />
  115. {{subjectJson[1][3] }}
  116. </div>
  117. </div>
  118. <img :src="imgList.line" alt width="100%" />
  119. <div class="chioseList">
  120. <p class="subTitles">2.{{subjectJson[2].title}}</p>
  121. <div class="cell" :class="two==1?'activce':''" @click="two=1">
  122. <img :src="imgList.excellent" class="icons" alt />
  123. {{subjectJson[2][1] }}
  124. </div>
  125. <div class="cell" :class="two==2?'activce':''" @click="two=2">
  126. <img :src="imgList.good" class="icons" alt />
  127. {{subjectJson[2][2] }}
  128. </div>
  129. <div class="cell" :class="two==3?'activce':''" @click="two=3">
  130. <img :src="imgList.normal" class="icons" alt />
  131. {{subjectJson[2][3] }}
  132. </div>
  133. </div>
  134. <img :src="imgList.line" alt width="100%" />
  135. <div class="chioseList">
  136. <p class="subTitles">3.{{subjectJson[3].title}}</p>
  137. <div class="cell" :class="three==1?'activce':''" @click="three=1">
  138. <img :src="imgList.excellent" class="icons" alt />
  139. {{subjectJson[3][1] }}
  140. </div>
  141. <div class="cell" :class="three==2?'activce':''" @click="three=2">
  142. <img :src="imgList.good" class="icons" alt />
  143. {{subjectJson[3][2] }}
  144. </div>
  145. <div class="cell" :class="three==3?'activce':''" @click="three=3">
  146. <img :src="imgList.normal" class="icons" alt />
  147. {{subjectJson[3][3] }}
  148. </div>
  149. </div>
  150. <img :src="imgList.line" alt width="100%" />
  151. <div class="chioseList">
  152. <p class="subTitles">4.{{subjectJson[4].title}}</p>
  153. <div class="cell" :class="four==1?'activce':''" @click="four=1">
  154. <img :src="imgList.excellent" class="icons" alt />
  155. {{subjectJson[4][1] }}
  156. </div>
  157. <div class="cell" :class="four==2?'activce':''" @click="four=2">
  158. <img :src="imgList.good" class="icons" alt />
  159. {{subjectJson[4][2] }}
  160. </div>
  161. <div class="cell" :class="four==3?'activce':''" @click="four=3">
  162. <img :src="imgList.normal" class="icons" alt />
  163. {{subjectJson[4][3] }}
  164. </div>
  165. </div>
  166. <img :src="imgList.line" alt width="100%" />
  167. <div class="chioseList">
  168. <p class="subTitles">5.{{subjectJson[5].title}}</p>
  169. <div class="cell" :class="five==1?'activce':''" @click="five=1">
  170. <img :src="imgList.excellent" class="icons" alt />
  171. {{subjectJson[5][1] }}
  172. </div>
  173. <div class="cell" :class="five==2?'activce':''" @click="five=2">
  174. <img :src="imgList.normal" class="icons" alt />
  175. {{subjectJson[5][2] }}
  176. </div>
  177. </div>
  178. </div>
  179. <div class="nextCard">
  180. <img :src="imgList.note2" class="topNote" width="100%" alt />
  181. <p class="title">
  182. <img :src="imgList.squrt" class="squrts" alt />
  183. 可选项
  184. </p>
  185. <div class="chioseList">
  186. <p class="subTitle">1.{{subjectJson[6].title}}</p>
  187. <div class="cell" :class="six==1?'activce':''" @click="six=1">
  188. <img :src="imgList.excellent" class="icons" alt />
  189. {{subjectJson[6][1] }}
  190. </div>
  191. <div class="cell" :class="six==2?'activce':''" @click="six=2">
  192. <img :src="imgList.normal" class="icons" alt />
  193. {{subjectJson[6][2] }}
  194. </div>
  195. </div>
  196. <img :src="imgList.line" alt width="100%" />
  197. <div class="chioseList">
  198. <p class="subTitles">2.{{subjectJson[7].title}}</p>
  199. <div class="cell" :class="seven==1?'activce':''" @click="seven=1">
  200. <img :src="imgList.excellent" class="icons" alt />
  201. {{subjectJson[7][1] }}
  202. </div>
  203. <div class="cell" :class="seven==2?'activce':''" @click="seven=2">
  204. <img :src="imgList.normal" class="icons" alt />
  205. {{subjectJson[7][2] }}
  206. </div>
  207. </div>
  208. <img :src="imgList.line" alt width="100%" />
  209. <div class="chioseList">
  210. <p class="subTitles">3.{{subjectJson[8].title}}</p>
  211. <div class="cell" :class="eight==1?'activce':''" @click="eight=1">
  212. <img :src="imgList.excellent" class="icons" alt />
  213. {{subjectJson[8][1] }}
  214. </div>
  215. <div class="cell" :class="eight==2?'activce':''" @click="eight=2">
  216. <img :src="imgList.good" class="icons" alt />
  217. {{subjectJson[8][2] }}
  218. </div>
  219. <div class="cell" :class="eight==3?'activce':''" @click="eight=3">
  220. <img :src="imgList.normal" class="icons" alt />
  221. {{subjectJson[8][3] }}
  222. </div>
  223. </div>
  224. </div>
  225. </div>
  226. <div class="submit" @click="submietInfo">
  227. <img :src="imgList.btn" width="100%" alt />
  228. </div>
  229. <div class="bottomBox"></div>
  230. </div>
  231. </template>
  232. <script>
  233. import { subjectJson } from "@/utils/questionJson";
  234. import { browser } from "@/common/common";
  235. import {findTeacherClassGroupInfo,addStudyReport1 } from "@/api/teacher"
  236. export default {
  237. data() {
  238. return {
  239. imgList: {
  240. topBanner: require("@/assets/images/start/topBanner.png"),
  241. note1: require("@/assets/images/start/note1.png"),
  242. note2: require("@/assets/images/start/note2.png"),
  243. squrt: require("@/assets/images/start/squrt.png"),
  244. theoryIcon: require("@/assets/images/start/theory-icon.png"),
  245. muiscIcon: require("@/assets/images/start/muisc-icon.png"),
  246. bookIcon: require("@/assets/images/start/book-icon.png"),
  247. addIcon: require("@/assets/images/start/add-icon.png"),
  248. deteleIcon: require("@/assets/images/start/detele-icon.png"),
  249. excellent: require("@/assets/images/start/excellent.png"),
  250. good: require("@/assets/images/start/good.png"),
  251. normal: require("@/assets/images/start/normal.png"),
  252. line: require("@/assets/images/start/line.png"),
  253. btn: require("@/assets/images/start/button.png")
  254. },
  255. theoryList: ["一级", "二级", "三级", "四级"],
  256. teachingList: [
  257. {
  258. values: ["一级", "二级", "三级", "四级"],
  259. defaultIndex: 2
  260. },
  261. {
  262. values: [],
  263. defaultIndex: 1
  264. }
  265. ],
  266. hasTheory: [{ str: "", show: false }],
  267. teaching: [{ str: "", show: false }],
  268. testMusic: "",
  269. showPicker: false,
  270. lessArr: [],
  271. subjectJson: subjectJson,
  272. one: "",
  273. two: "",
  274. three: "",
  275. four: "",
  276. five: "",
  277. six: "",
  278. seven: "",
  279. eight: "",
  280. subjectName:null,
  281. id:''
  282. };
  283. },
  284. created() {
  285. for (let i = 0; i < 17; i++) {
  286. this.teachingList[1].values.push(` lesson${i + 1} `);
  287. }
  288. this.classGroupId = this.$route.query.classGroupId;
  289. this.id = this.$route.query.id;
  290. this.token = localStorage.getItem("Authorization");
  291. // if (!this.token || !this.classGroupId) {
  292. // this.onAppBack();
  293. // return;
  294. // }
  295. findTeacherClassGroupInfo({ classGroupId: this.classGroupId }).then(res => {
  296. if (res.data.code == 200) {
  297. this.subjectName = res.data.data.subjectNames;
  298. }
  299. });
  300. },
  301. methods: {
  302. onConfirm(val, item) {
  303. item.str = val;
  304. item.show = false;
  305. },
  306. onTeacherConfirm(val, item) {
  307. item.str = val[0] + val[1];
  308. item.show = false;
  309. },
  310. addTheory(arr) {
  311. arr.push({ str: "", show: false });
  312. },
  313. removeTheory(arr, index) {
  314. arr.splice(index, 1);
  315. },
  316. submietInfo() {
  317. // console.log(this.one)
  318. // console.log(this.json.one[this.one])
  319. if (!this.one || !this.two || !this.three || !this.four || !this.five) {
  320. this.$toast("请认真选择必选项");
  321. return;
  322. }
  323. if (!this.hasTheory[0].str || !this.teaching[0].str) {
  324. this.$toast("必须选择乐理和教材");
  325. return;
  326. }
  327. if (!this.testMusic) {
  328. this.$toast("请输入练习曲目");
  329. return;
  330. }
  331. this.item = {
  332. one: this.one,
  333. two: this.two,
  334. three: this.three,
  335. four: this.four,
  336. five: this.five,
  337. six: this.six,
  338. seven: this.seven,
  339. eight: this.eight
  340. };
  341. let id = this.id || null;
  342. addStudyReport1({
  343. classGroupId: this.classGroupId,
  344. item: this.item,
  345. song: this.testMusic,
  346. musicTheory: this.hasTheory,
  347. teachingMaterial: this.teaching,
  348. version: 2,
  349. id
  350. }).then(res => {
  351. if (res.data.code == 200) {
  352. this.$toast("提交成功");
  353. setTimeout(() => {
  354. this.onAppBack()
  355. }, 2000);
  356. } else {
  357. this.$toast(res.data.msg);
  358. // setTimeout(() => {
  359. // // this.$router.push({
  360. // // path: "/studyReport",
  361. // // query: { classGroupId: this.classGroupId }
  362. // // });
  363. // }, 2000);
  364. }
  365. });
  366. },
  367. onAppBack() {
  368. if (browser().android) {
  369. DAYA.postMessage(JSON.stringify({ api: "back" }));
  370. } else if (browser().iPhone) {
  371. window.webkit.messageHandlers.DAYA.postMessage(
  372. JSON.stringify({ api: "back" })
  373. );
  374. }
  375. }
  376. }
  377. };
  378. </script>
  379. <style lang="less" scoped>
  380. div {
  381. box-sizing: border-box;
  382. }
  383. .m-containers {
  384. background: url("../../assets/images/start/bg.png") no-repeat;
  385. // background-size: 100% 100%;
  386. position: relative;
  387. width: 100%;
  388. min-height: 16.97rem;
  389. display: flex;
  390. flex-direction: column;
  391. align-items: center;
  392. background-color: #7ed2d3;
  393. padding-bottom: 0.2rem;
  394. z-index: 0;
  395. .topBanner {
  396. z-index: 2;
  397. }
  398. .paddingWrap {
  399. position: relative;
  400. z-index: 2;
  401. padding: 0 0.2rem 0.26rem;
  402. .topCard,
  403. .nextCard {
  404. position: relative;
  405. border-radius: 15px;
  406. top: -0.08rem;
  407. background-color: #fff;
  408. display: flex;
  409. flex-direction: column;
  410. justify-content: center;
  411. padding-bottom: 0.24rem;
  412. .topNote {
  413. z-index: 1;
  414. }
  415. .title {
  416. z-index: 5;
  417. position: absolute;
  418. top: 0.21rem;
  419. left: 0.15rem;
  420. display: flex;
  421. flex-direction: row;
  422. justify-content: flex-start;
  423. font-size: 0.18rem;
  424. height: 0.22rem;
  425. line-height: 0.22rem;
  426. margin-bottom: 0.365rem;
  427. color: #808080;
  428. .squrts {
  429. width: 0.05rem;
  430. height: 0.22rem;
  431. margin-right: 0.1rem;
  432. position: relative;
  433. z-index: 5;
  434. }
  435. }
  436. .chioseList {
  437. position: relative;
  438. top: -0.1rem;
  439. z-index: 3;
  440. padding: 0 0.17rem;
  441. .theoryCell,
  442. .musicCell {
  443. display: flex;
  444. flex-direction: row;
  445. justify-content: flex-start;
  446. background: rgba(255, 255, 255, 1);
  447. box-shadow: 0px 0px 9px 0px rgba(0, 0, 0, 0.14);
  448. border-radius: 10px;
  449. min-height: 0.44rem;
  450. padding: 0 0.07rem;
  451. .left {
  452. color: #666;
  453. font-size: 0.15rem;
  454. line-height: 0.44rem;
  455. margin-right: 4px;
  456. .theoryIcon {
  457. width: 0.17rem;
  458. height: 0.17rem;
  459. position: relative;
  460. top: 0.04rem;
  461. }
  462. .muiscIcon {
  463. width: 0.17rem;
  464. height: 0.19rem;
  465. position: relative;
  466. top: 0.04rem;
  467. }
  468. .bookIcon {
  469. width: 0.16rem;
  470. height: 0.19rem;
  471. position: relative;
  472. top: 0.04rem;
  473. }
  474. }
  475. .right {
  476. .theoryItem {
  477. display: flex;
  478. flex-direction: row;
  479. justify-content: space-between;
  480. width: 2.28rem;
  481. .van-cell {
  482. // width: 1.6rem;
  483. // border-bottom:none;
  484. }
  485. .van-field__label {
  486. width: 0.8rem;
  487. }
  488. .iconWrap {
  489. position: absolute;
  490. right: 0.2rem;
  491. width: 0.42rem;
  492. height: 0.42rem;
  493. display: flex;
  494. flex-direction: column;
  495. align-items: center;
  496. .smallIcon {
  497. margin-top: 0.15rem;
  498. width: 0.15rem;
  499. height: 0.15rem;
  500. }
  501. }
  502. }
  503. }
  504. }
  505. .musicCell,
  506. .teachingCell {
  507. margin-top: 0.25rem;
  508. }
  509. .subTitle,
  510. .subTitles {
  511. position: relative;
  512. top: -0.2rem;
  513. font-size: 0.18rem;
  514. color: #00696a;
  515. }
  516. .subTitles {
  517. top: 0 !important;
  518. padding: 0.27rem 0 0.24rem;
  519. }
  520. }
  521. }
  522. .nextCard {
  523. margin-top: 0.23rem;
  524. }
  525. }
  526. .cell.activce {
  527. border: 1px solid #28babd;
  528. color: #28babd;
  529. }
  530. .cell {
  531. width: 3.05rem;
  532. padding: 0.1rem 0.15rem 0.1rem 0;
  533. line-height: 0.2rem;
  534. display: flex;
  535. flex-direction: row;
  536. border-radius: 10px;
  537. box-shadow: 0px 0px 9px 0px rgba(0, 0, 0, 0.14);
  538. background-color: #fff;
  539. font-size: 0.14rem;
  540. margin-bottom: 0.245rem;
  541. border: 1px solid transparent;
  542. .icons {
  543. width: 0.26rem;
  544. height: 0.26rem;
  545. margin: 0 0.105rem;
  546. }
  547. }
  548. .submit {
  549. width: 3.2rem;
  550. position: relative;
  551. z-index: 2;
  552. }
  553. .bottomBox {
  554. background: url("../../assets/images/start/bottom.png") no-repeat;
  555. // background-size: 100% 100%;
  556. position: absolute;
  557. width: 100%;
  558. height: 3.45rem;
  559. left: 0;
  560. bottom: 0;
  561. z-index: 1;
  562. }
  563. }
  564. .van-overflow-hidden {
  565. z-index: 0;
  566. position: relative;
  567. }
  568. </style>