index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. <template>
  2. <div class="app-container">
  3. <el-tabs v-model="activeTab" @tab-click="handleClick">
  4. <el-tab-pane v-for="item in tabs" :key="item.id" :label="item.name" :name="item.id.toString()" />
  5. </el-tabs>
  6. <!-- 内容 -->
  7. <div style="display: flex; position: relative; align-items: flex-start">
  8. <el-image class="bg" :src="img" />
  9. <div :class="['item', active === index ? 'active' : '']"
  10. :style="{top: item.top + 'px', height: item.height + 'px'}" v-for="(item, index) in style[tabIndex]"
  11. :key="index" @click="getActive(index)" />
  12. <div class="form">
  13. <!-- 标题内容模块 -->
  14. <el-form v-if="content()" label-width="auto">
  15. <el-form-item label="标题">
  16. <el-input v-model="contentForm.name" placeholder="请输入标题" />
  17. </el-form-item>
  18. <el-form-item label="简介:" v-if="tabIndex === 1 && active === 8">
  19. <el-input v-model="contentForm.description" type="textarea" rows="4" placeholder="请输入简介" />
  20. </el-form-item>
  21. <el-form-item>
  22. <el-button type="primary" @click="getChange" v-hasPermi="['operation:recommend:submit']">
  23. 提交
  24. </el-button>
  25. </el-form-item>
  26. </el-form>
  27. <!-- 推荐时间段配置 -->
  28. <div v-if="tabIndex === 1 && active === 0" style="float: left">
  29. <el-form label-width="auto" v-for="(item, index) in timeList" :key="item.id">
  30. <el-form-item label-width="0">
  31. <span style="font-weight: bold">场景电台时间设置</span>
  32. <el-link icon="el-icon-close" :underline="false" style="float:right"
  33. @click="getChangeTime(item.id, 2)" />
  34. </el-form-item>
  35. <el-form-item label="时间段:">
  36. <el-time-picker is-range v-model="item.date" start-placeholder="开始时间" end-placeholder="结束时间" value-format="HH:mm:ss"
  37. format="HH:mm:ss" placeholder="选择时间范围" />
  38. </el-form-item>
  39. <el-form-item label="时间段文案:">
  40. <el-input v-model="item.name" placeholder="请输入文案" />
  41. </el-form-item>
  42. <el-form-item label="时间段Icon:">
  43. <Upload listType="picture-card" :url="item.pic" @upload="uploadIcon($event, index)" />
  44. </el-form-item>
  45. <el-form-item>
  46. <el-button @click="getEmpty(item)" v-hasPermi="['operation:recommend:delete']">清空</el-button>
  47. <el-button type="primary" @click="getSubmitTime(item)"
  48. v-hasPermi="['operation:recommend:submit']">提交</el-button>
  49. <el-button v-if="item.status === 0" type="primary" plain @click="getChangeTime(item.id, 1)"
  50. v-hasPermi="['operation:recommend:up']">上架
  51. </el-button>
  52. <el-button v-else type="primary" plain @click="getChangeTime(item.id, 0)"
  53. v-hasPermi="['operation:recommend:down']">下架</el-button>
  54. </el-form-item>
  55. </el-form>
  56. <el-button type="primary" style="margin-left: 30px" @click="getAdd"
  57. v-hasPermi="['operation:recommend:add']">新增</el-button>
  58. </div>
  59. <!-- 标签 -->
  60. <el-form class="label" v-if="label()">
  61. <el-form-item v-for="item in list" :key="item.id">
  62. <el-button type="primary">{{ item.title }}</el-button>
  63. </el-form-item>
  64. </el-form>
  65. <!-- 内容列表模块 -->
  66. <div v-else :style="{'display': tabIndex === 1 && active === 0 ? 'inline-block' : 'block'}">
  67. <el-form label-width="auto" v-for="(item, index) in list" :key="item.id">
  68. <el-form-item label-width="0" :label="item.sort.toString()" />
  69. <el-form-item label="时间:" v-if="time()">
  70. <el-date-picker v-model="item.date" type="datetimerange" start-placeholder="开始日期"
  71. end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" />
  72. </el-form-item>
  73. <el-form-item label="标题:" v-if="title()">
  74. <el-input v-model="item.title" placeholder="请输入标题" />
  75. </el-form-item>
  76. <el-form-item label="模式:" v-if="model()">
  77. <el-select v-model="item.model" placeholder="请选择模式">
  78. <el-option v-for="item in dict.type.content_model" :key="item.value" :label="item.label"
  79. :value="Number(item.value)" />
  80. </el-select>
  81. </el-form-item>
  82. <el-form-item label="跳转方式:" v-if="forwardType()">
  83. <el-select v-model="item.forwardType" placeholder="请选择跳转方式">
  84. <el-option v-for="item in typeOptions" :key="item.value" :label="item.label"
  85. :value="Number(item.value)" />
  86. </el-select>
  87. </el-form-item>
  88. <el-form-item label="内容:" v-if="contentName(item)">
  89. <el-input v-model="item.contentName" prefix-icon="el-icon-search" placeholder="选择内容"
  90. @focus="getDialog(index)" />
  91. </el-form-item>
  92. <el-form-item label="简介:" v-if="description(item)">
  93. <el-input v-model="item.description" type="textarea" rows="4" placeholder="请输入简介" />
  94. </el-form-item>
  95. <el-form-item label="跳转地址:" v-if="forwardUrl(item)">
  96. <el-input v-model="item.forwardUrl" placeholder="请输入跳转地址" />
  97. </el-form-item>
  98. <el-form-item label="封面模式:" v-if="isCustom(item)">
  99. <el-select v-model="item.isCustom" placeholder="选择封面模式">
  100. <el-option v-for="item in dict.type.is_custom" :key="item.value" :label="item.label"
  101. :value="Number(item.value)" />
  102. </el-select>
  103. </el-form-item>
  104. <el-form-item label="图片:" v-if="pic(item)">
  105. <Upload listType="picture-card" :url="item.pic" @upload="getUpload($event, index)" />
  106. </el-form-item>
  107. <el-form-item label="列表:" v-if="isList()">
  108. <el-button type="primary" @click="getDialog(index)" v-hasPermi="['operation:recommend:add']">
  109. 添加内容
  110. </el-button>
  111. <el-table :data="item.childList" height="332">
  112. <el-table-column label="电台名称:" prop="contentName" align="center" show-overflow-tooltip />
  113. <el-table-column label="当前状态" prop="status" align="center" :formatter="statusFormatter" />
  114. <el-table-column label="操作" align="center">
  115. <template slot-scope="scope">
  116. <el-button type="delete" @click="getDelete(scope.row, index)"
  117. v-hasPermi="['operation:recommend:delete']">删除</el-button>
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. </el-form-item>
  122. <el-form-item size="small">
  123. <el-button @click="getEmpty(item)" v-hasPermi="['operation:recommend:delete']">清空</el-button>
  124. <el-button type="primary" @click="getSubmit(item)" v-hasPermi="['operation:recommend:submit']">
  125. 提交
  126. </el-button>
  127. <el-button v-if="item.status === 1" type="primary" plain @click="handleChange(item, 0)"
  128. v-hasPermi="['operation:recommend:up']">上架
  129. </el-button>
  130. <el-button v-else type="primary" plain @click="handleChange(item, 1)"
  131. v-hasPermi="['operation:recommend:down']">下架</el-button>
  132. </el-form-item>
  133. </el-form>
  134. </div>
  135. </div>
  136. </div>
  137. <!-- 弹窗 -->
  138. <el-dialog :visible.sync="dialogVisible" title="添加内容" width="1000px">
  139. <el-form inline size="mini">
  140. <el-form-item label="音频类型:">
  141. <el-select v-model="form.audioType" placeholder="请选择类型" :disabled="disabled">
  142. <el-option v-for="item in audioOptions" :key="item.value" :label="item.label"
  143. :value="item.value" />
  144. </el-select>
  145. </el-form-item>
  146. <el-form-item label="资源平台:">
  147. <el-select v-model="form.platformId" placeholder="请选择平台">
  148. <el-option v-for="item in platformOptions" :key="item.value" :label="item.label"
  149. :value="item.value" />
  150. </el-select>
  151. </el-form-item>
  152. <el-form-item label="内容:">
  153. <el-input v-model="form.keyword" placeholder="请输入内容关键词" clearable />
  154. </el-form-item>
  155. <el-form-item>
  156. <el-button type="primary" icon="el-icon-search" @click="getSearch">搜索</el-button>
  157. </el-form-item>
  158. </el-form>
  159. <el-table :data="tableData" height="584" ref="tableData" :row-key="rowKey"
  160. @selection-change="handleSelectionChange">
  161. <el-table-column type="selection" align="center" reserve-selection
  162. v-if="tabIndex === 2 && active === 1" />
  163. <el-table-column label="音频ID" prop="audioId" align="center" show-overflow-tooltip />
  164. <el-table-column label="音频名称" prop="audioName" align="center" show-overflow-tooltip />
  165. <el-table-column label="音频封面" align="center" width="100px">
  166. <template slot-scope="scope">
  167. <el-image :src="scope.row.audioPic" />
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="音频类型" prop="audioType" align="center" :formatter="audioFormatter" />
  171. <el-table-column label="音频数量" prop="programCount" align="center" />
  172. <el-table-column label="付费类型" align="center" :formatter="freeFormatter" width="100px" />
  173. <el-table-column label="当前状态" align="center" :formatter="listStatusFormatter" />
  174. <el-table-column label="操作" align="center">
  175. <template slot-scope="scope">
  176. <el-button v-if="tabIndex === 2 && active === 1 ? false : true" type="text"
  177. @click="getSelect(scope.row)" :disabled="scope.row.status === 2">
  178. 选择
  179. </el-button>
  180. </template>
  181. </el-table-column>
  182. </el-table>
  183. <pagination v-show="total>0" :total="total" :page.sync="form.pageNum" :limit.sync="form.pageSize"
  184. @pagination="getContentList" />
  185. </el-dialog>
  186. <!-- 置顶按钮 -->
  187. <el-backtop />
  188. </div>
  189. </template>
  190. <script>
  191. import {
  192. listAll,
  193. recommendList,
  194. moduleDetail,
  195. submit,
  196. contentList,
  197. radioList,
  198. moduleContent,
  199. upOrDown,
  200. timeList,
  201. submitTime,
  202. changeTime
  203. } from '@/api/operation/recommend'
  204. import Upload from '@/components/Upload/index'
  205. import { isFreeMixin, audioMixin, platformMixin, onOrOffMixin } from '@/mixin/index'
  206. export default {
  207. dicts: [
  208. 'platform_type',
  209. 'is_custom',
  210. 'content_model'
  211. ],
  212. mixins: [isFreeMixin, audioMixin, platformMixin, onOrOffMixin],
  213. components: {
  214. Upload
  215. },
  216. data() {
  217. return {
  218. // 分类列表
  219. tabs: [],
  220. // 选中分类
  221. activeTab: '77',
  222. // 分类排序
  223. tabIndex: 1,
  224. // 模板列表
  225. module: [],
  226. // 模板图
  227. imgOptions: {
  228. '0': require('@/assets/images/operation/recommend.svg'),
  229. '1': require('@/assets/images/operation/radio.svg'),
  230. '2': require('@/assets/images/operation/music.svg'),
  231. '3': require('@/assets/images/operation/story.svg'),
  232. '4': require('@/assets/images/operation/kid.svg'),
  233. '5': require('@/assets/images/operation/other.svg')
  234. },
  235. img: require('@/assets/images/operation/recommend.svg'),
  236. // 选中模块
  237. style: {
  238. '1': [
  239. { top: 150, height: 225 },
  240. { top: 380, height: 175 },
  241. { top: 560, height: 185 },
  242. { top: 750, height: 315 },
  243. { top: 1070, height: 645 },
  244. { top: 1720, height: 185 },
  245. { top: 1910, height: 220 },
  246. { top: 2140, height: 315 },
  247. { top: 2460, height: 295 },
  248. { top: 2760, height: 600 },
  249. { top: 3370, height: 260 },
  250. { top: 3635, height: 600 }
  251. ],
  252. '2': [
  253. { top: 135, height: 165 },
  254. { top: 310, height: 250 },
  255. { top: 570, height: 100 },
  256. { top: 1465, height: 570 }
  257. ],
  258. '3': [
  259. { top: 150, height: 170 },
  260. { top: 385, height: 90 },
  261. { top: 480, height: 215 },
  262. { top: 700, height: 175 },
  263. { top: 880, height: 310 },
  264. { top: 1195, height: 300 },
  265. { top: 1500, height: 215 },
  266. { top: 1720, height: 305 },
  267. { top: 2490, height: 210 },
  268. { top: 2705, height: 220 },
  269. ],
  270. '4': [
  271. { top: 150, height: 165 },
  272. { top: 320, height: 115 },
  273. { top: 440, height: 405 },
  274. { top: 850, height: 230 },
  275. { top: 1085, height: 410 },
  276. { top: 1500, height: 130 },
  277. { top: 1635, height: 405 },
  278. { top: 2045, height: 170 },
  279. { top: 2220, height: 405 },
  280. { top: 2850, height: 405 },
  281. { top: 3260, height: 405 },
  282. { top: 3670, height: 620 }
  283. ],
  284. '5': [
  285. { top: 150, height: 180 },
  286. { top: 335, height: 120 },
  287. { top: 460, height: 425 },
  288. { top: 890, height: 125 },
  289. { top: 1020, height: 425 },
  290. { top: 1450, height: 210 },
  291. { top: 1665, height: 425 },
  292. { top: 2325, height: 640 }
  293. ],
  294. '6': [
  295. { top: 140, height: 165 },
  296. { top: 310, height: 115 },
  297. { top: 430, height: 375 },
  298. { top: 810, height: 385 },
  299. { top: 1200, height: 120 },
  300. { top: 1325, height: 390 },
  301. { top: 1720, height: 160 },
  302. { top: 1885, height: 385 },
  303. { top: 2480, height: 390 },
  304. { top: 2875, height: 590 }
  305. ]
  306. },
  307. active: 0,
  308. // 模块内容
  309. contentForm: {},
  310. list: [],
  311. // 时间段列表
  312. timeList: [],
  313. // 弹窗
  314. dialogVisible: false,
  315. form: {
  316. pageNum: 1,
  317. pageSize: 10,
  318. audioType: null,
  319. platformId: null
  320. },
  321. total: 0,
  322. index: 0,
  323. disabled: false,
  324. // 列表
  325. tableData: [],
  326. // 跳转方式
  327. typeOptions: [{
  328. value: 0,
  329. label: 'APP内容跳转广播',
  330. type: 2
  331. }, {
  332. value: 1,
  333. label: 'APP内容跳转歌曲',
  334. type: 11
  335. }, {
  336. value: 2,
  337. label: 'APP内容跳转歌单',
  338. type: 10
  339. }, {
  340. value: 3,
  341. label: 'APP内容跳转专辑',
  342. type: 8
  343. }, {
  344. value: 4,
  345. label: 'APP内打开节目',
  346. type: 6
  347. }, {
  348. value: 5,
  349. label: 'H5内链'
  350. }, {
  351. value: 6,
  352. label: 'H5外链'
  353. }]
  354. }
  355. },
  356. watch: {
  357. 'form.audioType'(val) {
  358. this.$nextTick(() => {
  359. this.getPlatform({
  360. audioType: val
  361. })
  362. })
  363. this.form.platformId = this.platformOptions[0].value
  364. },
  365. },
  366. mounted() {
  367. this.getTab()
  368. },
  369. methods: {
  370. // 分类列表
  371. getTab() {
  372. listAll().then(res => {
  373. if (res.code === 0) {
  374. this.tabs = res.data
  375. this.getModule(this.activeTab)
  376. this.getTimeList()
  377. }
  378. })
  379. },
  380. // 切换分类
  381. handleClick(e) {
  382. this.activeTab = this.tabs[e.index].id.toString()
  383. this.tabIndex = this.tabs[e.index].tabIndex
  384. e.index >= 5 ? e.index = 5 : e.index
  385. this.img = this.imgOptions[e.index]
  386. this.active = 0
  387. this.list = []
  388. this.getModule(this.activeTab)
  389. },
  390. // 模块列表
  391. getModule(id) {
  392. recommendList({
  393. categoryId: id
  394. }).then(res => {
  395. if (res.code === 0) {
  396. this.module = res.data
  397. this.getModuleDetail(res.data[0].id)
  398. this.getContentDetail(res.data[0].id)
  399. }
  400. })
  401. },
  402. // 选择模块
  403. getActive(index) {
  404. if (this.active !== index) {
  405. this.active = index
  406. this.form.audioType = 2
  407. this.getModuleDetail(this.module[index].id)
  408. this.getContentDetail(this.module[index].id)
  409. }
  410. if (this.tabIndex === 1 && this.active === 0) {
  411. this.getTimeList()
  412. }
  413. },
  414. // 模块详情
  415. getModuleDetail(id) {
  416. moduleDetail({
  417. id: id
  418. }).then(res => {
  419. if (res.code === 0) {
  420. this.contentForm = res.data
  421. }
  422. })
  423. },
  424. // 时间段列表
  425. getTimeList() {
  426. this.timeList = []
  427. timeList().then(res => {
  428. if (res.code === 0) {
  429. res.data.map(i => {
  430. this.timeList.push({
  431. ...i,
  432. date: [i.startTime, i.endTime]
  433. })
  434. })
  435. }
  436. })
  437. },
  438. // 模块内容列表
  439. getContentDetail(id) {
  440. this.list = []
  441. contentList({
  442. moduleId: id
  443. }).then(res => {
  444. if (res.code === 0) {
  445. res.data.map(i => {
  446. this.list.push({
  447. ...i,
  448. date: [i.startTime, i.endTime]
  449. })
  450. })
  451. }
  452. })
  453. },
  454. // 标题模块提交
  455. getChange() {
  456. moduleContent(this.contentForm).then(res => {
  457. if (res.code === 0) {
  458. this.$message.success('提交成功!')
  459. this.getModuleDetail(this.contentForm.id)
  460. }
  461. })
  462. },
  463. // 内容列表提交
  464. getSubmit(item) {
  465. item.startTime = item.date[0]
  466. item.endTime = item.date[1]
  467. delete item.date
  468. submit(item).then(res => {
  469. if (res.code === 0) {
  470. this.$message.success('提交成功!')
  471. this.getContentDetail(item.moduleId)
  472. }
  473. })
  474. },
  475. // 弹窗
  476. getDialog(index) {
  477. this.dialogVisible = true
  478. this.index = index
  479. this.form.audioType = this.list[index].forwardType !== null ? this.typeOptions.find(i => i.value === this.list[index].forwardType).type : 2
  480. this.disabled = this.tabIndex == 2 && this.active === 1 || this.list[index].forwardType !== null ? true : false
  481. this.getContentList()
  482. },
  483. // 搜索
  484. getSearch() {
  485. this.form.pageNum = 1
  486. this.getContentList()
  487. },
  488. // 内容列表
  489. getContentList() {
  490. radioList(this.form).then(res => {
  491. if (res.code === 0) {
  492. this.tableData = res.data.records
  493. this.total = res.data.total
  494. if (this.tableData.length > 0) {
  495. this.list[this.index].childList.map(i => {
  496. let row = res.data.records.find(j => j.audioId === i.contentId)
  497. if (row) {
  498. this.$refs.tableData.toggleRowSelection(row, true)
  499. }
  500. })
  501. }
  502. }
  503. })
  504. },
  505. // 选择某一个音频内容
  506. getSelect(row) {
  507. let e = this.list[this.index]
  508. e.contentId = row.audioId
  509. e.contentName = row.audioName
  510. e.pic = row.audioPic
  511. e.platformId = row.platformId
  512. e.contentType = row.audioType
  513. e.description = row.description
  514. this.dialogVisible = false
  515. this.$message.success('选择成功!')
  516. },
  517. rowKey(row) {
  518. return row.audioId
  519. },
  520. // 批量选择
  521. handleSelectionChange(row) {
  522. if (row.length > 0) {
  523. row.map(i => {
  524. if (this.list[this.index].childList.findIndex(j => j.contentId === i.audioId) === -1) {
  525. this.list[this.index].childList.push({
  526. contentId: i.audioId,
  527. contentName: i.audioName,
  528. platformId: i.platformId,
  529. contentType: i.audioType,
  530. pic: i.audioPic,
  531. description: i.description
  532. })
  533. }
  534. })
  535. }
  536. },
  537. // 删除已添加的内容
  538. getDelete(row, index) {
  539. let e = this.list[index].childList.findIndex(i => i.contentId === row.contentId)
  540. this.list[index].childList.splice(e, 1)
  541. },
  542. // 上传图片
  543. getUpload(e, index) {
  544. this.list[index].pic = e.file
  545. },
  546. // 清空
  547. getEmpty(item) {
  548. Object.keys(item).map(key => {
  549. if (!['id', 'moduleId', 'sort', 'status'].includes(key)) {
  550. item[key] = key === 'childList' ? [] : ''
  551. }
  552. })
  553. },
  554. // 上下架
  555. handleChange(item, status) {
  556. let tips = status === 0 ? '上架' : '下架'
  557. this.$confirm(`是否要${tips}?`, '提醒', {
  558. confirmButtonText: '确定',
  559. cancelButtonText: '取消',
  560. type: 'warning'
  561. }).then(() => {
  562. upOrDown(item.id, status).then(res => {
  563. if (res.code === 0) {
  564. this.$message.success(`${tips}成功!`)
  565. this.getContentDetail(item.moduleId)
  566. }
  567. })
  568. }).catch(() => { })
  569. },
  570. // 提交场景电台时间段
  571. getSubmitTime(item) {
  572. item.startTime = item.date[0]
  573. item.endTime = item.date[1]
  574. delete item.date
  575. submitTime(item).then(res => {
  576. if (res.code === 0) {
  577. this.$message.success('提交成功!')
  578. this.getTimeList()
  579. }
  580. })
  581. },
  582. // 上传icon
  583. uploadIcon(e, index) {
  584. this.timeList[index].pic = e.file
  585. },
  586. // 新增时间段
  587. getAdd() {
  588. this.timeList.push({})
  589. },
  590. // 上下架 / 删除 时间段
  591. getChangeTime(id, status) {
  592. let title = status === 0 ? '下架' : status === 1 ? '上架' : '删除'
  593. this.$confirm(`是否${title}?`, '提醒', {
  594. type: 'warning'
  595. }).then(() => {
  596. changeTime(id, status).then(res => {
  597. if (res.code === 0) {
  598. this.$message.success(`${title}成功!`)
  599. this.getTimeList()
  600. }
  601. })
  602. })
  603. },
  604. // 字典翻译
  605. audioFormatter(row) {
  606. return this.selectDictLabel(this.audioOptions, row.audioType)
  607. },
  608. freeFormatter(row) {
  609. return this.selectDictLabel(this.freeOptions, row.isFree)
  610. },
  611. statusFormatter(row) {
  612. return row.status === 0 ? '上架' : '下架'
  613. },
  614. listStatusFormatter(row) {
  615. return row.status ? this.selectDictLabel(this.onOrOffOptions, row.status) : '上架'
  616. },
  617. // v-if判断
  618. // 标题模块
  619. content() {
  620. let rules = {
  621. '1': [3, 4, 5, 6, 7, 8].includes(this.active),
  622. '2': [1, 3].includes(this.active),
  623. '3': [2, 4, 6, 7, 8, 9].includes(this.active),
  624. '4': [2, 4, 6, 8, 9, 10, 11].includes(this.active),
  625. '5': [2, 4, 5, 6, 7].includes(this.active),
  626. '6': [2, 3, 5, 7, 8, 9].includes(this.active)
  627. }
  628. return rules[this.tabIndex]
  629. },
  630. // 标签模块
  631. label() {
  632. let rules = {
  633. '2': this.tabIndex === 2 && this.active === 2,
  634. '3': this.tabIndex === 3 && this.active === 1,
  635. '4': [1, 5].includes(this.active) && this.tabIndex === 4,
  636. '5': [1, 3].includes(this.active) && this.tabIndex === 5,
  637. '6': [1, 4].includes(this.active) && this.tabIndex === 6
  638. }
  639. return rules[this.tabIndex]
  640. },
  641. // 时间
  642. time() {
  643. let rules = {
  644. '1': this.active !== 3 && this.active !== 8,
  645. '2': [0, 3].includes(this.active),
  646. '3': this.active !== 1,
  647. '4': this.active !== 1 || this.active !== 5,
  648. '5': this.active !== 1 || this.active !== 3,
  649. '6': this.active !== 1 || this.active !== 4
  650. }
  651. return rules[this.tabIndex]
  652. },
  653. // 标题
  654. title() {
  655. let rules = {
  656. '1': this.active === 10,
  657. '2': this.active === 1,
  658. '3': [3, 5, 9].includes(this.active),
  659. '4': [7].includes(this.active),
  660. '5': [5].includes(this.active)
  661. }
  662. return rules[this.tabIndex]
  663. },
  664. // 模式
  665. model() {
  666. let rules = {
  667. '1': [4, 5, 7, 9, 11].includes(this.active),
  668. '2': [3].includes(this.active),
  669. '3': [4, 7, 8].includes(this.active),
  670. '4': [2, 4, 6, 8, 9, 10, 11].includes(this.active),
  671. '5': [2, 4, 6, 7].includes(this.active),
  672. '6': [2, 3, 5, 7, 8, 9].includes(this.active)
  673. }
  674. return rules[this.tabIndex]
  675. },
  676. // 跳转方式
  677. forwardType() {
  678. let rules = {
  679. '1': [1, 2].includes(this.active),
  680. '2': [0].includes(this.active),
  681. '3': [0].includes(this.active),
  682. '4': [0, 3].includes(this.active),
  683. '5': [0].includes(this.active),
  684. '6': [0].includes(this.active)
  685. }
  686. return rules[this.tabIndex]
  687. },
  688. // 内容
  689. contentName(item) {
  690. let rules = {
  691. '1': [0, 6, 8, 10].includes(this.active),
  692. '3': [2, 3, 5, 6, 9].includes(this.active),
  693. '4': [7].includes(this.active),
  694. '5': [5].includes(this.active),
  695. '6': [6].includes(this.active)
  696. }
  697. return rules[this.tabIndex] || [0, 1, 2, 3, 4].includes(item.forwardType) || item.model === 1
  698. },
  699. // 简介
  700. description(item) {
  701. let rules = {
  702. '1': (this.active === 7 && item.model === 1) || this.active === 10,
  703. '3': [3, 5].includes(this.active) || [4, 7, 8].includes(this.active) && item.model === 1,
  704. '4': [7].includes(this.active)
  705. }
  706. return rules[this.tabIndex]
  707. },
  708. // 跳转连接
  709. forwardUrl(item) {
  710. return [5, 6].includes(item.forwardType)
  711. },
  712. // 封面模式
  713. isCustom(item) {
  714. let rules = {
  715. '1': [0, 8].includes(this.active),
  716. '5': [5].includes(this.active),
  717. }
  718. return rules[this.tabIndex] || item.model === 1
  719. },
  720. // 图片
  721. pic(item) {
  722. let rules = {
  723. '1': [1, 2, 6, 8, 10].includes(this.active),
  724. '2': [0, 1].includes(this.active),
  725. '3': [0, 2, 3, 5, 6, 9].includes(this.active),
  726. '4': [0, 3, 7].includes(this.active),
  727. '5': [0, 5].includes(this.active),
  728. '6': [0, 6].includes(this.active)
  729. }
  730. return rules[this.tabIndex] || item.isCustom === 0
  731. },
  732. // 列表
  733. isList() {
  734. return this.tabIndex === 2 && this.active === 1
  735. }
  736. }
  737. }
  738. </script>
  739. <style lang="scss" scoped>
  740. .bg {
  741. width: 365px;
  742. .el-image__error,
  743. .el-image__placeholder,
  744. .el-image__inner {
  745. height: auto;
  746. }
  747. }
  748. .item {
  749. position: absolute;
  750. left: 0;
  751. width: 365px;
  752. border: 1px solid yellow;
  753. }
  754. .active {
  755. background: rgba(255, 255, 0, 0.3);
  756. }
  757. .form {
  758. width: calc(100% - 395px);
  759. .el-form {
  760. width: 500px;
  761. margin-left: 30px;
  762. border: 1px solid #dcdfe6;
  763. box-shadow: 5px 5px 5px 0px #dcdfe6;
  764. padding: 20px;
  765. margin-bottom: 20px;
  766. }
  767. }
  768. .label {
  769. display: flex;
  770. flex-wrap: wrap;
  771. .el-form-item {
  772. width: calc(100% / 4);
  773. margin: 0;
  774. text-align: center;
  775. }
  776. }
  777. </style>