question_report.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  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 if (item.goodsType == 2) {
  232. uni.navigateTo({
  233. url: '/pages2/bank/detail?id='+item.goodsId
  234. })
  235. } else {
  236. uni.navigateTo({
  237. url: '/pages5/liveDetail/index?id='+item.goodsId
  238. })
  239. }
  240. },
  241. }
  242. };
  243. </script>
  244. <style>
  245. page {
  246. background-color: #eaeef1;
  247. }
  248. </style>
  249. <style lang="scss" scope>
  250. @import '../../pages5/examReport/indexCourseList.scss';
  251. .disNone {
  252. display: none;
  253. }
  254. .greenBtn {
  255. margin: 16rpx 16rpx 0;
  256. height: 80rpx;
  257. line-height: 80rpx;
  258. text-align: center;
  259. background-color: #f7fff8;
  260. border-radius: 16rpx;
  261. color: #34c759;
  262. font-weight: bold;
  263. font-size: 30rpx;
  264. }
  265. .redBtn {
  266. margin: 16rpx 16rpx 0;
  267. height: 80rpx;
  268. line-height: 80rpx;
  269. text-align: center;
  270. background-color: #FFF3F2;
  271. border-radius: 16rpx;
  272. color: #FF3B30;
  273. font-weight: bold;
  274. font-size: 30rpx;
  275. }
  276. .dis_fst {
  277. margin-top: 40rpx;
  278. display: flex;
  279. align-items: center;
  280. justify-content: space-around;
  281. }
  282. .btnACs {
  283. height: 48rpx;
  284. width: 160rpx;
  285. text-align: center;
  286. line-height: 48rpx;
  287. border: 1rpx solid #007aff;
  288. border-radius: 16rpx;
  289. color: #007aff;
  290. font-size: 24rpx;
  291. }
  292. .top {
  293. margin: 16rpx 16rpx 0;
  294. border-radius: 16rpx;
  295. padding: 40rpx 24rpx 16rpx;
  296. background: #fff;
  297. .title {
  298. font-size: 32rpx;
  299. font-weight: bold;
  300. color: #333333;
  301. }
  302. .desc {
  303. margin-top: 20rpx;
  304. font-size: 24rpx;
  305. color: #999999;
  306. }
  307. .box {
  308. margin-top: 30rpx;
  309. display: flex;
  310. .left {
  311. width: 250rpx;
  312. height: 176rpx;
  313. background: #f5f5f5;
  314. border-radius: 16rpx;
  315. display: flex;
  316. align-items: center;
  317. justify-content: center;
  318. flex-direction: column;
  319. margin-right: 16rpx;
  320. view {
  321. text-align: center;
  322. &:nth-of-type(1) {
  323. font-size: 60rpx;
  324. font-weight: bold;
  325. color: #007aff;
  326. }
  327. &:nth-of-type(2) {
  328. font-size: 32rpx;
  329. font-weight: bold;
  330. color: #333333;
  331. }
  332. &:nth-of-type(3) {
  333. font-size: 24rpx;
  334. color: #999999;
  335. }
  336. }
  337. }
  338. .right {
  339. flex: 1;
  340. display: flex;
  341. flex-direction: column;
  342. justify-content: space-between;
  343. .flex {
  344. background: #f5f5f5;
  345. display: flex;
  346. height: 80rpx;
  347. align-items: center;
  348. padding: 0 40rpx;
  349. border-radius: 16rpx;
  350. image {
  351. margin-right: 28rpx;
  352. &.right_num {
  353. width:26rpx;
  354. }
  355. &.out_num {
  356. width:38rpx;
  357. }
  358. &.wrong_num {
  359. width:30rpx;
  360. }
  361. }
  362. .text {
  363. flex: 1;
  364. font-size: 30rpx;
  365. color: #666666;
  366. }
  367. text {
  368. font-size: 48rpx;
  369. color: #e12626;
  370. &.red {
  371. color: #FF3B30;
  372. }
  373. &.green {
  374. color: #36C75A;
  375. }
  376. &.yellow {
  377. color:#FFC53D;
  378. }
  379. }
  380. }
  381. }
  382. }
  383. }
  384. .bottom {
  385. .circle-wrap {
  386. .circle-list {
  387. display: flex;
  388. .item {
  389. padding: 20rpx;
  390. border-radius: 16rpx;
  391. background: #fff;
  392. margin: 16rpx;
  393. flex: 1;
  394. .title {
  395. font-weight: bold;
  396. font-size: 30rpx;
  397. line-height: 24rpx;
  398. color: #333333;
  399. text {
  400. font-size: 20rpx;
  401. color: #999999;
  402. }
  403. }
  404. canvas {
  405. margin: 36rpx auto 0;
  406. width: 180rpx;
  407. height: 180rpx;
  408. }
  409. .text {
  410. text-align: center;
  411. margin-top: 16rpx;
  412. font-size: 24rpx;
  413. color: #333333;
  414. }
  415. }
  416. }
  417. }
  418. }
  419. </style>