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

1072 lines
33 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
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-input v-model="form.relaase_name" :placeholder="changePlaceholder" class="input_name" />
  11. </div>
  12. </el-col>
  13. <el-col :span="4" class="release_right">
  14. <el-button round class="release_btn" type="primary" @click="releaseSubmit">发布</el-button>
  15. <el-button round type="primary">关闭</el-button>
  16. </el-col>
  17. </el-row>
  18. <!-- 第一步设置时间 -->
  19. <el-row class="in_release_item">
  20. <el-col class="step_1">第一步设置时间</el-col>
  21. <el-col class="step_form">
  22. <el-form-item label="发布时间" prop="release_start" :rules="[
  23. { required: true, message: '请选择发布时间', trigger: 'change' }
  24. ]" label-width="100px">
  25. <el-date-picker v-if="publishType == 0" v-model="form.release_start" value-format="yyyy-MM-dd HH:mm:ss" type="date" placeholder="选择日期" />
  26. <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="结束日期" />
  27. </el-form-item>
  28. <el-form-item v-if="publishType == 1" label="设置周期" prop="release_cycle" :rules="[
  29. { required: true, message: '请设置周期:', trigger: 'change' },
  30. ]" :class="['set_weekly',{'no_margin': form.release_cycle == 2}]" label-width="100px">
  31. <el-radio-group v-model="form.release_cycle" @change="clearCheckbox()">
  32. <el-radio :label="1">每天</el-radio>
  33. <el-radio :label="2">每周</el-radio>
  34. </el-radio-group>
  35. </el-form-item>
  36. <el-form-item v-if="form.release_cycle == 2" :class="{'weekly_margin': form.release_cycle == 2}" prop="release_weekly" :rules="[
  37. { required: true, message: '请选择周期时间', trigger: 'change' },
  38. ]">
  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="tab(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" />
  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.length != 0) {
  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 () {
  420. console.log(this.form)
  421. this.form.orga_id = this.orga_id
  422. if (this.form.release_device == 1) {
  423. this.form.release_deviceDTOs = []
  424. } else {
  425. if (this.deviceTags.length == 0) {
  426. this.$message.error('请选择设备 !')
  427. return
  428. }
  429. this.form.release_deviceDTOs = this.deviceTags.map(item => {
  430. const json = {}
  431. json.device_id = item.device_id
  432. return json
  433. })
  434. }
  435. this.form.release_type = this.publishType
  436. // 先判断编辑还是新增
  437. this.form.actual_end = this.publishType == 0 ? null : ''
  438. if (this.publishType == 0) {
  439. this.form.release_cycle = 0
  440. this.form.release_weekly = null
  441. this.form.release_end = this.form.release_start
  442. }
  443. if (this.form.release_cycle == 2) {
  444. this.form.release_weekly = this.selectWeekly.join(',')
  445. }
  446. if (this.form.release_start instanceof Array) {
  447. const arrDate = this.form.release_start
  448. this.form.release_start = arrDate[0]
  449. this.form.release_end = arrDate[1]
  450. }
  451. this.form.release_materialDTOs = this.selectedMaterial.map((item, index) => {
  452. const json = {}
  453. if (item.material_type == 0) {
  454. json.duration = (item.showTime || item.showAnimationName || item.showAnimation) ? item.showTime : 15
  455. json.effect = (item.showTime || item.showAnimationName || item.showAnimation) ? item.showAnimation : 0
  456. json.bgm_path = (item.showAudioName || item.showAudioUrl) ? item.showAudioUrl : null
  457. } else {
  458. json.duration = 0
  459. json.effect = 0
  460. json.bgm_path = null
  461. }
  462. json.material_id = item.material_id
  463. json.material_name = item.material_name
  464. json.img_path = item.img_path
  465. json.file_size = item.file_size
  466. json.rm_id = null
  467. json.ranking = index + 1
  468. return json
  469. })
  470. const isBgm = this.selectedMaterial.find(item => {
  471. return item.material_type == 2
  472. })
  473. if (isBgm) {
  474. this.form.bgm_main = isBgm.deposit_url
  475. } else {
  476. this.form.bgm_main = null
  477. }
  478. saveRelease(this.form).then(res => {
  479. if (res.code == 200) {
  480. this.$message.success('发布成功!')
  481. localStorage.removeItem('selectedMaterial')
  482. } else {
  483. this.$message.error(res.msg)
  484. }
  485. })
  486. },
  487. // 获取设备列表
  488. ReqDeviceList () {
  489. const params = {
  490. device_id: '',
  491. device_name: '',
  492. is_state: '',
  493. page: 1,
  494. size: 10
  495. }
  496. ReqDeviceList(params).then(res => {
  497. if (res.code == 200) {
  498. this.deviceAllTags = res.data.content
  499. } else {
  500. return this.$message.error('获取设备列表失败!')
  501. }
  502. })
  503. },
  504. // 设备list - show
  505. addDeviceTag () {
  506. this.selectDeviceVisible = true
  507. },
  508. // 设备选中list
  509. tagHandle (tag) {
  510. if (this.deviceTags.length == 0) {
  511. this.deviceTags.push(tag)
  512. } else {
  513. const result = this.deviceTags.find((item) => {
  514. return item == tag
  515. })
  516. if (!result) {
  517. this.deviceTags.push(tag)
  518. } else {
  519. this.$message.error('已选择过了~')
  520. }
  521. }
  522. },
  523. // 删除已选择的设备
  524. deltTags (tag) {
  525. this.deviceTags.splice(this.deviceTags.indexOf(tag), 1)
  526. },
  527. // 清空已选择的设备
  528. clearDevice () {
  529. this.deviceTags = []
  530. },
  531. // 根据素材类型获取素材
  532. getMaterialByType () {
  533. const params = {
  534. 'theme_name': '',
  535. 'theme_type': this.themeType,
  536. 'theme_type_not': '',
  537. 'orga_id': this.orga_id,
  538. 'page': this.page,
  539. 'size': this.pageSize
  540. }
  541. getMaterialByType(params).then(res => {
  542. if (res.code == 200) {
  543. this.audioListData = res.data.content
  544. // 素材类型格式处理
  545. this.audioListData.forEach((item, key) => {
  546. this.materialPostfix[key] = item.deposit_url.substring(
  547. item.deposit_url.lastIndexOf('.') + 1,
  548. item.deposit_url.length
  549. )
  550. })
  551. } else {
  552. this.$message({
  553. message: res.msg,
  554. type: 'error'
  555. })
  556. }
  557. })
  558. },
  559. // 删除选择的素材
  560. selectDelt (id, i) {
  561. const index = this.contentIds.indexOf(id)
  562. this.contentIds.splice(index, 1)
  563. this.selectedEditData.splice(index, 1)
  564. this.selectedMaterial.splice(i, 1)
  565. localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial))
  566. },
  567. // 选中可编辑的
  568. clickMaterialItem (id, item) {
  569. const arr = this.contentIds
  570. if (arr.includes(id)) {
  571. const index = arr.indexOf(id)
  572. if (index > -1) {
  573. arr.splice(index, 1)
  574. this.selectedEditData.splice(index, 1)
  575. }
  576. } else {
  577. this.contentIds.push(id)
  578. this.selectedEditData.push(item)
  579. }
  580. },
  581. // 编辑-已选择的
  582. selectEdit () {
  583. this.listEditVisible = true
  584. let form = {
  585. showTime: '15',
  586. showAnimation: '',
  587. showAnimationName: ''
  588. }
  589. this.selectedEditData.map((item, index) => {
  590. if (item.material_type == 0) {
  591. this.setMaterialForm.push(form)
  592. }
  593. })
  594. },
  595. dragEnd () {
  596. // console.log(this.selectedEditData)
  597. // console.log(this.selectedMaterial)
  598. },
  599. // 选择音频
  600. selectAudioCont (type, index) {
  601. this.audioChecked = -1
  602. this.thisEditIndex = index
  603. this.isMultiSelected = false
  604. this.mulitText = '选择'
  605. this.selectAudioVisible = true
  606. // 根据类型获取素材 - audio - 2
  607. this.themeType = 2
  608. this.getMaterialByType()
  609. this.isMainBgm = type == 0 ? 0 : 1
  610. },
  611. // 音频选中-单选
  612. audioCheckedHandle (index) {
  613. if (index != this.audioChecked) {
  614. this.audioChecked = index
  615. } else {
  616. this.audioChecked = -1
  617. }
  618. },
  619. // 音频选中 - 提交
  620. audioCheckedSubmit () {
  621. this.selectAudioVisible = false
  622. if (this.audioChecked != -1) {
  623. const index = this.audioChecked
  624. if (!this.isMainBgm) {
  625. this.audioListData[index].material_type = 2
  626. const resultIndex = this.selectedMaterial.findIndex((item, key) => {
  627. return item.material_type == 2
  628. })
  629. if (resultIndex == -1) {
  630. this.selectedMaterial.push(this.audioListData[index])
  631. } else {
  632. this.selectedMaterial.splice(resultIndex, 1, this.audioListData[index])
  633. }
  634. localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial))
  635. } else {
  636. this.selectedEditData[this.thisEditIndex].showAudioName = this.audioListData[index].material_name
  637. this.selectedEditData[this.thisEditIndex].showAudioUrl = this.audioListData[index].deposit_url
  638. }
  639. } else {
  640. this.selectedEditData[this.thisEditIndex].showAudioName = ''
  641. this.selectedEditData[this.thisEditIndex].showAudioUrl = ''
  642. }
  643. },
  644. // 时间设置-切换到每天时
  645. clearCheckbox () {
  646. if (this.form.release_cycle == 2) {
  647. this.selectWeekly = []
  648. this.form.release_weekly = []
  649. }
  650. },
  651. // 动画切换
  652. selectAnimation (event, item) {
  653. item.showAnimationName = event.name
  654. item.showAnimation = event.key
  655. },
  656. // 选择内容-素材库/主题库 tab
  657. tabAll (index) {
  658. this.activeIndex = index
  659. this.activeItemIndex = 0
  660. this.isMultiSelected = false
  661. this.mulitText = '多选'
  662. },
  663. tab (index) {
  664. this.activeItemIndex = index
  665. },
  666. // 多选btn
  667. multiSelectBtn (type) {
  668. this.isMultiSelected = !this.isMultiSelected
  669. if (this.isMultiSelected) {
  670. this.mulitText = '取消'
  671. // 已选择的内容中-list是否包含,包含即选中状态
  672. this.selectedMaterial.forEach(item => {
  673. this.$refs.MaterialList.selectedListId.push(item.material_id)
  674. this.$refs.MaterialList.selectedMaterial.push(item)
  675. })
  676. } else {
  677. if (type == 'audio') {
  678. this.mulitText = '选择'
  679. this.audioChecked = -1
  680. } else {
  681. this.mulitText = '多选'
  682. }
  683. }
  684. },
  685. // 素材选择 - 确认按钮
  686. uploadSelected () {
  687. this.selectContVisible = false
  688. this.selectedMaterial = []
  689. this.selectedMaterial = this.$refs.MaterialList.selectedMaterial
  690. // 素材类型格式处理
  691. this.selectedMaterial.forEach((item, key) => {
  692. this.materialPostfix[key] = item.deposit_url.substring(
  693. item.deposit_url.lastIndexOf('.') + 1,
  694. item.deposit_url.length
  695. )
  696. })
  697. localStorage.setItem('selectedMaterial', JSON.stringify(this.selectedMaterial))
  698. this.mulitText = '多选'
  699. },
  700. // 素材选择 - 取消按钮
  701. cancelContSelect (type) {
  702. this.isMultiSelected = false
  703. if (type == 'audio') {
  704. this.selectAudioVisible = false
  705. } else {
  706. this.selectContVisible = false
  707. this.mulitText = '多选'
  708. }
  709. }
  710. }
  711. }
  712. </script>
  713. <style lang="scss" scoped>
  714. .app-container {
  715. background: none;
  716. padding: 0;
  717. }
  718. .in_release_item {
  719. padding: 16px 24px;
  720. margin-bottom: 10px;
  721. line-height: 34px;
  722. background: #fff;
  723. border-radius: 6px;
  724. .item_title {
  725. font-size: 16px;
  726. font-weight: bold;
  727. color: #3a8aeb;
  728. }
  729. .input_wrap {
  730. display: flex;
  731. width: 282px;
  732. height: 34px;
  733. padding: 0 24px;
  734. font-size: 14px;
  735. background: #f5f6fa;
  736. line-height: 34px;
  737. border-radius: 34px;
  738. .input_label {
  739. &::after {
  740. content: "|";
  741. padding-left: 8px;
  742. color: #ccc;
  743. }
  744. }
  745. .input_name {
  746. width: 194px;
  747. ::v-deep .el-input__inner {
  748. border: none;
  749. background: #f5f6fa;
  750. }
  751. }
  752. }
  753. .release_right {
  754. text-align: right;
  755. .el-button {
  756. font-size: 14px;
  757. padding: 8px 24px;
  758. border: none !important;
  759. }
  760. .release_btn {
  761. color: #fff;
  762. background: linear-gradient(to right, #fc8c6f, #fa544e) !important;
  763. }
  764. }
  765. }
  766. .step_1 {
  767. font-size: 16px;
  768. line-height: 54px;
  769. border-bottom: 1px solid #eee;
  770. }
  771. .set_weekly {
  772. ::v-deep .el-form-item__label {
  773. line-height: 40px;
  774. }
  775. }
  776. .no_margin {
  777. margin: 0;
  778. }
  779. .weekly_margin {
  780. margin: 0 0 6px 100px;
  781. ::v-deep .el-form-item__error {
  782. top: 70%;
  783. }
  784. }
  785. .step_select {
  786. display: flex;
  787. font-size: 14px;
  788. margin-bottom: 20px;
  789. div {
  790. margin-right: 30px;
  791. }
  792. .step_select_audio {
  793. margin-left: 5px;
  794. padding: 5px;
  795. }
  796. }
  797. .step_select_list {
  798. display: flex;
  799. .step_upload {
  800. width: 164px;
  801. height: 172px;
  802. margin-right: 16px;
  803. border: 1px dashed #dcdde3;
  804. background: url(~@/assets/images/t-sc.png) #f2f7ff no-repeat center center;
  805. background-size: 36px 29px;
  806. border-radius: 6px;
  807. }
  808. }
  809. .material_item {
  810. position: relative;
  811. .select_delt {
  812. position: absolute;
  813. top: 12px;
  814. right: 12px;
  815. .font-icon {
  816. width: 19px;
  817. height: 19px;
  818. }
  819. }
  820. .select_edit {
  821. position: absolute;
  822. bottom: 0;
  823. left: 0;
  824. width: 100%;
  825. height: 44px;
  826. background: rgba(0, 0, 0, 0.5);
  827. text-align: center;
  828. .font-icon {
  829. width: 16px;
  830. height: 17px;
  831. margin-top: 12px;
  832. }
  833. }
  834. }
  835. .step_form {
  836. padding-top: 30px;
  837. .select_all_tip {
  838. margin: -20px 0 0 0;
  839. }
  840. .select_other {
  841. margin: -20px 0 0 0;
  842. }
  843. }
  844. .drag_list {
  845. display: flex;
  846. flex-wrap: wrap;
  847. }
  848. .upload_return {
  849. color: #8ebcfe;
  850. }
  851. .total_time {
  852. position: absolute;
  853. top: 72px;
  854. right: 24px;
  855. font-size: 14px;
  856. color: #000;
  857. }
  858. .edit_material {
  859. display: flex;
  860. padding: 12px 0;
  861. border-bottom: 1px solid #f2f6fd;
  862. &:nth-last-child(2) {
  863. border-bottom: none;
  864. }
  865. .edit_img {
  866. position: relative;
  867. width: 58px;
  868. height: 77px;
  869. border-radius: 4px;
  870. overflow: hidden;
  871. img {
  872. display: block;
  873. width: 100%;
  874. height: 100%;
  875. }
  876. .radio_img {
  877. width: 58px;
  878. height: 77px;
  879. background: url(~@/assets/images/t-yp.png) no-repeat #b3e8fa center;
  880. background-size: 40px 40px;
  881. }
  882. span {
  883. position: absolute;
  884. top: -1px;
  885. left: -1px;
  886. display: block;
  887. width: 20px;
  888. height: 14px;
  889. font-size: 12px;
  890. text-align: center;
  891. color: #fff;
  892. line-height: 14px;
  893. }
  894. }
  895. &:nth-child(odd) {
  896. .edit_img {
  897. span {
  898. background: url(~@/assets/images/num_bg2.png) no-repeat;
  899. background-size: 20px 14px;
  900. }
  901. }
  902. }
  903. &:nth-child(even) {
  904. .edit_img {
  905. span {
  906. background: url(~@/assets/images/num_bg1.png) no-repeat;
  907. background-size: 20px 14px;
  908. }
  909. }
  910. }
  911. .edit_cont {
  912. display: flex;
  913. flex-direction: column;
  914. justify-content: space-between;
  915. flex: 1;
  916. padding: 10px 0 8px 0;
  917. font-size: 14px;
  918. margin-left: 25px;
  919. .edit_cont_base {
  920. display: flex;
  921. p {
  922. margin-right: 14px;
  923. color: #000;
  924. }
  925. span {
  926. display: inline-block;
  927. padding: 0 5px;
  928. margin-right: 8px;
  929. font-size: 12px;
  930. line-height: 16px;
  931. color: #3a8aeb;
  932. background: #cde4ff;
  933. border-radius: 2px;
  934. }
  935. }
  936. .edit_cont_set {
  937. display: flex;
  938. font-size: 12px;
  939. color: #666;
  940. height: 30px;
  941. line-height: 30px;
  942. .set_time {
  943. display: flex;
  944. margin-right: 30px;
  945. span {
  946. margin-right: 8px;
  947. }
  948. em {
  949. display: block;
  950. margin-left: 8px;
  951. font-style: normal;
  952. }
  953. }
  954. .set_animation {
  955. display: flex;
  956. margin-right: 30px;
  957. span.set_item {
  958. margin-right: 8px;
  959. }
  960. ::v-deep .el-form-item__content {
  961. height: 28px;
  962. }
  963. ::v-deep .el-input__suffix {
  964. height: 26px;
  965. }
  966. }
  967. .set_audio {
  968. flex: 1;
  969. .audio_name {
  970. margin-right: 10px;
  971. }
  972. ::v-deep .el-button--small {
  973. padding: 0 15px;
  974. border: none;
  975. }
  976. }
  977. ::v-deep .el-input__inner {
  978. text-align: center;
  979. height: 27px;
  980. line-height: 27px;
  981. }
  982. ::v-deep .el-input__icon {
  983. line-height: 27px;
  984. }
  985. }
  986. .edit_cont_other {
  987. line-height: 27px;
  988. font-size: 12px;
  989. color: #666;
  990. }
  991. }
  992. }
  993. .release_layer {
  994. ::v-deep .el-dialog__header {
  995. padding: 0;
  996. height: 60px;
  997. }
  998. .layer_tab_title {
  999. display: flex;
  1000. span {
  1001. position: relative;
  1002. display: block;
  1003. margin-right: 32px;
  1004. line-height: 60px;
  1005. font-size: 18px;
  1006. color: #666;
  1007. cursor: pointer;
  1008. &.active {
  1009. color: #333;
  1010. }
  1011. &.active::after {
  1012. content: "";
  1013. position: absolute;
  1014. left: 0;
  1015. bottom: 0;
  1016. width: 100%;
  1017. height: 3px;
  1018. background: #3a8aeb;
  1019. }
  1020. }
  1021. }
  1022. .tab_item {
  1023. display: flex;
  1024. font-size: 14px;
  1025. color: #666;
  1026. margin: -14px 0 16px 0;
  1027. li {
  1028. margin-right: 30px;
  1029. cursor: pointer;
  1030. span {
  1031. display: inline-block;
  1032. margin-left: 4px;
  1033. }
  1034. &.active {
  1035. color: #3a8aeb;
  1036. }
  1037. }
  1038. }
  1039. .material_list {
  1040. display: flex;
  1041. flex-wrap: wrap;
  1042. .item_cont {
  1043. margin: 0 24px 20px 0;
  1044. }
  1045. }
  1046. }
  1047. .theme_cont {
  1048. ::v-deep .el-tabs__header {
  1049. padding: 0;
  1050. margin-bottom: 0;
  1051. }
  1052. }
  1053. .release_layer {
  1054. ::v-deep .el-tabs {
  1055. margin: -26px 0 8px 0;
  1056. }
  1057. ::v-deep .el-tabs__nav-wrap::after {
  1058. display: none;
  1059. }
  1060. ::v-deep .el-tabs__active-bar {
  1061. display: none;
  1062. }
  1063. }
  1064. </style>