course.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <div class="c_box">
  3. <div class="choice_box" v-loading="isloading">
  4. <div class="title" style="display: flex;">
  5. <span style="min-width: fit-content;">{{ tindex + 1 + "、" }}</span>
  6. <span>{{ checkJson.title }}</span>
  7. </div>
  8. <div class="detail" v-if="checkJson.detail" v-html="checkJson.detail"
  9. style="color: #00000099;margin-top: 5px;">
  10. </div>
  11. <div class="choices" v-if="checkJson.courses.length">
  12. <div class="course">
  13. <div class="banner">
  14. <img :src="courseDetail.cover" alt="">
  15. </div>
  16. <div class="content">
  17. <div class="c_c">
  18. <span>课程名字:</span>
  19. <span>{{ courseDetail.title }}</span>
  20. </div>
  21. <div class="c_c">
  22. <span>课程类型:</span>
  23. <span>{{ courseDetail.name ? courseDetail.name : '暂无' }}</span>
  24. </div>
  25. <div class="c_c">
  26. <span>创建人:</span>
  27. <span>{{ courseDetail.username }}</span>
  28. </div>
  29. <div class="c_c">
  30. <span>协作者:</span>
  31. <span>{{ courseDetail.xieName ? courseDetail.xieName : '暂无' }}</span>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="page" v-if="checktype == '1'">
  36. <el-button type="primary" size="mini" :disabled="page == 0" @click="setPage('-1')">上一个</el-button>
  37. <div class="p_page"><span>{{ page + 1 }}</span><span>/</span><span>{{ checkJson.courses.length }}</span>
  38. </div>
  39. <el-button type="primary" size="mini" :disabled="page == (checkJson.courses.length - 1)"
  40. @click="setPage('1')">下一个</el-button>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. export default {
  48. props: {
  49. tindex: {
  50. type: Number
  51. },
  52. cJson: {
  53. type: Object,
  54. },
  55. checktype: {
  56. type: Number,
  57. default: 1
  58. },
  59. see: {
  60. type: Boolean,
  61. default: false
  62. }
  63. },
  64. data() {
  65. return {
  66. option: {
  67. 1: { name: '附件' },
  68. },
  69. userid: this.$route.query.userid,
  70. checkJson: undefined,
  71. progress: 0,
  72. isFinishSize: 0,
  73. proVisible: false,
  74. isAllSize: 0,
  75. wurl: "",
  76. isTong: false,
  77. page: 0,
  78. isloading: false,
  79. courseDetail:{}
  80. }
  81. },
  82. computed: {
  83. },
  84. watch: {
  85. checkJson: {
  86. handler(newValue) {
  87. this.$emit('update:cJson', newValue)
  88. },
  89. deep: true
  90. },
  91. },
  92. methods: {
  93. depthCopy(s) {
  94. return JSON.parse(JSON.stringify(s));
  95. },
  96. openFileBox() {
  97. this.dialogVisiblefile = true
  98. },
  99. setPage(index) {
  100. if (index == '1') {
  101. this.page++
  102. } else if (index == '-1') {
  103. this.page--
  104. }
  105. this.checkJson.answer2 = this.checkJson.courses[this.page]
  106. this.getCourse(this.checkJson.answer2)
  107. },
  108. getCourse(id) {
  109. this.isloading = true
  110. let params = {
  111. cid: id,
  112. };
  113. this.ajax
  114. .get(this.$store.state.api + "getCourseInfoTest", params)
  115. .then((res) => {
  116. this.isloading = false
  117. this.courseDetail = res.data[0][0]
  118. this.courseDetail.cover = JSON.parse(this.courseDetail.cover)[0].url
  119. })
  120. .catch((err) => {
  121. this.isloading = false
  122. console.error(err);
  123. });
  124. }
  125. },
  126. mounted() {
  127. this.checkJson = this.cJson ? this.depthCopy(this.cJson) : undefined
  128. if(this.checkJson.courses.length){
  129. this.page = this.checkJson.courses.indexOf(this.checkJson.answer2)
  130. this.getCourse(this.checkJson.answer2)
  131. }
  132. }
  133. }
  134. </script>
  135. <style scoped>
  136. .c_box {
  137. width: 100%;
  138. position: relative;
  139. }
  140. /* .mask {
  141. position: absolute;
  142. height: 100%;
  143. width: 100%;
  144. z-index: 2;
  145. } */
  146. .choice_box {
  147. white-space: pre-line;
  148. }
  149. .choice_box>.title {
  150. font-weight: bold;
  151. width: 100%;
  152. word-break: break-all;
  153. }
  154. .choice_box>.choices {
  155. margin-top: 10px;
  156. }
  157. .choices > .page{
  158. margin-top: 10px;
  159. display: flex;
  160. align-items: center;
  161. }
  162. .p_page{
  163. margin: 0 10px;
  164. }
  165. .course {
  166. display: flex;
  167. align-items: center;
  168. }
  169. .course > .banner {
  170. width: 200px;
  171. height: 120px;
  172. border-radius: 5px;
  173. overflow: hidden;
  174. border: 1px solid #3896fc;
  175. box-sizing: border-box;
  176. padding: 5px;
  177. margin-right: 15px;
  178. }
  179. .course > .banner > img{
  180. width: 100%;
  181. height: 100%;
  182. object-fit: cover;
  183. }
  184. .course > .content {}
  185. .course > .content > .c_c {}
  186. .course > .content > .c_c + .c_c{
  187. margin-top: 5px;
  188. }
  189. .course > .content > .c_c span:nth-child(1){}
  190. .course > .content > .c_c span:nth-child(2){}
  191. </style>