From 699b535d8cbc0047a027fd675c6ca726b7265d02 Mon Sep 17 00:00:00 2001 From: gaojuan Date: Tue, 17 Apr 2018 11:30:59 +0800 Subject: [PATCH] update --- fangija-zsyf/js/quotations/cityDetail.js | 8 +- .../component/cityIncreaseRankingComponent.js | 101 ++++++++---------- .../cityPotentialRankingComponent.js | 38 +++---- fangija-zsyf/views/house/cityDetail.html | 26 ++--- 4 files changed, 82 insertions(+), 91 deletions(-) diff --git a/fangija-zsyf/js/quotations/cityDetail.js b/fangija-zsyf/js/quotations/cityDetail.js index 33f09e9..2d05ef8 100644 --- a/fangija-zsyf/js/quotations/cityDetail.js +++ b/fangija-zsyf/js/quotations/cityDetail.js @@ -15,11 +15,12 @@ function loadMyCollectCity(){ if(positionCity){ cityDetaiVue.$data.citys.push(positionCity); } - - $("#cityInfo").hide() } + $("#cityInfo").hide() plus.nativeUI.closeWaiting(); + }).catch(function (error) { + plus.nativeUI.closeWaiting(); console.log(error); }); } @@ -36,8 +37,10 @@ function loadCurCity(city){ cityInfoVue.$data.collecd = false; } } + plus.nativeUI.closeWaiting(); }).catch(function (error) { + plus.nativeUI.closeWaiting(); console.log(error); }); } @@ -62,6 +65,7 @@ function loadCityPriceInfo(city){ cityObj.rangeLevel = data1.rangeLevel cityObj.time = year + month cityInfoVue.$data.myCityMap = cityObj; + $("#priceDiv").removeClass("dn"); } }).catch(function (error) { console.log(error); diff --git a/fangija-zsyf/views/component/cityIncreaseRankingComponent.js b/fangija-zsyf/views/component/cityIncreaseRankingComponent.js index 6998105..e06f0e1 100644 --- a/fangija-zsyf/views/component/cityIncreaseRankingComponent.js +++ b/fangija-zsyf/views/component/cityIncreaseRankingComponent.js @@ -27,8 +27,8 @@ Vue.component('city_increase_ranking',{ '{{!ci.oneMonthUpDownRange||ci.oneMonthUpDownRange==""?"暂无":Math.abs(100*ci.oneMonthUpDownRange).toFixed(2)+"%"}}'+ ''+ '
'+ - '关注'+ - '取消'+ + '关注'+ + '取消'+ '
'+ ''+ ''+ @@ -48,53 +48,39 @@ Vue.component('city_increase_ranking',{ }) }, follow:function(city,event, type){ + if(localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == ""){ clicked('/views/user/passLogin.html',true,false,{},{},function(){ if(localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == ""){ }else{ - axios.get("/rest/quotations/collectCity",{params:{city:city, type:type}}).then(function(response){ - var msg = response.data.message; - if(msg != "取消关注成功" && msg != "关注成功"){ - $.toast(msg); - }else{ - $(event.target).parent().children().removeClass("dn"); - $(event.target).addClass("dn"); - reloadMyFocus() - reloadCityPotentialRanking() - plus.webview.getWebviewById('views/house/houseDetail.html').reload(); - plus.webview.getWebviewById('views/house/houseManageList.html').reload(); - plus.webview.getWebviewById('views/user/userInfo.html').reload(); - } - - //cityDetaiVue.$data.citys.push(city); - }).catch(function(error){ - console.log(error) - }) + } }) }else{ - axios.get("/rest/quotations/collectCity",{params:{city:city, type:type}}).then(function(response){ - var msg = response.data.message; - if(msg != "取消关注成功" && msg != "关注成功"){ - $.toast(msg); - }else{ - $(event.target).parent().children().removeClass("dn"); - $(event.target).addClass("dn"); - reloadMyFocus() - reloadCityPotentialRanking() - if(type == 0){ - var curDatas = cityDetaiVue.$data.citys - if(curDatas && curDatas.length>0){ - if(!IsInArray(curDatas, city)){ - cityDetaiVue.$data.citys.push(city); + $.confirm('您确定要关注'+city+"?", function () { + axios.get("/rest/quotations/collectCity",{params:{city:city, type:type}}).then(function(response){ + var msg = response.data.message; + if(msg != "取消关注成功" && msg != "关注成功"){ + $.toast(msg); + }else{ + $(event.target).parent().children().removeClass("dn"); + $(event.target).addClass("dn"); + reloadMyFocus() + reloadCityPotentialRanking() + if(type == 0){ + var curDatas = cityDetaiVue.$data.citys + if(curDatas && curDatas.length>0){ + if(!IsInArray(curDatas, city)){ + cityDetaiVue.$data.citys.push(city); + } } } } - } - - }).catch(function(error){ - console.log(error) - }) + + }).catch(function(error){ + console.log(error) + }) + }); } }, @@ -108,23 +94,26 @@ Vue.component('city_increase_ranking',{ } }) }else{ - axios.get("/rest/quotations/collectCity",{params:{city:city, type:type}}).then(function(response){ - $(event.target).parent().children().removeClass("dn"); - $(event.target).addClass("dn"); - reloadMyFocus(); - reloadCityPotentialRanking() - //plus.webview.getWebviewById('views/user/userInfo.html').reload() - var da = cityDetaiVue.$data.citys - if(da && da.length>0){ - var index = da.indexOf(city) - if(index>0){ - da.splice(index, 1) - cityDetaiVue.$data.citys = da; - } - } - }).catch(function(error){ - console.log(error) - }) + + $.confirm("您确定要取消关注?", function () { + axios.get("/rest/quotations/collectCity",{params:{city:city, type:type}}).then(function(response){ + $(event.target).parent().children().removeClass("dn"); + $(event.target).addClass("dn"); + reloadMyFocus(); + reloadCityPotentialRanking() + //plus.webview.getWebviewById('views/user/userInfo.html').reload() + var da = cityDetaiVue.$data.citys + if(da && da.length>0){ + var index = da.indexOf(city) + if(index>0){ + da.splice(index, 1) + cityDetaiVue.$data.citys = da; + } + } + }).catch(function(error){ + console.log(error) + }) + }); } } diff --git a/fangija-zsyf/views/component/cityPotentialRankingComponent.js b/fangija-zsyf/views/component/cityPotentialRankingComponent.js index 7591787..0c58bca 100644 --- a/fangija-zsyf/views/component/cityPotentialRankingComponent.js +++ b/fangija-zsyf/views/component/cityPotentialRankingComponent.js @@ -71,24 +71,26 @@ Vue.component('city_potential_ranking',{ if(localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == ""){ }else{ - axios.get("/rest/quotations/collectCity",{params:{city:city, type:type}}).then(function(response){ - - var msg = response.data.message; - if(msg != "取消关注成功" && msg != "关注成功"){ - $.toast(msg); - }else{ - $(event.target).parent().children().removeClass("dn"); - $(event.target).addClass("dn"); - plus.webview.getWebviewById('views/house/houseDetail.html').reload(); - plus.webview.getWebviewById('views/house/houseManageList.html').reload(); - plus.webview.getWebviewById('views/user/userInfo.html').reload(); - reloadMyFocus() - reloadCityIncreaseRanking() - //cityDetaiVue.$data.citys.push(city); - } - }).catch(function(error){ - console.log(error) - }) + $.confirm('您确定要关注'+city+"?", function () { + axios.get("/rest/quotations/collectCity",{params:{city:city, type:type}}).then(function(response){ + + var msg = response.data.message; + if(msg != "取消关注成功" && msg != "关注成功"){ + $.toast(msg); + }else{ + $(event.target).parent().children().removeClass("dn"); + $(event.target).addClass("dn"); + plus.webview.getWebviewById('views/house/houseDetail.html').reload(); + plus.webview.getWebviewById('views/house/houseManageList.html').reload(); + plus.webview.getWebviewById('views/user/userInfo.html').reload(); + reloadMyFocus() + reloadCityIncreaseRanking() + //cityDetaiVue.$data.citys.push(city); + } + }).catch(function(error){ + console.log(error) + }) + }); } }) }else{ diff --git a/fangija-zsyf/views/house/cityDetail.html b/fangija-zsyf/views/house/cityDetail.html index f116ae3..062f95d 100644 --- a/fangija-zsyf/views/house/cityDetail.html +++ b/fangija-zsyf/views/house/cityDetail.html @@ -35,7 +35,7 @@
-
+
取消关注 @@ -45,7 +45,7 @@
当前参考均价
-
+
{{myCityMap.cityTopMonthAvgPrice}}元/㎡
暂无
@@ -151,8 +151,14 @@ $.config = {router: false} var date = new Date(); var year = date.getFullYear()+'年'; var month = date.getMonth()+1+'月'; -var city = "神农架" -var cityInfoVue = new Vue({ +var city = "普洱" +var cityInfoVue; + +document.addEventListener('plusready', onPlusReady, false); +function onPlusReady() { + var self = plus.webview.currentWebview(); + city = self.city + cityInfoVue = new Vue({ el: '#cityInfo', data: { city:"", @@ -162,12 +168,7 @@ var cityInfoVue = new Vue({ myCityMap : [] } }); - -document.addEventListener('plusready', onPlusReady, false); -function onPlusReady() { - var self = plus.webview.currentWebview(); - var city = self.city - cityInfoVue.$data.city = city; + cityInfoVue.$data.city = city; loadCurCity(city); loadCityPriceInfo(city) loadUpOrDown(city); @@ -176,11 +177,6 @@ function onPlusReady() { } -//loadCurCity(city); -// loadCityPriceInfo(city) -// loadUpOrDown(city); -// loadHotDistrict(city) -// loadCityPricesAndCounts(city)