diff --git a/src/views/dashboard/components/AlumniNews.vue b/src/views/dashboard/components/AlumniNews.vue index ff66ff3..24c85d4 100644 --- a/src/views/dashboard/components/AlumniNews.vue +++ b/src/views/dashboard/components/AlumniNews.vue @@ -12,9 +12,9 @@
- + {{ page }} / {{ lastPage }} 页 · 共 {{ total }} 条 - +
@@ -28,17 +28,30 @@ export default { data() { return { rows: [], page: 1, lastPage: 1, total: 0, loading: false, error: false, sequence: 0, rotationTimer: null } }, created() { this.load(1) }, mounted() { - if (this.displayMode) { - this.rotationTimer = setInterval(() => { - if (!this.loading) this.load(this.page % this.lastPage + 1) - }, 15000) - } + if (this.displayMode) this.startRotation() }, beforeDestroy() { clearInterval(this.rotationTimer) this.sequence++ }, methods: { + startRotation() { + clearInterval(this.rotationTimer) + this.rotationTimer = setInterval(() => { + if (!this.loading) this.load(this.page % this.lastPage + 1) + }, 15000) + }, + changePage(direction) { + if (this.loading) return + const target = this.page + direction + if (this.displayMode) { + if (this.lastPage <= 1) return + this.startRotation() + this.load((target - 1 + this.lastPage) % this.lastPage + 1) + } else { + this.load(target) + } + }, originalUrl(value) { if (typeof value !== 'string' || !/^https?:\/\//i.test(value.trim())) return '' try { const url = new URL(value.trim()); return ['http:', 'https:'].includes(url.protocol) ? url.href : '' } catch (_) { return '' } diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index abbcaf0..af5fe22 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -89,32 +89,34 @@
-
{{ config.name }} -
+ +
-
课程体系
已开设期数
培养人数(去重)
-
-
+
-
{{ item.name }}
+ class="table-row" + > +
{{ item.name }}
{{ item.course_periods_total }}期
{{ item.course_signs_total }}人
-
+