多媒体信息发布平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

563 lines
15 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div>
  3. <div class="material_content">
  4. <div class="material_item cont_upload">
  5. <el-button class="cont_upload_btn" round type="primary">上传</el-button>
  6. <el-button class="mkdir_btn" round type="primary" @click="handleMkdir">创建文件夹</el-button>
  7. </div>
  8. <div class="material_item folder">
  9. <div class="icon_bg">
  10. <svg class="font-icon icon" aria-hidden="true">
  11. <use xlink:href="#icon-wenjianjia" />
  12. </svg>
  13. <img src />
  14. </div>
  15. <p class="file_name">文件夹</p>
  16. </div>
  17. <div
  18. v-for="(item, index) in listData"
  19. :key="index"
  20. :class="['material_item', 'item_cont', { 'item_multi': contentIds.includes(item.id) }]"
  21. >
  22. <img v-if="item.coverImg" :src="item.coverImg" alt />
  23. <div v-if="item.type == 'audio'" class="radio_img"></div>
  24. <div class="item_format">
  25. <span class="item_type">{{ item.type }}</span>
  26. <span v-if="item.type !== 'JPG'" class="item_time">03:00</span>
  27. </div>
  28. <div class="file_name">{{ item.name }}</div>
  29. <span v-if="isMultiSelected" class="checked_btn" @click="selectedItem(item.id, item.type)"></span>
  30. </div>
  31. </div>
  32. <!-- 创建文件夹layer / 编辑 -->
  33. <div class="publish_layer">
  34. <el-dialog
  35. :title="layerTitle"
  36. :close-on-click-modal="false"
  37. :visible.sync="mkdirVisible"
  38. width="616px"
  39. height="384px"
  40. >
  41. <el-form ref="form" :inline="true" :model="form" size="small" label-width="100px">
  42. <el-form-item
  43. :label="labelTxt"
  44. prop="name"
  45. :rules="[
  46. { required: true, message: '请输入名称', trigger: 'blur' }
  47. ]"
  48. >
  49. <el-input v-model="form.name" style="width: 336px" />
  50. </el-form-item>
  51. <el-form-item v-if="formType !== 'JPG'" label="封面" prop="file">
  52. <el-upload action="#" list-type="picture-card" :auto-upload="false">
  53. <!-- <i slot="default" class="el-icon-plus"></i> -->
  54. <img src="@/assets/images/t-sc.png" alt />
  55. <div slot="file" slot-scope="{file}">
  56. <img class="el-upload-list__item-thumbnail" :src="file.url" alt />
  57. <!-- <span class="el-upload-list__item-actions">
  58. <span
  59. class="el-upload-list__item-preview"
  60. @click="handlePictureCardPreview(file)"
  61. >
  62. <i class="el-icon-zoom-in"></i>
  63. </span>
  64. <span
  65. v-if="!disabled"
  66. class="el-upload-list__item-delete"
  67. @click="handleDownload(file)"
  68. >
  69. <i class="el-icon-download"></i>
  70. </span>
  71. <span
  72. v-if="!disabled"
  73. class="el-upload-list__item-delete"
  74. @click="handleRemove(file)"
  75. >
  76. <i class="el-icon-delete"></i>
  77. </span>
  78. </span>-->
  79. </div>
  80. </el-upload>
  81. <!-- <el-dialog :visible.sync="dialogVisible">
  82. <img width="100%" :src="dialogImageUrl" alt />
  83. </el-dialog>-->
  84. </el-form-item>
  85. </el-form>
  86. <div slot="footer" class="dialog-footer">
  87. <el-button :loading="crud.status.cu === 2" type="primary" round @click="crud.submitCU">保存</el-button>
  88. <el-button round @click="crud.cancelCU">关闭</el-button>
  89. </div>
  90. </el-dialog>
  91. </div>
  92. <!-- 上传列表layer -->
  93. <div class="upload_layer">
  94. <!-- width="736px" -->
  95. <el-dialog
  96. title="上传列表"
  97. :close-on-click-modal="false"
  98. :visible.sync="uploadListVisible"
  99. height="384px"
  100. >
  101. <!-- :status="percentage === 100 ? undefined : 'success'" -->
  102. <el-table :data="uploadData" :header-cell-style="{ color: '#333' }">
  103. <el-table-column align="center" prop="name" label="文件名" />
  104. <el-table-column align="center" prop="type" label="类型" />
  105. <el-table-column align="center" prop="size" label="大小" />
  106. <el-table-column align="center" prop="status" label="状态">
  107. <template>
  108. <div v-if="progressLoading" class="loadingModal" :style="{ 'height': '100%' }">
  109. <el-progress
  110. :stroke-width="6"
  111. :percentage="percentage"
  112. :color="colors"
  113. :format="format"
  114. />
  115. </div>
  116. </template>
  117. </el-table-column>
  118. <el-table-column align="center" prop="handle" label="操作">
  119. <template slot-scope="scope">
  120. <el-button
  121. type="primary"
  122. round
  123. class="on_off_btn"
  124. @click="end(scope.$index, scope.row)"
  125. >{{ loading_txt }}</el-button>
  126. <el-button
  127. type="info"
  128. round
  129. class="upload_delt"
  130. @click="handleRecord(scope.$index, scope.row)"
  131. >删除</el-button>
  132. </template>
  133. </el-table-column>
  134. </el-table>
  135. <div class="upload_list_right">
  136. <el-upload
  137. class="upload-demo"
  138. action="https://jsonplaceholder.typicode.com/posts/"
  139. multiple
  140. :limit="3"
  141. >
  142. <div class="right_upload">点击上传</div>
  143. </el-upload>
  144. <div class="upload_return">返回</div>
  145. </div>
  146. </el-dialog>
  147. </div>
  148. <!-- 多选操作 -->
  149. <div v-if="contentIds.length !== 0" class="multi_handle">
  150. <el-button type="button" class="mulit_btn">即时发布</el-button>
  151. <el-button type="button" class="mulit_btn">定时发布</el-button>
  152. <el-button
  153. type="button"
  154. class="mulit_btn"
  155. :disabled="contentIds.length > 1"
  156. @click="editContent()"
  157. >编辑</el-button>
  158. <el-button type="button" class="mulit_btn">下载</el-button>
  159. <el-button type="button" class="mulit_btn" @click="moveingTo()">移动</el-button>
  160. <el-button type="button" class="mulit_btn mulit_delt_btn">删除</el-button>
  161. </div>
  162. <!-- 移动至layer -->
  163. <div class="wjj_layer">
  164. <!-- width="736px" -->
  165. <el-dialog
  166. title="移动至"
  167. :close-on-click-modal="false"
  168. :visible.sync="movingVisible"
  169. width="576px"
  170. height="384px"
  171. >
  172. <div class="wjj_list">
  173. <div
  174. v-for="(item, index) in wjjList"
  175. :key="index"
  176. :class="['wjj_item', { 'wjj_item_active': movingChecked === index }]"
  177. @click="wjjSelected(index)"
  178. >
  179. <svg class="font-icon icon" aria-hidden="true">
  180. <use xlink:href="#icon-wenjianjia" />
  181. </svg>
  182. <p class="wjj_name">{{ item.name }}</p>
  183. </div>
  184. </div>
  185. <div slot="footer" class="dialog-footer">
  186. <el-button type="primary" round>确定</el-button>
  187. <el-button round @click="crud.cancelCU">取消</el-button>
  188. </div>
  189. </el-dialog>
  190. </div>
  191. </div>
  192. </template>
  193. <script>
  194. import crudUser from '@/api/system/user'
  195. import CRUD, { presenter, header, form, crud } from '@crud/crud'
  196. import { mapGetters } from 'vuex'
  197. const defaultForm = {
  198. id: null,
  199. name: '',
  200. file: null
  201. }
  202. export default {
  203. name: 'MaterialList',
  204. components: {},
  205. cruds() {
  206. return CRUD({ title: '用户', url: 'api/users', crudMethod: { ...crudUser }})
  207. },
  208. mixins: [presenter(), header(), form(defaultForm), crud()],
  209. props: {
  210. isMultiSelected: {
  211. type: Boolean,
  212. required: true
  213. },
  214. mulitText: {
  215. type: String,
  216. required: true
  217. }
  218. },
  219. data() {
  220. return {
  221. uploadListVisible: false,
  222. loading_txt: '暂停',
  223. progressLoading: true,
  224. percentage: 0,
  225. colors: '#1e9f4c',
  226. layerTitle: '创建文件夹',
  227. labelTxt: '文件夹名称',
  228. mkdirVisible: false,
  229. formType: null,
  230. movingVisible: false,
  231. movingChecked: null,
  232. // dialogImageUrl: '',
  233. // dialogVisible: false,
  234. // disabled: false
  235. uploadData: [
  236. {
  237. id: '1',
  238. name: '文件夹1',
  239. type: 'vedio',
  240. size: '3MB'
  241. }
  242. ],
  243. listData: [
  244. {
  245. id: '1',
  246. name: '人工智能',
  247. type: 'JPG',
  248. coverImg: require('@/assets/images/background.jpg'),
  249. time: ''
  250. },
  251. {
  252. id: '2',
  253. name: '防控疫情小贴士',
  254. type: 'vedio',
  255. coverImg: require('@/assets/images/background.jpg'),
  256. time: '03:00'
  257. },
  258. {
  259. id: '3',
  260. name: '防控疫情小贴士2',
  261. type: 'audio',
  262. coverImg: '',
  263. time: '01:20'
  264. }
  265. ],
  266. contentIds: [],
  267. wjjList: [
  268. {
  269. id: '1',
  270. name: '文件夹1'
  271. },
  272. {
  273. id: '2',
  274. name: '文件夹2'
  275. }
  276. ]
  277. }
  278. },
  279. computed: {
  280. ...mapGetters([
  281. 'user'
  282. ])
  283. },
  284. watch: {
  285. isMultiSelected(newName, oldName) {
  286. if (newName === false) {
  287. this.contentIds = []
  288. }
  289. }
  290. },
  291. mounted: function() {
  292. this.start()
  293. },
  294. methods: {
  295. handleMkdir() {
  296. this.mkdirVisible = true
  297. },
  298. UploadList() {
  299. this.uploadListVisible = true
  300. },
  301. selectedItem(id, type) {
  302. console.log('type', type)
  303. const arr = this.contentIds
  304. // includes()方法判断是否包含某一元素,返回true或false表示是否包含元素,对NaN一样有效
  305. if (arr.includes(id)) {
  306. // 判断数组中是否有选中的id,如果有则去掉
  307. const index = arr.indexOf(id)
  308. if (index > -1) {
  309. arr.splice(index, 1)
  310. }
  311. } else {
  312. this.contentIds.push(id)
  313. this.formType = type
  314. }
  315. console.log('formType', this.formType)
  316. },
  317. editContent() {
  318. this.mkdirVisible = true
  319. this.labelTxt = '文件名称'
  320. if (this.formType === 'vedio') {
  321. this.layerTitle = '视频编辑'
  322. } else if (this.formType === 'audio') {
  323. this.layerTitle = '音频编辑'
  324. } else {
  325. this.layerTitle = '图片编辑'
  326. }
  327. const resType = this.listData.filter(item => {
  328. return item.id === this.contentIds[0]
  329. })
  330. this.form.name = resType[0].name
  331. },
  332. moveingTo(index) {
  333. this.movingVisible = true
  334. // this.movingChecked = index
  335. },
  336. wjjSelected(index) {
  337. this.movingChecked = index
  338. console.log(this.movingChecked)
  339. },
  340. format(percentage) {
  341. return percentage === 100 ? '100%' : `${percentage}%`
  342. },
  343. start() {
  344. const that = this
  345. that.$nextTick(() => {
  346. that.progressLoading = true
  347. that.percentage = 0
  348. that.timeStart = setInterval(() => {
  349. if (that.percentage < 100) {
  350. that.percentage += 1
  351. }
  352. }, 100)
  353. })
  354. },
  355. // 进度条结束
  356. end() {
  357. this.loading_txt = '继续'
  358. // const that = this
  359. // that.percentage = 100
  360. clearInterval(this.timeStart)
  361. // setTimeout(() => {
  362. // that.progressLoading = false
  363. // }, 300)
  364. }
  365. // handleRemove(file) {
  366. // console.log(file)
  367. // },
  368. // handlePictureCardPreview(file) {
  369. // this.dialogImageUrl = file.url
  370. // this.dialogVisible = true
  371. // },
  372. // handleDownload(file) {
  373. // console.log(file)
  374. // }
  375. }
  376. }
  377. </script>
  378. <style lang="scss" scoped>
  379. .material_content {
  380. display: flex;
  381. flex-wrap: wrap;
  382. margin-left: 24px;
  383. .material_item {
  384. position: relative;
  385. width: 174px;
  386. height: 182px;
  387. border-radius: 4px;
  388. margin: 0 20px 20px 0;
  389. }
  390. .checked_btn {
  391. position: absolute;
  392. top: 10px;
  393. right: 10px;
  394. display: block;
  395. width: 24px;
  396. height: 24px;
  397. background: url(~@/assets/images/un_selected.png) no-repeat;
  398. background-size: 24px 24px;
  399. cursor: pointer;
  400. }
  401. .item_multi {
  402. border-color: #3a8aeb !important;
  403. .checked_btn {
  404. background: url(~@/assets/images/selected.png) no-repeat;
  405. }
  406. }
  407. .cont_upload {
  408. display: flex;
  409. flex-wrap: wrap;
  410. justify-content: center;
  411. align-content: center;
  412. border: 1px dashed #dcdde3;
  413. background: #f2f7ff;
  414. .el-button {
  415. display: block;
  416. width: 114px;
  417. height: 34px;
  418. padding: 0;
  419. font-size: 14px;
  420. border: none;
  421. }
  422. .cont_upload_btn {
  423. background: linear-gradient(to right, #fc8c6f, #fa544e) !important;
  424. }
  425. .mkdir_btn {
  426. margin-left: 0;
  427. margin-top: 16px;
  428. }
  429. }
  430. .folder {
  431. border: 1px solid #dcdde3;
  432. .icon_bg {
  433. display: flex;
  434. align-items: center;
  435. justify-content: center;
  436. height: 148px;
  437. background: #fff5dd;
  438. .icon {
  439. width: 104px;
  440. height: 89px;
  441. }
  442. }
  443. }
  444. .item_cont {
  445. border-color: #dcdde3;
  446. img {
  447. width: 100%;
  448. height: 148px;
  449. }
  450. .radio_img {
  451. width: 100%;
  452. height: 148px;
  453. }
  454. }
  455. }
  456. ::v-deep .el-table {
  457. .el-button {
  458. padding: 0 10px;
  459. height: 24px;
  460. &.upload_delt {
  461. background-color: #f76b6b;
  462. }
  463. }
  464. }
  465. ::v-deep .el-upload--picture-card {
  466. width: 128px;
  467. height: 120px;
  468. background-color: #f2f7ff;
  469. }
  470. ::v-deep .el-upload-list--picture-card .el-upload-list__item {
  471. width: 128px;
  472. height: 120px;
  473. }
  474. .upload_layer {
  475. ::v-deep .el-dialog__headerbtn {
  476. right: -60px;
  477. .el-dialog__close {
  478. color: #fff;
  479. font-size: 26px;
  480. }
  481. }
  482. .upload_list_right {
  483. position: absolute;
  484. right: 24px;
  485. top: 24px;
  486. display: flex;
  487. font-size: 14px;
  488. font-weight: bold;
  489. color: #3a8aeb;
  490. .upload_return {
  491. margin-left: 16px;
  492. cursor: pointer;
  493. }
  494. }
  495. }
  496. .multi_handle {
  497. position: fixed;
  498. bottom: 140px;
  499. left: 50%;
  500. width: 1100px;
  501. padding: 25px 150px;
  502. background: rgba(0, 0, 0, 0.5);
  503. border-radius: 4px;
  504. margin-left: -438px;
  505. .mulit_btn {
  506. padding: 0 24px;
  507. height: 34px;
  508. font-size: 14px;
  509. color: #333;
  510. border: none;
  511. margin: 0 24px;
  512. background-color: #fff;
  513. }
  514. .mulit_delt_btn {
  515. background-color: #ec414d;
  516. color: #fff;
  517. }
  518. }
  519. .wjj_layer {
  520. ::v-deep .el-dialog__body {
  521. padding: 30px 24px;
  522. }
  523. .wjj_list {
  524. display: flex;
  525. flex-wrap: wrap;
  526. .wjj_item {
  527. display: flex;
  528. flex-wrap: wrap;
  529. align-content: center;
  530. justify-content: center;
  531. width: 96px;
  532. height: 104px;
  533. cursor: pointer;
  534. &.wjj_item_active {
  535. background: #e8f3ff;
  536. border: 1px solid #428fec;
  537. }
  538. .font-icon {
  539. width: 64px;
  540. height: 55px;
  541. }
  542. .wjj_name {
  543. font-size: 14px;
  544. color: #333;
  545. margin-top: 8px;
  546. }
  547. }
  548. }
  549. }
  550. </style>