question_statistics.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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">已答 65</view>
  20. <view>总数 650</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,index) in outline">
  28. <view class="section" :data-index="index" @click="changeItem" :class="{up:!item1.showList}">
  29. 2Z106010 施工承发包的模式-2Z106020 施工合同...
  30. </view>
  31. <view class="article" v-if="item1.showList" v-for="(article,index1) in item1.list">
  32. <view class="flex-auto">
  33. <view class="tit">施工承发包模式-施工合同与物资采购合同二</view>
  34. <view class="desc">
  35. <view class="flex-auto">
  36. 正确率
  37. <text class="green">65%</text>
  38. </view>
  39. <view class="flex-auto">
  40. 已完成
  41. <text class="blue">65%</text>
  42. </view>
  43. </view>
  44. </view>
  45. <navigator url="/pages2/bank/questionBank">
  46. <view v-if="index1 == 0" class="btn">
  47. 做题
  48. </view>
  49. <view v-if="index1 == 1" class="btn">
  50. 继续
  51. </view>
  52. </navigator>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import { mapGetters } from 'vuex';
  61. export default {
  62. data() {
  63. return {
  64. outline:[{
  65. list:[1,2,3],
  66. showList:false,
  67. },{
  68. list:[1,2,3],
  69. showList:false,
  70. },{
  71. list:[1,2,3],
  72. showList:false,
  73. },{
  74. list:[1,2,3],
  75. showList:false,
  76. }]
  77. };
  78. },
  79. onUnload() {
  80. },
  81. computed: { ...mapGetters(['userInfo']) },
  82. onLoad(option) {
  83. },
  84. onShow() {
  85. uni.getSystemInfo({
  86. success:(res) => {
  87. var winW = res.screenWidth;
  88. var winH = res.screenHeight;
  89. uni.createSelectorQuery().in(this).select('.canvas').boundingClientRect().exec((newRes)=>{
  90. var width = newRes[0].width;
  91. var height = newRes[0].height;
  92. var caculateX = winW/750;
  93. var caculateY = winH/1334;
  94. console.log(caculateX)
  95. var context1 = uni.createCanvasContext('Canvas1')
  96. context1.setStrokeStyle("#EEEEEE")
  97. context1.setLineWidth(caculateX * 20)
  98. context1.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, 2 * Math.PI, true)
  99. context1.stroke()
  100. context1.beginPath()
  101. context1.setStrokeStyle("#32D74B")
  102. context1.setFillStyle('#32D74B')
  103. context1.setTextAlign('center')
  104. context1.setLineCap('round')
  105. context1.setFontSize(caculateX * 32)
  106. context1.fillText('10%', caculateX * 90, caculateX * 90, caculateX * 180)
  107. context1.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, Math.PI, true)
  108. context1.stroke()
  109. context1.draw()
  110. var context2 = uni.createCanvasContext('Canvas2')
  111. context2.setStrokeStyle("#EEEEEE")
  112. context2.setLineWidth(caculateX * 20)
  113. context2.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, 2 * Math.PI, true)
  114. context2.stroke()
  115. context2.beginPath()
  116. context2.setStrokeStyle("#007AFF")
  117. context2.setFillStyle("#007AFF")
  118. context2.setTextAlign('center')
  119. context2.setLineCap('round')
  120. context2.setFontSize(caculateX * 32)
  121. context2.fillText('10%', caculateX * 90, caculateX * 90, caculateX * 180)
  122. context2.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, Math.PI, true)
  123. context2.stroke()
  124. context2.draw()
  125. })
  126. }
  127. })
  128. },
  129. methods: {
  130. changeItem(e) {
  131. let index = e.currentTarget.dataset.index
  132. this.outline.forEach((arrItem,i) => {
  133. if(i == index) {
  134. arrItem.showList = !arrItem.showList
  135. }
  136. })
  137. }
  138. }
  139. };
  140. </script>
  141. <style >
  142. page{
  143. background-color: #EAEEF1;
  144. }
  145. </style>
  146. <style lang="scss" scope>
  147. .top {
  148. margin:16rpx;
  149. border-radius: 16rpx;
  150. background:#fff;
  151. padding:24rpx;
  152. .title {
  153. font-size: 24rpx;
  154. line-height: 24rpx;
  155. color: #333333;
  156. text {
  157. font-size: 30rpx;
  158. color: #999999;
  159. }
  160. }
  161. .circle-wrap {
  162. margin-top:20rpx;
  163. .circle-list {
  164. display: flex;
  165. .item {
  166. flex:1;
  167. padding-left:30rpx;
  168. canvas {
  169. margin:0 auto;
  170. width:180rpx;
  171. height:180rpx;
  172. }
  173. .text {
  174. text-align: center;
  175. margin-top:16rpx;
  176. font-size: 24rpx;
  177. color: #333333;
  178. }
  179. }
  180. .numbers {
  181. display: flex;
  182. color:#999999;
  183. font-size: 24rpx;
  184. align-items: center;
  185. justify-content: center;
  186. flex-direction: column;
  187. .blue {
  188. margin-bottom:40rpx;
  189. color: #007AFF;
  190. }
  191. }
  192. }
  193. }
  194. }
  195. .title-list {
  196. background: #EAEEF1;
  197. padding:16rpx 16rpx 124rpx;
  198. .content {
  199. .list {
  200. background:#fff;
  201. margin-bottom:30rpx;
  202. overflow: hidden;
  203. border-radius: 16rpx;
  204. padding:10rpx 16rpx;
  205. .section {
  206. padding:30rpx 0;
  207. border-bottom: 1rpx solid #EEEEEE;
  208. font-size: 24rpx;
  209. color: #666666;
  210. &::before {
  211. content:'^';
  212. display: inline-block;
  213. margin-right:20rpx;
  214. }
  215. &.up {
  216. border:0;
  217. &::before {
  218. transform: rotate(180deg);
  219. }
  220. }
  221. }
  222. .article {
  223. padding:24rpx 0 10rpx;
  224. display: flex;
  225. align-items: center;
  226. margin-left:88rpx;
  227. font-size: 24rpx;
  228. color: #666666;
  229. border-bottom: 1rpx solid #EEEEEE;
  230. .flex-auto {
  231. flex:1;
  232. margin-right:30rpx;
  233. .desc {
  234. width: 480rpx;
  235. padding:0 14rpx;
  236. margin-top:20rpx;
  237. height: 40rpx;
  238. border: 1px solid #EEEEEE;
  239. border-radius: 16rpx;
  240. font-size: 26rpx;
  241. display: flex;
  242. align-items: center;
  243. .blue {
  244. font-size: 26rpx;
  245. color:#007AFF;
  246. }
  247. .green {
  248. font-size: 26rpx;
  249. color:#32D74B;
  250. }
  251. }
  252. }
  253. .btn {
  254. width: 96rpx;
  255. height: 48rpx;
  256. line-height: 48rpx;
  257. text-align: center;
  258. color:#fff;
  259. font-size: 30rpx;
  260. border-radius:24rpx;
  261. background: #007AFF;
  262. border-radius: 24rpx;
  263. }
  264. &:nth-last-of-type(1) {
  265. border:0;
  266. }
  267. &.active {
  268. color:#007AFF;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. </style>