question_report.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <template>
  2. <view>
  3. <nav-bar title="试卷报告"></nav-bar>
  4. <view :class="reportStatus == 0 ? 'redBtn' : reportStatus == 1 ? 'greenBtn' : 'disNone'" v-if="reportStatus !== null">
  5. {{ reportStatus == 0 ? '测试未通过' : reportStatus == 1 ? '测试通过' : '' }}
  6. </view>
  7. <view class="top">
  8. <view class="box">
  9. <view class="left">
  10. <view>{{ ((rightQuestionNum / (rightQuestionNum + doWrongQuestionNum)) * 100).toFixed(0) }}%</view>
  11. <view>正确率</view>
  12. <view>不含简答/案例题</view>
  13. </view>
  14. <view class="right">
  15. <view class="flex up">
  16. <!-- <u-icon name="checkmark" color="#16D48B" size="48" style="margin-right: 14rpx;"></u-icon> -->
  17. <image class="right_num" src="/static/right_num.png" mode="widthFix"></image>
  18. <view class="text">正确题数</view>
  19. <text class="green">{{ rightQuestionNum }}</text>
  20. </view>
  21. <view class="flex up">
  22. <!-- <u-icon name="checkmark" color="#16D48B" size="48" style="margin-right: 14rpx;"></u-icon> -->
  23. <image class="right_num" src="/static/out_num.png" mode="widthFix"></image>
  24. <view class="text">少选题数</view>
  25. <text class="yellow">{{ lessQuestionNum }}</text>
  26. </view>
  27. <view class="flex down">
  28. <!-- <u-icon name="close" color="#FF3B30" size="38" style="margin-right: 26rpx;"></u-icon> -->
  29. <image class="right_num" src="/static/wrong_num.png" mode="widthFix"></image>
  30. <view class="text">错误题数</view>
  31. <text class="red">{{ doWrongQuestionNum }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="bottom">
  37. <view class="circle-wrap">
  38. <view class="circle-list">
  39. <view class="item" v-show="totalScore">
  40. <view class="title">
  41. 试卷得分
  42. <text>(不含简答和案例题)</text>
  43. </view>
  44. <canvas class="canvas" canvas-id="Canvas1"></canvas>
  45. </view>
  46. <view class="item" v-show="examTime">
  47. <view class="title">答题时长</view>
  48. <canvas canvas-id="Canvas2"></canvas>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view v-if="courseList.length" class="course_list">
  54. <view class="titles">
  55. <image class="code" src="@/static/learn/act_icon.png" ></image>
  56. <text class="title">推荐课程</text>
  57. </view>
  58. <view class="list_item" v-for="(item,index) in courseList" :key="index" @click="toBuy(item)">
  59. <view class="course_content">
  60. <view class="c_title">{{item.goodsName}}</view>
  61. <view class="c_downs">
  62. <view class="img">
  63. <image :src="$method.splitImgHost(item.coverUrl, true)"></image>
  64. <view class="time" v-if="item.year">{{item.year?item.year:''}}</view>
  65. </view>
  66. <view class="text">
  67. <view class="desc">
  68. <view class="left">
  69. <text class="mon_t">¥ {{item.standPrice}}</text>
  70. <!-- <text class="sale">/限时优惠</text> -->
  71. <text v-if="item.linePrice" class="sale"> ¥ </text>
  72. <text v-if="item.linePrice" class="price_line">&nbsp;{{ item.linePrice }}</text>
  73. </view>
  74. <view class="right">
  75. <view class="regiser_row" v-if="!hideBuyState">立即购买</view>
  76. </view>
  77. </view>
  78. <view v-if="item.buyUserNum" class="joins">
  79. <!-- <image class="people" src="/static/index/people.png"></image> -->
  80. <!-- 为0时,不显示 -->
  81. <view class="people">{{ item.buyUserNum }}人参与</view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </template>
  90. <script>
  91. import { mapGetters } from 'vuex';
  92. export default {
  93. data() {
  94. return {
  95. id: '',
  96. hideBtns:false,
  97. examData:{},
  98. examId:'',
  99. context1: null,
  100. context2: null,
  101. rightQuestionNum:'',
  102. doWrongQuestionNum:'',
  103. score:'',
  104. totalScore:'',
  105. doTime:'',
  106. examTime:'',
  107. reportStatus:null,
  108. lessQuestionNum:0,
  109. courseList: [],
  110. pageNum: 1,
  111. pageSize: 10,
  112. total: 0,
  113. };
  114. },
  115. onPullDownRefresh() {
  116. this.pageNum = 1
  117. this.getcourList()
  118. // this.timer = setTimeout(function() {
  119. // uni.stopPullDownRefresh()
  120. // }, 500)
  121. },
  122. onReachBottom() {
  123. console.log(this.total,'total')
  124. console.log(this.courseList.length,'length')
  125. if (this.courseList.length < this.total) {
  126. this.pageNum++
  127. this.getcourList()
  128. }
  129. },
  130. onUnload() {},
  131. computed: { ...mapGetters(['userInfo', 'hideBuyState']) },
  132. async onShow() {
  133. this.courseList = []
  134. this.getcourList()
  135. uni.getSystemInfo({
  136. success: res => {
  137. var winW = res.screenWidth;
  138. var winH = res.screenHeight;
  139. uni.createSelectorQuery()
  140. .in(this)
  141. .select('.canvas')
  142. .boundingClientRect()
  143. .exec(async newRes => {
  144. var width = newRes[0].width;
  145. var height = newRes[0].height;
  146. var caculateX = winW / 750;
  147. var caculateY = winH / 1334;
  148. console.log(caculateX);
  149. if(this.totalScore) {
  150. var context1 = uni.createCanvasContext('Canvas1');
  151. this.context1 = context1;
  152. context1.setStrokeStyle('#EEEEEE');
  153. context1.setLineWidth(caculateX * 20);
  154. context1.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, 2 * Math.PI, true);
  155. context1.stroke();
  156. context1.beginPath();
  157. context1.setStrokeStyle('#32D74B');
  158. context1.setFillStyle('#32D74B');
  159. context1.setTextAlign('center');
  160. context1.setTextBaseline('middle');
  161. context1.setLineCap('round');
  162. context1.setFontSize(caculateX * 64);
  163. context1.fillText(this.score, caculateX * 90, caculateX * 90, caculateX * 180);
  164. context1.setFillStyle('#999999');
  165. context1.setFontSize(caculateX * 20);
  166. context1.fillText(`满分${this.totalScore}`, caculateX * 90, caculateX * 130, caculateX * 180);
  167. context1.arc(caculateX * 90, caculateX * 90, caculateX * 80, -Math.PI/2, -Math.PI/2 + (this.score / this.totalScore) * 2 * Math.PI, false);
  168. context1.stroke();
  169. context1.draw();
  170. }
  171. if(this.examTime) {
  172. var context2 = uni.createCanvasContext('Canvas2');
  173. this.context2 = context2;
  174. context2.setStrokeStyle('#EEEEEE');
  175. context2.setLineWidth(caculateX * 20);
  176. context2.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, 2 * Math.PI, true);
  177. context2.stroke();
  178. context2.beginPath();
  179. context2.setStrokeStyle('#007AFF');
  180. context2.setFillStyle('#007AFF');
  181. context2.setTextAlign('center');
  182. context2.setTextBaseline('middle');
  183. context2.setLineCap('round');
  184. context2.setFontSize(caculateX * 64);
  185. context2.fillText(`${this.doTime}'`, caculateX * 90, caculateX * 90, caculateX * 180);
  186. context2.setFillStyle('#999999');
  187. context2.setFontSize(caculateX * 20);
  188. context2.fillText(`限时${this.examTime}'`, caculateX * 90, caculateX * 130, caculateX * 180);
  189. context2.arc(caculateX * 90, caculateX * 90, caculateX * 80, -Math.PI/2, -Math.PI/2 + (this.doTime / this.examTime) * 2 * Math.PI, false);
  190. context2.stroke();
  191. context2.draw();
  192. }
  193. });
  194. }
  195. });
  196. },
  197. async onLoad(option) {
  198. this.examId = option.examId
  199. this.examTime = option.examTime;
  200. this.doTime = option.doTime;
  201. this.reportStatus = option.reportStatus;
  202. this.rightQuestionNum = +option.rightQuestionNum;
  203. this.doWrongQuestionNum = +option.doWrongQuestionNum;
  204. this.score = +option.score;
  205. this.lessQuestionNum = option.lessQuestionNum;
  206. this.totalScore = +option.totalScore;
  207. // this.hideBtns = Boolean(option.hideBtns);
  208. },
  209. methods: {
  210. getcourList() {
  211. this.$http({
  212. url: '/apply/recommend/goodsList',
  213. method: 'post',
  214. data: {
  215. examId: this.examId,
  216. pageNum: this.pageNum,
  217. pageSize: this.pageSize,
  218. }
  219. }).then((res) => {
  220. if (res.data.code == 200) {
  221. this.courseList.push(...(res.data.rows || [] ))
  222. this.total = res.data.total
  223. }
  224. })
  225. },
  226. toBuy(item) {
  227. // if (item.goodsType == 1) {
  228. // uni.navigateTo({
  229. // url: '/pages3/course/detail?id='+item.goodsId
  230. // })
  231. // } else
  232. if (item.goodsType == 2) {
  233. uni.navigateTo({
  234. url: '/pages2/bank/detail?id='+item.goodsId
  235. })
  236. } else {
  237. // /pages5/liveDetail/index
  238. uni.navigateTo({
  239. url: '/pages3/course/detail?id='+item.goodsId + '&goodsType=' + item.goodsType
  240. })
  241. }
  242. },
  243. }
  244. };
  245. </script>
  246. <style>
  247. page {
  248. background-color: #eaeef1;
  249. }
  250. </style>
  251. <style lang="scss" scope>
  252. @import '../../pages5/examReport/indexCourseList.scss';
  253. .disNone {
  254. display: none;
  255. }
  256. .greenBtn {
  257. margin: 16rpx 16rpx 0;
  258. height: 80rpx;
  259. line-height: 80rpx;
  260. text-align: center;
  261. background-color: #f7fff8;
  262. border-radius: 16rpx;
  263. color: #34c759;
  264. font-weight: bold;
  265. font-size: 30rpx;
  266. }
  267. .redBtn {
  268. margin: 16rpx 16rpx 0;
  269. height: 80rpx;
  270. line-height: 80rpx;
  271. text-align: center;
  272. background-color: #FFF3F2;
  273. border-radius: 16rpx;
  274. color: #FF3B30;
  275. font-weight: bold;
  276. font-size: 30rpx;
  277. }
  278. .dis_fst {
  279. margin-top: 40rpx;
  280. display: flex;
  281. align-items: center;
  282. justify-content: space-around;
  283. }
  284. .btnACs {
  285. height: 48rpx;
  286. width: 160rpx;
  287. text-align: center;
  288. line-height: 48rpx;
  289. border: 1rpx solid #007aff;
  290. border-radius: 16rpx;
  291. color: #007aff;
  292. font-size: 24rpx;
  293. }
  294. .top {
  295. margin: 16rpx 16rpx 0;
  296. border-radius: 16rpx;
  297. padding: 40rpx 24rpx 16rpx;
  298. background: #fff;
  299. .title {
  300. font-size: 32rpx;
  301. font-weight: bold;
  302. color: #333333;
  303. }
  304. .desc {
  305. margin-top: 20rpx;
  306. font-size: 24rpx;
  307. color: #999999;
  308. }
  309. .box {
  310. margin-top: 30rpx;
  311. display: flex;
  312. .left {
  313. width: 250rpx;
  314. height: 176rpx;
  315. background: #f5f5f5;
  316. border-radius: 16rpx;
  317. display: flex;
  318. align-items: center;
  319. justify-content: center;
  320. flex-direction: column;
  321. margin-right: 16rpx;
  322. view {
  323. text-align: center;
  324. &:nth-of-type(1) {
  325. font-size: 60rpx;
  326. font-weight: bold;
  327. color: #007aff;
  328. }
  329. &:nth-of-type(2) {
  330. font-size: 32rpx;
  331. font-weight: bold;
  332. color: #333333;
  333. }
  334. &:nth-of-type(3) {
  335. font-size: 24rpx;
  336. color: #999999;
  337. }
  338. }
  339. }
  340. .right {
  341. flex: 1;
  342. display: flex;
  343. flex-direction: column;
  344. justify-content: space-between;
  345. .flex {
  346. background: #f5f5f5;
  347. display: flex;
  348. height: 80rpx;
  349. align-items: center;
  350. padding: 0 40rpx;
  351. border-radius: 16rpx;
  352. image {
  353. margin-right: 28rpx;
  354. &.right_num {
  355. width:26rpx;
  356. }
  357. &.out_num {
  358. width:38rpx;
  359. }
  360. &.wrong_num {
  361. width:30rpx;
  362. }
  363. }
  364. .text {
  365. flex: 1;
  366. font-size: 30rpx;
  367. color: #666666;
  368. }
  369. text {
  370. font-size: 48rpx;
  371. color: #e12626;
  372. &.red {
  373. color: #FF3B30;
  374. }
  375. &.green {
  376. color: #36C75A;
  377. }
  378. &.yellow {
  379. color:#FFC53D;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. }
  386. .bottom {
  387. .circle-wrap {
  388. .circle-list {
  389. display: flex;
  390. .item {
  391. padding: 20rpx;
  392. border-radius: 16rpx;
  393. background: #fff;
  394. margin: 16rpx;
  395. flex: 1;
  396. .title {
  397. font-weight: bold;
  398. font-size: 30rpx;
  399. line-height: 24rpx;
  400. color: #333333;
  401. text {
  402. font-size: 20rpx;
  403. color: #999999;
  404. }
  405. }
  406. canvas {
  407. margin: 36rpx auto 0;
  408. width: 180rpx;
  409. height: 180rpx;
  410. }
  411. .text {
  412. text-align: center;
  413. margin-top: 16rpx;
  414. font-size: 24rpx;
  415. color: #333333;
  416. }
  417. }
  418. }
  419. }
  420. }
  421. </style>