// pages/school/school.js import { getApi, postApi } from "../../apis/api"; Page({ /** * 页面的初始数据 */ data: { school: { id: 1, crewSchoolName: "新蔡海员培训学校", crewSchoolImgFileKey: "new/crew_school/2cd3fd6c-0de4-400c-a847-d7fa07ddd6d31746529627175.png", crewSchoolImgUrl: "https://hhd-shipping-1255802371.cos.ap-shanghai.myqcloud.com/new/crew_school/2cd3fd6c-0de4-400c-a847-d7fa07ddd6d31746529627175.png?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKID4xb091cy4tRikV0EBrGOGsCF1WkhMlum%26q-sign-time%3D1746529628%3B93158697600%26q-key-time%3D1746529628%3B93158697600%26q-header-list%3Dhost%26q-url-param-list%3D%26q-signature%3D659f4bedef396f033e75d39425a4fe00f93dca3c", crewSchoolIntroduce: "新蔡海员", crewSchoolSiteSize: 2000, crewSchoolAnnualGraduationNum: 500, createTime: "2024/02/01 00:00:00", }, noticeList: [ { id: 3, crewSchoolId: 1, trainingNoticeTitle: "测试公告", trainingNoticeImgFileKey: "new/crew_school_training_notice/31c56330-3e68-4204-860b-87925b0f24dd1746495769145.png", trainingNoticeImgUrl: "https://hhd-shipping-1255802371.cos.ap-shanghai.myqcloud.com/new/crew_school_training_notice/31c56330-3e68-4204-860b-87925b0f24dd1746495769145.png?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKID4xb091cy4tRikV0EBrGOGsCF1WkhMlum%26q-sign-time%3D1746495776%3B93158697600%26q-key-time%3D1746495776%3B93158697600%26q-header-list%3Dhost%26q-url-param-list%3D%26q-signature%3D53284698ccdc5d1cbafe36965c22375effbc3e84", trainingNoticeContent: "测试内容", postedBy: "汇很多", createTime: "2025/04/25 14:42:23", }, ], notice: { title: "海员培训课程将在2025年3月10-15日期间在新蔡学员举办", author: "汇很多", date: "2024-02-01", photoUrl: "../../images/new-version/pic.png", content: "为提高海员专业素质,满足航运业发展需求,我校定于2025年3月10日至15日开展新一期海员培训课程。本次培训主要面向有志于从事航海事业的学员,课程内容包括船舶操作技能、航海英语、海事法规、安全管理等方面。培训采用理论与实践相结合的方式,配备经验丰富的教师团队,使用先进的模拟设备,确保学员能够掌握必要的专业知识和实操技能。完成培训并通过考核的学员,将获得相应的培训证书。此次培训名额有限,请有意向的学员提前报名。学校将为学员提供良好的学习环境和完善的后勤保障服务。", }, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.getSchoolInfo(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() {}, /** * 生命周期函数--监听页面显示 */ onShow() { if (typeof this.getTabBar === "function" && this.getTabBar()) { this.getTabBar().setData({ selected: 5, }); } }, /** * 生命周期函数--监听页面隐藏 */ onHide() {}, /** * 生命周期函数--监听页面卸载 */ onUnload() {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom() {}, /** * 用户点击右上角分享 */ onShareAppMessage(res) { if (res.from === "button") { const title = res.target.dataset.title || "海员培训学校通知"; return { title: title, path: "/pages/school/school", }; } return { title: "海员培训学校通知", path: "/pages/school/school", }; }, makePhoneCall(e) { const phone = e.currentTarget.dataset.phone; if (phone) { wx.makePhoneCall({ phoneNumber: phone, }); } else { wx.showToast({ title: "电话号码不存在", icon: "none", }); } }, async getSchoolTrainingNoticeList() { let { data } = await postApi("/crew/school/training/notices", { currentPage: 1, size: 1000, crewSchoolId: this.data.school.id, }); if (data.status === 0) { this.setData({ noticeList: data.result, }); } else { this.setData({ noticeList: [], }); } }, async getSchoolInfo() { let { data } = await getApi("/crew/school/info", {}); if (data.status === 0) { this.setData({ school: data.result, }); this.getSchoolTrainingNoticeList(); } else { this.setData({ school: {}, }); } }, });