diff --git a/constant/UrlConstant.js b/constant/UrlConstant.js index 944e3ea..ebeaffe 100644 --- a/constant/UrlConstant.js +++ b/constant/UrlConstant.js @@ -9,6 +9,7 @@ // 服务器域名 const baseUrl = 'https://app.demo.winqi.cn/'; //const baseUrl = 'http://hc.demo.winqi.cn:8012/'; +const hcBaseUrl = 'https://hc.demo.winqi.cn'; // 登录接口 const loginUrl = baseUrl + 'app/loginWx'; @@ -56,9 +57,9 @@ const applyVisitorApplicationKey = baseUrl + "app/applicationKey.applyVisitorApp //上传业主照片 const uploadOwnerPhoto = baseUrl +"app/owner.uploadOwnerPhoto"; -const getOwnerPhotoPath = "https://hc.demo.winqi.cn/callComponent/download/getFile/fileByObjId"; +const getOwnerPhotoPath = hcBaseUrl +"/callComponent/download/getFile/fileByObjId"; -const filePath = "https://hc.demo.winqi.cn/callComponent/download/getFile/file"; +const filePath = hcBaseUrl +"/callComponent/download/getFile/file"; //查询业主车位信息 const queryParkingSpacesByOwner = baseUrl+"app/parkingSpace.queryParkingSpacesByOwner"; @@ -72,13 +73,17 @@ const preOrder = baseUrl +"/app/payment/toPay"; //查询小区 const listCommunitys = baseUrl + "/app/community.listCommunitys"; //查询小区文化 -const listActivitiess = baseUrl + "/app/activities.listActivitiess" +const listActivitiess = baseUrl + "/app/activities.listActivitiess"; + +//查询小区广告 +const listAdvertPhoto = baseUrl +"/app/advert.listAdvertPhoto"; module.exports = { baseUrl: baseUrl, + hcBaseUrl: hcBaseUrl, loginUrl: loginUrl, areaUrl: areaUrl, GetNoticeListUrl: GetNoticeListUrl, @@ -103,5 +108,6 @@ module.exports = { preOrder: preOrder, listCommunitys: listCommunitys, listActivitiess: listActivitiess, - filePath: filePath + filePath: filePath, + listAdvertPhoto: listAdvertPhoto }; \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 3c3751c..4a972c6 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -9,15 +9,7 @@ Page({ */ data: { communityId:'', - ad: [{ - imageUrl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573966727205&di=66965e182c0d2efd0818a7d9b8c2629a&imgtype=0&src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fcf482ffb4f3fc6d941664e1cba8ca3ca6e9c0a9443f84-AsGU9b_fw658", - url: "http://www.homecommunity.cn/" - }, - { - imageUrl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1573966727205&di=66965e182c0d2efd0818a7d9b8c2629a&imgtype=0&src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Fcf482ffb4f3fc6d941664e1cba8ca3ca6e9c0a9443f84-AsGU9b_fw658", - url: "http://www.homecommunity.cn/" - } - ], + ad: [], notices: [ ], categoryList: { @@ -146,6 +138,9 @@ Page({ //查询小区文化 _that._loadActivites(); + //查询小区广告 + _that._loadCommunityAdvertPhoto(); + }); }, @@ -280,6 +275,50 @@ Page({ } }); }, + _loadCommunityAdvertPhoto:function(){ + let _that = this; + let _objData = { + page: 1, + row: 5, + communityId: this.data.communityId + }; + context.request({ + url: constant.url.listAdvertPhoto, + header: context.getHeaders(), + method: "GET", + data: _objData, //动态数据 + success: function (res) { + console.log("请求返回信息:", res); + if (res.statusCode == 200) { + + let _advertPhotos = res.data; + let _aPhotos = []; + _advertPhotos.forEach(function (_item) { + _item.url = constant.url.hcBaseUrl + _item.url + "&time=" + new Date(); + _aPhotos.push(_item); + }); + + _that.setData({ + ad: _aPhotos + }); + + return; + } + wx.showToast({ + title: "服务器异常了", + icon: 'none', + duration: 2000 + }) + }, + fail: function (e) { + wx.showToast({ + title: "服务器异常了", + icon: 'none', + duration: 2000 + }) + } + }); + }, _moreActivities:function(){ wx.navigateTo({ url: '/pages/activites/activites', diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 7c6141f..4a3a16d 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -41,7 +41,7 @@ - +