From 6e5379080c0393d8a6afba943b7f9ee1743ed2a2 Mon Sep 17 00:00:00 2001
From: Mrx <18278715334@163.com>
Date: Thu, 28 May 2026 14:54:32 +0800
Subject: [PATCH] f
---
project.config.json | 20 ++++
src/api/app.js | 7 ++
src/api/index.js | 1 +
src/pages/1.md | 89 +++++++++++++++
src/pages/index.vue | 220 ++++++++++++++++++++++++++++++------
src/pages/report.vue | 14 ++-
src/pages/toolbox/query.vue | 47 ++++++--
src/stores/case.js | 45 ++++++++
8 files changed, 392 insertions(+), 51 deletions(-)
create mode 100644 project.config.json
create mode 100644 src/api/app.js
create mode 100644 src/pages/1.md
create mode 100644 src/stores/case.js
diff --git a/project.config.json b/project.config.json
new file mode 100644
index 0000000..d7f618b
--- /dev/null
+++ b/project.config.json
@@ -0,0 +1,20 @@
+{
+ "description": "项目配置文件",
+ "packOptions": {
+ "ignore": []
+ },
+ "setting": {
+ "urlCheck": false,
+ "es6": true,
+ "postcss": false,
+ "minified": false,
+ "newFeature": true,
+ "bigPackageSizeSupport": true
+ },
+ "compileType": "miniprogram",
+ "libVersion": "",
+ "appid": "touristappid",
+ "projectname": "qnc-uniapp",
+ "miniprogramRoot": "dist/dev/mp-weixin/",
+ "condition": {}
+}
diff --git a/src/api/app.js b/src/api/app.js
new file mode 100644
index 0000000..5a1f8d4
--- /dev/null
+++ b/src/api/app.js
@@ -0,0 +1,7 @@
+import { http } from './http'
+
+/** 获取首页动态展示数据(案例和评价) */
+export async function getHomeDynamicData(params = {}) {
+ const res = await http.get('/app/home/dynamic', { params })
+ return res.data
+}
diff --git a/src/api/index.js b/src/api/index.js
index 962df7c..5b3d539 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -1,5 +1,6 @@
export * from './auth'
export { clearAuthStorage, http } from './http'
+export * from './app'
export * from './pay'
export * from './product'
export * from './query'
diff --git a/src/pages/1.md b/src/pages/1.md
new file mode 100644
index 0000000..5be650e
--- /dev/null
+++ b/src/pages/1.md
@@ -0,0 +1,89 @@
+
+
+
+
+
+三行向上滚动(速度不同)
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/index.vue b/src/pages/index.vue
index cfdb4c8..e07d34e 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -1,7 +1,12 @@
diff --git a/src/pages/toolbox/query.vue b/src/pages/toolbox/query.vue
index f84ee44..f22e115 100644
--- a/src/pages/toolbox/query.vue
+++ b/src/pages/toolbox/query.vue
@@ -3,6 +3,9 @@ import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getToolboxItem } from '@/config/toolboxRegistry'
import { postToolboxQuery } from '@/api/toolbox'
+import { useCaseStore } from '@/stores/case'
+
+const caseStore = useCaseStore()
definePage({
style: {
@@ -234,10 +237,9 @@ async function handleQuery() {
// 调试:打印表单值
console.log('提交的表单数据:', JSON.stringify(form.value))
- console.log('验证结果:', tool.value.validate(form.value))
-
- if (!tool.value.validate(form.value)) {
- error.value = tool.value.validateMsg
+
+ if (tool.value.validate && !tool.value.validate(form.value)) {
+ error.value = tool.value.validateMsg || '输入校验失败'
return
}
@@ -247,6 +249,15 @@ async function handleQuery() {
if (res.code === 200 && res.data?.result) {
result.value = res.data.result
+ // 实时推送到首页案例队列 (不经过数据库)
+ if (tool.value) {
+ caseStore.addCase({
+ tag: tool.value.name,
+ vin: '******',
+ model: '在线查询成功'
+ })
+ }
+
// 如果是游戏类工具
if (tool.value?.isGame) {
// 成语填字和诗词填空:准备选项
@@ -291,9 +302,10 @@ const resultEntries = computed(() => {
const val = result.value![key]
const display = val === '' || val === null ? '无' : val
if (typeof labelOrObj === 'object' && labelOrObj !== null) {
- return { key, label: labelOrObj.label, hidden: !!labelOrObj.hidden, value: display }
+ const obj = labelOrObj as any
+ return { key, label: obj.label || '', hidden: !!obj.hidden, value: display }
}
- return { key, label: labelOrObj, hidden: false, value: display }
+ return { key, label: String(labelOrObj), hidden: false, value: display }
})
})
@@ -318,9 +330,10 @@ const resultList = computed(() => {
})
const subResultList = computed(() => {
- if (!result.value || !tool.value?.subResultKey || !tool.value?.subResultLabels)
+ const currentTool = tool.value
+ if (!result.value || !currentTool?.subResultKey || !currentTool?.subResultLabels)
return []
- const sub = result.value[tool.value.subResultKey]
+ const sub = (result.value as Record)[currentTool.subResultKey]
if (!Array.isArray(sub))
return []
return sub
@@ -455,6 +468,18 @@ function handleRestart() {
}
handleQuery()
}
+
+// 辅助函数:安全获取标签和隐藏状态
+function getLabel(fieldLabel: any): string {
+ if (typeof fieldLabel === 'object' && fieldLabel !== null) {
+ return fieldLabel.label || ''
+ }
+ return String(fieldLabel)
+}
+
+function isFieldHidden(fieldLabel: any): boolean {
+ return typeof fieldLabel === 'object' && fieldLabel !== null && !!fieldLabel.hidden
+}
@@ -811,7 +836,7 @@ function handleRestart() {
{{ idx + 1 }}
- {{ typeof fieldLabel === 'object' ? fieldLabel.label : fieldLabel }}
+ {{ getLabel(fieldLabel) }}
{{ item[fieldKey] }}
@@ -836,9 +861,9 @@ function handleRestart() {
{{ idx + 1 }}
- {{ typeof fieldLabel === 'object' ? fieldLabel.label : fieldLabel }}
+ {{ getLabel(fieldLabel) }}
-
+
{
+ const caseQueue = ref([])
+
+ /**
+ * 向队列中添加一个案例
+ * @param {Object} item { id, tag, vin, model }
+ */
+ function addCase(item) {
+ // 将新案例插入到队列头部,这样下次滚动就能看到
+ caseQueue.value.unshift({
+ id: item.id || Date.now(),
+ tag: item.tag || '查询成功',
+ vin: item.vin || '******',
+ model: item.model || '未知工具',
+ })
+
+ // 保持队列长度,防止无限增长
+ if (caseQueue.value.length > 50) {
+ caseQueue.value.pop()
+ }
+ }
+
+ /**
+ * 批量更新队列(通常用于接口拉取)
+ */
+ function updateQueue(items) {
+ if (!items || items.length === 0) return
+
+ // 将新获取的数据合并到现有队列中
+ // 过滤掉已存在的 ID
+ const existingIds = new Set(caseQueue.value.map(c => c.id))
+ const newItems = items.filter(item => !existingIds.has(item.id))
+
+ caseQueue.value.push(...newItems)
+ }
+
+ return {
+ caseQueue,
+ addCase,
+ updateQueue
+ }
+})