From b584ef9a6ad1e5fff5883bb2f68b569eb22e5a7f Mon Sep 17 00:00:00 2001 From: 1191151619 <1191151619@qq.com> Date: Mon, 2 Aug 2021 11:26:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=A5=E5=8E=86=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ui-calendar/ui-calendar.js | 5 ++ components/ui-calendar/ui-calendar.wxml | 4 +- components/ui-calendar/ui-calendar.wxss | 8 +-- pages/calendar/calendar.js | 86 ++++++++++++++++--------- pages/calendar/calendar.wxml | 29 ++++++--- pages/calendar/calendar.wxss | 21 ++++++ 6 files changed, 106 insertions(+), 47 deletions(-) diff --git a/components/ui-calendar/ui-calendar.js b/components/ui-calendar/ui-calendar.js index bb59569..599ca3c 100644 --- a/components/ui-calendar/ui-calendar.js +++ b/components/ui-calendar/ui-calendar.js @@ -33,6 +33,11 @@ Component({ // debugger }, methods: { + emptyFun(){ + this.setData({ + indexT:-1, + }) + }, onDayTap: function (e) { console.log(e) this.triggerEvent('onDayTap', e.currentTarget.dataset); diff --git a/components/ui-calendar/ui-calendar.wxml b/components/ui-calendar/ui-calendar.wxml index 156ee4e..992ee74 100644 --- a/components/ui-calendar/ui-calendar.wxml +++ b/components/ui-calendar/ui-calendar.wxml @@ -81,10 +81,10 @@ day = day>9?day:'0'+day; var dataTime = year+'-'+month+'-'+day; - console.log(dataTime); + // console.log(dataTime); var a = auctionCount.indexOf(dataTime); var b = listedCount.indexOf(dataTime); - console.log(a,b); + // console.log(a,b); if(a>=0&&b>=0){ return 'active active-back-four' }else if(a>=0&&b<0){ diff --git a/components/ui-calendar/ui-calendar.wxss b/components/ui-calendar/ui-calendar.wxss index 42fb206..0f9d778 100644 --- a/components/ui-calendar/ui-calendar.wxss +++ b/components/ui-calendar/ui-calendar.wxss @@ -14,16 +14,16 @@ align-items: center; justify-content: center; margin: 12rpx; - width: 72rpx; - height: 72rpx; + width: 76rpx; + height: 76rpx; box-sizing: border-box; } .item .item_view { display: flex !important; align-items: center !important; justify-content: center !important; - width: 72rpx !important; - height: 72rpx !important; + width: 76rpx !important; + height: 76rpx !important; box-sizing: border-box !important; } diff --git a/pages/calendar/calendar.js b/pages/calendar/calendar.js index 17f8c0c..1221396 100644 --- a/pages/calendar/calendar.js +++ b/pages/calendar/calendar.js @@ -37,20 +37,34 @@ Page({ calendarSelectedDateStr: '', region: ["500000", "500100"], cityName: '重庆', + timeValue: '', + year: '', + month: '', + + info: [],//挂牌列表 - infoT:[],//拍卖列表 + infoT: [],//拍卖列表 - auctionCount:[],//有拍卖数量日期 - listedCount:[],//有挂牌数量日期 + auctionCount: [],//有拍卖数量日期 + listedCount: [],//有挂牌数量日期 }, bindDateChange(res) { - let calendarDisplayTime = res.detail.value + let calendarDisplayTime = res.detail.value; + console.log(calendarDisplayTime); + this.setData({ - calendarDisplayTime + year: calendarDisplayTime.split('-')[0], + month: calendarDisplayTime.split('-')[1], + calendarDisplayTime, + timer: '', }) + this.selectComponent("#calendarId").emptyFun(''); + this.getCalendar(); }, + + tabDowm(e) { let active = e.currentTarget.dataset.id if (active !== this.data.active) { @@ -69,9 +83,14 @@ Page({ let date = `${year}-${month}` if (date !== this.data.calendarDisplayTime) { this.setData({ - calendarDisplayTime: date + calendarDisplayTime: date, }) } + this.setData({ + timeValue: date, + year: year, + month: month, + }) }, bindAddressChange(res) { @@ -84,11 +103,11 @@ Page({ this.onShow() }, // 跳转 - navigate(e){ - let id=e.currentTarget.dataset.id; + navigate(e) { + let id = e.currentTarget.dataset.id; console.log(e.currentTarget.dataset.id) wx.navigateTo({ - url: '/pages/look-detail/look-detail?id='+id, + url: '/pages/look-detail/look-detail?id=' + id, }) }, @@ -104,29 +123,30 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - let demo =wx.getStorageSync("date"); - let timer=this.data.timer; - if(demo){ - timer=demo.time + let demo = wx.getStorageSync("date"); + let timer = this.data.timer; + if (!timer) { + timer = this.data.calendarDisplayTime + '-' + new Date().getDate(); + } + if (demo) { + timer = demo.time this.setData({ timer }) - }else{ - timer = moment().format('YYYY-MM-DD') + } else { + // timer = moment().format('YYYY-MM-DD') this.setData({ timer }) } - $api.getLandlistedList({annoDate:timer,city:this.data.cityName}).then(res=>{ - console.log(res.data) - + $api.getLandlistedList({ annoDate: timer, city: this.data.cityName }).then(res => { this.setData({ info: res.data.records }) }) - $api.getLandlistedList2({auctionDate:timer,city:this.data.cityName}).then(res=>{ + $api.getLandlistedList2({ auctionDate: timer, city: this.data.cityName }).then(res => { console.log(res.data) this.setData({ infoT: res.data.records @@ -138,20 +158,23 @@ Page({ selected: 0 }) } - // 获取日历列表数据 - $api.AJAX("GET",'applets/landlisted/calendar',{ - date: moment().format('YYYY-MM') - },true).then(res=>{ + this.getCalendar(); + }, + getCalendar() { + // 获取日历列表数据 + $api.AJAX("GET", 'applets/landlisted/calendar', { + date: this.data.calendarDisplayTime + }, true).then(res => { let auctionCount = [];// 拍卖数量的 let listedCount = [];//挂牌数量的 - res.data.map((item,index)=>{ - if(item.auctionCount>0){ + res.data.map((item, index) => { + if (item.auctionCount > 0) { auctionCount.push( item.date ) } - if(item.listedCount>0){ + if (item.listedCount > 0) { listedCount.push( item.date ) @@ -160,14 +183,13 @@ Page({ console.log(auctionCount); console.log(listedCount); - this.setData({ - auctionCount: auctionCount, - listedCount: listedCount, - }) + this.setData({ + auctionCount: auctionCount, + listedCount: listedCount, + }) }) }, - // 日历点击跳转(请求接口获取列表数据) onCalendarDayTap(res) { console.log(res) @@ -178,7 +200,7 @@ Page({ }) this.onShow() }, - calendarSelectedDate(e){ + calendarSelectedDate(e) { console.log(e) } }) \ No newline at end of file diff --git a/pages/calendar/calendar.wxml b/pages/calendar/calendar.wxml index bf03fe6..eb3491b 100644 --- a/pages/calendar/calendar.wxml +++ b/pages/calendar/calendar.wxml @@ -14,22 +14,33 @@ - - - - 当前选择 + + + + + 当前选择 + + + {{cityName}} + + + + + + {{year}}年 + + + {{month}}月 + - - {{cityName}} - - @@ -39,7 +50,7 @@ - {{item.name}} ({{item.id == 1?info.length:infoT.length}}) + {{item.name}} ({{item.id == 1?info.length:infoT.length}}) diff --git a/pages/calendar/calendar.wxss b/pages/calendar/calendar.wxss index c0f6ecf..06305ba 100644 --- a/pages/calendar/calendar.wxss +++ b/pages/calendar/calendar.wxss @@ -153,4 +153,25 @@ flex: 1; width: 100%; display: flex; +} + + +.screening{ + display: flex; + align-items: center; + justify-content:space-between; + padding-right: 20rpx; + +} +.dateTime{ + display: flex; +} +.dateTime .dateLi{ + height: 50rpx; + line-height: 50rpx; + padding:0 20rpx; + border-radius: 25rpx; + border:2rpx solid #333333; + columns: #333333; + margin:0 10rpx; } \ No newline at end of file