更新歌手页面,接口

This commit is contained in:
YeMingfei666 2024-07-10 15:55:19 +08:00
parent bcf5d09b3b
commit 8a3a30807a
3 changed files with 55 additions and 20 deletions

View File

@ -47,7 +47,7 @@ export function tbShopSongEdit(data) {
*/ */
export function tbShopSongDel(ids) { export function tbShopSongDel(ids) {
return request({ return request({
url: 'api/tbProduct/', url: '/api/tbShopSong',
method: 'delete', method: 'delete',
data: ids data: ids
}) })

View File

@ -1,10 +1,16 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="head-container"> <div class="head-container flex">
<el-button type="primary" icon="el-icon-plus" @click="$refs.addSong.show()"> <el-button type="primary" icon="el-icon-plus" @click="$refs.addSong.show()">
添加歌曲 添加歌曲
</el-button> </el-button>
</div> </div>
<div class="flex">
<div class="flex">
<span>歌手页地址:</span>
<a class="cursor-pointer" target="_blank" :href="singgerUrl">{{singgerUrl}}</a>
</div>
</div>
<div class="head-container" id="table_drag"> <div class="head-container" id="table_drag">
<el-table :data="tableData.list" v-loading="tableData.loading" row-key="id"> <el-table :data="tableData.list" v-loading="tableData.loading" row-key="id">
<el-table-column label="排序" sortable prop="sort"></el-table-column> <el-table-column label="排序" sortable prop="sort"></el-table-column>
@ -63,6 +69,7 @@
}, },
data() { data() {
return { return {
singgerUrl:'',
tableData: { tableData: {
page: 0, page: 0,
size: 10, size: 10,
@ -76,6 +83,9 @@
this.getTableData() this.getTableData()
}, },
methods: { methods: {
jumpUrl(url){
window.open(url)
},
addSongSuccess() { addSongSuccess() {
this.getTableData() this.getTableData()
}, },
@ -132,8 +142,25 @@
this.tableData.loading = false this.tableData.loading = false
this.tableData.list = res.content this.tableData.list = res.content
this.tableData.total = res.totalElements this.tableData.total = res.totalElements
const baseUrl=location.hostname==='localhost'? 'https://admintestweb.sxczgkj.cn': location.origin
this.singgerUrl = baseUrl+'/song-H5/index.html?t='+res.songUrl
} catch (error) {} } catch (error) {}
} }
} }
} }
</script> </script>
<style>
.flex{
display: flex;
align-content: center;
}
.cursor-pointer{
cursor: pointer;
color: #1890ff!important;
transition: all 0.3s;
font-size: 16px;
}
.cursor-pointer:hover{
opacity: .7;
}
</style>

View File

@ -1,5 +1,5 @@
<template> <template>
<el-dialog :title="title" width="500px" :visible.sync="dialogVisible"> <el-dialog :title="title" width="500px" :visible.sync="dialogVisible" @close="diaClose">
<el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left"> <el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="left">
<el-form-item label="歌曲图片"> <el-form-item label="歌曲图片">
<uploadImg ref="uploadImg" :limit="1" @success="uploadSuccess" @remove="uploadRemove" /> <uploadImg ref="uploadImg" :limit="1" @success="uploadSuccess" @remove="uploadRemove" />
@ -33,13 +33,21 @@
import { import {
tbShopSongAdd,tbShopSongEdit tbShopSongAdd,tbShopSongEdit
} from '@/api/application-song' } from '@/api/application-song'
const form={
img: '',
name: '',
singer: '',
originSinger: '',
price: 0,
sort: 0
}
export default { export default {
components: { components: {
uploadImg uploadImg
}, },
data() { data() {
return { return {
title: '新增歌曲', title: '',
dialogVisible: false, dialogVisible: false,
rules: { rules: {
name: [{ name: [{
@ -63,20 +71,19 @@
trigger: 'blur' trigger: 'blur'
}] }]
}, },
form: { form:form
img: '',
name: '',
singer: '',
originSinger: '',
price: 0,
sort: 0
}
} }
}, },
mounted() { mounted() {
console.log(this.form);
}, },
methods: { methods: {
restForm(){
this.form=form
this.$refs.uploadImg.clearFiles()
},
diaClose(){
this.restForm()
},
uploadSuccess(res) { uploadSuccess(res) {
this.form.img = res[0] this.form.img = res[0]
console.log(this.form.img); console.log(this.form.img);
@ -115,15 +122,20 @@
} }
}) })
}, },
async show(obj = {}, wine = false) { async show(obj = {}) {
console.log(obj); console.log(obj);
// this.form=this.$options.data().form
this.dialogVisible = true this.dialogVisible = true
this.title='添加歌曲'
if (obj && obj.id) { if (obj && obj.id) {
this.title='编辑歌曲'
this.form = { this.form = {
...obj ...obj
} }
} }
if (obj && obj.img) { if (obj && obj.hasOwnProperty('img')&&obj.img) {
console.log(obj.img)
this.form.img = obj.img this.form.img = obj.img
requestAnimationFrame(()=>{ requestAnimationFrame(()=>{
this.$refs.uploadImg.fileList = [{ this.$refs.uploadImg.fileList = [{
@ -135,12 +147,8 @@
}, },
close() { close() {
this.restForm()
this.dialogVisible = false this.dialogVisible = false
},
reset() {
this.form = {
...this.resetForm
}
} }
} }
} }