TestRecord.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. <script setup lang="ts">
  2. import CpmdHeader from '@/components/CpmdHeader.vue';
  3. import { onMounted, onUnmounted, ref } from 'vue'
  4. //持久化设置 菜单状态
  5. import { menuStatusStore, userInfoStore } from '@/stores'
  6. // import router from '@/router';
  7. import { useRouter } from 'vue-router';
  8. import { getDataApi } from '@/api/plan';
  9. import { userPlanApi, userPlanDetailApi } from '@/api/home';
  10. const router = useRouter()
  11. const menuStatus = menuStatusStore();
  12. menuStatus.saveActiveIndex('5')
  13. const userInfo = userInfoStore()
  14. //分页设计
  15. //当前页
  16. //是哪一页
  17. const pageNum = ref<number>(1)
  18. //一页显示多少条
  19. const pageSize = ref<number>(5)
  20. //数据总共多少条
  21. const totol = ref<number>(0)
  22. //显示是否是在加载中
  23. const isLoading = ref<boolean>(false)
  24. //是否显示noMore
  25. const noMore = ref<boolean>(false)
  26. //页面返回的数据
  27. const list = ref<any>([])
  28. //获取数据报
  29. const getData = async () => {
  30. //判断总条数是否大于当前页面的数据
  31. //先判断
  32. if (totol.value == list.value.length) {
  33. //显示noMore
  34. if (totol.value == 0) {
  35. noMore.value = false;
  36. } else {
  37. noMore.value = true;
  38. }
  39. return
  40. }
  41. //先是加载中的话就不加载了
  42. if (isLoading.value) {
  43. return
  44. }
  45. isLoading.value = true;
  46. //参数构造
  47. pageNum.value++
  48. //到这里就可以显示加载中
  49. let res = await initData()
  50. isLoading.value = false;
  51. }
  52. const initData = async () => {
  53. //判断用户登录没有
  54. if (!userInfo.token) {
  55. return
  56. }
  57. let params = {
  58. pageNum: pageNum.value,
  59. pageSize: pageSize.value,
  60. userNo: userInfo.userInfo.userNo
  61. }
  62. let res: any = await getDataApi(params)
  63. if (res.code == 200) {
  64. //在这里需要将已经测试完成的测试计划下的---的题目都标记出来
  65. // list.value.push(...res.data)
  66. if (res.data.content.length > 0) {
  67. let listInit = []
  68. listInit.push(...res.data.content)
  69. // list.value.push(...res.data.content)
  70. //在这里进行循环--将需要显示的报告查询出来放入数组
  71. for (let i = 0; i < listInit.length; i++) {
  72. // list.value[i].listLin = []
  73. let params = {
  74. planId: listInit[i].id,
  75. userNo: userInfo.userInfo.userNo
  76. }
  77. let temp: any = await userPlanDetailApi(params)
  78. //在这里循环//且类型等于0 量表的 得到量表的列表
  79. let scaleList = []
  80. for (let j = 0; j < temp.data.length; j++) {
  81. if (temp.data[j].isDisplayed == '1' && temp.data[j].contentType == '0') {
  82. scaleList.push(temp.data[j])
  83. }
  84. }
  85. listInit[i].scaleList = scaleList;
  86. //在这里循环 //且类型为等于1的量表 得到量表列表
  87. let taskList = []
  88. for (let j = 0; j < temp.data.length; j++) {
  89. if (temp.data[j].isDisplayed == '1' && temp.data[j].contentType == '1') {
  90. taskList.push(temp.data[j])
  91. }
  92. }
  93. listInit[i].taskList = taskList;
  94. // list.value[i].list = temp.data
  95. // list.value[i].listLin = []
  96. }
  97. list.value.push(...listInit)
  98. totol.value = res.data.totalElements
  99. } else {
  100. list.value = []
  101. totol.value = 0
  102. // totalElements
  103. }
  104. }
  105. }
  106. //先判断总条数是否等于 当前页面的参数
  107. //如果等于的话--显示nomore
  108. //如果总条数大于 当前页面的总条数就显示loading
  109. const planNumGet = async () => {
  110. if (userInfo.token) {
  111. let userNo = ''
  112. //登录的话
  113. //判断当前是否有后台管理
  114. userNo = userInfo.userInfo.userNo;
  115. //调用根据用户查询计划的API
  116. let res: any = await userPlanApi(userNo)
  117. userInfo.savePlanCurrentNum(res.data.length)
  118. }
  119. }
  120. //刚进入页面就将高度设置为页面需要的
  121. onMounted(() => {
  122. initData()
  123. //进到界面开始轮询
  124. planNumGet()
  125. })
  126. //界面销毁函数
  127. //跳转页面切换页面
  128. const viewReport = (val: any) => {
  129. router.push({ name: 'report', params: { planId: val.planId, flag: val.flag } })
  130. // router.push({ name: 'report', params: { planId: 'a', flag: 'b' } })
  131. // router.push({ name: 'report' })
  132. // router.push({ name: 'plan' })
  133. }
  134. //轮旋切换页面的方法
  135. //退出页面销毁 方法
  136. onUnmounted(() => {
  137. })
  138. </script>
  139. <template>
  140. <div class="home_header_out">
  141. <div class=" home_header_inner">
  142. <CpmdHeader />
  143. <div style="text-align: center;">
  144. <!-- <img class="xlts_img" style="margin-top:40px" src="../assets/home/other_text.png" /> -->
  145. </div>
  146. </div>
  147. <div class="kply">
  148. <div class="kply_inner">
  149. <!-- -->
  150. <div style="padding: 20px 40px;">
  151. <div style="padding:10% 20%" v-show="list.length == 0">
  152. <img width="60%" style="margin-left: 20%;" src="../assets/planNo.png">
  153. </div>
  154. <div class="infinite-list-wrapper" style="overflow: auto" v-infinite-scroll="getData">
  155. <div v-for="item in list">
  156. <div class="test_record">
  157. <img src="../assets/kepu/task_1.png" />
  158. <span>{{ item.planName }}</span>
  159. </div>
  160. <div class="test_time">
  161. <span>测试时间:{{ item.taskStartTime }}~{{ item.taskEndTime }}</span>
  162. </div>
  163. <div class="content_out">
  164. <div class="content_inner">
  165. <div class="task_out">
  166. <div class="content_title">1.问答测试</div>
  167. <div class="task_inner">
  168. <div class="task_inner_single" v-for="subItem in item.scaleList"
  169. :key="subItem.id">
  170. <div class="task_inner_one">
  171. <img style="width: 80px;height: 80px"
  172. src="../assets/kepu/xlwht_active.png" alt="">
  173. <div class="task_content">
  174. <div class="title">{{ subItem.name }}</div>
  175. <!-- <div class="des" v-show="subItem.isCompleted != '1'">预计用时:{{
  176. subItem.expectTime }}</div> -->
  177. <div class="des" v-show="subItem.isCompleted == '1'">实际用时:{{
  178. subItem.useTime }}</div>
  179. <!-- <div class="noCompleted" v-show="subItem.isCompleted != '1'">
  180. <div class='noCompleted_status'> 未完成</div>
  181. </div> -->
  182. <div class="isCompleted" v-show="subItem.isCompleted == '1'">
  183. <div @click="viewReport(subItem)"
  184. class='isCompleted_status'> 查看报告</div>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="task_out">
  192. <div class="content_title">2.认知评估</div>
  193. <div class="task_inner">
  194. <div class="task_inner_single" v-for="subItem in item.taskList">
  195. <div class="task_inner_one">
  196. <img style="width: 80px;height: 80px"
  197. src="../assets/kepu/xlwht_active.png" alt="">
  198. <div class="task_content">
  199. <div class="title">{{ subItem.name }}</div>
  200. <!-- <div class="des" v-show="subItem.isCompleted != '1'">预计用时:{{
  201. subItem.expectTime }}</div> -->
  202. <div class="des" v-show="subItem.isCompleted == '1'">实际用时:{{
  203. subItem.useTime }}</div>
  204. <!-- <div class="noCompleted" v-show="subItem.isCompleted != '1'">
  205. <div class='noCompleted_status'> 未完成</div>
  206. </div> -->
  207. <div class="isCompleted" v-show="subItem.isCompleted == '1'">
  208. <div @click="viewReport(subItem)"
  209. class='isCompleted_status'> 查看报告</div>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. <div></div>
  218. </div>
  219. <!-- <div class="record_out">
  220. <div class="record_score">
  221. <span>得&nbsp;&nbsp;&nbsp;&nbsp;分:</span>
  222. <span>{{ item.score }}</span>
  223. </div>
  224. <div class="record_result">
  225. <span>结&nbsp;&nbsp;&nbsp;&nbsp;论:</span>
  226. </div>
  227. </div> -->
  228. </div>
  229. <div style="text-align: center;margin-top:20px" v-show="isLoading">努力加载中...</div>
  230. <div style="text-align: center;;margin-top:20px" v-show="noMore">没有更多了</div>
  231. </div>
  232. <!-- 测试记录列表 -->
  233. </div>
  234. </div>
  235. </div>
  236. </div>
  237. </template>
  238. <style lang="scss" scoped>
  239. .home_header_out {
  240. // position: relative;
  241. padding-bottom: 60px;
  242. width: 100%;
  243. min-width: 1200px;
  244. background-image: url('../assets/home/bg_ty.png');
  245. background-repeat: no-repeat;
  246. background-size: contain;
  247. flex: 1;
  248. background-color: #B3F1DA; //估计是需要动态
  249. //获取屏幕宽度home_header_out 这个div的宽度--然后宽度*1000再除1920即为当前div的宽度
  250. .home_header_inner {
  251. min-height: 1;
  252. left: 0;
  253. right: 0;
  254. margin: auto;
  255. // height: 100px;
  256. width: 1200px;
  257. .xlts_img {
  258. height: 60px;
  259. }
  260. }
  261. .kply {
  262. width: 100%;
  263. margin-top: 40px;
  264. // background-color: #FAFAFA;
  265. .kply_inner {
  266. // padding: 20px 20px;
  267. left: 0;
  268. right: 0;
  269. margin: auto;
  270. width: 1200px;
  271. background-color: #ffffff;
  272. border-radius: 40px;
  273. // margin-bottom: 20px;
  274. // height: 1000px;
  275. .infinite-list-wrapper {
  276. // max-height: 900px;
  277. // max-height: 500px;
  278. // min-height: 500px;
  279. .kepu_title {
  280. display: flex;
  281. flex-direction: row;
  282. justify-content: space-between;
  283. align-items: center;
  284. .kepu_title_des {
  285. font-family: Alibaba PuHuiTi 2.0;
  286. font-weight: 600;
  287. font-size: 30px;
  288. color: #000000;
  289. }
  290. .home_mid_plan_button {
  291. width: 100%;
  292. display: flex;
  293. flex-direction: row;
  294. justify-content: end;
  295. // text-align: right;
  296. .pub_button {
  297. cursor: pointer;
  298. // width: 100px;
  299. border-radius: 12px;
  300. border: 3px solid #48D68E;
  301. color: #ffffff;
  302. background-color: #000000;
  303. padding: 8px 30px;
  304. cursor: pointer;
  305. display: flex;
  306. align-items: center;
  307. }
  308. }
  309. }
  310. .com_out {
  311. min-height: 500px;
  312. padding: 20px 20px;
  313. }
  314. .test_record {
  315. margin-top: 20px;
  316. display: flex;
  317. align-items: center;
  318. img {
  319. width: 70px;
  320. }
  321. span {
  322. margin-left: 20px;
  323. font-size: 28px;
  324. font-weight: 700;
  325. letter-spacing: 3px;
  326. }
  327. }
  328. .test_time {
  329. margin-bottom: 10px;
  330. display: flex;
  331. flex-direction: row;
  332. justify-content: space-between;
  333. align-items: center;
  334. span {
  335. color: #000000;
  336. opacity: 0.4;
  337. font-size: 20px;
  338. }
  339. div {
  340. cursor: pointer;
  341. // width: 100px;
  342. border-radius: 12px;
  343. border: 3px solid #48D68E;
  344. color: #ffffff;
  345. background-color: #000000;
  346. margin-right: 20px;
  347. padding: 8px 30px;
  348. cursor: pointer;
  349. display: flex;
  350. align-items: center;
  351. }
  352. }
  353. .record_out {
  354. margin-top: 30px;
  355. background-color: #F7F7F7;
  356. padding: 30px 40px;
  357. border-radius: 40px;
  358. .record_score {
  359. color: #48D68E;
  360. margin-bottom: 5px;
  361. font-size: 20px;
  362. letter-spacing: 3px;
  363. }
  364. .record_result {
  365. line-height: 30px;
  366. color: #48D68E;
  367. margin-bottom: 10px;
  368. font-size: 20px;
  369. letter-spacing: 3px;
  370. }
  371. }
  372. .content_out {
  373. display: flex;
  374. flex-direction: column;
  375. width: 100%;
  376. // height: 200px;
  377. background-color: #F7F7F7;
  378. border-radius: 40px;
  379. .content_inner {
  380. padding: 20px 40px;
  381. .content_title {
  382. margin-bottom: 0px;
  383. font-weight: 700;
  384. font-size: 18px;
  385. }
  386. .content_one {
  387. border-radius: 20px;
  388. // padding: 10px 20px;
  389. display: flex;
  390. background-color: #ffffff;
  391. width: 45%;
  392. align-items: center;
  393. .content_single {
  394. border-radius: 20px;
  395. padding: 10px 20px;
  396. display: flex;
  397. background-color: #ffffff;
  398. width: 45%;
  399. align-items: center;
  400. .content_detail {
  401. display: flex;
  402. margin-left: 15px;
  403. justify-content: start;
  404. height: 80px;
  405. flex-direction: column;
  406. .title {
  407. font-weight: 700;
  408. font-size: 18px;
  409. }
  410. .des {
  411. color: #999999;
  412. font-size: 14px;
  413. }
  414. }
  415. }
  416. }
  417. .task_out {
  418. margin-top: 20px;
  419. display: flex;
  420. flex-direction: column;
  421. .task_inner {
  422. display: flex;
  423. flex-direction: row;
  424. justify-content: space-between;
  425. flex-wrap: wrap;
  426. .task_inner_single {
  427. margin-top: 20px;
  428. height: 100px;
  429. border-radius: 20px;
  430. width: 45%;
  431. display: flex;
  432. flex-direction: row;
  433. background-color: #ffffff;
  434. align-items: center;
  435. .task_inner_one {
  436. padding: 10px 20px;
  437. border-radius: 20px;
  438. width: 100%;
  439. display: flex;
  440. flex-direction: row;
  441. background-color: #ffffff;
  442. align-items: center;
  443. .task_content {
  444. height: 80px;
  445. margin-left: 10px;
  446. display: flex;
  447. flex-direction: column;
  448. width: 100%;
  449. .title {
  450. font-weight: 700;
  451. font-size: 18px;
  452. width: 100%;
  453. letter-spacing: 2px;
  454. }
  455. .des {
  456. color: #999999;
  457. font-size: 14px;
  458. line-height: 24px;
  459. letter-spacing: 2px;
  460. }
  461. .noCompleted {
  462. width: 100%;
  463. color: #ffffff;
  464. display: flex;
  465. justify-content: end;
  466. .noCompleted_status {
  467. line-height: 24px;
  468. font-size: 14px;
  469. border-radius: 20px;
  470. text-align: center;
  471. right: 0px;
  472. width: 70px;
  473. background-color: red;
  474. }
  475. }
  476. .isCompleted {
  477. width: 100%;
  478. color: #ffffff;
  479. display: flex;
  480. justify-content: end;
  481. .isCompleted_status {
  482. padding-left: 10px;
  483. padding-right: 10px;
  484. line-height: 30px;
  485. font-size: 14px;
  486. border-radius: 4px;
  487. text-align: center;
  488. right: 0px;
  489. width: 70px;
  490. border-radius: 12px;
  491. border: 3px solid #48D68E;
  492. color: #ffffff;
  493. background-color: #000000;
  494. cursor: pointer
  495. }
  496. }
  497. }
  498. }
  499. }
  500. }
  501. }
  502. }
  503. }
  504. }
  505. }
  506. }
  507. }
  508. .home_mid {
  509. // background-color: blanchedalmond;
  510. width: 1200px;
  511. left: 0;
  512. right: 0;
  513. margin: auto;
  514. margin-top: 40px;
  515. // position: relative;
  516. .kepu_title {
  517. text-align: center;
  518. font-size: 50px;
  519. color: #111111;
  520. line-height: 95px;
  521. // width: 100%;
  522. // left: 0;
  523. // right: 0;
  524. // margin: auto
  525. }
  526. .kepu_title_sub {
  527. margin-top: 30px;
  528. text-align: center;
  529. font-size: 28px;
  530. color: #48D68E;
  531. line-height: 26px;
  532. }
  533. .man1_group {
  534. margin-top: 60px;
  535. height: 100%;
  536. display: flex;
  537. .man1 {
  538. position: relative;
  539. width: 327px;
  540. // height: 100%;
  541. // height: 100%
  542. .man1_img {
  543. position: absolute;
  544. bottom: 0;
  545. /* bottom: 0px; */
  546. /* height: auto; */
  547. width: 100%;
  548. left: 100px
  549. }
  550. }
  551. .des {
  552. border: #48D68E solid 5px;
  553. border-radius: 40px;
  554. padding: 20px;
  555. letter-spacing: 6px;
  556. flex: 1;
  557. .des_inner {
  558. border: 1px dashed #48D68E;
  559. border-radius: 40px;
  560. padding-bottom: 40px;
  561. padding-top: 30px;
  562. padding-left: 100px;
  563. padding-right: 20px;
  564. letter-spacing: 6px;
  565. font-weight: normal;
  566. font-size: 24px;
  567. color: #333333;
  568. line-height: 40px;
  569. }
  570. }
  571. }
  572. .man2_group {
  573. margin-top: 60px;
  574. height: 100%;
  575. display: flex;
  576. .man2 {
  577. position: relative;
  578. width: 327px;
  579. // height: 100%;
  580. // height: 100%
  581. .man2_img {
  582. position: absolute;
  583. bottom: 0;
  584. /* bottom: 0px; */
  585. /* height: auto; */
  586. width: 100%;
  587. left: -100px
  588. }
  589. }
  590. .des2 {
  591. border: #48D68E solid 5px;
  592. border-radius: 40px;
  593. padding: 20px;
  594. letter-spacing: 6px;
  595. flex: 1;
  596. .des2_inner {
  597. border: 1px dashed #48D68E;
  598. border-radius: 40px;
  599. padding-bottom: 40px;
  600. padding-top: 30px;
  601. padding-left: 20px;
  602. padding-right: 100px;
  603. letter-spacing: 6px;
  604. font-weight: normal;
  605. font-size: 24px;
  606. color: #333333;
  607. line-height: 40px;
  608. }
  609. }
  610. }
  611. .get_more {
  612. text-align: center;
  613. img {
  614. width: 300px;
  615. margin-top: 60px;
  616. margin-bottom: 60px;
  617. }
  618. }
  619. }
  620. // .home_footer_out {
  621. // width: 100%;
  622. // background-color: #000000;
  623. // }</style>