项目库缘分接接口
This commit is contained in:
parent
4706c324be
commit
67c781147a
@ -76,7 +76,7 @@ Component({
|
|||||||
if (!isNaN(date.getTime())) {
|
if (!isNaN(date.getTime())) {
|
||||||
if (date >= today) mold = 1
|
if (date >= today) mold = 1
|
||||||
else mold = 2
|
else mold = 2
|
||||||
if (Date.now() < date.getTime()) timestamp = date.getTime() - Date.now()
|
if (Date.now() < date.getTime()) timestamp = true
|
||||||
} else mold = 3
|
} else mold = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ Component({
|
|||||||
setCountDown(index) {
|
setCountDown(index) {
|
||||||
const urls = this.data.urls
|
const urls = this.data.urls
|
||||||
clearTimeout(this.data.countdownInterval);
|
clearTimeout(this.data.countdownInterval);
|
||||||
if (urls[index]['timestamp']) this.startCountdown(urls[index]['timestamp'])
|
if (urls[index]['timestamp']) this.startCountdown(urls[index]['date'])
|
||||||
else {
|
else {
|
||||||
this.setData({
|
this.setData({
|
||||||
countDownState: false,
|
countDownState: false,
|
||||||
@ -146,9 +146,11 @@ Component({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
startCountdown(duration) {
|
startCountdown(date) {
|
||||||
clearTimeout(this.data.countdownInterval);
|
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 days = Math.floor(timer / (24 * 60 * 60 * 1000));
|
||||||
const hours = Math.floor((timer % (24 * 60 * 60 * 1000)) / (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));
|
const minutes = Math.floor((timer % (60 * 60 * 1000)) / (60 * 1000));
|
||||||
@ -163,7 +165,7 @@ Component({
|
|||||||
countDownState: true,
|
countDownState: true,
|
||||||
});
|
});
|
||||||
timer = timer - 1000
|
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) {
|
goPage(e) {
|
||||||
|
@ -251,27 +251,42 @@ Page({
|
|||||||
}).exec();
|
}).exec();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取今日缘分
|
// 获取今日缘分
|
||||||
getFate() {
|
getFate() {
|
||||||
wx.showLoading({
|
wx.showLoading({
|
||||||
title: '加载中...',
|
title: '加载中...',
|
||||||
})
|
})
|
||||||
util.wxget("/api/project.home/todayFateProject").then(res => {
|
util.wxget("/api/project.other/todayFateProject").then(res => {
|
||||||
if (res.code != 200) return
|
if (res.code != 200) return
|
||||||
const data = res.data || []
|
let data = res.data || []
|
||||||
|
|
||||||
data.forEach(element => {
|
data.forEach(element => {
|
||||||
element['random'] = app.randomString(6)
|
element['projectid'] = []
|
||||||
|
element.data.forEach(ele => {
|
||||||
|
element['projectid'].push(ele.id)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
this.setData({
|
this.setData({
|
||||||
fateProject: data,
|
fateProject: data,
|
||||||
|
fateProjectShow: [...data].sort(() => 0.5 - Math.random()).slice(0, 2)
|
||||||
})
|
})
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
wx.hideLoading()
|
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() {
|
getAdmission() {
|
||||||
util.wxget("/api/project.lists", {
|
util.wxget("/api/project.lists", {
|
||||||
|
@ -233,6 +233,7 @@ view {
|
|||||||
border: 1rpx solid rgba(242, 242, 242, 1);
|
border: 1rpx solid rgba(242, 242, 242, 1);
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
box-shadow: 0 -7.5rpx rgba(249, 93, 93, 1);
|
box-shadow: 0 -7.5rpx rgba(249, 93, 93, 1);
|
||||||
|
padding-bottom: 42rpx;
|
||||||
|
|
||||||
|
|
||||||
.head {
|
.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 {
|
.admission {
|
||||||
|
@ -67,11 +67,11 @@
|
|||||||
<view wx:if="{{ fateProject.length != 0 }}" class="fate">
|
<view wx:if="{{ fateProject.length != 0 }}" class="fate">
|
||||||
<view class="head flexacenter">
|
<view class="head flexacenter">
|
||||||
<view class="text">今日缘分项目</view>
|
<view class="text">今日缘分项目</view>
|
||||||
<view class="refresh flexcenter" bind:tap="getFate">
|
<view class="refresh flexcenter" bind:tap="updateFate">
|
||||||
<image class="icon" src="https://app.gter.net/image/miniApp/offer/refresh-icon.png"></image>
|
<image class="icon" src="https://app.gter.net/image/miniApp/offer/refresh-icon.png"></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="box">
|
<view class="box" wx:if="{{ false }}">
|
||||||
<view class="item flexacenter" wx:for="{{ fateProject }}" wx:key="index" bind:tap="goDetails" data-uniqid="{{ item.uniqid }}">
|
<view class="item flexacenter" wx:for="{{ fateProject }}" wx:key="index" bind:tap="goDetails" data-uniqid="{{ item.uniqid }}">
|
||||||
<view class="left flexflex flex1">
|
<view class="left flexflex flex1">
|
||||||
<view class="title one-line-display">{{ item.name_zh}}</view>
|
<view class="title one-line-display">{{ item.name_zh}}</view>
|
||||||
@ -95,6 +95,19 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="fate-box" wx:else>
|
||||||
|
<view class="content flexacenter" wx:for="{{ fateProjectShow }}" wx:key="index">
|
||||||
|
<view class="project-list">
|
||||||
|
<view class="project-item flexacenter" wx:for="{{ item.data }}" wx:key="index">
|
||||||
|
<image class="icon" src="{{ item.schoollogo }}"></image>
|
||||||
|
{{ item.schoolalias }}
|
||||||
|
<image class="arrows" src="https://app.gter.net/image/miniApp/offer/arrows-circle-yellow-green.svg" mode="widthFix"></image>
|
||||||
|
<view class="text one-line-display">{{ item.name_zh }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="btn flexcenter" bind:tap="goContrast" data-ids="{{ item.projectid }}">项目对比</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 招生官项目 轮播图 -->
|
<!-- 招生官项目 轮播图 -->
|
||||||
|
@ -197,6 +197,7 @@ view {
|
|||||||
border: 1rpx solid #f2f2f2;
|
border: 1rpx solid #f2f2f2;
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
box-shadow: 0 -7.5rpx #f95d5d;
|
box-shadow: 0 -7.5rpx #f95d5d;
|
||||||
|
padding-bottom: 42rpx;
|
||||||
}
|
}
|
||||||
.fate .head {
|
.fate .head {
|
||||||
height: 84rpx;
|
height: 84rpx;
|
||||||
@ -259,6 +260,47 @@ view {
|
|||||||
color: #D7D7D7;
|
color: #D7D7D7;
|
||||||
margin: 0 20rpx;
|
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 {
|
.admission {
|
||||||
margin: 0 22.5rpx 30rpx;
|
margin: 0 22.5rpx 30rpx;
|
||||||
padding-bottom: 7.5rpx;
|
padding-bottom: 7.5rpx;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user