123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- //index.js
- import fetch from '../../../utils/http'
- //获取应用实例
- const app = getApp()
- const $api = require('../../../config/api.js').$api
-
- Component({
- behaviors: [],
- properties: {},
- data: {
- UserInfo: app.globalData.UserInfo,
- NavList: [{
- value: '楼盘资讯',
- id: ''
- }, {
- value: '精彩活动',
- id: ''
- }],
- NavActiveIndex: 0,
- ListA: [],
- ListB: [],
- PostDataA: {
- PageNum: 1,
- PageSize: 10000
- },
- PostDataB: {
- PageNum: 1,
- PageSize: 10000
- }
- },
- lifetimes: {},
- ready: function() {
- this.GetProjectList()
- this.GetActivityList()
- let _self = this
- wx.getSystemInfo({
- success(res) {
- _self.setData({
- WindowHeight: res.windowHeight
- })
- }
- })
- },
- pageLifetimes: {
- show: function() {},
- },
- methods: {
- GetActivityList() { // 获取活动列表
- fetch({
- url: $api.activity.list.url + '?pageNum=' + this.data.PostDataB.PageNum + '&pageSize=' + this.data.PostDataB.PageSize,
- method: $api.activity.list.method
- }).then((res) => {
- if (res.code === 200) {
- let arr = res.data.records || []
- let pArr = this.data.ListB
- arr.map((item) => {
- pArr.push({
- Title: item.title,
- CreateDate: item.publicDate,
- Org: item.buildingName,
- Img: item.imgUrl,
- Id: item.activityId
- })
- })
- this.setData({
- ListB: pArr,
- PostDataB: {
- PageNum: res.data.total === this.data.ListB.length ? this.data.PostDataB.PageNum : this.data.PostDataB.PageNum + 1,
- PageSize: this.data.PostDataB.PageSize
- }
- })
- }
- })
- },
- GetProjectList() { // 获取项目动态列表
- fetch({
- url: $api.dynamic.list.url + '?pageNum=' + this.data.PostDataA.PageNum + '&pageSize=' + this.data.PostDataA.PageSize,
- method: $api.dynamic.list.method
- }).then((res) => {
- if (res.code === 200) {
- let arr = res.data.records || []
- let pArr = this.data.ListA
- arr.map((item) => {
- pArr.push({
- Title: item.title,
- CreateDate: item.createDate,
- Org: item.buildingName,
- Img: item.imgUrl,
- Id: item.dynamicId
- })
- })
- this.setData({
- ListA: pArr,
- PostDataA: {
- PageNum: res.data.total === this.data.ListA.length ? this.data.PostDataA.PageNum : this.data.PostDataA.PageNum + 1,
- PageSize: this.data.PostDataA.PageSize
- }
- })
- }
- })
- },
- CutNav(e) { // 切换nav
- if (e.target.dataset.index !== undefined && e.target.dataset.index !== this.data.NavActiveIndex) {
- this.setData({
- NavActiveIndex: e.target.dataset.index
- })
-
- this.triggerEvent('tabChange', e.target.dataset.index)
- }
- },
- ItemTap(e) {
- wx.navigateTo({
- url: '/pages/ActivityDetail/index?type=' + e.target.dataset.type + '&id=' + e.target.dataset.id
- })
- }
- }
- })
|