diff --git a/component/admission-box/admission-box.js b/component/admission-box/admission-box.js index 8ef3014..175cac0 100644 --- a/component/admission-box/admission-box.js +++ b/component/admission-box/admission-box.js @@ -76,7 +76,7 @@ Component({ if (!isNaN(date.getTime())) { if (date >= today) mold = 1 else mold = 2 - if (Date.now() < date.getTime()) timestamp = date.getTime() - Date.now() + if (Date.now() < date.getTime()) timestamp = true } else mold = 3 } @@ -87,7 +87,7 @@ Component({ this.setData({ urls, }) - + this.calculateIndicator() if (urls.length != 0) this.setCountDown(0) @@ -138,7 +138,7 @@ Component({ setCountDown(index) { const urls = this.data.urls clearTimeout(this.data.countdownInterval); - if (urls[index]['timestamp']) this.startCountdown(urls[index]['timestamp']) + if (urls[index]['timestamp']) this.startCountdown(urls[index]['date']) else { this.setData({ countDownState: false, @@ -146,9 +146,11 @@ Component({ } }, - startCountdown(duration) { + startCountdown(date) { clearTimeout(this.data.countdownInterval); - let timer = duration; + const newTime = new Date().getTime() + const dateTime = new Date(date).getTime() + let timer = dateTime - newTime const days = Math.floor(timer / (24 * 60 * 60 * 1000)); const hours = Math.floor((timer % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)); const minutes = Math.floor((timer % (60 * 60 * 1000)) / (60 * 1000)); @@ -163,7 +165,7 @@ Component({ countDownState: true, }); timer = timer - 1000 - if (timer > 0) this.data.countdownInterval = setTimeout(() => this.startCountdown(timer), 1000) + if (timer > 0) this.data.countdownInterval = setTimeout(() => this.startCountdown(date), 1000) }, goPage(e) { diff --git a/pages/projectLibrary/projectLibrary.js b/pages/projectLibrary/projectLibrary.js index 22473ef..35ceadd 100644 --- a/pages/projectLibrary/projectLibrary.js +++ b/pages/projectLibrary/projectLibrary.js @@ -251,27 +251,42 @@ Page({ }).exec(); }, - - // 获取今日缘分 getFate() { wx.showLoading({ title: '加载中...', }) - util.wxget("/api/project.home/todayFateProject").then(res => { + util.wxget("/api/project.other/todayFateProject").then(res => { if (res.code != 200) return - const data = res.data || [] + let data = res.data || [] + data.forEach(element => { - element['random'] = app.randomString(6) + element['projectid'] = [] + element.data.forEach(ele => { + element['projectid'].push(ele.id) + }) }) + this.setData({ fateProject: data, + fateProjectShow: [...data].sort(() => 0.5 - Math.random()).slice(0, 2) }) }).finally(() => { wx.hideLoading() }) }, + updateFate() { + this.setData({ + fateProjectShow: [...this.data.fateProject].sort(() => 0.5 - Math.random()).slice(0, 2) + }) + }, + + goContrast(e) { + const ids = e.currentTarget.dataset.ids + common.goPage(`/pages/projectComparison/projectComparison?ids=${ids}`) + }, + // 获取 招生官项目 getAdmission() { util.wxget("/api/project.lists", { diff --git a/pages/projectLibrary/projectLibrary.less b/pages/projectLibrary/projectLibrary.less index b20d154..9e4ec22 100644 --- a/pages/projectLibrary/projectLibrary.less +++ b/pages/projectLibrary/projectLibrary.less @@ -233,6 +233,7 @@ view { border: 1rpx solid rgba(242, 242, 242, 1); border-radius: 18rpx; box-shadow: 0 -7.5rpx rgba(249, 93, 93, 1); + padding-bottom: 42rpx; .head { @@ -312,6 +313,62 @@ view { } } } + + .fate-box { + padding: 0 30rpx; + + .content { + // width: calc(100vw - 60rpx); + // background-color: rgb(255, 0, 0); + // border: 1rpx solid rgb(255, 0, 0); + background-color: rgba(246, 246, 246, 1); + border: 1rpx solid rgba(242, 242, 242, 1); + border-radius: 18rpx; + padding: 34.5rpx 16rpx; + margin-top: 30rpx; + justify-content: space-between; + + .project-list { + + .project-item { + font-size: 24rpx; + color: #333333; + line-height: 33.75rpx; + + &:not(:last-of-type) { + margin-bottom: 19.5rpx; + } + + .icon { + width: 24rpx; + height: 27rpx; + margin-right: 7.5rpx; + } + + .arrows { + width: 18rpx; + height: 18rpx; + margin: 0 13.5rpx; + } + + .text { + width: 313.5rpx; + + } + } + } + + .btn { + width: 132rpx; + height: 60rpx; + background-color: rgba(207, 247, 255, 1); + border: 1rpx solid rgba(186, 222, 230, 1); + border-radius: 172.5rpx; + font-size: 24rpx; + color: #026277; + } + } + } } .admission { diff --git a/pages/projectLibrary/projectLibrary.wxml b/pages/projectLibrary/projectLibrary.wxml index 7a22584..9fa6a5e 100644 --- a/pages/projectLibrary/projectLibrary.wxml +++ b/pages/projectLibrary/projectLibrary.wxml @@ -67,11 +67,11 @@ 今日缘分项目 - + - + {{ item.name_zh}} @@ -95,6 +95,19 @@ + + + + + + {{ item.schoolalias }} + + {{ item.name_zh }} + + + 项目对比 + + diff --git a/pages/projectLibrary/projectLibrary.wxss b/pages/projectLibrary/projectLibrary.wxss index d1d8ae9..7905b1e 100644 --- a/pages/projectLibrary/projectLibrary.wxss +++ b/pages/projectLibrary/projectLibrary.wxss @@ -197,6 +197,7 @@ view { border: 1rpx solid #f2f2f2; border-radius: 18rpx; box-shadow: 0 -7.5rpx #f95d5d; + padding-bottom: 42rpx; } .fate .head { height: 84rpx; @@ -259,6 +260,47 @@ view { color: #D7D7D7; margin: 0 20rpx; } +.fate .fate-box { + padding: 0 30rpx; +} +.fate .fate-box .content { + background-color: #f6f6f6; + border: 1rpx solid #f2f2f2; + border-radius: 18rpx; + padding: 34.5rpx 16rpx; + margin-top: 30rpx; + justify-content: space-between; +} +.fate .fate-box .content .project-list .project-item { + font-size: 24rpx; + color: #333333; + line-height: 33.75rpx; +} +.fate .fate-box .content .project-list .project-item:not(:last-of-type) { + margin-bottom: 19.5rpx; +} +.fate .fate-box .content .project-list .project-item .icon { + width: 24rpx; + height: 27rpx; + margin-right: 7.5rpx; +} +.fate .fate-box .content .project-list .project-item .arrows { + width: 18rpx; + height: 18rpx; + margin: 0 13.5rpx; +} +.fate .fate-box .content .project-list .project-item .text { + width: 313.5rpx; +} +.fate .fate-box .content .btn { + width: 132rpx; + height: 60rpx; + background-color: #cff7ff; + border: 1rpx solid #badee6; + border-radius: 172.5rpx; + font-size: 24rpx; + color: #026277; +} .admission { margin: 0 22.5rpx 30rpx; padding-bottom: 7.5rpx;