video_course.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template >
  2. <div class="video_contianer">
  3. <el-card>
  4. <div slot="header" >
  5. <mx-search-group justify="space-between" :span="6" v-model="form.sectionName" placeholder="请输入搜索内容" @search="searchVideo">
  6. <div class="spans">
  7. <span
  8. v-for="item in videoType"
  9. :key="item.code"
  10. class="pointer"
  11. :class="typeActive == item.code ? 'active_text' : ''"
  12. @click="toggleType(item.code)"
  13. >{{ item.label }}</span
  14. >
  15. </div>
  16. </mx-search-group>
  17. <!-- <div class="search_btn" style="float: right; overflow: auto">-->
  18. <!-- <input-->
  19. <!-- v-model="form.sectionName"-->
  20. <!-- @keyup.enter="searchVideo"-->
  21. <!-- placeholder="请输入搜索内容"-->
  22. <!-- />-->
  23. <!-- <img src="@/assets/images/icon_search.png" @click="searchVideo" />-->
  24. <!-- </div>-->
  25. </div>
  26. <div class="radio_contianer">
  27. <div style="margin-bottom: 16px">
  28. <span>科目</span>
  29. <el-radio-group v-model="form.course" @change="getGrade" size="mini">
  30. <el-radio-button
  31. :label="item.code"
  32. v-for="item in subjects"
  33. :key="item.code"
  34. >{{ item.label }}</el-radio-button
  35. >
  36. </el-radio-group>
  37. </div>
  38. <div style="margin-bottom: 16px">
  39. <span>年级</span>
  40. <el-radio-group v-model="form.grade" @change="getVersion" size="mini">
  41. <el-radio-button
  42. :label="item.code"
  43. v-for="item in grade"
  44. :key="item.code"
  45. >{{ item.label }}</el-radio-button
  46. >
  47. </el-radio-group>
  48. </div>
  49. <div style="margin-bottom: 16px" v-if="version.length > 0">
  50. <span>版本</span>
  51. <el-radio-group
  52. v-model="form.version"
  53. size="mini"
  54. @change="toggleCondition"
  55. >
  56. <el-radio-button
  57. :label="item.code"
  58. v-for="item in version"
  59. :key="item.code"
  60. >{{ item.label }}</el-radio-button
  61. >
  62. </el-radio-group>
  63. </div>
  64. <div style="margin-bottom: 16px" v-if="packList.length > 0">
  65. <span>分类</span>
  66. <el-radio-group
  67. v-model="form.pack"
  68. size="mini"
  69. @change="togglePack($event)"
  70. >
  71. <el-radio-button
  72. :label="item.value"
  73. v-for="item in packList"
  74. :key="item.code"
  75. >{{ item.label }}</el-radio-button
  76. >
  77. </el-radio-group>
  78. </div>
  79. </div>
  80. </el-card>
  81. <!-- 视频主体 -->
  82. <el-card class="video_content" v-if="videoList.length > 0">
  83. <el-row :span="24">
  84. <el-col
  85. :span="6"
  86. class="video_item"
  87. v-for="item in videoList"
  88. :key="item.id"
  89. >
  90. <img
  91. :src="item.img"
  92. alt=""
  93. @click="
  94. toVideoDetail(
  95. item.pack_id,
  96. item.chapter_id,
  97. item.id,
  98. item.section_aliId,
  99. item.aliIdType
  100. )
  101. "
  102. />
  103. <p>{{ item.section_name }}</p>
  104. </el-col>
  105. </el-row>
  106. <!-- 分页 -->
  107. <div class="split_page">
  108. <pagination
  109. v-show="total > 0"
  110. :total="total"
  111. :page.sync="form.pageNum"
  112. :limit.sync="form.pageSize"
  113. :pageSizes="[16,32]"
  114. @pagination="getVideoList"
  115. />
  116. </div>
  117. </el-card>
  118. <evaluation-empty v-if="videoList.length == 0" />
  119. </div>
  120. </template>
  121. <script>
  122. import {
  123. videoSubjects,
  124. videoType,
  125. videoGrades,
  126. videoVersions,
  127. packList,
  128. videoList,
  129. videoInfo,
  130. } from "@/api/webApi/webVideo";
  131. import MxSearchGroup from '@/components/MxSearch/mx-search-group'
  132. import FormSearch from "@/components/formSearch";
  133. export default {
  134. components: {MxSearchGroup },
  135. data() {
  136. return {
  137. input: "",
  138. typeActive: 0,
  139. videoType: [],
  140. form: {
  141. course: "", // 科目
  142. subject: "", // 大类
  143. grade: "", // 年级
  144. version: "", // 版本
  145. pageNum: 1,
  146. pageSize: 16,
  147. pack: 0,
  148. sectionName: "",
  149. },
  150. subjects: [], // 课程
  151. grade: [], // 年级
  152. version: [], // 版本
  153. packList: [], // 分类
  154. total: 0,
  155. packNewList: [],
  156. videoList: [], // 视频列表
  157. };
  158. },
  159. methods: {
  160. tohandle(code) {
  161. console.log(code);
  162. },
  163. toVideoDetail(id, chapter_id, childrenId, section_aliId, aliIdType) {
  164. this.$router.push({
  165. path: "/video_course/detail",
  166. query: {
  167. packId: id,
  168. chapter_id: chapter_id,
  169. childrenId: childrenId,
  170. section_aliId,
  171. aliIdType: aliIdType
  172. },
  173. });
  174. },
  175. searchVideo() {
  176. this.getVideoList();
  177. },
  178. // 获取视频课程大类
  179. getVideoType() {
  180. videoType().then((res) => {
  181. this.videoType = res.rows;
  182. if (res.rows.length > 0) {
  183. this.toggleType(res.rows[0].code);
  184. }
  185. });
  186. },
  187. // 切换大类获取科目
  188. toggleType(params) {
  189. this.typeActive = params;
  190. this.form.subject = params;
  191. let { subject } = this.form;
  192. // 获取科目
  193. videoSubjects({ subject }).then((res) => {
  194. this.subjects = res.rows;
  195. if (res.rows.length > 0) {
  196. this.form.course = res.rows[0].code;
  197. }
  198. // 获取年级
  199. this.getGrade();
  200. });
  201. },
  202. // 获取年级
  203. getGrade() {
  204. let { subject, course } = this.form;
  205. videoGrades({ subject, course }).then((res) => {
  206. console.log(JSON.stringify(res.rows));
  207. this.grade = res.rows;
  208. if (res.rows.length > 0) {
  209. this.form.grade = res.rows[0].code;
  210. }
  211. this.getVersion();
  212. });
  213. },
  214. // 获取版本
  215. getVersion() {
  216. let { subject, course, grade } = this.form;
  217. videoVersions({ subject, course, grade }).then((res) => {
  218. let resArr = res.rows.filter((item) => {
  219. return item != null;
  220. });
  221. if (resArr.length > 0) {
  222. this.version = resArr;
  223. this.form.version = this.version[0].code;
  224. this.getPack();
  225. } else {
  226. this.version = []
  227. this.form.version = ''
  228. this.videoList = []
  229. }
  230. });
  231. },
  232. // 获取包分类
  233. getPack() {
  234. packList(this.form).then((res) => {
  235. if (res.rows.length > 0) {
  236. this.form.pack = res.rows[0].value;
  237. this.packList = res.rows;
  238. this.getVideoList();
  239. } else {
  240. this.packList = []
  241. this.form.pack = ''
  242. this.videoList = []
  243. }
  244. });
  245. },
  246. // 获取视频列表
  247. getVideoList() {
  248. videoList(this.form).then((res) => {
  249. console.log(res);
  250. this.total = res.total;
  251. this.videoList = res.rows;
  252. });
  253. },
  254. togglePack(pack) {
  255. this.form.pack = pack;
  256. this.getVideoList();
  257. },
  258. toggleCondition(code) {
  259. this.form.version = code;
  260. this.getPack();
  261. }
  262. },
  263. created() {
  264. this.getVideoType();
  265. },
  266. };
  267. </script>
  268. <style scoped>
  269. .el-card {
  270. margin-bottom: 32px;
  271. }
  272. .video_contianer {
  273. padding: 20px;
  274. }
  275. .spans {
  276. margin-left: 10px;
  277. }
  278. .spans > span {
  279. height: 100%;
  280. display: inline-block;
  281. padding: 6px 19px;
  282. border-radius: 16px;
  283. font-size: 14px;
  284. font-family: PingFangSC-Regular, PingFang SC;
  285. font-weight: 400;
  286. margin-right: 8px;
  287. border: 1px solid #eee;
  288. }
  289. .active_text {
  290. background: #47c6a2;
  291. color: white;
  292. }
  293. .search_btn {
  294. display: flex;
  295. flex-direction: row;
  296. align-items: center;
  297. }
  298. .search_btn input {
  299. border: 0;
  300. height: 100%;
  301. }
  302. .search_btn input:focus {
  303. outline: 0;
  304. }
  305. .search_btn img {
  306. cursor: pointer;
  307. }
  308. .radio_contianer {
  309. margin-top: 24px;
  310. }
  311. .radio_contianer span {
  312. font-size: 14px;
  313. font-family: PingFangSC-Regular, PingFang SC;
  314. font-weight: 400;
  315. color: #232323;
  316. line-height: 20px;
  317. height: 20px;
  318. margin-right: 16px;
  319. }
  320. .radio_contianer .el-radio-button {
  321. margin-right: 8px;
  322. }
  323. .video_content p {
  324. margin: 0;
  325. padding: 0;
  326. text-align: left;
  327. height: 27px;
  328. font-size: 14px;
  329. font-family: PingFangSC-Regular, PingFang SC;
  330. font-weight: 400;
  331. color: #343434;
  332. line-height: 20px;
  333. margin-top: 11px;
  334. }
  335. .video_item > img {
  336. cursor: pointer;
  337. }
  338. .video_content .el-col {
  339. margin-bottom: 42px;
  340. }
  341. .video_item > img {
  342. width: 100%;
  343. padding-right: 22px;
  344. }
  345. </style>
  346. <style >
  347. .radio_contianer .el-radio-button__inner {
  348. border-left: 1px solid #dcdfe6;
  349. }
  350. .radio_contianer .el-radio-button:first-child:last-child .el-radio-button__inner {
  351. border-radius: 16px;
  352. }
  353. .radio_contianer .el-radio-button .el-radio-button__inner {
  354. border-radius: 16px;
  355. }
  356. .split_page .el-pager > li {
  357. border-radius: 50%;
  358. }
  359. </style>