record.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="report_content">
  3. <view class="header">
  4. <view class="header_content">
  5. <view class="title">本次{{ type == "exam" ? "测评" : "学习" }}概览</view>
  6. <view class="content">
  7. <view class="content_row">
  8. <view class="main">{{ reportInfo.exam_time }}</view>
  9. <view class="tip">学习时长(分钟)</view>
  10. </view>
  11. <view class="content_row">
  12. <view class="main">{{ reportInfo.isanswer_total + "/" + reportInfo.answer_total }}</view>
  13. <view class="tip">答对题目</view>
  14. </view>
  15. <view class="content_row">
  16. <view class="main">{{ reportInfo.get_score }}</view>
  17. <view class="tip">获得积分</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="content">
  23. <view class="title">答题情况</view>
  24. <view class="content_list">
  25. <view class="conent_main" v-for="(item, index) in queston_list" :key="index">
  26. <view class="item_num">
  27. <view class="item_answer"><icon :type="item.is_answer == 0 ? 'cancel' : 'success'" size="20" /> &nbsp;第{{ index + 1 }}题</view>
  28. <view :style="item.get_score > 0 ? 'color:green' : 'color:red'">+{{ item.get_score }}&nbsp;积分</view>
  29. </view>
  30. <view class="item_title">{{ item.question_title }}</view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="bottom_btn">
  35. <view class="submit_btn defult" @click="_backList">返回课程列表</view>
  36. <view class="submit_btn" @click="_continue">{{ type == "exam" ? "重新练习" : "继续课后评测" }}</view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. reportInfo: {
  45. exam_time: 0,
  46. isanswer_total: 0,
  47. answer_total: 0,
  48. get_score: 0,
  49. },
  50. queston_list: [],
  51. record_id: null,
  52. type: null, // 确保 type 在 data 中定义
  53. };
  54. },
  55. onLoad(params) {
  56. console.log("params:", params); // 获取到query参数
  57. this.record_id = params.record_id;
  58. this.type = params.type;
  59. //分享按钮
  60. uni.showShareMenu({
  61. withShareTicket: true,
  62. menus: ["shareAppMessage", "shareTimeline"],
  63. });
  64. },
  65. onShow() {
  66. this._getRecord(this.type);
  67. this._getAnswerList(this.type);
  68. },
  69. onShareAppMessage(obj) {
  70. return {
  71. title: `999智控终端平台\n学习报告`,
  72. path: `/pages/video/record?type=${this.type}&record_id=${this.record_id}`,
  73. };
  74. },
  75. methods: {
  76. _backList() {
  77. uni.redirectTo({
  78. url: `/pages/video/index`,
  79. });
  80. },
  81. _continue() {
  82. uni.redirectTo({
  83. url: `/pages/video/exam?id=${this.record_id}`,
  84. });
  85. },
  86. _getRecord(type) {
  87. this.$http.request(`api/video_${type}_record/get_report`, { record_id: this.record_id }).then((re) => {
  88. if (re.code == "success") {
  89. console.log(re.data);
  90. this.reportInfo = re.data;
  91. }
  92. });
  93. },
  94. _getAnswerList(type) {
  95. this.$http.request(`api/video_${type}_answer/get_list`, { record_id: this.record_id }).then((re) => {
  96. if (re.code == "success") {
  97. console.log(re.data);
  98. this.queston_list = re.data;
  99. }
  100. });
  101. },
  102. },
  103. };
  104. </script>
  105. <style lang="less" scoped>
  106. .report_content {
  107. .header {
  108. width: 100vw;
  109. padding: 36rpx;
  110. box-sizing: border-box;
  111. .header_content {
  112. height: 360rpx;
  113. width: 100%;
  114. background: linear-gradient(to bottom right, #6765f1, #a556f7);
  115. border-radius: 20rpx;
  116. color: #fff;
  117. padding: 36rpx;
  118. box-sizing: border-box;
  119. .content {
  120. height: calc(100% - 55rpx);
  121. display: flex;
  122. align-items: center;
  123. justify-content: space-between;
  124. .content_row {
  125. display: flex;
  126. flex-direction: column;
  127. align-items: center;
  128. .main {
  129. font-size: 52rpx;
  130. font-weight: bold;
  131. margin-bottom: 20rpx;
  132. }
  133. .tip {
  134. color: #bba6ff;
  135. font-size: 28rpx;
  136. }
  137. }
  138. }
  139. }
  140. }
  141. > .content {
  142. width: 100vw;
  143. padding: 36rpx;
  144. box-sizing: border-box;
  145. > .title {
  146. font-size: 32rpx;
  147. font-weight: bold;
  148. margin-bottom: 36rpx;
  149. }
  150. > .content_list {
  151. width: 100%;
  152. height: calc(100vh - 750rpx);
  153. overflow: auto;
  154. box-sizing: border-box;
  155. display: flex;
  156. flex-direction: column;
  157. gap: 20rpx;
  158. .conent_main {
  159. border: 1px solid #ddd;
  160. box-shadow: 0 2px 4px 0 rgba(204, 204, 204, 0.5); /* 添加背景阴影 */
  161. width: 100%;
  162. padding: 20rpx;
  163. box-sizing: border-box;
  164. border-radius: 6rpx;
  165. display: flex;
  166. flex-direction: column;
  167. gap: 20rpx;
  168. .item_num {
  169. display: flex;
  170. justify-content: space-between;
  171. align-items: center;
  172. }
  173. .item_answer {
  174. display: flex;
  175. align-items: center;
  176. }
  177. }
  178. }
  179. }
  180. .bottom_btn {
  181. position: fixed;
  182. bottom: 0;
  183. left: 0;
  184. width: 100%;
  185. height: 150rpx;
  186. border-top: 4rpx solid #ddd;
  187. display: flex;
  188. align-items: center;
  189. justify-content: space-between;
  190. padding: 0 40rpx;
  191. box-sizing: border-box;
  192. .answer_info {
  193. display: flex;
  194. align-items: baseline;
  195. }
  196. .submit_btn {
  197. background-color: #5045e6;
  198. color: #fff;
  199. font-size: 28rpx;
  200. width: 45%;
  201. height: 80rpx;
  202. line-height: 80rpx;
  203. border-radius: 8rpx;
  204. box-shadow: 2rpx 2rpx 8rpx rgba(0, 0, 0, 0.1);
  205. text-align: center;
  206. &.defult {
  207. background-color: #fff;
  208. color: #333;
  209. }
  210. }
  211. }
  212. }
  213. </style>