record.vue 6.2 KB

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