question_report.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <view>
  3. <view class="top">
  4. <view class="title">试卷名称可换行我也不知道最多多少个字</view>
  5. <view class="desc">交卷时间:2021/10/22 17:24</view>
  6. <view class="box">
  7. <view class="left">
  8. <view>100%</view>
  9. <view>正确率</view>
  10. <view>不含简答/案例题</view>
  11. </view>
  12. <view class="right">
  13. <view class="flex up">
  14. <image src="/static/5-4_03.png" mode=""></image>
  15. <view class="text">正确题数</view>
  16. <text class="red">3</text>
  17. </view>
  18. <view class="flex down">
  19. <image src="/static/5-4_03.png" mode=""></image>
  20. <view class="text">错误题数</view>
  21. <text class="green">2</text>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="bottom">
  27. <view class="circle-wrap">
  28. <view class="circle-list">
  29. <view class="item">
  30. <view class="title">
  31. 试卷得分
  32. <text>(不含简答和案例题)</text>
  33. </view>
  34. <canvas class="canvas" canvas-id="Canvas1"></canvas>
  35. </view>
  36. <view class="item">
  37. <view class="title">
  38. 答题时长
  39. </view>
  40. <canvas canvas-id="Canvas2"></canvas>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import { mapGetters } from 'vuex';
  49. export default {
  50. data() {
  51. return {
  52. };
  53. },
  54. onUnload() {
  55. },
  56. computed: { ...mapGetters(['userInfo']) },
  57. onLoad(option) {
  58. },
  59. onShow() {
  60. uni.getSystemInfo({
  61. success:(res) => {
  62. var winW = res.screenWidth;
  63. var winH = res.screenHeight;
  64. uni.createSelectorQuery().in(this).select('.canvas').boundingClientRect().exec((newRes)=>{
  65. var width = newRes[0].width;
  66. var height = newRes[0].height;
  67. var caculateX = winW/750;
  68. var caculateY = winH/1334;
  69. console.log(caculateX)
  70. var context1 = uni.createCanvasContext('Canvas1')
  71. context1.setStrokeStyle("#EEEEEE")
  72. context1.setLineWidth(caculateX * 20)
  73. context1.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, 2 * Math.PI, true)
  74. context1.stroke()
  75. context1.beginPath()
  76. context1.setStrokeStyle("#32D74B")
  77. context1.setFillStyle('#32D74B')
  78. context1.setTextAlign('center')
  79. context1.setTextBaseline('middle')
  80. context1.setLineCap('round')
  81. context1.setFontSize(caculateX * 64)
  82. context1.fillText('60', caculateX * 90, caculateX * 90, caculateX * 180)
  83. context1.setFillStyle('#999999')
  84. context1.setFontSize(caculateX * 20)
  85. context1.fillText('满分100', caculateX * 90, caculateX * 130, caculateX * 180)
  86. context1.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, Math.PI, true)
  87. context1.stroke()
  88. context1.draw()
  89. var context2 = uni.createCanvasContext('Canvas2')
  90. context2.setStrokeStyle("#EEEEEE")
  91. context2.setLineWidth(caculateX * 20)
  92. context2.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, 2 * Math.PI, true)
  93. context2.stroke()
  94. context2.beginPath()
  95. context2.setStrokeStyle("#007AFF")
  96. context2.setFillStyle("#007AFF")
  97. context2.setTextAlign('center')
  98. context1.setTextBaseline('middle')
  99. context2.setLineCap('round')
  100. context2.setFontSize(caculateX * 64)
  101. context2.fillText("12'", caculateX * 90, caculateX * 90, caculateX * 180)
  102. context2.setFillStyle('#999999')
  103. context2.setFontSize(caculateX * 20)
  104. context2.fillText("限时120'", caculateX * 90, caculateX * 130, caculateX * 180)
  105. context2.arc(caculateX * 90, caculateX * 90, caculateX * 80, 0, Math.PI, true)
  106. context2.stroke()
  107. context2.draw()
  108. })
  109. }
  110. })
  111. },
  112. methods: {
  113. }
  114. };
  115. </script>
  116. <style >
  117. page{
  118. background-color: #EAEEF1;
  119. }
  120. </style>
  121. <style lang="scss" scope>
  122. .top {
  123. margin:16rpx 16rpx 0;
  124. border-radius: 16rpx;
  125. padding:40rpx 24rpx 16rpx;
  126. background:#fff;
  127. .title {
  128. font-size: 32rpx;
  129. font-weight: bold;
  130. color: #333333;
  131. }
  132. .desc {
  133. margin-top:20rpx;
  134. font-size: 24rpx;
  135. color: #999999;
  136. }
  137. .box {
  138. margin-top:30rpx;
  139. display: flex;
  140. .left {
  141. width: 250rpx;
  142. height: 176rpx;
  143. background: #F5F5F5;
  144. border-radius: 16rpx;
  145. display: flex;
  146. align-items: center;
  147. justify-content: center;
  148. flex-direction: column;
  149. margin-right:16rpx;
  150. view {
  151. text-align: center;
  152. &:nth-of-type(1) {
  153. font-size: 60rpx;
  154. font-weight: bold;
  155. color: #007AFF;
  156. }
  157. &:nth-of-type(2) {
  158. font-size: 32rpx;
  159. font-weight: bold;
  160. color: #333333;
  161. }
  162. &:nth-of-type(3) {
  163. font-size: 24rpx;
  164. color: #999999;
  165. }
  166. }
  167. }
  168. .right{
  169. flex:1;
  170. display: flex;
  171. flex-direction: column;
  172. justify-content: space-between;
  173. .flex {
  174. background:#F5F5F5;
  175. display: flex;
  176. height: 80rpx;
  177. align-items: center;
  178. padding:0 40rpx;
  179. border-radius: 16rpx;
  180. image {
  181. width: 30rpx;
  182. height: 30rpx;
  183. margin-right:28rpx;
  184. }
  185. .text {
  186. flex:1;
  187. font-size: 30rpx;
  188. color: #666666;
  189. }
  190. text {
  191. font-size: 48rpx;
  192. color: #E12626;
  193. &.red {
  194. color:red;
  195. }
  196. &.green {
  197. color:green;
  198. }
  199. }
  200. }
  201. }
  202. }
  203. }
  204. .bottom {
  205. .circle-wrap {
  206. .circle-list {
  207. display: flex;
  208. .item {
  209. padding:20rpx;
  210. border-radius: 16rpx;
  211. background:#fff;
  212. margin:16rpx;
  213. flex:1;
  214. .title {
  215. font-weight: bold;
  216. font-size: 30rpx;
  217. line-height: 24rpx;
  218. color: #333333;
  219. text {
  220. font-size: 20rpx;
  221. color: #999999;
  222. }
  223. }
  224. canvas {
  225. margin:36rpx auto 0;
  226. width:180rpx;
  227. height:180rpx;
  228. }
  229. .text {
  230. text-align: center;
  231. margin-top:16rpx;
  232. font-size: 24rpx;
  233. color: #333333;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. </style>