LiveCourse.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. <template>
  2. <div class="manage-root recorded-manage">
  3. <Header />
  4. <div class="manage-root-contain">
  5. <nav-menu class="manage-root-contain-left" :activeMenuIndex="activeMenuIndex"></nav-menu>
  6. <div class="manage-root-contain-right personnel-manage-right">
  7. <breadcrumb :breadcrumbList="breadcrumbList" class="breadcrumb-box"></breadcrumb>
  8. <div class="personal-inner">
  9. <div class="common-title-box">
  10. <h3>直播课</h3>
  11. <div class="btn-box">
  12. <el-button type="primary" size="small" @click="handleEdit">创建课程</el-button>
  13. </div>
  14. </div>
  15. <div class="search-box">
  16. <div class="search-item">
  17. <label>搜索</label>
  18. <el-input
  19. placeholder="输入搜索内容"
  20. v-model="searchInput">
  21. <i slot="suffix" class="el-input__icon el-icon-search" @click="getList" style="cursor: pointer;"></i>
  22. </el-input>
  23. </div>
  24. <div class="search-item">
  25. <label>状态</label>
  26. <el-select v-model="searchStatus" @change="getList" placeholder="请选择">
  27. <el-option
  28. v-for="item in searchStatusList"
  29. :key="item.value"
  30. :label="item.label"
  31. :value="item.value">
  32. </el-option>
  33. </el-select>
  34. </div>
  35. <div class="search-item">
  36. <label>学段</label>
  37. <el-select v-model="searchStudy" @change="getList" placeholder="请选择">
  38. <el-option
  39. v-for="item in studyList"
  40. :key="item.value"
  41. :label="item.label"
  42. :value="item.value">
  43. </el-option>
  44. </el-select>
  45. </div>
  46. </div>
  47. <el-table
  48. class="search-table"
  49. :data="tableData"
  50. style="width: 100%"
  51. :max-height="tableHeight">
  52. <el-table-column
  53. type="index"
  54. label="#"
  55. sortable
  56. width="64">
  57. </el-table-column>
  58. <el-table-column
  59. prop="title"
  60. label="名称"
  61. sortable
  62. min-width="128">
  63. </el-table-column>
  64. <el-table-column
  65. prop="teacher"
  66. label="教师"
  67. width="80"
  68. sortable>
  69. <template slot-scope="scope">
  70. <p class="teacher-list">
  71. {{formatterTracher(scope.row)}}
  72. </p>
  73. </template>
  74. </el-table-column>
  75. <el-table-column
  76. prop="study"
  77. label="学段"
  78. width="80"
  79. sortable>
  80. <template slot-scope="scope">
  81. {{formatterStudy(scope.row)}}
  82. </template>
  83. </el-table-column>
  84. <el-table-column
  85. prop="price"
  86. label="价格"
  87. width="154"
  88. sortable>
  89. <template slot-scope="scope">
  90. <span class="currectPrice">¥{{scope.row.price | cutMoneyFiter}}</span>
  91. <span class="oldPrice">(¥{{scope.row.oldPrice | cutMoneyFiter}})</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column
  95. prop="status"
  96. label="状态"
  97. width="104" >
  98. <template slot-scope="scope">
  99. <div class="status-box">
  100. <span :style="{background:statusList[scope.row.status].bg}"></span>
  101. <b :style="{color:statusList[scope.row.status].color}">{{statusList[scope.row.status].text}}</b>
  102. </div>
  103. </template>
  104. </el-table-column>
  105. <el-table-column
  106. prop="creator"
  107. label="创建人"
  108. min-width="80"
  109. sortable>
  110. </el-table-column>
  111. <el-table-column
  112. prop="data"
  113. label="创建时间"
  114. sortable
  115. width="160">
  116. </el-table-column>
  117. <el-table-column
  118. fixed="right"
  119. label="操作"
  120. width="220">
  121. <template slot-scope="scope">
  122. <el-button
  123. @click.native.prevent="handleLookInfo(scope.row)"
  124. type="text"
  125. size="small"
  126. class="primary-btn">
  127. 信息
  128. </el-button>
  129. <el-button
  130. @click.native.prevent="handleEdit(scope.row)"
  131. type="text"
  132. size="small"
  133. class="primary-btn">
  134. 编辑
  135. </el-button>
  136. <el-button
  137. @click.native.prevent="handleUp(scope.row, scope.$index)"
  138. type="text"
  139. size="small"
  140. class="primary-btn"
  141. v-if="scope.row.status==='0'">
  142. 上架
  143. </el-button>
  144. <el-button
  145. @click.native.prevent="handleUp(scope.row, scope.$index)"
  146. type="text"
  147. size="small"
  148. class="red-btn"
  149. v-else-if="scope.row.status==='1'">
  150. 下架
  151. </el-button>
  152. <el-button
  153. @click.native.prevent="handleDelete(scope.row, scope.$index)"
  154. type="text"
  155. size="small"
  156. class="red-btn">
  157. 删除
  158. </el-button>
  159. </template>
  160. </el-table-column>
  161. </el-table>
  162. <el-pagination
  163. background
  164. @size-change="handleSizeChange"
  165. @current-change="handleCurrentChange"
  166. :current-page="pageNumber"
  167. :page-sizes="[10, 20, 30, 40]"
  168. :page-size="pageSize"
  169. layout="total, prev, pager, next, sizes, jumper"
  170. :total="tableData.length">
  171. </el-pagination>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. </template>
  177. <script>
  178. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  179. //例如:import 《组件名称》from ‘《组件路径》';
  180. import Header from "../../../components/Header.vue";
  181. import NavMenu from "../../../components/NavMenu.vue"
  182. import Breadcrumb from '../../../components/Breadcrumb.vue';
  183. import { cutMoneyFiter } from '@/utils/defined';
  184. export default {
  185. //import引入的组件需要注入到对象中才能使用
  186. components: { Header, NavMenu, Breadcrumb },
  187. props: {},
  188. filters:{
  189. cutMoneyFiter
  190. },
  191. data() {
  192. //这里存放数据
  193. return {
  194. activeMenuIndex: "live_course",
  195. breadcrumbList:[
  196. {
  197. icon:'file-list-line',
  198. url:'',
  199. text:''
  200. },
  201. {
  202. icon:'',
  203. url:'',
  204. notLink: true,
  205. text:'内容管理'
  206. },
  207. {
  208. icon:'',
  209. url:'',
  210. notLink: true,
  211. text:'课程管理'
  212. },
  213. {
  214. icon:'',
  215. url:'',
  216. text:'直播课'
  217. }
  218. ],
  219. searchInput:'',
  220. searchStatus: '',
  221. searchStudy: '',
  222. searchStatusList:[
  223. {
  224. value:'',
  225. label:'全部'
  226. }
  227. ],
  228. studyList:[
  229. {
  230. value:'',
  231. label:'全部'
  232. },
  233. {
  234. value:'0',
  235. label:'初一'
  236. },
  237. {
  238. value:'1',
  239. label:'初二'
  240. },
  241. {
  242. value:'2',
  243. label:'初三'
  244. },
  245. {
  246. value:'3',
  247. label:'高一'
  248. }
  249. ],
  250. statusList:{
  251. '1':{
  252. text:'已上架',
  253. bg:'#165DFF',
  254. color:''
  255. },
  256. '0':{
  257. text:'未上架',
  258. bg:'#F53F3F',
  259. color:''
  260. }
  261. },
  262. tableData:[
  263. {
  264. id:'1',
  265. title:'高考特辑',
  266. teacher:['张老师','李老师'],
  267. study:'2',
  268. type:'0',
  269. price:'12',
  270. oldPrice:'16',
  271. status:'1',
  272. creator:'张三',
  273. data:'2018-02-03'
  274. },
  275. {
  276. id:'1',
  277. title:'高考特辑',
  278. teacher:['张老师','李老师'],
  279. study:'1',
  280. type:'1',
  281. price:'12',
  282. oldPrice:'16',
  283. status:'0',
  284. creator:'张三',
  285. data:'2018-02-03'
  286. },
  287. {
  288. id:'1',
  289. title:'高考特辑',
  290. teacher:['张老师','李老师'],
  291. study:'2',
  292. type:'0',
  293. price:'12',
  294. oldPrice:'16',
  295. status:'0',
  296. creator:'张三',
  297. data:'2018-02-03'
  298. },
  299. {
  300. id:'1',
  301. title:'高考特辑',
  302. teacher:['张老师','李老师'],
  303. study:'2',
  304. type:'0',
  305. price:'12',
  306. oldPrice:'16',
  307. status:'1',
  308. creator:'张三',
  309. data:'2018-02-03'
  310. },
  311. {
  312. id:'1',
  313. title:'高考特辑',
  314. teacher:['张老师','李老师'],
  315. study:'2',
  316. type:'0',
  317. price:'12',
  318. oldPrice:'16',
  319. status:'1',
  320. creator:'张三',
  321. data:'2018-02-03'
  322. },
  323. {
  324. id:'1',
  325. title:'高考特辑',
  326. teacher:['张老师','李老师'],
  327. study:'2',
  328. type:'0',
  329. price:'12',
  330. oldPrice:'16',
  331. status:'1',
  332. creator:'张三',
  333. data:'2018-02-03'
  334. },
  335. {
  336. id:'1',
  337. title:'高考特辑',
  338. teacher:['张老师','李老师'],
  339. study:'2',
  340. type:'0',
  341. price:'12',
  342. oldPrice:'16',
  343. status:'1',
  344. creator:'张三',
  345. data:'2018-02-03'
  346. },
  347. {
  348. id:'1',
  349. title:'高考特辑',
  350. teacher:['张老师','李老师'],
  351. study:'2',
  352. type:'0',
  353. price:'12',
  354. oldPrice:'16',
  355. status:'1',
  356. creator:'张三',
  357. data:'2018-02-03'
  358. },
  359. {
  360. id:'1',
  361. title:'高考特辑',
  362. teacher:['张老师','李老师'],
  363. study:'2',
  364. type:'0',
  365. price:'12',
  366. oldPrice:'16',
  367. status:'1',
  368. creator:'张三',
  369. data:'2018-02-03'
  370. },
  371. {
  372. id:'1',
  373. title:'高考特辑',
  374. teacher:['张老师','李老师'],
  375. study:'2',
  376. type:'0',
  377. price:'12',
  378. oldPrice:'16',
  379. status:'1',
  380. creator:'张三',
  381. data:'2018-02-03'
  382. },
  383. {
  384. id:'1',
  385. title:'高考特辑',
  386. teacher:['张老师','李老师'],
  387. study:'2',
  388. type:'0',
  389. price:'12',
  390. oldPrice:'16',
  391. status:'1',
  392. creator:'张三',
  393. data:'2018-02-03'
  394. },
  395. {
  396. userName:'赵萸艳',
  397. realName:'赵萸艳',
  398. sex:'1',
  399. type:'4', // 0 管理员 1 平台管理员 2 内容管理员 3 财务管理员 4 兑换码管理员
  400. email:'a.ghwrgoh@hlfh.nu',
  401. phone:'13273549500',
  402. status:'0',
  403. data:'2018-02-03',
  404. },
  405. ],
  406. pageSize: window.localStorage.getItem('pageSize')?Number(window.localStorage.getItem('pageSize')):10,
  407. pageNumber: window.localStorage.getItem('pageNumber')?Number(window.localStorage.getItem('pageNumber')):1,
  408. tableHeight: "" // 表格高度
  409. }
  410. },
  411. //计算属性 类似于data概念
  412. computed: {
  413. },
  414. //监控data中数据变化
  415. watch: {},
  416. //方法集合
  417. methods: {
  418. // 查询列表
  419. getList(){
  420. },
  421. // 处理老师
  422. formatterTracher(row){
  423. let teacher = ''
  424. if(row.teacher){
  425. teacher = row.teacher.join()
  426. }
  427. return teacher
  428. },
  429. // 处理学段
  430. formatterStudy(row){
  431. let studyCn = ''
  432. let list = this.studyList
  433. if(row.study){
  434. for(let i=0;i<list.length;i++){
  435. if(row.study===list[i].value){
  436. studyCn = list[i].label
  437. }
  438. }
  439. }else{
  440. studyCn = '未知'
  441. }
  442. return studyCn
  443. },
  444. // 创建机构或者编辑信息
  445. handleEdit(row){
  446. // 根据登录用户判断当前用户是不是超管 在table里加上disabled
  447. // 点击时记录页码和每页条数
  448. window.localStorage.setItem('pageSize',this.pageSize)
  449. window.localStorage.setItem('pageNumber',this.pageNumber)
  450. this.$router.push({
  451. path: "/createLive",
  452. query: {
  453. id: row?row.id:''
  454. },
  455. });
  456. },
  457. // 信息
  458. handleLookInfo(row){
  459. window.localStorage.setItem('pageSize',this.pageSize)
  460. window.localStorage.setItem('pageNumber',this.pageNumber)
  461. this.$router.push({
  462. path: "/peopleList",
  463. query: {
  464. id: row?row.id:''
  465. },
  466. });
  467. },
  468. // 停用 启用
  469. handleUp(row, index) {
  470. let Mname = "book-book_manager-SetPublishStatusForBook";
  471. let updataData = JSON.parse(JSON.stringify(row));
  472. let data = {
  473. book_id: row.id
  474. };
  475. if (row.publish_status == 0) {
  476. // 下架状态
  477. data.publish_status = 1;
  478. updataData.publish_status = 1;
  479. } else if (row.publish_status == 1) {
  480. data.publish_status = 0;
  481. updataData.publish_status = 0;
  482. }
  483. // getContent(Mname, data).then(res => {
  484. // this.$message.success("操作成功");
  485. // this.$set(this.tableData, index, updataData);
  486. // });
  487. },
  488. // 删除
  489. handleDelete(row){
  490. this.$confirm('确定删除吗?', '提示', {
  491. confirmButtonText: '确定',
  492. cancelButtonText: '取消',
  493. type: 'warning'
  494. }).then(() => {
  495. this.$message({
  496. type: 'success',
  497. message: '删除成功!'
  498. });
  499. }).catch(() => {
  500. this.$message({
  501. type: 'info',
  502. message: '已取消删除'
  503. });
  504. });
  505. },
  506. handleSizeChange(val) {
  507. this.pageSize = val
  508. },
  509. handleCurrentChange(val) {
  510. this.pageNumber = val
  511. },
  512. //计算table高度(动态设置table高度)
  513. getTableHeight() {
  514. let tableH = 370; //距离页面下方的高度
  515. let tableHeightDetil = window.innerHeight - tableH;
  516. if (tableHeightDetil <= 300) {
  517. this.tableHeight = 300;
  518. } else {
  519. this.tableHeight = window.innerHeight - tableH;
  520. }
  521. },
  522. },
  523. //生命周期 - 创建完成(可以访问当前this实例)
  524. created() {
  525. this.getTableHeight();
  526. },
  527. //生命周期 - 挂载完成(可以访问DOM元素)
  528. mounted() {
  529. },
  530. //生命周期-创建之前
  531. beforeCreated() { },
  532. //生命周期-挂载之前
  533. beforeMount() { },
  534. //生命周期-更新之前
  535. beforUpdate() { },
  536. //生命周期-更新之后
  537. updated() { },
  538. //生命周期-销毁之前
  539. beforeDestory() { },
  540. //生命周期-销毁完成
  541. destoryed() { },
  542. //如果页面有keep-alive缓存功能,这个函数会触发
  543. activated() { }
  544. }
  545. </script>
  546. <style lang="scss" scoped>
  547. /* @import url(); 引入css类 */
  548. .teacher-list{
  549. margin: 0;
  550. overflow:hidden;
  551. text-overflow:ellipsis;
  552. white-space: nowrap;
  553. }
  554. .currectPrice{
  555. color: #D85555;
  556. font-weight: 500;
  557. margin-right: 4px;
  558. }
  559. .oldPrice{
  560. color: #A7A7A7;
  561. font-weight: 500;
  562. }
  563. </style>