From db543cfee87aa9c47abb126f6b32684221b19971 Mon Sep 17 00:00:00 2001 From: A1300399510 Date: Tue, 11 Feb 2025 18:58:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=E4=B8=93=E4=B8=9A=E6=8E=92?= =?UTF-8?q?=E5=90=8D=E8=B7=B3=E8=BD=AC=E4=B8=93=E4=B8=9A=E6=8E=92=E5=90=8D?= =?UTF-8?q?=E3=80=81=E5=AF=B9=E6=AF=94=E9=A1=B5=E4=BF=AE=E6=94=B9=E5=88=86?= =?UTF-8?q?=E4=BA=ABtitle=E5=92=8C=E5=A4=B4=E9=83=A8=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E3=80=81=E5=88=A0=E9=99=A4=E4=B8=8D=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/projectComparison/projectComparison.js | 43 ++++--- .../projectComparison/projectComparison.less | 4 +- .../projectComparison/projectComparison.wxml | 8 +- .../projectComparison/projectComparison.wxss | 3 +- pages/projectDetails/projectDetails.js | 118 +++--------------- pages/projectDetails/projectDetails.wxml | 79 +----------- pages/projectList/projectList.js | 53 +++++--- pages/projectList/projectList.less | 5 + pages/projectList/projectList.wxml | 10 +- pages/projectList/projectList.wxss | 4 + pages/projectMy/projectMy.js | 37 ++---- .../projectSchoolHomepage.js | 4 +- .../projectSchoolHomepage.wxml | 30 +++-- project.private.config.json | 7 ++ 14 files changed, 137 insertions(+), 268 deletions(-) diff --git a/pages/projectComparison/projectComparison.js b/pages/projectComparison/projectComparison.js index 4c48c26..fde12be 100644 --- a/pages/projectComparison/projectComparison.js +++ b/pages/projectComparison/projectComparison.js @@ -309,23 +309,6 @@ Page({ }, - /** - * 用户点击右上角分享 - */ - // onShareAppMessage() { - // return { - // title: "【寄托港校项目库】 - 项目对比", - // } - // }, - // onShareTimeline() { - // util.statistics({ - // name: "share-timeline" - // }) - // return { - // title: "【寄托港校项目库】 - 项目对比", - // } - // }, - indexSidebar: null, windowHeight: 812, onPageScroll(e) { @@ -353,4 +336,30 @@ Page({ this.indexSidebar.openSidebarTwoHide() }, + + getShareTitle() { + const list = this.data.list || [] + let title = "港校项目对比:" + list.forEach((element, index) => { + title += "【" + element.schoolalias + " | " + element.name_zh + '】' + (index != list.length - 1 ? 'VS' : '') + }) + return title + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + return { + title: this.getShareTitle(), + } + }, + onShareTimeline() { + util.statistics({ + name: "share-timeline" + }) + return { + title: this.getShareTitle(), + } + }, }) \ No newline at end of file diff --git a/pages/projectComparison/projectComparison.less b/pages/projectComparison/projectComparison.less index 1116ee5..ff6400d 100644 --- a/pages/projectComparison/projectComparison.less +++ b/pages/projectComparison/projectComparison.less @@ -1,4 +1,5 @@ -view { +view, +navigator { box-sizing: border-box; font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; word-break: break-word; @@ -127,6 +128,7 @@ view { &.unfold { padding-bottom: 75rpx; + .more { display: flex; diff --git a/pages/projectComparison/projectComparison.wxml b/pages/projectComparison/projectComparison.wxml index b09320b..5054fe1 100644 --- a/pages/projectComparison/projectComparison.wxml +++ b/pages/projectComparison/projectComparison.wxml @@ -4,13 +4,13 @@ - {{ item.name_zh }} - {{ item.name_en }} - + {{ item.name_zh }} + {{ item.name_en }} + {{ item.schoolalias }} {{ item.semester.text }} - + diff --git a/pages/projectComparison/projectComparison.wxss b/pages/projectComparison/projectComparison.wxss index ac11ef0..49ddbb8 100644 --- a/pages/projectComparison/projectComparison.wxss +++ b/pages/projectComparison/projectComparison.wxss @@ -1,4 +1,5 @@ -view { +view, +navigator { box-sizing: border-box; font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC', sans-serif; word-break: break-word; diff --git a/pages/projectDetails/projectDetails.js b/pages/projectDetails/projectDetails.js index 59d52aa..b0e7014 100644 --- a/pages/projectDetails/projectDetails.js +++ b/pages/projectDetails/projectDetails.js @@ -184,7 +184,7 @@ Page({ const info = data.info || {} - const fields = ['tuition_fee', 'tuition_fee_per_credit', 'application_fee', 'admission_deposit']; + const fields = ['tuition_fee',]; fields.forEach(field => { const textKey = `${field}_text`; info[textKey] = common.formatNumberWithSpaces(info[field] || ''); @@ -413,7 +413,7 @@ Page({ }, onPageScroll(e) { - if (Math.random() > 0.5) return + // if (Math.random() > 0.5) return const scrollTop = e.scrollTop @@ -496,73 +496,7 @@ Page({ informationState: false }) }, - - // 打开状态 - cutState() { - if (!this.data.islogin) { - this.openLoginBtnState() - return - } - this.setData({ - stateState: !this.data.stateState, - }) - }, - - //监听键盘 - bindkeyboardheightchange(e) { - let keyboardHeight = e.detail.height || 0; - this.setData({ - keyboardHeight, - }); - }, - - // 监听输入 失去焦点 - bindblur() { - this.setData({ - keyboardHeight: 0, - }); - }, - - // 打开备注弹窗 - openRemark() { - if (!this.data.islogin) { - this.openLoginBtnState() - return - } - this.setData({ - remarkState: true, - remarkFocus: false, - remarkInput: this.data.remark, - }, () => { - this.setData({ - remarkFocus: true, - }) - }) - }, - - // 关闭备注 - closeRemark() { - this.setData({ - remarkState: false, - }) - }, - - // 确定备注 - confirmRemark() { - const contras = this.data.contras - util.wxpost("/api/project.user/remarks", { - token: contras.token, - remarks: this.data.remarkInput, - }).then(res => { - common.toast(res.message) - - this.setData({ - remark: this.data.remarkInput, - }) - - this.closeRemark() - }) - }, + // 点击 跳转 公共方法 goPage(e) { const url = e.currentTarget.dataset.url @@ -588,39 +522,6 @@ Page({ indexSidebar: null, windowHeight: 812, // 屏幕高度 - // 修改 项目 状态 - changeType(e) { - const typeid = e.currentTarget.dataset.typeid - const contras = this.data.contras - util.wxpost("/api/project.user/changeType", { - token: contras.token || '', - typeid, - }).then(res => { - if (res.code != 200) return - common.toast(res.message) - contras['typeid'] = typeid - this.cutState() - this.setData({ - contras, - }) - }) - }, - - delete() { - const contras = this.data.contras - util.wxpost("/api/project.user/delete", { - token: contras.token, - }).then(res => { - if (res.code != 200) return - common.toast(res.message) - contras['ismanage'] = 0 - this.setData({ - contras, - stateState: false, - }) - }) - }, - // 点击加入对比单 addComparison() { if (!this.data.islogin) { @@ -784,7 +685,6 @@ Page({ */ onShareAppMessage() { return { - // title: "【寄托港校项目库】 - " + this.data.info.name_zh, title: `【${ this.data.info.schoolalias || this.data.info.schoolname || '' }】 - ${this.data.info.name_zh}`, } }, @@ -802,4 +702,16 @@ Page({ quickAnswerState: !this.data.quickAnswerState }) }, + + // 跳转专业排名 + goProjectList(e) { + const rankings = this.data.info.rankings || [] + const index = e.currentTarget.dataset.index + let item = rankings[index] + item['system'] = encodeURIComponent(item['system']) + item['subject'] = encodeURIComponent(item['subject']) + wx.navigateTo({ + url: `/pages/projectList/projectList?year=${ item.year }&system=${item.system}&subject=${item.subject}`, + }) + }, }) \ No newline at end of file diff --git a/pages/projectDetails/projectDetails.wxml b/pages/projectDetails/projectDetails.wxml index 79e0795..5551312 100644 --- a/pages/projectDetails/projectDetails.wxml +++ b/pages/projectDetails/projectDetails.wxml @@ -80,29 +80,6 @@ - - {{ info.semester.text || '' }} @@ -121,7 +98,7 @@ - + {{ item.rank }} {{ rankingsObj[item.system].name }} @@ -141,20 +118,6 @@ 总学费 {{ info.tuition_fee_text || '待确认' }} - @@ -201,7 +164,7 @@ - + {{ item.rank }} @@ -306,20 +269,6 @@ 总学费 {{ info.tuition_fee_text || '待确认' }} - @@ -644,30 +593,6 @@ 可点击左侧“我的项目”进行项目对比或管理 - diff --git a/pages/projectList/projectList.js b/pages/projectList/projectList.js index d42fd4e..ae4de3d 100644 --- a/pages/projectList/projectList.js +++ b/pages/projectList/projectList.js @@ -67,11 +67,30 @@ Page({ university: data.university, universityArr, }) + + if (JSON.stringify(options) != "{}") { + let discipline = this.data.discipline || {} + discipline["yearKey"] = options.year + "" + discipline["organizationKey"] = this.decodeKey(options.system) + discipline["majorKey"] = this.decodeKey(options.subject) + this.setData({ + classify: "subject", + discipline, + }) + } + this.getRankings() }) }) }, + decodeKey(key) { + while (key !== decodeURIComponent(key)) { + key = decodeURIComponent(key); + } + return key; + }, + // 获取 综合排名 数据 getSynthesizeData() { let comprehensive = this.data.comprehensive @@ -132,7 +151,6 @@ Page({ title: '加载中...', }) let discipline = this.data.discipline - // console.log("discipline", discipline); util.wxget("/api/project.rankings/discipline", { token: discipline['token'], @@ -192,8 +210,6 @@ Page({ let yearsSet = [...this.collectYears(comprehensive)] yearsSet.sort((a, b) => b - a); - // console.log("yearsSet", yearsSet); - // comprehensiveTarget['year'] = yearsSet comprehensiveTarget['yearKey'] = yearsSet[0] comprehensiveTarget['obj'] = comprehensive @@ -205,13 +221,13 @@ Page({ const dOrganization = [...this.objectOne(discipline)] const [dOrganizationKey, dOrganizationValue] = Object.entries(discipline)[0] disciplineTarget['organization'] = dOrganization - disciplineTarget['organizationKey'] = dOrganizationKey - disciplineTarget['majorKey'] = Object.entries(dOrganizationValue)[0][0] + if (!disciplineTarget['organizationKey']) disciplineTarget['organizationKey'] = dOrganizationKey + if (!disciplineTarget['majorKey']) disciplineTarget['majorKey'] = Object.entries(dOrganizationValue)[0][0] + const dYear = [...this.collectYears(discipline)] dYear.sort((a, b) => b - a); - // disciplineTarget['year'] = dYear - disciplineTarget['yearKey'] = dYear[0] + if (!disciplineTarget['yearKey']) disciplineTarget['yearKey'] = dYear[0] disciplineTarget['obj'] = discipline this.checkDisciplineYear() @@ -222,9 +238,8 @@ Page({ isInitFinish: true, }) - if (!this.indexSidebar) this.indexSidebar = this.selectComponent('#index-sidebar') - - this.haveComprehensive() + if (this.data.classify == 'school') this.haveComprehensive() + else this.haveDiscipline() if (!this.indexSidebar) this.indexSidebar = this.selectComponent('#index-sidebar') @@ -263,11 +278,12 @@ Page({ if (classify == this.data.classify) return - let discipline = this.data.discipline + let discipline = this.data.discipline || {} // 切换 专业排名时 判断 是否需要 显示选择 - if (classify == 'subject' && discipline.list.length == 0) { - this.haveDiscipline() - } + 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, @@ -352,8 +368,6 @@ Page({ if (!year.includes(comprehensive.yearKey)) comprehensive.yearKey = year[0] - // if (year.length == 1) comprehensive.yearKey = year[0] - comprehensive['year'] = year this.setData({ comprehensive @@ -395,14 +409,11 @@ Page({ let majorsList = {} majorsList = obj[organizationKey] - // console.log(Object.keys(majorsList)[0]); const majorKey = Object.keys(majorsList)[0] || '' - // console.log("majorsList", majorsList[majorKey]); const yearObj = majorsList[majorKey] const yearList = Object.keys(yearObj) yearList.sort((a, b) => b - a); - // console.log("yearList", yearList); discipline['majorKey'] = majorKey discipline['year'] = yearList @@ -624,7 +635,9 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage() { - + return { + title: "【寄托港校项目库】- 榜单", + } }, onShareTimeline() { util.statistics({ diff --git a/pages/projectList/projectList.less b/pages/projectList/projectList.less index c5356f1..2e5c2a5 100644 --- a/pages/projectList/projectList.less +++ b/pages/projectList/projectList.less @@ -380,4 +380,9 @@ view { .index-sidebar { position: relative; z-index: 99; +} + +.empty { + flex-direction: column; + height: 50vh; } \ No newline at end of file diff --git a/pages/projectList/projectList.wxml b/pages/projectList/projectList.wxml index 4b580bf..a709c0c 100644 --- a/pages/projectList/projectList.wxml +++ b/pages/projectList/projectList.wxml @@ -77,7 +77,7 @@ - {{ item.city }} + {{ item.city || '' }} 学校主页 @@ -85,7 +85,15 @@ + + + + + + + + 暂无数据 - End - diff --git a/pages/projectList/projectList.wxss b/pages/projectList/projectList.wxss index 60642cf..76b3d67 100644 --- a/pages/projectList/projectList.wxss +++ b/pages/projectList/projectList.wxss @@ -321,3 +321,7 @@ view { position: relative; z-index: 99; } +.empty { + flex-direction: column; + height: 50vh; +} diff --git a/pages/projectMy/projectMy.js b/pages/projectMy/projectMy.js index d968ae1..edc0dd4 100644 --- a/pages/projectMy/projectMy.js +++ b/pages/projectMy/projectMy.js @@ -51,7 +51,6 @@ Page({ vsBottom: false, // 底部显示状态 - // isInitFinish: false, }, /** @@ -74,7 +73,6 @@ Page({ screen_data, islogin, manageHintState, - // isInitFinish: true, }) this.windowHeight = screen_data.windowHeight || 812 @@ -275,7 +273,6 @@ Page({ if (classify == this.data.classify) return this.setData({ classify, - // isInitFinish: false, }) if (this.data.classify == 'manage') { @@ -294,7 +291,6 @@ Page({ projectPage: 1, projectList: [], selectList: [], - // isInitFinish: true, }) this.getProjectList() this.getQuickList() @@ -487,28 +483,6 @@ Page({ let scrollTop = e.scrollTop this.scrollTop = scrollTop - let isFirstPattern = true - if (scrollTop > this.rpx219) isFirstPattern = false - - // if (this.data.isFirstPattern != isFirstPattern) { - // this.setData({ - // isFirstPattern, - // }) - // } - - // let sidebarState = this.indexSidebar.data.sidebarState - // if (scrollTop > this.windowHeight * 3 && sidebarState !== 3) sidebarState = 3 - - // if (scrollTop < this.windowHeight * 3 && sidebarState == 3) sidebarState = 2 - - // // 同一搜集 修改的 sidebarState - // if (sidebarState !== this.indexSidebar.data.sidebarState) { - // this.indexSidebar.setData({ - // sidebarState - // }) - // } - - // this.indexSidebar.openSidebarTwoHide() }, slowScrollNow: "", @@ -535,6 +509,14 @@ Page({ this.calculateManageHeight() }, + remarks: "", + focusfocus(e) { + const index = e.currentTarget.dataset.index + let list = this.data.list + console.log("list", list[index]); + this.remarks = list[index]['remarks'] + }, + bindblur(e) { const index = e.currentTarget.dataset.index let list = this.data.list @@ -548,7 +530,8 @@ Page({ }) const target = list[index] || {} - this.postRemarks(target.token, target.remarks) + if (this.remarks != target.remarks) this.postRemarks(target.token, target.remarks) + this.remarks = "" }, // 发送 备注 diff --git a/pages/projectSchoolHomepage/projectSchoolHomepage.js b/pages/projectSchoolHomepage/projectSchoolHomepage.js index 59b0c0f..3e7b263 100644 --- a/pages/projectSchoolHomepage/projectSchoolHomepage.js +++ b/pages/projectSchoolHomepage/projectSchoolHomepage.js @@ -636,7 +636,9 @@ Page({ * 用户点击右上角分享 */ onShareAppMessage() { - + return { + title: "【寄托港校项目库】- " + this.data.info.name, + } }, onShareTimeline() { util.statistics({ diff --git a/pages/projectSchoolHomepage/projectSchoolHomepage.wxml b/pages/projectSchoolHomepage/projectSchoolHomepage.wxml index 4b715cd..798d953 100644 --- a/pages/projectSchoolHomepage/projectSchoolHomepage.wxml +++ b/pages/projectSchoolHomepage/projectSchoolHomepage.wxml @@ -48,24 +48,22 @@ - - - - {{ item.name_zh }} - {{ item.name_en }} - - - - - - - - - - + + + {{ item.name_zh }} + {{ item.name_en }} + + + + - + + + + + + diff --git a/project.private.config.json b/project.private.config.json index 5627598..509f550 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -8,6 +8,13 @@ "condition": { "miniprogram": { "list": [ + { + "name": "pages/projectDetails/projectDetails", + "pathName": "pages/projectDetails/projectDetails", + "query": "uniqid=rD0Sj0auDPzX", + "launchMode": "default", + "scene": null + }, { "name": "pages/projectDetails/projectDetails", "pathName": "pages/projectDetails/projectDetails",