video_course.vue 9.2 KB

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