From be2dfd313e7ed10cc2de314a75015680179c488e Mon Sep 17 00:00:00 2001 From: "DESKTOP-RQ919RC\\Pc" <1300399510@qq.com> Date: Tue, 4 Mar 2025 18:53:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E9=BD=90offer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 17 +- app.wxss | 22 + .../project-list-screen.js | 185 ++++++ .../project-list-screen.json | 6 + .../project-list-screen.less | 155 +++++ .../project-list-screen.wxml | 47 ++ .../project-list-screen.wxss | 133 ++++ pages/projectAllList/projectAllList.js | 528 +++++++++++++++ pages/projectAllList/projectAllList.json | 8 + pages/projectAllList/projectAllList.less | 608 ++++++++++++++++++ pages/projectAllList/projectAllList.wxml | 130 ++++ pages/projectAllList/projectAllList.wxss | 474 ++++++++++++++ pages/projectComparison/projectComparison.js | 140 ++++ .../projectComparison/projectComparison.less | 137 +++- .../projectComparison/projectComparison.wxml | 32 +- .../projectComparison/projectComparison.wxss | 106 ++- pages/projectLibrary/projectLibrary.js | 58 +- pages/projectLibrary/projectLibrary.less | 123 +++- pages/projectLibrary/projectLibrary.wxml | 33 + pages/projectLibrary/projectLibrary.wxss | 95 +++ pages/projectList/projectList.js | 468 +++----------- pages/projectList/projectList.json | 4 +- pages/projectList/projectList.wxml | 71 +- project.private.config.json | 27 +- utils/util.js | 8 + 25 files changed, 3169 insertions(+), 446 deletions(-) create mode 100644 component/project-list-screen/project-list-screen.js create mode 100644 component/project-list-screen/project-list-screen.json create mode 100644 component/project-list-screen/project-list-screen.less create mode 100644 component/project-list-screen/project-list-screen.wxml create mode 100644 component/project-list-screen/project-list-screen.wxss create mode 100644 pages/projectAllList/projectAllList.js create mode 100644 pages/projectAllList/projectAllList.json create mode 100644 pages/projectAllList/projectAllList.less create mode 100644 pages/projectAllList/projectAllList.wxml create mode 100644 pages/projectAllList/projectAllList.wxss diff --git a/app.json b/app.json index b87e63d..7037344 100644 --- a/app.json +++ b/app.json @@ -6,6 +6,7 @@ "pages/projectSubjectList/projectSubjectList", "pages/projectComparison/projectComparison", "pages/projectList/projectList", + "pages/projectAllList/projectAllList", "pages/projectMy/projectMy", "pages/projectDetails/projectDetails", "pages/search/search", @@ -18,13 +19,15 @@ "navigationBarBackgroundColor": "#ffffff", "navigationStyle": "custom" }, - "subpackages": [{ - "root": "pagesSquare", - "name": "pagesSquare", - "pages": [ - "pages/PCAuthorization/PCAuthorization" - ] - }], + "subpackages": [ + { + "root": "pagesSquare", + "name": "pagesSquare", + "pages": [ + "pages/PCAuthorization/PCAuthorization" + ] + } + ], "style": "v2", "componentFramework": "glass-easel", "sitemapLocation": "sitemap.json", diff --git a/app.wxss b/app.wxss index 02aa6ff..bdddf66 100644 --- a/app.wxss +++ b/app.wxss @@ -92,4 +92,26 @@ font-weight: 900; font-style: normal; font-display: swap; +} + +.organ-item.qs { + background-color: #f7a602; +} + +.organ-item.times { + background: -webkit-linear-gradient(311.63353934deg, #fc392d 0%, #3948ff 135%); + background: -moz-linear-gradient(138.36646066deg, #fc392d 0%, #3948ff 135%); + background: linear-gradient(138.36646066deg, #fc392d 0%, #3948ff 135%); +} + +.organ-item.usnews { + background-color: #2456c8; +} + +.organ-item.ruanke { + background-color: #e5122d; +} + +.organ-item.mecoxLane { + background-color: #333333; } \ No newline at end of file diff --git a/component/project-list-screen/project-list-screen.js b/component/project-list-screen/project-list-screen.js new file mode 100644 index 0000000..d4c21a4 --- /dev/null +++ b/component/project-list-screen/project-list-screen.js @@ -0,0 +1,185 @@ +// template/project-list-screen/project-list-screen.js +Component({ + + /** + * 组件的属性列表 + */ + properties: { + classify: String, + comOption: { + type: Object, + observer(res) { + if (!res || JSON.stringify(res) == "{}") return + this.comJGToYear() + }, + }, + + com: Object, + + majOption: { + type: Object, + observer(res) { + if (!res || JSON.stringify(res) == "{}") return + this.majJgList() + } + }, + maj: Object, + }, + + /** + * 组件的初始数据 + */ + data: { + screenState: true, // 筛选状态 true 是选择 机构年份 false 是选择 专业 + comJgList: [], // 综合的 机构列表 + comYearList: [], // 综合的 年份列表 + majJgList: [], // 专业的 机构列表 + majMajorList: [], // 专业的 专业列表 + majYearList: [], // 专业的 年份列表 + }, + + /** + * 组件的方法列表 + */ + methods: { + // 综合 通过机构 计算 出年份 + 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) + let comYearList = Object.keys(option[jg]).sort((a, b) => b - a) + + this.setData({ + comJgList, + comYearList, + com: { + jg, + year: comYearList[0], + } + }) + }, + + // 选择综合的 机构 + selectComJg(e) { + const key = e.currentTarget.dataset.key + this.setData({ + [`com.jg`]: key, + }) + this.comJGToYear() + }, + + // 选择综合的 年份 + selectComYear(e) { + const key = e.currentTarget.dataset.key + this.setData({ + [`com.year`]: key, + }) + }, + + // 专业 算出机构列表和默认机构 + majJgList() { + const maj = this.data.maj + const option = this.data.majOption || {} + const jg = maj.jg || Object.keys(option)[0] + let majJgList = Object.keys(option) + this.setData({ + majJgList, + [`maj.jg`]: jg, + }) + this.majJgToMajor() + }, + + // 专业 通过 机构 算出 专业列表 + majJgToMajor() { + const maj = this.data.maj + const option = this.data.majOption[maj.jg] || {} + let majMajorList = Object.keys(option) + const major = maj.major || majMajorList[0] + this.setData({ + majMajorList, + [`maj.major`]: major, + }) + this.majMajorToYear() + }, + + // 专业 通过专业 算出 年份列表 + majMajorToYear() { + const maj = this.data.maj + const option = this.data.majOption[maj.jg][maj.major] || {} + let majYearList = Object.keys(option).sort((a, b) => b - a) || [] + const year = maj.year || majYearList[0] + this.setData({ + majYearList, + [`maj.year`]: year, + }) + }, + + // 专业 选择 机构 + selectMajJg(e) { + const jg = e.currentTarget.dataset.key + this.setData({ + maj: { + jg, + major: "", + year: "", + } + }) + + this.majJgToMajor() + }, + + // 打开专业弹窗 + opneMajorPop() { + this.setData({ + screenState: false, + }) + }, + + // 选择专业弹窗的关闭 + closeselect(e) { + const major = e.detail?.value || "" + this.setData({ + screenState: true, + }) + + if (major) { + this.setData({ + ['maj.major']: major, + ['maj.year']: "", + }) + this.majMajorToYear() + } + }, + + // 选择专业的年份 + selectMajYear(e) { + const key = e.currentTarget.dataset.key + this.setData({ + [`maj.year`]: key, + }) + }, + + // 点击取消 + cutScreenState() { + this.triggerEvent("cutScreenState") + }, + + // 点击选好了 + haveChosen() { + const classify = this.data.classify + if (classify == "school") { + const com = this.data.com + const comOption = this.data.comOption + com['token'] = comOption[com.jg][com.year] + } else { + let maj = this.data.maj + const majOption = this.data.majOption + maj['token'] = majOption[maj.jg][maj.major][maj.year] + } + + 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.json b/component/project-list-screen/project-list-screen.json new file mode 100644 index 0000000..deeff8c --- /dev/null +++ b/component/project-list-screen/project-list-screen.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "territory-select": "/component/territorySelect/territorySelect" + } +} \ No newline at end of file diff --git a/component/project-list-screen/project-list-screen.less b/component/project-list-screen/project-list-screen.less new file mode 100644 index 0000000..1c4ac53 --- /dev/null +++ b/component/project-list-screen/project-list-screen.less @@ -0,0 +1,155 @@ +/* template/project-list-screen/project-list-screen.wxss */ +/* 公共的 css 样式 */ +.flexflex { + display: flex; +} + +.flexcenter { + display: flex; + justify-content: center; + align-items: center; +} + +.flexjcenter { + display: flex; + justify-content: center; +} + +.flexacenter { + display: flex; + align-items: center; +} + +.flex1 { + flex: 1; +} + +.flexcolumn { + display: flex; + flex-direction: column; +} + +.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; + } + } + } +} \ 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 new file mode 100644 index 0000000..45263de --- /dev/null +++ b/component/project-list-screen/project-list-screen.wxml @@ -0,0 +1,47 @@ + + + + 请选择 + + + 评榜机构 + + {{ item }} + + + + 年份 + + {{ item }} + + + + + + 评榜机构 + + {{ item }} + + + + 专业 + + {{ maj.major }} + 请选择 + + + + + 年份 + + {{ item }} + + + + + 取消 + 选好了 + + + + \ No newline at end of file diff --git a/component/project-list-screen/project-list-screen.wxss b/component/project-list-screen/project-list-screen.wxss new file mode 100644 index 0000000..4ba41a6 --- /dev/null +++ b/component/project-list-screen/project-list-screen.wxss @@ -0,0 +1,133 @@ +/* template/project-list-screen/project-list-screen.wxss */ +/* 公共的 css 样式 */ +.flexflex { + display: flex; +} +.flexcenter { + display: flex; + justify-content: center; + align-items: center; +} +.flexjcenter { + display: flex; + justify-content: center; +} +.flexacenter { + display: flex; + align-items: center; +} +.flex1 { + flex: 1; +} +.flexcolumn { + display: flex; + flex-direction: column; +} +.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; +} diff --git a/pages/projectAllList/projectAllList.js b/pages/projectAllList/projectAllList.js new file mode 100644 index 0000000..591bfd9 --- /dev/null +++ b/pages/projectAllList/projectAllList.js @@ -0,0 +1,528 @@ +// pages/projectAllList/projectAllList.js +const miucms = require('../../utils/miucms.js'); +import common from '../../utils/commonMethod' +import util from "../../utils/util" +var app = getApp() + +Page({ + + /** + * 页面的初始数据 + */ + data: { + informationState: false, // 授权后可能需要弹出完成信息框 个人背景那些 + islogin: false, //是否登录 + isloginBtnState: false, // 登录弹窗的状态 + realizeState: false, // 了解弹窗状态 + + user: {}, + + classifyType: "school", // school subject + classify: "school", // school subject + + comData: [], + com: {}, + comOption: {}, + comSum: 0, + majData: [], + maj: {}, + 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: "", + }, + + screenState: false, // 选择框的状态 + + organList: [{ + name: "QS", + key: "qs", + text: "由英国的Quacquarelli Symonds公司编制,侧重于学术声誉、雇主声誉、师生比例等指标" + }, { + name: "泰晤士", + key: "times", + text: "以其全面的数据收集和分析著称,涵盖了教学、研究、国际化等多个方面‌" + }, { + name: "‌U.S. News", + key: "usnews", + text: "由美国新闻与世界报道出版,注重学术研究影响力、学术声誉等", + }, { + name: "‌软科", + key: "ruanke", + text: "由中国上海交通大学发布,强调科研表现和学术影响力", + }, { + name: "麦考林", + key: "mecoxLane", + text: "以全面和权威著称,主要关注加拿大国内大学的综合表现,并将大学分为医博类、综合类和基础类", + }], + + + letterList: {}, // 字母列表 + + screen_data: {}, + + letterKey: "A", + + letterFixed: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + windowHeight: 0, + onLoad(options) { + miucms.pageStart(app).then(() => { + const screen_data = app.globalData.screen_data + this.setData({ + islogin: app.globalData.user.uid > 0 ? true : false, + user: app.globalData.user, + screen_data, + }) + + this.windowHeight = screen_data.windowHeight + + common.xgBasicData(this, app).then(data => { + this.setData({ + rankingskeyVlaue: data.rankings || {}, + }) + this.getRankings() + this.getComprehensiveRanking() + this.getMajorRanking() + }) + }) + }, + + // 专业 + getMajorRanking() { + util.wxget("/api/ranking/getMajorRanking", {}).then(res => { + if (res.code != 200) return + const data = res.data + let list = data.list || [] + list.forEach(element => { + element['systemObj'] = {} + element.lists.forEach(ele => { + if (!Array.isArray(element['systemObj'][ele.system])) element['systemObj'][ele.system] = [] + element['systemObj'][ele.system].push(ele) + }) + }) + + list.sort((a, b) => { + if (a.subject < b.subject) { + return -1; + } + if (a.subject > b.subject) { + return 1; + } + return 0; + }); + + // 为每个对象添加首字母标识 + let currentInitial = null; + list.forEach(item => { + const initial = item.subject[0].toUpperCase() + if (initial !== currentInitial) { + item.initial = initial; + currentInitial = initial; + } + }) + + // 用于记录每个首字母的数量 + const initialCount = {}; + + // 为每个对象添加首字母标识并统计首字母数量 + list.forEach(item => { + const initial = item.subject[0].toUpperCase(); + if (!initialCount[initial]) { + initialCount[initial] = { + initial: 0, + sum: 0, + } + } + initialCount[initial]['initial'] += 1 + initialCount[initial]['sum'] += Object.keys(item.systemObj).length || 0 + }); + + this.setData({ + majSum: data.count, + majData: list, + letterList: initialCount, + }, () => { + this.calculateSectionTops() + }) + }) + }, + + // 综合 + getComprehensiveRanking() { + util.wxget("/api/ranking/getComprehensiveRanking", {}).then(res => { + if (res.code != 200) return + const data = res.data + this.setData({ + comSum: data.count, + comData: data.list, + }) + }) + }, + + // 获取 配置信息 + getRankings() { + wx.showLoading({ + title: '加载中...', + }) + util.wxget("/api/project.rankings", {}).then(res => { + if (res.code != 200) return + 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] + + 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] + + this.setData({ + comOption: comprehensive, + // comSum, + com, + majOption: discipline, + // majSum, + // majObj, + 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; + for (let key in obj) { + if (obj.hasOwnProperty(key)) { + const value = obj[key]; + if (typeof value === 'object' && value !== null) { + count += Object.keys(value).length; + count += this.countKeysInNestedObjects(value); + } + } + } + return count; + }, + + // 计算出 对象 所有 二级 key 不重复 + collectYears(obj, arr = new Set()) { + for (let key in obj) { + if (obj.hasOwnProperty(key)) { + if (!isNaN(key) && key.length === 4) arr.add(key); + const value = obj[key]; + if (typeof value === 'object' && value !== null) this.collectYears(value, arr); + } + } + return [...arr]; + }, + + openYear(e) { + const major = e.currentTarget.dataset.major + const organ = e.currentTarget.dataset.organ + this.setData({ + majPitch: { + major, + organ, + } + }) + }, + + // 选择专业排名 + selectMaj(e) { + let major = e.currentTarget.dataset.major + let organ = e.currentTarget.dataset.organ + const year = e.currentTarget.dataset.year + major = encodeURIComponent(major) + organ = encodeURIComponent(organ) + common.goPage(`/pages/projectList/projectList?type=subject&system=${organ}&subject=${major}&year=${year}`) + this.closeYear() + }, + + // 选择综合排名 + selectCom(e) { + let mechanism = e.currentTarget.dataset.mechanism || '' + const year = e.currentTarget.dataset.year + mechanism = encodeURIComponent(mechanism) + common.goPage(`/pages/projectList/projectList?type=school&mechanism=${mechanism}&year=${year}`) + }, + + closeYear() { + this.setData({ + majPitch: { + major: "", + organ: "", + } + }) + }, + + + // 切换了解状态 + cutRealizeState() { + this.setData({ + realizeState: !this.data.realizeState, + }) + }, + + // 切换查看类型 + cutClassify(e) { + 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, + }) + }, + + // 点击 + cutScreenState(e) { + const type = e.currentTarget.dataset.type + this.setData({ + classifyType: type, + screenState: !this.data.screenState, + }) + }, + + // 点击 筛选的选好了 + haveChosen(e) { + const detail = e.detail || {} + const classify = this.data.classifyType + this.setData({ + [classify == "school" ? 'com' : 'maj']: detail, + screenState: false, + }) + + const jg = encodeURIComponent(detail.jg || '') + + if (classify == "school") common.goPage(`/pages/projectList/projectList?type=school&mechanism=${jg}&year=${detail.year}`) + else common.goPage(`/pages/projectList/projectList?type=subject&system=${jg}&subject=${encodeURIComponent(detail.major || '')}&year=${detail.year}`) + }, + + userClickLogin(e) { + let data = e.detail.data + this.setData({ + islogin: true, + isloginBtnState: false, + informationState: data.regdatastep == 'success' ? false : true, + }) + + this.onLoad(this.data.options) + }, + + // 子组件传值 修改 完善信息组件的状态 + revampInformationState() { + this.setData({ + informationState: false + }) + }, + + // 关闭授权登录事件 + popClose() { + this.setData({ + isloginBtnState: !this.data.isloginBtnState + }) + }, + + openLoginState() { + this.setData({ + isloginBtnState: true + }) + }, + + sideHeight: {}, + // 计算每个字母区域的位置 + calculateSectionTops() { + const screen_data = this.data.screen_data + const query = wx.createSelectorQuery() + let headHeight = screen_data.totalTopHeight || 0 + query.select(`.header`).boundingClientRect() + query.select(`.item-header-screen`).boundingClientRect() + query.select(`.screen`).boundingClientRect() + + query.exec(res => { + if (!res) return + res.forEach(element => { + headHeight += element.height + }) + headHeight += util.rpxTopx(165) + let sideHeight = {} + const letterList = this.data.letterList + let h = util.pxToRpx(headHeight) + for (const key in letterList) { + const element = letterList[key] + let height = 108 * element.initial + 106 * element.sum + sideHeight[key] = util.rpxTopx(h) + h += height + } + this.sideHeight = sideHeight + }) + }, + + // 点击字母跳转 + 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], + // }) + // }, + + onPageScroll(e) { + const scrollTop = e.scrollTop + const sideHeight = this.sideHeight + const sideHeightList = Object.keys(sideHeight) || [] + if (sideHeightList.length == 0) return + const keys = Object.keys(sideHeight); + // 对键数组进行倒序排列 + let closestValue = keys.reduce((acc, key) => { + const diff = sideHeight[key] - scrollTop; + if (diff <= 5) return key + return acc; + }, null); + + const letterKey = closestValue || 'A' + if (letterKey != this.data.letterKey) { + this.setData({ + letterKey, + }) + } + // console.log("scrollTop", scrollTop, this.windowHeight / 4); + // if (scrollTop > this.windowHeight / 4) { + // this.setData({ + // letterFixed: true, + // }) + // } else { + // this.setData({ + // letterFixed: false, + // }) + // } + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/projectAllList/projectAllList.json b/pages/projectAllList/projectAllList.json new file mode 100644 index 0000000..9369dc9 --- /dev/null +++ b/pages/projectAllList/projectAllList.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "header-nav": "/component/headerNav/headerNav", + "go-login": "/component/goLogin/goLogin", + "perfect-information": "/component/perfectInformation/perfectInformation", + "project-list-screen": "/component/project-list-screen/project-list-screen" + } +} \ No newline at end of file diff --git a/pages/projectAllList/projectAllList.less b/pages/projectAllList/projectAllList.less new file mode 100644 index 0000000..fb159d6 --- /dev/null +++ b/pages/projectAllList/projectAllList.less @@ -0,0 +1,608 @@ +/* pages/projectAllList/projectAllList.wxss */ +view { + box-sizing: border-box; + font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; +} + +.container { + min-height: 100vh; + padding-bottom: 180rpx; + background-color: rgba(245, 245, 245, 1); + + .header { + padding: 36rpx 36rpx 61.5rpx; + background-color: #fbfbfb; + border-bottom: 1rpx solid #ebebeb; + margin-bottom: 60rpx; + + .medal { + width: 180rpx; + height: 180rpx; + margin-right: 30rpx; + } + + .right { + .name { + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + font-style: normal; + font-size: 48rpx; + color: #000000; + margin-bottom: 24rpx; + } + + .institution { + border-top: 1rpx solid #ebebeb; + border-bottom: 1rpx solid #ebebeb; + padding: 24rpx 0 12rpx; + + .text { + font-size: 21rpx; + color: #333333; + margin-bottom: 24rpx; + font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; + } + + .list { + flex-wrap: wrap; + + .item { + padding: 0 9rpx; + height: 33rpx; + line-height: 33rpx; + border-radius: 9rpx; + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + font-style: normal; + font-size: 21rpx; + color: #FFFFFF; + margin-bottom: 12rpx; + + &:not(:last-of-type) { + margin-right: 16.5rpx; + } + } + } + } + } + } + + .item-header { + .greenDot { + width: 9rpx; + height: 24rpx; + background-color: rgba(204, 208, 3, 1); + border: 1rpx solid rgba(154, 157, 2, 1); + border-radius: 7.5rpx; + margin-right: 20rpx; + } + + font-family: 'PingFangSC-Semibold', + 'PingFang SC Semibold', + 'PingFang SC', + sans-serif; + font-weight: 650; + font-style: normal; + font-size: 30rpx; + color: #000000; + padding-left: 22rpx; + margin-bottom: 30rpx; + } + + .screen { + height: 132rpx; + background-color: rgba(255, 255, 255, 1); + border: 1rpx solid rgba(242, 242, 242, 1); + border-radius: 15rpx; + margin: 0 22rpx 75rpx; + + .item { + width: 322.5rpx; + height: 72rpx; + background-color: rgba(246, 246, 246, 1); + border: 1rpx solid rgba(235, 235, 235, 1); + border-radius: 112.5rpx; + font-size: 24rpx; + + &:first-of-type { + margin-right: 15rpx; + } + + .icon { + width: 30rpx; + height: 30rpx; + margin-left: 12rpx; + } + } + } + + .all { + margin: 0 22rpx 75rpx; + border-radius: 0 0 15rpx 15rpx; + + .classify { + padding-top: 21rpx; + font-size: 30rpx; + color: #555555; + height: 109.5rpx; + font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; + background-color: rgba(237, 240, 244, 1); + border-radius: 15rpx 15rpx 0 0; + -moz-box-shadow: 0 -1.5rpx 4.5rpx rgba(0, 0, 0, 0.0470588235294118); + -webkit-box-shadow: 0 -1.5rpx 4.5rpx rgba(0, 0, 0, 0.0470588235294118); + box-shadow: 0 -1.5rpx 4.5rpx rgba(0, 0, 0, 0.0470588235294118); + + .classify-item { + justify-content: center; + position: relative; + + .pitch { + position: absolute; + top: -28rpx; + left: 0; + width: 375rpx; + height: 90rpx; + font-weight: 650; + font-size: 30rpx; + color: #000000; + overflow: hidden; + + &.right { + left: auto; + right: 0; + + .text { + margin-left: 115.5rpx; + } + } + + .icon { + position: absolute; + left: -4.5rpx; + top: -4.5rpx; + width: 385.5rpx; + height: 100.5rpx; + } + + .text { + position: relative; + z-index: 1; + margin-top: 27rpx; + margin-left: 73.5rpx; + + .text-icon-box { + width: 42rpx; + height: 42rpx; + border-radius: 50%; + background-color: #f95d5d; + margin-right: 15rpx; + + .text-icon { + width: 30rpx; + height: 30rpx; + } + } + } + } + } + } + + .total { + font-size: 21rpx; + color: #7F7F7F; + text-align: center; + margin-bottom: 45rpx; + } + + .spot { + width: 12rpx; + height: 12rpx; + background-color: rgba(246, 246, 189, 1); + border: 1rpx solid rgba(204, 208, 3, 1); + border-radius: 58.5rpx; + margin-right: 18rpx; + } + + .end { + font-size: 19.5rpx; + color: #D7D7D7; + padding: 100rpx 0; + text-align: center; + } + + .synthesis { + background-color: #ffffff; + margin-top: -28rpx; + position: relative; + padding-top: 55.5rpx; + + .list { + padding: 0 30rpx; + + .item { + &:not(:last-of-type) { + margin-bottom: 76.5rpx; + } + + .icon { + width: 130.5rpx; + height: 36rpx; + } + + .text { + padding: 33rpx 0; + border-bottom: 1rpx dotted #ebebeb; + + .title { + width: max-content; + } + + .year { + white-space: nowrap; + } + + font-size: 25.5rpx; + color: #000000; + } + } + } + } + + .major { + background-color: #ffffff; + margin-top: -28rpx; + position: relative; + padding-top: 55.5rpx; + + .letter { + // position: absolute; + // top: 50%; + // top: 0; + right: 22rpx; + // transform: translateY(-50%); + position: fixed; + top: 50%; + transform: translateY(-50%); + color: #AAAAAA; + transition: all 0.3s; + + // &.fixed { + // position: fixed; + // top: 50%; + // transform: translateY(-50%); + // } + + .item { + font-size: 21rpx; + line-height: 33rpx; + padding: 0 20rpx; + + + &.pitch { + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + color: #000000; + } + } + } + + .list { + .mask { + width: 100vw; + height: 100vh; + position: fixed; + top: 0; + left: 0; + z-index: 1; + } + + .item { + &:not(:last-of-type) { + margin-bottom: 76rpx; + } + + .title { + font-family: 'Arial-BoldMT', 'Arial Bold', 'Arial', sans-serif; + font-weight: 700; + font-style: normal; + font-size: 27rpx; + color: #000000; + padding-left: 30rpx; + line-height: 32rpx; + } + + .organ { + flex-direction: column; + padding-left: 75rpx; + padding-right: 90rpx; + + .organ-item { + height: 106rpx; + position: relative; + border-bottom: 1rpx dotted #ebebeb; + + .name { + font-size: 22.5rpx; + width: 130.5rpx; + } + } + + .select-box { + width: 394.5rpx; + position: absolute; + top: 0; + right: -15rpx; + padding-top: 94rpx; + padding-bottom: 10rpx; + transition: all .3s; + + &.show { + background-color: rgba(242, 242, 242, 1); + border-radius: 22.5rpx; + box-shadow: 0 0 7.5rpx rgba(0, 0, 0, 0.172549019607843); + z-index: 1; + + .year { + height: auto; + } + } + + .select { + position: absolute; + top: 25.5rpx; + right: 15rpx; + width: 364.5rpx; + height: 54rpx; + background-color: rgba(246, 246, 246, 1); + border: 1rpx solid rgba(215, 215, 215, 1); + border-radius: 36rpx; + padding: 0 15rpx; + justify-content: space-between; + + .text { + font-size: 21rpx; + color: #7F7F7F; + } + + .icon { + width: 10rpx; + height: 9rpx; + transform: rotate(-90deg); + } + } + + .year { + height: 0; + overflow: hidden; + font-size: 24rpx; + color: #000000; + padding-left: 34.5rpx; + + .year-item { + padding: 14rpx 0; + } + } + } + } + } + } + } + } + + + .pop { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background-color: rgba(0, 0, 0, 0.705882352941177); + z-index: 100; + flex-direction: column; + justify-content: flex-end; + + .pop-box { + background-color: rgba(255, 255, 255, 1); + border-radius: 45rpx 45rpx 0 0; + + &.realize-box { + .name { + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + font-style: normal; + font-size: 36rpx; + color: #000000; + text-align: center; + padding-top: 60rpx; + margin-bottom: 14rpx; + } + + .list { + padding: 0 45rpx 95rpx; + + .item { + padding: 30rpx 0; + + &:not(:last-of-type) { + border-bottom: 1rpx dotted #ebebeb; + } + + .title { + height: 33rpx; + border-radius: 9rpx; + font-weight: 650; + font-style: normal; + font-size: 24rpx; + color: #FFFFFF; + padding: 0 15rpx; + width: max-content; + margin-bottom: 16.5rpx; + } + + .text { + font-size: 22.5rpx; + color: #555555; + line-height: 39rpx; + font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; + } + } + } + } + } + + } + + .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; + } + } + } + } + +} + + +// .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 diff --git a/pages/projectAllList/projectAllList.wxml b/pages/projectAllList/projectAllList.wxml new file mode 100644 index 0000000..a1796e6 --- /dev/null +++ b/pages/projectAllList/projectAllList.wxml @@ -0,0 +1,130 @@ + + + + + + + + 世界排行榜 + + 了解评榜机构: + + {{ item.name }} + + + + + + + + 筛选榜单 + + + + + 筛选综合排名 + + + + 筛选专业排名 + + + + + + + 全部榜单 + + + + + + + + + + + + 综合排名 + + + 综合排名 + + + + + + + + + 专业排名 + + + 专业排名 + + + + + 共{{ comSum }}个综合排名榜单 + + + + + + {{ ite.name }} + + + + + - End - + + + + 共{{ majSum }}个专业排名榜单 + + {{ index }} + + + + + {{ item.subject }} + + + + {{ rankingskeyVlaue[ii].name || '' }} + + + 请选择年份 + + + + {{ it.year }}年 + + + + + + + - End - + + + + + + + 了解评榜机构 + + + {{ item.name }} + {{ item.text }} + + + + + + + + + + + \ No newline at end of file diff --git a/pages/projectAllList/projectAllList.wxss b/pages/projectAllList/projectAllList.wxss new file mode 100644 index 0000000..914371f --- /dev/null +++ b/pages/projectAllList/projectAllList.wxss @@ -0,0 +1,474 @@ +/* pages/projectAllList/projectAllList.wxss */ +view { + box-sizing: border-box; + font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; +} +.container { + min-height: 100vh; + padding-bottom: 180rpx; + background-color: #f5f5f5; +} +.container .header { + padding: 36rpx 36rpx 61.5rpx; + background-color: #fbfbfb; + border-bottom: 1rpx solid #ebebeb; + margin-bottom: 60rpx; +} +.container .header .medal { + width: 180rpx; + height: 180rpx; + margin-right: 30rpx; +} +.container .header .right .name { + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + font-style: normal; + font-size: 48rpx; + color: #000000; + margin-bottom: 24rpx; +} +.container .header .right .institution { + border-top: 1rpx solid #ebebeb; + border-bottom: 1rpx solid #ebebeb; + padding: 24rpx 0 12rpx; +} +.container .header .right .institution .text { + font-size: 21rpx; + color: #333333; + margin-bottom: 24rpx; + font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; +} +.container .header .right .institution .list { + flex-wrap: wrap; +} +.container .header .right .institution .list .item { + padding: 0 9rpx; + height: 33rpx; + line-height: 33rpx; + border-radius: 9rpx; + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + font-style: normal; + font-size: 21rpx; + color: #FFFFFF; + margin-bottom: 12rpx; +} +.container .header .right .institution .list .item:not(:last-of-type) { + margin-right: 16.5rpx; +} +.container .item-header { + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + font-style: normal; + font-size: 30rpx; + color: #000000; + padding-left: 22rpx; + margin-bottom: 30rpx; +} +.container .item-header .greenDot { + width: 9rpx; + height: 24rpx; + background-color: #ccd003; + border: 1rpx solid #9a9d02; + border-radius: 7.5rpx; + margin-right: 20rpx; +} +.container .screen { + height: 132rpx; + background-color: #ffffff; + border: 1rpx solid #f2f2f2; + border-radius: 15rpx; + margin: 0 22rpx 75rpx; +} +.container .screen .item { + width: 322.5rpx; + height: 72rpx; + background-color: #f6f6f6; + border: 1rpx solid #ebebeb; + border-radius: 112.5rpx; + font-size: 24rpx; +} +.container .screen .item:first-of-type { + margin-right: 15rpx; +} +.container .screen .item .icon { + width: 30rpx; + height: 30rpx; + margin-left: 12rpx; +} +.container .all { + margin: 0 22rpx 75rpx; + border-radius: 0 0 15rpx 15rpx; +} +.container .all .classify { + padding-top: 21rpx; + font-size: 30rpx; + color: #555555; + height: 109.5rpx; + font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; + background-color: #edf0f4; + border-radius: 15rpx 15rpx 0 0; + -moz-box-shadow: 0 -1.5rpx 4.5rpx rgba(0, 0, 0, 0.04705882); + -webkit-box-shadow: 0 -1.5rpx 4.5rpx rgba(0, 0, 0, 0.04705882); + box-shadow: 0 -1.5rpx 4.5rpx rgba(0, 0, 0, 0.04705882); +} +.container .all .classify .classify-item { + justify-content: center; + position: relative; +} +.container .all .classify .classify-item .pitch { + position: absolute; + top: -28rpx; + left: 0; + width: 375rpx; + height: 90rpx; + font-weight: 650; + font-size: 30rpx; + color: #000000; + overflow: hidden; +} +.container .all .classify .classify-item .pitch.right { + left: auto; + right: 0; +} +.container .all .classify .classify-item .pitch.right .text { + margin-left: 115.5rpx; +} +.container .all .classify .classify-item .pitch .icon { + position: absolute; + left: -4.5rpx; + top: -4.5rpx; + width: 385.5rpx; + height: 100.5rpx; +} +.container .all .classify .classify-item .pitch .text { + position: relative; + z-index: 1; + margin-top: 27rpx; + margin-left: 73.5rpx; +} +.container .all .classify .classify-item .pitch .text .text-icon-box { + width: 42rpx; + height: 42rpx; + border-radius: 50%; + background-color: #f95d5d; + margin-right: 15rpx; +} +.container .all .classify .classify-item .pitch .text .text-icon-box .text-icon { + width: 30rpx; + height: 30rpx; +} +.container .all .total { + font-size: 21rpx; + color: #7F7F7F; + text-align: center; + margin-bottom: 45rpx; +} +.container .all .spot { + width: 12rpx; + height: 12rpx; + background-color: #f6f6bd; + border: 1rpx solid #ccd003; + border-radius: 58.5rpx; + margin-right: 18rpx; +} +.container .all .end { + font-size: 19.5rpx; + color: #D7D7D7; + padding: 100rpx 0; + text-align: center; +} +.container .all .synthesis { + background-color: #ffffff; + margin-top: -28rpx; + position: relative; + padding-top: 55.5rpx; +} +.container .all .synthesis .list { + padding: 0 30rpx; +} +.container .all .synthesis .list .item:not(:last-of-type) { + margin-bottom: 76.5rpx; +} +.container .all .synthesis .list .item .icon { + width: 130.5rpx; + height: 36rpx; +} +.container .all .synthesis .list .item .text { + padding: 33rpx 0; + border-bottom: 1rpx dotted #ebebeb; + font-size: 25.5rpx; + color: #000000; +} +.container .all .synthesis .list .item .text .title { + width: max-content; +} +.container .all .synthesis .list .item .text .year { + white-space: nowrap; +} +.container .all .major { + background-color: #ffffff; + margin-top: -28rpx; + position: relative; + padding-top: 55.5rpx; +} +.container .all .major .letter { + right: 22rpx; + position: fixed; + top: 50%; + transform: translateY(-50%); + color: #AAAAAA; + transition: all 0.3s; +} +.container .all .major .letter .item { + font-size: 21rpx; + line-height: 33rpx; + padding: 0 20rpx; +} +.container .all .major .letter .item.pitch { + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + color: #000000; +} +.container .all .major .list .mask { + width: 100vw; + height: 100vh; + position: fixed; + top: 0; + left: 0; + z-index: 1; +} +.container .all .major .list .item:not(:last-of-type) { + margin-bottom: 76rpx; +} +.container .all .major .list .item .title { + font-family: 'Arial-BoldMT', 'Arial Bold', 'Arial', sans-serif; + font-weight: 700; + font-style: normal; + font-size: 27rpx; + color: #000000; + padding-left: 30rpx; + line-height: 32rpx; +} +.container .all .major .list .item .organ { + flex-direction: column; + padding-left: 75rpx; + padding-right: 90rpx; +} +.container .all .major .list .item .organ .organ-item { + height: 106rpx; + position: relative; + border-bottom: 1rpx dotted #ebebeb; +} +.container .all .major .list .item .organ .organ-item .name { + font-size: 22.5rpx; + width: 130.5rpx; +} +.container .all .major .list .item .organ .select-box { + width: 394.5rpx; + position: absolute; + top: 0; + right: -15rpx; + padding-top: 94rpx; + padding-bottom: 10rpx; + transition: all 0.3s; +} +.container .all .major .list .item .organ .select-box.show { + background-color: #f2f2f2; + border-radius: 22.5rpx; + box-shadow: 0 0 7.5rpx rgba(0, 0, 0, 0.17254902); + z-index: 1; +} +.container .all .major .list .item .organ .select-box.show .year { + height: auto; +} +.container .all .major .list .item .organ .select-box .select { + position: absolute; + top: 25.5rpx; + right: 15rpx; + width: 364.5rpx; + height: 54rpx; + background-color: #f6f6f6; + border: 1rpx solid #d7d7d7; + border-radius: 36rpx; + padding: 0 15rpx; + justify-content: space-between; +} +.container .all .major .list .item .organ .select-box .select .text { + font-size: 21rpx; + color: #7F7F7F; +} +.container .all .major .list .item .organ .select-box .select .icon { + width: 10rpx; + height: 9rpx; + transform: rotate(-90deg); +} +.container .all .major .list .item .organ .select-box .year { + height: 0; + overflow: hidden; + font-size: 24rpx; + color: #000000; + padding-left: 34.5rpx; +} +.container .all .major .list .item .organ .select-box .year .year-item { + padding: 14rpx 0; +} +.container .pop { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background-color: rgba(0, 0, 0, 0.70588235); + z-index: 100; + flex-direction: column; + justify-content: flex-end; +} +.container .pop .pop-box { + background-color: #ffffff; + border-radius: 45rpx 45rpx 0 0; +} +.container .pop .pop-box.realize-box .name { + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + font-style: normal; + font-size: 36rpx; + color: #000000; + text-align: center; + padding-top: 60rpx; + margin-bottom: 14rpx; +} +.container .pop .pop-box.realize-box .list { + padding: 0 45rpx 95rpx; +} +.container .pop .pop-box.realize-box .list .item { + padding: 30rpx 0; +} +.container .pop .pop-box.realize-box .list .item:not(:last-of-type) { + border-bottom: 1rpx dotted #ebebeb; +} +.container .pop .pop-box.realize-box .list .item .title { + height: 33rpx; + border-radius: 9rpx; + font-weight: 650; + font-style: normal; + font-size: 24rpx; + color: #FFFFFF; + padding: 0 15rpx; + width: max-content; + margin-bottom: 16.5rpx; +} +.container .pop .pop-box.realize-box .list .item .text { + font-size: 22.5rpx; + color: #555555; + line-height: 39rpx; + font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; +} +.container .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; +} +.container .screen-mask .screen-box { + width: 100vw; + background-color: #FFFFFF; + padding-top: 43.5rpx; + border-radius: 45rpx 45rpx 0 0; +} +.container .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; +} +.container .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; +} +.container .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; +} +.container .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; +} +.container .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; +} +.container .screen-mask .screen-box .box .major-box .text.text-no { + color: #AAAAAA; + font-weight: 400; +} +.container .screen-mask .screen-box .box .major-box .icon { + width: 10.5rpx; + height: 18rpx; +} +.container .screen-mask .screen-box .box .list { + flex-wrap: wrap; +} +.container .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; +} +.container .screen-mask .screen-box .box .list .item.pitch { + border: 1rpx solid #ccd003; + font-weight: 650; + color: #9A9D02; +} +.container .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; +} +.container .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; +} +.container .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; +} diff --git a/pages/projectComparison/projectComparison.js b/pages/projectComparison/projectComparison.js index 0341b4d..f4f9ed2 100644 --- a/pages/projectComparison/projectComparison.js +++ b/pages/projectComparison/projectComparison.js @@ -38,6 +38,16 @@ Page({ isInitFinish: false, user: {}, + rankingsObj: {}, + selectState: false, + + schoolList: [], + schoolPitch: {}, + schoolValue: [], + + projectList: [], + projectPitch: {}, + projectValue: {}, }, /** @@ -74,7 +84,15 @@ Page({ discipline.forEach(element => { obj[element.value] = element.label }) + + const rankings = data.rankings || {} + let rankingsObj = {} + for (const key in rankings) { + const element = rankings[key] || {} + rankingsObj[element.alias] = element.name + } this.setData({ + rankingsObj, disciplineObj: obj, }) this.initData() @@ -142,6 +160,37 @@ Page({ common.toast("出错了,请联系管理员。") }) + const ranking = data.ranking + const project = ranking.project || [] + let projectArr = [] + project.forEach(element => { + projectArr.push({ + system: element.system, + year: element.year, + }) + }) + const projectList = this.removeDuplicates(projectArr) + + const school = ranking.school + let schoolArr = [] + school.forEach(element => { + schoolArr.push({ + system: element.mechanism, + year: element.year, + }) + }) + const schoolList = this.removeDuplicates(schoolArr) + this.setData({ + projectList, + projectPitch: projectList[0] || {}, + schoolList, + schoolPitch: schoolList[0] || {}, + ranking, + }) + + this.getProjectValue() + this.getSchoolPitch() + }).finally(() => { wx.hideLoading() this.setData({ @@ -150,6 +199,66 @@ Page({ }) }, + getProjectValue() { + const projectPitch = this.data.projectPitch + const ids = this.ids || [] + const project = this.data.ranking.project || [] + let projectValue = {} + ids.forEach((element, index) => { + project.forEach(ele => { + if (projectPitch.system == ele.system && projectPitch.year == ele.year && ele.projectid == element) { + projectValue[ele.projectid] = { + rank: ele.rank || "-", + subject: ele.subject || "-", + } + } + }) + }) + + this.setData({ + projectValue, + }) + }, + + getSchoolPitch() { + const schoolPitch = this.data.schoolPitch + const school = this.data.ranking.school || [] + let schoolValue = {} + school.forEach(ele => { + if (schoolPitch.system == ele.mechanism && schoolPitch.year == ele.year) { + schoolValue[ele.sid] = { + rank: ele.rank || "-", + } + } + }) + this.setData({ + schoolValue, + }) + }, + + // 去掉重复 + removeDuplicates(arr) { + console.log("arr", arr); + const uniqueSet = new Set(); + const uniqueArray = []; + arr.forEach(item => { + const itemString = JSON.stringify(item); + if (!uniqueSet.has(itemString)) { + uniqueSet.add(itemString); + uniqueArray.push(item); + } + }); + + const order = ["QS", "软科", "ruanke", "Shanghai Ranking", "USNEWS", "US News", "usnews", "泰晤士", "Times Higher Education", "麦考林"]; + // 对数组进行排序 + uniqueArray.sort((a, b) => + (order.indexOf(a.system) + 1 || Infinity) - (order.indexOf(b.system) + 1 || Infinity) || + b.year - a.year + ); + + return uniqueArray + }, + // 判断奖学金文案 JudgmentScholarshipText(obj) { let text = "" @@ -414,4 +523,35 @@ Page({ title: this.getShareTitle(), } }, + + openSelectRank(e) { + const type = e.currentTarget.dataset.type + this.setData({ + selectState: true, + selectType: type, + }) + }, + + closeSelectRank() { + this.setData({ + selectState: false, + selectType: "", + }) + }, + + handleSelectType(e) { + const index = e.currentTarget.dataset.index + const selectType = this.data.selectType + let target = {} + if (selectType == "rank") target = this.data.projectList[index] + else target = this.data.schoolList[index] + + this.setData({ + [selectType == "rank" ? 'projectPitch' : 'schoolPitch']: target, + selectType: "", + selectState: false, + }) + + selectType == "rank" ? this.getProjectValue() : this.getSchoolPitch() + }, }) \ No newline at end of file diff --git a/pages/projectComparison/projectComparison.less b/pages/projectComparison/projectComparison.less index f7904a7..9945b03 100644 --- a/pages/projectComparison/projectComparison.less +++ b/pages/projectComparison/projectComparison.less @@ -111,6 +111,48 @@ navigator { } } + .mode7 { + flex-direction: column; + padding: 18rpx 15rpx; + + .sum { + font-family: 'Arial-Black', 'Arial Black', sans-serif; + font-weight: 900; + font-style: normal; + font-size: 24rpx; + color: #000000; + text-align: center; + } + + .major { + // display: flex; + // gap: 8px; + // align-items: flex-start; + // width: 100%; + + color: #7F7F7F; + line-height: 21rpx; + font-size: 19.5rpx; + font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; + font-weight: 400; + font-style: normal; + text-align: center; + + .text { + display: inline-flex; + justify-content: center; + + } + + .year { + flex-shrink: 0; + white-space: nowrap; + align-self: flex-end; + /* 年份底部对齐 */ + } + } + } + } &.show { @@ -450,7 +492,6 @@ navigator { height: 12rpx; margin: 10rpx; margin-right: 40rpx; - margin-bottom: -13px; margin-left: 18rpx; } @@ -466,4 +507,98 @@ navigator { height: 199.5rpx; } } +} + +.ranking-title { + height: 42rpx; + background-color: rgba(246, 246, 246, 1); + border-radius: 322rpx; + font-size: 22.5rpx; + color: #555555; + margin-bottom: 15rpx; + + .icon { + width: 21rpx; + height: 12rpx; + margin-left: 10rpx; + } +} + +.select-pop { + width: 100vw; + height: 100vh; + position: fixed; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.705882352941177); + z-index: 100; + align-items: flex-end; + + .select-box { + width: 100%; + background-color: rgba(255, 255, 255, 1); + border-radius: 45rpx 45rpx 0 0; + padding-top: 70rpx; + padding-bottom: 120rpx; + + .title { + font-weight: 650; + font-style: normal; + font-size: 30rpx; + color: #000000; + text-align: center; + margin-bottom: 50rpx; + } + + .list { + max-height: 60vh; + + .item { + padding-left: 37.5rpx; + height: 90rpx; + + &:not(:last-of-type) { + .content { + border-bottom: 1rpx dotted #ebebeb; + } + } + + font-size: 27rpx; + color: #555555; + + &.pitch { + font-weight: 650; + color: #000000; + + + .content { + .img { + display: block; + } + } + + } + + .dot { + width: 12rpx; + height: 12rpx; + background-color: rgba(246, 246, 189, 1); + border: 1rpx solid rgba(204, 208, 3, 1); + border-radius: 58.5rpx; + margin-right: 33rpx; + } + + .content { + height: 100%; + padding-right: 43.5rpx; + + .img { + display: none; + width: 30rpx; + height: 30rpx; + } + } + } + } + } } \ No newline at end of file diff --git a/pages/projectComparison/projectComparison.wxml b/pages/projectComparison/projectComparison.wxml index 55d3577..937564e 100644 --- a/pages/projectComparison/projectComparison.wxml +++ b/pages/projectComparison/projectComparison.wxml @@ -33,6 +33,10 @@ 专业排名 + + {{ projectPitch.system }}世界专业排名({{ projectPitch.year }}) + + @@ -42,6 +46,10 @@ 学校排名 + + {{ schoolPitch.system }}世界综合排名({{ schoolPitch .year }}) + + @@ -300,4 +308,26 @@ Financial Computing - \ No newline at end of file + + + + + + + 请选择 + + + + + {{ item.system }}世界专业排名({{ item.year }}年) + + + + + + \ No newline at end of file diff --git a/pages/projectComparison/projectComparison.wxss b/pages/projectComparison/projectComparison.wxss index b83f628..608eaf7 100644 --- a/pages/projectComparison/projectComparison.wxss +++ b/pages/projectComparison/projectComparison.wxss @@ -79,6 +79,37 @@ navigator { color: #7F7F7F; margin-bottom: 18rpx; } +.block .item .mode7 { + flex-direction: column; + padding: 18rpx 15rpx; +} +.block .item .mode7 .sum { + font-family: 'Arial-Black', 'Arial Black', sans-serif; + font-weight: 900; + font-style: normal; + font-size: 24rpx; + color: #000000; + text-align: center; +} +.block .item .mode7 .major { + color: #7F7F7F; + line-height: 21rpx; + font-size: 19.5rpx; + font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif; + font-weight: 400; + font-style: normal; + text-align: center; +} +.block .item .mode7 .major .text { + display: inline-flex; + justify-content: center; +} +.block .item .mode7 .major .year { + flex-shrink: 0; + white-space: nowrap; + align-self: flex-end; + /* 年份底部对齐 */ +} .block.show .item { height: 200px; overflow: hidden; @@ -348,7 +379,6 @@ navigator { height: 12rpx; margin: 10rpx; margin-right: 40rpx; - margin-bottom: -13px; margin-left: 18rpx; } .QRcode .img { @@ -362,3 +392,77 @@ navigator { width: 199.5rpx; height: 199.5rpx; } +.ranking-title { + height: 42rpx; + background-color: #f6f6f6; + border-radius: 322rpx; + font-size: 22.5rpx; + color: #555555; + margin-bottom: 15rpx; +} +.ranking-title .icon { + width: 21rpx; + height: 12rpx; + margin-left: 10rpx; +} +.select-pop { + width: 100vw; + height: 100vh; + position: fixed; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.70588235); + z-index: 100; + align-items: flex-end; +} +.select-pop .select-box { + width: 100%; + background-color: #ffffff; + border-radius: 45rpx 45rpx 0 0; + padding-top: 70rpx; + padding-bottom: 120rpx; +} +.select-pop .select-box .title { + font-weight: 650; + font-style: normal; + font-size: 30rpx; + color: #000000; + text-align: center; + margin-bottom: 50rpx; +} +.select-pop .select-box .list { + max-height: 60vh; +} +.select-pop .select-box .list .item { + padding-left: 37.5rpx; + height: 90rpx; + font-size: 27rpx; + color: #555555; +} +.select-pop .select-box .list .item:not(:last-of-type) .content { + border-bottom: 1rpx dotted #ebebeb; +} +.select-pop .select-box .list .item.pitch { + font-weight: 650; + color: #000000; +} +.select-pop .select-box .list .item.pitch .content .img { + display: block; +} +.select-pop .select-box .list .item .dot { + width: 12rpx; + height: 12rpx; + background-color: #f6f6bd; + border: 1rpx solid #ccd003; + border-radius: 58.5rpx; + margin-right: 33rpx; +} +.select-pop .select-box .list .item .content { + height: 100%; + padding-right: 43.5rpx; +} +.select-pop .select-box .list .item .content .img { + display: none; + width: 30rpx; + height: 30rpx; +} diff --git a/pages/projectLibrary/projectLibrary.js b/pages/projectLibrary/projectLibrary.js index 1abc5d9..4f72d4f 100644 --- a/pages/projectLibrary/projectLibrary.js +++ b/pages/projectLibrary/projectLibrary.js @@ -35,6 +35,7 @@ Page({ swiperHeightList: {}, // 轮播图高度 swiperCurrent: 0, // 轮播图下标 + rankingList: [], }, @@ -44,6 +45,7 @@ Page({ headHeight: 0, // 头部高度 rpx15: 15, searchBoxTop: 0, + rankingsObj: {}, options: {}, onLoad(options) { this.options = options @@ -68,6 +70,7 @@ Page({ this.windowHeight = screen_data.windowHeight || 812 common.xgBasicData(this, app, true).then(data => { + this.rankingsObj = data.rankings || {} this.setData({ contrastcount: data.contrastcount || 0, university: data.university, @@ -80,6 +83,7 @@ Page({ this.addRandom() this.getProjectData() this.bannerData() + this.getRankingData() const fateProject = (this.data.fateProject || []).map(element => ({ ...element, @@ -341,7 +345,6 @@ Page({ list = (list).map(element => ({ ...element, random: app.randomString(6), - // semesterState: month > element.semester.month && year + 1 <= element.semester.year, semesterState: (year < element.semester.year) || (year === element.semester.year && month < element.semester.month), })); @@ -790,4 +793,57 @@ Page({ title: "聚焦港校项目,助你迈向国际名校之路!", } }, + + getRankingData() { + util.wxpost("/api/ranking/homeRankingRecommend").then(res => { + if (res.code != 200) { + common.toast(res.message || '') + return + } + const data = res.data || [] + data.forEach(element => { + element['mechanism'] = this.rankingsObj[element.mechanism]?.name || element.mechanism + }) + let arr = [data.slice(0, 5), data.slice(5, 10), data.slice(10, 15)] + console.log("arr", arr); + this.setData({ + rankingList: arr + }) + }) + }, + + bindchangeSwiper(e) { + const current = e.detail.current || 0 + this.setData({ + swiperCurrent: current, + }) + }, + + cutSwiper(e) { + const type = e.currentTarget.dataset.type + const swiperCurrent = this.data.swiperCurrent + const length = this.data.rankingList.length + let newCurrent = swiperCurrent + + if (type == 'right') newCurrent = (swiperCurrent + 1) % length + else if (type == 'left') newCurrent = (swiperCurrent - 1 + length) % length + + this.setData({ + swiperCurrent: newCurrent, + }) + }, + + goProjectAllList() { + common.goPage(`/pages/projectAllList/projectAllList`) + }, + + handRanking(e) { + const index = e.currentTarget.dataset.index + const i = e.currentTarget.dataset.i + const list = this.data.rankingList + const target = list[index][i] + + if (index < 2) common.goPage(`/pages/projectList/projectList?type=subject&system=${encodeURIComponent(target.mechanism)}&subject=${encodeURIComponent(target.subject)}&year=${target.year}`) + else common.goPage(`/pages/projectList/projectList?type=school&mechanism=${encodeURIComponent(target.mechanism)}&year=${target.year}`) + }, }) \ No newline at end of file diff --git a/pages/projectLibrary/projectLibrary.less b/pages/projectLibrary/projectLibrary.less index d72e280..4d1c17a 100644 --- a/pages/projectLibrary/projectLibrary.less +++ b/pages/projectLibrary/projectLibrary.less @@ -789,7 +789,6 @@ view { z-index: 100; } - .slideshow-box { padding: 12rpx 22.5rpx 0; margin-bottom: 33rpx; @@ -819,4 +818,126 @@ view { } } } +} + +.ranking { + margin: 0 22.5rpx 30rpx; + height: 540rpx; + background-color: rgba(255, 255, 255, 1); + border: 1rpx solid rgba(235, 235, 235, 1); + border-radius: 18rpx; + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + + .side { + width: 36rpx; + height: 36rpx; + background-color: #f2f2f2; + border-radius: 50%; + + &.right .icon { + transform: rotate(180deg); + } + + .icon { + width: 10.5rpx; + height: 18rpx; + } + } + + .swiper-box { + flex-direction: column; + width: calc(100% - 110rpx); + height: 100%; + + .btn { + width: 225rpx; + height: 54rpx; + background-color: rgba(4, 176, 213, 1); + border-radius: 172.5rpx; + font-size: 24rpx; + color: #FFFFFF; + margin: 0 auto 30rpx; + + .icon { + width: 16.5rpx; + height: 18rpx; + margin-left: 9rpx; + } + } + } + + .swiper { + height: calc(100% - 84rpx); + margin: 0 30rpx; + + .swiper-item { + .title { + font-weight: 650; + font-size: 30rpx; + color: #000000; + margin: 30rpx auto 10.5rpx; + text-align: center; + } + + .list { + .item { + height: 72rpx; + + &:not(:last-of-type) { + .content { + border-bottom: 1rpx dotted #ebebeb; + } + } + + .spot { + width: 12rpx; + height: 12rpx; + background-color: rgba(253, 223, 109, 1); + border: 1rpx solid rgba(202, 177, 87, 1); + border-radius: 50%; + margin-right: 19.5rpx; + } + + .content1 { + font-size: 22.5rpx; + color: #333333; + width: calc(100% - 31.5rpx); + height: 100%; + line-height: 100%; + + .name { + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + color: #000000; + } + + .icon { + width: 18rpx; + height: 18rpx; + margin: 0 9rpx; + } + + .text { + max-width: 240rpx; + // display: contents; + // flex: 1; + // display: contents; + } + + .year { + white-space: nowrap; + margin-left: 10rpx; + } + } + + .content2 { + display: inline; + font-size: 22.5rpx; + color: #333333; + width: calc(100% - 31.5rpx); + } + } + } + } + } } \ No newline at end of file diff --git a/pages/projectLibrary/projectLibrary.wxml b/pages/projectLibrary/projectLibrary.wxml index db65062..ae44d91 100644 --- a/pages/projectLibrary/projectLibrary.wxml +++ b/pages/projectLibrary/projectLibrary.wxml @@ -158,6 +158,39 @@ + + + + + + + + + {{ swiperCurrent < 2 ? "专业排名" : "综合排名" }} + + + + + {{ item.mechanism }} + + {{ item.subject }} + ({{ item.year }}年) + + {{ item.mechanism }}世界综合排名({{ item.year }}年) + + + + + + 更多榜单 + + + + + + + + diff --git a/pages/projectLibrary/projectLibrary.wxss b/pages/projectLibrary/projectLibrary.wxss index ccfeba5..95dada8 100644 --- a/pages/projectLibrary/projectLibrary.wxss +++ b/pages/projectLibrary/projectLibrary.wxss @@ -668,3 +668,98 @@ view { .slideshow-box .indication-point .indication-point-item.pitch { background-color: #fa6b11; } +.ranking { + margin: 0 22.5rpx 30rpx; + height: 540rpx; + background-color: #ffffff; + border: 1rpx solid #ebebeb; + border-radius: 18rpx; + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; +} +.ranking .side { + width: 36rpx; + height: 36rpx; + background-color: #f2f2f2; + border-radius: 50%; +} +.ranking .side.right .icon { + transform: rotate(180deg); +} +.ranking .side .icon { + width: 10.5rpx; + height: 18rpx; +} +.ranking .swiper-box { + flex-direction: column; + width: calc(100% - 110rpx); + height: 100%; +} +.ranking .swiper-box .btn { + width: 225rpx; + height: 54rpx; + background-color: #04b0d5; + border-radius: 172.5rpx; + font-size: 24rpx; + color: #FFFFFF; + margin: 0 auto 30rpx; +} +.ranking .swiper-box .btn .icon { + width: 16.5rpx; + height: 18rpx; + margin-left: 9rpx; +} +.ranking .swiper { + height: calc(100% - 84rpx); + margin: 0 30rpx; +} +.ranking .swiper .swiper-item .title { + font-weight: 650; + font-size: 30rpx; + color: #000000; + margin: 30rpx auto 10.5rpx; + text-align: center; +} +.ranking .swiper .swiper-item .list .item { + height: 72rpx; +} +.ranking .swiper .swiper-item .list .item:not(:last-of-type) .content { + border-bottom: 1rpx dotted #ebebeb; +} +.ranking .swiper .swiper-item .list .item .spot { + width: 12rpx; + height: 12rpx; + background-color: #fddf6d; + border: 1rpx solid #cab157; + border-radius: 50%; + margin-right: 19.5rpx; +} +.ranking .swiper .swiper-item .list .item .content1 { + font-size: 22.5rpx; + color: #333333; + width: calc(100% - 31.5rpx); + height: 100%; + line-height: 100%; +} +.ranking .swiper .swiper-item .list .item .content1 .name { + font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; + font-weight: 650; + color: #000000; +} +.ranking .swiper .swiper-item .list .item .content1 .icon { + width: 18rpx; + height: 18rpx; + margin: 0 9rpx; +} +.ranking .swiper .swiper-item .list .item .content1 .text { + max-width: 240rpx; +} +.ranking .swiper .swiper-item .list .item .content1 .year { + white-space: nowrap; + margin-left: 10rpx; +} +.ranking .swiper .swiper-item .list .item .content2 { + display: inline; + font-size: 22.5rpx; + color: #333333; + width: calc(100% - 31.5rpx); +} diff --git a/pages/projectList/projectList.js b/pages/projectList/projectList.js index 4c9715f..1b7111a 100644 --- a/pages/projectList/projectList.js +++ b/pages/projectList/projectList.js @@ -13,37 +13,28 @@ Page({ isFirstPattern: true, classify: "school", // school subject screenState: false, // 选择框的状态 - territoryState: false, // 专业弹窗 - - comprehensive: { - organizationKey: "", - organization: [], - yearKey: "", - year: [], - obj: {}, - list: [], - total: 0, - only: 0, - page: 1, - }, - - discipline: { - organizationKey: "", - organization: [], - yearKey: "", - year: [], - majorKey: "", - obj: {}, - list: [], - total: 0, - only: 0, - page: 1, - }, - - university: [], universityArr: [], isInitFinish: false, user: {}, + comOption: {}, + com: { + jg: "", + year: "", + }, + comOnly: 0, // 综合 仅显示香港学校 + comList: [], + comPage: 1, + comTotal: 0, + majOption: {}, + maj: { + jg: "", + major: "", + year: "", + }, + majOnly: 0, // 专业 仅显示香港学校 + majList: [], + majPage: 1, + majTotal: 0, }, /** @@ -64,55 +55,50 @@ Page({ universityArr.push(element.value) }) this.setData({ - university: data.university, universityArr, user: app.globalData.user, }) - - if (options.type == 'subject') { - let discipline = this.data.discipline || {} - discipline["yearKey"] = options.year + "" - discipline["organizationKey"] = this.decodeKey(options.system) - discipline["majorKey"] = this.decodeKey(options.subject) + if (['subject', 'school'].includes(options.type)) { + const isSubject = options.type === 'subject'; + const targetKey = isSubject ? 'maj' : 'com'; + const source = this.data[targetKey] || (isSubject ? {} : this.data.com); + const updates = { + jg: this.decodeKey(isSubject ? options.system : options.mechanism) || '', + year: `${options.year || ''}` + }; + if (isSubject) updates.major = this.decodeKey(options.subject); this.setData({ - classify: "subject", - discipline, - }) + classify: options.type, + [targetKey]: { + ...source, + ...updates + } + }); } - - if (options.type == 'school') { - let comprehensive = this.data.comprehensive - comprehensive["yearKey"] = options.year + "" - comprehensive['organizationKey'] = this.decodeKey(options.mechanism) - this.setData({ - classify: "school", - comprehensive, - }) - } - this.getRankings() }) }) }, decodeKey(key) { + if (!key) return key; while (key !== decodeURIComponent(key)) { key = decodeURIComponent(key); } return key; }, + compAllList: [], // 获取 综合排名 数据 getSynthesizeData() { - let comprehensive = this.data.comprehensive - + let com = this.data.com wx.showLoading({ title: '加载中...', }) util.wxget("/api/project.rankings/comprehensive", { - token: comprehensive['token'], - ishongkong: comprehensive['only'] || 0, + token: com['token'], + ishongkong: this.data.comOnly || 0, limit: 2000, }).then(res => { if (res.code != 200) return @@ -123,16 +109,12 @@ Page({ list.forEach(element => { if (!universityArr.includes(element.sid)) element.sid = 0 }); - comprehensive['total'] = data.count - comprehensive['allList'] = list - comprehensive['list'] = [] - comprehensive['page'] = 1 - - comprehensive['organizeText'] = comprehensive['organizationKey'] - comprehensive['yearText'] = comprehensive['yearKey'] + this.compAllList = list this.setData({ - comprehensive, + comTotal: data.count, + comList: [], + comPage: 1, screenState: false, }) @@ -143,43 +125,36 @@ Page({ // 渲染 综合排名 limit: 20 renderComprehensiveList() { const limit = 20 - let comprehensive = this.data.comprehensive - let page = comprehensive['page'] + let page = this.data.comPage if (page == 0) return - - const allList = comprehensive['allList'] + const allList = this.compAllList const target = allList.slice((page - 1) * limit, page * limit) - comprehensive['list'] = comprehensive.list.concat(target) - comprehensive['page'] = target.length < limit ? 0 : page + 1 this.setData({ - comprehensive + comPage: target.length < limit ? 0 : page + 1, + comList: this.data.comList.concat(target), }) }, + majAllList: [], // 获取 专业排名 数据 getMajorData() { wx.showLoading({ title: '加载中...', }) - let discipline = this.data.discipline - + let maj = this.data.maj util.wxget("/api/project.rankings/discipline", { - token: discipline['token'], - ishongkong: discipline['only'] || 0, + token: maj['token'], + ishongkong: this.data.majOnly || 0, }).then(res => { if (res.code != 200) return let data = res.data - discipline['total'] = data.count - discipline['allList'] = data.data - discipline['list'] = [] - discipline['page'] = 1 - - discipline['organizeText'] = discipline['organizationKey'] - discipline['yearText'] = discipline['yearKey'] - discipline['majorText'] = discipline['majorKey'] + let list = data.data || [] + this.majAllList = list this.setData({ - discipline, + majTotal: data.count, + majList: [], + majPage: 1, screenState: false, }) this.renderDisciplineList() @@ -189,17 +164,15 @@ Page({ // 渲染 专业排名 limit: 20 renderDisciplineList() { const limit = 20 - let discipline = this.data.discipline - let page = discipline['page'] + let page = this.data.majPage if (page == 0) return - const allList = discipline['allList'] + const allList = this.majAllList const target = allList.slice((page - 1) * limit, page * limit) - discipline['list'] = discipline.list.concat(target) - discipline['page'] = target.length < limit ? 0 : page + 1 this.setData({ - discipline, + majList: this.data.majList.concat(target), + majPage: target.length < limit ? 0 : page + 1, }) }, @@ -213,44 +186,36 @@ Page({ const data = res.data const comprehensive = data.comprehensive - let comprehensiveTarget = this.data.comprehensive + let com = this.data.com + let organizationSet = [...this.objectOne(comprehensive)] - comprehensiveTarget['organization'] = organizationSet - if (!comprehensiveTarget['organizationKey']) comprehensiveTarget['organizationKey'] = organizationSet[0] + if (!com['jg']) com['jg'] = organizationSet[0] - let yearsSet = [...this.collectYears(comprehensive)] - yearsSet.sort((a, b) => b - a); - - if (!comprehensiveTarget['yearKey']) comprehensiveTarget['yearKey'] = yearsSet[0] - comprehensiveTarget['obj'] = comprehensive - - this.checkComprehensiveYear() + let yearsSet = [...this.collectYears(comprehensive)].sort((a, b) => b - a); + if (!com['year']) com['year'] = yearsSet[0] + com['token'] = comprehensive[com.jg][com.year] const discipline = data.discipline - let disciplineTarget = this.data.discipline - - const dOrganization = [...this.objectOne(discipline)] + let maj = this.data.maj const [dOrganizationKey, dOrganizationValue] = Object.entries(discipline)[0] - disciplineTarget['organization'] = dOrganization - if (!disciplineTarget['organizationKey']) disciplineTarget['organizationKey'] = dOrganizationKey - if (!disciplineTarget['majorKey']) disciplineTarget['majorKey'] = Object.entries(dOrganizationValue)[0][0] + if (!maj['jg']) maj['jg'] = dOrganizationKey + if (!maj['major']) maj['major'] = Object.entries(dOrganizationValue)[0][0] - const dYear = [...this.collectYears(discipline)] - dYear.sort((a, b) => b - a); + const dYear = [...this.collectYears(discipline)].sort((a, b) => b - a); - if (!disciplineTarget['yearKey']) disciplineTarget['yearKey'] = dYear[0] - disciplineTarget['obj'] = discipline - - this.checkDisciplineYear() + if (!maj['year']) maj['year'] = dYear[0] + maj['token'] = discipline[maj.jg][maj.major][maj.year] this.setData({ - comprehensive: comprehensiveTarget, - discipline: disciplineTarget, + comOption: comprehensive, + com, + majOption: discipline, + maj, isInitFinish: true, }) - if (this.data.classify == 'school') this.haveComprehensive() - else this.haveDiscipline() + if (this.data.classify == 'school') this.getSynthesizeData() + else this.getMajorData() if (!this.indexSidebar) this.indexSidebar = this.selectComponent('#index-sidebar') @@ -270,14 +235,9 @@ Page({ collectYears(obj, arr = new Set()) { for (let key in obj) { if (obj.hasOwnProperty(key)) { - if (!isNaN(key) && key.length === 4) { - arr.add(key); - } - + if (!isNaN(key) && key.length === 4) arr.add(key); const value = obj[key]; - if (typeof value === 'object' && value !== null) { - this.collectYears(value, arr); - } + if (typeof value === 'object' && value !== null) this.collectYears(value, arr); } } return [...arr]; @@ -287,15 +247,9 @@ Page({ cutClassify(e) { 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() - + if (classify == 'subject' && this.data.majList.length == 0) this.getMajorData() + if (classify == 'school' && this.data.comList.length == 0) this.getSynthesizeData() this.setData({ classify, }) @@ -334,250 +288,20 @@ Page({ cutOnlyXg() { const classify = this.data.classify if (classify == 'school') { - let comprehensive = this.data.comprehensive - comprehensive['only'] = comprehensive['only'] == 1 ? 0 : 1 - - comprehensive['list'] = [] this.setData({ - comprehensive, + comList: [], + comOnly: this.data.comOnly == 1 ? 0 : 1, }) - this.getSynthesizeData() } else { - let discipline = this.data.discipline - discipline['only'] = discipline['only'] == 1 ? 0 : 1 - discipline['list'] = [] this.setData({ - discipline, + majOnly: this.data.majOnly == 1 ? 0 : 1, + majList: [], }) this.getMajorData() } }, - // 选择机构 - 综合 - selectOrganicComprehensive(e) { - let key = e.currentTarget.dataset.key - - // const key = e.currentTarget.dataset.key - let comprehensive = this.data.comprehensive - comprehensive['organizationKey'] = key - this.setData({ - comprehensive, - }) - this.checkComprehensiveYear() - }, - - // 判断是否存在值 综合 检查 年份 - checkComprehensiveYear() { - const comprehensive = this.data.comprehensive - const obj = comprehensive.obj - const target = obj[comprehensive.organizationKey] - - let year = this.objectOne(target) || [] - - year.sort((a, b) => b - a); - - if (!year.includes(comprehensive.yearKey)) comprehensive.yearKey = year[0] - - comprehensive['year'] = year - this.setData({ - comprehensive - }) - }, - - // 选择年份 - 综合 - selectYearComprehensive(e) { - const key = e.currentTarget.dataset.key - let comprehensive = this.data.comprehensive - comprehensive['yearKey'] = key - this.setData({ - comprehensive, - }) - }, - - // 选择机构 - 专业 - selectOrganicMajor(e) { - const key = e.currentTarget.dataset.key - let discipline = this.data.discipline - discipline['organizationKey'] = key - discipline['majorKey'] = "" - - this.setData({ - discipline - }) - - // this.checkDisciplineYear() - this.selectFirstMajorInRanking() - }, - - // 选中专业排名后 默认选择 第一个专业 - selectFirstMajorInRanking() { - let discipline = this.data.discipline - const organizationKey = discipline.organizationKey - - const obj = discipline.obj - - let majorsList = {} - majorsList = obj[organizationKey] - - - const majorKey = Object.keys(majorsList)[0] || '' - const yearObj = majorsList[majorKey] - const yearList = Object.keys(yearObj) - yearList.sort((a, b) => b - a); - - discipline['majorKey'] = majorKey - discipline['year'] = yearList - discipline['yearKey'] = yearList[0] - this.setData({ - discipline, - }) - }, - - // 判断是否存在值 专业 检查 年份 - checkDisciplineYear() { - const discipline = this.data.discipline - const obj = discipline.obj - const target = obj[discipline.organizationKey] - - let year = this.collectYears(target) || [] - year.sort((a, b) => b - a); - if (!year.includes(discipline.yearKey)) discipline.yearKey = year[0] - discipline['year'] = year - - // if (year.length == 1) discipline.yearKey = year[0] - - this.setData({ - discipline - }) - }, - - // 选择年份 - 综合 - selectYearDiscipline(e) { - const key = e.currentTarget.dataset.key - let discipline = this.data.discipline - discipline['yearKey'] = key - this.setData({ - discipline, - }) - }, - - // 打开专业弹窗 - opneMajorPop() { - let discipline = this.data.discipline - - const organizationKey = discipline.organizationKey - const yearKey = discipline.yearKey - - // discipline['yearKey'] = "" - - const obj = discipline.obj - if (!organizationKey) { - wx.showToast({ - icon: "none", - title: '请先选择评榜机构', - }) - return - } - let majorsList = {} - // 没有 选择年份的情况下 - majorsList = obj[organizationKey] - - this.setData({ - majorsList, - territoryState: true, - screenState: false, - }) - }, - - // 关闭 专业选择 - closeselect(e) { - const yearList = e.detail?.yearList || [] - - yearList.sort((a, b) => b - a); - - const key = e.detail?.key || '' - - if (!key) { - this.setData({ - territoryState: false, - screenState: true, - }) - } - - let discipline = this.data.discipline - - discipline['majorKey'] = key - discipline['year'] = yearList - if (!yearList.includes(discipline.yearKey)) discipline.yearKey = "" - - discipline.yearKey = yearList[0] - - this.setData({ - territoryState: false, - screenState: true, - discipline, - }) - }, - - // 选好了 综合 - haveComprehensive() { - let comprehensive = this.data.comprehensive - const organizationKey = comprehensive['organizationKey'] - const yearKey = comprehensive['yearKey'] - - if (!organizationKey) this.selectionPrompt("请选择评榜机构") - if (!yearKey) this.selectionPrompt("请选择年份") - - if (!organizationKey || !yearKey) return - - const obj = comprehensive['obj'] - - const organizationValue = obj[organizationKey] - const token = organizationValue[yearKey] - comprehensive['token'] = token - - this.setData({ - comprehensive - }) - - this.getSynthesizeData() - - }, - - // 选好了 专业 - haveDiscipline() { - let discipline = this.data.discipline - const organizationKey = discipline['organizationKey'] - const majorKey = discipline['majorKey'] - const yearKey = discipline['yearKey'] - - if (!organizationKey) this.selectionPrompt("请选择评榜机构") - if (!majorKey) this.selectionPrompt("请选择专业") - if (!yearKey) this.selectionPrompt("请选择年份") - if (!organizationKey || !majorKey || !yearKey) return - - const obj = discipline['obj'] - - const organizationValue = obj[organizationKey] - const majorValue = organizationValue[majorKey] - const token = majorValue[yearKey] - discipline['token'] = token - this.setData({ - discipline - }) - - this.getMajorData() - }, - - //选择提示 - selectionPrompt(title) { - wx.showToast({ - icon: "none", - title, - }) - }, - // 跳转学校主页 goSchoolHomepage(e) { const sid = e.currentTarget.dataset.sid @@ -593,12 +317,6 @@ Page({ }) }, - goDetails(e) { - return - const id = e.currentTarget.dataset.id - common.goPage(`/pages/projectDetails/projectDetails?id=${id}`) - }, - /** * 生命周期函数--监听页面初次渲染完成 */ @@ -658,4 +376,18 @@ Page({ title: "【寄托港校项目库】- 榜单", } }, + + // 点击 筛选的选好了 + haveChosen(e) { + const detail = e.detail || {} + const classify = this.data.classify + + this.setData({ + [classify == "school" ? 'com' : 'maj']: detail, + screenState: false, + }) + + if (classify == "school") this.getSynthesizeData() + else this.getMajorData() + }, }) \ No newline at end of file diff --git a/pages/projectList/projectList.json b/pages/projectList/projectList.json index 9ebdfd1..fa1e45d 100644 --- a/pages/projectList/projectList.json +++ b/pages/projectList/projectList.json @@ -2,7 +2,7 @@ "enablePullDownRefresh": false, "usingComponents": { "header-nav": "/component/headerNav/headerNav", - "territory-select": "/component/territorySelect/territorySelect", - "index-sidebar": "/component/indexSidebar/indexSidebar" + "index-sidebar": "/component/indexSidebar/indexSidebar", + "project-list-screen": "/component/project-list-screen/project-list-screen" } } \ No newline at end of file diff --git a/pages/projectList/projectList.wxml b/pages/projectList/projectList.wxml index 68142ac..56f3df4 100644 --- a/pages/projectList/projectList.wxml +++ b/pages/projectList/projectList.wxml @@ -32,13 +32,13 @@ - {{ comprehensive.organizeText }}世界综合排名({{ comprehensive.yearText }}年) + {{ com.jg }}世界综合排名({{ com.year }}年) - 共 {{ comprehensive.total }} 个排名 + 共 {{ comTotal }} 个排名 - + 仅显示香港学校 @@ -46,16 +46,13 @@ - - - {{ discipline.organizeText }} > {{ discipline.majorText }}({{ discipline.yearText }}年) - + {{ maj.jg }} > {{ maj.major }}({{ maj.year }}年) - 共 {{ discipline.total }} 个排名 + 共 {{ majTotal }} 个排名 - + 仅显示香港学校 @@ -63,7 +60,7 @@ - + {{ item.rank }} @@ -74,7 +71,6 @@ {{ item.enname }} ({{item.simple}}) - {{ item.city || '' }} @@ -87,7 +83,7 @@ - + @@ -96,57 +92,10 @@ 暂无数据 - - End - + - End - - - - 请选择 - - - 评榜机构 - - {{ item }} - - - - 年份 - - {{ item }} - - - - - - 评榜机构 - - {{ item }} - - - - 专业 - - {{ discipline.majorKey }} - 请选择 - - - - - 年份 - - {{ item }} - - - - - - 取消 - 选好了 - - - - - + \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index 41a2864..76e3cd8 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -1,13 +1,34 @@ { "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", - "projectname": "project", + "projectname": "%E5%B0%8F%E7%A8%8B%E5%BA%8F%20-%20%E9%A1%B9%E7%9B%AE%E5%BA%93", "setting": { - "compileHotReLoad": false, + "compileHotReLoad": true, "urlCheck": true }, "condition": { "miniprogram": { "list": [ + { + "name": "pages/projectList/projectList", + "pathName": "pages/projectList/projectList", + "query": "type=subject&system=QS&subject=Accounting%2520and%2520Finance&year=2023", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/projectAllList/projectAllList", + "pathName": "pages/projectAllList/projectAllList", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "pages/projectComparison/projectComparison", + "pathName": "pages/projectComparison/projectComparison", + "query": "ids=202%2C564", + "launchMode": "default", + "scene": null + }, { "name": "pages/projectSubjectList/projectSubjectList", "pathName": "pages/projectSubjectList/projectSubjectList", @@ -74,5 +95,5 @@ ] } }, - "libVersion": "development" + "libVersion": "trial" } \ No newline at end of file diff --git a/utils/util.js b/utils/util.js index f7b84d4..8b1c80e 100644 --- a/utils/util.js +++ b/utils/util.js @@ -402,6 +402,13 @@ function rpxTopx(value) { return px; } +// px转rpx +function pxToRpx(value) { + let deviceWidth = wx.getSystemInfoSync().windowWidth; // 获取设备屏幕宽度 + let rpx = Math.floor((750 / deviceWidth) * value); + return rpx; +} + function changeNum(num) { return num > 9 ? num : "0" + num; } @@ -619,4 +626,5 @@ module.exports = { statistics, bindingUser, objectToQueryString, + pxToRpx, }; \ No newline at end of file