From c2566a0a8038112d1341281953f42bddfc5b7e5a Mon Sep 17 00:00:00 2001
From: 18631081161 <2088094923@qq.com>
Date: Fri, 20 Sep 2024 22:18:08 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=AD=8C=E6=9B=B2.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
modules/api/AppServer.js | 78 +++++++++++++++++++++++++++++++++++++
pages/create/createpage.vue | 60 +++++++++++++++++++++-------
2 files changed, 125 insertions(+), 13 deletions(-)
diff --git a/modules/api/AppServer.js b/modules/api/AppServer.js
index efe48a3..97e324c 100644
--- a/modules/api/AppServer.js
+++ b/modules/api/AppServer.js
@@ -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 => {
diff --git a/pages/create/createpage.vue b/pages/create/createpage.vue
index 48d883b..1a1e26b 100644
--- a/pages/create/createpage.vue
+++ b/pages/create/createpage.vue
@@ -23,7 +23,7 @@
style="background-image: linear-gradient(to left, #a541ffFF, #3fbbfeFF); padding: 1rpx; border-radius: 20rpx;">
-
{{fontNum}}/500
@@ -69,7 +69,7 @@
-
@@ -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'
- });
- }
-
}
}