appPage.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <div>
  3. <!-- 搜索标题 -->
  4. <div @click="openTeaching('create')"
  5. class='newBand'>新建</div>
  6. <!-- 搜索标题 -->
  7. <save-form :inline="true"
  8. class="searchForm"
  9. saveKey="contentAppPage"
  10. @submit="search"
  11. :model="searchForm">
  12. <el-form-item prop="hasPracticeCourse">
  13. <el-select class="multiple"
  14. v-model.trim="searchForm.tenantId"
  15. placeholder="请选择对内或对外">
  16. <el-option label="对内"
  17. value="1"></el-option>
  18. <el-option label="对外"
  19. value="2"></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button native-type="submit" type="danger">搜索</el-button>
  24. </el-form-item>
  25. </save-form>
  26. <!-- 列表 -->
  27. <div class="tableWrap">
  28. <el-table :data='tableList'
  29. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  30. <el-table-column align='center'
  31. label="轮播图">
  32. <template slot-scope="scope">
  33. <img class="bannerImg"
  34. :src="scope.row.coverImage"
  35. alt="">
  36. </template>
  37. </el-table-column>
  38. <el-table-column align='center'
  39. prop="title"
  40. label="标题">
  41. </el-table-column>
  42. <el-table-column align='center'
  43. label="跳转连接">
  44. <template slot-scope="scope">
  45. <overflow-text :text="scope.row.linkUrl"></overflow-text>
  46. <!-- {{ scope.row.linkUrl }} -->
  47. </template>
  48. </el-table-column>
  49. <el-table-column align='center'
  50. prop="remark"
  51. label="是否使用">
  52. <template slot-scope="scope">
  53. {{ scope.row.status == 1 ? '是' : '否' }}
  54. </template>
  55. </el-table-column>
  56. <el-table-column align='center'
  57. prop="memo"
  58. label="版本号">
  59. <template slot-scope="scope">
  60. {{ scope.row.memo ? scope.row.memo : '--' }}
  61. </template>
  62. </el-table-column>
  63. <el-table-column align='center'
  64. prop="order"
  65. label="排序">
  66. </el-table-column>
  67. <el-table-column align="center"
  68. prop="remark"
  69. label="适用范围">
  70. <template slot-scope="scope">
  71. <p v-if=" scope.row.tenantId == 1">对内</p>
  72. <p v-if=" scope.row.tenantId == 2">对外</p>
  73. </template>
  74. </el-table-column>
  75. <el-table-column align='center'
  76. label="操作">
  77. <template slot-scope="scope">
  78. <el-button @click="openTeaching('update', scope.row)"
  79. type="text">修改</el-button>
  80. <el-button v-if="scope.row.status == 1"
  81. @click="onStop(scope.row, 0)"
  82. type="text">停用</el-button>
  83. <el-button v-else
  84. @click="onStop(scope.row, 1)"
  85. type="text">启用</el-button>
  86. <el-button @click="onDel(scope.row)"
  87. type="text">删除</el-button>
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. <pagination
  92. saveKey="contentAppPage"
  93. sync :total.sync="pageInfo.total"
  94. :page.sync="pageInfo.page"
  95. :limit.sync="pageInfo.limit"
  96. :page-sizes="pageInfo.page_size"
  97. @pagination="getList" />
  98. </div>
  99. </div>
  100. </template>
  101. <script>
  102. import { newsList, newsUpdate, newsDel } from '@/api/contentManager'
  103. import pagination from '@/components/Pagination/index'
  104. export default {
  105. name: 'training',
  106. components: {
  107. pagination
  108. },
  109. data () {
  110. return {
  111. searchForm: {
  112. tenantId: '1'
  113. },
  114. tableList: [],
  115. organId: null,
  116. teacherId: this.$route.query.teacherId,
  117. pageInfo: {
  118. // 分页规则
  119. limit: 10, // 限制显示条数
  120. page: 1, // 当前页
  121. total: 1, // 总条数
  122. page_size: [10, 20, 40, 50] // 选择限制显示条数
  123. }
  124. }
  125. },
  126. mounted () {
  127. this.getList()
  128. },
  129. methods: {
  130. search() {
  131. this.pageInfo.page = 1
  132. this.getList()
  133. },
  134. getList () {
  135. let params = {
  136. clientName: 'manage',
  137. tenantId: this.searchForm.tenantId,
  138. rows: this.pageInfo.limit,
  139. page: this.pageInfo.page,
  140. type: 6
  141. }
  142. newsList(params).then(res => {
  143. if (res.code == 200) {
  144. this.tableList = res.data.rows
  145. this.pageInfo.total = res.data.total
  146. }
  147. })
  148. },
  149. openTeaching (type, rows) {
  150. let params = {}
  151. if (type == 'update') {
  152. params.id = rows.id
  153. }
  154. params.type = 6
  155. params.pageType = type
  156. this.$router.push({
  157. path: '/contentManager/contentOperation',
  158. query: params
  159. })
  160. },
  161. onDel (row) { // 删除
  162. this.$confirm('确定是否删除?', '提示', {
  163. confirmButtonText: '确定',
  164. cancelButtonText: '取消',
  165. type: 'warning'
  166. }).then(() => {
  167. newsDel({ id: row.id }).then(res => {
  168. if (res.code == 200) {
  169. this.$message.success('删除成功')
  170. this.getList()
  171. } else {
  172. this.$message.error(res.msg)
  173. }
  174. })
  175. }).catch(() => { })
  176. },
  177. onStop (row, status) { // 停止
  178. // newsUpdate
  179. let tempStr = ['停用', '启用']
  180. newsUpdate({
  181. id: row.id,
  182. status: status
  183. }).then(res => {
  184. if (res.code == 200) {
  185. this.$message.success(tempStr[status] + '成功')
  186. this.getList()
  187. } else {
  188. this.$message.error(res.msg)
  189. }
  190. })
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="scss" scoped>
  196. .bannerImg {
  197. height: 60px;
  198. }
  199. </style>