多媒体信息发布平台
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.

444 lines
13 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
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. :show-close="false"
  38. :visible.sync="mkdirVisible"
  39. width="616px"
  40. height="384px"
  41. >
  42. <el-form ref="form" :inline="true" :model="form" size="small" label-width="100px">
  43. <el-form-item
  44. :label="labelTxt"
  45. prop="name"
  46. :rules="[
  47. { required: true, message: '请输入名称', trigger: 'blur' }
  48. ]"
  49. >
  50. <el-input v-model="form.name" style="width: 336px" />
  51. </el-form-item>
  52. <el-form-item v-if="formType !== 'JPG'" label="封面" prop="file">
  53. <el-upload action="#" list-type="picture-card" :auto-upload="false">
  54. <!-- <i slot="default" class="el-icon-plus"></i> -->
  55. <img src="@/assets/images/t-sc.png" alt />
  56. <div slot="file" slot-scope="{file}">
  57. <img class="el-upload-list__item-thumbnail" :src="file.url" alt />
  58. <!-- <span class="el-upload-list__item-actions">
  59. <span
  60. class="el-upload-list__item-preview"
  61. @click="handlePictureCardPreview(file)"
  62. >
  63. <i class="el-icon-zoom-in"></i>
  64. </span>
  65. <span
  66. v-if="!disabled"
  67. class="el-upload-list__item-delete"
  68. @click="handleDownload(file)"
  69. >
  70. <i class="el-icon-download"></i>
  71. </span>
  72. <span
  73. v-if="!disabled"
  74. class="el-upload-list__item-delete"
  75. @click="handleRemove(file)"
  76. >
  77. <i class="el-icon-delete"></i>
  78. </span>
  79. </span>-->
  80. </div>
  81. </el-upload>
  82. <!-- <el-dialog :visible.sync="dialogVisible">
  83. <img width="100%" :src="dialogImageUrl" alt />
  84. </el-dialog>-->
  85. </el-form-item>
  86. </el-form>
  87. <div slot="footer" class="dialog-footer">
  88. <el-button :loading="crud.status.cu === 2" type="primary" round @click="crud.submitCU"> </el-button>
  89. <el-button round @click="mkdirVisible=false"> </el-button>
  90. </div>
  91. </el-dialog>
  92. </div>
  93. <!-- 上传列表layer -->
  94. <div class="upload_layer">
  95. <!-- width="736px" -->
  96. <el-dialog
  97. title="上传列表"
  98. :close-on-click-modal="false"
  99. :show-close="false"
  100. :visible.sync="uploadListVisible"
  101. height="384px"
  102. >
  103. <!-- :status="percentage === 100 ? undefined : 'success'" -->
  104. <el-table :data="uploadData" :header-cell-style="{ color: '#333' }">
  105. <el-table-column align="center" prop="name" label="文件名" />
  106. <el-table-column align="center" prop="type" label="类型" />
  107. <el-table-column align="center" prop="size" label="大小" />
  108. <el-table-column align="center" prop="status" label="状态">
  109. <template>
  110. <div v-if="progressLoading" class="loadingModal" :style="{ 'height': '100%' }">
  111. <el-progress
  112. :stroke-width="6"
  113. :percentage="percentage"
  114. :color="colors"
  115. :format="format"
  116. />
  117. </div>
  118. </template>
  119. </el-table-column>
  120. <el-table-column align="center" prop="handle" label="操作">
  121. <template slot-scope="scope">
  122. <el-button
  123. type="primary"
  124. round
  125. class="on_off_btn"
  126. @click="end(scope.$index, scope.row)"
  127. >{{ loading_txt }}</el-button>
  128. <el-button
  129. type="info"
  130. round
  131. class="upload_delt"
  132. @click="handleRecord(scope.$index, scope.row)"
  133. >删除</el-button>
  134. </template>
  135. </el-table-column>
  136. </el-table>
  137. <div class="upload_list_right">
  138. <el-upload
  139. class="upload-demo"
  140. action="https://jsonplaceholder.typicode.com/posts/"
  141. multiple
  142. :limit="3"
  143. >
  144. <div class="right_upload">点击上传</div>
  145. </el-upload>
  146. <div class="upload_return" @click="uploadListVisible=false">返回</div>
  147. </div>
  148. </el-dialog>
  149. </div>
  150. <!-- 多选操作 -->
  151. <div v-if="contentIds.length !== 0" class="multi_handle">
  152. <el-button type="button" class="mulit_btn" @click="publishHandle(0)">即时发布</el-button>
  153. <el-button type="button" class="mulit_btn" @click="publishHandle(1)">定时发布</el-button>
  154. <el-button
  155. type="button"
  156. class="mulit_btn"
  157. :disabled="contentIds.length > 1"
  158. @click="editContent()"
  159. >编辑</el-button>
  160. <el-button type="button" class="mulit_btn">下载</el-button>
  161. <el-button type="button" class="mulit_btn" @click="moveingTo()">移动</el-button>
  162. <el-button type="button" class="mulit_btn mulit_delt_btn">删除</el-button>
  163. </div>
  164. <!-- 移动至layer -->
  165. <div class="wjj_layer">
  166. <!-- width="736px" -->
  167. <el-dialog
  168. title="移动至"
  169. :close-on-click-modal="false"
  170. :show-close="false"
  171. :visible.sync="movingVisible"
  172. width="576px"
  173. height="384px"
  174. >
  175. <div class="wjj_list">
  176. <div
  177. v-for="(item, index) in wjjList"
  178. :key="index"
  179. :class="['wjj_item', { 'wjj_item_active': movingChecked === index }]"
  180. @click="wjjSelected(index)"
  181. >
  182. <svg class="font-icon icon" aria-hidden="true">
  183. <use xlink:href="#icon-wenjianjia" />
  184. </svg>
  185. <p class="wjj_name">{{ item.name }}</p>
  186. </div>
  187. </div>
  188. <div slot="footer" class="dialog-footer">
  189. <el-button type="primary" round>确定</el-button>
  190. <el-button round @click="movingVisible=false">取消</el-button>
  191. </div>
  192. </el-dialog>
  193. </div>
  194. </div>
  195. </template>
  196. <script>
  197. import crudUser from '@/api/system/user'
  198. import CRUD, { presenter, header, form, crud } from '@crud/crud'
  199. import { mapGetters } from 'vuex'
  200. const defaultForm = {
  201. id: null,
  202. name: '',
  203. file: null
  204. }
  205. export default {
  206. name: 'MaterialList',
  207. components: {},
  208. cruds() {
  209. return CRUD({ title: '用户', url: 'api/users', crudMethod: { ...crudUser }})
  210. },
  211. mixins: [presenter(), header(), form(defaultForm), crud()],
  212. props: {
  213. isMultiSelected: {
  214. type: Boolean,
  215. required: true
  216. },
  217. mulitText: {
  218. type: String,
  219. required: true
  220. }
  221. },
  222. data() {
  223. return {
  224. uploadListVisible: false,
  225. loading_txt: '暂停',
  226. progressLoading: true,
  227. percentage: 0,
  228. colors: '#1e9f4c',
  229. layerTitle: '创建文件夹',
  230. labelTxt: '文件夹名称',
  231. mkdirVisible: false,
  232. formType: null,
  233. movingVisible: false,
  234. movingChecked: null,
  235. // dialogImageUrl: '',
  236. // dialogVisible: false,
  237. // disabled: false
  238. uploadData: [
  239. {
  240. id: '1',
  241. name: '文件夹1',
  242. type: 'vedio',
  243. size: '3MB'
  244. }
  245. ],
  246. listData: [
  247. {
  248. id: '1',
  249. name: '人工智能',
  250. type: 'JPG',
  251. coverImg: require('@/assets/images/background.jpg'),
  252. time: ''
  253. },
  254. {
  255. id: '2',
  256. name: '防控疫情小贴士',
  257. type: 'vedio',
  258. coverImg: require('@/assets/images/background.jpg'),
  259. time: '03:00'
  260. },
  261. {
  262. id: '3',
  263. name: '防控疫情小贴士2',
  264. type: 'audio',
  265. coverImg: '',
  266. time: '01:20'
  267. }
  268. ],
  269. contentIds: [],
  270. wjjList: [
  271. {
  272. id: '1',
  273. name: '文件夹1'
  274. },
  275. {
  276. id: '2',
  277. name: '文件夹2'
  278. }
  279. ]
  280. }
  281. },
  282. computed: {
  283. ...mapGetters([
  284. 'user'
  285. ])
  286. },
  287. watch: {
  288. isMultiSelected(newName, oldName) {
  289. if (newName === false) {
  290. this.contentIds = []
  291. }
  292. }
  293. },
  294. mounted: function() {
  295. this.start()
  296. },
  297. methods: {
  298. publishHandle(index) {
  299. this.$router.push(
  300. {
  301. path: '/release', query: { tag: index }
  302. }
  303. )
  304. },
  305. handleMkdir() {
  306. this.mkdirVisible = true
  307. },
  308. UploadList() {
  309. this.uploadListVisible = true
  310. },
  311. selectedItem(id, type) {
  312. console.log('type', type)
  313. const arr = this.contentIds
  314. // includes()方法判断是否包含某一元素,返回true或false表示是否包含元素,对NaN一样有效
  315. if (arr.includes(id)) {
  316. // 判断数组中是否有选中的id,如果有则去掉
  317. const index = arr.indexOf(id)
  318. if (index > -1) {
  319. arr.splice(index, 1)
  320. }
  321. } else {
  322. this.contentIds.push(id)
  323. this.formType = type
  324. }
  325. console.log('formType', this.formType)
  326. },
  327. editContent() {
  328. this.mkdirVisible = true
  329. this.labelTxt = '文件名称'
  330. if (this.formType === 'vedio') {
  331. this.layerTitle = '视频编辑'
  332. } else if (this.formType === 'audio') {
  333. this.layerTitle = '音频编辑'
  334. } else {
  335. this.layerTitle = '图片编辑'
  336. }
  337. const resType = this.listData.filter(item => {
  338. return item.id === this.contentIds[0]
  339. })
  340. this.form.name = resType[0].name
  341. },
  342. moveingTo(index) {
  343. this.movingVisible = true
  344. // this.movingChecked = index
  345. },
  346. wjjSelected(index) {
  347. this.movingChecked = index
  348. console.log(this.movingChecked)
  349. },
  350. format(percentage) {
  351. return percentage === 100 ? '100%' : `${percentage}%`
  352. },
  353. start() {
  354. const that = this
  355. that.$nextTick(() => {
  356. that.progressLoading = true
  357. that.percentage = 0
  358. that.timeStart = setInterval(() => {
  359. if (that.percentage < 100) {
  360. that.percentage += 1
  361. }
  362. }, 100)
  363. })
  364. },
  365. // 进度条结束
  366. end() {
  367. this.loading_txt = '继续'
  368. // const that = this
  369. // that.percentage = 100
  370. clearInterval(this.timeStart)
  371. // setTimeout(() => {
  372. // that.progressLoading = false
  373. // }, 300)
  374. }
  375. // handleRemove(file) {
  376. // console.log(file)
  377. // },
  378. // handlePictureCardPreview(file) {
  379. // this.dialogImageUrl = file.url
  380. // this.dialogVisible = true
  381. // },
  382. // handleDownload(file) {
  383. // console.log(file)
  384. // }
  385. }
  386. }
  387. </script>
  388. <style lang="scss" scoped>
  389. .material_content {
  390. display: flex;
  391. flex-wrap: wrap;
  392. margin-left: 24px;
  393. .material_item {
  394. position: relative;
  395. width: 174px;
  396. height: 182px;
  397. border-radius: 4px;
  398. margin: 0 20px 20px 0;
  399. }
  400. .item_cont {
  401. border-color: #dcdde3;
  402. img {
  403. width: 100%;
  404. height: 148px;
  405. }
  406. .radio_img {
  407. width: 100%;
  408. height: 148px;
  409. }
  410. }
  411. }
  412. .upload_layer{
  413. ::v-deep .el-dialog__body{
  414. padding: 0 20px 30px 20px;
  415. }
  416. }
  417. ::v-deep .el-table {
  418. .el-button {
  419. padding: 0 10px;
  420. height: 24px;
  421. &.upload_delt {
  422. background-color: #f76b6b;
  423. }
  424. }
  425. }
  426. ::v-deep .el-upload--picture-card {
  427. width: 128px;
  428. height: 120px;
  429. background-color: #f2f7ff;
  430. }
  431. ::v-deep .el-upload-list--picture-card .el-upload-list__item {
  432. width: 128px;
  433. height: 120px;
  434. }
  435. </style>