创建歌曲.

This commit is contained in:
18631081161 2024-09-20 22:18:08 +08:00
parent e21d6d2ee6
commit c2566a0a80
2 changed files with 125 additions and 13 deletions

View File

@ -30,6 +30,12 @@ serverConfig.apiUrl_Music_GetMusicGenresList = baseUrl + '/api/Music/GetMusicGen
serverConfig.apiUrl_Music_GetMusicGenresInfo = baseUrl + '/api/Music/GetMusicGenresInfo'
serverConfig.apiUrl_Music_GetUserMusicGenresList = baseUrl + '/api/Music/GetUserMusicGenresList' //音乐标签
serverConfig.apiUrl_Music_CreateUserMusicGenres = baseUrl + '/api/Music/CreateUserMusicGenres' //创建音乐风格
serverConfig.apiUrl_Music_CreateMusic = baseUrl + '/api/Music/CreateMusic' //创建音乐
serverConfig.apiUrl_Music_GetMusicSchedule = baseUrl + '/api/Music/GetMusicSchedule' //获取音乐进度
serverConfig.apiUrl_Music_GetMyMusicList = baseUrl + '/api/Music/GetMyMusicList' //我的音乐列表
serverConfig.apiUrl_Music_GetUserInfo = baseUrl + '/api/Music/GetUserInfo' //用户信息
serverConfig.apiUrl_Music_MusicSongsReview = baseUrl + '/api/Music/MusicSongsReview' //歌曲审核
serverConfig.apiUrl_Music_MusicCancelSongsReview = baseUrl + '/api/Music/MusicCancelSongsReview' //取消审核
/**
@ -228,6 +234,78 @@ AppServer.prototype.CreateUserMusicGenres = async function(genreName) {
})
}
//创建音乐
AppServer.prototype.CreateMusic = async function(genreName, prompt, name) {
var url = serverConfig.apiUrl_Music_CreateMusic
return this.postData(url, {
"genreName": genreName,
"prompt": prompt,
"name": name,
}).then((data) => {
return data;
})
}
//获取音乐进度
AppServer.prototype.GetMusicSchedule = async function(id) {
var url = serverConfig.apiUrl_Music_GetMusicSchedule
return this.getData(url, {
"id": id
}).then((data) => {
return data;
})
}
//我的音乐列表
AppServer.prototype.GetMyMusicList = async function(id) {
var url = serverConfig.apiUrl_Music_GetMyMusicList
return this.getData(url, {
"id": id
}).then((data) => {
return data;
})
}
//用户信息
AppServer.prototype.GetUserInfo = async function() {
var url = serverConfig.apiUrl_Music_GetUserInfo
return this.getData(url).then((data) => {
return data;
})
}
//歌曲审核
AppServer.prototype.MusicSongsReview = async function(id) {
var url = serverConfig.apiUrl_Music_MusicSongsReview
return this.postData(url, {
"id": id
}).then((data) => {
return data;
})
}
//取消歌曲审核
AppServer.prototype.MusicCancelSongsReview = async function(id) {
var url = serverConfig.apiUrl_Music_MusicCancelSongsReview
return this.postData(url, {
"id": id
}).then((data) => {
return data;
})
}
AppServer.prototype.GetServerList = async function() {
return this.postData(serverConfig.apiUrl_AppConfig_GetServerList).then(data => {

View File

@ -23,7 +23,7 @@
style="background-image: linear-gradient(to left, #a541ffFF, #3fbbfeFF); padding: 1rpx; border-radius: 20rpx;">
<view class=""
style="width: 623.33rpx; height: 272.22rpx; padding: 30rpx 30rpx 70rpx 30rpx; border-radius: 20rpx; background-color: #221f35FF;">
<textarea type="text" style="color: white; width: 100%;" v-model="inputData"
<textarea type="text" style="color: white; width: 100%;" v-model="musicPrompt"
placeholder="描述歌词的场景" maxlength="500" @input="sumfontnum" />
<view style="text-align: end; color: white; " class="input_holder"><text
style="color: white;">{{fontNum}}</text>/500</view>
@ -69,7 +69,7 @@
</view>
<view class="" @click="toCreateInfo()"
<view class="" @click="createMusic()"
style="width: 683.33rpx; height: 83.33rpx; margin-left: 33rpx; margin-right: 33rpx; margin-top: 50rpx;
background-image: linear-gradient(to left, #a541ffFF, #3fbbfeFF); padding: 1rpx; border-radius:50rpx; display: flex; align-items: center; justify-content: center;">
@ -101,10 +101,11 @@
systemBarHeight: 0,
subtractedHeight: 0,
fontNum: 0,
inputData: '',
musicPrompt: '',
typeData: [],
styleIndex: 0,
songTitle: ''
songTitle: '',
genreName: ''
}
},
@ -146,6 +147,8 @@
this.styleIndex = index;
if (data == "自定义") {
this.$refs.inputDialog.open();
} else {
this.genreName = data;
}
},
@ -156,7 +159,7 @@
appserver.GetUserMusicGenresList().then(data => {
console.log("getMusicGenresInfo", data.data);
that.typeData = data.data;
that.genreName = data.data[0].genreName;
that.typeData.push({
"genreName": "自定义",
"orderId": -1,
@ -171,14 +174,52 @@
var appserver = new AppServer();
appserver.CreateUserMusicGenres(genreName).then(data => {
console.log("createUserMusicGenres", data.data);
if(data.data){
if (data.data) {
this.getMusicGenresInfo();
}
});
},
//
createMusic() {
if (this.musicPrompt == "") {
uni.showToast({
title: '提示词不能为空',
icon: 'error',
duration: 2000
});
return;
}
if (this.songTitle == "") {
uni.showToast({
title: '歌曲名称不能为空',
icon: 'error',
duration: 2000
});
return;
}
var that = this;
var appserver = new AppServer();
appserver.CreateMusic(this.genreName, this.musicPrompt, this.songTitle).then(data => {
console.log("CreateMusic", data.data);
if (data.code == 0) {
uni.navigateTo({
url: '/pages/create/CreateInfoPage'
});
} else {
uni.showToast({
title: data.message,
icon: 'error',
duration: 2000
});
}
});
},
//
setStyleBg(index) {
if (this.styleIndex == index) {
return {
@ -204,13 +245,6 @@
// this.typeData.unshift(value);
// this.styleIndex = 0;
},
toCreateInfo() {
uni.navigateTo({
url: '/pages/create/CreateInfoPage'
});
}
}
}
</script>