question_statistics.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <template>
  2. <view>
  3. <view class="top">
  4. <view class="title">
  5. 做题统计
  6. <text>(不含简答和案例题)</text>
  7. </view>
  8. <view class="circle-wrap">
  9. <view class="circle-list">
  10. <view class="item">
  11. <canvas class="canvas" canvas-id="Canvas1"></canvas>
  12. <view class="text">正确率</view>
  13. </view>
  14. <view class="item">
  15. <canvas canvas-id="Canvas2"></canvas>
  16. <view class="text">做题进度</view>
  17. </view>
  18. <view class="numbers">
  19. <view class="blue">已答 {{goodsCount.doNum}}</view>
  20. <view>总数 {{goodsCount.totalNum}}</view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="title-list">
  26. <view class="content">
  27. <view class="list" v-for="(item1,index1) in bankList" :key="index1">
  28. <template v-if="item1.type==1">
  29. <view class="moduleItem" @click="clickModule(item1.majorId,index1)">
  30. <view class="courseName">{{item1.name}}</view>
  31. <view>
  32. <image src="/static/icon/up.png" class="icon_up" v-if="!item1.showList"></image>
  33. <image src="/static/icon/down.png" class="icon_up" v-if="item1.showList"></image>
  34. </view>
  35. </view>
  36. <template v-if="item1.showList">
  37. <view v-for="(item2,index2) in item1.list" :key="index2" >
  38. <view class="section" @click="changeItem(index1,item2.chapterExamId,item1.type)">
  39. <image src="/static/icon/up1.png" class="icon_up" v-if="!item2.showList"></image>
  40. <image src="/static/icon/down1.png" class="icon_up" v-if="item2.showList"></image>
  41. {{item2.name}}
  42. </view>
  43. <view v-if="item2.showList">
  44. <view class="article" v-for="(article,index3) in item2.list" :key="index3">
  45. <view class="flex-auto">
  46. <view class="tit">{{article.examName}}</view>
  47. <view class="desc">
  48. <view class="flex-auto">
  49. 正确率
  50. <text class="green">65%</text>
  51. </view>
  52. <view class="flex-auto">
  53. 已完成
  54. <text class="blue">65%</text>
  55. </view>
  56. </view>
  57. </view>
  58. <navigator :url="'/pages2/bank/questionBankExplain?continue=1&recordId='+article.recordId+'&id='+article.examId+'&goodsid='+article.goodsId+'&moduleId='+article.moduleExamId+'&chapterId='+article.chapterExamId+''">
  59. <view class="btn" v-if="article.recordStatus == 0">继续</view>
  60. </navigator>
  61. </view>
  62. </view>
  63. <u-line></u-line>
  64. </view>
  65. </template>
  66. </template>
  67. <template v-if="item1.type ==2">
  68. <view class="section" @click="changeItem(index1,item1.majorId,item1.type)">
  69. <image src="/static/icon/up1.png" class="icon_up" v-if="!item1.showList"></image>
  70. <image src="/static/icon/down1.png" class="icon_up" v-if="item1.showList"></image>
  71. {{item1.name}}
  72. </view>
  73. <view v-if="item1.showList" >
  74. <view class="article" :key="index3" v-for="(article,index2) in item1.list">
  75. <view class="flex-auto">
  76. <view class="tit">{{article.name}}</view>
  77. <view class="desc">
  78. <view class="flex-auto">
  79. 正确率
  80. <text class="green">65%</text>
  81. </view>
  82. <view class="flex-auto">
  83. 已完成
  84. <text class="blue">65%</text>
  85. </view>
  86. </view>
  87. </view>
  88. <navigator :url="'/pages2/bank/questionBankExplain?continue=1&recordId='+article.recordId+'&id='+article.examId+'&goodsid='+article.goodsId+'&moduleId=0&chapterId='+article.chapterExamId+''">
  89. <view class="btn" v-if="article.recordStatus == 0">继续</view>
  90. </navigator>
  91. </view>
  92. </view>
  93. </template>
  94. <template v-if="item1.type ==3">
  95. <view class="article" >
  96. <view class="flex-auto">
  97. <view class="tit">{{item1.name}}</view>
  98. <view class="desc">
  99. <view class="flex-auto">
  100. 正确率
  101. <text class="green">65%</text>
  102. </view>
  103. <view class="flex-auto">
  104. 已完成
  105. <text class="blue">65%</text>
  106. </view>
  107. </view>
  108. </view>
  109. <navigator :url="'/pages2/bank/questionBankExplain?continue=1&recordId='+item1.recordId+'&id='+item1.majorId+'&goodsid='+item1.goodsId+'&moduleId=0&chapterId=0'">
  110. <view class="btn" v-if="item1.recordStatus == 0">继续</view>
  111. </navigator>
  112. </view>
  113. </template>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. </template>
  119. <script>
  120. import { mapGetters } from 'vuex';
  121. export default {
  122. data() {
  123. return {
  124. bankList:[],
  125. goodsCount:{},
  126. id:'',
  127. context1:null,
  128. context2:null,
  129. caculateX:0,
  130. caculateY:0,
  131. };
  132. },
  133. onUnload() {
  134. },
  135. computed: { ...mapGetters(['userInfo']) },
  136. onLoad(option) {
  137. this.id = option.id;
  138. uni.getSystemInfo({
  139. success:(res) => {
  140. var winW = res.screenWidth;
  141. var winH = res.screenHeight;
  142. uni.createSelectorQuery().in(this).select('.canvas').boundingClientRect().exec((newRes)=>{
  143. this.goodsBankQuestionNum();
  144. this.goodsBankDolist();
  145. // this.goodsBankList();
  146. var width = newRes[0].width;
  147. var height = newRes[0].height;
  148. this.caculateX = winW/750;
  149. this.caculateY = winH/1334;
  150. var context1 = uni.createCanvasContext('Canvas1')
  151. this.context1 = context1;
  152. context1.setStrokeStyle("#EEEEEE")
  153. context1.setLineWidth(this.caculateX * 20)
  154. context1.arc(this.caculateX * 90, this.caculateX * 90, this.caculateX * 80, 0, 2 * Math.PI, true)
  155. context1.stroke()
  156. context1.draw()
  157. var context2 = uni.createCanvasContext('Canvas2')
  158. this.context2 = context2;
  159. context2.setStrokeStyle("#EEEEEE")
  160. context2.setLineWidth(this.caculateX * 20)
  161. context2.arc(this.caculateX * 90, this.caculateX * 90, this.caculateX * 80, 0, 2 * Math.PI, false)
  162. context2.stroke()
  163. context2.draw()
  164. })
  165. }
  166. })
  167. },
  168. onShow() {
  169. },
  170. methods: {
  171. goodsBankDolist() {
  172. this.$api.goodsBankDolist({
  173. goodsId:this.id
  174. }).then(res => {
  175. console.log(res)
  176. this.bankList = res.data.data;
  177. })
  178. },
  179. goodsBankList() {
  180. this.$api.goodsBankList({
  181. goodsId:this.id
  182. }).then(res => {
  183. console.log(res)
  184. this.bankList = res.data.data;
  185. })
  186. },
  187. goodsBankQuestionNum(){
  188. this.$api.goodsBankQuestionNum(this.id).then(res => {
  189. this.goodsCount = res.data.data
  190. this.context1.beginPath()
  191. this.context1.setStrokeStyle("#32D74B")
  192. this.context1.setFillStyle('#32D74B')
  193. this.context1.setTextAlign('center')
  194. this.context1.setLineCap('round')
  195. this.context1.setFontSize(this.caculateX * 32)
  196. this.context1.fillText((this.goodsCount.rightNum / this.goodsCount.totalNum * 100).toFixed(2)+'%', this.caculateX * 90, this.caculateX * 90, this.caculateX * 180)
  197. this.context2.save()
  198. this.context2.translate(this.caculateX * 90, this.caculateX * 90)
  199. this.context2.rotate(-90 * Math.PI/180);
  200. this.context1.arc(this.caculateX * 90, this.caculateX * 90, this.caculateX * 80, 0, (this.goodsCount.rightNum / this.goodsCount.totalNum) * 2 * Math.PI, false)
  201. this.context2.restore()
  202. this.context1.stroke()
  203. this.context1.draw()
  204. this.context2.beginPath()
  205. this.context2.setStrokeStyle("#007AFF")
  206. this.context2.setFillStyle("#007AFF")
  207. this.context2.setTextAlign('center')
  208. this.context2.setLineCap('round')
  209. this.context2.setFontSize(this.caculateX * 32)
  210. this.context2.fillText((this.goodsCount.doNum / this.goodsCount.totalNum * 100).toFixed(2)+'%', this.caculateX * 90, this.caculateX * 90, this.caculateX * 180)
  211. this.context2.save()
  212. this.context2.translate(this.caculateX * 90, this.caculateX * 90)
  213. this.context2.rotate(-90 * Math.PI/180);
  214. this.context2.arc(this.caculateX * 90, this.caculateX * 90, this.caculateX * 80, 0, (this.goodsCount.doNum / this.goodsCount.totalNum) * 2 * Math.PI, false)
  215. this.context2.restore()
  216. this.context2.stroke()
  217. this.context2.draw()
  218. })
  219. },
  220. clickModule(id,index) {
  221. if(this.bankList[index].list) {
  222. this.$set(this.bankList[index],'showList',!this.bankList[index].showList)
  223. return;
  224. }
  225. this.$api.goodsChapterDolist({
  226. moduleExamId:id
  227. }).then(res => {
  228. this.$set(this.bankList[index],'showList',true)
  229. this.$set(this.bankList[index],'list',res.data.data)
  230. })
  231. },
  232. changeItem(index1,id,type) {
  233. if(type == 1) {
  234. if(this.bankList[index1].list[index2].list) {
  235. this.$set(this.bankList[index1].list[index2],'showList',!this.bankList[index1].list[index2].showList)
  236. return;
  237. }
  238. this.$api.goodsExamList({
  239. chapterExamId:id
  240. }).then(res => {
  241. this.$set(this.bankList[index1].list[index2],'showList',true)
  242. this.$set(this.bankList[index1].list[index2],'list',res.data.data)
  243. })
  244. } else if(type == 2) {
  245. if(this.bankList[index1].list) {
  246. this.$set(this.bankList[index1],'showList',!this.bankList[index1].showList)
  247. return;
  248. }
  249. this.$api.goodsExamDolist({
  250. chapterExamId:id
  251. }).then(res => {
  252. this.$set(this.bankList[index1],'showList',true)
  253. this.$set(this.bankList[index1],'list',res.data.data)
  254. })
  255. }
  256. }
  257. }
  258. };
  259. </script>
  260. <style >
  261. page{
  262. background-color: #EAEEF1;
  263. }
  264. </style>
  265. <style lang="scss" scope>
  266. .top {
  267. margin:16rpx;
  268. border-radius: 16rpx;
  269. background:#fff;
  270. padding:24rpx;
  271. .title {
  272. font-size: 24rpx;
  273. line-height: 24rpx;
  274. color: #333333;
  275. text {
  276. font-size: 30rpx;
  277. color: #999999;
  278. }
  279. }
  280. .circle-wrap {
  281. margin-top:20rpx;
  282. .circle-list {
  283. display: flex;
  284. .item {
  285. flex:1;
  286. padding-left:30rpx;
  287. canvas {
  288. margin:0 auto;
  289. width:180rpx;
  290. height:180rpx;
  291. }
  292. .text {
  293. text-align: center;
  294. margin-top:16rpx;
  295. font-size: 24rpx;
  296. color: #333333;
  297. }
  298. }
  299. .numbers {
  300. display: flex;
  301. color:#999999;
  302. font-size: 24rpx;
  303. align-items: center;
  304. justify-content: center;
  305. flex-direction: column;
  306. .blue {
  307. margin-bottom:40rpx;
  308. color: #007AFF;
  309. }
  310. }
  311. }
  312. }
  313. }
  314. .courseName{
  315. white-space:nowrap;
  316. overflow:hidden;
  317. text-overflow:ellipsis;
  318. }
  319. .moduleItem{
  320. height: 80rpx;
  321. color: #333333;
  322. font-size: 32rpx;
  323. line-height: 80rpx;
  324. font-weight: bold;
  325. display: flex;
  326. justify-content: space-between;
  327. }
  328. .icon_up{
  329. width: 32rpx;
  330. height: 32rpx;
  331. }
  332. .title-list {
  333. background: #EAEEF1;
  334. padding:16rpx 16rpx 124rpx;
  335. .content {
  336. .list {
  337. background:#fff;
  338. margin-bottom:30rpx;
  339. overflow: hidden;
  340. border-radius: 16rpx;
  341. padding:10rpx 16rpx;
  342. .module {
  343. font-size: 30rpx;
  344. color: #333333;
  345. .icon {
  346. margin-right:10rpx;
  347. }
  348. }
  349. .section {
  350. font-size: 30rpx;
  351. font-family: PingFang SC;
  352. font-weight: bold;
  353. color: #333333;
  354. white-space:nowrap;
  355. overflow:hidden;
  356. text-overflow:ellipsis;
  357. margin: 20rpx 0;
  358. display: flex;
  359. align-items: center;
  360. }
  361. .article {
  362. padding:14rpx 0 10rpx;
  363. display: flex;
  364. align-items: center;
  365. margin-left:40rpx;
  366. font-size: 24rpx;
  367. color: #666666;
  368. border-bottom: 1rpx solid #EEEEEE;
  369. .flex-auto {
  370. font-size: 26rpx;
  371. flex:1;
  372. margin-right:30rpx;
  373. &:nth-last-of-type(1) {
  374. border:0;
  375. }
  376. .desc {
  377. width: 480rpx;
  378. padding:0 14rpx;
  379. margin-top:20rpx;
  380. height: 40rpx;
  381. border: 1px solid #EEEEEE;
  382. border-radius: 16rpx;
  383. font-size: 26rpx;
  384. display: flex;
  385. align-items: center;
  386. .blue {
  387. font-size: 26rpx;
  388. color:#007AFF;
  389. }
  390. .green {
  391. font-size: 26rpx;
  392. color:#32D74B;
  393. }
  394. }
  395. }
  396. .btn {
  397. width: 96rpx;
  398. height: 48rpx;
  399. line-height: 48rpx;
  400. text-align: center;
  401. color:#fff;
  402. font-size: 30rpx;
  403. border-radius:24rpx;
  404. background: #007AFF;
  405. // margin-left:36rpx;
  406. border-radius: 24rpx;
  407. }
  408. }
  409. }
  410. }
  411. }
  412. </style>