TaskDetails.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="deatail-area">
  3. <navbar :viewLogo="false" :backPath="'/pages/tabbar/task/index?date='+selectDate"
  4. :title="timeType.replace('任务','')+':'+taskDetailsData.name" />
  5. <view style="height:92rpx;"></view>
  6. <view class="card-box">
  7. <view class="title-box">
  8. <text class="title-big-bold">{{taskDetailsData.course_name}}</text>
  9. <text class="status">
  10. <text class="circle"></text>
  11. <text>{{finishStatus}}</text>
  12. </text>
  13. </view>
  14. <text class="title-small">{{taskDetailsData.cs_item_name}}</text>
  15. <text class="title-small">{{taskDetailsData.cs_item_begin_time}} ~ {{taskDetailsData.cs_item_end_time}}</text>
  16. </view>
  17. <view class="card-box">
  18. <text class="title-big">
  19. {{timeType}} {{taskDetailsData.name}}
  20. </text>
  21. <text class="title-small-bold">{{taskDetailsData.time_space_view_txt}}</text>
  22. <text class="title-small-bold">任务要求</text>
  23. <text class="title-middle">{{taskDetailsData.content}}</text>
  24. <text class="title-small-bold">课件任务</text>
  25. <view class="courseware-box" v-for="(item,i) in taskDetailsData.courseware_list" :key="i"
  26. @click="linkTaskCourseware(item.courseware_id,item.is_finished,item.group_id_selected_info)">
  27. <view class="courseware-main">
  28. <image class="courseware-img" src="../../../static/courseware.png" />
  29. <text class="title-middle">{{item.courseware_name}}</text>
  30. </view>
  31. <uni-icons type="checkmarkempty" v-show="isEnable(item.is_finished)" size="16" color="#3ACB85" />
  32. </view>
  33. </view>
  34. <view class="card-box">
  35. <text class="title-small-bold">给教师留言</text>
  36. <textarea class="student-message" v-model="studentMessage" placeholder="请输入内容" :disabled="isEnable(isFinished)"
  37. :style="{'background-color':isEnable(isFinished)?'#e9e9e9':'#fff'}" />
  38. </view>
  39. <button type="button" class="finished-btn" v-show="!isEnable(isFinished)"
  40. @click="fillMyTaskExecuteInfo_Student">完成任务</button>
  41. </view>
  42. </template>
  43. <script>
  44. import {
  45. GetTaskInfo,
  46. FillMyTaskExecuteInfo_Student,
  47. } from '@/api/exercise.js';
  48. import {
  49. time_type_list,
  50. task_finish_status_list,
  51. isEnable,
  52. } from '@/pages/answer_question/common/data/common.js';
  53. import {
  54. getToken,
  55. } from '@/utils/auth';
  56. export default {
  57. data() {
  58. return {
  59. time_type_list,
  60. task_finish_status_list,
  61. isEnable,
  62. queryData: {
  63. id: '',
  64. is_contain_cs_item_learning_material: 'true',
  65. is_contain_my_execute_info: 'true',
  66. },
  67. taskDetailsData: [],
  68. student_message: '',
  69. selectDate: '',
  70. finishStatus: '',
  71. studentMessage: '',
  72. timeType: '',
  73. isFinished: '',
  74. }
  75. },
  76. onLoad(options) {
  77. this.queryData.id = options.task_id;
  78. this.selectDate = options.date;
  79. this.getTaskInfo();
  80. },
  81. onShow() {
  82. this.getTaskInfo();
  83. },
  84. methods: {
  85. getTaskInfo() {
  86. GetTaskInfo(this.queryData).then((res) => {
  87. if (res.status) {
  88. // console.log('返回信息', res);
  89. this.taskDetailsData = res;
  90. this.finishStatus = task_finish_status_list[res.finish_status].label;
  91. this.studentMessage = res.my_execute_info.student_message;
  92. this.timeType = time_type_list[res.time_type].label;
  93. this.isFinished = res.my_execute_info.is_finished;
  94. }
  95. })
  96. },
  97. fillMyTaskExecuteInfo_Student() {
  98. let data = {
  99. "task_id": this.queryData.id,
  100. "student_message": this.studentMessage,
  101. "is_finished": 'true',
  102. }
  103. FillMyTaskExecuteInfo_Student(data).then((res) => {
  104. if (res.status) {
  105. // console.log('返回信息', res);
  106. location.reload();
  107. }
  108. })
  109. },
  110. //跳转到集成页
  111. linkTaskCourseware(courseware_id, is_finished, group_id_selected_info) {
  112. let access_token = '';
  113. uni.getStorage({
  114. key: 'AccessToken',
  115. success: function(res) {
  116. access_token = res.data;
  117. }
  118. })
  119. const view_mode = isEnable(is_finished) ? 'Result' : 'Answer';
  120. const business_id = this.taskDetailsData.id;
  121. let baseUrl = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '');
  122. // uni.navigateTo({
  123. // url: '/pages/common/ViewCourseware?path=' + baseUrl +
  124. // '/GCLS-Book/#/Integration/Courseware?AppID=Mobile_Task&AccessToken=' + access_token +
  125. // '&ViewMode=' + view_mode + '&CoursewareID=' + courseware_id + '&BusinessID=' + business_id +
  126. // '&CoursewareGroupIDSelectedInfo=' + encodeURIComponent(group_id_selected_info)
  127. // })
  128. let url = baseUrl +
  129. '/GCLS-Book/#/Integration/Courseware?AppID=Mobile_Task&AccessToken=' + access_token +
  130. '&ViewMode=' + view_mode + '&CoursewareID=' + courseware_id + '&BusinessID=' + business_id +
  131. '&CoursewareGroupIDSelectedInfo=' + encodeURIComponent(group_id_selected_info);
  132. window.open(url, 'target');
  133. },
  134. }
  135. }
  136. </script>
  137. <style lang="scss">
  138. .deatail-area {
  139. .card-box {
  140. margin: 16rpx;
  141. background-color: #fff;
  142. border-radius: 16rpx;
  143. display: flex;
  144. flex-direction: column;
  145. align-items: flex-start;
  146. justify-content: center;
  147. row-gap: 16rpx;
  148. padding: 16px;
  149. .title-box {
  150. width: 100%;
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. .status {
  155. color: #3ACB85;
  156. font-size: 15px;
  157. .circle {
  158. display: inline-block;
  159. width: 8px;
  160. height: 8px;
  161. border-radius: 50%;
  162. background-color: #3ACB85;
  163. margin-right: 7px;
  164. }
  165. }
  166. }
  167. .title-big-bold {
  168. font-size: 18px;
  169. font-weight: 600;
  170. }
  171. .title-small {
  172. font-size: 13px;
  173. color: #737373;
  174. }
  175. .title-big {
  176. font-size: 18px;
  177. font-weight: 400;
  178. }
  179. .title-small-bold {
  180. font-size: 13px;
  181. font-weight: 500;
  182. color: #808080;
  183. }
  184. .title-middle {
  185. font-size: 15px;
  186. }
  187. .courseware-box {
  188. display: flex;
  189. align-items: center;
  190. justify-content: space-between;
  191. padding: 16rpx 16rpx 16rpx 36rpx;
  192. width: 70%;
  193. border: 1px solid #DFDFDF;
  194. border-radius: 8rpx;
  195. .courseware-main {
  196. display: flex;
  197. column-gap: 10px;
  198. align-items: center;
  199. .courseware-img {
  200. width: 24px;
  201. height: 24px;
  202. }
  203. }
  204. }
  205. .student-message {
  206. width: calc(100vw - 80px);
  207. padding: 8px 16px;
  208. border: 1px solid #DFDFDF;
  209. border-radius: 8rpx;
  210. height: 136px;
  211. }
  212. }
  213. .finished-btn {
  214. background-color: #306EFF;
  215. color: #fff;
  216. margin: 16rpx;
  217. font-size: 16px;
  218. font-weight: 500;
  219. }
  220. }
  221. </style>