Add Merging Playlist

Add Merging Playlist function in my playlist
This commit is contained in:
Dumeng 2017-12-14 12:02:41 +08:00
parent fe60c92c0d
commit 1e121ca3d9
5 changed files with 90 additions and 0 deletions

View File

@ -787,6 +787,22 @@ li {
background-position: -144px -36px;
}
.playlist-detail .detail-head-title .merge {
display: inline-block;
text-indent: -9999px;
width: 36px;
height: 36px;
margin-right: 8px;
margin-top: 0;
background: url(../images/player_large.png) no-repeat 0 9999px;
background-position: -324px 0px;
}
.playlist-detail .detail-head-title .merge:hover {
background: url(../images/player_large.png) no-repeat 0 9999px;
background-position: -324px -36px;
}
.playlist-detail .detail-head-title .ply:hover {
background-position: -40px -204px;
}
@ -957,6 +973,32 @@ li {
font-size: 17px;
}
.dialog-merge-playlist {
padding-left: 0px;
text-align: left;
}
.dialog-merge-playlist li {
cursor: pointer;
height: 112px;
padding: 6px;
}
.dialog-merge-playlist li:hover {
background-color: #555555;
}
.dialog-merge-playlist li img {
float: left;
height: 100px;
width: 100px;
}
.dialog-merge-playlist li h2{
margin-left: 125px;
font-size: 17px;
}
.dialog-newplaylist input{
margin-bottom: 22px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -236,6 +236,14 @@
if (dialog_type == 5) {
$scope.dialog_title = '打开歌单';
$scope.dialog_type = 5;
}
if (dialog_type == 6) {
$scope.dialog_title = '歌单导入合并';
var url = '/show_myplaylist';
loWeb.get(url).success(function(data) {
$scope.myplaylist = data.result;
});
$scope.dialog_type = 6;
}
};
@ -312,6 +320,25 @@
});
};
$scope.mergePlaylist = function(target_list_id) {
var url = '/merge_playlist';
loWeb.post({
url: url,
method: 'POST',
data: $httpParamSerializerJQLike({
source: $scope.list_id,
target: target_list_id,
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).success(function() {
$scope.showPlaylist($scope.list_id);
Notification.success('合并歌单成功');
$scope.closeDialog();
});
};
$scope.removeSongFromPlaylist = function(song, list_id) {
var url = '/remove_track_from_myplaylist';

View File

@ -142,6 +142,19 @@ function($rootScope, $log, $http, $httpParamSerializerJQLike) {
return fn({'result': result});
}
}
}
if (request.url.search('/merge_playlist') != -1) {
var source = getParameterByName('source', url+'?'+request.data);
var target = getParameterByName('target', url+'?'+request.data);
var data = localStorage.getObject(target);
for(var i in data.tracks){
myplaylist.add_myplaylist(source, data.tracks[i]);
};
return {
success: function(fn) {
fn();
}
};
}
},
bootstrapTrack: function(success, failure) {

View File

@ -122,6 +122,13 @@
<button class="btn btn-primary confirm-button" ng-click="openUrl(dialog_url);closeDialog();">打开歌单</button>
<button class="btn btn-default" ng-click="closeDialog()">取消</button>
</div>
<ul ng-show="dialog_type==6" class="dialog-merge-playlist">
<li ng-repeat="playlist in myplaylist track by $index" ng-class-odd="'odd'" ng-class-even="'even'" ng-click="mergePlaylist(playlist.info.id)">
<img ng-src="{{ playlist.info.cover_img_url }}" />
<h2> {{ playlist.info.title }} </h2>
</li>
</ul>
</div>
</div>
@ -321,6 +328,7 @@
<a title="收藏歌单" class="clone" ng-show="playlist_title!='' && !is_mine" ng-click="clonePlaylist(list_id)">收藏</a>
<a title="编辑歌单" class="edit" ng-show="playlist_title!='' && is_mine" ng-click="showDialog(3, {list_id: list_id, playlist_title: playlist_title, cover_img_url: cover_img_url})">编辑</a>
<a title="原始链接" class="link" ng-show="playlist_title!=''" open-url="playlist_source_url">原始链接</a>
<a title="导入合并" class="merge" ng-show="playlist_title!='' && is_mine" ng-click="showDialog(6)">导入合并</a>
</div>
</div>
<ul class="detail-songlist">