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

1088 lines
34 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
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
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
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
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 class="app-container">
  3. <el-form ref="form" :model="form" size="small">
  4. <!-- 创建标题 -->
  5. <el-row class="in_release_item" type="flex" justify="space-between">
  6. <el-col :span="3" class="item_title">创建{{ publishType == 0 ? "即时发布" : "定时发布" }}</el-col>
  7. <el-col :span="18">
  8. <div class="input_wrap">
  9. <span class="input_label">名称</span>
  10. <el-form-item prop="relaase_name" :rules="[{ required: true, message: '请输入名称', trigger: 'blur' }]">
  11. <el-input v-model="form.relaase_name" :placeholder="changePlaceholder" class="input_name" />
  12. </el-form-item>
  13. </div>
  14. </el-col>
  15. <el-col :span="4" class="release_right">
  16. <el-button round class="release_btn" type="primary" @click="releaseSubmit('form')">发布</el-button>
  17. <el-button round type="primary">关闭</el-button>
  18. </el-col>
  19. </el-row>
  20. <!-- 第一步设置时间 -->
  21. <el-row class="in_release_item">
  22. <el-col class="step_1">第一步设置时间</el-col>
  23. <el-col class="step_form">
  24. <el-form-item label="发布时间" prop="release_start" :rules="[
  25. { required: true, message: '请选择发布时间', trigger: 'change' }
  26. ]" label-width="100px">
  27. <el-date-picker v-if="publishType == 0" v-model="form.release_start" value-format="yyyy-MM-dd HH:mm:ss" type="date" placeholder="选择日期" />
  28. <el-date-picker v-else v-model="form.release_start" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" range-separator="" start-placeholder="开始日期" end-placeholder="结束日期" />
  29. </el-form-item>
  30. <el-form-item v-if="publishType == 1" label="设置周期" prop="release_cycle" :rules="[
  31. { required: true, message: '请设置周期', trigger: 'change' },
  32. ]" :class="['set_weekly',{'no_margin': form.release_cycle == 2}]" label-width="100px">
  33. <el-radio-group v-model="form.release_cycle" @change="clearCheckbox()">
  34. <el-radio :label="1">每天</el-radio>
  35. <el-radio :label="2">每周</el-radio>
  36. </el-radio-group>
  37. </el-form-item>
  38. <el-form-item v-if="form.release_cycle == 2" :class="{'weekly_margin': form.release_cycle == 2}" prop="release_weekly">
  39. <el-checkbox-group v-model="selectWeekly">
  40. <el-checkbox v-for="item in weeklyList" :key="item.id" :label="item.id" :value="item.id" name="type">{{ item.name }}</el-checkbox>
  41. </el-checkbox-group>
  42. </el-form-item>
  43. <!-- :rules="[
  44. { required: true, message: '请选择是否置顶', trigger: 'change' }
  45. ]" -->
  46. <el-form-item label="是否置顶" prop="is_topping" label-width="100px">
  47. <el-checkbox v-model="form.is_topping">置顶</el-checkbox>
  48. </el-form-item>
  49. </el-col>
  50. </el-row>
  51. <!-- 第二步选择内容 -->
  52. <el-row class="in_release_item">
  53. <el-col class="step_1">第二步选择内容</el-col>
  54. <el-col class="step_form">
  55. <div class="step_select">
  56. <div>已选内容 0</div>
  57. <div>内容总时长0.00s</div>
  58. <div>添加BGM<el-button class="step_select_audio" type="primary" round @click="selectAudioCont(0,-1)">选择文件</el-button>
  59. </div>
  60. </div>
  61. <div class="step_select_list">
  62. <div class="step_upload" @click="selectContVisible = true"></div>
  63. <draggable v-model="selectedMaterial" class="drag_list" @end="dragEnd">
  64. <div v-for="(item, index) in selectedMaterial" :key="'list-'+index" :class="['material_item', 'item_cont']" @click="clickMaterialItem(item.material_id,item)">
  65. <img v-if="item.img_path || item.material_type == 1" :src="item.img_path" :onerror="defaultImg" alt />
  66. <div v-if="!item.img_path && item.material_type == 2" class="radio_img"></div>
  67. <div class="item_format">
  68. <span class="item_type">{{ materialPostfix[index] }}</span>
  69. <span v-if="item.material_type != '0'" class="item_time">{{ item.duration | getSeconds }}</span>
  70. </div>
  71. <div class="file_name">{{ item.material_name }}</div>
  72. <div v-if="contentIds.includes(item.material_id)" class="select_handle">
  73. <div class="select_delt" @click.stop="selectDelt(item.material_id,index)">
  74. <svg class="font-icon icon1" aria-hidden="true">
  75. <use xlink:href="#icon-guanbi2" />
  76. </svg>
  77. </div>
  78. <div class="select_edit" @click.stop="selectEdit()">
  79. <svg class="font-icon icon1" aria-hidden="true">
  80. <use xlink:href="#icon-bianji" />
  81. </svg>
  82. </div>
  83. </div>
  84. </div>
  85. </draggable>
  86. </div>
  87. </el-col>
  88. </el-row>
  89. <!-- 第三步-选择设备 -->
  90. <el-row class="in_release_item">
  91. <el-col class="step_1">第三步选择设备</el-col>
  92. <el-col class="step_form">
  93. <el-form-item label="" prop="release_device" :rules="[
  94. { required: true, message: '请选择设备', trigger: 'change' },
  95. ]">
  96. <el-radio-group v-model="form.release_device" @change="clearDevice()">
  97. <el-radio label="1">所有设备</el-radio>
  98. <el-radio label="2">部分设备<i v-if="form.release_device == 2" class="radio_tip" @click="addDeviceTag()">添加</i></el-radio>
  99. </el-radio-group>
  100. </el-form-item>
  101. <div v-if="form.release_device == 1" class="select_all_tip">所有设备都将被发送</div>
  102. <div v-if="deviceTags.length > 0 && form.release_device == 2" class="select_other">
  103. <el-row>
  104. <el-col :span="10" class="other_tip">以下设备都将被发送<span>总计{{ deviceTags.length }}个设备</span></el-col>
  105. <el-col :span="4">
  106. <el-button round class="delt_btn" @click="clearDevice()">清空</el-button>
  107. </el-col>
  108. </el-row>
  109. <el-tag v-for="tag in deviceTags" :key="tag.device_id" closable :disable-transitions="true" :hit="false" color="#cbe3ff" @close="deltTags(tag)">
  110. {{ tag.device_name }}
  111. </el-tag>
  112. </div>
  113. </el-col>
  114. </el-row>
  115. </el-form>
  116. <!-- 第二步选择内容 - 选择素材 -->
  117. <div class="release_layer upload_layer">
  118. <el-dialog :close-on-click-modal="false" :show-close="false" :visible.sync="selectContVisible" width="1200px">
  119. <div slot="title" class="layer_tab_title">
  120. <span :class="{'active': activeIndex === 0}" @click="tabAll(0)">素材库</span>
  121. <span :class="{'active': activeIndex === 1}" @click="tabAll(1)">主题库</span>
  122. </div>
  123. <!-- 素材库 -->
  124. <div v-if="activeIndex === 0">
  125. <ul class="tab_item">
  126. <li v-for="(item, index) in materialTabItem" :key="index" :class="{'active': activeItemIndex === index}" @click="tabItem(index)">{{ item.name }}<span>{{ item.num }}</span>
  127. </li>
  128. </ul>
  129. <div class="material_list" style="min-height: 260px">
  130. <MaterialList ref="MaterialList" :is-multi-selected="isMultiSelected" :mulit-text="mulitText" :activeItemIndex="activeItemIndex" />
  131. </div>
  132. </div>
  133. <!-- 主题库 -->
  134. <div v-if="activeIndex === 1" class="theme_cont">
  135. <!-- 主题库list -->
  136. <ThemeGalleryList ref="ThemeGalleryList" :is-multi-selected="isMultiSelected" :mulit-text="mulitText" :show-item-info="false" />
  137. </div>
  138. <div class="upload_list_right">
  139. <div class="mulit_btn" @click="multiSelectBtn">{{ mulitText }}</div>
  140. </div>
  141. <div slot="footer" class="dialog-footer">
  142. <el-button type="primary" round @click="uploadSelected()"> </el-button>
  143. <el-button round @click="cancelContSelect"> </el-button>
  144. </div>
  145. </el-dialog>
  146. </div>
  147. <!-- 编辑播放内容 -->
  148. <div class="upload_layer">
  149. <el-dialog title="请选择播放内容" :close-on-click-modal="false" :visible.sync="listEditVisible">
  150. <div class="total_time">
  151. 内容总时长3m15s
  152. </div>
  153. <div v-for="(item, index) in selectedEditData" :key="index" class="edit_material">
  154. <div class="edit_img">
  155. <img v-if="item.img_path || item.material_type == 1" :src="item.img_path" :onerror="defaultImg" alt />
  156. <div v-if="!item.img_path && item.material_type == 2" class="radio_img"></div>
  157. <span class="">{{ index+1 }}</span>
  158. </div>
  159. <div class="edit_cont">
  160. <div class="edit_cont_base">
  161. <p>{{ item.material_name }}</p>
  162. <span>{{ materialPostfix[index] }}</span>
  163. <span>{{ item.file_size | formatBytes }}</span>
  164. </div>
  165. <!-- <div v-if="item.material_type == 0" class="edit_cont_set"> -->
  166. <el-form v-if="item.material_type == 0" :ref="setMaterialForm" :model="setMaterialForm.form" class="edit_cont_set" size="small">
  167. <div class="set_time">
  168. <span>展示时长</span>
  169. <el-form-item :prop="'form.'+index+'.showTime'" style="width: 100px">
  170. <el-input v-model="item.showTime" type="text" placeholder="15" style="width: 66px" />
  171. </el-form-item>
  172. <em></em>
  173. </div>
  174. <div class="set_animation">
  175. <span class="set_item">切换动效</span>
  176. <el-form-item :prop="'form.'+index+'.showAnimation'" style="width: 100px">
  177. <el-select v-model="item.showAnimationName" size="small" class="filter-item" value-key="name" @change="selectAnimation($event, item)">
  178. <el-option v-for="items in animationData" :key="items.key" :label="items.name" :value="items" />
  179. </el-select>
  180. </el-form-item>
  181. </div>
  182. <div class="set_time set_audio">
  183. <span>音频</span>
  184. <p class="audio_name">{{ item.showAudioName }}</p>
  185. <!-- 主题库音频文件不可选择 -->
  186. <el-button type="primary" round @click="selectAudioCont(1,index)">选择文件</el-button>
  187. </div>
  188. </el-form>
  189. <!-- </div> -->
  190. <div v-else class="edit_cont_other">内容时长{{ item.duration | getSeconds }}</div>
  191. </div>
  192. </div>
  193. <div slot="footer" class="dialog-footer">
  194. <el-button type="primary" round @click="listEditVisible = false"> </el-button>
  195. <el-button round @click="listEditVisible = false"> </el-button>
  196. </div>
  197. </el-dialog>
  198. </div>
  199. <!-- 素材库 - 音频选择 -->
  200. <div class="release_layer upload_layer">
  201. <el-dialog :close-on-click-modal="false" :show-close="false" :visible.sync="selectAudioVisible" width="1200px">
  202. <div slot="title" class="layer_tab_title">
  203. <span class="active">素材库</span>
  204. </div>
  205. <div>
  206. <ul class="tab_item">
  207. <li>音频<span>{{ audioListData.length }}</span></li>
  208. </ul>
  209. <div class="material_list">
  210. <div v-for="(item, index) in audioListData" :key="index" :class="['material_item', 'item_cont',{ 'item_multi': audioChecked == index }]" @click="audioCheckedHandle(index)">
  211. <img v-if="item.img_path" :src="item.img_path" alt />
  212. <div v-else class="radio_img"></div>
  213. <div class="item_format">
  214. <span class="item_type">mp3</span>
  215. <span class="item_time">{{ item.duration | getSeconds }}</span>
  216. </div>
  217. <div class="file_name">{{ item.material_name }}</div>
  218. <span v-if="audioChecked == index" class="checked_btn"></span>
  219. </div>
  220. </div>
  221. </div>
  222. <!-- <div class="upload_list_right">
  223. <div class="mulit_btn" @click="multiSelectBtn('audio')">{{ mulitText }}</div>
  224. </div> -->
  225. <div slot="footer" class="dialog-footer">
  226. <el-button type="primary" round @click="audioCheckedSubmit"> </el-button>
  227. <el-button round @click="cancelContSelect('audio')"> </el-button>
  228. </div>
  229. </el-dialog>
  230. </div>
  231. <!-- 添加发布的设备 -->
  232. <div class="add_device_layer">
  233. <el-dialog title="请选择设备" :close-on-click-modal="false" :visible.sync="selectDeviceVisible" width="400px">
  234. <el-tag v-for="tag in deviceAllTags" :key="tag.device_id" :disable-transitions="true" :hit="false" color="#cbe3ff" class="all_tags" @click="tagHandle(tag)">
  235. {{ tag.device_name }}
  236. </el-tag>
  237. </el-dialog>
  238. </div>
  239. </div>
  240. </template>
  241. <script>
  242. import draggable from 'vuedraggable'
  243. import ThemeGalleryList from '../components/ThemeGalleryList.vue'
  244. import MaterialList from '../components/MaterialCompontentList.vue'
  245. import { getMaterialByType } from '@/api/material/material'
  246. import { ReqDeviceList } from '@/api/device/deviceList.js'
  247. import { saveRelease } from '@/api/release/release.js'
  248. import { getSeconds, formatBytes } from '@/utils/index.js'
  249. export default {
  250. name: 'ImmediateRelease',
  251. components: {
  252. draggable,
  253. ThemeGalleryList,
  254. MaterialList
  255. },
  256. filters: {
  257. getSeconds (s) {
  258. return getSeconds(s)
  259. },
  260. formatBytes (bytes, decimals) {
  261. return formatBytes(bytes, decimals)
  262. }
  263. },
  264. data () {
  265. return {
  266. orga_id: '133221333123111',
  267. selectedMaterial: [], // 从其他页面选择带过来的素材
  268. materialPostfix: [],
  269. publishType: 0, // 判断是定时发布还是即时发布页面
  270. themeType: null,
  271. page: 1,
  272. pageSize: 10,
  273. audioListData: [], // 音频list
  274. isMainBgm: null, //是最外层的bgm还是里面的
  275. selectDeviceVisible: false, // 设备list - layer
  276. deviceAllTags: [], // 设备list
  277. deviceTags: [], // 已选择设备list
  278. selectContVisible: false, // 选择内容素材/主题 - layer
  279. selectAudioVisible: false, // 音频list-layer
  280. audioChecked: null, // 音频已选中的
  281. mulitText: '多选',
  282. isMultiSelected: false,
  283. form: {
  284. actual_end: '', // “实际结束时间 yyyy-MM-dd HH:mm:ss”,
  285. is_topping: false, // 是否置顶,
  286. orga_id: '', // "机构id"
  287. bgm_main: '',
  288. relaase_name: '', // 发布名称
  289. release_cycle: '', // 发布周期 0.无 1.每天 2.每周
  290. release_weekly: '', // 发布每周 如果设置为每天则为空
  291. release_device: '', // 发布设备 1.全部 2.部分
  292. release_deviceDTOs: [], // {"device_id": "设备id"}
  293. release_end: '', // “发布结束时间 yyyy-MM-dd HH:mm:ss”
  294. release_id: null, // 发布id 为null则为新增
  295. // {
  296. // "duration": 时长(s),
  297. // "effect": 切换动效,
  298. // "material_id": "素材id",
  299. // "material_name": "素材名称",
  300. // "img_path","显示图片路径",
  301. // "bgm_path":"背景音乐",
  302. // "file_size":"文件大小",
  303. // "ranking": 排序,
  304. // "rm_id": "关联id 新增则为null"
  305. // }
  306. release_materialDTOs: [],
  307. release_start: '', // 发布开始时间 yyyy-MM-dd HH:mm:ss
  308. release_type: '' // 发布类型
  309. },
  310. contentIds: [],
  311. listEditVisible: false, // 可编辑list素材-layer
  312. selectedEditData: [], // 可编辑list内容 - 选择的item
  313. thisEditIndex: null, // 当前音乐选择的index
  314. setMaterialForm: [],
  315. animationData: [ // 图片素材切换动态 - 编辑动画
  316. {
  317. key: '0',
  318. name: '无动画'
  319. },
  320. {
  321. key: '1',
  322. name: '动画1'
  323. },
  324. {
  325. key: '2',
  326. name: '动画2'
  327. }
  328. ],
  329. selectWeekly: [],
  330. weeklyList: [
  331. {
  332. id: '1',
  333. name: '周一'
  334. },
  335. {
  336. id: '2',
  337. name: '周二'
  338. },
  339. {
  340. id: '3',
  341. name: '周三'
  342. },
  343. {
  344. id: '4',
  345. name: '周四'
  346. },
  347. {
  348. id: '5',
  349. name: '周五'
  350. },
  351. {
  352. id: '6',
  353. name: '周六'
  354. },
  355. {
  356. id: '7',
  357. name: '周七'
  358. }
  359. ],
  360. materialTabItem: [ // 素材库 - tab切换title
  361. {
  362. key: 1,
  363. name: '全部',
  364. num: '3'
  365. },
  366. {
  367. key: 2,
  368. name: '图片',
  369. num: '1'
  370. },
  371. {
  372. key: 3,
  373. name: '视频',
  374. num: '1'
  375. },
  376. {
  377. key: 4,
  378. name: '音频',
  379. num: '1'
  380. }
  381. ],
  382. activeIndex: 0,
  383. activeItemIndex: 0,
  384. }
  385. },
  386. computed: {
  387. changePlaceholder () {
  388. return this.publishType == 0 ? '即时发布 2022-01-01' : '定时发布 2022-01-01'
  389. },
  390. defaultImg () {
  391. return 'this.src="' + require('@/assets/images/menu_bg_02.png') + '"'
  392. }
  393. },
  394. created () {
  395. this.selectedMaterial = []
  396. this.selectedMaterial = JSON.parse(localStorage.getItem('selectedMaterial'))
  397. // 素材类型格式处理
  398. if (this.selectedMaterial) {
  399. this.selectedMaterial.forEach((item, key) => {
  400. this.materialPostfix[key] = item.deposit_url.substring(
  401. item.deposit_url.lastIndexOf('.') + 1,
  402. item.deposit_url.length
  403. )
  404. })
  405. }
  406. },
  407. mounted () {
  408. if (this.$route.path === '/release') {
  409. this.materialTabItem.pop()
  410. }
  411. if (this.$route.query.tag) {
  412. this.publishType = this.$route.query.tag
  413. }
  414. // 设备list
  415. this.ReqDeviceList()
  416. },
  417. methods: {
  418. // 发布提交
  419. releaseSubmit (formName) {
  420. this.$refs[formName].validate((valid) => {
  421. if (valid) {
  422. this.form.orga_id = this.orga_id
  423. // 先判断编辑还是新增
  424. this.form.actual_end = this.publishType == 0 ? null : ''
  425. if (this.form.release_device) {
  426. if (this.form.release_device == 1) {
  427. this.form.release_deviceDTOs = []
  428. } else {
  429. if (this.deviceTags.length == 0) {
  430. this.$message.error('请选择设备 !')
  431. return
  432. }
  433. this.form.release_deviceDTOs = this.deviceTags.map(item => {
  434. const json = {}
  435. json.device_id = item.device_id
  436. return json
  437. })
  438. }
  439. }
  440. this.form.release_type = this.publishType
  441. if (this.publishType == 0) {
  442. this.form.release_cycle = 0
  443. this.form.release_weekly = null
  444. this.form.release_end = this.form.release_start
  445. }
  446. if (this.form.release_cycle == 2) {
  447. this.form.release_weekly = this.selectWeekly.join(',')
  448. }
  449. if (this.form.release_start instanceof Array) {
  450. const arrDate = this.form.release_start
  451. this.form.release_start = arrDate[0]
  452. this.form.release_end = arrDate[1]
  453. }
  454. if (this.selectedMaterial) {
  455. this.form.release_materialDTOs = this.selectedMaterial.map((item, index) => {
  456. const json = {}
  457. if (item.material_type == 0) {
  458. json.duration = (item.showTime || item.showAnimationName || item.showAnimation) ? item.showTime : 15
  459. json.effect = (item.showTime || item.showAnimationName || item.showAnimation) ? item.showAnimation : 0
  460. json.bgm_path = (item.showAudioName || item.showAudioUrl) ? item.showAudioUrl : null
  461. } else {
  462. json.duration = 0
  463. json.effect = 0
  464. json.bgm_path = null
  465. }
  466. json.material_id = item.material_id
  467. json.material_name = item.material_name
  468. json.img_path = item.img_path
  469. json.file_size = item.file_size
  470. json.rm_id = null
  471. json.ranking = index + 1
  472. return json
  473. })
  474. // 判断最外层是否有bgm
  475. const isBgm = this.selectedMaterial.find(item => {
  476. return item.material_type == 2
  477. })
  478. if (isBgm) {
  479. this.form.bgm_main = isBgm.deposit_url
  480. } else {
  481. this.form.bgm_main = null
  482. }
  483. saveRelease(this.form).then(res => {
  484. if (res.code == 200) {
  485. this.$message.success('发布成功!')
  486. localStorage.removeItem('selectedMaterial')
  487. } else {
  488. this.$message.error(res.msg)
  489. }
  490. })
  491. } else {
  492. this.$message.error('请选择发布内容!')
  493. }
  494. } else {
  495. console.log('error submit!!');
  496. return false;
  497. }
  498. });
  499. },
  500. // 获取设备列表
  501. ReqDeviceList () {
  502. const params = {
  503. device_id: '',
  504. device_name: '',
  505. is_state: '',
  506. page: 1,
  507. size: 10
  508. }
  509. ReqDeviceList(params).then(res => {
  510. if (res.code == 200) {
  511. this.deviceAllTags = res.data.content
  512. } else {
  513. return this.$message.error('获取设备列表失败!')
  514. }
  515. })
  516. },
  517. // 设备list - show
  518. addDeviceTag () {
  519. this.selectDeviceVisible = true
  520. },
  521. // 设备选中list
  522. tagHandle (tag) {
  523. if (this.deviceTags.length == 0) {
  524. this.deviceTags.push(tag)
  525. } else {
  526. const result = this.deviceTags.find((item) => {
  527. return item == tag
  528. })
  529. if (!result) {
  530. this.deviceTags.push(tag)
  531. } else {
  532. this.$message.error('已选择过了~')
  533. }
  534. }
  535. },
  536. // 删除已选择的设备
  537. deltTags (tag) {
  538. this.deviceTags.splice(this.deviceTags.indexOf(tag), 1)
  539. },
  540. // 清空已选择的设备
  541. clearDevice () {
  542. this.deviceTags = []
  543. },
  544. // 根据素材类型获取素材
  545. getMaterialByType () {
  546. const params = {
  547. 'theme_name': '',
  548. 'theme_type': this.themeType,
  549. 'theme_type_not': '',
  550. 'orga_id': this.orga_id,
  551. 'page': this.page,
  552. 'size': this.pageSize
  553. }
  554. getMaterialByType(params).then(res => {
  555. if (res.code == 200) {
  556. this.audioListData = res.data.content
  557. // 素材类型格式处理
  558. this.audioListData.forEach((item, key) => {
  559. this.materialPostfix[key] = item.deposit_url.substring(
  560. item.deposit_url.lastIndexOf('.') + 1,
  561. item.deposit_url.length
  562. )
  563. })
  564. } else {
  565. this.$message({
  566. message: res.msg,
  567. type: 'error'
  568. })
  569. }
  570. })
  571. },
  572. // 删除选择的素材
  573. selectDelt (id, i) {
  574. const index = this.contentIds.indexOf(id)
  575. this.contentIds.splice(index, 1)
  576. this.selectedEditData.splice(index, 1)
  577. this.selectedMaterial.splice(i, 1)
  578. localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial))
  579. },
  580. // 选中可编辑的
  581. clickMaterialItem (id, item) {
  582. const arr = this.contentIds
  583. if (arr.includes(id)) {
  584. const index = arr.indexOf(id)
  585. if (index > -1) {
  586. arr.splice(index, 1)
  587. this.selectedEditData.splice(index, 1)
  588. }
  589. } else {
  590. this.contentIds.push(id)
  591. this.selectedEditData.push(item)
  592. }
  593. },
  594. // 编辑-已选择的
  595. selectEdit () {
  596. this.listEditVisible = true
  597. let form = {
  598. showTime: '15',
  599. showAnimation: '',
  600. showAnimationName: ''
  601. }
  602. this.selectedEditData.map((item, index) => {
  603. if (item.material_type == 0) {
  604. this.setMaterialForm.push(form)
  605. }
  606. })
  607. },
  608. dragEnd () {
  609. // console.log(this.selectedEditData)
  610. // console.log(this.selectedMaterial)
  611. },
  612. // 选择音频
  613. selectAudioCont (type, index) {
  614. this.audioChecked = -1
  615. this.thisEditIndex = index
  616. this.isMultiSelected = false
  617. this.mulitText = '选择'
  618. this.selectAudioVisible = true
  619. // 根据类型获取素材 - audio - 2
  620. this.themeType = 2
  621. this.getMaterialByType()
  622. this.isMainBgm = type == 0 ? 0 : 1
  623. },
  624. // 音频选中-单选
  625. audioCheckedHandle (index) {
  626. if (index != this.audioChecked) {
  627. this.audioChecked = index
  628. } else {
  629. this.audioChecked = -1
  630. }
  631. },
  632. // 音频选中 - 提交
  633. audioCheckedSubmit () {
  634. this.selectAudioVisible = false
  635. if (this.audioChecked != -1) {
  636. const index = this.audioChecked
  637. if (!this.isMainBgm) {
  638. this.audioListData[index].material_type = 2
  639. const resultIndex = this.selectedMaterial.findIndex((item, key) => {
  640. return item.material_type == 2
  641. })
  642. if (resultIndex == -1) {
  643. this.selectedMaterial.push(this.audioListData[index])
  644. } else {
  645. this.selectedMaterial.splice(resultIndex, 1, this.audioListData[index])
  646. }
  647. localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial))
  648. } else {
  649. this.selectedEditData[this.thisEditIndex].showAudioName = this.audioListData[index].material_name
  650. this.selectedEditData[this.thisEditIndex].showAudioUrl = this.audioListData[index].deposit_url
  651. }
  652. } else {
  653. this.selectedEditData[this.thisEditIndex].showAudioName = ''
  654. this.selectedEditData[this.thisEditIndex].showAudioUrl = ''
  655. }
  656. },
  657. // 时间设置-切换到每天时
  658. clearCheckbox () {
  659. if (this.form.release_cycle == 2) {
  660. this.selectWeekly = []
  661. this.form.release_weekly = []
  662. }
  663. },
  664. // 动画切换
  665. selectAnimation (event, item) {
  666. item.showAnimationName = event.name
  667. item.showAnimation = event.key
  668. },
  669. // 选择内容-素材库/主题库 tab
  670. tabAll (index) {
  671. this.activeIndex = index
  672. this.activeItemIndex = 0
  673. this.isMultiSelected = false
  674. this.mulitText = '多选'
  675. },
  676. // 子菜单-tab
  677. tabItem (index) {
  678. this.activeItemIndex = index
  679. console.log(this.activeItemIndex)
  680. },
  681. // 多选btn
  682. multiSelectBtn (type) {
  683. this.isMultiSelected = !this.isMultiSelected
  684. if (this.isMultiSelected) {
  685. this.mulitText = '取消'
  686. // 已选择的内容中-list是否包含,包含即选中状态
  687. this.selectedMaterial.forEach(item => {
  688. this.$refs.MaterialList.selectedListId.push(item.material_id)
  689. this.$refs.MaterialList.selectedMaterial.push(item)
  690. })
  691. } else {
  692. if (type == 'audio') {
  693. this.mulitText = '选择'
  694. this.audioChecked = -1
  695. } else {
  696. this.mulitText = '多选'
  697. }
  698. }
  699. },
  700. // 素材选择 - 确认按钮
  701. uploadSelected () {
  702. this.selectContVisible = false
  703. this.selectedMaterial = []
  704. this.selectedMaterial = this.$refs.MaterialList.selectedMaterial
  705. // 素材类型格式处理
  706. this.selectedMaterial.forEach((item, key) => {
  707. this.materialPostfix[key] = item.deposit_url.substring(
  708. item.deposit_url.lastIndexOf('.') + 1,
  709. item.deposit_url.length
  710. )
  711. })
  712. localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial))
  713. this.mulitText = '多选'
  714. },
  715. // 素材选择 - 取消按钮
  716. cancelContSelect (type) {
  717. this.isMultiSelected = false
  718. if (type == 'audio') {
  719. this.selectAudioVisible = false
  720. } else {
  721. this.selectContVisible = false
  722. this.mulitText = '多选'
  723. }
  724. }
  725. }
  726. }
  727. </script>
  728. <style lang="scss" scoped>
  729. .app-container {
  730. background: none;
  731. padding: 0;
  732. }
  733. .in_release_item {
  734. padding: 16px 24px;
  735. margin-bottom: 10px;
  736. line-height: 34px;
  737. background: #fff;
  738. border-radius: 6px;
  739. .item_title {
  740. font-size: 16px;
  741. font-weight: bold;
  742. color: #3a8aeb;
  743. }
  744. .input_wrap {
  745. display: flex;
  746. width: 282px;
  747. height: 34px;
  748. padding: 0 24px;
  749. font-size: 14px;
  750. background: #f5f6fa;
  751. line-height: 34px;
  752. border-radius: 34px;
  753. .input_label {
  754. &::after {
  755. content: "|";
  756. padding-left: 8px;
  757. color: #ccc;
  758. }
  759. }
  760. .input_name {
  761. width: 194px;
  762. ::v-deep .el-input__inner {
  763. border: none;
  764. background: #f5f6fa;
  765. }
  766. }
  767. }
  768. .release_right {
  769. text-align: right;
  770. .el-button {
  771. font-size: 14px;
  772. padding: 8px 24px;
  773. border: none !important;
  774. }
  775. .release_btn {
  776. color: #fff;
  777. background: linear-gradient(to right, #fc8c6f, #fa544e) !important;
  778. }
  779. }
  780. }
  781. .step_1 {
  782. font-size: 16px;
  783. line-height: 54px;
  784. border-bottom: 1px solid #eee;
  785. }
  786. .set_weekly {
  787. ::v-deep .el-form-item__label {
  788. line-height: 40px;
  789. }
  790. }
  791. .no_margin {
  792. margin: 0;
  793. }
  794. .weekly_margin {
  795. margin: 0 0 6px 100px;
  796. ::v-deep .el-form-item__error {
  797. top: 70%;
  798. }
  799. }
  800. .step_select {
  801. display: flex;
  802. font-size: 14px;
  803. margin-bottom: 20px;
  804. div {
  805. margin-right: 30px;
  806. }
  807. .step_select_audio {
  808. margin-left: 5px;
  809. padding: 5px;
  810. }
  811. }
  812. .step_select_list {
  813. display: flex;
  814. .step_upload {
  815. width: 164px;
  816. height: 172px;
  817. margin-right: 16px;
  818. border: 1px dashed #dcdde3;
  819. background: url(~@/assets/images/t-sc.png) #f2f7ff no-repeat center center;
  820. background-size: 36px 29px;
  821. border-radius: 6px;
  822. }
  823. }
  824. .material_item {
  825. position: relative;
  826. .select_delt {
  827. position: absolute;
  828. top: 12px;
  829. right: 12px;
  830. .font-icon {
  831. width: 19px;
  832. height: 19px;
  833. }
  834. }
  835. .select_edit {
  836. position: absolute;
  837. bottom: 0;
  838. left: 0;
  839. width: 100%;
  840. height: 44px;
  841. background: rgba(0, 0, 0, 0.5);
  842. text-align: center;
  843. .font-icon {
  844. width: 16px;
  845. height: 17px;
  846. margin-top: 12px;
  847. }
  848. }
  849. }
  850. .step_form {
  851. padding-top: 30px;
  852. .select_all_tip {
  853. margin: -20px 0 0 0;
  854. }
  855. .select_other {
  856. margin: -20px 0 0 0;
  857. }
  858. }
  859. .drag_list {
  860. display: flex;
  861. flex-wrap: wrap;
  862. }
  863. .upload_return {
  864. color: #8ebcfe;
  865. }
  866. .total_time {
  867. position: absolute;
  868. top: 72px;
  869. right: 24px;
  870. font-size: 14px;
  871. color: #000;
  872. }
  873. .edit_material {
  874. display: flex;
  875. padding: 12px 0;
  876. border-bottom: 1px solid #f2f6fd;
  877. &:nth-last-child(2) {
  878. border-bottom: none;
  879. }
  880. .edit_img {
  881. position: relative;
  882. width: 58px;
  883. height: 77px;
  884. border-radius: 4px;
  885. overflow: hidden;
  886. img {
  887. display: block;
  888. width: 100%;
  889. height: 100%;
  890. }
  891. .radio_img {
  892. width: 58px;
  893. height: 77px;
  894. background: url(~@/assets/images/t-yp.png) no-repeat #b3e8fa center;
  895. background-size: 40px 40px;
  896. }
  897. span {
  898. position: absolute;
  899. top: -1px;
  900. left: -1px;
  901. display: block;
  902. width: 20px;
  903. height: 14px;
  904. font-size: 12px;
  905. text-align: center;
  906. color: #fff;
  907. line-height: 14px;
  908. }
  909. }
  910. &:nth-child(odd) {
  911. .edit_img {
  912. span {
  913. background: url(~@/assets/images/num_bg2.png) no-repeat;
  914. background-size: 20px 14px;
  915. }
  916. }
  917. }
  918. &:nth-child(even) {
  919. .edit_img {
  920. span {
  921. background: url(~@/assets/images/num_bg1.png) no-repeat;
  922. background-size: 20px 14px;
  923. }
  924. }
  925. }
  926. .edit_cont {
  927. display: flex;
  928. flex-direction: column;
  929. justify-content: space-between;
  930. flex: 1;
  931. padding: 10px 0 8px 0;
  932. font-size: 14px;
  933. margin-left: 25px;
  934. .edit_cont_base {
  935. display: flex;
  936. p {
  937. margin-right: 14px;
  938. color: #000;
  939. }
  940. span {
  941. display: inline-block;
  942. padding: 0 5px;
  943. margin-right: 8px;
  944. font-size: 12px;
  945. line-height: 16px;
  946. color: #3a8aeb;
  947. background: #cde4ff;
  948. border-radius: 2px;
  949. }
  950. }
  951. .edit_cont_set {
  952. display: flex;
  953. font-size: 12px;
  954. color: #666;
  955. height: 30px;
  956. line-height: 30px;
  957. .set_time {
  958. display: flex;
  959. margin-right: 30px;
  960. span {
  961. margin-right: 8px;
  962. }
  963. em {
  964. display: block;
  965. margin-left: 8px;
  966. font-style: normal;
  967. }
  968. }
  969. .set_animation {
  970. display: flex;
  971. margin-right: 30px;
  972. span.set_item {
  973. margin-right: 8px;
  974. }
  975. ::v-deep .el-form-item__content {
  976. height: 28px;
  977. }
  978. ::v-deep .el-input__suffix {
  979. height: 26px;
  980. }
  981. }
  982. .set_audio {
  983. flex: 1;
  984. .audio_name {
  985. margin-right: 10px;
  986. }
  987. ::v-deep .el-button--small {
  988. padding: 0 15px;
  989. border: none;
  990. }
  991. }
  992. ::v-deep .el-input__inner {
  993. text-align: center;
  994. height: 27px;
  995. line-height: 27px;
  996. }
  997. ::v-deep .el-input__icon {
  998. line-height: 27px;
  999. }
  1000. }
  1001. .edit_cont_other {
  1002. line-height: 27px;
  1003. font-size: 12px;
  1004. color: #666;
  1005. }
  1006. }
  1007. }
  1008. .release_layer {
  1009. ::v-deep .el-dialog__header {
  1010. padding: 0;
  1011. height: 60px;
  1012. }
  1013. .layer_tab_title {
  1014. display: flex;
  1015. span {
  1016. position: relative;
  1017. display: block;
  1018. margin-right: 32px;
  1019. line-height: 60px;
  1020. font-size: 18px;
  1021. color: #666;
  1022. cursor: pointer;
  1023. &.active {
  1024. color: #333;
  1025. }
  1026. &.active::after {
  1027. content: "";
  1028. position: absolute;
  1029. left: 0;
  1030. bottom: 0;
  1031. width: 100%;
  1032. height: 3px;
  1033. background: #3a8aeb;
  1034. }
  1035. }
  1036. }
  1037. .tab_item {
  1038. display: flex;
  1039. font-size: 14px;
  1040. color: #666;
  1041. margin: -14px 0 16px 0;
  1042. li {
  1043. margin-right: 30px;
  1044. cursor: pointer;
  1045. span {
  1046. display: inline-block;
  1047. margin-left: 4px;
  1048. }
  1049. &.active {
  1050. color: #3a8aeb;
  1051. }
  1052. }
  1053. }
  1054. .material_list {
  1055. display: flex;
  1056. flex-wrap: wrap;
  1057. .item_cont {
  1058. margin: 0 24px 20px 0;
  1059. }
  1060. }
  1061. }
  1062. .theme_cont {
  1063. ::v-deep .el-tabs__header {
  1064. padding: 0;
  1065. margin-bottom: 0;
  1066. }
  1067. }
  1068. .release_layer {
  1069. ::v-deep .el-tabs {
  1070. margin: -26px 0 8px 0;
  1071. }
  1072. ::v-deep .el-tabs__nav-wrap::after {
  1073. display: none;
  1074. }
  1075. ::v-deep .el-tabs__active-bar {
  1076. display: none;
  1077. }
  1078. }
  1079. </style>