鸭先知
This commit is contained in:
parent
7bbddc2d07
commit
d898941c09
@ -1,11 +1,24 @@
|
|||||||
// pagesSquare/components/survey-box/survey-box.js
|
// pagesSquare/components/survey-box/survey-box.js
|
||||||
|
const util = require('../../utils/util')
|
||||||
|
|
||||||
Component({
|
Component({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件的属性列表
|
* 组件的属性列表
|
||||||
*/
|
*/
|
||||||
properties: {
|
properties: {
|
||||||
duckProphet: Object,
|
duckProphet: {
|
||||||
|
type: Object,
|
||||||
|
observer(res) {
|
||||||
|
if (JSON.stringify(res) == "{}") return
|
||||||
|
res['latestdate'] = util.timeformat(res['latestdate'], 6)
|
||||||
|
res['earliestdate'] = util.timeformat(res['earliestdate'], 6)
|
||||||
|
console.log("res", res);
|
||||||
|
this.setData({
|
||||||
|
duckProphet: res || {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
newest: {
|
newest: {
|
||||||
type: String,
|
type: String,
|
||||||
observer(res) {
|
observer(res) {
|
||||||
|
@ -88,6 +88,7 @@ Page({
|
|||||||
rpx30: 30,
|
rpx30: 30,
|
||||||
user: {},
|
user: {},
|
||||||
offerList: [],
|
offerList: [],
|
||||||
|
offerShowList: [],
|
||||||
offerPage: 1,
|
offerPage: 1,
|
||||||
sideNum: {},
|
sideNum: {},
|
||||||
answerType: 0, // 招生管显示类型 0不显示 1长期答疑 2即将开始
|
answerType: 0, // 招生管显示类型 0不显示 1长期答疑 2即将开始
|
||||||
@ -127,7 +128,7 @@ Page({
|
|||||||
applyListState: false, // 申请信息选择列表状态
|
applyListState: false, // 申请信息选择列表状态
|
||||||
|
|
||||||
newest: "",
|
newest: "",
|
||||||
duckProphet: {}, // 鸭先知
|
duckProphet: 0, // 鸭先知
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,7 +228,6 @@ Page({
|
|||||||
}, 500)
|
}, 500)
|
||||||
})
|
})
|
||||||
|
|
||||||
this.getOfferData()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.detailsInfo) {
|
if (data.detailsInfo) {
|
||||||
@ -288,6 +288,7 @@ Page({
|
|||||||
this.handleRequirementData(admissionsId)
|
this.handleRequirementData(admissionsId)
|
||||||
this.getRecommendData()
|
this.getRecommendData()
|
||||||
|
|
||||||
|
this.getOfferData()
|
||||||
this.getDuckProphet()
|
this.getDuckProphet()
|
||||||
})
|
})
|
||||||
}).finally(() => wx.hideLoading())
|
}).finally(() => wx.hideLoading())
|
||||||
@ -295,7 +296,7 @@ Page({
|
|||||||
|
|
||||||
// 获取 鸭先知 数据
|
// 获取 鸭先知 数据
|
||||||
getDuckProphet() {
|
getDuckProphet() {
|
||||||
util.wxpost("https://api.gter.net/v1/program/duckProphet", {
|
util.wxget("https://api.gter.net/v1/program/duckProphet", {
|
||||||
uniqid: this.data.uniqid,
|
uniqid: this.data.uniqid,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code != 200) {
|
if (res.code != 200) {
|
||||||
@ -304,9 +305,20 @@ Page({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data = res.data
|
const data = res.data
|
||||||
|
const hasValidCount = data.studentcount || data.offercount || data.rejectcount;
|
||||||
|
const shouldResetSide = !hasValidCount && this.data.offerShowList.length === 0 && this.data.offerPage !== 1;
|
||||||
this.setData({
|
this.setData({
|
||||||
duckProphet: data,
|
duckProphet: hasValidCount ? data : null,
|
||||||
})
|
side: shouldResetSide ? (() => {
|
||||||
|
const side = {
|
||||||
|
...this.data.side
|
||||||
|
};
|
||||||
|
delete side.consult;
|
||||||
|
return side;
|
||||||
|
})() : this.data.side
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(() => this.getHeadHeight(), 500)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -799,20 +811,29 @@ Page({
|
|||||||
this.offerLoading = true
|
this.offerLoading = true
|
||||||
const limit = 5
|
const limit = 5
|
||||||
this.requestOfferData(limit).then(data => {
|
this.requestOfferData(limit).then(data => {
|
||||||
const list = data.list || []
|
let list = data.list || []
|
||||||
let side = this.data.side
|
let side = this.data.side
|
||||||
// if (list.length == 0) delete side.consult
|
// if (list.length == 0) delete side.consult
|
||||||
|
|
||||||
let sideNum = this.data.sideNum
|
let sideNum = this.data.sideNum
|
||||||
sideNum['consult'] = data.count
|
sideNum['consult'] = data.count
|
||||||
|
const page = data.count > data.limit * data.page ? this.data.offerPage + 1 : 0
|
||||||
this.setData({
|
this.setData({
|
||||||
offerShowList: list,
|
offerShowList: list,
|
||||||
side,
|
side,
|
||||||
sideNum,
|
sideNum,
|
||||||
offerPage: data.count > data.limit * data.page ? this.data.offerPage + 1 : 0,
|
offerPage: page,
|
||||||
}, () => {
|
}, () => setTimeout(() => this.getHeadHeight(), 500))
|
||||||
setTimeout(() => this.getHeadHeight(), 500)
|
|
||||||
})
|
if (list.length == 0 && this.data.duckProphet == null) {
|
||||||
|
console.log("1111111", this.data.duckProphet);
|
||||||
|
|
||||||
|
let side = this.data.side
|
||||||
|
delete side.consult
|
||||||
|
this.setData({
|
||||||
|
side,
|
||||||
|
})
|
||||||
|
}
|
||||||
}).finally(() => this.offerLoading = false)
|
}).finally(() => this.offerLoading = false)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -496,10 +496,12 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="side-item" data-type="consult">
|
<view class="side-item" data-type="consult" wx:if="{{ duckProphet || offerShowList.length != 0}}">
|
||||||
<view class="side-head flexcenter">录取参考</view>
|
<view class="side-head flexcenter">录取参考</view>
|
||||||
<template is="item-header" data="{{ text: 'Offer观察' }}"></template>
|
<block wx:if="{{ duckProphet }}">
|
||||||
<survey-box duckProphet="{{ duckProphet }}" newest="{{ newest }}"></survey-box>
|
<template is="item-header" data="{{ text: 'Offer观察' }}"></template>
|
||||||
|
<survey-box duckProphet="{{ duckProphet }}" newest="{{ newest }}"></survey-box>
|
||||||
|
</block>
|
||||||
|
|
||||||
<block wx:if="{{ offerShowList.length != 0 }}">
|
<block wx:if="{{ offerShowList.length != 0 }}">
|
||||||
<template is="item-header" data="{{ text: '寄托录取参考', type: 'consult' }}"></template>
|
<template is="item-header" data="{{ text: '寄托录取参考', type: 'consult' }}"></template>
|
||||||
|
@ -384,6 +384,8 @@ function timeformat(time, type = 1) {
|
|||||||
result = `${Nmonth}月${Ndate}日 ${Nhour}:${Nmin}`;
|
result = `${Nmonth}月${Ndate}日 ${Nhour}:${Nmin}`;
|
||||||
if (new Date().getFullYear() != Nyear) result = `${Nyear}年` + result;
|
if (new Date().getFullYear() != Nyear) result = `${Nyear}年` + result;
|
||||||
} else if (type == 4) result = `${Nyear}-${Nmonth}-${Ndate} ${Nhour}:${Nmin}`;
|
} else if (type == 4) result = `${Nyear}-${Nmonth}-${Ndate} ${Nhour}:${Nmin}`;
|
||||||
|
else if (type == 5) result = `${Nyear}-${Nmonth}-${Ndate}`;
|
||||||
|
else if (type == 6) result = `${Nyear}年${Nmonth}月${Ndate}日`;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user