diff --git a/miniprogram/components/class-box-loading/class-box-loading.js b/miniprogram/components/class-box-loading/class-box-loading.js
new file mode 100644
index 0000000..b79c512
--- /dev/null
+++ b/miniprogram/components/class-box-loading/class-box-loading.js
@@ -0,0 +1 @@
+Component({});
diff --git a/miniprogram/components/class-box-loading/class-box-loading.json b/miniprogram/components/class-box-loading/class-box-loading.json
new file mode 100644
index 0000000..467ce29
--- /dev/null
+++ b/miniprogram/components/class-box-loading/class-box-loading.json
@@ -0,0 +1,3 @@
+{
+ "component": true
+}
diff --git a/miniprogram/components/class-box-loading/class-box-loading.wxml b/miniprogram/components/class-box-loading/class-box-loading.wxml
new file mode 100644
index 0000000..cc4d91f
--- /dev/null
+++ b/miniprogram/components/class-box-loading/class-box-loading.wxml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/miniprogram/components/class-box-loading/class-box-loading.wxss b/miniprogram/components/class-box-loading/class-box-loading.wxss
new file mode 100644
index 0000000..04271bd
--- /dev/null
+++ b/miniprogram/components/class-box-loading/class-box-loading.wxss
@@ -0,0 +1,154 @@
+:host {
+ display: block;
+ width: 100%;
+}
+
+.class-box-loading {
+ min-height: 100vh;
+ background: #f5f7fb;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.box-loader {
+ position: relative;
+ width: 210rpx;
+ height: 240rpx;
+ transform: translateY(-22rpx);
+}
+
+.falling-card {
+ position: absolute;
+ z-index: 1;
+ top: 8rpx;
+ left: 50%;
+ width: 102rpx;
+ height: 66rpx;
+ padding: 13rpx 14rpx;
+ border-radius: 10rpx;
+ box-sizing: border-box;
+ background: #ffffff;
+ border: 1rpx solid #dbe7f6;
+ box-shadow: 0 8rpx 18rpx rgba(30, 41, 59, 0.08);
+ opacity: 0;
+ transform: translate3d(-50%, -38rpx, 0) scale(0.94);
+ animation: card-drop 2.2s cubic-bezier(0.35, 0, 0.25, 1) infinite;
+}
+
+.card-two {
+ animation-delay: 0.42s;
+}
+
+.card-three {
+ animation-delay: 0.84s;
+}
+
+.card-accent {
+ width: 24rpx;
+ height: 7rpx;
+ border-radius: 999rpx;
+ background: #2563eb;
+}
+
+.card-two .card-accent {
+ background: #10b981;
+}
+
+.card-three .card-accent {
+ background: #8b5cf6;
+}
+
+.card-line {
+ height: 6rpx;
+ margin-top: 9rpx;
+ border-radius: 999rpx;
+ background: #dbe4ef;
+}
+
+.line-long {
+ width: 72rpx;
+}
+
+.line-short {
+ width: 48rpx;
+ margin-top: 7rpx;
+}
+
+.loader-box {
+ position: absolute;
+ z-index: 2;
+ left: 50%;
+ bottom: 8rpx;
+ width: 176rpx;
+ height: 104rpx;
+ transform: translate3d(-50%, 0, 0);
+ transform-origin: 50% 100%;
+ animation: box-settle 2.2s ease-in-out infinite;
+}
+
+.box-back,
+.box-front,
+.box-rim {
+ position: absolute;
+ left: 0;
+ width: 100%;
+ box-sizing: border-box;
+}
+
+.box-back {
+ top: 13rpx;
+ height: 38rpx;
+ border-radius: 14rpx 14rpx 5rpx 5rpx;
+ background: #dceaff;
+ border: 2rpx solid #8ab7f2;
+}
+
+.box-front {
+ z-index: 3;
+ bottom: 0;
+ height: 78rpx;
+ border-radius: 8rpx 8rpx 18rpx 18rpx;
+ background: #eaf2ff;
+ border: 2rpx solid #8ab7f2;
+ box-shadow: 0 12rpx 24rpx rgba(37, 99, 235, 0.12);
+}
+
+.box-rim {
+ z-index: 4;
+ top: 22rpx;
+ height: 15rpx;
+ border-radius: 999rpx;
+ background: #ffffff;
+ border: 2rpx solid #8ab7f2;
+}
+
+@keyframes card-drop {
+ 0%, 8% {
+ opacity: 0;
+ transform: translate3d(-50%, -38rpx, 0) scale(0.94);
+ }
+ 14% {
+ opacity: 1;
+ }
+ 48% {
+ opacity: 1;
+ transform: translate3d(-50%, 80rpx, 0) scale(1);
+ }
+ 62%, 100% {
+ opacity: 0;
+ transform: translate3d(-50%, 128rpx, 0) scale(0.9);
+ }
+}
+
+@keyframes box-settle {
+ 0%, 46%, 56%, 65%, 75%, 84%, 94%, 100% {
+ transform: translate3d(-50%, 0, 0) scale(1);
+ }
+ 50%, 69%, 88% {
+ transform: translate3d(-50%, 5rpx, 0) scale(1.025, 0.97);
+ }
+ 53%, 72%, 91% {
+ transform: translate3d(-50%, -2rpx, 0) scale(0.99, 1.015);
+ }
+}
diff --git a/miniprogram/pages/admin-auth/admin-auth.json b/miniprogram/pages/admin-auth/admin-auth.json
index 1c39cde..96ee339 100644
--- a/miniprogram/pages/admin-auth/admin-auth.json
+++ b/miniprogram/pages/admin-auth/admin-auth.json
@@ -1,3 +1,6 @@
{
- "navigationBarTitleText": "管理员认证"
+ "navigationBarTitleText": "管理员认证",
+ "usingComponents": {
+ "class-box-loading": "/components/class-box-loading/class-box-loading"
+ }
}
diff --git a/miniprogram/pages/admin-auth/admin-auth.wxml b/miniprogram/pages/admin-auth/admin-auth.wxml
index 37877ad..092ea8d 100644
--- a/miniprogram/pages/admin-auth/admin-auth.wxml
+++ b/miniprogram/pages/admin-auth/admin-auth.wxml
@@ -1,11 +1,8 @@
-
-
- 管理员认证
- 身份检查中...
-
+
-
+
+
请先完成班级身份验证
完成验证后,班委可通过一次性邀请码开通管理员权限。
diff --git a/miniprogram/pages/class-assistant/class-assistant.json b/miniprogram/pages/class-assistant/class-assistant.json
index 36a467a..274b699 100644
--- a/miniprogram/pages/class-assistant/class-assistant.json
+++ b/miniprogram/pages/class-assistant/class-assistant.json
@@ -1,4 +1,7 @@
{
"navigationBarTitleText": "班级助手",
- "enablePullDownRefresh": false
+ "enablePullDownRefresh": false,
+ "usingComponents": {
+ "class-box-loading": "/components/class-box-loading/class-box-loading"
+ }
}
diff --git a/miniprogram/pages/class-assistant/class-assistant.wxml b/miniprogram/pages/class-assistant/class-assistant.wxml
index 4090b36..ab5c2a1 100644
--- a/miniprogram/pages/class-assistant/class-assistant.wxml
+++ b/miniprogram/pages/class-assistant/class-assistant.wxml
@@ -1,5 +1,7 @@
-
+
+
+
-
- 身份检查中...
- 正在确认班级成员身份
-
-
-
+
请先完成身份认证
认证后即可使用班级助手
diff --git a/miniprogram/pages/detail/detail.json b/miniprogram/pages/detail/detail.json
index efd1f82..1eb9228 100644
--- a/miniprogram/pages/detail/detail.json
+++ b/miniprogram/pages/detail/detail.json
@@ -1,3 +1,6 @@
{
- "navigationBarTitleText": "详情"
+ "navigationBarTitleText": "详情",
+ "usingComponents": {
+ "class-box-loading": "/components/class-box-loading/class-box-loading"
+ }
}
diff --git a/miniprogram/pages/detail/detail.wxml b/miniprogram/pages/detail/detail.wxml
index b26f4b3..b62ec21 100644
--- a/miniprogram/pages/detail/detail.wxml
+++ b/miniprogram/pages/detail/detail.wxml
@@ -1,10 +1,8 @@
-
-
- 身份检查中...
-
+
-
+
+
请先完成班级身份验证
验证后即可查看事项详情
diff --git a/miniprogram/pages/favorites/favorites.json b/miniprogram/pages/favorites/favorites.json
index d8ae3a7..a4b4185 100644
--- a/miniprogram/pages/favorites/favorites.json
+++ b/miniprogram/pages/favorites/favorites.json
@@ -1,3 +1,6 @@
{
- "navigationBarTitleText": "我的收藏"
+ "navigationBarTitleText": "我的收藏",
+ "usingComponents": {
+ "class-box-loading": "/components/class-box-loading/class-box-loading"
+ }
}
diff --git a/miniprogram/pages/favorites/favorites.wxml b/miniprogram/pages/favorites/favorites.wxml
index a539e4a..edd868f 100644
--- a/miniprogram/pages/favorites/favorites.wxml
+++ b/miniprogram/pages/favorites/favorites.wxml
@@ -1,5 +1,7 @@
-
+
+
+
-
- 身份检查中...
-
-
-
+
请先完成班级身份验证
验证后即可查看已收藏的班级事项
diff --git a/miniprogram/pages/feedback/feedback.json b/miniprogram/pages/feedback/feedback.json
index 4ee9891..5051925 100644
--- a/miniprogram/pages/feedback/feedback.json
+++ b/miniprogram/pages/feedback/feedback.json
@@ -1,3 +1,6 @@
{
- "navigationBarTitleText": "意见反馈"
+ "navigationBarTitleText": "意见反馈",
+ "usingComponents": {
+ "class-box-loading": "/components/class-box-loading/class-box-loading"
+ }
}
diff --git a/miniprogram/pages/feedback/feedback.wxml b/miniprogram/pages/feedback/feedback.wxml
index 1a766d1..aa70462 100644
--- a/miniprogram/pages/feedback/feedback.wxml
+++ b/miniprogram/pages/feedback/feedback.wxml
@@ -1,11 +1,7 @@
-
-
- 身份检查中...
- 正在确认班级成员身份
-
+
-
+
diff --git a/miniprogram/pages/identity-select/identity-select.js b/miniprogram/pages/identity-select/identity-select.js
index 48af65b..5abb838 100644
--- a/miniprogram/pages/identity-select/identity-select.js
+++ b/miniprogram/pages/identity-select/identity-select.js
@@ -8,8 +8,18 @@ Page({
this.pageAlive = true;
},
onShow() {
+ this.hideNativeHomeButton();
this.checkIdentity();
},
+ hideNativeHomeButton() {
+ if (typeof wx.hideHomeButton !== "function") {
+ return;
+ }
+
+ wx.hideHomeButton({
+ fail: () => {},
+ });
+ },
onUnload() {
this.pageAlive = false;
},
diff --git a/miniprogram/pages/identity-select/identity-select.json b/miniprogram/pages/identity-select/identity-select.json
index c669f54..1ec9b36 100644
--- a/miniprogram/pages/identity-select/identity-select.json
+++ b/miniprogram/pages/identity-select/identity-select.json
@@ -1,3 +1,6 @@
{
- "navigationBarTitleText": "选择使用方式"
+ "navigationBarTitleText": "选择使用方式",
+ "usingComponents": {
+ "class-box-loading": "/components/class-box-loading/class-box-loading"
+ }
}
diff --git a/miniprogram/pages/identity-select/identity-select.wxml b/miniprogram/pages/identity-select/identity-select.wxml
index 284de4c..3eb10d9 100644
--- a/miniprogram/pages/identity-select/identity-select.wxml
+++ b/miniprogram/pages/identity-select/identity-select.wxml
@@ -1,15 +1,12 @@
-
+
+
+
选择使用方式
请选择适合你的方式进入班级盒子
-
- 身份检查中...
- 正在确认你的使用方式
-
-
-
+
班级成员
认证班级身份后,可使用班级通知、事项管理等完整功能。
diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js
index ead5149..39d1360 100644
--- a/miniprogram/pages/index/index.js
+++ b/miniprogram/pages/index/index.js
@@ -20,22 +20,52 @@ Page({
filteredNoticeList: [],
runningNoticeCount: 0,
importantNoticeCount: 0,
+ showHomeLoading: true,
authLoading: true,
verified: false,
isLoading: false,
loadError: false,
},
- authCheckPromise: null,
+ pageAlive: false,
+ homeRequestId: 0,
+ homeInitPromise: null,
isIdentityRouting: false,
onLoad() {
- this.checkMemberVerification();
+ this.pageAlive = true;
+ this.syncTabBarVisibility();
},
onShow() {
- this.checkMemberVerification();
+ this.runHomeInitialization();
+ this.syncTabBarVisibility();
+ },
+ onUnload() {
+ this.pageAlive = false;
+ this.homeRequestId += 1;
+ this.homeInitPromise = null;
+ },
+ syncTabBarVisibility() {
+ if (!this.pageAlive) {
+ return;
+ }
+
+ const method = this.isIdentityRouting || this.data.showHomeLoading
+ ? "hideTabBar"
+ : "showTabBar";
+
+ if (typeof wx[method] !== "function") {
+ return;
+ }
+
+ wx[method]({
+ animation: false,
+ fail: () => {},
+ });
},
onPullDownRefresh() {
- this.checkMemberVerification({
- stopRefresh: true,
+ const task = this.runHomeInitialization();
+
+ Promise.resolve(task).finally(() => {
+ wx.stopPullDownRefresh();
});
},
onShareAppMessage() {
@@ -51,49 +81,80 @@ Page({
query: "",
};
},
- // 在后续处理前验证输入和业务约束,失败时立即终止无效流程。
- checkMemberVerification(options = {}) {
- if (this.authCheckPromise) {
- return this.authCheckPromise;
+ isCurrentHomeRequest(requestId) {
+ return this.pageAlive && requestId === this.homeRequestId;
+ },
+ setHomeData(requestId, data) {
+ if (!this.isCurrentHomeRequest(requestId)) {
+ return Promise.resolve(false);
}
- this.setData({
- authLoading: true,
+ return new Promise((resolve) => {
+ if (!this.isCurrentHomeRequest(requestId)) {
+ resolve(false);
+ return;
+ }
+
+ this.setData(data, () => {
+ resolve(this.isCurrentHomeRequest(requestId));
+ });
});
+ },
+ runHomeInitialization() {
+ if (!this.pageAlive || this.isIdentityRouting) {
+ return Promise.resolve(null);
+ }
- const request = wx.cloud.callFunction({
- name: "checkAdmin",
- }).then((res) => {
- const result = res.result || {};
+ if (this.homeInitPromise) {
+ return this.homeInitPromise;
+ }
- if (!result.success) {
- throw new Error(result.message || "checkAdmin failed");
+ const requestId = ++this.homeRequestId;
+ const task = this.initializeHome(requestId).finally(() => {
+ if (this.homeInitPromise === task) {
+ this.homeInitPromise = null;
}
+ });
+
+ this.homeInitPromise = task;
+ return task;
+ },
+ async initializeHome(requestId) {
+ const loadingSet = await this.setHomeData(requestId, {
+ showHomeLoading: true,
+ authLoading: true,
+ loadError: false,
+ });
+
+ if (!loadingSet || !this.isCurrentHomeRequest(requestId)) {
+ return null;
+ }
- const verified = result.verified === true;
- const isMember = result.isMember === true || verified;
- const isGuest = result.isGuest === true;
+ this.syncTabBarVisibility();
- if (!isMember) {
- this.clearNoticeState();
+ let result;
- if (options.stopRefresh) {
- wx.stopPullDownRefresh();
- }
+ try {
+ const response = await wx.cloud.callFunction({
+ name: "checkAdmin",
+ });
- return this.routeByIdentity(isGuest
- ? "/pages/class-assistant/class-assistant"
- : "/pages/identity-select/identity-select");
+ if (!this.isCurrentHomeRequest(requestId)) {
+ return null;
}
- this.setData({
- authLoading: false,
- verified,
- });
+ result = response.result || {};
- return this.loadNotices(options);
- }).catch(() => {
- this.setData({
+ if (!result.success) {
+ throw new Error(result.message || "checkAdmin failed");
+ }
+ } catch (error) {
+ if (!this.isCurrentHomeRequest(requestId)) {
+ return null;
+ }
+
+ await this.setHomeData(requestId, {
+ showHomeLoading: false,
authLoading: false,
verified: false,
noticeList: [],
@@ -105,25 +166,50 @@ Page({
loadError: true,
});
- if (options.stopRefresh) {
- wx.stopPullDownRefresh();
+ if (this.isCurrentHomeRequest(requestId)) {
+ this.syncTabBarVisibility();
+ wx.showToast({
+ title: "网络超时,请稍后重试",
+ icon: "none",
+ });
}
- wx.showToast({
- title: "网络超时,请稍后重试",
- icon: "none",
- });
+
return null;
- }).finally(() => {
- if (this.authCheckPromise === request) {
- this.authCheckPromise = null;
+ }
+
+ if (!this.isCurrentHomeRequest(requestId)) {
+ return null;
+ }
+
+ const verified = result.verified === true;
+ const isMember = result.isMember === true || verified;
+ const isGuest = result.isGuest === true;
+
+ if (!isMember) {
+ await this.clearNoticeState(requestId);
+
+ if (!this.isCurrentHomeRequest(requestId)) {
+ return null;
}
+
+ return this.routeByIdentity(isGuest
+ ? "/pages/class-assistant/class-assistant"
+ : "/pages/identity-select/identity-select", requestId);
+ }
+
+ const memberSet = await this.setHomeData(requestId, {
+ authLoading: false,
+ verified,
});
- this.authCheckPromise = request;
- return request;
+ if (!memberSet) {
+ return null;
+ }
+
+ return this.loadNotices(requestId);
},
- clearNoticeState() {
- this.setData({
+ clearNoticeState(requestId) {
+ return this.setHomeData(requestId, {
noticeList: [],
importantNoticeList: [],
filteredNoticeList: [],
@@ -133,113 +219,146 @@ Page({
loadError: false,
});
},
- routeByIdentity(url) {
- if (this.isIdentityRouting) {
- return null;
+ routeByIdentity(url, requestId) {
+ if (this.isIdentityRouting || !this.isCurrentHomeRequest(requestId)) {
+ return Promise.resolve(false);
}
this.isIdentityRouting = true;
- wx.reLaunch({
- url,
- fail: () => {
- this.isIdentityRouting = false;
- this.setData({
- authLoading: false,
- verified: false,
- loadError: true,
- });
- wx.showToast({
- title: "页面打开失败,请重试",
- icon: "none",
- });
- },
+ this.syncTabBarVisibility();
+ return new Promise((resolve) => {
+ wx.reLaunch({
+ url,
+ success: () => resolve(true),
+ fail: async () => {
+ if (!this.isCurrentHomeRequest(requestId)) {
+ resolve(false);
+ return;
+ }
+
+ this.isIdentityRouting = false;
+ await this.setHomeData(requestId, {
+ showHomeLoading: false,
+ authLoading: false,
+ verified: false,
+ loadError: true,
+ });
+
+ if (this.isCurrentHomeRequest(requestId)) {
+ this.syncTabBarVisibility();
+ wx.showToast({
+ title: "页面打开失败,请重试",
+ icon: "none",
+ });
+ }
+
+ resolve(false);
+ },
+ });
});
- return null;
},
// 读取并整理 loadNotices 所需的数据,异步完成后再同步业务状态。
- loadNotices(options = {}) {
- this.setData({
+ async loadNotices(requestId) {
+ const loadingSet = await this.setHomeData(requestId, {
+ showHomeLoading: true,
isLoading: true,
loadError: false,
});
- this.fetchVisibleNotices()
- .then((list) => {
- const noticeList = list.map((notice) => {
- const category = this.normalizeCategory(notice.category);
- const timeLabel = this.normalizeTimeLabel(notice.timeLabel || this.getDefaultTimeLabel(category));
- const isExpired = this.isNoticeExpired(notice);
- const courseText = String(notice.course || "").trim();
- const locationText = String(notice.location || notice.place || "").trim();
- const publisherNameText = this.getPublisherNameText(notice.publisherName);
-
- return {
- ...notice,
- category,
- displayCategory: this.getCategoryShortName(category),
- categoryClass: this.getCategoryClass(category),
- timeLabel,
- courseLabel: this.getCourseLabel(category),
- courseText,
- locationLabel: this.getLocationLabel(category),
- locationText,
- publisherNameText,
- isPinned: notice.isPinned === true,
- isExpired,
- statusText: isExpired ? "已过期" : "进行中",
- timeText: this.formatTimeRange(notice.deadline, notice.endTime),
- important: notice.important === true || notice.isImportant === true,
- place: notice.location,
- };
- }).sort((a, b) => {
- if (a.isPinned !== b.isPinned) {
- return a.isPinned ? -1 : 1;
- }
+ if (!loadingSet || !this.isCurrentHomeRequest(requestId)) {
+ return null;
+ }
- const sortResult = this.getSortTime(a) - this.getSortTime(b);
+ this.syncTabBarVisibility();
- if (sortResult !== 0) {
- return sortResult;
- }
+ try {
+ const list = await this.fetchVisibleNotices();
- return String(a.deadline || "").localeCompare(String(b.deadline || ""));
- });
+ if (!this.isCurrentHomeRequest(requestId)) {
+ return null;
+ }
- this.setData({
- noticeList,
- importantNoticeList: this.getImportantNoticeList(noticeList),
- runningNoticeCount: noticeList.filter((notice) => !notice.isExpired).length,
- importantNoticeCount: noticeList.filter((notice) => !notice.isExpired && (notice.important === true || notice.isImportant === true)).length,
- isLoading: false,
- loadError: false,
- }, () => {
- this.filterNotices();
-
- if (options.stopRefresh) {
- wx.stopPullDownRefresh();
- }
- });
- })
- .catch(() => {
- this.setData({
- noticeList: [],
- importantNoticeList: [],
- filteredNoticeList: [],
- runningNoticeCount: 0,
- importantNoticeCount: 0,
- isLoading: false,
- loadError: true,
- });
+ const noticeList = list.map((notice) => {
+ const category = this.normalizeCategory(notice.category);
+ const timeLabel = this.normalizeTimeLabel(notice.timeLabel || this.getDefaultTimeLabel(category));
+ const isExpired = this.isNoticeExpired(notice);
+ const courseText = String(notice.course || "").trim();
+ const locationText = String(notice.location || notice.place || "").trim();
+ const publisherNameText = this.getPublisherNameText(notice.publisherName);
+
+ return {
+ ...notice,
+ category,
+ displayCategory: this.getCategoryShortName(category),
+ categoryClass: this.getCategoryClass(category),
+ timeLabel,
+ courseLabel: this.getCourseLabel(category),
+ courseText,
+ locationLabel: this.getLocationLabel(category),
+ locationText,
+ publisherNameText,
+ isPinned: notice.isPinned === true,
+ isExpired,
+ statusText: isExpired ? "已过期" : "进行中",
+ timeText: this.formatTimeRange(notice.deadline, notice.endTime),
+ important: notice.important === true || notice.isImportant === true,
+ place: notice.location,
+ };
+ }).sort((a, b) => {
+ if (a.isPinned !== b.isPinned) {
+ return a.isPinned ? -1 : 1;
+ }
- if (options.stopRefresh) {
- wx.stopPullDownRefresh();
+ const sortResult = this.getSortTime(a) - this.getSortTime(b);
+
+ if (sortResult !== 0) {
+ return sortResult;
}
+ return String(a.deadline || "").localeCompare(String(b.deadline || ""));
+ });
+ const readySet = await this.setHomeData(requestId, {
+ noticeList,
+ importantNoticeList: this.getImportantNoticeList(noticeList),
+ filteredNoticeList: this.getFilteredNoticeList(noticeList),
+ runningNoticeCount: noticeList.filter((notice) => !notice.isExpired).length,
+ importantNoticeCount: noticeList.filter((notice) => !notice.isExpired && (notice.important === true || notice.isImportant === true)).length,
+ isLoading: false,
+ loadError: false,
+ showHomeLoading: false,
+ });
+
+ if (readySet && this.isCurrentHomeRequest(requestId)) {
+ this.syncTabBarVisibility();
+ }
+
+ return readySet;
+ } catch (error) {
+ if (!this.isCurrentHomeRequest(requestId)) {
+ return null;
+ }
+
+ await this.setHomeData(requestId, {
+ showHomeLoading: false,
+ noticeList: [],
+ importantNoticeList: [],
+ filteredNoticeList: [],
+ runningNoticeCount: 0,
+ importantNoticeCount: 0,
+ isLoading: false,
+ loadError: true,
+ });
+
+ if (this.isCurrentHomeRequest(requestId)) {
+ this.syncTabBarVisibility();
wx.showToast({
title: "加载失败,请下拉刷新重试",
icon: "none",
});
- });
+ }
+
+ return false;
+ }
},
async fetchVisibleNotices() {
const db = wx.cloud.database();
@@ -497,10 +616,11 @@ Page({
this.filterNotices();
});
},
- filterNotices() {
- const { activeCategory, activeStatus, searchKeyword, noticeList } = this.data;
+ getFilteredNoticeList(noticeList = this.data.noticeList) {
+ const { activeCategory, activeStatus, searchKeyword } = this.data;
const keyword = searchKeyword.toLowerCase();
- const filteredNoticeList = noticeList.filter((notice) => {
+
+ return noticeList.filter((notice) => {
const matchCategory = activeCategory === "全部" || this.normalizeCategory(notice.category) === activeCategory;
const matchStatus = activeStatus === "全部" || notice.statusText === activeStatus;
const searchableText = `${notice.title || ""}${notice.content || ""}${notice.course || ""}`.toLowerCase();
@@ -520,10 +640,11 @@ Page({
return String(a.deadline || "").localeCompare(String(b.deadline || ""));
});
-
+ },
+ filterNotices(callback) {
this.setData({
- filteredNoticeList,
- });
+ filteredNoticeList: this.getFilteredNoticeList(),
+ }, callback);
},
goDetail(e) {
const noticeId = e.currentTarget.dataset.noticeId;
diff --git a/miniprogram/pages/index/index.json b/miniprogram/pages/index/index.json
index 6d4bdc2..f556dd7 100644
--- a/miniprogram/pages/index/index.json
+++ b/miniprogram/pages/index/index.json
@@ -1,4 +1,7 @@
{
"navigationBarTitleText": "班级盒子",
- "enablePullDownRefresh": true
+ "enablePullDownRefresh": true,
+ "usingComponents": {
+ "class-box-loading": "/components/class-box-loading/class-box-loading"
+ }
}
diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml
index edab99a..01ecbd4 100644
--- a/miniprogram/pages/index/index.wxml
+++ b/miniprogram/pages/index/index.wxml
@@ -1,5 +1,7 @@
-
+
+
+
事项概览
@@ -17,12 +19,7 @@
-
- 身份检查中...
- 正在确认班级成员身份
-
-
-
+
请先完成班级身份验证
验证后即可查看班级事项列表
diff --git a/miniprogram/pages/my-posts/my-posts.json b/miniprogram/pages/my-posts/my-posts.json
index d2d5fd5..5130c1f 100644
--- a/miniprogram/pages/my-posts/my-posts.json
+++ b/miniprogram/pages/my-posts/my-posts.json
@@ -1,4 +1,7 @@
{
"navigationBarTitleText": "我发布的事项",
- "enablePullDownRefresh": true
+ "enablePullDownRefresh": true,
+ "usingComponents": {
+ "class-box-loading": "/components/class-box-loading/class-box-loading"
+ }
}
diff --git a/miniprogram/pages/my-posts/my-posts.wxml b/miniprogram/pages/my-posts/my-posts.wxml
index db5298f..13130cc 100644
--- a/miniprogram/pages/my-posts/my-posts.wxml
+++ b/miniprogram/pages/my-posts/my-posts.wxml
@@ -1,16 +1,13 @@
-
+
+
+
-
- 身份检查中...
- 正在确认管理权限
-
-
-
+
请先完成班级身份验证
diff --git a/miniprogram/pages/my/my.json b/miniprogram/pages/my/my.json
index 4ec55be..9874c68 100644
--- a/miniprogram/pages/my/my.json
+++ b/miniprogram/pages/my/my.json
@@ -1,3 +1,6 @@
{
- "navigationBarTitleText": "我的"
+ "navigationBarTitleText": "我的",
+ "usingComponents": {
+ "class-box-loading": "/components/class-box-loading/class-box-loading"
+ }
}
diff --git a/miniprogram/pages/my/my.wxml b/miniprogram/pages/my/my.wxml
index a00dd07..d956563 100644
--- a/miniprogram/pages/my/my.wxml
+++ b/miniprogram/pages/my/my.wxml
@@ -1,12 +1,9 @@
-
-
-
- 身份检查中...
- 正在同步你的班级身份
-
+
-
+
+
+
{{name}}
学号:{{studentId}}
diff --git a/miniprogram/pages/publish/publish.json b/miniprogram/pages/publish/publish.json
index a863bd2..c1cf9f5 100644
--- a/miniprogram/pages/publish/publish.json
+++ b/miniprogram/pages/publish/publish.json
@@ -1,3 +1,6 @@
{
- "navigationBarTitleText": "发布"
+ "navigationBarTitleText": "发布",
+ "usingComponents": {
+ "class-box-loading": "/components/class-box-loading/class-box-loading"
+ }
}
diff --git a/miniprogram/pages/publish/publish.wxml b/miniprogram/pages/publish/publish.wxml
index dfd0ee6..648fa79 100644
--- a/miniprogram/pages/publish/publish.wxml
+++ b/miniprogram/pages/publish/publish.wxml
@@ -1,10 +1,10 @@
-
- 权限加载中...
+
-
+
+
请先完成班级身份验证
验证后即可使用班级盒子主要功能