|
@@ -1,3 +1,4 @@
|
|
|
+<!-- 歌曲 -->
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<!-- 搜索 -->
|
|
@@ -9,39 +10,95 @@
|
|
|
<el-input v-model="form.name" placeholder="请输入歌曲名称" clearable />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="歌手名称:">
|
|
|
- <el-input v-model="form.singerName" placeholder="请输入歌手名称" clearable />
|
|
|
+ <el-input
|
|
|
+ v-model="form.singerName"
|
|
|
+ placeholder="请输入歌手名称"
|
|
|
+ clearable
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="资源平台:">
|
|
|
- <el-select v-model="form.platformId" placeholder="请选择资源平台" clearable>
|
|
|
- <el-option v-for="item in platformOptions" :key="item.value" :value="item.value" :label="item.label" />
|
|
|
+ <el-select
|
|
|
+ v-model="form.platformId"
|
|
|
+ placeholder="请选择资源平台"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in platformOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :value="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="当前状态:">
|
|
|
<el-select v-model="form.status" placeholder="请选择当前状态" clearable>
|
|
|
- <el-option v-for="item in onOrOffOptions" :key="item.value" :value="item.value" :label="item.label" />
|
|
|
+ <el-option
|
|
|
+ v-for="item in onOrOffOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :value="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" icon="el-icon-search" @click="getSearch">搜索</el-button>
|
|
|
+ <el-button type="primary" icon="el-icon-search" @click="getSearch"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
<el-button icon="el-icon-refresh" @click="getRefresh">重置</el-button>
|
|
|
- <el-button type="primary" plain icon="el-icon-plus" @click="getDetail()"
|
|
|
- v-hasPermi="['music:list:add']">新增</el-button>
|
|
|
- <el-button type="primary" :disabled="obj.id === ''" @click="getChange(obj, 1)"
|
|
|
- v-hasPermi="['music:list:up']">批量上架</el-button>
|
|
|
- <el-button type="primary" :disabled="obj.id === ''" @click="getChange(obj, 2)"
|
|
|
- v-hasPermi="['music:list:down']">批量下架</el-button>
|
|
|
- <Upload listType="mp3" multiple name="multipartFiles" @upload="getList()" style="margin-left: 10px;">批量上传</Upload>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="getDetail()"
|
|
|
+ v-hasPermi="['music:list:add']"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :disabled="obj.id === ''"
|
|
|
+ @click="getChange(obj, 1)"
|
|
|
+ v-hasPermi="['music:list:up']"
|
|
|
+ >批量上架</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :disabled="obj.id === ''"
|
|
|
+ @click="getChange(obj, 2)"
|
|
|
+ v-hasPermi="['music:list:down']"
|
|
|
+ >批量下架</el-button
|
|
|
+ >
|
|
|
+ <Upload
|
|
|
+ listType="mp3"
|
|
|
+ multiple
|
|
|
+ name="multipartFiles"
|
|
|
+ @upload="getList()"
|
|
|
+ style="margin-left: 10px"
|
|
|
+ >批量上传</Upload
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<!-- 列表 -->
|
|
|
- <el-table :data="tableData" v-loading="loading" @selection-change="handleSelect">
|
|
|
+ <el-table
|
|
|
+ :data="tableData"
|
|
|
+ v-loading="loading"
|
|
|
+ @selection-change="handleSelect"
|
|
|
+ >
|
|
|
<el-table-column type="selection" align="center" />
|
|
|
<el-table-column label="歌曲Id" prop="id" align="center" />
|
|
|
- <el-table-column label="歌曲名称" prop="name" align="center" show-overflow-tooltip />
|
|
|
+ <el-table-column
|
|
|
+ label="歌曲名称"
|
|
|
+ prop="name"
|
|
|
+ align="center"
|
|
|
+ show-overflow-tooltip
|
|
|
+ />
|
|
|
<el-table-column label="歌手名称" align="center" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
- <span v-for="(item, index) in scope.row.singerResp" :key="item.singerId">
|
|
|
- {{ item.singerName }} {{ index + 1 !== scope.row.singerResp.length ? ',' : '' }}
|
|
|
+ <span
|
|
|
+ v-for="(item, index) in scope.row.singerResp"
|
|
|
+ :key="item.singerId"
|
|
|
+ >
|
|
|
+ {{ item.singerName }}
|
|
|
+ {{ index + 1 !== scope.row.singerResp.length ? "," : "" }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -52,43 +109,81 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="播放时长" prop="playTime" align="center" />
|
|
|
<el-table-column label="所属专辑" prop="songName" align="center" />
|
|
|
- <el-table-column label="资源平台" prop="platformId" align="center" :formatter="platformIdFormatter" />
|
|
|
- <el-table-column label="当前状态" prop="status" align="center" :formatter="statusFormatter" />
|
|
|
+ <el-table-column
|
|
|
+ label="资源平台"
|
|
|
+ prop="platformId"
|
|
|
+ align="center"
|
|
|
+ :formatter="platformIdFormatter"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ label="当前状态"
|
|
|
+ prop="status"
|
|
|
+ align="center"
|
|
|
+ :formatter="statusFormatter"
|
|
|
+ />
|
|
|
<el-table-column label="更新时间" prop="updateTime" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
|
|
+ <span>{{
|
|
|
+ parseTime(scope.row.updateTime, "{y}-{m}-{d} {h}:{i}:{s}")
|
|
|
+ }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" @click="getDetail(scope.row.id, true)">查看</el-button>
|
|
|
+ <el-button type="text" @click="getDetail(scope.row.id, true)"
|
|
|
+ >查看</el-button
|
|
|
+ >
|
|
|
<span v-if="scope.row.status === 2">
|
|
|
- <el-button type="text" @click="getDetail(scope.row.id)" v-hasPermi="['music:list:edit']"
|
|
|
- style="margin-left: 10px">编辑</el-button>
|
|
|
- <el-button type="text" @click="getChange(scope.row, 1)" v-hasPermi="['music:list:up']">上架
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="getDetail(scope.row.id)"
|
|
|
+ v-hasPermi="['music:list:edit']"
|
|
|
+ style="margin-left: 10px"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="getChange(scope.row, 1)"
|
|
|
+ v-hasPermi="['music:list:up']"
|
|
|
+ >上架
|
|
|
</el-button>
|
|
|
- <el-button type="delete" @click="getDelete(scope.row)" v-hasPermi="['music:list:delete']">删除
|
|
|
+ <el-button
|
|
|
+ type="delete"
|
|
|
+ @click="getDelete(scope.row)"
|
|
|
+ v-hasPermi="['music:list:delete']"
|
|
|
+ >删除
|
|
|
</el-button>
|
|
|
</span>
|
|
|
- <el-button type="text" v-else @click="getChange(scope.row, 2)" v-hasPermi="['music:list:down']">下架
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ v-else
|
|
|
+ @click="getChange(scope.row, 2)"
|
|
|
+ v-hasPermi="['music:list:down']"
|
|
|
+ >下架
|
|
|
</el-button>
|
|
|
<Audio :src="scope.row.progaramUrl" style="margin-left: 10px" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <pagination v-show="total > 0" :total="total" :page.sync="form.pageNum" :limit.sync="form.pageSize"
|
|
|
- @pagination="getList" />
|
|
|
+ <pagination
|
|
|
+ v-show="total > 0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="form.pageNum"
|
|
|
+ :limit.sync="form.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import Audio from '@/components/Audio/index.vue'
|
|
|
-import { list, remove, change } from '@/api/music/list'
|
|
|
-import { platformMixin, onOrOffMixin } from '@/mixin/index'
|
|
|
+import { change, list, remove } from "@/api/music/list";
|
|
|
+import Audio from "@/components/Audio/index.vue";
|
|
|
+import { onOrOffMixin, platformMixin } from "@/mixin/index";
|
|
|
+import { dialogCallBack } from "@/utils/DialogUtil";
|
|
|
export default {
|
|
|
mixins: [platformMixin, onOrOffMixin],
|
|
|
components: {
|
|
|
- Audio
|
|
|
+ Audio,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -97,7 +192,7 @@ export default {
|
|
|
// 表单
|
|
|
form: {
|
|
|
pageNum: 1,
|
|
|
- pageSize: 10
|
|
|
+ pageSize: 10,
|
|
|
},
|
|
|
// 总数据
|
|
|
total: 0,
|
|
@@ -107,47 +202,47 @@ export default {
|
|
|
isPlay: true,
|
|
|
// 批量上下架
|
|
|
obj: {
|
|
|
- id: '',
|
|
|
- name: '已选数据'
|
|
|
- }
|
|
|
+ id: "",
|
|
|
+ name: "已选数据",
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
// 获取资源平台
|
|
|
this.getPlatform({
|
|
|
- audioType: 11
|
|
|
- })
|
|
|
- this.getList()
|
|
|
+ audioType: 11,
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
// 列表
|
|
|
getList() {
|
|
|
- this.loading = true
|
|
|
+ this.loading = true;
|
|
|
// 后端延迟
|
|
|
setTimeout(() => {
|
|
|
- list(this.form).then(res => {
|
|
|
+ list(this.form).then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
- this.tableData = res.data.records
|
|
|
- this.total = res.data.total
|
|
|
- this.loading = false
|
|
|
+ this.tableData = res.data.records;
|
|
|
+ this.total = res.data.total;
|
|
|
+ this.loading = false;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}, 1500);
|
|
|
},
|
|
|
|
|
|
// 搜索
|
|
|
getSearch() {
|
|
|
- this.form.pageNum = 1
|
|
|
- this.getList()
|
|
|
+ this.form.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
},
|
|
|
|
|
|
// 重置
|
|
|
getRefresh() {
|
|
|
this.form = {
|
|
|
pageNum: 1,
|
|
|
- pageSize: 10
|
|
|
- }
|
|
|
- this.getList()
|
|
|
+ pageSize: 10,
|
|
|
+ };
|
|
|
+ this.getList();
|
|
|
},
|
|
|
|
|
|
// 新增 编辑
|
|
@@ -156,54 +251,65 @@ export default {
|
|
|
path: `/music/musicList/detail`,
|
|
|
query: {
|
|
|
id: id,
|
|
|
- disabled: boolean
|
|
|
- }
|
|
|
- })
|
|
|
+ disabled: boolean,
|
|
|
+ },
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 上下架
|
|
|
getChange(row, status) {
|
|
|
- let title = status === 1 ? '上架' : '下架'
|
|
|
- this.$confirm(`是否${title}${row.name}?`, '提示', {
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- change(row.id, status).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.$message.success(`${title}成功!`)
|
|
|
- this.getList()
|
|
|
- }
|
|
|
+ let title = status === 1 ? "上架" : "下架";
|
|
|
+ this.$confirm(`是否${title}${row.name}?`, "提示", {
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ change(row.id, status).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success(`${title}成功!`);
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
})
|
|
|
- }).catch(() => { })
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
|
|
|
// 多选
|
|
|
handleSelect(e) {
|
|
|
- this.obj.id = ''
|
|
|
- e.map((item, index) => this.obj.id += item.id + ((index + 1) < e.length ? ',' : ''))
|
|
|
+ this.obj.id = "";
|
|
|
+ e.map(
|
|
|
+ (item, index) =>
|
|
|
+ (this.obj.id += item.id + (index + 1 < e.length ? "," : ""))
|
|
|
+ );
|
|
|
},
|
|
|
|
|
|
// 删除
|
|
|
getDelete(row) {
|
|
|
- this.$confirm(`是否删除${row.name}?`, '提示', {
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- remove(row.id).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.$message.success('删除成功!')
|
|
|
- this.getList()
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(() => { })
|
|
|
+ var that = this;
|
|
|
+ dialogCallBack(that, function () {
|
|
|
+ that
|
|
|
+ .$confirm(`是否删除${row.name}?`, "提示:", {
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ remove(row.id).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ that.$message.success("删除成功!");
|
|
|
+ that.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 字典翻译
|
|
|
statusFormatter(row) {
|
|
|
- return this.selectDictLabel(this.onOrOffOptions, row.status)
|
|
|
+ return this.selectDictLabel(this.onOrOffOptions, row.status);
|
|
|
},
|
|
|
|
|
|
platformIdFormatter(row) {
|
|
|
- return this.selectDictLabel(this.platformOptions, row.platformId)
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ return this.selectDictLabel(this.platformOptions, row.platformId);
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|