index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <div class="app-container">
  3. <el-card>
  4. <mx-condition ref="condition" :query-params="queryParams" :require-fields="requireFields" @query="handleQuery"
  5. @invalid="handleInvalidQuery"
  6. ></mx-condition>
  7. </el-card>
  8. <el-card class="box-card mt20">
  9. <div slot="header" class="clearfix">
  10. <el-row :gutter="10">
  11. <el-col :span="1.5" v-hasPermi="['front:personResource:uploadToCloudResourse']">
  12. <el-button plain icon="el-icon-upload2" size="small" @click="upToCloudResourse" :disabled="multiple">上传至云库
  13. </el-button>
  14. </el-col>
  15. <el-col :span="1.5" v-hasPermi="['front:personResource:uploadToSchoolResourse']">
  16. <el-button plain icon="el-icon-upload2" size="small" @click="upToSchoolResourse" :disabled="multiple">
  17. 上传至校本资源库
  18. </el-button>
  19. </el-col>
  20. <el-col :span="1.5" v-hasPermi="['front:personResource:uploadToBoard']">
  21. <el-button plain icon="el-icon-upload2" size="small" @click="upToSchoolClass" :disabled="multiple">上传至班牌
  22. </el-button>
  23. </el-col>
  24. <el-col :span="1.5" v-hasPermi="['front:personResource:uploadToStudent']">
  25. <el-button plain icon="el-icon-upload2" size="small" @click="upToSchoolStudent" :disabled="multiple">
  26. 上传至学生端
  27. </el-button>
  28. </el-col>
  29. <el-col :span="1.5" v-hasPermi="['front:personResource:uploadToParent']">
  30. <el-button plain icon="el-icon-upload2" size="small" @click="upToSchoolParent" :disabled="multiple">上传至家长端
  31. </el-button>
  32. </el-col>
  33. </el-row>
  34. </div>
  35. <mx-table :rows="list" :prop-defines="propDefines" @selection-change="handleSelectionChange">
  36. <template #img="{row}">
  37. <img style="width: 130px; height: 80px; cursor: pointer" @click="playVideo(row)" :src="img.ship" alt/>
  38. </template>
  39. </mx-table>
  40. </el-card>
  41. <upload-dialog
  42. v-if="dialogVisible"
  43. :title="title"
  44. :pageName="pageName"
  45. :isZdy="isZdy"
  46. :selectType="selectType"
  47. :dialogVisible="dialogVisible"
  48. @handleClose="handleClose"
  49. @dialogVisibleClose="dialogVisibleClose"
  50. ></upload-dialog>
  51. <el-dialog title="查看视频" :visible.sync="dialogVideo" width="60%">
  52. <mx-video v-if="dialogVideo" :aliIdType="aliIdType" :src="src" controls controlslist="nodownload"
  53. disablepictureinpicture
  54. ></mx-video>
  55. </el-dialog>
  56. </div>
  57. </template>
  58. <script>
  59. import MxCondition from '@/components/MxCondition/mx-condition'
  60. import {
  61. list,
  62. upToCloudResourse,
  63. upToSchoolClass,
  64. upToSchoolParent,
  65. upToSchoolResourse,
  66. upToSchoolStudent
  67. } from '@/api/webApi/person'
  68. export default {
  69. components: { MxCondition },
  70. data() {
  71. return {
  72. queryParams: {
  73. subjectByVideo: ''
  74. },
  75. img: {
  76. ship: require('@/assets/images/ship.png')
  77. },
  78. requireFields: [],
  79. pageForm: {
  80. pageSize: 10,
  81. pageNum: 1
  82. },
  83. dialogVideo: false,
  84. list: [],
  85. total: 0,
  86. propDefines: {
  87. sele: {
  88. label: '文件',
  89. type: 'selection'
  90. },
  91. paper: {
  92. label: '文件',
  93. slot: 'img'
  94. },
  95. resourcesName: {
  96. label: '文件名'
  97. },
  98. createBy: {
  99. label: '发布人'
  100. },
  101. createTime: {
  102. label: '时间'
  103. }
  104. },
  105. multiple: true,
  106. // 非单个禁用
  107. single: true,
  108. ids: [],
  109. idsSel: [],
  110. resourcesNames: [],
  111. isZdy: true,
  112. title:'',
  113. selectType:'',
  114. dialogVisible:'',
  115. pageName:"视频课程",
  116. }
  117. },
  118. created() {
  119. },
  120. watch: {},
  121. methods: {
  122. dialogVisibleClose() {
  123. this.dialogVisible = false;
  124. },
  125. handleClose(type, name, selectData) {
  126. console.log("------------");
  127. console.log(type);
  128. console.log(name);
  129. console.log(selectData);
  130. let _this = this
  131. if (this.title == '上传至云库') {
  132. _this.ids.forEach((item, index) => {
  133. let Ajax = {
  134. resourseId: item
  135. }
  136. if (name) {
  137. Ajax.resourcesName = name
  138. }
  139. upToCloudResourse(Ajax).then(() => {
  140. if (index == _this.ids.length - 1) {
  141. _this.msgSuccess('操作成功')
  142. _this.dialogVisible = false
  143. }
  144. })
  145. })
  146. } else if (this.title == '上传至校本资源库') {
  147. _this.ids.forEach((item, index) => {
  148. let Ajax = {
  149. resourseId: item
  150. }
  151. if (name) {
  152. Ajax.resourcesName = name
  153. }
  154. upToSchoolResourse(Ajax).then(() => {
  155. if (index == _this.ids.length - 1) {
  156. _this.msgSuccess('操作成功')
  157. _this.dialogVisible = false
  158. }
  159. })
  160. })
  161. } else if (this.title == '上传至班牌') {
  162. console.log('上传至班牌')
  163. console.log(selectData)
  164. _this.ids.forEach((item, index) => {
  165. let Ajax = {
  166. resourseId: item,
  167. classId: selectData.checkedClass,
  168. studentCodes: selectData.checkedStudent
  169. ? selectData.checkedStudent.join(',')
  170. : ''
  171. }
  172. if (name) {
  173. Ajax.resourcesName = name
  174. }
  175. console.log('上传至班牌', Ajax)
  176. upToSchoolClass(Ajax).then(() => {
  177. if (index == _this.ids.length - 1) {
  178. _this.msgSuccess('操作成功')
  179. _this.dialogVisible = false
  180. }
  181. })
  182. })
  183. } else if (this.title == '上传至学生端') {
  184. console.log('上传至学生端')
  185. console.log(selectData)
  186. _this.ids.forEach((item, index) => {
  187. let Ajax = {
  188. resourseId: item,
  189. classId: selectData.checkedClass,
  190. remark: selectData.remark,
  191. studentCodes: selectData.checkedStudent.join(',')
  192. }
  193. if (name) {
  194. Ajax.resourcesName = name
  195. }
  196. upToSchoolStudent(Ajax).then(() => {
  197. if (index == _this.ids.length - 1) {
  198. _this.msgSuccess('操作成功')
  199. _this.dialogVisible = false
  200. }
  201. })
  202. })
  203. } else if (this.title == '上传至家长端') {
  204. console.log('上传至家长端')
  205. console.log(selectData)
  206. _this.ids.forEach((item, index) => {
  207. let Ajax = {
  208. resourseId: item,
  209. classId: selectData.checkedClass,
  210. remark: selectData.remark,
  211. studentCodes: selectData.checkedStudent.join(',')
  212. }
  213. if (name) {
  214. Ajax.resourcesName = name
  215. }
  216. upToSchoolParent(Ajax).then(() => {
  217. if (index == _this.ids.length - 1) {
  218. _this.msgSuccess('操作成功')
  219. _this.dialogVisible = false
  220. }
  221. })
  222. })
  223. }
  224. },
  225. upToCloudResourse() {
  226. this.isZdy = false
  227. let _this = this
  228. const resourcesIds = this.ids.join(',')
  229. this.title = '上传至云库'
  230. this.selectType = ''
  231. this.dialogVisible = true
  232. },
  233. upToSchoolResourse() {
  234. this.isZdy = true
  235. let _this = this
  236. const resourcesIds = this.ids.join(',')
  237. this.title = '上传至校本资源库'
  238. this.selectType = ''
  239. this.dialogVisible = true
  240. },
  241. upToSchoolClass() {
  242. this.isZdy = false
  243. let _this = this
  244. const resourcesIds = this.ids.join(',')
  245. this.title = '上传至班牌'
  246. this.selectType = 'class'
  247. this.dialogVisible = true
  248. },
  249. upToSchoolStudent() {
  250. this.isZdy = false
  251. let _this = this
  252. const resourcesIds = this.ids.join(',')
  253. this.title = '上传至学生端'
  254. this.selectType = 'student'
  255. this.dialogVisible = true
  256. },
  257. upToSchoolParent() {
  258. this.isZdy = false
  259. let _this = this
  260. const resourcesIds = this.ids.join(',')
  261. this.title = '上传至家长端'
  262. this.selectType = 'parent'
  263. this.dialogVisible = true
  264. },
  265. handleSelectionChange(selection) {
  266. this.idsSel = selection.map((item) => item)
  267. this.ids = selection.map((item) => item.resourcesId)
  268. this.resourcesNames = selection.map((item) => item.resourcesName)
  269. this.single = selection.length !== 1
  270. this.multiple = !selection.length
  271. },
  272. handleQuery() {
  273. this.getList()
  274. },
  275. playVideo(row) {
  276. this.aliIdType = row.aliIdType
  277. this.src = row.resourcesUrl
  278. this.dialogVideo = true
  279. },
  280. getList() {
  281. this.tableLoading = true
  282. list({
  283. subjectId: this.queryParams.subjectByVideo, //科目
  284. category: '视频课程',
  285. ...this.pageForm
  286. })
  287. .then(res => {
  288. this.list = res.rows
  289. this.total = res.total
  290. })
  291. .finally(_ => {
  292. this.tableLoading = false
  293. })
  294. },
  295. handleInvalidQuery() {
  296. }
  297. }
  298. }
  299. </script>