From 0b487b6d685e844a196eb527e8a53cf42a7fc83f Mon Sep 17 00:00:00 2001 From: ywyonui Date: Wed, 9 Jul 2025 17:04:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=B5=84=E6=BA=90=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/base/server.ts | 12 + src/components/BasicListLayout/ListLayout.vue | 14 +- .../BasicListLayout/hooks/useLayout.ts | 45 +- .../BasicListLayout/type/useLayout.d.ts | 1 - .../BasicPicker/TimePicker/DatetimePicker.vue | 2 +- src/components/BasicSign/Sign.vue | 2 +- src/components/BasicTree/Tree.vue | 8 +- src/components/charts/u-charts.js | 12 +- .../view/routine/JiaoXueZiYuan/index.vue | 312 +++----- .../view/routine/JiaoXueZiYuan/indexList.vue | 721 +++++++----------- 10 files changed, 419 insertions(+), 710 deletions(-) diff --git a/src/api/base/server.ts b/src/api/base/server.ts index decae64..c6dc6e0 100644 --- a/src/api/base/server.ts +++ b/src/api/base/server.ts @@ -115,4 +115,16 @@ export const xsJzListByXsIdApi = async (params: any) => { return await get("/api/jz/getListByXsId", params); }; +// 教学资源树形 +export const typesFindTreeApi = async () => { + return await get("/api/types/qryTreeReturn"); +}; + +// 获取资源分页 +export const resourcesFindPageApi = async (params: any) => { + return await get("/api/resources/findPage", params); +}; + + + diff --git a/src/components/BasicListLayout/ListLayout.vue b/src/components/BasicListLayout/ListLayout.vue index 2451bc8..fb624bd 100644 --- a/src/components/BasicListLayout/ListLayout.vue +++ b/src/components/BasicListLayout/ListLayout.vue @@ -5,7 +5,7 @@ - + @@ -29,10 +29,10 @@ diff --git a/src/components/BasicListLayout/hooks/useLayout.ts b/src/components/BasicListLayout/hooks/useLayout.ts index 33df640..b55d0b7 100644 --- a/src/components/BasicListLayout/hooks/useLayout.ts +++ b/src/components/BasicListLayout/hooks/useLayout.ts @@ -1,5 +1,5 @@ import {isFunction} from "lodash"; -import {Ref, ref, nextTick} from "vue"; +import {Ref} from "vue"; import {hideLoading, showLoading} from "@/utils/uniapp"; import type { LayoutCallback, @@ -13,46 +13,22 @@ import type { export function useLayout(options: LayoutOptions): UseLayoutInterfaceReturn { let methods: Ref - let dataListRef: Ref | undefined - - // 强制设置concat为false,使用完整数据模式 - if (!options.componentProps) options.componentProps = {}; - options.componentProps.concat = false; - - // 用于维护所有已加载数据 - const allData = ref([]); async function requestApi(pageNo: number, pageSize: number) { if (isFunction(options.api)) { try { - const result = await options.api(Object.assign({}, { - pageNo: pageNo, - pageSize: pageSize - }, options.param)) + let params = Object.assign({}, { + rows: pageSize, + page: pageNo + }, options.param) + const result = await options.api(params) await nextTick() if (methods.value) { - let newList = result[options.resultKey || 'rows'] || []; - if (pageNo === 1) { - allData.value = [...newList]; - if (dataListRef) dataListRef.value = allData.value; - } else { - // 合并去重 - const map = new Map(); - [...allData.value, ...newList].forEach(item => { - map.set(item.id, item); - }); - allData.value = Array.from(map.values()); - if (dataListRef) dataListRef.value = allData.value; - } - const hasMoreData = newList.length > 0; - if (!hasMoreData) { - await methods.value.completeByNoMore(allData.value as any, true); - return; - } else { - await methods.value.complete(allData.value as any); - } + // @ts-ignore + await methods.value.complete(result[options.resultKey || 'rows']) } } catch (err) { + console.log('err', err) if (methods.value) { await methods.value.complete(false); } @@ -64,9 +40,8 @@ export function useLayout(options: LayoutOptions): UseLayoutInterfaceReturn { options.query = requestApi } - const register = (callback: LayoutCallback, pagingRef: Ref, listRef?: Ref) => { + const register = (callback: LayoutCallback, pagingRef: Ref) => { methods = pagingRef - dataListRef = listRef callback(options) } return [register, diff --git a/src/components/BasicListLayout/type/useLayout.d.ts b/src/components/BasicListLayout/type/useLayout.d.ts index d449e22..1dcf5b4 100644 --- a/src/components/BasicListLayout/type/useLayout.d.ts +++ b/src/components/BasicListLayout/type/useLayout.d.ts @@ -16,7 +16,6 @@ interface LayoutOptions { createdReload?: boolean //组件created时立即触发reload(可解决一些情况下先看到页面再看到loading的问题),auto为true时有效。为否时将在mounted+nextTick后触发reload autoCleanListWhenReload?: boolean //reload时立即自动清空原list,若立即自动清空,则在reload之后、请求回调之前页面是空白的 fixed?: boolean //z-paging是否使用fixed布局,若使用fixed布局,则z-paging的父view无需固定高度,z-paging高度默认铺满屏幕,页面中的view请放在z-paging标签内,需要固定在顶部的view使用slot="top"包住,需要固定在底部的view使用slot="bottom"包住。 - concat?: boolean //自动拼接complete中传过来的数组 } } diff --git a/src/components/BasicPicker/TimePicker/DatetimePicker.vue b/src/components/BasicPicker/TimePicker/DatetimePicker.vue index ceed04f..946ee9b 100644 --- a/src/components/BasicPicker/TimePicker/DatetimePicker.vue +++ b/src/components/BasicPicker/TimePicker/DatetimePicker.vue @@ -79,7 +79,7 @@ export default { minDate: { type: Number, // 最小默认值为前10年 - default: new Date(new Date().getFullYear() - 80, 0, 1).getTime() + default: new Date(new Date().getFullYear() - 10, 0, 1).getTime() }, // 可选的最小小时,仅mode=time有效 minHour: { diff --git a/src/components/BasicSign/Sign.vue b/src/components/BasicSign/Sign.vue index f5f9187..ef42b32 100644 --- a/src/components/BasicSign/Sign.vue +++ b/src/components/BasicSign/Sign.vue @@ -407,7 +407,7 @@ export default { background: #FFF; margin: 10px 0; width: 90vw; - height: 90vh; + height: 88vh; align-self: center; // pointer-events:none; } diff --git a/src/components/BasicTree/Tree.vue b/src/components/BasicTree/Tree.vue index ddb190f..6bc7359 100644 --- a/src/components/BasicTree/Tree.vue +++ b/src/components/BasicTree/Tree.vue @@ -170,10 +170,10 @@ export default { parentArr = [...parents] delete parentArr.children parentid.push(item[this.idKey]); - // 保留所有原始字段,而不仅仅是 key 和 title - const parentItem = { ...item }; - delete parentItem.children; // 移除 children 字段避免循环引用 - parentArr.push(parentItem); + parentArr.push({ + [this.idKey]: item[this.idKey], + [this.rangeKey]: item[this.rangeKey] + }) this._renderTreeList(item.children, rank + 1, parentid, parentArr); } else { this.treeList[this.treeList.length - 1].lastRank = true; diff --git a/src/components/charts/u-charts.js b/src/components/charts/u-charts.js index f78bde5..6d49fad 100644 --- a/src/components/charts/u-charts.js +++ b/src/components/charts/u-charts.js @@ -4735,6 +4735,7 @@ function drawYAxis(series, opts, config, context) { let textAlign = yData.textAlign || "right"; //画Y轴刻度及文案 rangesFormat.forEach(function(item, index) { + var label = opts.yAxis.format(item); var pos = points[index]; context.beginPath(); context.setFontSize(yAxisFontSize); @@ -4764,7 +4765,7 @@ function drawYAxis(series, opts, config, context) { context.setTextAlign('center'); tmpstrat = tStartLeft - yAxisWidth.width / 2 } - context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); + context.fillText(String(label), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); } else if (yAxisWidth.position == 'right') { //画刻度线 @@ -4786,7 +4787,7 @@ function drawYAxis(series, opts, config, context) { context.setTextAlign('center'); tmpstrat = tStartRight + yAxisWidth.width / 2 } - context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); + context.fillText(String(label), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); } else if (yAxisWidth.position == 'center') { //画刻度线 if (yData.calibration == true) { @@ -4808,7 +4809,7 @@ function drawYAxis(series, opts, config, context) { context.setTextAlign('center'); tmpstrat = tStartCenter - yAxisWidth.width / 2 } - context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); + context.fillText(String(label), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); } context.closePath(); context.stroke(); @@ -7016,7 +7017,10 @@ var uCharts = function uCharts(opts) { dashLength: 4 * opts.pix, gridColor: '#cccccc', padding: 10, - fontColor: '#666666' + fontColor: '#666666', + format: function format(val) { + return val; + } }, opts.yAxis); opts.xAxis = assign({}, { rotateLabel: false, diff --git a/src/pages/view/routine/JiaoXueZiYuan/index.vue b/src/pages/view/routine/JiaoXueZiYuan/index.vue index 863f350..4e9ec9e 100644 --- a/src/pages/view/routine/JiaoXueZiYuan/index.vue +++ b/src/pages/view/routine/JiaoXueZiYuan/index.vue @@ -1,214 +1,116 @@ @@ -232,33 +134,33 @@ onMounted(() => { width: 280rpx; background: #ffffff; border-right: 1px solid #e5e5e5; - + .subject-list { height: 100%; } - + .subject-item { padding: 30rpx 20rpx; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: all 0.3s ease; text-align: center; - + .subject-name { font-size: 28rpx; color: #666666; display: block; } - + &.active { background: #fff3e0; - + .subject-name { color: #ff9800; font-weight: 600; } } - + &:hover:not(.active) { background: #f8f9fa; } @@ -280,7 +182,7 @@ onMounted(() => { .grade-section { margin-bottom: 40rpx; flex-shrink: 0; - + .section-title { font-size: 32rpx; font-weight: 600; @@ -304,16 +206,16 @@ onMounted(() => { border-radius: 8rpx; cursor: pointer; transition: all 0.3s ease; - + .type-text { font-size: 28rpx; color: #666666; } - - &:hover { + + &.active { border-color: #ff9800; background: #fff3e0; - + .type-text { color: #ff9800; } @@ -335,16 +237,16 @@ onMounted(() => { cursor: pointer; transition: all 0.3s ease; text-align: center; - + .grade-text { font-size: 28rpx; color: #666666; } - + &:hover { border-color: #ff9800; background: #fff3e0; - + .grade-text { color: #ff9800; } @@ -357,7 +259,7 @@ onMounted(() => { display: flex; align-items: center; justify-content: center; - + .empty-text { font-size: 28rpx; color: #999999; @@ -369,25 +271,25 @@ onMounted(() => { .left-panel { width: 150rpx; } - + .subject-item { padding: 20rpx 10rpx; - + .subject-name { font-size: 12px; } } - + .right-panel { padding: 20rpx; } - + .tag-item { padding: 10rpx 18rpx; - + .tag-text { font-size: 12px; } } } - \ No newline at end of file + \ No newline at end of file diff --git a/src/pages/view/routine/JiaoXueZiYuan/indexList.vue b/src/pages/view/routine/JiaoXueZiYuan/indexList.vue index 5790ba6..5cf4005 100644 --- a/src/pages/view/routine/JiaoXueZiYuan/indexList.vue +++ b/src/pages/view/routine/JiaoXueZiYuan/indexList.vue @@ -1,468 +1,287 @@