123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- // 城市数据
- var cityData = [];
- // 当前城市,所有接口根据当前城市获取数据
- var curCityInfo = localStorage.getItem('curCityInfo');
- // 宠物医院数据
- var hospitalData = [];
- // 宠物数据
- var petData = [];
- // 寻宠数据
- var searchPetsData = [];
- var searchPetsIndex = 0;
- var searchPetsInterval = 5;
- // 宠物品种统计数据
- var recordPetsPieData = [];
- // 上牌排行数据
- var recordRankingData = [];
- $.ajax({
- url: '/?s=pets_screen/getCityData',
- async: false,
- dataType: 'json',
- success: function(resp){
- if (resp.success === false) {
- alert(resp.message);
- return;
- }
- cityData = resp.data;
- if (curCityInfo === null) {
- curCityInfo = cityData[0] || [];
- localStorage.setItem('curCityInfo', JSON.stringify(curCityInfo));
- } else {
- curCityInfo = JSON.parse(curCityInfo);
- }
- }
- });
- // 宠物医院
- function getHospitalData() {
- $.ajax({
- url: '/?s=pets_screen/getHospitalData',
- async: false,
- data: 'cityId=' + curCityInfo.id,
- dataType: 'json',
- success: function(resp){
- if (!resp.success) {
- console.log('getHospitalData',resp.message);
- return;
- }
- hospitalData = resp.data;
- }
- });
- }
- // 宠物数据
- function getPetData() {
- $.ajax({
- url: '/?s=pets_screen/getPetData',
- async: false,
- data: 'cityId=' + curCityInfo.id,
- dataType: 'json',
- success: function(resp){
- if (!resp.success) {
- console.log('getPetData',resp.message);
- return;
- }
- petData = resp.data;
- }
- });
- }
- // 寻宠信息
- function getSearchPetsData() {
- $.ajax({
- url: '/?s=pets_screen/getSearchPetsData',
- async: false,
- data: 'cityId=' + curCityInfo.id,
- dataType: 'json',
- success: function(resp) {
- if (!resp.success) {
- console.log('getSearchPetsData',resp.message);
- return;
- }
- searchPetsData = resp.data.data;
- resp.interval && (searchPetsInterval = resp.interval)
- }
- });
- }
- // 宠物品种统计数据
- function getRecordPetsPieData() {
- $.ajax({
- url: '/?s=pets_screen/getPetBreedData',
- async: false,
- data: 'cityId=' + curCityInfo.id,
- dataType: 'json',
- success: function(resp) {
- if (!resp.success) {
- console.log('getPetBreedData',resp.message);
- return;
- }
- recordPetsPieData = resp.data;
- }
- });
- }
- // 上牌排行数据
- function getRecordRankingData() {
- $.ajax({
- url: '/?s=pets_screen/getRecordRankingData',
- async: false,
- data: 'cityId=' + curCityInfo.id,
- dataType: 'json',
- success: function(resp) {
- if (!resp.success) {
- console.log('getRecordRankingData',resp.message);
- return;
- }
- recordRankingData = resp.data;
- }
- });
- }
|