From e09b6bea1dfbb2bd92ec19f819eeab756415c881 Mon Sep 17 00:00:00 2001
From: "DESKTOP-RQ919RC\\Pc" <1300399510@qq.com>
Date: Thu, 3 Apr 2025 19:05:48 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=92=8C=E5=AF=B9=E6=AF=94?=
=?UTF-8?q?=E8=AF=A6=E6=83=85=E5=8A=A0=E5=AF=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/projectComparison/projectComparison.js | 107 ++++------
pages/projectDetails/projectDetails.js | 214 ++++++++++---------
pages/projectDetails/projectDetails.wxml | 16 +-
project.private.config.json | 7 +
4 files changed, 161 insertions(+), 183 deletions(-)
diff --git a/pages/projectComparison/projectComparison.js b/pages/projectComparison/projectComparison.js
index 6049e5f..05d5bf9 100644
--- a/pages/projectComparison/projectComparison.js
+++ b/pages/projectComparison/projectComparison.js
@@ -120,12 +120,11 @@ Page({
let allArr = []
list.forEach(element => allArr.push(common.decodeKey(element)))
const obj = this.data.disciplineObj
- // console.log("obj", obj);
Promise.allSettled(allArr).then(res => {
let list = []
res.forEach(element => list.push(element.status === "fulfilled" ? element.value : {}));
list.forEach(element => {
-
+ console.log("element", element);
element['result_date'] = element['admissions']?.[0]?.result_time
if (element.accreditations) {
@@ -143,44 +142,46 @@ Page({
}
element["english_proficiency_text"] = ""
- element.admission_requirements[0].language_requirements.forEach(ele => {
- if (ele.language = "ENGLISH") {
- ele.proof_methods.forEach(el => {
- if (el.type == "test") {
- el.tests.forEach((e) => {
- let text = "";
- if (["GMAT", "GMAT Focus Edition"].includes(e.test_name)) text = `Verbal Reasoning ${e.min_score} 分以上`;
- else if (e.grade && e.grade == "Pass") text = `等级 ${e.grade}`;
- else if (e.grade) text = `等级 ${e.grade} 以上`;
- else if (e.sub_scores.length > 0) {
- let allEqual = true;
- e.sub_scores.forEach((ee) => {
- if (ee.score != e.sub_scores[0].score) allEqual = false;
- });
-
- const fields = {
- Total: "总分",
- Reading: "阅读",
- Speaking: "口语",
- Writing: "写作",
- Listening: "听力",
- };
-
- if (allEqual) text = `总分 ${e.min_score} 分以上,各项分数不低于 ${e.sub_scores[0].score} 分`;
- else {
+ if (element.admission_requirements[0]) {
+ (element.admission_requirements?.[0]?.language_requirements || []).forEach(ele => {
+ if (ele.language = "ENGLISH") {
+ ele.proof_methods.forEach(el => {
+ if (el.type == "test") {
+ el.tests.forEach((e) => {
+ let text = "";
+ if (["GMAT", "GMAT Focus Edition"].includes(e.test_name)) text = `Verbal Reasoning ${e.min_score} 分以上`;
+ else if (e.grade && e.grade == "Pass") text = `等级 ${e.grade}`;
+ else if (e.grade) text = `等级 ${e.grade} 以上`;
+ else if (e.sub_scores.length > 0) {
+ let allEqual = true;
e.sub_scores.forEach((ee) => {
- if (fields[ee.subject] && ee.score) text += `${fields[ee.subject]} ${ee.score} 分以上、`;
+ if (ee.score != e.sub_scores[0].score) allEqual = false;
});
- if (text.endsWith("、")) text = text.slice(0, -1);
- }
- } else if (e.min_score) text = `总分 ${e.min_score} 分以上`;
- element["english_proficiency_text"] += `・${e.test_name}:${text}; \n`;
- });
- }
- })
- }
- })
+ const fields = {
+ Total: "总分",
+ Reading: "阅读",
+ Speaking: "口语",
+ Writing: "写作",
+ Listening: "听力",
+ };
+
+ if (allEqual) text = `总分 ${e.min_score} 分以上,各项分数不低于 ${e.sub_scores[0].score} 分`;
+ else {
+ e.sub_scores.forEach((ee) => {
+ if (fields[ee.subject] && ee.score) text += `${fields[ee.subject]} ${ee.score} 分以上、`;
+ });
+ if (text.endsWith("、")) text = text.slice(0, -1);
+ }
+ } else if (e.min_score) text = `总分 ${e.min_score} 分以上`;
+
+ element["english_proficiency_text"] += `・${e.test_name}:${text}; \n`;
+ });
+ }
+ })
+ }
+ })
+ }
const documentsData = [];
const documentsMap = new Map();
@@ -203,13 +204,13 @@ Page({
});
element["documents_required"] = documents_required;
- element['entrance_requirements'] = element.admission_requirements[0]['basic_requirements']
+ element['entrance_requirements'] = element.admission_requirements?.[0]?.['basic_requirements']
- element['tuition_fee_text'] = common.formatNumberWithSpaces(element.admissions[0].tuition_fee || '')
+ element['tuition_fee_text'] = common.formatNumberWithSpaces(element.admissions?.[0]?.tuition_fee || '')
- element['admission_deposit_text'] = common.formatNumberWithSpaces(element.admissions[0].admission_deposit || '')
+ element['admission_deposit_text'] = common.formatNumberWithSpaces(element.admissions?.[0]?.admission_deposit || '')
- if (element.details.language_of_instruction) {
+ if (element.details?.language_of_instruction) {
let strOutput = element.details.language_of_instruction.join(',');
element['language_of_instruction_text'] = strOutput
}
@@ -221,16 +222,6 @@ Page({
element['language_of_instruction_text'] = strOutput
}
- // let scores = element.language_proficiency_scores || []
-
- // const scoresList = common.scoresList(scores)
-
- // element["english_proficiency_text"] = ""
- // scoresList.forEach(ele => {
- // element["english_proficiency_text"] += `・ ${ele.name}:${ele.text}; \n`
- // })
-
- // if (element.scholarship) element['scholarshipText'] = this.JudgmentScholarshipText(element.scholarship)
element['disciplinename'] = obj[element.disciplineid] || ''
})
@@ -238,9 +229,7 @@ Page({
isquick: data.isquick,
list,
}, () => wx.nextTick(() => this.getAllItemHeight()))
- }).catch(err => {
- common.toast("出错了,请联系管理员。")
- })
+ }).catch(err => common.toast("出错了,请联系管理员。"))
const ranking = data.ranking
const project = ranking.project || []
@@ -345,16 +334,6 @@ Page({
return uniqueArray
},
- // 判断奖学金文案
- JudgmentScholarshipText(obj) {
- let text = ""
- if (obj.local && obj.nonlocal) text = '均有'
- else if (!obj.local && !obj.nonlocal) text = '均无'
- else if (obj.local && !obj.nonlocal) text = '非本地学生无'
- else if (!obj.local && obj.nonlocal) text = '非本地学生有'
- return text
- },
-
getAllItemHeight() {
this.createSelectorQuery().selectAll(".lump .block").boundingClientRect(data => {
let showObj = {}
diff --git a/pages/projectDetails/projectDetails.js b/pages/projectDetails/projectDetails.js
index 9e68b55..859a15c 100644
--- a/pages/projectDetails/projectDetails.js
+++ b/pages/projectDetails/projectDetails.js
@@ -170,122 +170,124 @@ Page({
},
}).then(res => {
const data = res.data
- let admissionofficerin = data.admissionofficerin || []
-
- if (admissionofficerin.length > 0) {
- admissionofficerin.forEach(element => {
- const date = new Date(element.date);
- if (!isNaN(date.getTime())) {
- if (Date.now() < date.getTime()) {
- this.startCountdown(date.getTime() - Date.now() || 0)
- this.setData({
- answerType: 2,
- })
- }
- }
- })
- }
-
- let answerquestions = data.answerquestions || []
- common.decodeKey(data.info).then(res => {
- data.info = res
-
-
- const info = data.info || {}
-
- let contras = Array.isArray(data.contras) ? {} : data.contras;
-
- let side = this.data.side
-
- const isadmission = info.admissionsproject || 0
- if (isadmission == 1) this.getAdmissionList()
-
- // const date = new Date()
- // const month = date.getMonth() + 1
- // const year = date.getFullYear()
- // const semester = info.semester || {}
- // if ((year < semester.year) || (year === semester.year && month < semester.month)) info['semesterState'] = true
-
- this.setData({
- info,
- contras,
- side,
- isadmission,
- sideKey: "basic", // basic
- isInitFinish: true,
- admissionofficerin,
- answerintroduction: data.answerintroduction,
- }, () => {
- setTimeout(() => {
- this.getHeadHeight()
- this.getIndexHeight()
- }, 500)
- })
-
- this.getOfferData()
- }).catch(err => common.toast("出错了,请联系管理员。"))
-
- common.decodeKey(data.detailsInfo).then(data => {
- const direction = ['career_fields', 'typical_employers', 'career_positions'];
- direction.forEach(field => {
- let text = ""
- if (data[field]) {
- data[field].forEach(element => {
- text += element + '\n'
- })
- data[field] = text
- }
+ const encodefields = data.encodefields || []
+ const decodePromises = encodefields.map(element => {
+ return common.decodeKey(data[element]).then(res => {
+ data[element] = res;
});
+ });
- data.language_of_instruction && (data.language_of_instruction_text = data.language_of_instruction.join(","));
-
- let course = {
- required: [],
- requiredCount: 0,
- elective: [],
- electiveCount: 0,
+ Promise.all(decodePromises).then(() => {
+ let admissionofficerin = data.admissionofficerin || []
+ if (admissionofficerin.length > 0) {
+ admissionofficerin.forEach(element => {
+ const date = new Date(element.date);
+ if (!isNaN(date.getTime())) {
+ if (Date.now() < date.getTime()) {
+ this.startCountdown(date.getTime() - Date.now() || 0)
+ this.setData({
+ answerType: 2,
+ })
+ }
+ }
+ })
}
- const curriculum = data.curriculum || []
- curriculum.forEach(element => {
- if (element.course_credits == 'N/A') element.course_credits = 0
- element.type === 'Compulsory' ? (course.required.push(element), course.requiredCount += element.course_credits) : (course.elective.push(element), course.electiveCount += element.course_credits);
- })
- let side = this.data.side
- // 判断是否常见问题 ,没有则删除左侧
- if (!data.faq || data.faq.length == 0) delete side.issue
+ let answerquestions = data.answerquestions || []
+ if (data.info) {
+ const info = data.info || {}
+ let contras = Array.isArray(data.contras) ? {} : data.contras;
- if (answerquestions.length == 0) delete side.answers
+ let side = this.data.side
+ const isadmission = info.admissionsproject || 0
+ if (isadmission == 1) this.getAdmissionList()
+
+ // const date = new Date()
+ // const month = date.getMonth() + 1
+ // const year = date.getFullYear()
+ // const semester = info.semester || {}
+ // if ((year < semester.year) || (year === semester.year && month < semester.month)) info['semesterState'] = true
+
+ this.setData({
+ info,
+ contras,
+ side,
+ isadmission,
+ sideKey: "basic", // basic
+ isInitFinish: true,
+ admissionofficerin,
+ answerintroduction: data.answerintroduction,
+ }, () => {
+ setTimeout(() => {
+ this.getHeadHeight()
+ this.getIndexHeight()
+ }, 500)
+ })
+
+ this.getOfferData()
+ }
+
+ if (data.detailsInfo) {
+ const res = data.detailsInfo || {}
+ const direction = ['career_fields', 'typical_employers', 'career_positions'];
+ direction.forEach(field => {
+ let text = ""
+ if (res[field]) {
+ res[field].forEach(element => {
+ text += element + '\n'
+ })
+ res[field] = text
+ }
+ });
+
+ res.language_of_instruction && (res.language_of_instruction_text = res.language_of_instruction.join(","));
+
+ let course = {
+ required: [],
+ requiredCount: 0,
+ elective: [],
+ electiveCount: 0,
+ }
+ const curriculum = res.curriculum || []
+ curriculum.forEach(element => {
+ if (element.course_credits == 'N/A') element.course_credits = 0
+ element.type === 'Compulsory' ? (course.required.push(element), course.requiredCount += element.course_credits) : (course.elective.push(element), course.electiveCount += element.course_credits);
+ })
+ let side = this.data.side
+
+ // 判断是否常见问题 ,没有则删除左侧
+ if (!res.faq || res.faq.length == 0) delete side.issue
+
+ if (answerquestions.length == 0) delete side.answers
+
+ this.setData({
+ course,
+ answerquestions,
+ detailsInfo: res,
+ side,
+ })
+ }
+
+ this.handleAccreditationData(data.accreditations || [])
+ this.handleDocumentsData(data.documents || [])
+
+ const admissions = data.admissions
this.setData({
- course,
- answerquestions,
- detailsInfo: data,
- side,
+ admissions,
+ scholarships: data.scholarships || [],
+ discipline: data.discipline,
+ admission_requirements: data.admission_requirements || [],
+ newest: data.newest || '',
})
+
+ const admissionsId = admissions[0].id
+ this.handleAmissionsData(admissionsId)
+ this.handleRequirementData(admissionsId)
+ this.getRecommendData()
})
-
- this.handleAccreditationData(data.accreditations || [])
- this.handleDocumentsData(data.documents || [])
-
- const admissions = data.admissions
- this.setData({
- admissions,
- scholarships: data.scholarships || [],
- discipline: data.discipline,
- admission_requirements: data.admission_requirements || [],
- newest: data.newest || '',
- })
-
- const admissionsId = admissions[0].id
- this.handleAmissionsData(admissionsId)
- this.handleRequirementData(admissionsId)
-
- this.getRecommendData()
- }).finally(() => {
- wx.hideLoading()
- })
+ }).finally(() => wx.hideLoading())
},
// 处理 能力要求信息
diff --git a/pages/projectDetails/projectDetails.wxml b/pages/projectDetails/projectDetails.wxml
index a7bca44..53cca1d 100644
--- a/pages/projectDetails/projectDetails.wxml
+++ b/pages/projectDetails/projectDetails.wxml
@@ -412,7 +412,7 @@
-
+
@@ -507,21 +507,11 @@
专业
-
- {{ item.professionaltou }}
- {{ item.professionalzhong }}
- {{ item.professionalend }}
-
- {{ item.professional }}
+ {{ item.professional }}
项目
-
- {{ item.projecttou }}
- {{ item.projecttzhong }}
- {{ item.projecttend }}
-
- {{ item.project }}
+ {{ item.project }}
{{ item.semester }}
diff --git a/project.private.config.json b/project.private.config.json
index 14f5fd1..18935d5 100644
--- a/project.private.config.json
+++ b/project.private.config.json
@@ -8,6 +8,13 @@
"condition": {
"miniprogram": {
"list": [
+ {
+ "name": "pages/projectComparison/projectComparison",
+ "pathName": "pages/projectComparison/projectComparison",
+ "query": "ids=1%2C5",
+ "launchMode": "default",
+ "scene": null
+ },
{
"name": "pages/projectDetails/projectDetails",
"pathName": "pages/projectDetails/projectDetails",