From eb96cf5bf1fbdd38225b4680b21a48df71636b8a Mon Sep 17 00:00:00 2001 From: Moomesy Date: Tue, 3 Oct 2017 11:39:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=BD=91=E6=98=93=E6=AD=8C?= =?UTF-8?q?=E5=8D=95=E4=B8=8D=E8=83=BD=E6=89=93=E5=BC=80=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=90=9C=E7=B4=A2=E6=A1=86=E5=86=85=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D=EF=BC=8C=E5=88=87=E6=8D=A2Tab?= =?UTF-8?q?=E6=97=B6=E5=80=99=E4=B8=8D=E8=B0=83=E7=94=A8=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20(#101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修正网易歌单不能打开的问题 * 如果搜索框内没有关键词,切换Tab时候不调用搜索接口 以免网易接口字段缺失导致一直转圈和虾米出来的音乐都是* --- js/app.js | 15 ++++++++++----- js/provider/netease.js | 18 +++++++----------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/js/app.js b/js/app.js index d3c7c0e..27df81f 100644 --- a/js/app.js +++ b/js/app.js @@ -910,11 +910,16 @@ $scope.loading = true; $scope.tab = newTab; $scope.result = []; - loWeb.get('/search?source=' + getSourceName($scope.tab) + '&keywords=' + $scope.keywords).success(function(data) { - // update the textarea - $scope.result = data.result; - $scope.loading = false; - }); + + if ($scope.keywords===''){ + $scope.loading = false; + }else{ + loWeb.get('/search?source=' + getSourceName($scope.tab) + '&keywords=' + $scope.keywords).success(function(data) { + // update the textarea + $scope.result = data.result; + $scope.loading = false; + }); + } }; $scope.isActiveTab = function(tab){ diff --git a/js/provider/netease.js b/js/provider/netease.js index 458f8f8..8f2d86f 100644 --- a/js/provider/netease.js +++ b/js/provider/netease.js @@ -40,22 +40,18 @@ var netease = (function() { var ne_get_playlist = function(url, hm, se) { var list_id = getParameterByName('list_id', url).split('_').pop(); - var target_url = 'http://music.163.com/playlist?id=' + list_id; + var target_url = 'http://music.163.com/api/playlist/detail?id=' + list_id; return { - success: function(fn) { - hm.get(target_url).success(function(data) { - data = $.parseHTML(data); - var dataObj = $(data); + success: function (fn) { + hm.get(target_url).success(function (data) { var info = { 'id': 'neplaylist_' + list_id, - 'cover_img_url': dataObj.find('.u-cover img').attr('src'), - 'title': dataObj.find('.tit h2').text(), - 'source_url': 'http://music.163.com/#/playlist?id=' + list_id, + 'cover_img_url': data.result.coverImgUrl, + 'title': data.result.name, + 'source_url': 'http://music.163.com/#/playlist?id=' + list_id }; var tracks = []; - var json_string = dataObj.find('textarea').val(); - var track_json_list = JSON.parse(json_string); - $.each(track_json_list, function(index, track_json){ + $.each(data.result.tracks, function(index, track_json){ var default_track = { 'id': '0', 'title': '',