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

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