From e177d0db15abc4fad28e5616493b362140fbd403 Mon Sep 17 00:00:00 2001 From: "DESKTOP-RQ919RC\\Pc" <1300399510@qq.com> Date: Wed, 5 Mar 2025 19:08:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E5=90=8D=E6=B5=8B=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project-list-screen.js | 187 +++++++++++++++--- .../project-list-screen.wxml | 16 +- component/territorySelect/territorySelect.js | 10 +- .../territorySelect/territorySelect.wxml | 4 +- pages/projectAllList/projectAllList.js | 162 +++++---------- pages/projectAllList/projectAllList.less | 55 ++---- pages/projectAllList/projectAllList.wxml | 8 +- pages/projectAllList/projectAllList.wxss | 18 +- pages/projectComparison/projectComparison.js | 21 ++ .../projectComparison/projectComparison.less | 2 +- .../projectComparison/projectComparison.wxml | 8 +- .../projectComparison/projectComparison.wxss | 1 - pages/projectDetails/projectDetails.wxml | 2 +- pages/projectLibrary/projectLibrary.less | 2 + pages/projectLibrary/projectLibrary.wxss | 2 + pages/projectList/projectList.js | 38 ++-- pages/projectList/projectList.less | 125 ------------ pages/projectList/projectList.wxml | 4 +- pages/projectList/projectList.wxss | 108 ---------- project.private.config.json | 7 + 20 files changed, 325 insertions(+), 455 deletions(-) diff --git a/component/project-list-screen/project-list-screen.js b/component/project-list-screen/project-list-screen.js index d4c21a4..8eb4c5a 100644 --- a/component/project-list-screen/project-list-screen.js +++ b/component/project-list-screen/project-list-screen.js @@ -1,4 +1,5 @@ // template/project-list-screen/project-list-screen.js +import common from '../../utils/commonMethod' Component({ /** @@ -10,7 +11,7 @@ Component({ type: Object, observer(res) { if (!res || JSON.stringify(res) == "{}") return - this.comJGToYear() + this.initCom() }, }, @@ -20,7 +21,8 @@ Component({ type: Object, observer(res) { if (!res || JSON.stringify(res) == "{}") return - this.majJgList() + // this.majJgList() + this.initMaj() } }, maj: Object, @@ -36,28 +38,52 @@ Component({ majJgList: [], // 专业的 机构列表 majMajorList: [], // 专业的 专业列表 majYearList: [], // 专业的 年份列表 + + rankingKey: { + "Shanghai Ranking": "软科", + "Times Higher Education": "泰晤士", + "times": "泰晤士", + "USNEWS": "U.S. News", + "US News": "U.S. News", + }, }, /** * 组件的方法列表 */ methods: { + // 初始化综合 + initCom() { + const option = this.data.comOption || {} + let comJgList = Object.keys(option) || [] + const jg = comJgList[0] + let comYearList = Object.keys(option[jg]).sort((a, b) => b - a) + this.setData({ + comJgList, + comYearList, + }) + }, + // 综合 通过机构 计算 出年份 comJGToYear() { const com = this.data.com const option = this.data.comOption || {} - console.log("com", com, "option", option); - const jg = com.jg || Object.keys(option)[0] - let comJgList = Object.keys(option) + const jg = com.jg + let year = com.year + + // let comJgList = Object.keys(option) let comYearList = Object.keys(option[jg]).sort((a, b) => b - a) + if (!comYearList.includes(year)) year = "" this.setData({ - comJgList, + // comJgList, comYearList, - com: { - jg, - year: comYearList[0], - } + [`com.year`]: year, + // [`com.jg`]: jg, + // com: { + // jg, + // year: comYearList[0], + // } }) }, @@ -91,6 +117,37 @@ Component({ this.majJgToMajor() }, + initMaj() { + const option = this.data.majOption + const allMajor = Object.values(option).flatMap(institutionData => Object.keys(institutionData)); + const majMajorList = [...new Set(allMajor)].sort((a, b) => { + if (a < b) return -1; + if (a > b) return 1; + return 0; + }); + + const maj = this.data.maj + + if (maj.jg) { + if (maj.major) this.majMajorToJG() + let majYearList = option[maj.jg][maj.major] || [] + majYearList = Object.keys(majYearList).sort((a, b) => b - a) + this.setData({ + majMajorList, + majYearList, + }) + } else { + let majJgList = Object.keys(option) + let majYearList = option[majJgList[0]][majMajorList[0]] || [] + majYearList = Object.keys(majYearList).sort((a, b) => b - a) + this.setData({ + majMajorList, + majYearList, + majJgList, + }) + } + }, + // 专业 通过 机构 算出 专业列表 majJgToMajor() { const maj = this.data.maj @@ -107,9 +164,37 @@ Component({ // 专业 通过专业 算出 年份列表 majMajorToYear() { const maj = this.data.maj - const option = this.data.majOption[maj.jg][maj.major] || {} + const majOption = this.data.majOption + const option = majOption[maj.jg][maj.major] || {} + console.log("option", this.data.majOption); + let target = {} + // if (maj.jg) { + // target = majOption[maj.jg] + + // for (const key in target) { + // if (Object.hasOwnProperty.call(target, key)) { + // const element = target[key]; + // console.log("key", key); + // if () { + + // } + // } + // } + // } + // // console.log("target", target); + // return + + // for (const key in majOption) { + // if (Object.hasOwnProperty.call(majOption, key)) { + // const element = majOption[key]; + + // } + // } + let majYearList = Object.keys(option).sort((a, b) => b - a) || [] - const year = maj.year || majYearList[0] + let year = maj.year + if (!majYearList.includes(year)) year = "" + this.setData({ majYearList, [`maj.year`]: year, @@ -119,15 +204,21 @@ Component({ // 专业 选择 机构 selectMajJg(e) { const jg = e.currentTarget.dataset.key + const maj = this.data.maj + let year = maj.year + this.setData({ - maj: { - jg, - major: "", - year: "", - } + ['maj.jg']: jg, + // maj: { + // jg, + // major: "", + // year: "", + // } }) - this.majJgToMajor() + // this.majJgToMajor() + + if (maj.major && maj.jg) this.majMajorToYear() }, // 打开专业弹窗 @@ -140,17 +231,46 @@ Component({ // 选择专业弹窗的关闭 closeselect(e) { const major = e.detail?.value || "" + const maj = this.data.maj this.setData({ screenState: true, }) + console.log("major", major); - if (major) { - this.setData({ - ['maj.major']: major, - ['maj.year']: "", - }) - this.majMajorToYear() + if (!major) return + this.setData({ + ['maj.major']: major, + }) + console.log("major", major); + this.majMajorToJG() + if (major && maj.jg) this.majMajorToYear() + }, + + // 专业 通过专业 算出 机构 + majMajorToJG() { + const option = this.data.majOption + let maj = this.data.maj + let major = maj.major + + + let majJgList = [] + + for (const key in option) { + if (Object.hasOwnProperty.call(option, key)) { + const element = option[key]; + for (const k in element) { + if (k == major) majJgList.push(key) + } + } } + + let jg = maj.jg + if (!majJgList.includes(jg)) jg = "" + + this.setData({ + majJgList, + ['maj.jg']: jg, + }) }, // 选择专业的年份 @@ -170,16 +290,31 @@ Component({ haveChosen() { const classify = this.data.classify if (classify == "school") { + let hint = "" const com = this.data.com const comOption = this.data.comOption + if (!com['jg']) hint = "请选择机构" + else if (!com['year']) hint = "请选择年份" + if (hint) { + common.toast(hint) + return + } com['token'] = comOption[com.jg][com.year] + this.triggerEvent("haveChosen", this.data.com) } else { + let hint = "" let maj = this.data.maj const majOption = this.data.majOption + if (!maj['major']) hint = "请选择专业" + else if (!maj['jg']) hint = "请选择机构" + else if (!maj['year']) hint = "请选择年份" + if (hint) { + common.toast(hint) + return + } maj['token'] = majOption[maj.jg][maj.major][maj.year] + this.triggerEvent("haveChosen", this.data.maj) } - - this.triggerEvent("haveChosen", this.data.classify == "school" ? this.data.com : this.data.maj) }, } }) \ No newline at end of file diff --git a/component/project-list-screen/project-list-screen.wxml b/component/project-list-screen/project-list-screen.wxml index 45263de..373fb21 100644 --- a/component/project-list-screen/project-list-screen.wxml +++ b/component/project-list-screen/project-list-screen.wxml @@ -1,12 +1,12 @@ - + 请选择 评榜机构 - {{ item }} + {{ rankingKey[item] || item }} @@ -17,12 +17,6 @@ - - 评榜机构 - - {{ item }} - - 专业 @@ -31,6 +25,12 @@ + + 评榜机构 + + {{ rankingKey[item] || item }} + + 年份 diff --git a/component/territorySelect/territorySelect.js b/component/territorySelect/territorySelect.js index 69f9b72..34493fd 100644 --- a/component/territorySelect/territorySelect.js +++ b/component/territorySelect/territorySelect.js @@ -35,16 +35,8 @@ Component({ const key = e.currentTarget.dataset.key const value = e.currentTarget.dataset.value || {} - let yearList = [] - - - for (const key in value) { - yearList.push(key) - } - this.triggerEvent('closeselect', { - key, - yearList, + value, }) }, diff --git a/component/territorySelect/territorySelect.wxml b/component/territorySelect/territorySelect.wxml index a02edd2..30d79b9 100644 --- a/component/territorySelect/territorySelect.wxml +++ b/component/territorySelect/territorySelect.wxml @@ -3,10 +3,10 @@ {{ titleObj[type] }} - + - {{ type == 'subject2' ? item.label : (item.value || item.name || index) }} + {{ type == 'subject2' ? item.label : type == 'major' ? item : (item.value || item.name || index) }} {{ item.count }} diff --git a/pages/projectAllList/projectAllList.js b/pages/projectAllList/projectAllList.js index 591bfd9..6900bb9 100644 --- a/pages/projectAllList/projectAllList.js +++ b/pages/projectAllList/projectAllList.js @@ -14,12 +14,9 @@ Page({ islogin: false, //是否登录 isloginBtnState: false, // 登录弹窗的状态 realizeState: false, // 了解弹窗状态 - user: {}, - classifyType: "school", // school subject classify: "school", // school subject - comData: [], com: {}, comOption: {}, @@ -29,18 +26,7 @@ Page({ majOption: {}, majSum: 0, majObj: {}, - - list: [{}, {}, {}, ], - - rankingObj: { - "QS": "ranking-qs-icon.png", - "USNEWS": "ranking-us-icon.png", - "泰晤士": "ranking-times-icon.png", - "软科": "ranking-soft-icon.png", - "麦考林": "ranking-macleans-icon.png", - }, rankingskeyVlaue: {}, - majPitch: { major: "", organ: "", @@ -70,14 +56,19 @@ Page({ text: "以全面和权威著称,主要关注加拿大国内大学的综合表现,并将大学分为医博类、综合类和基础类", }], - letterList: {}, // 字母列表 - screen_data: {}, - letterKey: "A", - letterFixed: false, + isFirstPattern: true, // 是否是首屏模式 + + rankingKey: { + "Shanghai Ranking": "软科", + "Times Higher Education": "泰晤士", + "times": "泰晤士", + "USNEWS": "U.S. News", + "US News": "U.S. News", + }, }, /** @@ -86,10 +77,11 @@ Page({ windowHeight: 0, onLoad(options) { miucms.pageStart(app).then(() => { - const screen_data = app.globalData.screen_data + const screen_data = app.globalData.screen_data + const user = app.globalData.user this.setData({ - islogin: app.globalData.user.uid > 0 ? true : false, - user: app.globalData.user, + islogin: user.uid > 0 ? true : false, + user, screen_data, }) @@ -121,12 +113,8 @@ Page({ }) list.sort((a, b) => { - if (a.subject < b.subject) { - return -1; - } - if (a.subject > b.subject) { - return 1; - } + if (a.subject < b.subject) return -1; + if (a.subject > b.subject) return 1; return 0; }); @@ -142,7 +130,6 @@ Page({ // 用于记录每个首字母的数量 const initialCount = {}; - // 为每个对象添加首字母标识并统计首字母数量 list.forEach(item => { const initial = item.subject[0].toUpperCase(); @@ -188,67 +175,29 @@ Page({ const data = res.data const comprehensive = data.comprehensive || {} - // const comSum = this.countKeysInNestedObjects(comprehensive) - let com = this.data.com - - com['jg'] = Object.keys(comprehensive)[0] - - let yearsSet = [...this.collectYears(comprehensive)].sort((a, b) => b - a); - com['year'] = yearsSet[0] - com['token'] = comprehensive[com.jg][com.year] + // let com = this.data.com + // com['jg'] = Object.keys(comprehensive)[0] + // let yearsSet = [...this.collectYears(comprehensive)].sort((a, b) => b - a); + // com['year'] = yearsSet[0] const discipline = data.discipline || {} - // const majSum = this.countKeysInNestedObjects(discipline) - // const majObj = this.transform(discipline) - - let maj = this.data.maj - const [dOrganizationKey, dOrganizationValue] = Object.entries(discipline)[0] - maj['jg'] = dOrganizationKey - maj['major'] = Object.entries(dOrganizationValue)[0][0] - const dYear = [...this.collectYears(discipline)].sort((a, b) => b - a); - maj['year'] = dYear[0] - maj['token'] = discipline[maj.jg][maj.major][maj.year] + // let maj = this.data.maj + // const [dOrganizationKey, dOrganizationValue] = Object.entries(discipline)[0] + // maj['jg'] = dOrganizationKey + // maj['major'] = Object.entries(dOrganizationValue)[0][0] + // const dYear = [...this.collectYears(discipline)].sort((a, b) => b - a); + // maj['year'] = dYear[0] this.setData({ comOption: comprehensive, - // comSum, - com, + // com, majOption: discipline, - // majSum, - // majObj, - maj, + // maj, isInitFinish: true, }) }).finally(() => wx.hideLoading()) }, - transform(input) { - const result = {}; - const subjectMap = new Map(); - - // 收集学科对应的机构 - for (const [agency, subjects] of Object.entries(input)) { - for (const subject of Object.keys(subjects)) { - if (!subjectMap.has(subject)) subjectMap.set(subject, new Set()); - subjectMap.get(subject).add(agency); - } - } - - // 构建结果 - for (const [agency, subjects] of Object.entries(input)) { - for (const [subject, data] of Object.entries(subjects)) { - const agencies = subjectMap.get(subject); - if (!result[subject]) result[subject] = {}; - // if (agencies.size > 1) { - // console.log("99", agencies.size); - // } - result[subject][agency] = data - } - } - - return result; - }, - // 计算对象里对象的数量 countKeysInNestedObjects(obj) { let count = 0; @@ -328,14 +277,6 @@ Page({ const classify = e.currentTarget.dataset.type if (classify == this.data.classify) return - - // let discipline = this.data.discipline || {} - // 切换 专业排名时 判断 是否需要 显示选择 - // if (classify == 'subject' && discipline.list.length == 0) this.haveDiscipline() - - // let comprehensive = this.data.comprehensive || {} - // if (classify == 'school' && comprehensive.list.length == 0) this.haveComprehensive() - this.setData({ classify, }) @@ -357,6 +298,7 @@ Page({ this.setData({ [classify == "school" ? 'com' : 'maj']: detail, screenState: false, + classifyType: "", }) const jg = encodeURIComponent(detail.jg || '') @@ -408,6 +350,7 @@ Page({ query.exec(res => { if (!res) return + this.topBtnSistance = res[0].height + headHeight res.forEach(element => { headHeight += element.height }) @@ -429,23 +372,12 @@ Page({ jumpToIndex(e) { const key = e.currentTarget.dataset.key const sideHeight = this.sideHeight - console.log("sideHeight", sideHeight); wx.pageScrollTo({ scrollTop: sideHeight[key], }) }, - // touchToIndex(e) { - // console.log("e", e); - // const key = e.target.dataset.key - // if (!key) return - // console.log("key", key); - // const sideHeight = this.sideHeight - // wx.pageScrollTo({ - // scrollTop: sideHeight[key], - // }) - // }, - + topBtnSistance: 248, // onPageScroll(e) { const scrollTop = e.scrollTop const sideHeight = this.sideHeight @@ -465,16 +397,17 @@ Page({ letterKey, }) } - // console.log("scrollTop", scrollTop, this.windowHeight / 4); - // if (scrollTop > this.windowHeight / 4) { - // this.setData({ - // letterFixed: true, - // }) - // } else { - // this.setData({ - // letterFixed: false, - // }) - // } + + if (scrollTop > this.topBtnSistance && this.data.isFirstPattern) { + // 这里是 首屏的 + this.setData({ + isFirstPattern: false, + }) + } else if (scrollTop < this.topBtnSistance && !this.data.isFirstPattern) { + this.setData({ + isFirstPattern: true, + }) + } }, /** @@ -523,6 +456,17 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage() { + return { + title: "【寄托港校项目库】- 世界排行榜", + } + }, - } + onShareTimeline() { + util.statistics({ + name: "share-timeline" + }) + return { + title: "【寄托港校项目库】- 世界排行榜", + } + }, }) \ No newline at end of file diff --git a/pages/projectAllList/projectAllList.less b/pages/projectAllList/projectAllList.less index fb159d6..0abcd6a 100644 --- a/pages/projectAllList/projectAllList.less +++ b/pages/projectAllList/projectAllList.less @@ -6,7 +6,7 @@ view { .container { min-height: 100vh; - padding-bottom: 180rpx; + padding-bottom: 100rpx; background-color: rgba(245, 245, 245, 1); .header { @@ -117,7 +117,7 @@ view { } .all { - margin: 0 22rpx 75rpx; + margin: 0 22rpx; border-radius: 0 0 15rpx 15rpx; .classify { @@ -206,7 +206,7 @@ view { .end { font-size: 19.5rpx; color: #D7D7D7; - padding: 100rpx 0; + padding: 60rpx 0; text-align: center; } @@ -215,6 +215,7 @@ view { margin-top: -28rpx; position: relative; padding-top: 55.5rpx; + border-radius: 0 0 15rpx 15rpx; .list { padding: 0 30rpx; @@ -253,6 +254,7 @@ view { margin-top: -28rpx; position: relative; padding-top: 55.5rpx; + border-radius: 0 0 15rpx 15rpx; .letter { // position: absolute; @@ -261,8 +263,9 @@ view { right: 22rpx; // transform: translateY(-50%); position: fixed; - top: 50%; - transform: translateY(-50%); + // top: 50%; + // transform: translateY(-50%); + bottom: 80rpx; color: #AAAAAA; transition: all 0.3s; @@ -276,7 +279,7 @@ view { font-size: 21rpx; line-height: 33rpx; padding: 0 20rpx; - + text-align: center; &.pitch { font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; @@ -342,6 +345,12 @@ view { box-shadow: 0 0 7.5rpx rgba(0, 0, 0, 0.172549019607843); z-index: 1; + .select { + .icon { + transform: rotate(90deg); + } + } + .year { height: auto; } @@ -368,6 +377,7 @@ view { width: 10rpx; height: 9rpx; transform: rotate(-90deg); + transition: all .3s; } } @@ -418,7 +428,7 @@ view { } .list { - padding: 0 45rpx 95rpx; + padding: 0 45rpx 150rpx; .item { padding: 30rpx 0; @@ -576,33 +586,4 @@ view { } } } - -} - - -// .scroll-tip { -// position: fixed; -// top: 50%; -// left: 50%; -// transform: translate(-50%, -50%); -// width: 100rpx; -// height: 100rpx; -// background: rgba(0, 0, 0, 0.7); -// color: white; -// border-radius: 50%; -// display: flex; -// align-items: center; -// justify-content: center; -// font-size: 48rpx; -// animation: scaleTip 0.3s; -// } - -// @keyframes scaleTip { -// from { -// transform: translate(-50%, -50%) scale(0); -// } - -// to { -// transform: translate(-50%, -50%) scale(1); -// } -// } \ No newline at end of file +} \ No newline at end of file diff --git a/pages/projectAllList/projectAllList.wxml b/pages/projectAllList/projectAllList.wxml index a1796e6..d0b13b4 100644 --- a/pages/projectAllList/projectAllList.wxml +++ b/pages/projectAllList/projectAllList.wxml @@ -1,6 +1,6 @@ - + {{ isFirstPattern ? '' : '世界排行榜' }} @@ -82,7 +82,7 @@ 共{{ majSum }}个专业排名榜单 - {{ index }} + {{ index }} @@ -110,7 +110,7 @@ - + 了解评榜机构 @@ -125,6 +125,4 @@ - - \ No newline at end of file diff --git a/pages/projectAllList/projectAllList.wxss b/pages/projectAllList/projectAllList.wxss index 914371f..0bad286 100644 --- a/pages/projectAllList/projectAllList.wxss +++ b/pages/projectAllList/projectAllList.wxss @@ -5,7 +5,7 @@ view { } .container { min-height: 100vh; - padding-bottom: 180rpx; + padding-bottom: 100rpx; background-color: #f5f5f5; } .container .header { @@ -97,7 +97,7 @@ view { margin-left: 12rpx; } .container .all { - margin: 0 22rpx 75rpx; + margin: 0 22rpx; border-radius: 0 0 15rpx 15rpx; } .container .all .classify { @@ -175,7 +175,7 @@ view { .container .all .end { font-size: 19.5rpx; color: #D7D7D7; - padding: 100rpx 0; + padding: 60rpx 0; text-align: center; } .container .all .synthesis { @@ -183,6 +183,7 @@ view { margin-top: -28rpx; position: relative; padding-top: 55.5rpx; + border-radius: 0 0 15rpx 15rpx; } .container .all .synthesis .list { padding: 0 30rpx; @@ -211,12 +212,12 @@ view { margin-top: -28rpx; position: relative; padding-top: 55.5rpx; + border-radius: 0 0 15rpx 15rpx; } .container .all .major .letter { right: 22rpx; position: fixed; - top: 50%; - transform: translateY(-50%); + bottom: 80rpx; color: #AAAAAA; transition: all 0.3s; } @@ -224,6 +225,7 @@ view { font-size: 21rpx; line-height: 33rpx; padding: 0 20rpx; + text-align: center; } .container .all .major .letter .item.pitch { font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; @@ -279,6 +281,9 @@ view { box-shadow: 0 0 7.5rpx rgba(0, 0, 0, 0.17254902); z-index: 1; } +.container .all .major .list .item .organ .select-box.show .select .icon { + transform: rotate(90deg); +} .container .all .major .list .item .organ .select-box.show .year { height: auto; } @@ -302,6 +307,7 @@ view { width: 10rpx; height: 9rpx; transform: rotate(-90deg); + transition: all 0.3s; } .container .all .major .list .item .organ .select-box .year { height: 0; @@ -339,7 +345,7 @@ view { margin-bottom: 14rpx; } .container .pop .pop-box.realize-box .list { - padding: 0 45rpx 95rpx; + padding: 0 45rpx 150rpx; } .container .pop .pop-box.realize-box .list .item { padding: 30rpx 0; diff --git a/pages/projectComparison/projectComparison.js b/pages/projectComparison/projectComparison.js index f4f9ed2..cddddec 100644 --- a/pages/projectComparison/projectComparison.js +++ b/pages/projectComparison/projectComparison.js @@ -208,6 +208,7 @@ Page({ project.forEach(ele => { if (projectPitch.system == ele.system && projectPitch.year == ele.year && ele.projectid == element) { projectValue[ele.projectid] = { + id: ele.id || "-", rank: ele.rank || "-", subject: ele.subject || "-", } @@ -227,6 +228,8 @@ Page({ school.forEach(ele => { if (schoolPitch.system == ele.mechanism && schoolPitch.year == ele.year) { schoolValue[ele.sid] = { + mechanism: ele.mechanism || "", + year: ele.year || "", rank: ele.rank || "-", } } @@ -554,4 +557,22 @@ Page({ selectType == "rank" ? this.getProjectValue() : this.getSchoolPitch() }, + + goProjectList(e) { + const id = e.currentTarget.dataset.value?.id || '' + if (!id) return + const project = this.data.ranking.project || [] + let target = project.find(element => element.id == id); + if (!target) return + const major = encodeURIComponent(target.subject) + const organ = encodeURIComponent(target.system) + common.goPage(`/pages/projectList/projectList?type=subject&system=${organ}&subject=${major}&year=${target.year}`) + }, + + goProjectSchoolList(e) { + const target = e.currentTarget.dataset.value || "" + if (!target) return + const mechanism = encodeURIComponent(target.mechanism) + common.goPage(`/pages/projectList/projectList?type=school&mechanism=${mechanism}&year=${target.year}`) + }, }) \ No newline at end of file diff --git a/pages/projectComparison/projectComparison.less b/pages/projectComparison/projectComparison.less index 9945b03..114eb64 100644 --- a/pages/projectComparison/projectComparison.less +++ b/pages/projectComparison/projectComparison.less @@ -131,7 +131,7 @@ navigator { // width: 100%; color: #7F7F7F; - line-height: 21rpx; + // line-height: 21rpx; font-size: 19.5rpx; font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; font-weight: 400; diff --git a/pages/projectComparison/projectComparison.wxml b/pages/projectComparison/projectComparison.wxml index 937564e..2d7cde6 100644 --- a/pages/projectComparison/projectComparison.wxml +++ b/pages/projectComparison/projectComparison.wxml @@ -38,8 +38,8 @@ - - + + @@ -51,8 +51,8 @@ - - + + diff --git a/pages/projectComparison/projectComparison.wxss b/pages/projectComparison/projectComparison.wxss index 608eaf7..1fc3f3c 100644 --- a/pages/projectComparison/projectComparison.wxss +++ b/pages/projectComparison/projectComparison.wxss @@ -93,7 +93,6 @@ navigator { } .block .item .mode7 .major { color: #7F7F7F; - line-height: 21rpx; font-size: 19.5rpx; font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; font-weight: 400; diff --git a/pages/projectDetails/projectDetails.wxml b/pages/projectDetails/projectDetails.wxml index e557dd9..f29ecc4 100644 --- a/pages/projectDetails/projectDetails.wxml +++ b/pages/projectDetails/projectDetails.wxml @@ -604,7 +604,7 @@ {{ text }} - + 榜单 diff --git a/pages/projectLibrary/projectLibrary.less b/pages/projectLibrary/projectLibrary.less index 4d1c17a..00ee142 100644 --- a/pages/projectLibrary/projectLibrary.less +++ b/pages/projectLibrary/projectLibrary.less @@ -919,6 +919,8 @@ view { .text { max-width: 240rpx; + line-height: 72rpx; + height: 72rpx; // display: contents; // flex: 1; // display: contents; diff --git a/pages/projectLibrary/projectLibrary.wxss b/pages/projectLibrary/projectLibrary.wxss index 95dada8..49134b2 100644 --- a/pages/projectLibrary/projectLibrary.wxss +++ b/pages/projectLibrary/projectLibrary.wxss @@ -752,6 +752,8 @@ view { } .ranking .swiper .swiper-item .list .item .content1 .text { max-width: 240rpx; + line-height: 72rpx; + height: 72rpx; } .ranking .swiper .swiper-item .list .item .content1 .year { white-space: nowrap; diff --git a/pages/projectList/projectList.js b/pages/projectList/projectList.js index 1b7111a..d834440 100644 --- a/pages/projectList/projectList.js +++ b/pages/projectList/projectList.js @@ -25,6 +25,7 @@ Page({ comList: [], comPage: 1, comTotal: 0, + comDefault: {}, majOption: {}, maj: { jg: "", @@ -35,6 +36,15 @@ Page({ majList: [], majPage: 1, majTotal: 0, + majDefault: {}, + + rankingKey: { + "Shanghai Ranking": "软科", + "Times Higher Education": "泰晤士", + "times": "泰晤士", + "USNEWS": "U.S. News", + "US News": "U.S. News", + }, }, /** @@ -58,11 +68,16 @@ Page({ universityArr, user: app.globalData.user, }) + const rankingsObj = Object.fromEntries(Object.entries(data.rankings).map(([key, element]) => [element.name, key])); + if (options['system']) { + options.system = this.decodeKey(options.system) + options.system = rankingsObj[options.system] || options.system + } if (['subject', 'school'].includes(options.type)) { const isSubject = options.type === 'subject'; - const targetKey = isSubject ? 'maj' : 'com'; + const targetKey = isSubject ? 'majDefault' : 'comDefault'; const source = this.data[targetKey] || (isSubject ? {} : this.data.com); - const updates = { + let updates = { jg: this.decodeKey(isSubject ? options.system : options.mechanism) || '', year: `${options.year || ''}` }; @@ -91,13 +106,13 @@ Page({ compAllList: [], // 获取 综合排名 数据 getSynthesizeData() { + let comDefault = this.data.comDefault let com = this.data.com wx.showLoading({ title: '加载中...', }) - util.wxget("/api/project.rankings/comprehensive", { - token: com['token'], + token: com['token'] || comDefault['token'], ishongkong: this.data.comOnly || 0, limit: 2000, }).then(res => { @@ -141,9 +156,10 @@ Page({ wx.showLoading({ title: '加载中...', }) + let majDefault = this.data.majDefault let maj = this.data.maj util.wxget("/api/project.rankings/discipline", { - token: maj['token'], + token: maj['token'] || majDefault['token'], ishongkong: this.data.majOnly || 0, }).then(res => { if (res.code != 200) return @@ -186,17 +202,17 @@ Page({ const data = res.data const comprehensive = data.comprehensive - let com = this.data.com + let com = this.data.comDefault let organizationSet = [...this.objectOne(comprehensive)] if (!com['jg']) com['jg'] = organizationSet[0] let yearsSet = [...this.collectYears(comprehensive)].sort((a, b) => b - a); if (!com['year']) com['year'] = yearsSet[0] - com['token'] = comprehensive[com.jg][com.year] + com['token'] = comprehensive[com.jg]?.[com.year] || "" const discipline = data.discipline - let maj = this.data.maj + let maj = this.data.majDefault const [dOrganizationKey, dOrganizationValue] = Object.entries(discipline)[0] if (!maj['jg']) maj['jg'] = dOrganizationKey if (!maj['major']) maj['major'] = Object.entries(dOrganizationValue)[0][0] @@ -204,13 +220,13 @@ Page({ const dYear = [...this.collectYears(discipline)].sort((a, b) => b - a); if (!maj['year']) maj['year'] = dYear[0] - maj['token'] = discipline[maj.jg][maj.major][maj.year] + maj['token'] = discipline[maj.jg]?.[maj.major]?.[maj.year] || "" this.setData({ comOption: comprehensive, - com, + comDefault: com, majOption: discipline, - maj, + majDefault: maj, isInitFinish: true, }) diff --git a/pages/projectList/projectList.less b/pages/projectList/projectList.less index 9d4c535..90cbe5b 100644 --- a/pages/projectList/projectList.less +++ b/pages/projectList/projectList.less @@ -253,131 +253,6 @@ view { } } -.screen-mask { - width: 100vw; - height: 100vh; - background-color: rgba(0, 0, 0, 0.705882352941177); - position: fixed; - top: 0; - left: 0; - width: 100vw; - height: 100vh; - display: flex; - align-items: flex-end; - z-index: 100; - - .screen-box { - width: 100vw; - background-color: #FFFFFF; - padding-top: 43.5rpx; - border-radius: 45rpx 45rpx 0 0; - - .head { - font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; - font-weight: 650; - font-size: 30rpx; - color: #000000; - margin-bottom: 45rpx; - text-align: center; - } - - .box { - margin: 0 22.5rpx 30rpx; - background-color: rgba(251, 251, 251, 1); - border: 1rpx solid rgba(242, 242, 242, 1); - border-radius: 15rpx; - padding: 16.5rpx 18rpx 30rpx 18rpx; - - .title { - font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; - font-weight: 650; - font-size: 27rpx; - color: #000000; - margin-bottom: 45rpx; - } - - .major-box { - height: 72rpx; - line-height: 72rpx; - background-color: rgba(255, 255, 255, 1); - border: 1rpx solid rgba(204, 208, 3, 1); - border-radius: 112.5rpx; - padding-left: 30rpx; - padding-right: 22.5rpx; - - .text { - font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; - font-weight: 650; - font-size: 24rpx; - color: #9A9D02; - - &.text-no { - color: #AAAAAA; - font-weight: 400; - } - } - - .icon { - width: 10.5rpx; - height: 18rpx; - } - } - - .list { - flex-wrap: wrap; - - .item { - min-width: 150rpx; - height: 72rpx; - line-height: 72rpx; - background-color: rgba(246, 246, 246, 1); - border-radius: 112.5rpx; - font-size: 24rpx; - color: #555555; - margin-right: 15rpx; - padding: 0 15rpx; - margin-bottom: 10rpx; - - &.pitch { - border: 1rpx solid rgba(204, 208, 3, 1); - font-weight: 650; - color: #9A9D02; - } - } - } - } - - .footer { - margin-top: 45rpx; - height: 201rpx; - border-top: 1rpx solid #ebebeb; - justify-content: space-between; - font-size: 30rpx; - padding: 45rpx 30rpx 0 30rpx; - - .cancel { - width: 225rpx; - height: 96rpx; - background-color: rgba(207, 247, 255, 0); - border: 1rpx solid rgba(215, 215, 215, 1); - border-radius: 112.5rpx; - color: #555555; - } - - .confirm { - width: 435rpx; - height: 96rpx; - font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; - font-weight: 650; - color: #026277; - background-color: rgba(207, 247, 255, 1); - border: 1rpx solid rgba(186, 222, 230, 1); - border-radius: 112.5rpx; - } - } - } -} - .index-sidebar { position: relative; z-index: 99; diff --git a/pages/projectList/projectList.wxml b/pages/projectList/projectList.wxml index 56f3df4..b19cbca 100644 --- a/pages/projectList/projectList.wxml +++ b/pages/projectList/projectList.wxml @@ -32,7 +32,7 @@ - {{ com.jg }}世界综合排名({{ com.year }}年) + {{ rankingKey[com.jg] || rankingKey[comDefault.jg] || com.jg || comDefault.jg }}世界综合排名({{ com.year || comDefault.year }}年) @@ -46,7 +46,7 @@ - {{ maj.jg }} > {{ maj.major }}({{ maj.year }}年) + {{ rankingKey[maj.jg] || rankingKey[majDefault.jg] || maj.jg || majDefault.jg }} > {{ maj.major || majDefault.major }}({{ maj.year || majDefault.year }}年) diff --git a/pages/projectList/projectList.wxss b/pages/projectList/projectList.wxss index a11605a..cbd76ed 100644 --- a/pages/projectList/projectList.wxss +++ b/pages/projectList/projectList.wxss @@ -210,114 +210,6 @@ view { font-size: 19.5rpx; color: #D7D7D7; } -.screen-mask { - background-color: rgba(0, 0, 0, 0.70588235); - position: fixed; - top: 0; - left: 0; - width: 100vw; - height: 100vh; - display: flex; - align-items: flex-end; - z-index: 100; -} -.screen-mask .screen-box { - width: 100vw; - background-color: #FFFFFF; - padding-top: 43.5rpx; - border-radius: 45rpx 45rpx 0 0; -} -.screen-mask .screen-box .head { - font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; - font-weight: 650; - font-size: 30rpx; - color: #000000; - margin-bottom: 45rpx; - text-align: center; -} -.screen-mask .screen-box .box { - margin: 0 22.5rpx 30rpx; - background-color: #fbfbfb; - border: 1rpx solid #f2f2f2; - border-radius: 15rpx; - padding: 16.5rpx 18rpx 30rpx 18rpx; -} -.screen-mask .screen-box .box .title { - font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; - font-weight: 650; - font-size: 27rpx; - color: #000000; - margin-bottom: 45rpx; -} -.screen-mask .screen-box .box .major-box { - height: 72rpx; - line-height: 72rpx; - background-color: #ffffff; - border: 1rpx solid #ccd003; - border-radius: 112.5rpx; - padding-left: 30rpx; - padding-right: 22.5rpx; -} -.screen-mask .screen-box .box .major-box .text { - font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; - font-weight: 650; - font-size: 24rpx; - color: #9A9D02; -} -.screen-mask .screen-box .box .major-box .text.text-no { - color: #AAAAAA; - font-weight: 400; -} -.screen-mask .screen-box .box .major-box .icon { - width: 10.5rpx; - height: 18rpx; -} -.screen-mask .screen-box .box .list { - flex-wrap: wrap; -} -.screen-mask .screen-box .box .list .item { - min-width: 150rpx; - height: 72rpx; - line-height: 72rpx; - background-color: #f6f6f6; - border-radius: 112.5rpx; - font-size: 24rpx; - color: #555555; - margin-right: 15rpx; - padding: 0 15rpx; - margin-bottom: 10rpx; -} -.screen-mask .screen-box .box .list .item.pitch { - border: 1rpx solid #ccd003; - font-weight: 650; - color: #9A9D02; -} -.screen-mask .screen-box .footer { - margin-top: 45rpx; - height: 201rpx; - border-top: 1rpx solid #ebebeb; - justify-content: space-between; - font-size: 30rpx; - padding: 45rpx 30rpx 0 30rpx; -} -.screen-mask .screen-box .footer .cancel { - width: 225rpx; - height: 96rpx; - background-color: rgba(207, 247, 255, 0); - border: 1rpx solid #d7d7d7; - border-radius: 112.5rpx; - color: #555555; -} -.screen-mask .screen-box .footer .confirm { - width: 435rpx; - height: 96rpx; - font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; - font-weight: 650; - color: #026277; - background-color: #cff7ff; - border: 1rpx solid #badee6; - border-radius: 112.5rpx; -} .index-sidebar { position: relative; z-index: 99; diff --git a/project.private.config.json b/project.private.config.json index 76e3cd8..7bda233 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -8,6 +8,13 @@ "condition": { "miniprogram": { "list": [ + { + "name": "pages/projectList/projectList", + "pathName": "pages/projectList/projectList", + "query": "type=subject&system=%25E8%25BD%25AF%25E7%25A7%2591&subject=Oceanography&year=2024", + "launchMode": "default", + "scene": null + }, { "name": "pages/projectList/projectList", "pathName": "pages/projectList/projectList",